Category Archives: Code

Validation without a model in CakePHP

CakePHP offers an awesome set of validation methods, but they rely on defining what you want to validate within a model. Sometimes you just want to quickly validate a certain piece of data, or validate a set of data iteratively without touching the model. For that, you can import the Validation class and use its [...]

Creating Half Pie Charts in Flex

This is an awfully hacky way to perform a very specific task. My brief was to create a pie chart representing two data sets, each occupying half of the pie chart. The pie chart as a whole could represent the sum of the two pieces of data, whilst still representing them both individually.

Unique items in a multidimensional array in PHP

array_unique() works fine for a single dimensional array, but falls down on multidimensional arrays because it relies on string comparisons. When it compares entries in a multidimensional array, it simply sees ‘Array’ === ‘Array’ and returns true.