Blake (old posts, page 11)

What I do on my Mac.

From André Roberge

jennifer:~ bwinton$ history|awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn | head
86 ls
80 bzr
60 cd
56 scp
46 vi
38 exit
37 sudo
25 xcodebuild
13 spam
7 ssh

I’m not sad about that set of commands. I look around a lot, and check stuff in a lot, and copy it to my iTouch most of the time. I’m sure xcodebuild would be higher in the list if I didn’t use Command-B from inside the IDE.

An odd restriction

As I mentioned before, I’ve ported Gambit Scheme to my iTouch, and have been playing around with it a little. It’s pretty nice all in all, but I recently ran into a small problem while I was trying to play around with macros. The problem? There’s no way to enter a backtick (`) on the iTouch! That means that I don’t really have a way to write code like

`( a b ,(+ 1 2) d)

which makes writing macros a lot more painful. Fortunately, I got a lot of help from the people on IRC and on the Gambit mailing list. Specifically, Marc Feeley, the author of Gambit, posted a snippet of code that I could put into my .gambcini file that would add $ as a synonym for `. The code looked like this:

    #\$  ;; the character to dispatch on
    #t   ;; this character is a delimiter
    (lambda (re c) (##read-quotation re #\`)))  ;; handler

and the example, which works, is:

$(1 ,(+ 2 3) 4)
output: (1 5 4)

If you’re trying to write that code on your iTouch, you might notice that it includes the forbidden `, and so you’re once again out of luck. Except that in this case, you can replace #\` with #\u0060, which you can type in on the iTouch, and then it’ll all work.

On the road again…

Last night, I finally got the garage door open, after it had been frozen in a block of ice for most of the winter, and got my bike out. So this morning, I biked to work for the first time in, uh, I don’t even know how long. It was a pretty sweet ride, all in all. There were any number of reasons not to do it; my biking jeans are dirty, it’s too cold, I couldn’t down-shift, but as always there was one reason that trumped them all. I wanted to ride again. And so I did.

Some of the things I forgot about during my hiatus were how good that first cup of coffee tastes after you’ve been riding in -5° weather, what a rush it is to pass cars as they’re sitting, idling in stop-and-go traffic, and how invigorated I feel when I finally get to the office, and sit down. Oh, also how sore my butt is. Damn, that’s a small hard seat. I can’t wait to get used to it again.

Well, that’s about it. I made it in safely, and I’m sure I’ll be doing it again, and again, and pocketing the $22.50/week that would have gone to the TTC, to spend on random upgrades.

Fixing the blog for iPhones.

A while ago, I had bought an iPod Touch, and started messing around with the CSS on this weblog, to try and get it looking a little nicer on the small screen. Sadly, it never quite worked, and because of a bug in my selector (“min-device-width” should have been “max-device-width”), I broke the weblog for Safari too. Fortunately, today, I grabbed a copy of the latest version of Safari, and fixed the bug! So now iPhones and iTouches will both get a pretty version of the site, and Safari 3.1 looks beautiful again. Even more beautiful, now that SVG is supported. (Give it a try, and let me know if you can see the green ? in a circle.)

Bzr Looms kick ass!

On the Bazaar mailing list, Robert Collins wrote:

I’m happy to announce bzr-loom.

And I’m happy to use them!

My company uses vss for our version control, (I know. That should be “for our ‘version’ ‘control’”,) and we had recently announced a code freeze for an impending release. Thanks to bzr-loom, which I downloaded and installed on my birthday (the 5th), I could continue to push ahead with my work, and pop down and fix bugs in the frozen code when it became necessary, and never lose my history, and not have to deal with copying directories back and forth. Heck, by adding a thread for each proposed future VSS checkin, I even had a reasonable history in VSS when it came time to check everything in.

Thank you, Robert, for making my job far more bearable.

Other dynamically-changing stuff.

Last night I was browsing the newest iTouch apps, and I saw one called LEDBanner. It allowed you to scroll text across your screen as if your screen was a set of LEDs. My only problem with it was that I couldn’t programmatically change the text. Fortunately the source was available, and so, with only minor changes, I now have a version which lets me change the text to whatever I want.

For instance, the following scheme code:

#! /usr/bin/gsi
(define (flmod x y) (fl- x (fl* (floor (fl/ x y)) y)))
(define (%100 time) (flmod (floor (time->seconds time))
(fixnum->flonum 100)))
(define (f)
        path: "~/Library/Preferences/org.akamatsu.LEDBanner.msg"
        truncate: #t)
      (lambda () (display (%100 (current-time)))))
    (thread-sleep! 3)

changes the text every three seconds to the number of seconds, modulo 100. Which turns out to be a mostly-random number, as shown below.

The number 8.

How to dynamically change your icons.

One of the things I wanted to add to WifiToggle was having the icon show you whether your wifi was on or off, by having the switch be up or down (and the blue glow be on or off, since in Australia a down switch means that the light is on, whereas in Canada, it’s the opposite). Sadly, it didn’t seem possible, since Springboard1 seems to cache your icon.png, and ignore any updates you do to it. And so that was where I left it for a long time…

Recently, however, I was browsing through AppFlow and I noticed that the MobileCalendar application’s icon was different than the one in Springboard. Specifically, the one on AppFlow was blank, whereas the one in Springboard showed me the current day and date (i.e. "Saturday" and "1" for today). How did it do that? I grabbed the source, and grepped through it for the answer, which turned out to be a special key in the Info.plist:


When I set WifiToggle’s SBIconClass key to be the same, I too had the day and date drawn on top of my icon! Partial success! So now I’m at the point of trying to figure out if I can use any class that implements the correct interface (I’m thinking specifically about adding a class to my application to handle the updates.) Of course, I have no idea what that interface is, but hey, I’m way closer than I was this morning, so that’s got to count for something.

  1. The application launcher on the iTouch. 

How to add Markdown to your PyBlosxom Blog.

Hopefully this all just works. Include A&B, and 4 < 5.


Smaller headers


  • Lists
  • of
  • things

    Blocks of python code could be here.

etc, etc.

Okay, so now that I’ve determined that it works, here’s how I did it: I added a new entry parser, called, to my plugins directory. The content of the code looks like this:

FILE_EXT = 'md'

__version__ = 'pymarkdown 0.1'
__author__ = 'Blake Winton <>'

import markdown

    from Pyblosxom import tools
except ImportError:

def cb_entryparser(entryparsingdict):
       Register self as markdown file handler
       entryparsingdict[FILE_EXT] = parse
       return entryparsingdict

def parse(filename, request):
    We just read everything off the file here, using the filename as
    entrydata = {}

    f = open(filename, "r")
    lines = f.readlines()

    # strip off the first line and use that as the title.
    title = lines.pop(0).strip()
    entrydata['title'] = title

    # absorb meta data lines which begin with a # and consist
    # of a name and a value
    while lines and lines[0].startswith("#"):
        meta = lines.pop(0)
        meta = meta[1:].strip()     # remove the hash
        meta = meta.split(" ", 1)
        entrydata[meta[0].strip()] = meta[1].strip()

    # join the rest of the lines as the story
    story = ''.join(lines)
    story = markdown.markdown( story )
    entrydata['body'] = story

    return entrydata

And you’re done.

I guess you might be wondering why I would bother doing that, since both Amy and I are obviously comfortable writing straight HTML. Well, DrProject is switching from a custom-built Wiki-ish-syntax parser to a third-party Markdown parser, and I figured this would give me a bit of a headstart on getting used to the new syntax, and also give me a bit of a playground for testing out new features that I might want to add.

Now I feel like I’m behind the times.

I was reading a presentation about how to write better software for non-developers, and it said:

I would refuse to work on any sort of collaborative software development project that doesn’t use version control.

I totally agree. Heck, I even use version control for my personal one-off projects. But it got me wondering what people use at their jobs, so I asked my friends who were on instant messenger, as a straw poll. The results were shockingly unanimous. Subversion. 8 for 8. I regret to say that I’m not using Subversion at my job, but that may change someday. In the meantime, leave a comment, and tell me what you’re using at work or at home, either to make me feel better, or to rub my nose in it.

Update: One person uses Clear Case. I’ve heard good things about Clear Case.

Goodbye Mimi.

Today, at 3:20, Amy and I took Mimi to the vet, and had her put down.

It’s really hard, and I’m finding that I have to kind of pull back from it for a while, or I’ld be totally bawling all the time I’m writing this.

She was cranky, rude, ill-tempered, and maybe a little mean (although never to me). But I did love her, and she really seemed to be getting worse, and not enjoying life anymore, and so I think that it is the right decision, hard though it is. Heck, just looking at her, sleeping on the sofa beside me last night, I could totally see that she wasn’t right. She was in pain, and wasn’t happy anymore, and didn’t have much of a prospect of getting better. (Certainly not while we weren’t willing to spend $1000’s of dollars treating cancer. Chemotherapy seems like a cruel thing to put a cat through.) She’s also the first pet I’ve ever had to put down. I was sad when the rats died, but this feels totally different, probably because we’re doing it by choice, instead of it happening on its own time. I guess I just figured that she would disappear one night, and I could delude myself into thinking that she found another home, but it’s probably better this way. More of a sense of closure, and all that...

She went really quickly, (really really quickly,) which was a blessing, and the vet agreed that she was on her way out, and that we probably did the right thing at the right time.

I can also see why people believe in God and Heaven and stuff. I would kind of like to believe that Mimi has gone to some sort of better place, but I know in my heart that she hasn’t. That she’s just gone. And it sucks.

On a happier note, there are a lot of things I want to remember about her, both good and bad. The way her head smelled of ginger and cinnamon. The time she made Kathryn cry while she was babysitting for us. How loud and incessant her purr was. The way she would always hiss and swipe at Colin when we were all working in my living room. How soft she was under her chin. The way she let Amy (and only Amy) comfort her after spending a night at the vet. Heck, I even want to remember the way she would scratch her ass on the rug, and complain when I wanted to sit down on my couch. Damn stupid cat. I loved her.