Blog Archives

The MacBook Pro’s not so bad…

Two years after moaning about my MacBook Pro I figure it’s time for an update: It’s not so bad… Thanks to various blog comments I managed to solve most of the niggles I had with the laptop: muted the startup

Posted in JavaScript

Concatenating arrays in PHP

Just a quick post so I know where to look the next time I forget how to concatenate arrays in PHP. Use array_merge to concatenate two numerically-indexed arrays; not array_push and not the array union operator: +. $first = array(‘doh’,

Posted in JavaScript

sprintf for JavaScript

Avoid writing formatting functions in JavaScript by grabbing yourself a decent sprintf implementation – handling padding, truncation, floating-point numbers, left/right alignment and re-ordered arguments. You can download sprintf for JavaScript, available under the Create Commons Attribution License. Now license free

Posted in JavaScript

undefined is not a reserved word

With the new release of Prototype (1.5.0) comes a new website for the Prototype JavaScript Library. The home-page of the new website features a snippet of JavaScript: cells: function(row) { if(row == undefined) return this.tab… return $(row).getElementsBySelector(… } Let’s get

Posted in JavaScript

Numbers in form-fields

JavaScript is often used for client-side form validation to save unnecessary round-trips to the server. Unfortunately, lots of client-side validation relies on lenient JavaScript methods such as parseInt, allowing numbers to be input in ways totally unacceptable to your server-side

Posted in JavaScript