Implementing an Enum in PHP

Posted by & filed under PHP, Programming.

A quick PHP example; how to implement an Enum. PHP lacks this useful feature so this is a bit of a hack to emulate an Enum.   Example below with an example of usage;    

PHP PDO Connection class

Posted by & filed under PHP, Programming.

A useful, perhaps, class for database connections using the PHP PDO library: PDOConnection.php   Singleton implementation with the class method getConnection() returning a \PDO connection with connection details;        

Objective C Prefix headers file wrongs

Posted by & filed under Apple, Objective C.

TL ; DR   Do not use the Xcode automatically generated Prefix headers (.pch) file and the preprocessor for constants, configuration, environment settings, etc – The name gives away its purpose, it is not called Prefix headers and configuration settings. Best practice; if you have to share constants between classes then create something like a Constants class by subclassing… Read more »

Mapping BBC Price of Football survey

Posted by & filed under Football, Mapping, Open Data, OpenLayers.

The BBC have released results of a survey undertaken in 2012 involving 166 clubs in 10 divisions across British football, including the Conference Premier and Women’s Super League gathering the prices for the most expensive, and cheapest, season tickets and adult matchday tickets along with a programme and some say, most importantly a pie and tea. The… Read more »

Mapping Mr Correcter tweets

Posted by & filed under Mapping, Ruby, Web.

As an update to a previous post about Mr Correcter, the Twitter spelling bot here is a post about how I managed to find and geolocate so many offenders. Quick update; Mr Correcter was a script that searched Twitter for 2x common spelling mistakes (beleive and acommodate) and replied back to the tweeter reminding them… Read more »

How to upgrade manual installation of Ruby on Linux

Posted by & filed under Linux, Ruby.

I had a server with a manual installation (local compilation -> ./configure && make; make install) of Ruby v1.9.2 and I needed to upgrade this to v1.9.3 – How did I do this?   Technically I didn’t… it worked out to be too much hassle long term to upgrade the manual installation on a production… Read more »

The Twitter account – Mr Correcter

Posted by & filed under Ruby, Web.

Update [29 July 2012]: Twitter disabled the @Mr_Correcter account Not sure if anyone complained or automated analysis of the account’s posting history (many replies) flagged it up as annoying. Probably best for everyone all round.   I created the Twitter account @Mr_Correcter as a development exercise and funny test… little did I know I would start… Read more »

Javascript message queue implementation

Posted by & filed under Coffeescript, Javascript, Programming.

Here is a Javascript implementation of a message queue that displays the messages in the ui – it is written in Coffeescript and compiles down to Javascript. Source available on github here. ui-message-queue is a Javascript implementation of a message queue allowing you to push messages (String) to the queue and display via a First… Read more »