Blog News Programming

AIR Badge plugins for WordPress take away all the hard work!

This is soooo cool.

Creating an AIR badge for an Adobe AIR application is a bit of a hassle, but the following 2 WordPress plugins really do take all the work out of it. Any post where you want to add an Air badge, you’re done in 3 minutes.

You’ll need either one of the following plugins:

– The Original plugin, made by Peter Elst, which is easy to use
– The Updated plugin with built-in click tracking (requires a bit more work)

I decided to use the original plugin, and you need to do just 3 things to use it.

  1. install the plugin (in your admin menu, just go to the plugin section and use the “search plugins” button to search for “air badge”
  2. upload your .air file to the server (if you want to use the wordpress “Add Media” uploader, you might also need to install an additional plugin called “PJW mime-config” and add .air to the list.
  3. create your badge by writing the following magic words between the words ‘airbadge’ : application name, full URL to .air file, application version, image.jpg

You’re done ! Admire your work (and that of the guy who made it possible, Peter Elst)!

Apple Programming

WeightManDesktop v.0.2 (AIR)


I updated my little AIR application called WeightManDesktop (which uses data from WeightMan, a free  iPhone application made by Katachi Studios) to version 0.2.

Changes in version 0.2:

  • Calculates the minimum and maximum weight
  • Calculates the minimum BMI
  • Both the weight graph and the BMI graph now don’t start from 0 – instead they use the minimum values to calculate the begin value of the graph
  • The graphs are much more clear now and the changes in weight show up more distinctly.

You can download version 0.2  of the program by clicking on the install badge. Version 0.1 entry and description can be found here.

[airbadge] WeightManDesktop,, 0.2,[/airbadge]


WeightManDesktop, an AIR application for Weightman (iTunes)


Here’s a small application called WeightManDesktop that I wrote as a proof of concept to see how difficult it was to import a csv file and process it in actionscript. I blogged about it earlier here.

It uses the csv file that is generated by WeightMan (iTunes link), a free iPhone program that allows you to note your weight over time intervals. Weightman allows you to export your entries in csv and sent them by mail to your desktop. I wanted a desktop application that could display all the entries in one go.

The iPhone app is made by Katachi studios. I did try to contact them to let them know I was posting this, but as their site is partly in japanese and there is only a small english page, I couldn’t find the contact email… [update: I managed to contact them, and they seem happy with it 🙂 ]

To use the program, use the install badge below – it’s an AIR application, so you need to first install the run-time air player as well if you haven’t done so before. I’ll make a proper install badge for it sometime in the future if or when I revise the program.

Use the source button on the bottom of the screen to locate the csv file and import it. Two graphs will then be shown, one showing your weight and one showing your body mass index level, as calculated by Weightman.  There’s a toggle button to show only the last 30 entries as well.

It’s a very basic first release, but I may add additional functionality it in the future. If you would like an improvement or see something to fix, please leave a comment.

[Update: link changed to point to version 0.2 – changes are described here]

[airbadge] WeightManDesktop,, 0.2,[/airbadge]


Reading and Displaying a csv file using Flex (AIR) and Actionscript

I’ve already written a python script that can convert a .csv file to a .xml file, which quite a few people seem to like. This is a good solution when you have a large file to convert.

But really, reading a small and simple csv file directly into Flex/Flash to use it in charts or display the contents in a DataGrid would be a “Nice To Have” solution. Plus, I’ve noticed that over the years I reuse my code and each time I add new functionality to it; now is the time to start with it !

So I made an AIR application ( for the simple reason that I load a local csv file) that does exactly that. The AIR app is called WeightManDesktop.

Since I know it’s a small file that I’m loading, it doesn’t matter that I load it completely into memory. For a larger file, in Python I would typically open the file for reading and read it line by line, processing each line as I go.

Using the File.browseForOpen AIR functionality, I read in the file selected by the user into a string and then process the content in a seperate function:

// Read in the selected file when the file is selected
private function openfileSRCHandler(event:Event):void{, FileMode.READ);
content = String(fileStream.readUTFBytes(fileStream.bytesAvailable));
trace(“*** File loaded.”);

Using the strings split function, I first split the string into seperate lines using the line seperator to split them. Each line thus becomes an Array. I then split each line into seperate content, again using the split function using commas to seperate them into the seperate items. These items are then added to an ArrayCollection that I’ve previously defined.

private function processContent():void {
//var ending:String = new String(“\n\g”);
// Split the whole file into lines
var values:Array;
var lines:Array = content.split(“\n”);
trace (“File split into ” + lines.length + ” lines”);
// Split each line into data content – start from 1 instead of 0 as this is a header line.
for ( var i: Number=1; i < lines.length; i++ ) {
var line: String = lines[i];
values = line.split(“,”);
trace (“line split in ” + values);

// Add values to arraycollection
linedata.addItem({date:values[0], weight:values[1], bmi:values[2], workout:values[3]});

And that’s it. Use the ArrayCollection as a dataprovider for your datagrid and Bob’s your Uncle !