Fork me on GitHub

Archive for the ‘Web Development’ Category

Truncating Data via Doctrine 2.x in MySQL

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).

Read On…

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.

Read On…

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…

Custom ExtJS Grid Context Menus

A sample ExtJS right-click context menu

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.

Read On…

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.

Read On…

jQuery Image Overlays with Mosaic

jQuery Image Overlay Sample

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.

Read On…

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.

Read On…