Wednesday, December 5, 2012

Exercising my inner geek


Overview: The Y Mobile App is something that I wrote (and continue to maintain) for free in my spare time.  My previous "smartphone" was underpowered and incapable of displaying the "official" on-line exercise schedules, plus I wanted a quick way to check and see what was happening at the locations around me. 

I initially shared the app with friends and other members that I knew. Those people liked the app for its convenience and usefulness, and shared the link via Facebook and E-mail. Some people find that this app helps them discover new Group Exercise classes to try - there's a wide variety of classes, and the Group Ex instructors are great (I'm always amazed - and very thankful - at the amount of work they put into running those classes)!

If you have any comments or suggestions on improvements for the app, please leave a comment below!


The long story (with lots of geeky details):

A few years ago, I joined the local YMCA in attempt to counterbalance the hours that my butt spends in my office chair. One of the "member benefits" are the various Group Exercise classes (most of which still intimidate me - because I'm a geek, which means I'm accustomed to not fitting in). Since I bounce around between a few of their locations, it's handy to have on-line access to the schedule information. The problem is that their web site wasn't very compatible with my stinkin' old first generation LG Optimus cell phone. 



The phone has a decent web browser - the usual WebKit enabled thing that came with Android 2.2 (FroYo) - it just didn't like all of the lovely Flash widgets used by the YMCA site, and the response time was longer than my attention span (I hate waiting on computers - which is a driving factor in the software I write - if I can't stand it, nobody else should either). One day, when I was using a "real" computer to view the Group Exercise (Group Ex) information on the YMCA's website, I noticed the queries were landing at a website called GroupExPro.com, with a bunch of "human readable" parameters on the query string.

My inner geek couldn't resist the temptation, and I hit F12 to bring up Firebug and check out the  interaction between the browser and their site. I fiddled around with the options to see if a JSON response was possible (rather than the pre-formatted HTML stream), but couldn't find it. I decided to send an e-mail to the site's support/contact address to see if they already had a JSON option available. I was surprised to receive a response (on a weekend night!) from one of their developers who gave me the magic parameter needed to receive a JSON response. After a little testing with 'wget' (relax, I've started using 'curl' more often these days, due to development with RESTEasy), I was able to tweak my query strings to assemble the information I needed.

Since it was winter 2012 when I gleaned this information, I was ready for a fresh "geek project", and this seemed like a perfect fit. I was working on learning more about Google's AppEngine (GAE) and their App Engine Datastore (yeah, yet another NoSQL implementation). After a few nights of work, I had the "alpha release" ready for use. My app pulled the JSON data from the GroupExPro website every few hours, and stuffed it in the Memcache since it's "expendable information" that can be re-obtained if/when the Memcache fails or gets flushed.

The whole thing is coded up in GWT, which worked great for this project - On the Client Side, GWT provides simple RPC with the server, UI event handling, Browser History management, and compacts all of the UI's files into an obscenely tiny download. The hosting on GAE is free because the amount of CPU and bandwidth used by my app falls below Google's minimum thresholds, which means free hosting!

Here's the link to the live application (still running in Google App Engine):
http://ytwincities.appspot.com