Generate heart rate charts from MapMyRide TCX files

So I had some free time over Columbus Day weekend and figured why not spend it on a fun programming project. My politically-incorrectly named GhettoTCX project emerged after some quick fussing around with TCX (XML) file.

Ghetto TCX

GhettoTCX will parse a TCX file from Garmin, MapMyRide, etc. and generate some basic plots. The most interesting plot type is the heart rate zone chart. It can create a panel of plots, by parsing all the filed in a given directory.

It’s called GhettoTCX because it’s a no-frills, nothing fancy, not even a true TCX file parser. It simply searches for some keywords and pulls out heartbeat info and lat/long data. And not even at the same time, you need to the read the file twice if you want to plot both.

Heart Rate plots
Heart Rate plots

The example code and python code repository can be found on the project’s github page.

There are “better” TCX/XML file parsers out there. This one was meant to do one thing (actually two things), quickly and easily: plot heart rate (and heart rate zones). It can also plot lat/long data points onto a scatterplot, but it is seriously no-frills when you can get nice google maps charts on MapMyRide and practically any other fitness app out there.

It started out (and ended) as a fun weekend programming project… if you are curious about your heart rate zone, and are too cheap cost-conscious to pay the monthly subscription fee to MapMyRide for the heart rate zone chart, you can use this free tool instead. Enjoy!

Facebook Kicks Off Implementation Of QR Codes

I can’t see this on my own Facebook profile yet, but we’ve gotten a number of tips in our inbox in the past 10 minutes so it’s safe to assume it’s not a hoax or anything: Facebook appears to have started enabling users to generate custom two-dimensional QR codes.

From the looks of the screenshot embedded above, there are two types of QR codes: a personal barcode or a “status QR barcode”. This also seems to appear on Facebook Fan Pages.

via TechCrunch: Facebook Kicks Off Implementation Of QR Codes .

QR barcodes are two-dimensional bar codes… similar to what you see on computer generated postal stamps when you use USPS automated kiosks.  The QR codes on facebook would have a link to one’s facebook profile, presumably.  This has tremendous potential, I believe, and could be use in everything from loyalty marketing programs, to integration w/ airline/hotel checkins etc. Of course, there’s the privacy issue, but that could be fixed with PGP or other security issues.  Heck, why not use the QR codes to store your public PGP key and use as a voter identification at these new high tech electronic voting booth.  Lots of possibilities here… a cheaper alternative than embedding RFIDs on everything… (I wonder if people realize how companies have begun embedding RFIDs in clothing — well, that’s a topic for another day)

GameSalad – Game Creation for the Rest of Us ™ –

This is insane… wow, very cool. I wonder how long it really takes to generate a game from scratch…

What is GameSalad?

GameSalad is the world’s most advanced game creation tool for non-programmers. With GameSalad, game makers of all levels can bring their ideas to life without programming a single line of code. Build games visually using a drag-and-drop interface along with a robust behavior system. Publish your games quickly and easy to the iPhone, iPod Touch, Mac Desktop, and the Web.

GameSalad – Game Creation for the Rest of Us ™ –

Free Stanford course on developing software for iPhone and iPod

This is a great resource:

Want to know how to write programs for the iPhone and iPod touch? Beginning this week, a Stanford computer science class on that buzzworthy topic will be available online to the general public for free. The 10-week course, iPhone Application Programming, is a hot ticket. It begins today and videos of the classes will be posted at Stanford on iTunes U two days after each class meeting ( Copies of the slides shown in class will be available there as well.

iPhoning His Way To Retirement

Video on YouTubeEugene Lin wanted some iPhone App Store money. So he made one iPhone app that was eventually accepted, then another that was rejected and then he found a hit with the racy Peek-a-boo. Along the way he learned the ins and outs of the App Store approva process and made quite a lot of money in Japan. He shared his findings on this episode of the Ignite Show. Eugene was filmed at Ignite Seattle 8 in the funniest talk of the evening.

Google shows off Chrome OS tablet ideas –

On Monday, Glen Murphy, a user interface designer for Google’s Chrome browser and the Chrome operating system based on it, pointed to image and video concepts of a Chrome OS-based tablet that went live two days before the iPad launch. Apparently nobody noticed initially, because only now did Murphy tweet, “Apparently our tablet mocks have been unearthed.”

Google shows off Chrome OS tablet ideas –

Developing iPhone applications using Ruby on Rails and Eclipse, Part 1: Serving content for iPhones

Been wanting to develop an iPhone app for a while.. either real app or a web app… Found these links helpful

FROM IBM: Developing iPhone applications using Ruby on Rails and Eclipse, Part 1: Serving content for iPhones.

IBM: This article shows how to build a Ruby on Rails application that dynamically recognizes iPhone or iPod touch browsers (throughout this article, I refer to the iPhone — remember that everything here also applies to the iPod touch), while allowing Mobile Safari users the option of seeing the full Web content if they want. The article also focuses on the server-side structures needed to support serving separate content to iPhone users and how to start to serve iPhone content. Part 2 of this “Developing iPhone applications using Ruby on Rails and Eclipse” series focuses on how to give that content an iPhone look and feel.

If  you are wondering how to change the user agent in firefox… check this out…

code snippets

Creating a boolean radio button set while trying to build upon the source code samples in Beginning Rails book, but was having trouble with the radio buttons: selecting second one didn’t do anything, the first one would automatically get re-selected. Realized what the problem was: the label tags were messing me up. I needed to wrap each option (belonging to the radio group) in its own label tags. Duh!

 'create' do %>
Course ID:

User ID:




Configuring my workspace

Ok, so trying to get back into the (programming) swing of things, been spending my day re-configuring my laptop to become a lean, mean, programming platform. Of course my life would be easier with Mac OSX, but I’m stuck with my ThinkPad X60s laptop for now. (When is Apple going to come out with a truly lightweight ultraportable??

My setup so far

  • cygwin – for Linux-like interface (making sure to install bash, screen, xrvt, vim, X11, etc.)
  • vim – my favorite text editor (using gvim.exe Win32 edition for use out of cygwin)
  • ruby – downloaded a Win32 edition (can also use InstantRails as a “shortcut”); also installed rails
  • mysql – everyone’s favorite (free) database, right? (postgresql is cool too)
  • apache – installed it, but haven’t had time to configure that one (correctly) yet

Why screen?

Screen will allow me to have a few vim sessions open, plus a ruby console, and mysql console, and yeah, mongrel running from a command line all within one (or more) terminal window. I can toggle between screens with a simple key-command. Plus, I can “detach” the screen, close the terminal window and the sessions will persist in the background. Once I’m done with “other work” I can tell screen to “reattach” and all my files and applications will still be there.

Yeah, there are other IDEs out there I could use (such as Eclipse, etc.), but since I hardly have time to learn ruby as it is, I’m sticking to what I learned “back in the old days”, which was not that long ago anyway 😉 I’m a big fan of learning how to program on UNIX using command line environments. It may not be “user-friendly” but learning to operate in a lean environment like that comes in handy later on. Plus, I haven’t seen any text editor that truly rivals vim or emacs. 😉

Some early challenges

So, I had some trouble running ruby scripts within cygwin’s bash shell. Something about bad file extensions, missing ruby gems, and other random crap. Given I have ruby installed in both “regular” Win32 version and in cygwin, and can’t get rails installed in cygwin, I probably shot myself in the foot. It works perfectly fine using windows xp’s dos shell (cmd.exe), so i’m calling cmd within a bash shell and running ruby from there. Not pretty _at_all_ but it gets the job done, and with Duo Core + 1.5GB in RAM, I have plenty of memory and CPU to spare.

Also, couldn’t get screen to work correctly in cygwin’s bash. Seems like a bug, but thanks to this site, I found a work around using xrvt: when reattaching to a screen, need to use screen -D -RR and it works.

Here’s my shortcut for C:cygwinbinrxvt.exe -fn “Lucida Console-14” -geometry 160×60 -sr -sl 1000 -e /bin/bash –login -i


I found this site after working through this, wish I had found it earlier:

I agree with the author, quoting him,

For many, including myself, the shell environment is the most critical part of a system and graphical applications and utilities are often superfluous, distracting, wasteful of resources, and even dangerous. Most of the command GNU command-line utilities are practically universal and can be used on everything from supercomputers to small handheld devices.