I recently stumbled across a question on stackoverflow.com where somebody was having problems with foreign key constraints and truncating data in MySQL. An accepted answer stated that while it was possible to truncate the data, it isn’t possible if there are foreign keys present (as is the case with Doctrine 2 entities).
Archive for the ‘Web Development’ Category
Glob Performance for Finding Files in PHP
Listing files in a directory isn’t something that I’d usually worry about in a web application, considering that its usually inside a CMS or a limited-access backend where the number of daily requests are in the hundreds rather than millions. Recently however, when working on a large-scale website for a client I started thinking about the performance differences between glob and opendir/readdir in PHP 5.3. I’ve always used glob, just because it makes life easier with partial string matching and because it returns your file paths in an array ready to use, but not because I thought it was drastically better in terms of performance. Read On…
Installing ImageMagick beta for PHP on Ubuntu
There seems to be a few issues with Imagick in PECL related to setting your own properties on a class that extends Imagick. A project I’m working on at the moment is making heavy use of image processing and I wanted to stick with Imagick over the GD library. A little bit of investigation told me that this bug was fixed in the latest release candidate of Imagick in PECL, so I began investigating how to install a beta release of the extension but Google gave me no hits.
Recording ‘Last Activity’ for Users in Symfony2 + FOSUserBundle
Whilst working on a personal project based on the Symfony2 framework I wanted to record when a user was last active so that I could emulate a list of currently online users. I had already plugged in the amazing FOSUserBundle extension, so this was just about tweaking what was already there. If you’re in a similar situation and already have the Symfony2 standard distribution installed with FOSUserBundle then this walkthrough should be pretty straightforward. Read On…
robbailey.co.uk is live
I’ve recently finished working on a new website for UK based artist and illustrator Rob Bailey. You should definitely head over and check out his work at robbailey.co.uk.
Custom ExtJS Grid Context Menus

ExtJS provides some powerful grid functionality with their Ext.grid package, and part of this functionality includes custom context menus that provide an intuitive method of interaction with grid rows. I found that there was no documentation on how to create these menus, so I thought I would put together a quick tutorial. I’m assuming that users have a basic understanding of ExtJS, and the version I am using as a demonstration is ExtJS 3.4.
Custom Event Rendering with Ext Calendar Pro
ExtJS is a great framework, and whilst its learning curve is quite steep it makes building user interfaces as simple as you could hope for. One of its major let-downs however, is its lack of Calendar component (quite a frequently requested interface layout actually). Brian Moeskau (one of the earlier developers in the ExtJS project) released his own 3rd Party extension called Ext Calendar Pro, which fills this void.
Fixing the Missing Text Issue in DomPDF
I was recently plagued with a problem at work where a previously working document produced by one of our software applications was not including text anymore. Table borders and images were fine, and even some custom page footers we were generating through the use of the $pdf global variable was appearing okay.
jQuery Image Overlays with Mosaic

Recently, whilst working on a client’s website I had to incorporate image overlays into their portfolio page. I had seen Mosaic mentioned before on various websites and blogs, but I had never used it. I was disappointed at the lack of documentation, but nevertheless it proved to be a nice, light (~2kb minified) jQuery plugin that did exactly what it said on the tin. I thought I would document how to get going with a quick mouse-over animated overlay which will hopefully save someone some time.
Avoiding CAPTCHAs with a simple Math Class
It’s been a while since I last blogged, and a lot has been going on since (apart from a hectic Christmas and New Year’s eve). I’ve been working away on my personal projects outside of my 9-5, and I came across the dreaded idea of CAPTCHAs in a form. I’m a sucker for nice registration forms (Spotify is a great example), and I wanted to create something that was equally as pleasant to use.