Blake (old posts, page 6)

Some VSS to Subversion notes.

From various places around the net. (Hint: Google "vss to subversion".)

  • Lock-modify-unlock for Svn. Not that that's what I think we should bd doing, but if I've got to sell it, and that's a sticking point, at least I have an answer now.
  • Subversion is said to be much faster. "Our CC.NET build went from 3 minutes to 35 seconds for whole tree!!!!" I haven't looked up how much of our nightly build time is spent getting files from VSS, but I seem to remember it's not inconsiderable, and that step has been failing more often recently, so if we can make it both faster and more reliable, that'll be a good selling point.
  • Ankhsvn (Wow, what a horrible front page! If I were Greg Wilson, and grading them on it, they'ld get a 51%. I mean, it's there, so I'm not going to fail you, but for the love of Pete, hire a graphic designer, or look at the other two links in this entry, or something. Please.) or PushOK or VisualSVN for Visual Studio integration, but everyone seems to use TortoiseSvn. I wonder if there's something similar for OSX? Fortunately, Eclipse integration is good enough that I don't really mind falling back to the command line client when I have to, but still.
  • A presentation on "Replacing SourceSafe with SubVersion".
  • A Perl script (shudder) to migrate your VSS repository to svn.

And there you go. Management has been feeling the pain recently, and the Server Team Lead seems onboard with the idea, so we might actually make the change. Exciting times.

More questions from a new Mac user.

Okay, y'all know by now that we've got a new Mac. And in the grand tradition of new computers, I'm trying to burn up all the hard drive space with fun or useful utilities. Since this is pretty much my first exposure to OSX, anything goes, since I probably haven't heard of it.

Having said that, here's what I have found:

  • QuickSilver
  • I installed Growl, but I don't think anything is using it, other than Transmission.
  • TextWrangler (Freeware, from the people who make BBEdit) is surprisingly my editor of choice. (Well, except for this post.) I was sure I'ld stick with vim, being old-skool like that, but I find I want to save my Terminal window for running things, and edit my source in an editor.

Oh, and the two neat new tricks I've learned so far are:

  • Command-Shift-4, then the spacebar to take a screenshot of just one window, and
  • sudo defaults write /Library/Preferences/ LoginwindowText -string "My Funny Message!!!"
    to print a message on the login window.

Response to Tim Bray.

In a recent weblog entry, Tim Bray wrote about some things he thought Ruby lacked. Since he doesn't have comments enabled, I thought I would share my opinions here, as a series of disjointed thoughts.

He said "Ruby needs an IDE. All programming languages need IDEs." Well, I completely agree with that, and for my serious Python programming (as opposed to noodling around in Python), I tend to use Eclipse, because it's there. Perhaps Ruby could take the same approach...

Of course, he also said a couple of things where I think he's a little off the mark. For instance "I should never have to scroll much; IDEs go to a lot of trouble to make it trivial to jump from wherever to the source for the method being called, or its docs, or the next compile error or breakpoint, or variable declaration, or whatever. Scrolling back and forth in a source-code file is just stupid." This I see more as a problem with his choice of editor, or perhaps his knowledge of its features. I'm fairly sure both emacs and vi allow you to jump to the things he's asking for...

"certain aspects of Unicode are, on the surface at least, objectively racist; for example, why does UTF-8 encoding of characters become progressively less efficient as you move from the languages of the Western hemisphere to those of the East?" Hmm... I don't know... My first guess would be because Western languages have approximately a 10,000th the number of characters as Eastern languages. My second guess would have something to do with Huffman coding and the prevalence of Western Language (mainly English) documents on the net, but I do recognize that this could be due to my only being able to read English.

As for Integration, isn't that what Parrot, .NET, and the JVM are supposed to provide us? If I'm wrong, and the language level is the appropriate level to solve this problem, then I sincerely hope that it's the Ruby and Python communities who get together to do something.

And finally, he missed what I consider to be the most important part of an IDE. (No, not Source Control Integration!) An integrated debugger. I had to go back to print statements to figure out what was happening in Demokritos recently, and it just sucked. So I added in some pdb support, and while it was easy to add the breakpoints, using it also sucked. Can we please show me the list of variables in a box at the top of my screen, and more than zero lines of context around the currently executing line? Please? It was so bad that I'm actually going to install Eclipse on my Mac Mini, just to avoid it in the future.

Some questions from a new Mac user.

Cc:-ed to the MacPython list, because they might know.


I'm trying to get Subversion bindings for my installed version of MacPython (/Library/Frameworks/Python.framework/Versions/2.4/) This seems to mean that I want to install Subversion, and if so, I would like to get it hooked up to Apache so that I can connect to (or whatever) on my work computer and access my home repository.

Now, I can install the subversion python bindings using DarwinPorts, but that won't hook into the Framework version of Python, so I've downloaded the Subversion 1.3.2 sources, and I can build them, but they complain about my version of Apache. Specifically, about apxs being too old.

Do I really need to upgrade apache to Apache 2 to get this all working?

Is there a good way of replacing the default Apache with Apache 2, or is that a really bad idea because the Software Update will get horribly confused?

Is there another place I should be asking these questions?


Snakes on an Apple!

As I mentioned before, we got a Mac Mini. It's been a bit of a pain getting it all set up, but I think we're finally done. The web server is moved over, along with all the websites. The mail server is moved over, and I took the opportunity to delete my mother's account. (That's not as bad as it sounds. She had it redirecting to GMail anyways, and the error message says as much. Of course, since I haven't told her about it yet, this will probably come as a bit of a surprise.) Uh, and that turned out to be all the servers I was running. Well, I was running CherryPy, and some other stuff, but it wasn't particularly important, and I've found better ways of doing it, for the most part.

But that's not really why I'm posting here. I'm posting here because I got some cool Python stuff working under the Mac, and I wanted to share it. Specifically, I (or rather, my wife and I) wanted to have a window showing on the login screen, displaying the weather. After several bits of trial and error, and liberal "borrowing" from Dethe Elza's Pastels project I finally got something which would do what I wanted. First, the code:

from AppKit import NSObject, NSApplication, NSTimer, NSApp, NSURL
from AppKit import NSURLRequest, NSWindow, NSTitledWindowMask
from AppKit import NSClosableWindowMask, NSMiniaturizableWindowMask
from AppKit import NSResizableWindowMask, NSBackingStoreBuffered
from BeautifulSoup import BeautifulSoup
from PyObjCTools import AppHelper
from WebKit import WebView, WebDataSource

import os
import stat
import time
import urllib

width, height = 620, 540

def Window(title, width, height, view=None):
    window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(
        NSTitledWindowMask |
        NSClosableWindowMask | 
        NSMiniaturizableWindowMask |
    if view:
    return window

class MyAppDelegate(NSObject):
    def update( self, timer ):
        y = urllib.urlopen( str(self.wUrl) ).read()
        b = BeautifulSoup( y )
            <body>%s<body><html>""" %
            ("".join( [str(x) for x in b.head.findAll( 'style' )]), b.body.div.div.div.div.div),
            self.wUrl )

    def applicationDidFinishLaunching_(self, notification):
        rect = ((0,0),(width, height))
        self.view = WebView.alloc().initWithFrame_(rect)
        self.window = Window('Pastels Test', width, height, self.view)
        self.window_delegate = MyWindowDelegate.alloc().init()
        self.wUrl = NSURL.alloc().initWithString_(
        self.update( None )
        timer = NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(
            1800, self, 'update', None, True )

class MyWindowDelegate(NSObject):
    def windowWillClose_(self, notification):

def main():
    app_delegate = MyAppDelegate.alloc().init()

if __name__ == "__main__":
    while True:
        if os.stat( "/dev/console" )[stat.ST_UID] == 0:
            # If the console is owned by root, start the app.
            # Otherwise, sleep until it is.
            time.sleep( 10 )

And next, the launchd plist file that keeps it running:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
<plist version="1.0">
    <string>A program to pop up the weather in a box</string>

And there you have it. Way cooler than my previous attempt, which tried to write using sudo defaults write /Library/Preferences/ LoginwindowText -string "parsed weather info here".

If any of you have any questions, I'ld love to answer them as best I can. Just comment, and I'll see what I can dig up. By which I mean email Dethe, and ask him. ;)

Coming Back

(Return path marked in green.)

Based on my experiences with tricky detours heading up to Balm Beach, I thought that I should just take nice straight routes home, and see how that worked out. So I took Highway 6/27 straight into Barrie, then Concession Road 10 to Bradford, then Yonge Street stright to Finch Station.

As I said in the previous post, there was some craziness on the trip back. The weather prediction was a 40% chance of thunderstorms. I figure those are better odds than you would get at a casino, and I don't really have any other way to get home, so it didn't really affect my planning. I got to Barrie in record time, and figured that if the rest of the trip was that easy, I would have nothing to worry about. After an Iced Capp at Timmy's I made my way onto Concession Road 10, and kept on keeping on. Sure enough, 20 minutes out of Barrie, the skies opened, and a torrential downpour started. For most of it I was reduced to peering out of one mostly-closed eye, seeing only a few tens of feet ahead of me, since the rain was apparently pelting its way through my sunglasses, to hit me in the eyes. I suppose, in retrospect, that that was a good clue to me that I should have pulled over to the side of the road, and waited it out, but at the time, I figured I should just keep on riding, over to the edge more so that cars wouldn't hit me, because who knows how long the rain would last, and I didn't want to be stuck standing there for hours. Well, the rain didn't last that long, but it did manage to completely soak me, and my shoes didn't dry out that night, nor the next. Having said that, the wet shirt and shorts did manage to keep me comfortably cool for the rest of the ride.

South of Barrie, I stopped in Bradford for a rest, gave Amy a call, and went on South down Yonge. It was getting a little hillier, and so I tried to take it a little easier, stopping every now and then. I met a nice kid who was taking the bus to his job at Canada's Wonderland. He was hoping for a thunderstorm, so that he could sit around and do nothing, and still get paid. Heh. He was also quite impressed at my trip so far. Finally, I saw the CN Tower. What a rush that was. I worked out at one point that I could describe my trip as "Go as far north as you can see. Then look north again, and go as far north as you can see. Lather. Rinse. Repeat." I never did manage to keep track of how many times you would have to do that, but it's sort of a neat idea. Maybe next year.

On Biking; or There and Back Again.

Well, that took a long time.

It would have been a lot shorter if I hadn't made three wrong turns. The first was missing the short turn South from Holland Landing Road onto Bridge Street, and instead going up Bathurst to the "No Exit" sign. (I'm very glad I decided to stop when I saw that sign, since the road got quite a bit worse after that.) The map I'm using makes it look like you can just continue along the Holland Landing Road, and it will turn into the Bridge Street, but you really do need to jog South.

The second was trying to take the North Simcoe Rail Trail, which turned out to be much like the Belt Line or the Don Valley Trail, in that it was unpaved gravel, but worse, in that it was overgrown by flowers, bushes, and grasses. It also turned out to not be a continuous trail, and at one point (between Golf Course Road and Hendrie Road) I came across an electrified fence, beyond which were six or seven cows. Now, there were warnings that some sections of the trail ran through private property, and because we're not in England, where there are Right Of Way laws which force people to let travellers through, some of the owners have decided to disallow access through their sections. I'm fine with that. Of course, since there was no way around, I had to backtrack to the last road. The thing that irks me is that there was no indication that that section of trail was a dead end, so instead of just cutting around it, I had to waste my time finding out for myself. Between that, and the slow pace I had to take while riding through the weeds, and the many road crossings, which slowed me down even further, I resolved to stick to paved roads for the rest of the trip.

The third was the longest inadvertent detour, and most disheartening of all. When I was heading out of Elmvale, I thought I was on Highway 6, which would take me straight to Balm Beach Road, but I was actually on Highway 27, which, if you don't take the Highway 6 exit, turns to the right, and heads off to Waverley after going up a huge hill. A nice couple asked me if I knew where I was, and I had them convinced for a second that we were all in Wyevale, because how could I be that far off course? But no, I was, indeed, that far off course, and had to backtrack to Highway 6 to continue my journey.

Between the extra mileage from the wrong turns, and the extra mileage from trying to avoid hills and traffic by heading up Leslie instead of up Yonge, and by trying to take the North Simcoe Rail Trail and the Tiny Trail, I ended up biking 172 km on the way there, making that my first Imperial Century (107 miles). (And I'm not just saying that so that I can have ridden more than Tanya.) For comparison, on the way back, starting and ending at the same points, I only went 131 km (81 miles).

Some more stats:

  There Back
Top Speed: 71.2km/h (44.2 mph) (37.4mph)
Average Speed: 23.7km/h (14.7mph) 24.6km/h (15.3mph)

Next up, some notes on the trip back to Toronto.

The Route.

A while ago, I mentioned that I was going to head up to Balm Beach on my bicycle. Well, the date has been set, and it's this coming Saturday. I've done a couple of successively longer rides after the 87km Musselman Lake ride, a 103km ride out to Holland Landing and back, and a 126km ride up to Keswick and back. I've planned out a route (see right), and think it should be a long, but do-able ride. It's a little bit longer than my longest ride (which was yesterday, up to Keswick and back), but I'm going to start earlier (8:00am from Steeles, instead of 9:00am from Finch), and I don't mind finishing later. (I finished the Keswick ride, including taking the subway home from Finch, at 5:30pm, but these days, it's light out until almost 9:00pm. I don't really want to be biking for 13 hours continuously, but it's good to know that the option is there, if I decide to stop for a really long lunch, or something.)

The cue sheet looks something like this:

At Dist Turn Location
a 0 (or 2.1) km R Steeles
b 1.1 (or 3.2) km L Henderson
c 2.8 (or 4.9) km R John
d 3.7 (or 5.8) km L Bayview
e 16.4 (or 18.5) km R Stouffville
f 18.6 (or 20.7) km L Leslie
g 37.6 (or 39.7) km L Mount Albert Road
h 41.6 (or 43.7) km L Yonge
i 42.1 (or 44.2) km QR Holland Landing Road
turns into Bridge Street
j 48.2 (or 50.3) km VL Holland Line West
k 48.9 (or 51.0) km R Barrie Street
l 50.2 (or 52.3) km L 8th Concession
m 53.4 (or 55.5) km R 10th Sideroad
n 81.9 (or 84.0) km L Burton Ave
o ??.? km ? A trail, or Highway 40
p ??.? km R North Simcoe Rail Trail
q ??.? km O Balm Beach Road

I'm not exactly sure what's going on at step "m", so I figure I'll wing it, depending on how the trail looks, or if there even is a trail there.

New Tires!

In pseudo-preperation for biking from North of Barrie back to Toronto, I've bought a new set of tires for my bike. So now, instead of the 2" knobbies, I'm riding on a set of 1.5" slicks. I haven't noticed the difference so far, but it's a fairly short ride from the bike shop to my office, and along the way, I was carrying my old tires. I'm hoping that I'll notice more of a difference on my ride home.

But that's not really why I'm posting this. (I'm also not posting this in an attempt to drown out Amy's talk of cute children and chcoclate cake.) I'm posting this because just this morning, I changed my tires for the first time in my life! It's true, I've never had a flat before, and I was a little nervous about getting one one my big trip, but now that I've changed both the front and the back wheel, I see how easy it really is, and it's no longer a concern for me. (The instructions I heard from a guy at MEC last Bike Week really helped, and it's really just not that hard, although I expect it's a little trickier when it's pouring rain.)

In other news, does anyone know of a good bike route from Balm Beach to Toronto?

Remind you of anyone?

I was chatting with both Tan and Kate recently, and they each mentioned how much Delphine looked like me. I completely agree, and have the photo to prove it.

No, that's not actually my sister and my daughter. That's my mother and I, circa 1976(-ish. I'm guessing that I was three in the photo).