Web development

audio-tag The HTML5 audio tag on 29 Dec 11 (1 comment)

The new HTML5 audio element now has pretty decent support across all browsers (even IE9) so is starting to be a pretty compelling alternative to using Flash. This article explains how to use the audio element, talks about which audio formats are supported by which browsers and how to control it using javascript.

cement lion Maintainable CSS presentation slides on 31 Jan 11 (2 comments)

A talk that I gave at the Developer, Developer, Developer day in Reading in 2011 about my experiences trying to make CSS easier to maintain. Contains slides and sample downloads.

Javascript method context on 29 Nov 09 (4 comments)

In languages like C# and Java you never really need to give a thought to the this operator. In javascript things are a little more complicated due to functions being first class objects.

multiple-background-image CSS3 Multiple background images on 23 Nov 09 (8 comments)

Firefox 3.6 supports multiple background images so I thought it was time to give them a go and figure out how they work. May contain small rant about beautiful markup.

IE6 absolute positioning in parent with odd width on 07 Sep 09 (Add comment)

A small browser quirk for IE6 where absolute positioning with the CSS right property is one pixel out when the parent container has an odd number of pixels.

Building javascript minification into MSBuild scripts on 29 Aug 09 (Add comment)

How to use a tool called Packer.NET to build javascript minification into a MSBuild script.

Why I don't like reset stylesheets on 23 Aug 09 (7 comments)

I don’t much like reset stylesheets. They make extra work when creating CSS and are an extra request for the browser to make to build a page.

Javascript prototype chaining on 17 Aug 09 (3 comments)

Prototype chaining is used to build new types of objects based on existing ones. It has a very similar job to inheritance in a class based language.

SVG images as CSS backgrounds on 12 Aug 09 (4 comments)

Experimenting with using an SVG image as a CSS background image.

A great big welcome to inline-block! on 09 Aug 09 (4 comments)

Inline-block is a halfway point between setting an element’s display to inline or to block. It keeps the element in the inline flow of the document like display:inline does, but you can manipulate the element’s box attributes (width, height and vertical margins) like you can with display:block.

Our web 2.0 wedding on 01 Aug 09 (2 comments)

The story of how Joe and I used our favourite web tools to organise our wedding and share the experience with the people who couldn’t be there.

Javascript object prototype on 18 Jan 09 (15 comments)

The javascript object prototype is javascript’s way of sharing implementation across similar objects, much like the way classes are used to do this in many other languages. Although constructor functions look a lot like classes, javascript does not have a class based object system like C# or Java. Instead it has a prototype based object [...]

Javascript null or default operator on 09 Dec 08 (1 comment)

A neat little trick I learnt from Ting is a way to check whether a value was null or undefined using the or operator (||). It’s really simple. If valueThatMightBeEmpty has a value set, you get that value. If it is null you get the default. It’s just like the ?? operator in C#: var [...]

Changing firebug's font size on 16 Nov 08 (Add comment)

One problem I’ve had a couple of times when using Firebug to show things during code demos is I haven’t been able to make the font big enough for people at the back to read it. I found the solution at stack overflow: 1. Open firebug in new window 2. Go to the view->text size [...]

Dust-me selector tool for finding unused CSS selectors on 21 Oct 08 (2 comments)

My find for today was a Firefox extension called Dust-Me Selectors from the SitePoint guys that scans a web site looking for unused selectors in the CSS. It extracts the style references for the current page and then looks at the page to see where they are used. It can look at the current page [...]

CSS3 box-sizing attribute on 20 Oct 08 (21 comments)

CSS3 is going to include a new attribute called box-sizing so we can choose whether the width set on an element will include borders and padding or whether borders and paddings will be added to the width. The difference is basically the difference between the IE5 and W3C box models. The default will still be [...]

Javascript closures on 17 Oct 08 (7 comments)

Javascript closures are a really powerful feature of the javascript language. Closures are created when a function that’s nested inside another function accesses a variable from its parent’s scope. This is really useful for passing state around your application when the inner function is called after the outer function has exited. Javascript supports functions nested [...]

Constructor functions on 14 Sep 08 (8 comments)

The object literal syntax is great for setting up one off objects but sometimes you’ll want to mass produce objects that all have the same properties and methods. It would be a pain to have to set up each object individually so instead you can use a constructor function to do it for you. There’s [...]

Google Chrome.. or GlaDOS? on 02 Sep 08 (2 comments)

I downloaded Google Chrome tonight. It’s the pretty! Only scary thing is something Joe noticed… how much the logo looks like GlaDOS from Portal. Remember that time I pretended to murder you?

Object oriented javascript slides and samples on 31 Aug 08 (2 comments)

In 2008 I did a talk at a .NET user group in Oxford about the nuts and bolts of how objects actually work in javascript. Here are the presentation slides and code samples.

Javascript anonymous functions on 23 Aug 08 (34 comments)

Anonymous functions are functions that are dynamically declared at runtime. They’re called anonymous functions because they aren’t given a name in the same way as normal functions. Anonymous functions are declared using the function operator. You can use the function operator to create a new function wherever it’s valid to put an expression. For example [...]

Functions are first class objects in javascript on 19 Aug 08 (10 comments)

Functions in javascript are first class objects. This means that javascript functions are just a special type of object that can do all the things that regular objects can do. Really, just like any other variable Here are a few of the important objects things that you can do with a function in javascript. A [...]

Building simple objects on 17 Aug 08 (5 comments)

Javascript objects are basically just hash tables, a group of related properties and functions that can be accessed by a key. Properties are dynamically added at runtime. Methods are just properties that happen to be functions. Building a simple object The simplest way to build objects in Javascript is by declaring a new variable of [...]

rufus How javascript objects work on (8 comments)

This is a series of articles about how to use the javascript language features to write object oriented type code. It’s designed for people who are already sold on the idea of bundling functionality up into objects and want to know the javascript way of doing things.

IETester: test IE5.5 to IE8 on the same computer on 07 Aug 08 (Add comment)

My favourite new webdev tool of the moment is IETester. You can use it to test pages in IE5.5, IE6, IE7 and IE8 all on the same machine without messing around with your main installed version of IE. I was pretty amazed when I saw it because I’d always believed that it was a bit [...]