The Highland Fling 2011 – Web Standard In Scotland

July 8th 2011 saw the welcome and eagerly anticipated return of “The Highland Fling — Web Standards in Scotland”.  Set up and organised by Alan White in 2007 to increase awareness of web standards and best practice, it’s the only conference of it’s kind in Scotland.  I’ve been fortunate enough to have been able to attend each conference, although there was a hiatus in 2009/2010.  The inaugural event really set the bar high for what could be achieved by a dedicated developer passionate about his work.

Continue reading

Revert to PHP 5.2 in Ubuntu 10.04 (Lucid Lynx)

Despite suppressing updates of my LAMP stack, the upgrade to Ubuntu 10.04 ignored that, and as such I now have PHP 5.3.X installed.  Ordinarilly this woud be fine, but one of the open source web applications I work with doesn’t play well with PHP 5.3.X.  I needed a simple way to revert to a previous 5.2.X version of PHP.  The version in the Ubuntu 9.10 (Karmic) repositories would do the trick, so it was jsut a case of forcing Ubuntu to honour the 9.10 versions of various PHP packages over the 10.04 versions.

First, we get a list of all the currently installed PHP packages:

sudo dpkg -l | grep php > /tmp/php.packages

Next we remove the currently installed PHP packages:

sudo apt-get remove --purge $(dpkg -l | grep php)

Now we need to create an alternative sources list:

sed s/lucid/karmic/g /etc/apt/sources.list |\
sudo tee /etc/apt/sources.list.d/karmic.list

Having done that, we need to generate an aptitude preferences file for PHP:

awk '{print "Package: " $0; print "Pin: release a=karmic\nPin-Priority: 991\n"}' /tmp/php.packages |\
sudo tee /etc/apt/preferences.d/php

This preferences file tells aptitude that for each listed package, we want to pin down the installation candidate to that from the Karmic repositories. We can now install the packages that we previously removed, but this time the versions from the Karmic repositories:

sudo apt-get update && apt-get install $(cat /tmp/php.packages | tr "\n" " ")

A quick restart of Apache and everything seems to be working with the older version of PHP!

UK Geocoding

After a little hard work, I’m releasing my attempt to address the shortfall in accurate UK geocoding services.  Courtesy of open data provided by Ordnance Survey Open Click-Point, some sed, SQLite, PHP and YQL I’ve produced a REST API, and a YQL datatable.  I’ve also written a more thorough account of this by way of documenation.

YQL Nutritional Data

My todo list has been telling me to play with Yahoo’s YQL for far too long now, so last night I did something about it.  YQL is a Yahoo SQL-like language that allows developers to easily aggregate data from various disparate data sources without having to go through the rigmarole of writing their own API.  There is a large selection of base tables that allow the developer to work with e.g. Flickr or Upcoming.  There is also a community contributed selection of tables (see datatables.org).  You can contribute to the project by forking the GitHub project and sending a pull request once you’ve committed changed to your tree.

That’s exactly what I did last night.  I did some digging and found the UK government’s data source for nutritional information, the “Composition of Foods” report.  To use the data, I had to apply for a free Click-Use license.  I didn’t have to specify what data I was using or how I was going to use it; it seemed more the case that I had to have my name added to a list of people who use government data in some way, shape or form.  Once I’d munged the data a bit, I created a CSV, and corresponding XML file as described by the DataTables documentation.

You can use my DataTable by querying YQL (or in the YQL-console) like this for example:

use "http://maxmanders.co.uk/lab/nutritionals/nutritionals.xml";
select * from nutritionals where name = 'banana';