Skip to main content


Showing posts from April, 2009

Talk: Python Tools, the UNIX Philosophy, and sort Tricks

Updated link.

I recently gave a talk at BayPiggies called Python Tools, the UNIX Philosophy, and sort Tricks. Thanks go to Glen Jarvis for recording it. The "slides" are below:This is a random collection of topics related to Python tools.

Talk about the UNIX philosophy:
Small tools.
My problems tend to be too large for RAM, but not too big for one machine.
UNIX and batch processing are a natural fit.
Multiple processes = multiple CPUs.
Multiple programming languages = more flexibility.
Pipes = concurrency without the pain.
Scales linearly and predictably, unlike databases.
UNIX tools that already exist are helpful and fast.

Use the optparse module to provide consistent command line APIs:
Here's an example of the setup from the docs:
: from optparse import OptionParser
: parser = OptionParser()
: parser.add_option("-f", "--file", dest="filename",
: help="write report…

Oz: Don't See it Yet? Tell Me More!

I've been playing with the programming language Oz lately. It has an interactive interface. Conceptually, it's a lot like the Python shell. However, when you "Browse" (i.e. output) values, it outputs them to a second window called the "Browser". I could never figure out why a separate window was needed until just the other day.

If you feed the following into the interactive interface, it'll block (i.e. it won't show anything):declare A B C in
{Browse C}However, if you feed it the following:A=10
B=200It'll display 210 in the browser. It knows that it can't display C until it figures out values for A and B.

Ok, that's kind of interesting, but it gets weirder! If you feed the following into the interactive interface, it'll show "D" in the browser:declare D in
{Browse D}Now, if you go back and actually bind D to a value:D=10It'll change the D to a 10 in the browser. Crazy!

Apple: Broken Keyboard: Apple to the Rescue!

I left the gate to my office open, and when I went inside, I noticed my Return key on my MacBook was broken. I think my 1.5 year old got to it.

I read online that it's best to just bring it in to the Apple Store. It turned out that there was a small plastic part that was broken. They have a drawer full of keyboards which they use to replace broken keys. However, the Apple Store near my house didn't have the right keyboard.

I went to five Apple stores in all, and none of them had the right type of keyboard. Somehow, my 2008 MacBook is different than everyone else's. The person at the fifth store checked, and my warranty had expired just two weeks earlier.

The guy at the "Genius Bar" said, "I'm not going to petty. We'll fix it. We'll just replace the whole top case." The top case includes the touch pad, etc. and costs about $150. I gave him my laptop immediately, and picked it up four days later.

In the past (about five years ago), I had…