All posts in Code

For a current project I needed a browser based image cropping user interface, I wanted it to have the same features as found in something like Photoshop and be based on the Prototype JavaScript framework and possibly script.aculo.us, as they are both being employed in the area this tool will be used, plus taking advantage of their power would reduce the weight impact of the interface.

I did quite a lot of searching for some ready made solutions and found none that had the complete feature set that I required or any complete versions based on Prototype, the closest I found was Encytemedia’s Prototype/Script.aculo.us Javascript Image Cropper, but this is far from complete.

So after a week and a half of work, I present the JavaScript image cropper UI, built on Prototype & script.aculo.us, there is also demo page which allows you to try out all the functionality of the image cropper UI.
Continue reading this entry »

Updated the PHPUnit2 HTML Runner to apply a fix provided by Glen Ogilvie for the Formatter when it tries to find the original exception that was thrown.

I also tided the Formatter up a bit by adding much needed comments to explain the functionality it provides in the context of the HTML Runner.
Continue reading this entry »

I’ve recently started to get into using Test Driven Development in almost everything that I am able to because I’ve begun to really see and experience the benefits that it brings to development. The basic advantages of TDD are covered very well in an article by Robert Blackburn, Test Driven Development with ColdFusion Part I: An Introduction to Unit Testing so I won’t cover them here.

I’ve been playing around with the xUnit family of testing frameworks in PHP, Coldfusion and JavaScript and really like the way they handle testing. However having been spoilt slightly by CFCUnit and JSUnit with their HTML GUIs I found the text runner in PHPUnit to be lacking for my needs.

So taking inspiration from the interface of CFCUnit I created the PHPUnit2 HTML Runner.

jsDebug is a simple utility created to assist with debugging JavaScript development cross-browser.

The usual method for debugging JavaScript is to pepper the code with alert() calls to give you feedback on how the script is executing, this is especially useful in browsers that supply vague and un-helpful information about errors (or even their exact location), but can soon become counter productive – confirming multiple alert boxes breaks the code, test, code flow. This script creates a console to send messages to, where you would have traditionally used alert().
View the jsDebug code entry for the download, instructions on it’s implementation, to see it in action view the jsDebug demo page.

I have just added a PHP port of Martin Laine’s Application Constants Mach-II Coldfusion plugin to my new code section. It allows you to set application constants for multiple environments (development, staging, production etc.) in an XML configuration file, these constants are then read into the Mach-II properties.
Continue reading this entry »