Saturday, March 22, 2008

Eyes on the Prize

What lessons can we learn from the physical world that also apply to the higher realms of the mind and the spirit? The old quote "eyes on the prize" is actually very practical advice!

It occurred to me that lately I've been biking, playing tennis, and discussing golf if not actually playing. And each of these activities has some variation of that same "eyes on the prize" lesson. Tennis in particular has the idiom "keep your eye on the ball", repeated so often perhaps people stopped thinking about what it really means.

The most accurate tennis shot comes when you keep your head still as you make contact with the ball. The natural impulse is to pull your eyes and attention away a moment before contact, swivelling your head so that you can follow your own shot and see where it lands. But that motion can result in a shot that's off-center or that goes off-target. Now, a tennis match involves hundreds or thousands of shots, but the outcome hinges on maybe a dozen or two critical moments. The more important the shot, the more temptation there is to be distracted, the more important it is to focus on this lesson at that moment. If your opponent is at the net and you must hit a precise passing shot, or you have a seemingly easy put-away close to the net, that's the time to keep your head very still and your attention focused on the ball as you hit it. Even for a moment after you hit it, since you'll either win the point or not based on how well you execute.

In tennis, experience means being able to visualize the whole court, pick a target, and hit that target without looking at it, while looking at the ball instead. You'll hear this same advice applied to the serve; look at the other side and decide on a target, then concentrate on the ball while executing the service motion. Like magic, the ball will seek the target more accurately than if you peek at the other side partway through the swing.

Cycling has different considerations, but along the same lines. You might have noticed, if you spot something dangerous in the road and fixate on it (a rut, a pebble, a bump, a gate), you are likely to ride straight at it despite a fervent desire to avoid it. Muscle memory doesn't know how to interpret a negative directive, "don't go there". You have to turn the impulse into something positive -- focus on some area away from the danger zone and steer towards it. Depending on how treacherous and steep your path is, you either focus on what's immediately in front of you (avoid this obstacle, reach that next milestone), or you let your imagination wander farther ahead to your ultimate goal (the finish line, home sweet home).

Golf offers a third variation on the same theme. As in tennis, you perform the same precise movement over and over. As in cycling, you are going for a positive goal that's a long way off, but it's important to avoid obstacles along the way (the trees, the water, the wrong fairway). During the golf swing, again you should keep your head still and focus on the spot where the ball is, even for a moment after you've actually hit it. The golf course is big enough, and usually unfamiliar enough, that you can't visualize an entire hole the way a tennis player pictures the court. But you can form a mental image of an intermediate target, something that if you can fly the ball over it probably means you're on-target. You want that target to be something positive (the green on the other side of the water hazard) rather than a negative obstacle (the tangled brush where you'll never find the ball).

The lessons for life almost write themselves. Focus on the positive steps you're taking towards your goals and to avoid potential problems, rather than fretting about the dangers themselves. Keep executing until success is ensured; don't look away too soon (the old "counting your chickens before they've hatched"). Concentrate on the things you can control (the ball), don't be distracted by your opponents or the hazards along the way. Gain experience and think ahead, so that you can either visualize your whole plan, or (if the whole system is too big or complicated) pick the right intermediate target to know you're on the right path.

Saturday, March 08, 2008

First Look at the iPhone SDK

I've just started downloading and reading up on the recently announced iPhone SDK. The Apple development environment, Objective-C and all those frameworks, has never quite appealed enough to me to dive into them. Using those same things for iPhone apps could be the tipping point for me.

Looks like quite a nice set of sample applications to use for a starting point. And FAQs and tutorials available the first day. That's a good sign for me. People have thought through use cases, likely questions, and getting-started scenarios. Too often, good technology is bogged down in technology for its own sake, or installation/startup problems are assumed to be handwaved away.

I'm a bit saddened that Palm didn't entice me with this kind of stuff several years ago when I tinkered with Palm programming. (I have a blog post in the back of my head entitled "Why Palm Didn't Take Over the World" that deals with that notion.) With all the emphasis on rewriting Palm OS using Linux and what have you, I never saw a push for things that I felt would yield a lot of bang for the buck. Enhancements to the PC-based client software -- the Windows version never changed much, and the moribund OS X version is so limited and painful I've stopped doing any entry or synching on OS X. (With the iPhone, is there any doubt that iTunes will keep gaining more and more capabilities? Already, the iPhone demos are supplied as movie downloads through the iTunes store.) Pushing the platform to its limits -- does it really take a complete Y2K-style rewrite to, let's say, allow to-do records to have more than one category, or 256 categories instead of 16, or some combination?

The thing that continues to hold me back me a bit, looking at the sample material, is what I think of as "frameworkitis". For every conceivable thing you might want to do, there's a different method with a long name. Just memorize a few hundred of those and you're off to the races. For learning any large system, there's a balance between the number of things to learn at the first, second, third, and sometimes fourth levels. When I evaluate the usability of any development environment, I look at whether too many things (class or procedure names) are pushed up to the top level, or whether you can learn a small number of general things, and then branch off to other things that follow logically. Let's break out that simulator and see how the iPhone APIs fit into that view of the world!

Sunday, March 02, 2008

iTunes: Adding Track Numbers to Songs

Everyone fills in the basic facts in iTunes for their songs -- name, artist, and usually album -- but don't forget another valuable piece of information, the track number!

Track number is important when you're burning an audio CD. You'll want to sort by that field to avoid the songs coming out in alphabetical or some other unhelpful order. It's important when you want to verify that you have all the tracks from an album. When listening to the album in iTunes, you can sort the songs and turn off Shuffle to re-create the album experience. Ditto on your iPod, if you turn off Shuffle or set it to Shuffle Albums, and listen to songs in album order.

If a group of songs don't already have the Track Number field filled in, don't give up hope. A couple of Applescripts let Mac users of iTunes fill it in without a lot of gruntwork.

Use the first script if your song names in iTunes are stuffed with several pieces of information, including the track number. Typically, all the songs from an album will use the same format for the name, for example "01 - Happy Birthday - Greatest Birthday Songs" or "5. Christmas Album / Jingle Bells". But each album might use a different format. That's where the Track Parser script comes in. You select some tracks, enter a coded string that says how to interpret the data, spaces, and punctuation in the names. The script scans through the selected tracks and slots the information into the right fields, while stripping that extra information out of the name field. You can experiment by doing "test runs" on a single track before you turn it loose on dozens of songs. And you can save the string patterns, so that if you encounter similarly named songs in the future, you can "decode" them just by picking from a list of sample song names.

If the track information isn't in the song names, all is not lost. You'll just need to do a bit more work. First, you'll need to download and install the Albumize Selection script. Go to Wikipedia, Amazon.com, or some other "discography" site that lists all the tracks on that album. Turn off Shuffle in iTunes, put the tracks in a playlist, and sort that playlist by the first column -- the one with no label, just numbers. That puts the tracks in the order that is iTunes' "best guess" of the right order. Once these settings are in effect in the playlist, you can drag songs up and down to reorder them. When they're in the right order, select all the tracks from the album (or from disc N in a multi-disk set), run the Albumize Selection script from the iTunes script menu, and it will fill in the "Track X of Y" information for the selected songs.

If you have to go to these lengths to find out album information, don't forget to also fill in the year for all the songs in each album. That will let you create Smart Playlists based on year or decade, and sort an artist's work in chronological order.