Trouble with local cross-domain Django cookies

I’m working on a Django app which is able to serve content on a number of subdomains. The app has a number of sites, which appear as subdomains of the main domain. There’s some middleware to look things up from the request and do the right routing.

In the wild the subdomains will be done with DNS, but for local development, I’m creating entries in my /etc/hosts such as demosite.local, using .local as my ‘main domain’ locally.  After a colleague integrated some authentication code, I suddenly found I couldn’t log in on my development environment. It didn’t work with either the custom login screen or the Django admin. Very odd.

Read more...

Crazy high CPU usage on Snow Leopard and a surprising culprit

After coming back from a team-building trip, I started to notice things were going a bit slow on my work laptop. I took it with me for casual emailing and working on the train, but spent about 4 days not really using it and certainly not ‘working’ on it. It came out once to display the lyrics to a song about Pithivier, and once to check emails, but that was about it.

Read more...

Crazy idea: Hold music cadence machine

I’ve just been on a call with a client. They have Strauss or somesuch a hold music. Orchestral waltzes. The person on the other end picked up exactly at the end of a phrase. It was perfect.

My idea:

On-hold music programmed with meta-information that stores the exact timecodes of cadences and the end of phrases. When the person who is being waited on picks up the phone, the system keeps playing the music until the next point.

Read more...

In Which we Discover Some Rules About Python Scoping (which we already knew)

I’ve just been bitten by scoping in Python. If you gave me this code and asked me what it did, I’d probably guess that it was a trick question and look carefully at it. What would you say?

def demo():
number = 100
one = number / 100

numbers = [one, one+1, one+2]
big_numbers = [number * 100 for number in numbers]
bigger_numbers = [big_number * 100 for big_number in big_numbers]
print number

 

Read more...

The Annual Squash Balancing Ritual

There are few events more sought after and exclusive than the annual Balancing of the Squash. This happens in a secret location, late at night, early in November. This ritual has roots in the ancient culture of a secret society known as ’the Box of the Torch'.

Tonight the participants excelled both themselves and in some cases, each other.

It’s a legume.

Read more...