Thursday, 2 May 2013

Nerd Talk Today!

Coding used to be a big part of my job.  Did a lot of stuff in Perl, some C, some Java.  My crowning achievement was setting up my own server at home to run a hockey pool, scraping the ESPN web site for nightly stats, updating a database, and serving the results to a web page that the hockey pool participants could check for their standings.  But the last 7 years have been pretty dry.  I do some stuff here and there for my dad's company but not much else.

I still get the itch now and then though, so when the sleep clinic tech handed me a sheet of paper and said I had to track major sleep events over two weeks, I thought there must be a better way.  I couldn't see myself carrying around this piece of paper and a pencil to mark down every time I went to bed or had a meal or took a leak.  The only thing I carry around with me 24 hours a day is my phone so that seemed like the best spot to record this info.

My first thought was that there surely must be an app out there to track these things.  Nope.  So then I thought this would be a great opportunity to learn how to write an app for Android.  But I realized that such a project would more than likely absorb more time than I had available between now, Peanut's birth, and my return to the sleep clinic in a month.

So, something simple to track these events that's readily available on my phone.  A spreadsheet made sense and Google has their Docs platform available on the web and on Android as part of Google Drive.  The spreadsheet component is pretty basic but I thought it might do the trick.  I duplicated the grid layout that was on my sleep diary sheet and added dropdown lists to select from the standard codes they had defined for sleep affecting events.  But I needed a way to automatically time stamp each entry.  I just wanted to pick a code, hit enter, and have the entry time stamped so I could transcribe it to the sleep clinic's sheet later.

That's when I found that Google Drive has a whole scripting component that I had no idea about.  It's their server-side implementation of VBA.  I was fascinated and spent a couple hours digging through their API and hobbling together a script to do just what I wanted.  I was quite pleased with myself.

Until this morning.  I was just sitting down at my desk and I was still thinking about the sleep diary.  I did a little more digging and found out about Forms in Google Drive.  Within 5 minutes I had a simpler, cleaner, more accessible solution than what took 2 hours the night before.  Felt kind of deflated after the coding high from the night before but I still marvel at how easily solutions to modern "problems" can be fabricated.

Thanks for listening.  And for the 2 people out there who might find this topic interesting, I highly recommend checking out Google Drive scripting.

No comments:

Post a Comment