Format data application

Today I finished my program for combining data from different files. There will be three different files at the end of a day. A text file with lines and tab separated data containing all the data recorded by the Suunto watch. A gpx file that contains GPS data in xml format. And a text file with lines and tab separated data which holds time and activity data.

I placed myself for the daunting task of combining these different files and formats into one tab separated text file. As Flash can’t output a text file I chose Processing for the job. It appeared the capabilities to work with strings are rather limited compared to ActionScript or PHP. But they do have a very convenient XML element class. It was actually the first time I worked with an XML file in this way (that is extracting attributes from an XML node). The loadStrings function is very handy for loading external data and putting it into an array at the same time. In one big loop I cycle through all the files, add a concatenated line at the end of every loop. The result is a tidy text file with only the necessary data in a structured format.

A day well spend 🙂

Merging three files into one (day_data.txt)
Merging three files into one (day_data.txt)

Join the Conversation

2 Comments

  1. Hi Sander,
    Thanks for pointing that out! I wasn’t aware. Could be very useful in the future.
    For now I think I’ll stick to Flash for online apps, but I’m sure that doesn’t surprise you 😉 I think the poor browser support (though understandable) is a drawback at this time. But I’ve heared and experienced that working with bitmaps is very slow in Flash and a lot faster in Processing. So that might be a good reason to try it out some day.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.