06 Jan 2013
I've been trying to rationalise my websites a bit recently, and in particular finally put into mothballs what was probably my first website.
The site was first written in about 1999(!), and some of the code hasn't changed very much since then. The only part that is still really being used is a football prediction game called "Fantasy Island" - like fantasy football but a bit crap :-)
For me this was an interesting exercise in brushing up on my extremely rusty PHP skills, learning some new things about MySQL and looking back at some very old code. In particular there are a couple of things of note ...
- I've learnt a lot about coding in the last 14 years, as some of the old code is pretty ropey. In particular the way I (and hopefully everybody) think more about potential security issues is definitely a good thing.
- PHP is surprisingly similar to ASP Classic
The 2nd point is quite interesting, in particular given the slightly dismissive attitude that I've heard about PHP sometimes from people who were quite happy to develop in a very similar way not that long ago. Clearly it is easy to write "spaghetti code" in PHP and ASP, but unstructured code isn't a feature of any language, but more a function of the developer writing the code.
You can see the results of my handywork at http://www.yeltz.co.uk/fantasyisland/, and once I've done a final tidy up and fixed any bugs found now it's live I may share the code somewhere.
There were a couple of gotchas that tripped me up as I was doing the migration that I'll share here in case someone else hits them too.
DateTime->add() is not supported in PHP 5.2
I wanted to use a DateTime object to find a day 60 days from now, and on my dev box I was running PHP 5.4, so using the add() function seemed logical.
However what I didn't realise until later was that the server I've ported the code to is only running PHP 5.2.17, and a close look at the documentation showed the add() function was only supported in 5.3.0 and above.
The solution was to use the pretty self-explanatory following code:
$twoMonthsInterval = new DateTime();
Not as clean, but it works :-)
Use TINYINT(1) for boolean fields in MySQL
I had all sorts of issues which to be honest I didn't really understand when trying to retrieve data from a table that I'd set as a BOOL field in the database.
According to the documentation it's just a synonym for a TINYINT(1) field but when fetching the info via PDO I was getting incorrect values for some reason.
Anyway, directly setting the value to TINYINT(1) and setting/getting the 0 or 1 values directly fixed all of my issues.
09 Nov 2012
A minor, mainly bug fix release to our Bedside Clock for WP7 app has finally made it through the release process into the wild.
This change should hopefully fix some of the very occasional crashes being reported by the WIndows Phone Dev Center when the local weather forecast is being loaded.
Other than a few minor cosmetic changes - the settings page now follows the UI guidelines a bit better - it's still basically the same app as before.
Next step - which is still work in progress - is to make a Windows Phone 8 specific build using the improved features of the new OS.
If you see any issues with the update, feel free to drop us a line at email@example.com.
28 Aug 2012
After working on Bing for as long as it's been in existence - I was there back in the "Windows Live Search" days - I've now taken a position with the Skype team in London.
It will be a big change for me, and I'll really miss working with some of the smartest people I've ever met. However, I'm definitely ready to try something new and I'm very excited to move to Skype at what's a very exciting time.
I'll hopefully be learning lots of new skills and techniques - and reacquainting myself with some old ones! - so I'm also hoping I'll have some interesting things to post on here too.
15 Jul 2012
I've got several blogs than run on Posterous - including this one - but to be honest the default templates are all a little dull. Therefore I thought I'd have a go at building my own fully customised template.
Now as you can see I'm no designer, but I am reasonably pleased with the results so far with just a few remaining minor glitches.
This is fair enough for security reasons, but that means the dynamic features of the Bootstrap framework I'm using don't work - for example trying to use a dropdown in the top nav bar now fails. Unfortunately this means the navbar doesn't really match the one on the main BraveLocation website, but I don't think there is anything to be done about that.
The other main problem which I haven't solved yet is the injection of the Posterous control at the top right of the page messes up the size and hence the alignment of the top navbar is slightly off. More irritating than anything else, and I can live with that as my CSS skills aren't strong enough to bother seeing if I can solve it.
Aside from those small issues, overall it's really nice this blog now at least resembles the main website, and for me I'm pretty happy with the way both look.
14 Jul 2012
I got an email from Google saying I needed to update the manifest for my "Bing Translate" Chrome extension - which turned out to be slightly trickier than I thought.
According to the depreciation guide, developers need to update the manifest file that describes the extension properties to version 2 reasonably soon - although to be honnest without looking I have absolutely no idea what version Chrome is currently on.
The line I had to add to the manifest was:
"content_security_policy": "script-src 'self' https://api.microsofttranslator.com; object-src 'self'",
... a detailed explanation of which can be found on the Chrome Extensions documentation site
The key point to note is that this only works for https secure websites, but fortunately the Translator API also works via https://api.microsofttranslator.com, so once I'd figured that out everything worked again.
If you are one of the users of this slightly useful tool, please go to Tools->Extensions menu and click on "Update Extensions now" to get the updated v1.1.