Max says…

Avatar

thoughts of a web developer


Warning: DOMDocument::load() [function.DOMDocument-load]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load(http://maxmanders.co.uk/feed) [function.DOMDocument-load]: failed to open stream: Connection refused in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load() [function.DOMDocument-load]: I/O warning : failed to load external entity "http://maxmanders.co.uk/feed" in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load() [function.DOMDocument-load]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load(http://del.icio.us/rss/maxmanders) [function.DOMDocument-load]: failed to open stream: Connection refused in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load() [function.DOMDocument-load]: I/O warning : failed to load external entity "http://del.icio.us/rss/maxmanders" in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load() [function.DOMDocument-load]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load(http://...@N00&format=rss_200) [function.DOMDocument-load]: failed to open stream: Connection refused in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load() [function.DOMDocument-load]: I/O warning : failed to load external entity "http://www.flickr.com/services/feeds/photos_public.gne?id=52727640@N00&format=rss_200" in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load() [function.DOMDocument-load]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load(http://ws.audioscrobbler.com/1.0/user/mmanders/recenttracks.rss) [function.DOMDocument-load]: failed to open stream: Connection refused in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load() [function.DOMDocument-load]: I/O warning : failed to load external entity "http://ws.audioscrobbler.com/1.0/user/mmanders/recenttracks.rss" in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load() [function.DOMDocument-load]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load(http://twitter.com/statuses/user_timeline/623503.rss) [function.DOMDocument-load]: failed to open stream: Connection refused in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Warning: DOMDocument::load() [function.DOMDocument-load]: I/O warning : failed to load external entity "http://twitter.com/statuses/user_timeline/623503.rss" in /var/www/maxmanders.co.uk/wp/wp-content/themes/newmax/functions.php on line 55

Hello, Goodbye

A month ago I handed in my resignation to Diet Chef, and this past month has certainly flown by. Today I start a new job with Maglabs.

I thoroughly enjoyed my time with Diet Chef and will miss my friends there, and with any luck we’ll keep in touch. I learned a lot about marketing at Diet Chef and it was a very different environment to that which I became accustomed to at Valley Technology; but different in a very positive way.

My time there made me realise that I’m very much a back-office PHP coder. I enjoyed the varied challenges there but my passion lies more with getting something awesome working well rather than making something look beautiful (in no way a criticism of my previous employer, far from it, I just want to be more focused in my work); I’m no designer although I definitely believe any design has to be functional and usable. I want my work playground to involve more complicated coding challenges, maybe mashing cool APIs together now and then.

With a wedding to Jo to save for and who knows what in the future I also have to be realistic and that unfortunately means being financially motivated as well as looking for the right career fit. I’m looking forward to being able to fulfil both these needs with Maglabs. With that I bid my friends and colleagues at Diet Chef farewell and the very best of luck and success in the future, while also hoping for the same for myself in the future.

Creating a Lifestream Widget with YQL

What is YQL?

The Yahoo! Query Language (YQL) is a fantastic web service from the Yahoo! Developer Network (YDN) that can dramatically speed up development time if your application involves requesting data from multiple disparate web services and somehow combining that data.  You can think of YQL as a gateway API that allows you to quickly and easily select, filter and combine data from across the web. [Read more]

Display Query Results Vertically With PostgreSQL

Those who are familiar with MySQL may be used to terminating a query with ‘\G’ to have the client output the query results vertically with each column/value pair a line at a time. There is in a equivalent in PostgreSQL too. The psql client uses ‘\x’ to toggle vertical output, and ‘\g’ to send the current buffer to the server for processing. To get the same effect in psql as ‘\G’ in MySQL, just end your query with ‘\x\g\x’.

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 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 – Update

I’ve updated the UK Geocoding site to provide better documentation, and a UI for geocoding, in addition to the XML API.

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';

Coder’s Block

Whether it’s because yesterday was Blue Monday, or because tomorrow is my birthday I don’t know, but I feel a little melancholy of late. Not so much in general, but specifically with my hobby and career, web development.

Don’t get me wrong, I love my job; as I have with every job I’ve had. The problem is that with any personal interest that becomes a career, web development has lost it’s shine a little lately. I’m certainly not going to do anything rash like change career I enjoy what I do too much. I just remember a time when I’d have a number of personal projects on the go, but when I get home from work now, the last thing I want to do is code.

I seem to have lost my creative inspiration and enthusiasm for what was my hobby but is now my career. Has anyone else been in a similar position of having the programmers equivalent of writer’s block? Any thoughts or suggestions as to how I can regain my enthusiasm on a postcard please. How do other coders come up with ideas for personal projects to keep them engaged and up to speed with the latest APIs and tools? Hopefully this can all be put down to seasonal blues and I’ll find inspiration soon.

What’s In Store For 2010

And so the new year is upon us.  Whether it’s twenty-ten or two thousand and ten I don’t know, but in any case it seems obligatory in the blogosphere to reflect on the year gone by and to expound upon the year to come.

A year ago I wrote a similarly themed post in which I set out a number of so called resolutions that I had the best of intentions of keeping.  Unsurprisingly, I didn’t manage to keep any of them.  I still smoke, although I can honestly say that I smoke less than I did this time last year; I doubt very much that I have lost any weight in fact quite the opposite; my caffeine intake has probably risen and I think I’ve only played the trombone while severely inebriated.  If the object of a new years resolution is to endeavour to do the exact opposite, then I have most certainly succeeded in keeping all of last years resolutions.

So moving forward to the year ahead, I will be trying my utmost to fulfil the resolutions of last year whilst in addition trying to be generally less grumpy and trying not to succumb to stressful situations.

And without a doubt. the most exciting event I have to look forward to in the coming year is my being married to my fianceé Jo.  All in all I’m hopeful that 2010 will be a great year!

Do You Have Any ID?

I realise that supermarkets have to cover their own backs with respect to the sale of alcohol and tobacco. However the supermarket policies and the law informing those policies seem to differ drastically. Retailers aren’t legally allowed to sell alcohol or tobacco to persons under the age of eighteen. Most supermarket policies require that their staff ask for ID of any persons who look under the age of 25.

I haven’t yet been abroad, and I don’t drive. As such I do not posses either of the forms of ID that retailers consider adequate to prove who I am, and my age. I do have a birth certificate, which when produced in conjunction with credit/debit cards might be enough to convince a sympathetic checkout clerk that I am who I say I am, and am indeed aged over 18.

I certainly don’t think I look younger than 18!  I have a full beard and a hair line that is receding embarrassingly rapidly.  In fact, the majority of checkout clerks who question my age are pimply youths who hardly look old enough to be custodians of the cigarettes and booze I am old and ugly enough to choose to buy for myself.

Since I have been deprived of cigarettes and almost deprived of the beer I have been looking forward to relaxing with all day, I take justified objection to what feels like discrimination.  A checkout clerk can refuse to serve me because they decide on a whim that I look younger than 25; seven years older than legally required, and I am unable to prove my age because I neither drive nor have been abroad.

In summary – BLARGH!

Next,