Entries in November 2006

My site is smarter than I am

Published November 22, 2006

Looking through my stats today, I found an incoming link from a blog written entirely in Chinese. Now, I don’t read Chinese (I know about half a dozen words of Mandarin, but couldn’t begin to pronounce them with the right tones), so I ran it through Babelfish and found that this person was — apparently — commenting on how “comforting” my site was to him.

This left me somewhat befuddled, until I went back and ...

Read full entry and comments

Django tips: get the most out of generic views

Published November 16, 2006

Recently at work I had the chance to revisit an application I’d written fairly early on in my tenure at World Online; I was still getting used to doing real Django development and to some of the quirks of our development environment, and ended up writing a lot more code than I needed to, so I was happy to be able to take a couple days and rewrite large chunks of the application to ...

Read full entry and comments

Comment problems

Published November 12, 2006

So it seems that something’s broken somewhere in all the hacks I do to the comment system, because every attempt to submit a comment is now met with AkismetError: missing required argument.

I’m working on it.

Update: commenting still won’t work, but apparently I’m not the only person running into this bug. I can’t find any notes regarding changes to the Akismet API, but that feels like the most obvious ...

Read full entry and comments

Programming tips: learn optimization strategies

Published November 5, 2006

Recently I spent a little time talking about the tradeoffs between “concise” code and readable code in Python. Throughout that entry, I was using as an example a simple function which calculates numbers in the Fibonacci sequence; here’s one variation:

def fib(n):
    if n < 2:
        return n
    return fib(n-1) + fib(n-2)

The Fibonacci sequence is a classic example from introductory programming materials, because it teaches recursion, and recursion is an ...

Read full entry and comments

Django tips: auto-populated fields

Published November 2, 2006

One of these days I’m going to run out of frequently-asked Django questions to answer. But today isn’t that day, so let’s look at one of the most common questions people ask: how do you set up a model with one or more fields that never show up in add/edit forms, and get automatically populated with some specific value?

A simple example

Let’s say you’re writing a to-do list ...

Read full entry and comments