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;
Posts Categorized: Programming
PHP PDO Connection class
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
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
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
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
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 »
A new Openlayers WMS Layer for using Ordnance Survey Openspace map tiles
I have created a quick implementation of the OpenLayers WMS class to use Ordnance Survey’s OpenSpace tile servers. The Openspace service is usually accessed via they’re Javascript API but this is tied to an old version of OpenLayers and so this is just a quick workaround to use the latest Openlayers library with OS backdrop… Read more »
The Twitter account – Mr Correcter
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
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 »
Integrate Rails app and PHP on Apache
Here is one method of how to integrate a Ruby on Rails application and a PHP application or even just static HTML using Apache webserver. One reason for doing this could be (in this website’s case) that your main website application is Rails but you want to use WordPress or another technology of blog or… Read more »