Tuesday, November 30, 2004



I've been trying to determine exactly what it is that I hate about my current job so much. I think I've finally focused on it: I hate the feeling of powerlessness.

I'm accustomed to working in smaller companies, those that are small enough that I can accomplish things on my own. I've worked for companies where, if the e-mail server is down, I can walk into the computer room and fix it myself, or stick my head in somebody's office, tell them the server is down, and walk back to my office knowing it will be fixed by the time I get back to my desk. I'm accustomed to working on both the client side and server side of the systems I develop, and working directly with all the other developers. I am accustomed to thinking of everyone else in the company as being on "my team".

My current employer is different. It is so large that, by necessity, it is split into a lot of different departments, each of which has its own managers, its own procedures, and its own priorities. As far as I can tell, no department is responsible for providing any services to any other department; each one sets its own agenda and does what it wants. It seems that whenever I need assistance from someone in another department, I have to go through a couple layers of personnel, none of whom are very interested in helping me do what I need to do.

It's not that they are bad people, or not interested in doing their jobs as well as they can. I like the people I with whom I work. It just seems that they are not aligned with me. They are not on my team. And it pains me to realize that they probably think of me the same way.

But I am dependent on them. So, when e-mail is not working, I submit a problem report to the MIS department, and then wait a few hours to see if it gets fixed. If not, I submit another report. If I am working on the client side of a system, and the server side is not working, all I can do is ask them to fix it. I can't help, I can't make suggestions, I just have to find something else to do. I spend much of my time complaining about things I can't control, and I don't like that.

Is this inevitable in a large company? I don't know. Maybe being a tiny cog in a big machine is naturally disempowering, but I think a large well-organized company could provide a lot of resources and support that wouldn't be available to an employee of a smaller company.

I've been offered some management positions, which in theory could decrease my powerlessness. But I don't think it would work out that way. Being higher up in the hierarchy wouldn't necessarily give me any more control over what happens - I'd still be dependent on those "other people" in the other departments.

I like to do things. Being prevented from doing things is very frustrating for me. So, as I search for my next job, I'll be sure to evaluate to what extent prospective employers and co-workers will be "in my way" as opposed to "on my side".


Considering Flight Schools

I've decided that learning to fly is one of the things I want to do before I die. I've considered this in the past, but didn't because of the cost ($8,000-$10,000 is the average cost of training for a private pilot's license) and lack of time, but now I've got a little extra money to burn and should be able to get some time off from work soon.

Finding information on local flight schools on the web has been extraordinarily difficult. It seems that most flight schools have nothing more than a couple of pages on the web, if any at all. Search engines are clogged with a lot of irrelevant hits. It took a while to find a few sites that have any useful information.

The first big question is where to take the lessons. There are a few small airports in the area, but they are all at least a 30-minute drive away. As training and testing will require a couple dozen trips to the airfield, I want something close. However, I also need to consider the busyness of the airport - when I'm paying $150/hour for a plane and instructor, I don't want to spend half an hour on the ground waiting for clearance to take off. Some web searching has led me to consider these airports in the area:

There are a few other local airports, like Fulton County Airport-Brown Field (KFTY), Gwinnett County Airport-Briscoe Field (KLZU), and Cartersville Airport (KVPC) which are far enough away that I won't want to drive to them, but which I probably will use for practicing approaches and takeoffs.

I'm leaning toward RYY, because it is far enough away from Atlanta that it shouldn't be too busy, and it is also up toward the mountains and lakes that I'd like to fly over. GVL seems pleasant enough, but I'm concerned about its smallness and lack of amenities. I hope to visit these airports next weekend, to get a feel for how far the drives are and what they actually have on site.

As far as schools go, I'm leaning toward taking lessons from Aero Atlanta, at KRYY. They have the best web site, which I know sounds very superficial, but I've also seen recommendations for them from satisfied customers on a few pilot message boards. Their web site will even show you current aircraft reservations and instructors' schedules. And those Cirrus cockpits look really, really nice.

Another possibility is Superior Flight School, also located at KRYY. What I like about them is that they just got a new helicopter. I plan to take training for fixed-wing aircraft, but it might be nice to take a little trip in a heli as a change of pace.

Anyway, I'm still researching. I hope to take a "discovery flight" with one of these schools in the next few weeks, and start training in January.

Monday, November 29, 2004


Dead Mouse Batteries

I just had to replace the batteries in my Microsoft Wireless Explorer mouse. It looks like a set of batteries lasts less than a month. I guess I'll need to stock up on some AA's. I've got some Eveready rechargeables that I use in my digital camera; I'll give those a try to see how long they last in the mouse.

A Microsoft troubleshooter popped up to let me know that the signal from the mouse was weak. Good thing: I wouldn't have guessed to check the batteries if the mouse stopped working. This is my first wireless mouse (well, the Apple Bluetooth was the first, but I don't use that anymore). Checking my mouse charge is a new habit I'll need to develop.

Sunday, November 28, 2004


The Pleasure of My Company

I just finished reading The Pleasure of My Company, a novel (novella?) by Steve Martin. I was disappointed by his first novel, Shopgirl, but I really enjoyed this one.

I find that I can't talk about this book without comparing it and contrasting it with Shopgirl. Like Shopgirl, this story takes place in Los Angeles, providing Martin ample opportunity to poke a little fun at the inhabitants of that weird little part of the world. However, while Shopgirl felt like a bunch of scenes cut from Martin's LA Story with a love story thrown in to tie it together, The Pleasure of My Company weaves the observational humor into the main character's self-reflective nature. The main character is neurotic, but his behavior is not any more nonsensical than that of the other people around him.

The story is told from a first-person perspective by an obsessive-compulsive character who is isolated from the world. The character's disorders are relatively mild, and he is able to overcome them when necessary, so we can laugh along with him as he explains his little quirks (for example, he can't step over curbs, and all the lights turned on in his apartment must add up to 1125 watts). Much of the story focuses on his attraction to various women, and his strange plans to make contact with them. As a single guy with my own set of misunderstandings about the opposite sex, I can both laugh at and sympathize with his efforts.

Like Shopgirl, this book has all the loose ends tied up quickly at the end, with a lot of explanation by the author of how it all happened and what the characters think about it. This is the only weakness with Martin's novel writing that bothers me. He is good at putting together lots of funny scenes, but there is really no climax, and the resolution is just explained rather than acted out by the characters.

In summary, it's a very funny book in which I recognized some of myself. That's my favorite kind. It's also a quick read, at 163 pages.


Generate iPod Selection Script

My iPod mini's 4-GB drive will hold only a fraction of my iTunes music library. I don't want my iPod to just keep playing the same "favorite songs" over and over again, so I've set up a Smart Playlist called "iPod Selection Source" that contains only songs in my library that have never been played, and I've written a script to copy a random selection of 250 of those songs to the "iPod Selection" playlist that gets downloaded to the iPod:

-- Generate iPod Selection.scpt

property MaxNumberOfTracks : 250
property SourcePlaylistName : "iPod Selection Source"
property DestinationPlaylistName : "iPod Selection"

on run
    tell application "iTunes" to activate
end run

on GeneratePlayList()
    tell application "iTunes"
        set theDestinationPlaylist to a reference to playlist DestinationPlaylistName
        delete every track of theDestinationPlaylist
        set theSourcePlaylist to a reference to playlist SourcePlaylistName
        set restoreShuffle to theSourcePlaylist's shuffle
        set theSourcePlaylist's shuffle to true
        set trackCount to count of theSourcePlaylist's tracks
        if trackCount > MaxNumberOfTracks then
            set trackCount to MaxNumberOfTracks
        end if
        repeat with i from 1 to trackCount
            duplicate (track i of theSourcePlaylist) to theDestinationPlaylist
        end repeat
        set theSourcePlaylist's shuffle to restoreShuffle
    end tell
end GeneratePlayList

on UpdateIPod()
    tell application "iTunes"
        set theIPods to every source whose kind is iPod
        repeat with eachIPod in theIPods
            update eachIPod
        end repeat
    end tell
end UpdateIPod

So, now I can just plug my iPod in, let it sync to update play counts of anything I've listened to on the device, then I run the script to get a fresh set of files downloaded to the iPod. I can monkey with the settings of the "iPod Selection Source" playlist to control what genres or artists will be included in the mix.

[UPDATE: I've discovered that I can set up a Smart Playlist to randomly select a set of songs from another playlist. So the above script is not necessary, but still serves as an example of how to manipulate playlists with AppleScript.]

Saturday, November 27, 2004


Little Josh

I have a cousin, Josh, who is currently serving in Iraq. Josh is 14 or 15 years younger than I am, so I always think of him as being a cute little kid. I remember when he was just learning to speak, and pronounced his own name as "Dosh". I remember how my brothers and I used to hold him upside down and swing him by his feet. It's hard to think of him an adult, and impossible to think of him as a soldier in a combat zone.

Josh's National Guard unit patrols an Iraqi city - I don't know which one - in armored trucks. To let his friends and family back home stop worrying, he told us that nothing ever happened; it was just a lot of boring "driving around". He had some complaints about lack of equipment, but assured everyone that he was very safe in his armored sandbagged truck.

A couple of weeks ago, the lead truck in Josh's convoy hit an improvised explosive device (IED). Two soldiers in that truck were killed; another lost his foot. One of the boys who was killed grew up in Josh's home town. Josh was in the third truck.

We now hear that Josh is supposed to come home for good at the end of January. We're all praying for his safe return. I really want to be able to think of him as an innocent little kid again.


Apple's Incompatible Media File Formats

I've spent a day working around a big problem with my Mac's multimedia capabilities: inconsistent and incompatible file formats. This is something I would have expected Apple to get right: after all, it seems that everything uses the QuickTime subsystem for playback, recording, and coding/decoding. And the Mac is supposed to make it all work seamlessly, right? No, there are seams everywhere.


I know that some of these restrictions are due to intellectual-property issues and marketing strategies, but c'mon Apple, can't you get this stuff to just work the way it should?

Tuesday, November 23, 2004


I Like Cheese

I like /\ndy's solution to telemarketers. It's too bad I didn't see this when the pre-election pollsters were calling every day.

Sunday, November 21, 2004


Organize Pictures Script

I had a folder with over 2,700 picture files in it. Most of the filenames were generated by applying a number to some sort of prefix. For example, here are some file names:

mountain-0001.jpg  amy_01.jpg  sgh5432.jpg
mountain-0038.jpg  amy_02.jpg  sgh6662.jpg
mountain-0039.jpg  amy_03.jpg  sgh7323-a.jpg

I wrote a script that would create a new subfolder for each prefix and move the files into those folders. For example, given the above filenames, the script will create subfolders named "mountain", "amy", and "sgh", and move the files into those folders. For files that don't have a recognizable prefix, the script just puts them into a folder named "Misc".

Here's the script:

-- Organize Photos.scpt

property TopFolder : alias ((path to pictures folder as string) & "Photos")
property DigitCharacters : "0123456789"
property DefaultSubfolderName : "Misc"

on run
end run

on OrganizePictures()
    tell application "Finder"
        set theFileNames to name of every file in TopFolder
        set theExistingSubfolders to name of every folder in TopFolder
    end tell
    set numberOfFilesMoved to 0
    repeat with fileName in theFileNames
        if IsAPictureFile(fileName) then
            set subfolderName to GetSubfolderName for fileName
            if theExistingSubfolders does not contain subfolderName then
                CreateSubfolder for subfolderName
                copy subfolderName to the beginning of theExistingSubfolders
            end if
            MoveFile for fileName into subfolderName
            set numberOfFilesMoved to numberOfFilesMoved + 1
        end if
    end repeat
    return numberOfFilesMoved
end OrganizePictures

on GetSubfolderName for aFilename
    set subfolderName to GetPrefix for aFilename
    if subfolderName's length < 2 then set subfolderName to DefaultSubfolderName
    return subfolderName
end GetSubfolderName

on CreateSubfolder for aSubfolderName
    tell application "Finder"
        make new folder at TopFolder with properties {name:aSubfolderName}
    end tell
end CreateSubfolder

on MoveFile for aFilename into aSubfolderName
    set fileAlias to alias ((TopFolder as string) & aFilename)
    set folderAlias to alias ((TopFolder as string) & aSubfolderName & ":")
    tell application "Finder" to move fileAlias to folderAlias
end MoveFile

on IsAPictureFile(aFilename)
    if aFilename ends with ".jpg" then return true
    if aFilename ends with ".jpe" then return true
    return false
end IsAPictureFile

on GetPrefix for aFilename
    if aFilename's length is 0 then return ""
    if character 1 of aFilename is in DigitCharacters then return ""
    set theIndex to offset of "-" in aFilename
    if theIndex < 2 then
        set theIndex to offset of "_" in aFilename
    end if
    if theIndex < 2 then
        set theIndex to GetOffsetOfAny of DigitCharacters for aFilename
    end if
    if theIndex < 2 then return ""
    return aFilename's (characters 1 thru (theIndex - 1)) as string
end GetPrefix

on GetOffsetOfAny of aSetOfCharacters for aString
    if aString's length is 0 then return 0
    repeat with i from 1 to aString's length
        if character i of aString is in aSetOfCharacters then
            return i
        end if
    end repeat
    return 0
end GetOffsetOfAny

Running this script for 2,700 files took a long time. It was only moving two or three files per second. It was cool to watch the directory in the Finder as it ran; I could see subfolders appearing and files disappearing. A shell script could probably do this faster, but I wanted to play with AppleScript.

This script can be easily customized for different purposes. The definition of the TopFolder property can be changed to run this script to organize files in a different directory than ~/Pictures/Photos. The IsAPictureFile handler contains the logic for deciding which files to process, and which to leave alone. The GetPrefix handler contains the logic for deciding what the subfolder name will be.

Thursday, November 18, 2004


Convert Tabs to Spaces Script

Here's a simple AppleScript that will convert each tab character on the clipboard to four space characters. I use this script when copying-and-pasting scripts into this blog.

on run
    set theOriginalText to the clipboard as string
    set theConvertedText to ConvertTabsToSpaces for theOriginalText
    set the clipboard to theConvertedText
    return theConvertedText
end run

property ReplacementSpaces : "    "

to ConvertTabsToSpaces for aString
    set theResult to ""
    repeat with characterElement in aString
        if (ASCII number characterElement) is (ASCII number tab) then
            set theResult to (theResult & ReplacementSpaces)
            set theResult to (theResult & characterElement)
        end if
    end repeat
    return theResult
end ConvertTabsToSpaces


Download Clipboard Location to Desktop Script

Here's a little AppleScript I wrote to download a file to the desktop, where a link to the file is on the clipboard. It requires OmniWeb:

on run
    set theURL to the clipboard as string
    return DownloadURL for theURL
end run

to DownloadURL for theURL
    set theDownloadFilePath to GetDownloadFilePath for theURL
    tell application "OmniWeb" to GetURL theURL to theDownloadFilePath
    return theDownloadFilePath
end DownloadURL

to GetDownloadFilePath for theURL
    set indexOfLastSlash to GetIndexOfLastSlash for theURL
    if indexOfLastSlash is theURL's length then
        set theFilename to "download"
    else if indexOfLastSlash > 0 then
        set theFilename to theURL's characters (indexOfLastSlash + 1) thru (theURL's length)
        set theFilename to theURL
    end if
    set theDownloadFolder to POSIX path of (path to desktop folder)
    return theDownloadFolder & theFilename
end GetDownloadFilePath

-- return index of last "/" character in string, or 0 if it does not occur
to GetIndexOfLastSlash for theString
    if theString's length is 0 then return 0
    repeat with i from theString's length to 1 by -1
        if character i of theString is "/" then return i
    end repeat
    -- didn't find a slash
    return 0
end GetIndexOfLastSlash


My Own News Aggregator

Disappointment with Shrook and iPodderX is leading me to consider creating my own news aggregator. The features that I consider important are

Of course, the most important feature will be that I can add features and fix bugs myself.

I don't know when or if I'll get around to actually working on this. I'm still brainstorming and learning Cocoa programming.

Monday, November 15, 2004



In the past few days, I've gone from asking "What is podcasting?" to becoming a big fan.

I like music, but I have always had a hard time finding stuff that interests me. Commercial radio sucks. Local clubs are too crowded and loud. Unfortunately, my CD collection hasn't changed much since college. So I go through long periods when I don't listen to anything because I'm sick of hearing that same old crap. I bought an iPod mini a couple of months back, and had fun ripping my old CDs for a few days, but I quickly filled the 4-GB drive with stuff that I really didn't want to listen to.

On one of the podcasts, I heard podcasting referred to as "food for your iPod". That's a great description: it provides a continuous flow of new content into your playlists for you to consume. It's like a combination of independent radio and TiVo.

In the past few days, I haven't had a chance to sample too many podcasts, but here are the ones I like right now:

A few of the music-oriented podcasts are plugging the artist Brad Sucks. His album I Don't Know What I'm Doing is available for download online, and I recommend it. I think he's got a Lenny Kravitz-sorta sound; others compare him to Beck.

The podcasting tools need some work. I'm using iPodderX, which seems to download some things multiple times but not download other things at all. I'd like to just write a simple AppleScript for Shrook that would take care of automatically downloading the audio enclosures and moving them to iTunes, but Shrook is not scriptable.

Podcasting is not about getting stuff for free; it is about having more choice. Podcasts have stimulated my interest in music. While listening to podcasts over the past few days, I've bought five albums from the Apple Music Store. That's a lot more than I would have bought due to listening to the radio or watching VH1 over the same period.

Podcasting is still a pretty small movement, but I think it will grow rapidly as people catch on to it. Businesses that can learn to use technology to give a larger number of customers more choices are going to do very well; those that continue to focus on the mass-marketing of lowest-common-denominator junk are going to lose badly.

Sunday, November 14, 2004


Disillusionment with Shrook

I've been using Shrook as my news aggregator. I like the UI layout, and when things work, they work well.

There are, however, a few very annoying problems:

It's gotten me started thinking about implementing my own news aggregator. Maybe I'll take one of the open-source aggregators and add a Shook-style Cocoa UI. Or maybe I'll just keep complaining until Shrook gets fixed.

Saturday, November 13, 2004


Find Out Your Neighbors' Political Leanings

Scary: http://indexedforever.com/index.php?p=14


Painless Bug Tracking

While surfing around some development sites, I ran across a really good Joel on Software article on how to track bugs in a useful way: http://www.joelonsoftware.com/articles/fog0000000029.html.

I'm going to try to spread this around the office next week. We're using ClearQuest as our bug-tracking system. ClearQuest is a monstrosity, apparently designed to punish anyone who wants to record or find any information about problems with our software. For the simplest case, where I just want to mark a "Submitted" issue as "Resolved", it takes about four minutes of clicking buttons and putting text into fields to get it to that state. So if I have ten bugs to take care of for a release, it takes about an hour just to do the ClearQuest part of the work.

What we have is better than having no bug-tracking system, but not by much. Due to the pain involved in using it, I avoid entering change requests and other items that would be useful to track. That's too bad, because I would really like to use it for those things, and the process nazis would like me to use it for those things, but I just don't have an hour a day to devote to maintaining that stuff.


A Factoring Rule

While writing some code the other day, I discovered a rule for writing well-factored code. Maybe this rule already has a name, maybe it's a pattern, but anyway, here's what I learned:

I was writing a VBA macro to extract some data from an Excel spreadsheet and write it to a file in a particular format. I started writing the procedure, and got this far:

Sub CreateDataFile(rowIndex As Integer)
    ItemName = Worksheet.Cells(rowIndex, 

At this point, I was going to go back and look at the spreadsheet to figure out what the index was for the ItemName column. But instead of looking at the spreadsheet, I decided to just press on, using symbols for all the values I didn't have in my head, filling out my function this way:

Sub CreateDataFile(rowIndex As Integer)
    ItemName = Worksheet.Cells(rowIndex, colIndex_ItemName)
    ItemId = Worksheet.Cells(rowIndex, colIndex_ItemId)
    ItemPrice = Worksheet.Cells(rowIndex, colIndex_ItemPrice)

After finishing the procedure, I looked back at the spreadsheet and then added these definitions to my macro module:

Const colIndex_ItemName = 1
Const colIndex_ItemId = 2
Const colIndex_ItemPrice = 3

Of course, there is nothing new about the idea of using symbols to represent magic constants. What I had discovered was this meta-rule:

Whenever you are about to refer to an external document while writing a routine, don't. Instead, use symbols or other abstractions to finish writing the routine. Then work on those abstractions, continuing to apply this rule. Don't refer to the document until you have to get concrete.

The result of applying this rule is a clean separation between concrete application-specific code and abstract potentially-reusable code. It also tends to produce shorter functions, as one can only write so much without looking at some other source file, or a spec, or some sample data, or whatever.

Thursday, November 11, 2004


Scripting Sucks

I am currently in the process of learning or re-learning a few programming languages. I'm using Objective-C while learning Cocoa programming, I'm using AppleScript to automate things at home, I'm using Visual Basic for Applications to automate some Excel-related tasks at work, and I am re-familiarizing myself with Python for an upcoming project.

Most of these languages are considered to be "scripting languages". There is no agreement on what makes something a scripting language, but my criteria are that a scripting language is primarily used to implement simple operations involving already-implemented components, and is designed to be embedded within an application rather than used to create an application. The boundary is fuzzy: Python can be used as a scripting language, but can also be used as an application-development language.

None of these languages are difficult to learn, but learning them all at the same time is probably making it more difficult than it needs to be. Sure, i know all the syntax, but the hard part of learning a language is learning how to use all the libraries and off-the-shelf components that are needed to be productive. Each one has its own culture associated with it, and one must learn the ways of those cultures.

It's ironic that many programmers think that scripting languages like AppleScript and VBA are easy. In fact, making use of these languages is very difficult, because one has to learn the intricacies of poorly documented application-specific features. With AppleScript, for example, one can open an application's "dictionary" to get a list of classes and commands, but each of those items is documented with just a few words. VBA's documentation is a little more complete, but not by much, and is missing crucial information. The only way to figure out how to write scripts in this languages is to search for examples and to do a lot of experimenting.

It's times like these when I wonder why we can't settle on one programming language for simple tasks. Yeah, I know, it's because we need different ways to express different kinds of solutions. However, we often don't need these choices, especially when doing something as prosaic as exporting data from a spreadsheet. The four languages I'm using here are fundamentally very similar: they are based on sending messages to objects. The code I'm writing in any one of these languages could be trivially ported to any of the other languages, or to Java or Ruby or any of several other similar languages.

If I could choose one language, I'd choose something free with a lot of support, like Python or Ruby. But Apple had to create their own scripting language, and Microsoft had to create their own scripting language, and Sun had to create their own portable bytecode-based language, and so programmers have to be polyglots. Every time I need to write a script for a program, it's going to take me several hours to figure out exactly what ten lines of code are needed to perform the needed task, and then I'll have to go through the learning process again the next time I use that same language, because I do it so infrequently.

To all you application and platform designers out there: please don't design your own application-specific language. We programmers don't need another one. Pick Python or TCL or some other off-the-shelf solution, and we'll thank you.


The Story of Audion

Everybody has heard that WinAmp is doing a dodo. However, a similar product for Mac OS is also becoming unsupported. One of Audion's creators has written an interesting story about how the program came to be and the path it took to reach the end of its active life: http://panic.com/extras/audionstory/. The story has lots of interesting sidelinks, such as the Chipmunks' voices played at normal speed.

By the way, Panic's home page is really annoying. It's one of those displays with a bunch of cryptic icons and no text to explain any of them. They don't even have the tooltips pop up as you hover the mouse over one of the icons. If I was looking for one of Panic's products, I don't think I could find it from this page.

Wednesday, November 10, 2004


My First AppleScripts

OK, they aren't really my first AppleScripts. I used AppleScript a lot back in the Mac OS 7 days, but unfortunately most of the applications I used back then didn't support it very well. I was hoping things would be better now, but they really aren't. Apple's applications have reasonable support, but many third parties' applications do not.

Case in point: Mozilla Firefox 1.0. Released this week, I read several Mac users' comments that we finally have a good browser for Mac OS. On Windows, I prefer Firefox to IE, but on Mac, it is not as good as OmniWeb, and is not better than Safari. What really bugs me about Firefox is the lack of support for basic Mac features, especially AppleScript.

But anyway, I found a need for a simple AppleScript today. I use Shrook as my RSS reader. Shrook is nice, but is still not very polished. I was trying to download Adam Curry's Daily Source Code MP3 from the Shrook window, but the "Download Linked File" item on the context menu had no effect. So I opened the page in OmniWeb, but OmniWeb wanted to download the whole file and then play it in an ugly embedded QuickTime viewer. What I really wanted to do was get iTunes to stream it, but didn't want to go through all the hoo-hah of opening the URL in iTunes.

I haven't used AppleScript for years, so I spent a long while looking at various examples on the web and experimenting with different concepts. I finally came up with a script that would let me copy the MP3 URL to the clipboard, and then select "Open Clipboard Location in iTunes" from my Script Menu. Here's the script, which I saved as "Open Clipboard Location in iTunes.scpt" in ~/Library/Scripts:

tell application "iTunes"
  set theLocation to (the clipboard as text)
  open location theLocation
end tell

Very simple, like it should be.

After that little exercise, I decided I'd like a similar script that would open a URL from the clipboard in a new tab in OmniWeb. OmniWeb has the richest AppleScript support of all the Mac browsers I've seen. Here's the script:

tell application "OmniWeb"
  if (count browsers) < 1 then
    make new browser at front of browsers
  end if
  set theUrl to (the clipboard as text)
  tell front browser
    set theNewTab to (make new tab at end of tabs with properties {address:theUrl})
    set active tab to theNewTab
  end tell
end tell


Name Taken

It turns out that there is already an alarm clock utility named "Rouser": http://www.pcmag.com/article2/0,1759,1654716,00.asp.

So the search for a name for my alarm clock has to continue.

Sunday, November 07, 2004


Looping a Helicopter

In the movie Blue Thunder, one of the plot devices used to build up the mystique of Roy Scheider's character is his claim to have looped a helicopter, which everyone else says is impossible. For years, I believed looping a helicopter must be impossible (movies are all true, aren't they?), but it's not. When I got involved in RC helicopters, I was amazed to see model helicopters doing loops, rolls, inverted flight, and all sorts of other "impossible" maneuvers.

For an example, see this video. If you've never seen something like this before, you'll think you're watching a special effects demo reel. Laws of physics are seemingly violated, but it's all real. Full-size helicopters are capable of these feats too, if they are rigged the right way. I suspect that when people report seeing aircraft doing 90-degree turns over Area 51, they're not seeing alien spacecraft: they're watching experimental helicopters. Helicopter aerobatics make the most sophisticated airplane aerobatics look boring.

Of course, I've wanted to do these maneuvers with my own RC helicopter. The first helicopter I bought, the Ikarus Piccolo, was incapable of such maneuvers. My current helicopter, the Hornet II, is capable. The difference is that the Hornet features collective pitch control. The thrust produced by a helicopter's rotor blades is dependent on two things: the speed at which the rotor is turning, known as the head speed and controlled by the throttle, and the angle of attack of the blades with the air, known as the blade pitch. These throttle and blade-pitch controls are known as the collective. As the head speed increases, the lift produced by the blades increases, just like an airplane's wing increases lift as its speed increases. Increasing the angle of attack also increases lift. The Piccolo has fixed-pitch rotor blades, meaning that the angle of attack never changes, so lift is determined solely by the throttle. However, the Hornet can control both the throttle and the pitch, providing for a greater degree of control over lift. Collective pitch also provides quicker response, as changing the pitch of blades can happen almost instantaneously, but speeding up or slowing down the head speed takes some time.

To fly inverted (upside down), a helicopter pilot adjusts the blade pitch so that it is opposite of normal blade pitch. This is called negative pitch. Most real-world helicopters provide some degree of negative pitch, which is needed for certain high-performance maneuvers and for landing in high winds. However, real-world helicopters do not provide enough negative pitch to hover or fly inverted. They could be rigged for more negative pitch, but manufacturers do not want the liability associated with certifying their helicopters for aerobatic flight. In contrast, RC helicopters with collective pitch usually are capable of inverted flight.

I first tried loops and rolls a few months ago, without much success. I was able to roll successfully a few times, but I also crashed a few times. My attempts to loop never worked out: I would end up with a messy flip and recovery, or I would end up walking across the field to pick up the pieces. The problem was that I didn't have enough cyclic power, which is what controls left-right rolling and forward-backward pitch. The helicopter just wouldn't turn over fast enough to get back to level flight before hitting the ground.

I read of two potential fixes to this problem. The first fix was a higher head speed. Higher head speeds increase the responsiveness of the helicopter, but also make it more jumpy and difficult to control. The second fix was addition of a Bell-Hiller mixer, which increases the power of the cyclic, but also makes the helicopter more jumpy and difficult to control. To smooth out the additional jumpiness, I added weighted rotor blades, which stabilize the helicopter by increasing the gyroscopic effect of the rotor.

I made these changes two months ago, but hadn't been able to try them out. We had a few hurricanes blow through, which really screwed up our weather for a few weeks. Then work ate up all my free time. Last week, I finally tried it out. I was rusty, so I just did some simple hovering and a few figure-eights. It was definitely a lot more responsive to the controls, so much so that I had difficulty keeping it under control. i did manage to keep it in the air for thirty minutes, and take it home intact.

During the week, a made a few adjustments to my transmitter. I made the cyclic control less sensitive and increased rudder sensitivity (I had noticed difficulty getting the heli to turn sharply). I also did a lot of practicing with the Reflex XTR simulator.

Today, I gave it another try. The air was calm when I packed up and got in my car, but by the time I arrived at the flying site, there was a 10 MPH wind. Undeterred, I lifted off and did some easy flying for a while. The wind was strong, but steady, so I figured I could try some crazy stuff. I flew into the wind, went into a climb, applied negative pitch as it went over the top of the loop, then leveled out. It wasn't pretty, but it was a loop. I did a few more. None of them were pretty, and the wind was too strong for me to know how they would look in steady wind, but it was a lot easier than I expected. To tempt fate, I also did a couple of rolls, and they were without incident.

So now I officially classify myself as an "intermediate" RC helicopter pilot. Whenever we have a calm day, I'll try some inverted hovering, which is what the Real Men do.

[UPDATE: Later in the day, I did my inverted hovering and a few more loops and rolls. Unfortunately, I crashed during a simple right-side-up hovering maneuver. I'm now waiting for $85 worth of replacement parts before I can try again.]


Open Letter to the Democratic Party

A must-read: http://fromasadamerican.blogspot.com/2004/11/how-you-could-have-had-my-vote.html

Saturday, November 06, 2004


Work, Stress, and Goofing Off

Well, we have our software "finished", and it's a full week ahead of the deadline. I expect smooth sailing for the next week or so, which will finally give me some time to get back into a normal work schedule and to focus on some longer-term goals instead of the crisis-of-the-hour.

The last couple of weeks have been very stressful and tiring. I've been working long hours, and I've been working to solve many last-minute problems. I haven't taken it all in stride: I've lost my temper a couple of times, and I'm constantly thinking about just quitting without notice. However, I haven't fallen apart, and I have been detached enough to reflect a bit on how I react to stress.

I think I prefer to handle stress in a different way from most people. Most people, it seems to me, try to handle stressful situations through escapism. That is, they try to psychologically distance themselves from the stress by distracting themselves with unrelated activities. They play ping-pong, they go for a run during lunch, they watch DVDs, they do anything they can to temporarily forget about the source of stress. This is popularly known as "blowing off steam", and most people think it works for them.

I am different. When confronted with a stressful situation, my reaction is to focus intensely on whatever the problem is until it is solved. Instead of distracting myself with other things, I want no distractions whatsoever. By focusing on one particular problem, I can temporarily forget about every other problem in my life.

Because of my intense desire to eliminate the problem, I see "blowing off steam" as a waste of time. Every minute I spend doing something other than my work is another minute that I have to worry about the problem. I'm sure many people would see this as an unhealthy outlook, but I just can't make myself ignore a serious problem.

I don't think there is anything wrong with my way of dealing with stress, but it does seem to be incompatible with everybody else's way. When things get rough, I want to eliminate every distraction. I want to close my door. I want people to leave me alone. I don't want to talk to anyone about matters not related to work. I want to go into work very early and leave very late because I value the quiet of the early morning and late evening hours. When I need to leave my office, I walk very quickly and avoid eye contact with people because I have something to do and I don't want anyone to interrupt me. I don't want to commiserate with others in the same situation; I just want us all to do our jobs.

My desire for focus is so strong that it bothers me when people just want to say "Hi, Kris". It's even worse when people start asking "What's wrong?", "Why are you working so hard?", "Do you need any help?", or suggesting that I need to chill out, go home early, or take a few days off. They don't understand that locking myself in my office and working actually makes me feel much better than I would if I was trying to blow off steam the way that they do. They just think I'm wound up really tight and that I'm about to snap.

Unfortunately, I don't know a polite way to ask people to let me do my work in peace. Avoiding idle chit-chat is considered to be rude. Responding with "no, I'm busy" every time I'm asked whether I want to go to lunch, play a game, or go to an after-work party is leading my friends and colleagues to think I don't like them anymore. Keeping my office door shut seems to be the only socially acceptable way to prevent people from interrupting me, but that makes me physically uncomfortable due to the heat generated by all the equipment in my office.

A benefit of my way of handling stress is that I really don't have to work very long hours. I have a couple of intense two-or-three-hour work sessions a day (early morning and after hours), with some milder hours in the middle of the day while other people are in the office and need my attention. There is no sense in working really late, because my intense focus causes my mind to turn to mush by the end of the day and so I go home at 8 or 9 o'clock at the latest. In contrast, I see other people working 12- or 14-hour days, with lots of ping-pong, video games, and pizza breaks to keep them from losing their minds. For the same reason, I never work more than a few hours over the weekend, no matter how much work I think I have to have done by Monday morning. In contrast, I know a few "relaxed" people who work seven days a week.

A took a year off from work a little while ago. During that time, I was much happier, and I thought I had learned how to relax under any circumstances. I now understand that when I have work to do, I just can't relax. The best way for me to deal with stress is to work hard and then go home when I'm done.

Some managers pride themselves on the fact that they've made their offices "fun" places. That is, they let people goof off as much as they want, as long as the work eventually gets done. For people unlike me, I guess that's a good thing. But for me, a "fun" place to work would be one where everybody focuses on work all the time at the office, but then everybody goes home at 5 o'clock and never has to work on Saturday or Sunday. Some people think work can be fun, but I think having one's work finished is a lot more fun.

Thursday, November 04, 2004


CNN Post-election poll

I ran across this story on CNN.com. It starts with this conclusion:

Americans by and large appear to be happy with the results of Tuesday's elections and are hopeful the country will be drawn together during President Bush's second term.

Let's see how they reached this conclusion. First

Just over half -- 51 percent -- of 621 American adults surveyed said they were pleased with the outcome of the presidential election; 38 percent said they were upset.

51% are happy with the outcome. That's not surprising, considering that 51% of the electorate voted for Bush. And it would seem that 80% of the people on the other side are upset.

Later in the article, we have this:

One-third of respondents said they were optimistic about Bush's second term, and 23 percent were enthusiastic. Another 24 percent said they were afraid and 18 percent expressed pessimism.

So, just a little over half are optimistic or enthusiastic, and a little less than half are afraid or pessimistic.

The initial claim, that "Americans by and large appear to be happy with the results" just doesn't make sense. To me, "by and large" would mean a vast majority. Instead, the poll seems to indicate deep divisions, anger, and uncertainty. The opinion of a slim majority cannot be considered to be the consensus among all. When the opinion of the minority is dismissed, it intensifies the polarization.

I don't expect insightful analysis from CNN, but this is ridiculous.

[UPDATE: On January 20, 2005, CNN has another poll which shows that the public is split as to whether Bush is a uniter or a divider.]

Wednesday, November 03, 2004


More of the Same

In Citizen Kane, there is a scene where Kane's newspaper staff is deciding what headline to run on election day after Kane's run for the governorship. Had Kane won, the headline would have been "KANE WINS!". However, he didn't win, so the headline they use is "FRAUD AT POLLS!".

I spent most of my time watching PBS's NewsHour coverage of the election returns, but I jumped around to the other networks. When Ohio was called for Bush by NBC, apparently sewing things up for Bush, the commentators started admitting that they were surprised. Early exit polls had shown a likely Kerry win. Most of the journalists thought it they'd be projecting a Kerry win early in the evening. They told us none of this until after Bush had apparently won. I suppose it's a good thing that they didn't report on the what they thought the outcome would be while it was going on, but it makes me wonder what else journalists know that they won't tell us.

C-SPAN's election map is pretty cool. I heard that on CNN.com, one can find the data on election returns for each precinct/county. I'm not sure how "useful" any of this data is, but political information junkies must be thrilled with what they can get on the Internet these days.

My favorite election news story of the day was this one.

Tuesday, November 02, 2004


Rouser 1.0 Release

I don't know if anyone is interested, but my simple Rouser alarm clock application is available for download from here: http://kristopherjohnson.net/download/Rouser-1.0.dmg. Source code is included, and it's all free under an MIT-style license.

It mostly works. The Print and Help commands don't work. OS X 10.3 (Panther) is required; I don't know what it will do (if anything) under older OS X versions.

For the next version, I plan to provide the following:

If you try it out, please let me know what you think.


My Voting Experience

Happy Voting Day, everyone!

I first went to my local polling place at 10:30 AM. The line was wrapped around the parking lot, it looked like at least a two-hour wait, and rain was likely. I was, in one sense, pleased to see such a huge turnout, but I also wondered why our local election officials hadn't made better arrangements. I didn't want to wait for two hours in the rain, and couldn't find a place to park, so I decided to return later.

At 2:30 PM, things were better, so I got into line. The polling location was an elementary school cafetorium. As I walked through the line, I looked at the decorations and other items on the walls. The theme was "Rock and Roll", with paper cutouts of acoustic guitars and record albums (how many elementary school kids have ever seen a vinyl record?). The menu for the previous day's lunch included a "chix sandwich", which made me wonder if the meat came from the same animal that is the source of McNuggets.

During my 45 minutes or so in line, I thought a lot about the voting process. My thoughts drifted toward cynicism. I thought about the futility of voting in a state that will probably go 60% Bush. I thought about the fact that in most of the local races, the incumbent was running unopposed.

I did have a pleasant Democracy Moment: as I neared the end of the line, the woman behind me said "Excuse me, this is my first time voting in this country. Can you tell me where I go?" I suddenly felt very proud to be welcoming a newcomer to the wonderful world of freedom and democracy. (For all I know, she may have come from a country that is more free and democratic than the USA, but I took my duties as Ambassador of American Glory very seriously.) I wasn't sure exactly what we had to do, so I explained that the procedures were different in every location, and if we'd just go to the first table and do what the election workers said, they would tell us what to do next. She thanked me as we walked forward to the table to fill out our voter forms, and my cynicism was gone.

It returned when I was handed my "voting card", a smart card for the paper-free touch-screen voting machines. The machines were easy to use, and I have no reason to believe they are any less secure than the punch cards we had in previous elections, but I left with the feeling that my vote hadn't really been registered by the machine. Maybe it's just a side effect of being a computer programmer, but I have absolutely no trust in these things.

So now we'll have to sit back and see who wins the first vote count. Then who wins the second vote count. Then the first lawsuit, and so on. Several bloggers I read seem to think that things are leaning toward Kerry, but they're pro-Kerry so I can't believe them.

I am left with good feelings about the day. Even with my cynicism, I was impressed with the cheerfulness and courtesy of the other people in line. There were no loudmouth idiots expounding simplistic views, or people who have nothing to do but belittle the views of others. I think there's hope for civility in America.

Monday, November 01, 2004


On Writing

I like writing code. I like writing documentation. I like writing specs. I like writing e-mail and letters. I like wikis. I like writing in my blog. I like writing.

What do I like about writing? I like the process of organizing my thoughts and seeing them on paper/screen. I like continually revising what I write; I can never make it perfect, but I can always make it better. It's nice when other people read and comment on what I write, but what I like about writing is personal and internal.

I've toyed with the idea of becoming a professional writer. In a way, I already am, as a programmer is really a writer of a very specialized kind of writing. However, I'd like to be a "real" writer: one who gets articles and books published and spends most of his time writing English prose rather than a mishmash of math and symbolic logic.

Unfortunately, I don't know how I can make a living at writing. I don't know what I could write that I could get paid for. There have been times in my career when I could have written really good technical books about implementing ActiveX controls and containers with MFC and ATL, or about developing CORBA applications. I never had the time to write those books, and now those subjects are no longer interesting to anyone.

When I was developing Remoting.Corba, one of my dreams was that it would become popular enough to warrant publication of a book. The content of the Remoting.Corba wiki, bulked up with a bunch of screenshots and appendices, would have made a book that is at least as good as most of the books in the Computers section of the bookstore. The project died, but that wiki still stands as the most book-like thing I've written. I submitted a R.C article at the request of a Microsoft employee for publication on the MSDN web site, but interest in R.C waned before it was published.

I don't have the depth of knowledge to write good technical books about current subjects, because I am now a primarily a manager and I don't get to spend enough time delving into new stuff. Maybe there could be a .NET book or a Cocoa book in my future, but right now I really don't have anything to teach anyone about programming.

I've been told that I have a gift for explaining things to non-techies without dumbing it down too much, so I've considered writing books or articles targeted at people who have to deal with technology but don't understand it. A subject area that I've considered is the interaction between software developers, customers, and managers. My working title is Talking to Techies. The work would be an attempt to explain to non-techies how they can best get what they want when they need assistance from software developers, network administrators, and technical support personnel. Too often, I see communication between these groups break down, as the non-techies don't accurately or completely specify what they need, and the techies provide a useless solution or no solution because they don't understand the needs or think they are being asked to perform impossible tasks. A companion book could be targeted at the techie audience who doesn't know how to explain issues to non-techies.

I signed up for the National Novel Writing Month (NaNoWriMo) event. This is a "contest" where participants must write a 50,000-word novel during the month of November. Entries are not judged; anyone who writes a novel with 50,000 words is a winner. I wanted to do this, but now I don't think I will: I don't have time, and I don't have a story in mind. Instead of trying to write a novel, I'm currently reading Robert McKee's Story in the hope that maybe I can develop an interesting story for next year's NaNoWriMo.

While I'm ruminating about all the books I'd like to write, I'll just keep scribbling in this blog, sending too many e-mails to my co-workers, and contributing to wikis. I hope that if I just keep writing, I'll eventually find a book in there somewhere.


Building Emacs for Mac OS X from Current CVS Source

For any of you lazy people out there who want a current build of Emacs, but don't want to read the docs, here are the commands that will retrieve the source and build it:

cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co emacs

cd emacs

./configure --with-ns

make -j2

sudo make install

Then, copy or move nextstep/Emacs.app to any desired location (like the Applications directory).

For details on different ways to build it, read the nextstep/INSTALL files after extracting everything via CVS.

You need to have the Developer Tools installed to build Emacs. I have Fink installed as well, but I'm pretty sure the above commands will work fine without it.

[UPDATED 2006/03/04: Fixed the cvs command above to use the current repository.]

[UPDATED 2009/01/12: Now builds the Cocoa version (Carbon build is no longer supported).]

This page is powered by Blogger. Isn't yours?