XOR Media

Coding, Operations, Etc.

Anatomy of a Redesign

Screenshot of the previous XOR Media theme, a slightly modified notmyidea

A new year, a new theme. Since switching XOR Media from it's hand-coded, mostly placeholder, last May I'd been planning to build a custom theme for it and over the holiday break here in the US I had a chance to tackle it. I started by looking around ...

(more)
In misc, tagged: copywriting, css3, design, html5, and pelican.

Django ALLOWED_HOSTS and Amazon Elastic Load Balancer

A recent Django security release added a new configuration option, ALLOWED_HOSTS. It's optional in 1.3 and 1.4, but required in 1.5 setups. The relevant detail is that when enabled in production Django will throw 500 errors if the Host header doesn't match one of the ...

(more)
In ops, tagged: aws, django, elb, and python.

Django Model Validation On Save

In what is probably my biggest WTF with Django to date, it doesn't validate your models before saving them to the database. All of the necessary code exists and when a dev sets up her models she usually adds the relevant validations using EmailField, URLField, blank, null, unique, ..., but ...

(more)

Django Startup Signal

If you've spent some time with Django chances are you've run across its signals system. It is most commonly used to provide hooks in to the model setup and CRUD processes, but there are many other uses of the facility throughout the code including auth, db, and the ...

(more)
In code, tagged: django, signals, and python.

Efficiently Querying for Nearby Things

It's a fairly common use case to have a latitude and longitude and want to find the closest objects to a given point. While there are heavyweight solutions: MySQL Spatial Extensions, PostGIS, they can be more trouble than they're worth especially if you're making use of an ...

(more)
In code, tagged: algorithms, db, examples, geo, mysql, performance, and sql.