Archive for September, 2007

Python requires forward declarations to break circular dependencies

I’m writing this rather technical post so that other people will understand this funny Python behavior. I was rather surprised by it, and hopefully this short explanation will help other people understand how to avoid this problem themselves.

Python breaks on circular dependencies. For example, consider the following two files:
from b import b_foo

def a_foo(): print 'a_foo'

from a import a_foo

def b_foo(): print 'b_foo'

If you try to run either of these files, python exits with a very uninformative error that reads like ImportError: cannot import name a_foo

However, forward-declaring the functions works:
def a_foo(): dummy

from b import b_foo

def a_foo(): print 'a_foo'

def b_foo(): dummy

from a import a_foo

def b_foo(): print 'b_foo'

Leave a Comment

Spam is the new Lewis Carroll

“Babes always whizgiggled at me and even gars did in the open WC! Well, now I whoop at them, because I took MEGADIK for 5 months and now my tool is dreadfully more than civil.”

If Lewis Carroll can invent chortling, then spam can invent whizgiggling.



A good Judo story

Our Judo instructor is an Olympic medalist in the sport, which is pretty fancy. I’m not sure why he’s here at Berkeley, but I guess you’ve got to do something to pay the bills while training for the Olympics.

Today, we were learning a technique for pinning someone. The idea was that one person would hunch over on all fours and try not to be pinned, and the other person would pry their elbow to destabilize and pin them. My partner was pulling my elbow the wrong way, so the teacher demonstrated on me. But I successfully resisted, holding my elbow still and remaining unpinned. Even an Olympic medalist couldn’t pin me! Then, of course, he used another technique he hadn’t taught us and easily pinned me. But I’m still proud that I held my own for a moment.


The Shirtless Sundays

I got a new camera, which I used to take pictures at my neighbor’s concert. He and some friends started a band called the Shirtless Sundays. They’re quite good, even though they only have 3 practiced songs so far. I especially enjoyed one where they used a didgeridoo to provide the bass:

Playing the didgeridoo

Later in the concert, they lived up to their name and became shirtless:
The Shirtless Sundays

Leave a Comment

Protected: next-door neighbor

This content is password protected. To view it please enter your password below:

Leave a Comment

I ordered a digital camera from I have had bad experiences with UPS, so I paid $3 more to have it shipped via FedEx, which is at least kind enough to have its distribution center located within a 15-minute drive. But today, looking at my package tracking, I saw this:

Date/Time Activity Location Details
Sep 6, 2007 2:04 PM At local FedEx facility EMERYVILLE, CA Package not due for delivery
6:49 AM On FedEx vehicle for delivery EMERYVILLE, CA
6:45 AM At local FedEx facility EMERYVILLE, CA

Um, WTF? They were all ready to deliver it, but they decided to wait because they only promised 3-day delivery? That’s ass, dammit. I was looking forward to getting my camera today, and it was even on the damn truck. This was not worth the extra $3.

Leave a Comment

Psych experiment subject


I’m in a class about the neurobiology reaching and pointing. That sounds a little specialized, but my research is about the theoretical structures (hopefully informed by the neural structures) that are used to produce and understand action. So it’s a very relevant class to me.

Yesterday, in class, we were talking about adaptation of motor actions, and they mentioned one of the classic experiments. In this experiment, they make a subject wear funny glasses that make everything look over to the side. Then, the subject is asked to perform some normal tasks.


The cool thing was that they asked for a volunteer to demo the distortion glasses on, and I shot up my hand as fast as I could, and was chosen. So, I scampered up to the front of the room, and put on the glasses, and then, as instructed, reached for a marker the professor was holding. I missed by quite a bit, but I soon got better at it.

Then, when I took them off, they had me try it again. I could see that my vision was finally undistorted, but as I reached straight for the marker, my finger went off to the side! I had adapted to the glasses, and it took me some practice to fix my reflexes. It sounds simple enough, but it was amazing having my body betray me like that–I felt like I was reaching straight for the marker, but I was way off. The whole class, including me, laughed in amazement.

I’m not sure I can describe the glee and amazement I feel. It was more fun than I had any right to expect, and that’s probably a measure of my geekiness. But I now know that I can fool my body, and that there’s a lot of unconscious stuff going on! The moral of the story is: take part in psych demos when you can. The results can be wildly fun.


1 Comment

Scanner fix

I relate the following story so that future searchers may quickly and easily find their solution.

I plugged my Artec e+48u scanner into my new Ubuntu linux laptop. When I tried to use it, though, it popped up the following message:

Failed to open device `artec_eplus48u:libusb:002:002′: Invalid argument.

The problem was that the firmware for the device (a file called Artec48.usb, found on the driver CD for the scanner) was not found in the required place. The conf file for the scanner (/etc/sane.d/artec_eplus48u.conf) listed a firmware file /usr/share/sane/artec_eplus48u/Artec48.usb, which was not present. After copying the driver from the CD to that place, it worked perfectly.

Leave a Comment