October 31, 2006

Let's scare the heck out of them

For reasons I still can't pin down, my dear wife decided to purchase a halloween toy this year in the form of something called Shaking Spirits. I thought it was silly but figured people would laugh at it and that would be that.

We opened for business this evening as Sarah headed out with Jon (as a dapper vampire) with Steve as the designated candy server.

My office is right next to the front walkway, so I immediately had to deal with the squawking noise going off every couple minutes. The skeleton started going off randomly and some people thought it was neat (I was seriously wondering at some point), a few laughed and there was some discussion. About what I'd anticipated.

And then the first perfect moment. A couple families, a gaggle of little girls and the skeleton of terror went off just as they passed. One girl shrieked and another let out a loud yelp, there was a lot of urgent chatter as the source was identified and then oohed and aahed over. I couldn't help it, I started laughing. After listening to the infernal contraption for 30 minutes or so, I had the payoff.

A bit later, we'd run out of candy when the treat scavenging duo returned home. We shutdown the front lights and killed off the motion detection light on the corner of the garage. I came back down to my office figuring the activities for the evening were finished and totally forgot about the electronic monster lurking a dozen feet from the front door.

You've got to love teenagers.

There's a reason that young people are the primary targets of monsters in the movies (besides the fact that young gruesomely dead bodies are better from a cinematic standpoint and the young are the primary customers). They'll blindly charge ahead where others fear to tread. Ignoring all signs of evacuation (except for my office light and a light upstairs in a bedroom), they climbed the 14 steps on the winding path or came up the rather steep driveway. We've got a half moon so you can see reasonably well, but it's still dark. They were a lively group but even when they were up the hill I figured they'd turn around.

I really hadn't considered the potential effect of the shadows near the front entrance with all the lights off. They're never completely off if you wander around a bit (it startles me occasionally) and don't actively make it so.

Now I believe I've got a better understanding of the people designing stuff like this.

When the twitching, flashing and screeching gadget launched its act, pandemonium ensued. We registered at least two more shrieks. The whole group froze in place for at least 30 seconds.

Posted by dely at 11:57 PM | Comments (0) | TrackBack

October 16, 2006

Python temp files

Recently I was wondering how to properly manage temporary files in Python. I've been sort of abusing a home grown and imperfect solution (it worked) and I was doing it again. Using tempfile was one alternative, but I'd seen the comment on mktemp() (don't trust it) which was how I'd wound up where I was.

The ActiveState Python Cookbook has a pretty good discussion. The best solution (the one I'd use if I were working on a server application instead of a bunch of development tools that access our provisioning and authentication APIs) seems to be subProcess.py by Pádraig Brady.

For a basic script, the simple tempfile idiom recommended by Tobias Polzin in save_popen2 seems reasonable after looking at the code for mktemp() (in tempfile.py) but there's a huge hole there if you're squirting around confidential data on an ongoing basis. It lays claim to a filename that doesn't exist, without actually creating it, leaving you open to more than one thread (or application for that matter) claiming the same file. The mkstemp() function might be a better idea (at least it grabs the file) but because it is set to self destruct, that's a problem if the file is passed to a process (or internal call) that closes it. That's the situation I'm in right now.

I learned a lot this past week (while on vacation?) and finally started digging around in the core Python library code. I was hoping to find a better situation but I've been disappointed with how hard it is to do well in every language I've ever used, no surprises here. You're on your own when it comes to launching external processes and managing the basic pipes that are the lifeblood of modern stitched together apps.

Posted by dely at 11:49 PM | Comments (0) | TrackBack

October 08, 2006

Eat E. coli and be happy

Based on a teaser ad for the 11 PM news, that's the cheerful message from a local television network.

With more E. coli contamination vegetable problems being announced, the talking head weekend anchor just can't wait to tell us about it. She really seemed overjoyed at the prospect.

The report won't include any kind of meaningful information about a solution (one the state will likely wind up paying for). I hope someone does.

California is highly dependent on goodwill toward our agricultural products and another high profile recall is going to push more digging into a situation the Chronicle calls an 11 year old problem. I'm guessing the ranchers and growers have fought over allocations and first use rights and the results were well lubricated with money. No doubt this'll get ugly and everyone is going to wind up looking bad.

Posted by dely at 10:57 PM | Comments (0) | TrackBack