Archive for May, 2008

Track It, Alcohol Consumption and Odd Socks

Thursday, May 29th, 2008

Track It! is a free online application to help you track aspects of your life. Most popular aspects to track are mood, exercise and sleep.

Supernifty currently provides cycle analysis and correlation between trackers, to help you better understand yourself.

I received some interesting feedback regarding the use of Track It!:

I recently started using Track It to first monitor, and then control, my alcohol consumption. I seemed to be having a drink after work every night of the week, and thought that couldn’t be good.

Just the act of recording my consumption every day made me think about how much I was consuming, and made me start to set targets to reduce my consumption. I don’t think I was alcoholic, but I think dependence was definitely beginning to emerge.

I’ve reduced my consumption quite a bit, down to around 3-4 nights a week, and I’m certain it has made a big difference to my wellbeing. I’m doing lots more interesting things after work now, and last night something happened which really proved this point, and in fact made me write this letter.

I have a drawer full of odd socks. When an odd sock arrives from the wash, I usually search the odd sock drawer for a match, and if there’s no match, add it to the drawer. Last night I had another look at that odd sock drawer.

Numerous times in the past I’ve looked through that drawer for matches, and found none. But last night, I managed to match up almost half the odd socks! Some were inside out or whatever so it wasn’t immediately obvious, but the fact that I failed to do this in the past, in my alcohol induced haze, makes me wonder what kind of person I have been in the past, and what opportunities I have missed.

I wonder about my behaviour at work, and with friends, what other glaringly obvious things have passed me by. I wonder how in the past I was unable to do what now seems like a simple task.

The odd socks incident made me wake up and see how I have changed.

It made me think that the person from the past was some other person, not me … someone who couldn’t even spot matching socks!.

Hopefully, now I am on the path to a better life, and some of that is thanks to your tracking software.

I think that’s very interesting how much effect something can have on your overall outlook, without you even realizing it.

Below is the 6 month alcohol consumption graph for my correspondent:
Tracking Alcohol Consumption

As you can see, there is a noticeable drop in consumption, however, the biggest drop occurred as soon as the tracking started: the act of thinking about it each day got the ball rolling.

The comment about seeing a past version of yourself as someone else reminded me of one of my favourite books, Flowers for Algernon.

If you have an interesting use of Track It, or wish to comment on this story, feel free to contact us.

Backup multiple MySQL databases with Python – hack it #5

Wednesday, May 28th, 2008

Keep copies, or risk the great sadness

Backing up is important.

If you host a website which has a database, and you’re not backing it up, you should.

If your database was wiped, and you lost your entire blog, wiki, customer details, and the rest, if you’re like me, you’d be deeply unhappy.

Most webhosting companies do backups, but are somewhat vague on guarantees and process. They often charge to do restores as well.

Best bet is to do it yourself.

This set of instructions applies to MySQL, and can be applied to one database or many.

Step 1. Backup your databases on the server
Below is a python script that will backup multiple MySQL databases. Put this on your web server, preferably in a directory called backup, with the name

import os
databases = dict()
databases['*** db1 ***'] = '*** password1 ***'
databases['*** db2 ***'] = '*** password2 ***'
databases['*** db3 ***'] = '*** password3 ***'
def set_pass( name ):
 file = open( '/*** your home directory ***/.my.cnf', 'w' )
 file.writelines( ( '[client]\n', 'password=%s\n' % databases[name] ) )
for key in databases.keys():
 set_pass( key )
 os.system( "mysqldump --user %s --opt %s > %s.sql" % ( key, key, key ) )
os.system( "zip *.sql" )
os.system( "rm *.sql" )
os.system( "chmod 600" )

About this script:

  • A problem with backing up multiple databases without intervention is the entering of passwords in a secure way. This script uses .my.cnf to set the password securely.
  • Fill in the database usernames and passwords. This script assumes the database has the same name as the username.
  • Fill in your home directory e.g. /home/john
  • The result of this script is, in the current directory.

Step 2. Copy backup to your machine
This script connects to your web server, runs the above backup script, then copies the result back to your local machine. Put this on your local machine.

ssh -i "your_key" "cd backup; python"
rsync -avz --rsh="ssh -i your_key" backup

About this script:

  • This script assumes the backup script is in the “backup” directory on your web server.
  • You need ssh and rsync to use this script. On Windows, PuTTY provides a great ssh client, but I don’t know of a good rsync implementation, other than cygwin. Instead of rsync, you could use scp, which comes with PuTTY.
  • If you want to automate this script (see later), you’ll want passwordless ssh, which means setting up “your_key”. Google on how to set this up.

Step 3. Repeat periodically
You want to automate this process so you can forget all about it.

  • Unix: crontab. If you’re unfamiliar with crontab, try “man crontab”. The main commands to use are “crontab -e” and “crontab -l”.
  • Windows: scheduler. Check out Control Panel->Scheduled Tasks, and add your client script.
  • As mentioned above, you need passwordless ssh so your scheduled task can run unattended.

There’s your nutshell guide to backing up multiple MySQL databases with Python.

Audio Tuner Mobile 0.7 – crashes for Europeans and South Americans – eliminated!

Sunday, May 25th, 2008

Your mobile instrument tuner

Supernifty has released version 0.7 of Audio Tuner Mobile.

Audio Tuner Mobile enables you to tune your musical instrument to pitch perfection using your Windows Mobile or Pocket PC.

If you live in a country that uses “,” as its decimal separator… i.e. most of Europe, South America and a bunch of other countries, you may have encountered a problem with Audio Tuner Mobile crashing for specific notes.

This has been fixed. Hurrah!

Turns out decimal points were not being properly dealt with and this was causing the program to crash for specific notes.

I’m so glad to have finally gotten to the bottom of this issue. I hadn’t been able to replicate this in my own “.” based world.

If you have problems, suggestions, feedback or unrelenting praise, please contact me.

For further details, including downloads, phone compatibility and tutorials, visit the Audio Tuner Mobile Homepage.

Audio Tuner Mobile 0.6 released

Friday, May 23rd, 2008

Tune your instrument, while mobile

Supernifty has released a new version of Audio Tuner Mobile.

Audio Tuner Mobile enables you to tune your musical instrument to pitch perfection using your Windows Mobile or Pocket PC.

Changes in this update:

Better support for crash diagnostics – in the past, a crash resulted in the application instantly disappearing without a trace. Somewhat unhelpful.

In most circumstances, this should no longer happen. You should now get a readable crash report. It would cause me no end of joy if you would forward this to me.

The crash report is also saved to “error.log” under “Program Files/Audio Tuner”, if you miss the message box.

Remember the last tuned note – saves you from having to select the first note every time.

Feel free to pass on any feedback about the software. Problems, suggestions and comments are welcomed.

For further details, including downloads, phone compatibility and tutorials, visit the Audio Tuner Mobile Homepage.

Backups – Hack It #4

Wednesday, May 21st, 2008

Keep copies
Backups are an essential feature of any IT installation.

You’ve got to have backups. Not backing up is a ridiculous, unnecessary risk.

The average hard drive has a 20% chance of failure each year. How would you fare if your computer was stolen, or melted in a fire? If you don’t have a plan for data recovery, you are asking for trouble.

It shouldn't happen to you!

Try to put a value on losing everything on your hard drive, and remember that fires, robberies and hardware failure are all out of your control.

For instance, a friend recently lost all his photos. Over 10 years worth of memories, gone forever! Man, he was sad.

These days there are great, inexpensive options for backups.

Option 1: buy an external hard drive.
This is a big improvement on not backing up at all, however, there’s a problem. If you keep the external drive with your computer, you’re not covering all the bases.

Any localized event, such as a natural disaster or robbery, will render your backup solution useless.

If you copy your data off your computer, then take your external hard drive away to another location, then this is a fine solution. Otherwise, it’s not recommended.

Option 2: online backup
In recent times, some very competitive options have sprung up. This stores your data safely away from your computer, so this is a winner – you can’t lose both in the one event. The main factor in my opinion is security.

  • Mozy – unlimited storage for $4.95/month.
  • Carbonite – unlimited storage for $49.95/year.
  • Amazon S3 – incremental storage of 15c/GB/month. This is not on its own a backup solution. You need a user-friendly client to connect you to their backup service. For instance, JungleDisk.

I chose S3 and JungleDisk, primarily for security reasons. Most solutions tell you that your data is safe and encrypted, but that they can recover your data if you lose your password.

This means that if the company is hacked, or if you don’t trust company employees, your data is vulnerable. JungleDisk has the option to encrypt your data before it leaves your computer, and cannot be decrypted without your password.

It’s worth pointing out, that with Amazon’s incremental pricing, if you only need to backup a few gigs, then you’ll be paying less than $1/month to keep your data safe.

It’s a tiny price to pay for the guarantee that your data will not be lost.

Audio Tuner 0.8 released

Monday, May 19th, 2008

Baritone Ukulele
I’m pleased to announce the release of Audio Tuner version 0.8. Main changes in this version are:

  • automatically pick the note being tuned
  • remember the last note tuned
  • baritone ukulele tuning added

Automatically pick the note being tuned
A number of people have requested this, so now you can try it out.

When the software detects a pitch for more than a couple of seconds, it will move to the nearest note in the selected instrument. So if your instrument isn’t way out of tune then this should save you the time of having to manually change notes each time.

The software also gives a quick beep when it changes notes, so this provides you with a truly hands free instrument tuner.

This turned out to require a bit of tweaking to get working, main factors being

  • ignoring signals considered too soft, and
  • ignoring harmonics,

so if it doesn’t work properly for you, or you have suggestions for improving the algorithm, please let me know

Any other feedback is of course welcomed.

Audio Tuner Mobile Users
If you’re using Audio Tuner Mobile, then you’ll be thinking that these hands-free improvements would be especially handy (or should that be unhandy?)

Once any problems have been ironed out of the PC version, expect these to be implemented on the mobile version.

More Information
All details about the software, including download links, are available here.

What affects my mood? Track It! adds correlation analysis

Thursday, May 1st, 2008

Track It! is a free application to help track aspects of your life. We’re using it for the World Happiness Survey to help learn what affects people’s moods.

If you’re tracking more than one thing, you can now use the correlation analysis feature to see how they affect each other. For instance, if you’re tracking your mood and your hours of sleep, you can click on the analysis to see how much one affects the other.

Track It! Correlation Analysis

The number of days tells you how long until it has an effect. A positive number means it has a positive effect: if one goes up the other tends to go up. Negative numbers mean an inverse relationship.

So in the example above, sleep generally has a positive impact on mood, however, alcohol, with a two day delay, has a negative effect.

You can also apply these in reverse, to see if mood has an effect on sleep, and alcohol consumption.

This is our first pass at correlation analysis, so any feedback is welcome. We hope to improve the results after consulting further with our local statistician – and hope to highlight correlations that are significant and not just the result of random noise.

If you have any queries about this new feature, or have any interesting correlations to discuss, please feel free to contact us

To learn more, check out the links below.