Introducing TraineoWeight.wdgt

Yes, I really want to lose that muchTraineodone

Update: The traineo guys provided an API and I updated the widget. See: TraineoWeight.wdgt Updated

Like most Americans I’d prefer to be less fat. To help me with that goal I’ve been logging my weight on traineo.com. They offer plenty more than just weight tracking, but I haven’t gotten into all that quite yet. Anyway, it seemed silly to log into a web page just to enter my weight each day (who has the time for that! :) </lazy>). So I pinged the traineo folks and got this in reply:

I’m afraid that at the moment we don’t have an open API, although we are planning to release one in the not-too-distant future.

<snip>

If you want to input your weight remotely, this is possible, but not something we actively advertise, as it’s currently not really ready for public consumption.

If you were to visit http://they.made.it.sound/like/i/shouldnt/share while logged in (i.e. you have a cookie saved in your browser (they don’t go stale for a long time)), your weight would be submitted.

To which I said (to myself): “C Is for cookie, that’s good enough for me!”.

When I found myself awake at 3am[1]. I knew just what to do:

1) Fire up Dashcode
2) Author a widget based on a template Apple provided[2] using 1997 methods of screen scraping[3].
3) Publish widget with minimal testing
4) Hope traineo doesn’t change their response HTML

This took ~3 hours of my time[4] and surely has bugs and will surely break when traineo changes their response. I provide this “as is”. With that:

Enjoy! TraineoWeight.wdgt.zip Make sure you log into your traineo account with Safari first.

[1] our 3 year old likes to wake me up and make me tuck her back in (it’s not that bad really - I’m sure I’ll miss it when it stops).
[2] I can’t make pretty things. But I can copy pretty things!
[3] .substring() - I fought the DOM parser for too long and finally reverted to .substring(). Yes, this is a hack and this widget *will* break someday…possibly soon.
[4] I would have never tried this without Dashcode. It’s pretty slick. Two thumbs up.
[5] Wait…there wasn’t a [5]. Well, if you want access to the Dashcode project let me know and I’ll put up an svn repo. Feel free to take the widget and do with it what you will.

One Response to “Introducing TraineoWeight.wdgt”

  1. Maxwell Lamb Says:

    Awesome - fast work! Feel free to drop me an email, and we’ll talk about how we could provide something a little more robust for you - such as an API key/hashstring for users, so they don’t need to worry about cookies etc.

    Cheers,

    Maxwell

Leave a Reply


© 2006 roobasoft, LLC