Swim Counter reaches 1000 users


I released a “WatchApp” for the Pebble recently called Swim Counter. As the Pebble can be taken underwater, I thought it would be useful to have an app that would allow me to track the number of lengths I swim of each stroke.

I found out that Swim Counter reached 1000 users a few days ago, proud father moment!

Thanks to everybody that has downloaded it, hope you’re finding it useful.

“Fun” with .bash_profile in OSX

I’m learning me some cocos2d-x at the moment, and one of the things they ask you to do is to add a couple of PATH variables for convenience, such as the following:

  • NDK_ROOT – A reference to where the Android Native Development Kit lives on your system
  • SDK_ROOT – A reference to where the Android SDK lives on your system
  • ANT_ROOT – A reference to Apache ANT (A Java based build tool, kind of similar to ‘make’)

Usually the way you do this in a Linux/Unix terminal is to run the following command (For example, with NDK_ROOT)

export NDK_ROOT="/Users/cameronwilby/Source/android-developer-tools/ndk/"

The problem I found with OSX was that it would only save the NDK_ROOT variable for the current Terminal session. When opening a new terminal window, the variables would be lost. Very frustrating.

I found out that the reason is that Unix has two types of shells. A login shell (When you’re already in a desktop environment or logged in via SSH) and a non-login shell (Imagine in the good old days where you login via a green-text-on-black screen terminal).

Login shells execute .bash_profile before you start typing commands, and non-login shells execute .bashrc first.

When you run the above command, the PATH variable is saved to .bashrc, not .bash_profile.

Now, the problem is that OSX creates a new login shell every time you open Terminal and subsequent tabs, which executes .bash_profile, missing out on the PATH variables we saved in .bashrc.  Thus, any PATH variables saved in a Terminal session will not be loaded the next time Terminal is opened.

The solution according to Josh Staiger is to add some lines to .bash_profile that loads in the PATH variables from .bashrc using to avoid this problem. I did this and it seemed to fix it.

…. I f**king hate Unix. Seriously. I just want to make a game or something.

Swim Counter


Technologies Used
C, Pebble SDK

Swim Counter is a basic health and fitness utility for the Pebble Smartwatch. It keeps track of the number of lengths you swim for the four main strokes (Freestyle, backstroke, breaststroke and butterfly).

It’s open source – if you want to check out Swim Counter’s guts, go right ahead.


  • Track the number of lengths for the four main swimming strokes
  • Track lengths swam in the long run – counts are saved when the app is closed.
  • The Pebble is waterproof, rated 5ATM – meaning this app can be used in the pool.
  • Incredible graphics.