Ken Kinder's personal website

Author Archives: Ken Kinder

Making httplib log debug information

As opposed to having it print to stdout. Here’s how…

Worst lock acquisition code ever.

Courtesy of CherryPy:

while True:
try:
lockfd = os.open(path, os.O_CREAT|os.O_WRONLY|os.O_EXCL)
except OSError:
time.sleep(0.1)
else:
os.close(lockfd)
break
self.locked = True

Really people, [...]

The Wordy Shipmates

In the unplanned spirit of Thanksgiving, I recently finished Sarah Vowell’s The Wordy Shipmates. Written as a cross between a history book and a mémoire on the Massachusetts Bay, it’s so-named as a commentary on the Pilgrams’ verbose writing style. Vowell has a bookish snarkiness that makes the book worthwhile. Read it.

Decorating your methods

You can read about Python Decorators in the PEP like I had to, or you can just skip to the good stuff.
Python decorators are a way of modifying a function, of quickly wrapping it. They’re sort of like aspect-oriented programming, in that they let you define logic that cross-cuts methods all over your program. Here’s [...]

PyLucene 2.0 on Ubuntu 5.10

I took me a mailing list post and some banging my head, but here’s how to get PyLucene 2.0 running on Ubuntu 5.10 (Breezy Badger):

Coffeeshop Typewriter

Good times…