Indeed

Things that seemed important enough at the time

Friday, June 24, 2005

Tap Tempo - Playing with Dashboard

I finally upgraded my laptop to Tiger right before WWDC, since I was helping with the student Sunday sessions and I figured I should at least _look_ at CoreData before people asked me questions about it. I spent most of my time helping people in the "Intro to Cocoa" session, so it didn't matter that much in the end...

Before installing I'd been looking forward to using Spotlight the most, but I've been pleasantly surprised by Dashboard. I haven't used the standard-Dashboard-demo widgets too much, but here are a few that I've used quite a bit:

  • Air Traffic Control - for finding wireless networks. More for fun than anything else...
  • iTunesLyrics - a great example of something that accesses the web, but that is more than just a cover to a search site. It gets the lyrics for the current song playing in iTunes (yeah, I know, you probably figured that out from the name already)
  • Package Tracker - shows off another feature of dashboard - allowing you to have multiple copies, tracking different packages. I used to track this in my RSS aggregator, but this is a much better solution.
This week I finally broke down and started a dashboard widget, since I had an idea for one and naively thought it wouldn't be _that_ hard. It's tentatively called "Tap Tempo", and it's for... um... tapping... the tempo... of things (I'm Captain Obvious tonight). When dealing with music for Fremont I often need to know the tempo of a piece, and my $100+ metronome with that function isn't always nearby. Of course my computer always is, and the math isn't hard, so how hard can the html/javascript/css stuff be anyway? Heh...

So a few days later I finally have something that works. It has buttons, preferences, does the fancy flip, background image, etc. Well, it has the background image from the widget sample code :) And... the button is the icon from the sample code :) But hey, it works right? Hopefully I can convince Lisa to draw up something pretty so I can stop hanging my head in shame.

Here's an image for you - I'll get the real thing posted once I clean up the UI some more:

Tap Tempo In Progress
Ohhhhh soooo cheesy :)

I've been getting by with Javascript examples from an old 'jack-of-all-trades' web book and searching on google when necessary. I've been building up more links on my del.icio.us page if you ever need to find some. It's been kinda frustrating figuring out the language works (and how it interacts with html/css, etc) - I realized that I've been spoiled working in Objective-C for the past 5 years. But I really miss the development environment the most (never thought I'd say that :). Debugging using alert() to substitute for gdb or even NSLog()s is no fun - it throws a modal alert onscreen whenever you want to see something, which was recommended by one site (is there a 'print to console' equivalent?). And I miss having a compiler to warn me that I forgot a semicolon, assigned a value instead of testing for equality in an if statement, or that I typed 'val' instead of 'var', so it thinks I'm using some class instead of creating a variable - yes, all of these happened :(. I also managed to forget to add 'break' lines to cases in a switch statement, which is only interesting to me since I did the same thing 10 years ago when I was first learning C.

All in all, not the greatest week for my programming skills, but I know more about the languages now, and like I said - it works :)

But it's still ugly. For now.

5 Comments:

  • At 8:53 AM, June 24, 2005, Anonymous Anonymous said…

    You probably don't want to here this, but there's already a widget that will do this:
    http://www.apple.com/downloads/dashboard/music/bpmwidget.html

     
  • At 8:53 AM, June 24, 2005, Anonymous Anonymous said…

    Sorry, that comment was from Greg.

     
  • At 9:34 AM, June 24, 2005, Blogger cflake said…

    NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!

    Heh. :)
    I guess it would have been nice to find that before I started, but it's still been good to get some experience with Javascript.

    Also, it seems to take almost 20 clicks to get the correct tempo from that widget, and I don't always have that long to figure it out. One of the (non-pictured) features of mine is that the preferences allow you to average the tempo from 2-8 clicks; 2 is probably too small for most people, since clicking the mouse is pretty inaccurate, but you can choose what you want. Setting the iTunes tempo is an interesting idea that I wouldn't have thought of though. And the other one is prettier :)

     
  • At 7:40 PM, July 01, 2005, Blogger Paul said…

    in safari/webkit, you can do window.console.log() instead of alert.

     
  • At 11:55 PM, July 11, 2005, Blogger cflake said…

    but if you try to use that call in the actual dashboard, it will stop the rest of the method from proceeding (that took me a while to figure out, so hopefully somebody finds it useful :). Useful for debugging in the browser though - just remember to take them out later...

     

Post a Comment

<< Home

 
Google