Archive for July, 2004

Napolean Dynamite

Friday, July 30th, 2004

My wife and I saw the movie Napolean Dynamite this evening.

I’m one of those people that generally cannot stand movies. The stupid plot, the stupid need to have a happy ending, the stupid director’s ego ruining something that could have been good [AI, for example], or the assumption that the audience is no smarter than your average bag of rocks.

I really liked Napolean Dynamite. A very strange and wonderful movie. It was wonderfully stupid and had an absurdly enjoyable plot. Thing Breakfast Club meets Slackers with the non-violent part of Fargo thrown in for good measure.

KeySpan Remote: very useful with iTunes

Thursday, July 29th, 2004

I picked up a Keyspan Digital Media Remote today. As long as you install the beta driver (scroll down), it works flawlessly (the volume control doesn’t work in the production drivers on recent versions of OS X).

With this, I can now remotely control the iMac that acts as both the main music library and occasional DVD player. Out of the box, it is quite useful; track forward/back, volume, mute, play, pause, stop and a handful of other keys I can’t remember.

The “key editor” will let me assign AppleScript scripts to the buttons, as well. So, I’m going to make the directional buttons set the rating on the song and the select button effectively do a Do not ever play the currently playing song again. Not ever. It sucks. Make it go away! Play the Next Song!!!

Cool gadget for less than $40.

Cool PyObjC Trick

Thursday, July 29th, 2004

With PyObjC, you can edit classes at runtime on an ad hoc basis. In particular, you can change what methods a class responds to, both adding and replacing methods in a class with new implementations at will. You can also cache the original implementation and easily invoke it from your replacement implementations.

% python
>>> from Foundation import *
>>> from objc import classAddMethods, classAddMethod
>>> oldDescription = NSObject.instanceMethodForSelector_("description")
>>> def newDescription_(self):
...   print "New %s description" % oldDescription(self)
... 
>>> x = NSObject.alloc().init()
>>> x.description()

>>> classAddMethod(NSObject, "description", newDescription_)
>>> x.description()
New <NSObject: 0x379a70> description
>>> 

The same can be done in pure ObjC (mostly C, really), but it is a lot harder.

AnswerBag & WikiPedia

Monday, July 26th, 2004

The answerbag is an awesome site that collects questions and allows users to post answers. A community driven rating system evaluates the quality of the answers and generally seems to filter the noise from the signal quite effectively.

The questions range far and wide and the answers are typically succinct and accurate. Generally.

I had been consuming their RSS feeds (summary of feeds) for quite a while and found it to be an interesting way to throw some random bits o’ information at my brain in the morning.

Now I am finding myself throwing out an answer or two and rating other folk’s answers. Kind of fun.

Unlike answerbag, WikiPedia is intended to be an open content encyclopedia in many languages. It is truly an incredible resource.

Holes!

Tuesday, July 20th, 2004

I always wanted a hole big enough to camp out in. I don’t know why. It just seems like a good idea. Maybe it comes from spending a lot of time in caves in the midwest while growing up.

As such, this guy amuses me at the same time his story has inspired me– not for the first time– to dig a hole in my yard.

I don’t think I’ll be playing with firearms in my hole, though. I’m betting that doing so would put me firmly in the “bad neighbor” category.

Maybe so, maybe not…. when I was 8, I had friends that liked to dig holes with me. At 34, I’m thinking that may no longer be the case. Then again….

Useful python bits.

Sunday, July 11th, 2004

I haven’t disappeared! I have just been incredibly busy with WWDC and related development work. Unfortunately, our stuff hasn’t been pushed outside of NDA’d channels, so I can’t start swamping my weblog with interesting code snippets related to my day job. I am building up quite the list of “to post” hacks, though.

I have been writing little bits of code to make eliminate repetitive tedium from my world. I’ll share what I can. All scripts are available on my public iDisk. Mount http://idisk.mac.com/bbum/Public/ in the Finder or visit my tedious file download page.

First up, if you use Python to bring sanity to shell scripting like tasks (a wonderful thing), then you likely need to execute lots of external commands in a shell like fashion. Process (formerly popen5) is an absolute god-send. It brings total sanity and a bit of security to invoking external commands from within Python:


pkgs = glob.glob('*.pkg')
for pkg in pkgs:
    process.call(['/usr/sbin/installer', '-pkg', pkg, '-target', '/'])

The above being a snippet from a script called bulk-install.py When invoked (typically by sudo python bulk-install.py it installs all pkgs and tarballs in the current working directory (tarballs are just untarred into /).

Just copy the two scripts into a directory, drop any packages and tarballs into the directory and run the script. It is the first thing I run whenever I install a new system. That way, I’m always guranteed to immediately have PyObjC, the Python bsddb and sqlite modules, Subversion, iPhoto, OCUnit, Keynote, the Python documentation and everything else I need regularly.

Ebay careers: Mac/Linux users need not apply.

Sunday, July 11th, 2004

Ebay’s job search site requires Internet Explorer.

That’s kind of pathetic.

A friend noticed this recently and I finally had a chance to check it out. To be fair, I didn’t test with IE on the Mac. Maybe it just works? Not that the site gives any indication that IE exists for Macs.