will

It's All Geek to Me

Posts about technology, with a focus on web development with Python.

I am the author of Beginning Games Development with Python and PyGame.

I recently worked on the re-design of 2 Degrees, which required a lot of image processing on thumbnails. The thumbnails where to be in a variety of different sizes, all with rounded corners and keylines on a selection of virtually identical off-white backgrounds and gradients. And they all had to work on IE6 *spit* without the transparency hack.

A variety of thumbnails generated by Sore Thumb

A lesser engineer may have told the front-end developer where to stick his rounded corners, but I didn't want see a grown man cry, so I built Sore Thumb, an on-the-fly thumbnail and image processing system for Django. continue reading…

Pakt publishing have released a new Django book called Django 1.2 E-Commerce, written by Jess Legg. I'll have a copy soon and post a review here.

In the meantime they are offering a free chapter of the book; Chapter 2 Setting up Shop in 30 minutes.

Meebo, the instant messenger in your browser company, are seriously looking for Python developers right now to work in Mountain View, California. From what I can gather they are expanding, and are building a number of sites in the Django framework.

Meebo are hiring!

If you have experience with Django, or some other web framework, and you live in California (or can relocate) this may be an excellent opportunity for you to work for a cool technology company. Contact Kiko Griffin if you're interested — and please mention where you read this!

See Meebo's job page for more information…

Since I've upgraded to Ubuntu 10.04, I figured this would be a good time to play with video editing, which is something I've been wanting to play with for a while. I suspect that video editing could be a killer app for Linux, and there are a few packages to chose from. Kdenlive looked to be the most feature rich, but I'm afraid I found it buggy and prone to crashing, so I settled on OpenShot, which has a clean, simple interface and didn't crash on me once.

Here's the video I put together:

If you know the answer, please don't post it straight away – to give others a chance to figure it out…

Upgrading to Ubuntu 10.04 went remarkably smoothly, with the exception that audio in Flash was erratic. Sometimes it worked, sometimes it didn't. Since I use my PC as an entertainment system, this was pretty much a deal-breaker.

Googling for it got me no where. Apparently “no audio in flash” is the Ubuntu equivalent of “i have a headache” – it's a vague symptom that has multiple possible causes. Long story short, the problem was that I had both Flash 9 and Flash 10 installed. Firefox appeared to pick one at random (as far as I could tell), but audio only worked with 10. The solution was to delete Flash 9 – which I couldn't do from the package manager, because it turned out I had Flash 9 installed locally. continue reading…

Django has support for Generic Foreign Keys, which let you reference one model instance from another, without knowing up-front what that model type is. The classic use for something like this is for a commenting system; you need generic foreign keys – or something like them – because you wouldn't want a commenting system that only worked with a single model. continue reading…

I recently administered a programming test to a number of applicants for a Python developer job at 2degreesnetwork.com. Since we now have a new developer (hi Gustavo!), I figured I would post the test and see what kind of response I get to them.

There are two parts to the test, neither are hugely difficult, but there is enough scope in the solutions to understand how the candidate approaches a problem.

In the first part of the test I asked the candidate to look at the following code and implement the thousands_with_commas function, which should take an integer and return a string representation of that integer with commas separating groups of three digits: continue reading…

I implemented a theme system for locidesktop.com and thought it only fitting that the first theme I made was one for Django.

I present you with the Django themed Loci Desktop!

Here it is, in embedded form – although you really need to click the above link to fully appreciate it.

Since I've been hacking away with Javascript lately, I thought I'd share a few snippets that I have found invaluable.

Some of these snippets use JQuery, but could easily be modified to use plain JS or another toolkit.

Some of these snippets are likely available in other libraries and plugins, but I prefer not to introduce too many dependencies when working with Javascript. Better to keep the code lean – if possible!

Building strings with Javascript can be a pain if it consists of a number of parts, and it isn't too flexible if you want to modify later. Here's a snippet that adds simple template substitution to strings.

It adds a method, f, which takes an object and replaces parts of the string between double braces with values from that object, similar to Django templates. Here's an example: continue reading…

I have been busy working on locidesktop.com lately. One popular feature request from the beta testing was to use website favicons, so that links become more readily identifiable – which I have implemented after several late nights, and abusing my quad core.

A few of the 3D Favicons used in locidesktop.com

I built a pipeline that downloads favicons, extracts PNGs which are then processed in to a 3D scene and rendered for missing resolutions (.ICO files can contain multiple resolutions). I've tweaked the way that the 3D icons are produced, and they are significantly better than my first attempt – although some do come out better than others. continue reading…