Jan 2007

Quicksilver for Developers

If you are:

  1. a Mac OS X user,
  2. a coder, web developer, or hacker of some sort (C/C++, Cocoa, Python, Ruby, Web dude(tte),

I just found a mighty good use of Quicksilver that I wanted to share—getting at reference documentation when you’re coding. Now, I hit Cmd-Space to invoke Quicksilver, and then type in, say:

  • NSString to bring up the Cocoa Foundation documentation about the NSString class,
  • sscanf to bring up the sscanf(3) manpage, or
  • dict to bring up the Erlang dict module.

Nice, no?

Quicksilver uses a number of catalogs to create its big list of items that you can search. For example, there’s a Quicksilver plugin that catalogs applications on your hard disk, so that when you start typing iTun, Quicksilver searches the applications catalog to find iTunes. If you start typing in a person’s name, the Address Book plugin has catalogued your Address Book and will search on that.

The neat thing is, you can add your own custom catalogs pretty easily, by indexing text files and HTML files. Quicksilver comes with a File and Folder scanner plugin that you can use to index reference documentation. Adding a custom catalog is easy:

  1. go to Quicksilver’s Preferences,
  2. select the Catalog tab,
  3. select the Custom catalog type on the left-hand pane,
  4. click the + button and pick “File & Folder Scanner”,
  5. add the text/HTML file to be used as a catalog, and
  6. set the “Include Contents” pop-up button in the Inspector pane (the i button in the bottom-right hand corner) to HTML Links or Text Lines, as appropriate.

You probably want to also set Quicksilver to rescan your catalog once in a while: I’ve set mine to rescan every hour.

Here’s some example usage scenarios:

  • Cocoa developers: Add /Developer/ADC Reference Library/documentation/Cocoa/Reference/Foundation/ObjC_classic/index.html as a catalog to index the Foundation kit classes, and /Developer/ADC Reference Library/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/index.html to index the AppKit classes. Now, you can type any class name (such as NSString or NSWindow) at the Quicksilver prompt to immediately bring up the Cocoa documentation in your preferred Web browser.
  • UNIX developers: Install Bwana, which provides a kickass HTML version of your system’s manpages. (It dynamically generates them on demand, so don’t worry, it won’t take up another 100MB of space.) An an aside, Bwana’s the very first manpage viewer I’ve liked besides running man(1) itself in a shell. Run Bwana once and hit the Index button so it can index all the manpages. Add ~/Library/Caches/Bwana/manindex-.html to your Quicksilver catalog, and all of your manpages will now be indexed. Bam, type in printf at a Quicksilver prompt, and behold as all those formatting specifiers you forgot magically appear in your Web browser.
  • Erlang developers: Download the Erlang documentation and keep it somewhere on your local hard disk. Add the doc/index.html file as a catalog, and bam, type in dict to bring up the Erlang dict module functions in your Web browser.

Of course, this works for any HTML documentation, so whether you’re a Java, Python, Ruby, C++ weenie or whatever, just grab some HTML documentation and let Quicksilver index it for you. Bam! (With kudos to Zapp Brannigan, my hero.)


Design and Taste in Open-Source Software

I had a email conversation with Jeff Waugh a long time ago about design and taste in open-source software, which Jeff encouraged me to blog about. However, every time I tried to put the email into a blog article, it lost the original feel of what I was trying to say. Kathy Sierra’s superb keynote at Linux.conf.au 2007 on Creating Passionate Users inspired me to publish it more-or-less verbatim here so it wouldn’t be delayed for any longer. (Perfection being the enemy of Good and all that.) As such, here ‘tis:

… something else that I’ve been musing about in the past week is that there’s a really interesting culture difference between the Mac OS X community and the Linux community.

The Mac community thrives on shareware applications: things that cost anywhere between $5-$50. RapidWeaver, a $40 Web application creation program, is apparently used for over 3000 Web pages… There are plenty of Mac shareware developers who make enough money from their software that they can do it for a living, professionally. Wil Shipley, the author of Delicious Library… claimed he had $50,000 in sales of his first day of Delicious Library.

The interesting culture difference is that the Linux community tends to put out small, useful little programs, but with little polish. This is not a criticism: there’s a lot more programs in the Linux world to do what you want to do, and even though they’re not polished, they do work, and they’re open source whereas Mac software generally isn’t. However, it’s a completely different class of programs to Mac shareware: now that I’ve done a lot of work on a program where the UI is the really important thing, I truly admire the amount of polish and sheer effort that goes into the majority of Mac shareware programs. The icons are beautiful, every part of the workflow is accounted for, and the integration with the rest of the system is superb. That’s what you pay your $5 to $50 for, and the authors charge this because they’ve put a hell of a lot of time and effort into all these things.

The attitude difference is quite a contrast: probably the best way to sum it up is that the Linux community tends to produce cheap’n’cheery tools that they’re very happy to give away and share, whereas the Mac community has a much slower rate of production, but their production values are superb: they are completely unwilling to release stuff that isn’t up to the developer’s highest standards.

What approach do you prefer? If you’re a Linux developer, are you willing to put into practice what Kathy Sierra has to say?


The Designers of Lua on Concurrency

I came across the following quote about threads while reading The Evolution of Lua:

… we did not (and still do not) believe in the standard multithreading model, which is preemptive concurrency with shared memory: we still think that no one can write correct programs in a language where ‘a=a+1’ is not deterministic.

That is quite possibly the best one-line summary I have read about why shared-state concurrency is evil. Just say no!


Erlang and Concurrency slides are online

Moof! I’ve found some time this weekend in the 40-odd degrees heat1 to finally get the slides and Web page up for my Concurrency and Erlang talk, and have also updated the official Linux.conf.au webpage about it to point to my page. Remember kids: just say no to shared state concurrency!

1 Stupid things to do in 43-degree weather on a Sunday morning instead of sleeping in so I can recover from Linux.conf.au this week: Play two hours of tennis.


FOMS and Linux.conf.au 2007


FOMS and Linux.conf.au 2007 absolutely rocked the house. I go to my fair share of conferences each year, and even though I’m mostly a Mac OS X user these days, I can heartily say that there really is nothing that matches the flair, co-operation and vibrance of the Linux community.

The Foundations of Open Media Software mini-conference and workshop took place the week before Linux.conf.au to discuss problem areas in open-source media software and how to tackle them, and a number of worthy goals came out of it. One really important project is the advancement of totally free multimedia codecs that sites such as Wikipedia can use for their video: we’re gunning for Theora (video) and Vorbis (audio) support out-of-the-box for Firefox 3, which means that everyone will finally be able to watch video in a Web browser in a non-patented, totally open format without installing plugins or any other nonsense. Putting all the faces to names and seeing all the different projects co-operating to improve open-source multimedia and hit common goals is fantastic.

Linux.conf.au was just as stellar: the atmosphere was vibrant, talks were casual and informative, the organisation was the best I’ve ever seen for any conference, the parties were great, and the community just wonderful. Kathy Sierra’s keynote about Creating Passionate Users was the best keynote I’d ever seen at a conference, even rivalling Steve Jobs’s famous reality distortion field (and Kathy’s was arguably better, since she was actually delivering a ton of information rather than just unveiling “ooo shiny iPhone!”). As jdub would say, awesome. Thanks so much to the amazing Seven Team for organising the best conference I’ve ever been to, all the volunteers and helpers that made it go so smoothly, the A/V team that preserved the talks for all eternity (plug: including mine, of course :-).

Now to catch up on these 700+ RSS articles that I’ve abandoned reading for the week and await the return of life to normality. See you all at FOMS and Linux.conf.au next year!


Mutable State as Manual Memory Management

An engaging quote from Paul Johnson, from the January 9, 2007 issue of Haskell Weekly News:

Mutable state is actually another form of manual memory management: every time you over-write a value you are making a decision that the old value is now garbage, regardless of what other part of the program might have been using it.

My little theory: there is no reason to ever change the value of a variable except for efficiency. Instead, make a new immutable variable based on the old value, which gives you freedom to name your new variable to better describe what it does. My C and C++ code is littered with const almost everywhere, and it helps enormously when you look back at the code a month later to figure out what it’s doing.

And, just to throw in a little more Haskell evangelism from someone else who’s merrily had their brain reconfigured to to see the awe of the lambda calculus:

So far I’ve written about 300 LOC replacing about 1500 LOC of a system written in Perl… The thing that totally, utterly blows my mind is that I’ve done all this without any loops and using only 3 conditional statements. (One if and two case, if it matters. And I don’t mean this in the cheap sense that Haskell doesn’t have any looping constructs and so I’m writing recursive functions instead, which everyone knows is the same thing. There is no explicit recursion in my code. I’m just flabbergasted.


Mac OS X Software for the Uninitiated

I have a lot of friends who’ve switched to Mac OS X from both Windows and Linux in the past few years. I think it’s a good computing platform (duh, otherwise I wouldn’t be using it), but of course it can take a while to find all those handy little bits of software that make life just a bit easier.

So, since I’m a lazy bastard and got sick of regurgitating my list of Mac OS X software to switcher friends in the past few years, I finally made a Mac OS X Resources page with a list of software that I personally use and think kicks ass. There’s also a (small) collection of hints and tips, including some coding tips for those moving across from Linux. (I’m aware that the coding tips really are quite sparse — I’ll hopefully find some time to expand that in the future.) I hope the resources page is useful for someone else out there: if you do find it useful, a very simple one-line email saying thanks is always appreciated! As Larry Wall would say, have the appropriate amount of fun.