Fixing switch - what I want out of switch statements

There are changes to switch statements that would make my life much easier. They are perhaps best explained by just showing you how I want them to work.

switch ($somevar as $s) { 
    case 0: 
        if (do_something()) {
            $s = 1;
    case 1: 
        $var = "Something"; 
    case 2: 
        $var = "Some "; 
    case 3: 
        $var .= "Things"; 
    case $s > 4: 
        $var = "Too Much!"; 
    case $s > 0: 
        echo $var; 

Moving blogs

"The time has come," the blogger said, "To talk of other things. Of PHP and JavaScript, and safe MySQL strings."

Which is a complicated way of saying that the posts on this site will, from now on, tend to be about actual code, and my posts which are more off-topic will move to their new home on I've migrated old blogs (and comments) over to there already. I'm leaving here everything that involves actual code, seeing as it still gets a fair bit of traffic, and I have code highlighting in drupal.


BlogFile is a simple, very light weight blog system which is entirely housed in a single PHP file. It provides basic templating, a simple markdown format, simple comment spam protection, an automatic karma system, and the ability to add both blog posts and static pages.

Date: Released on May 7, 2012
Time: Development ~30 hours
Technology: PHP/MySQL
Licence: WTFPL
Github URL:

Code For Causes

Code for causes is a new project that is currently in the planning stages. It will allow programmers, designers, and other IT professionals to donate their time, knowledge, and experience to charities, NPOs, and good causes without having to contract to them directly. This will mean that charities can get work done without being dependant on a single person, and the people who help won't feel like they are forever attached to the charity for future work.

Blog/further information:

3D Cellular Automation (Conway's Game Of Life)

Game Of LifeConway's Game Of Life 3D is an exercise in cellular automation based on the original Conway's Game Of Life. It was mainly made as an excuse to use HTML5, and the canvas element.

Date: December 2011
Time: Development ~10 hours
Technology: JavaScript, HTML5, utilizing the THREE.js JavaScript graphics library

Simple Photo Management and Galleries

I recently got my first decent digital camera. The first one that had changeable lenses, a manual zoom, and full control over all the settings you could want. It takes some great photos, and to ensure that there are great photos, I take a lot of them. Quality through quantity.

MICO - Mantis Inbound Call Organiser

Mantis Overview MICO (formerly Mantis) is a simple application for taking down and tracking phone calls. I designed it out of a need for a simple way to take down phone calls at work. Using email and instant messaging made following up calls difficult, but using a full blown task tracker lacked flexibility. Mantis is designed to make taking a call as painless as possible, while giving the users the ability to easily track and follow up on calls.

Date: Started September 2010, First Release on October 31, 2010
Time: Development ~100-150 hours
Technology: ExtJS/Sencha user interface, talking to a PHP/MySQL server side API.
Licence: GNU Lesser General Public Licence version 3.0
Download: Home page

Sencha/ExtJS Combo box gotchas - and how to fix them

I've been working on a new project using ExtJs (now called Sencha), and have been spending some time on getting the combo boxes to work just right. The nature of the application that I've been working on (which will show up in my portfolio in due course), means that efficiency of data input is the most important feature.

Securing your software: Password security

Password security is always a hot topic of conversation. Passwords are often your first line of defense against intruders, attackers, and all sorts of nasties. What is involved in ensuring password security, though? With something so essential, so vital, why don't we have standards about the correct length, strength, and storage to ensure that passwords are kept secure?

SQL Delete statement using Joins

A co-worker asked me a question about finding and deleting records in a link table which referenced records in either table which no longer existed.

My quick response was to provide him with a simple exclusion query:

FROM `Brand_Contacts` 
LEFT JOIN `Brands` ON `Brands`.`id` =  `Brand_Contacts`.`brand_id` 
LEFT JOIN `Contacts` ON `Contacts`.`id` =  `Brand_Contacts`.`contact_id` 
WHERE `Brands`.`id` IS  NULL 
OR `Contacts`.`id` IS  NULL

Syndicate content