I have opinions

Broken Windows

There is an interesting theory that came around in 1982 by two American social scientists named James Wilson and George Kelling called “Broken Windows”. This stated that maintaining law and order quickly in urban areas would result in fewer crimes and de-escalating crimes of severity.

Nov 2015

Service Manuals

Service Manuals, Playbooks, Style Guides, call them what you want but to any large-ish organisation they are a vital way to maintain consistency among the different departments and outside organisations, to ensure your brand does not get misused and misrepresented.

Mar 2015

Cleaning up after yourself

Everyone likes a nice clean interface; some of the required scaffolding simply gets in the way of what we want to do. A classic example of this is closing things automatically; there are several ways to do this (using tweaked code examples from the PHP manual):

Oct 2014

Magic Mirror

This guy could be on to something. There is a definite huge gap in the market for a quick and easy way to see what’s going on whilst you get ready, without having to look at your phone and then get distracted on Facebook, Clash of Clans, or an email.

Gracefully loading images

User experience is important, and it’s the little things that matter the most. Make their visit seamless and they’ll come back time and time again. One of many ways you can achieve this is by loading images “nicely”, not by thrusting them in their face but by displaying a default image and then gracefully loading the image.

Jul 2014

Getting Sassy

My stance on CSS preprocessors in the past has been far from glowing, but I’m slowly coming around. Slowly being the keyword. But I’m there now, I love it. I used to think it was just because of variables, but actually the syntax is nicer than CSS. There, I said it, humble pie. And it’s not just because it’s leaner, it’s actually more maintainable, and I’m going to give you three quick examples why.

Dec 2013

Yoda natation

Everyone’s done it, they’ve missed the second equals sign in an if-statement and created an assignment instead. Much tutting, shaking of the head, and a little chuckle ensues as you realise your error. There is a thought amongst some that Yoda notation is the way to go, so named because it switches the comparative’s to produce errors instead of unexpected behaviour.

Sep 2013

iOS 7 redesign

I use Mac’s. I think they are leagues ahead of our Windows counterpart. However, I do not own an iPhone and people think I’m crazy. I tell them I use the best tool for the job, for me that is Android, and they laugh at me. I’m not sure why utilising a Mac means I should also have an iPhone, especially since I (and most iPhone owners, come to that…) use Google for most (web)apps.

Jul 2012

An introduction to PDO: The basics and benefits

MySQL is/was deeply integrated within PHP. No doubt you have seen and used the mysql_*() functions at some stage, but there is an alternative that makes your database interactions much more reliable. It’s called PDO (PHP Data Object) and here’s a quick guide that should get you up to speed in no time at all.

Jun 2012

Update: Reversi board game in PHP and Javascript

I like playing the occasional game of Reversi, and thought it would prove to be an interesting project (creating something like RedHotPawn for chess). Several hours programming later I had a simple working prototype. A couple more hours later I added in some missing features and smartened everything up.

jQuery plugin: Swiping Blind Effect

This plugin stemmed from a need to have an effect similar to that of a blind, how it displays the content beneath slowly from left to right in strips.

StackOverflow challenge: Replicate (almost) HTML text-align justify

Quite an interesting little test, I thought. Has zero practical world application, but it does require the person to have a somewhat analytical mind and problem solving skills. Also a reasonable knowledge of PHP. So I thought I would have a go (without looking at others’ solutions). 10 minutes later a working script which does exactly what was requested.

Jan 2012

Knolling

Today I learnt a new word, knolling; arranging items in parallel and 90º to each other in an aesthetically pleasing manner.

Sep 2011

May 2011

Simple PHP Encryption and Decryption

The need for encryption and decryption in general day-to-day Web programming is quite rare. But it can crop up from every now and again. I use a class that handles both encryption and decryption using mcrypt and the Rijndael algorithm (AES) and a 256 bit key size.

Mar 2011

Sep 2009

Design Pattern II: Factory

As you might have grasped from the name of the pattern its role is to produce and dispatch a product. In this case a classes. We use the Factory pattern as it is a standard way to create a class which is very similar to other classes by containing the same functions, but implemented in a different way. I always like to use non-technical terms when explaining, and this example will be no different.

Aug 2009

Cookie replay attack protection

So let’s jump straight in, what is a replay attack? Essentially a security breach whereby someone poses as someone else using some unique piece of data the user supplied/was issued to/from the Web server. It’s kind of similar to a man-in-the-middle attack. We’re going to be looking at the attack using specifically cookie authorisation, a very common means of implementing a “remember me” function.

Defensive programming

Earlier in the week, whilst implementing a domain registration API into another client project (and pulling my hair out), I thought back to a seminar from university. The module was Component Based Design and it was all about writing code in a standard way, helping to aid both the supplier (API creator) and the client (the person using the API). Although I didn’t realise it until now it actually played a large role…

Jul 2009

MySQL is 24 seconds too slow

1246402800. A perfectly valid UNIX timestamp, but one that created some confusion and head scratching in our office for one of our latest internal projects. The problem came around when converting the timestamp into a MySQL date using the FROM_UNIXTIME function which produced the wrong output. The timestamp is perfectly valid, it’s the timestamp for 1st June 2009, 00:00:00 (check it, if you don’t believe me).

PHP __auoload

PHP5 reared it’s head mid 2004, 5 long years ago and all PHP developers rejoiced. Especially me. It gave us lots of new shiny tools to play with, including the obvious improved OO support and my particular favourite: the __autoload function. For all you Java developers out there you know that you never have to include or require files, the Java language instinctively knows where to find them thanks to the…

Oct 2008

Battle of the CSS positions

It all began a couple days ago, one slightly dull Tuesday afternoon. The air was thick and the light was dimmed. Ahem, I have a challenge for you; try and place a div underneath another. “Piece of cake,” you say. “That’s hardly a challenge”. Well, not so it would seem. I was perplexed by what I saw for a few minutes, at least. So much that I wrote this article and created a little demonstration.

Jun 2008

Delete from multiple MySQL tables

I have just spent the last half hour scratching my head over how to delete from 2 tables, joined by a unique ID. For some reason, MySQL kept spitting out: Unknown table ‘myTable’ in MULTI DELETE. Many visits to the MySQL manual still made me scratching my head (Yes, looking back on the manual makes me hit my head for not noticing the “Note” about a third of the way down the page).

jQuery tooltip

Sorry for the lack of updates recently but I have been swept off my feet with work. A couple days ago I redesigned part of my companies website, Centation, whereby I needed to make a little jQuery tooltip to add a dynamic flair to the page. Well, I didn’t need to make one, but the lack of quality jQuery tooltip plugins forced me to. I thought I would give you the code of how I did this, and give you a couple demonstrations.

Apr 2008

PHP class: SimpleXML

One thing I have found is the lack of really simple XML classes—that’s not to say there aren’t any good ones out there, I have used several really cracking ones. For my new version of my personal site (yes, this site is planned for a revamp) I wanted to integrate my Twitter feed somewhere. I looked and looked for a really simple XML class but was unable to find one. So I made one. And here is the result:

Feb 2008

jQuery text resizer

I was on a site today which offered text resizing. Great I thought, let me increase the font a wee bit—it was a bit small. It proceeded to reload the page completely to set the cookie using some server-side language. The site in question was running quite slow, so it took me upwards of 5 seconds to see the changes. It would have been quicker for me to tap cmd+plus a couple times.

Jul 2007

Submit buttons not submitting

Wow, I have been busy lately, what with a hectic workplace and personal life. But I am here to tell you about a little problem I have known about for years but recently popped up when a friend couldn’t work out what was happening.

POST requests are actually GETs

I found out a pretty interesting, and slightly strange, feature of the HTTP protocol today. When submitting a form as a POST request, if you set the action to the targeted files folder name without the trailing slash it submits the form as a GET request—this caused me to scratch my head over a script for a couple minutes.

Jun 2007

PHP class: Text to anything

I recently had a client who sent me a 300+ list of items they wanted placing into a drop down select menu. Beside the obvious accessibility issues they were quite set in their ways about what they wanted—per usual.

Design Pattern I: Singleton

In this first episode of PHP design patterns, we will be looking at the Singleton. The Singleton is available in most, if not all, OO languages. The purpose of the Singleton is to only ever have 1 instance of a class available which supplies the rest of the application with consistent data. I would like to point out that my version of a Singleton may differ slightly from other peoples; design patterns are not exact nor are they set in stone.

phpSimpleAuthent

I was browsing a couple of PHP forums the other day, and it seems people require a simple authentication script for their website. So, I thought I would make just that.

Magically dynamic PHP

There are several functions in the PHP language which were made to make classes more accessible and dynamic. I am going to be talking about two of these so called “magic functions” which allow you to set and get information dynamically, whilst also providing a simple log to show you what is really going on behind the scenes. These two functions are of course __set() and __get().

PHP exception handling

Arguably one of the best things to come out of PHP5 was its improved OO support. With OO comes easier separation of presentation, data, and business logic layers which leads to reusable code and better code management, amongst a host of others.