All posts by Thomas

Running Metronome for Linux

The cadence of a runner, is the number of steps that the runner takes per minute. For people interesting in practicing running technique and form, cadence is often one of the focus points. If your cadence is too low you may be overstriding which can cause all sorts of injuries. Whether or not there is an optimal cadence, and how this might vary with pace, appears to be the subject of some debate. In any case, it is often hard to gauge what your pace is when running without a foot-pod that measures this explicitly. You can of course try to count your steps while running and keeping track of the time, but this is cumbersome to do during a run, especially when you are getting tired. It is popular to use music where the beats per minute (BPM) of the music approximately matches your desired cadence, and there are multiple services that help you find good music corresponding to a given number of beats per minute.

If you want to focus on the cadence, and not get distracted by counting, or music, a metronome can help you keep the right pace. I had problems finding audio files that I can put on my portable mp3 player that just contains the output from a metronome, so I decided to write a little piece of software to generate mp3’s with nothing but metronome-like bleeps at the right rate. I have tested it on Ubuntu 11.10, and Ubuntu 12.04 but fully expect it to work on most distributions, old and new (as long as they have the Boost library). If you are not interested in the metronome itself, but just want some files you can use while running — here is a list of files with varying bpm that I generated, feel free to download and use them on your own device if you so desire:

Each file is 2 minutes long. If you want a different number of beats per minute, check out if it is already available in the full list. If not you can download and compile my metronome software to generate your own files. This also goes if you want a different duration.
(There are also other metronomes available for linux, but I decided it would be more fun to write it myself.)

Waveform at 1000 beats per minute from the metronome







TCX-Tools: Convert Nike+ Files, Work With GPS and Heart Rate Data from TCX Files.

Photo by darkmatter/flickr.

I recently started using Endomondo to keep track of my workouts. Endomondo can get data from the Endomondo smartphone apps, but it also has good support for importing data from Garmin devices (including my Garmin Forerunner 610) and it supports importing tcx files generated by other sites/apps as well. However, there was a few things that annoyed me a little bit.

  • I could not import my old foot-pod workouts from Nike+.
  • Endomondo will only display the heart rate graph if the workout has associated GPS information. This means that I cannot see the heart rate graph for my indoor workouts, and that’s just dumb.
  • Sometimes I will walk or run with my wife and we will follow the same route. If she wears the Forerunner the associated heart rate information will not apply to me, although the gps trace itself is perfectly valid.
I decided to scratch my itch and develop some simple open source tools that can help me with the above issues. The result is TCX-Tools. which is a suite of very rudimentary tools that perform helpful operations on TCX files, the popular Garmin file format for fitness information.
  • nike+totcx Converts XML Files with iPod foot-pod data from Nike+
    to TCX files.
  • tcx-add-gps-coordinate Adds a GPS coordinate to an existing TCX
    file without location information.
  • tcx-strip-heart-rate Removes heart rate information from an
    existing TCX file.

Be aware: This is a very basic collection of XSL Transformations and some trivial tools to run them. There are probably multiple bugs and there is no fancy GUI or anything like that. It is also completely untested on anything but Ubuntu 11.10, but I am hopeful that it works on most OS’s, even if the scripts themselves won’t run :). Please let me know if/when you find any issues with any of the tools and I’ll try and fix them.

Endomondo heart rate
Endomondo heart rate graph with no speed information.


TCX-Tools is hosted on github. These directions assume  you are working with a GNU/Linux (or possibly Mac) system. The tools are based on XSL Transformations which should work in any os if you have the right tools. First clone the tcx-tools repository

$ git clone
$ cd tcx-tools 

You will need to install Saxon, on Ubuntu this can be done like this:

$ sudo aptitude install libsaxon-java 

To use nike+totcx to convert Nike+ XML files to TCX files you also
need to download the EXSLT template:

$ wget 


The nike+totcx tool is an xsl document that can be used to convert
information from a standard Nike+ foot-pod system paired with an iPod
to the TCX files supported by Endomondo and Garmin Connect (and many

Getting the data

Mount your iPod and find the directory containing the .xml files for
the individual workouts. On my iPod the workouts are stored in the

 /media/<ipod name>/iPod_Control/Device/Trainer/Workouts/ 

It is also possible to get the xml files of past runs from the Nike+
website, but it involves some trickery.


$ ./nike+totcx <input xml file> <output tcx file> 


As explained above this tool adds a single GPS coordinate (lat,long)
to the tcx file. Doing this will coerce Endomondo to display the heart
rate graph that it otherwise wouldn’t display.


$ ./tcx-add-gps-coordinate <input tcx file> <output tcx file> <lat> <long> 


If you have been out exercising with a companion that used a gps and
heart rate monitoring device, you may want to import the GPS trace but
not the heart rate information into your own account (on Endomondo,
Garmin Connect or other tool). This tool strips the heart rate (and
calorie) information from the supplied tcx file, but keeps everything


$ ./tcx-strip-heart-rate <input tcx file> <output tcx file> 

Play with Global Flood Maps – New SCALGO Website Launched

A long time in the making, we finally launched the new website for SCALGO a few days ago. The new website has product descriptions and lots of easy to read information about our technology and I hope that it can inspire LIDAR users to get more out of their huge LIDAR datasets. After all, it is a shame to spend millions in flight time and equipment and then not use the point cloud optimally because the data is too big to handle.

One of the things I like about our new site is our mapping example which is built on top of Google Maps using our own custom server for our data. Unfortunately we don’t have the rights to show some of the very detailed LIDAR-derived models we have worked with. However, we have also played with the full SRTM model, and we show two different examples online. In the first you can play with global flood maps by controlling the sea-level and discover what parts of the world gets flooded. Unlike most other similar computations available online, this is not done by simply intersection the raster with a horizontal plane at the water level and marking everything underneath this plane as flooded – doing so would ignore the effect of many features in the terrain (e.g. dikes). Additionally, the computation is done so that we can show arbitrary sea-levels, and not just levels in increments of e.g. 10cm. In the other computation you can play with flow accumulation, where water falls on the terrain and runs downstream, forming rivers and smaller tributaries.  Note that the resolution of the SRTM model is relatively coarse so dikes and other small natural barriers are not always reflected as they are missing in the data. You can read more about these computations here. The computations were performed using our newly released SCALGO Hydrology and SCALGO Simplify packages.



Danish Meatballs (Frikadeller)

Danish Meatballs (Frikadeller)
Danish Meatballs (Frikadeller)

I’ve made Danish Meatballs (also known as “Frikadeller”) a couple of times since I moved to North Carolina, and I have recived a couple of requests for the recipe. I figured I’d put it up here to help spread the gospel of “fine” Danish cuisine in America. This recipe is based on the recipe found here (in Danish).


Attention: The internal data of table “2” is corrupted!

Step-by-step Instructions

  1. Mix the pork with the salt and let it sit for a couple of minutes. This will improve the meat’s ability to absorb the milk.
  2. Grate the onion.
  3. Mix all the ingredients and stir thoroughly. Hold back some of the milk and flour, this can be used to tweak the consistency of the mix. If you use fatty or recently defrosted meat you should probably use a little less milk.
  4. Heat a skillet over medium heat, and use plenty of oil or butter. Use a teaspoon or a tablespoon (depending on the size you want) to form the meatballs in the palm of your hand, and put them on the pan in a circular pattern (so you can remember which order you put them down). They will need a few minutes on each side, depending on their size.

Cooking Danish Meatballs
Cooking Danish Meatballs


From MADALGO comes word of a summer school on geometric data structures, looks like fun!

Here is the official announcement:


August 16-19, 2010, Aarhus, Denmark


Geometric data structures are methods of efficiently storing and querying data in two or more dimensions. Working with geometric data often requires the use of specialized and fundamentally geometric techniques. The goal of the summer school is to provide an in-depth introduction to some of the key techniques in geometric data structures, while highlighting a number of open problems.


The school will be taught by experts in the area of geometric data structures:

  • Timothy Chan (University of Waterloo)
  • Sariel Har-Paled (University of Illinois at Urbana-Champaign)
  • John Iacono (Polytechnic Institute of New York University)
  • Mihai Patrascu (AT&T)


The summer school will take place on August 16-19, 2010 at Center for Massive Data Algorithmics (MADALGO) in the Department of Computer Science, University of Aarhus, Denmark.

The school is targeted at graduate students, as well as researchers interested in an in-depth introduction to geometric data structures.

The capacity of the summer school is limited. Prospective participants should register using the online registration form available at as soon as possible. Registering graduate students must also have their supervisor send a letter confirming their graduate student status directly to; the subject line of the email should be ‘student_last_name/SS_2010/confirming’. Registration is on a first-come-first-serve basis and will close on July 1, 2010.

Registration is free; handouts, coffee breaks, lunches and a dinner will be provided by MADALGO and the Aarhus University.


  • Lars Arge (MADALGO)
  • Gerth S. Brodal (MADALGO)
  • John Iacono (Polytechnic Institute of New York University)
  • Else Magård (MADALGO)
  • Sara Ølholm (Aarhus University)


Center for MAssive Data ALGOrithmics is a major basic research center funded by the Danish National Research Foundation. The center is located at the Department of Computer Science, University of Aarhus, Denmark, but also includes researchers at CSAIL, Massachusetts Institute of Technology in the US, and at the Max Planck Institute for Informatics and at Frankfurt University in Germany. The center covers all areas of the design, analysis and implementation of algorithms and data structures for processing massive data (interpreted broadly to cover computations where data is large compared to the computational resources), but with a main focus on I/O-efficient, cache-oblivious and data stream algorithms.

Interdisciplinary Geospatial Informatics Post Doc position at MADALGO

Via Lars Arge, advice information about an interesting post doc opportunity at MADALGO:

An interdisciplinary Post Doc position is available at Aarhus
University, Denmark, starting August 2010 or later. The responsibilities
of the Post Doc will include work on geospatial problems on the boundary
between computer science and biology, more specifically between
algorithms and ecology/biodiversity. Modest teaching responsibilities
may also be required. The Post Doc will be affiliated with the Danish
National Research Foundation Center MADALGO (Center for Massive Data
Algorithmics – under the supervision of computer
science Professor Lars Arge (, but will also
work extensively with researchers in the Ecoinfomatics & Biodiversity
group at the Department of Biological Sciences under the supervision of
Professor Jens-Christian Svenning (
The Post Doc should focus on problems in relation to computationally
efficient use of modern detailed (and thus massive) topographic data in
various global-change-relevant modeling applications. These problems
include the computation of fine-resolution topography-derived variables
on a global scale, as well as local- and global-scale flooding scenario
modeling and impact assessment.
Applications are welcomed from computer science researchers with clearly
demonstrated skills in the design, analysis and implementation of
algorithms (preferably also with I/O-efficient algorithms), as well as
from geoinformatics or biology researchers with clearly demonstrated
skills in ecoinformatics, GIS, and programming. Researchers with
interdisciplinary research experience will be preferred. Applicants
should apply by uploading a letter of interest and a CV, as well as
indicate at least two names of references for recommendations, using the
application form available at To be assured of full
consideration, applications must arrive by May 17, 2010. Applications
will be considered until the position is filled.
For further information contact Professor Lars Arge at or Professor Jens-Christian Svenning at

Tethering the Motorola DROID Android phone on Linux (Ubuntu Karmic)

Tethering lets you to use the 3G connection on your  Android-based cell phone to browse the internet from your laptop.  Some phones come with tethering applications build int, but on other phones tethering is not possible – or you have to jump through a lot of hoops to enable it.

The nice new Motorola DROID phone does not have a tethering ability by standard (all-though a Verizon representative told that Verizon will be coming out with something at some point) but it is still possible to tether it using the Proxoid application. Unlike other approaches, you do not have to root your phone.

A detailed installation guide is available here. To use this guide with the Motorola DROID phone you should put the following line in /etc/udev/rules.d/11-android.rules:

SUBSYSTEMS=="usb", SYSFS{idVendor}=="22b8", SYSFS{idProduct}=="41db", MODE="0666", OWNER="USERNAME"

If you’re on Ubuntu Karmic Koala 9.10 you should restart udev using the following command:

sudo service udev restart

When trying to connect to the android phone you mave have to run

sudo ./adb kill-server
sudo ./adb start-server

Before you can see the device (this happens if the server was already started when you changed the udev rules). This works on Ubuntu Karmic Koala.

Be aware that tethering may not be allowed by your service provider, you should read your contract to find out.