Experiments with publishing application activity

February 10, 2008

For a couple of weeks now I’ve been monitoring what I do on my Mac using two tracker tools: Wakoopa and RescueTime. Both have unique approaches to the theme of tracking. Wakoopa builds a social network around the applications that you use. It lets you build ‘teams’ of people and see what your friends have been using. The other two significant things that it does are statistical visualizations, and recommendations of apps based on what you’ve been using. So if you’ve been using a lot of TextEdit lately, it might recommend TextMate as a ‘similar’ application. This, according to my guesswork, they do by matching application tags.

Wakoopa Recommendations

The other way to do these recommendations could be to match people based on their application sets (or better still, their activity sets. If app = Microsoft Word, then Activity = word processing); and then provide recommendations based on what other people who have similar appication/activity sets are using, that the current user isn’t.

Anyways, Wakoopa does provide a simple API to accessing its data, and that is a great thing to do. That’s something that RescueTime hasn’t done yet, but they promise to do the same soon on their site. RescueTime has a unique approach to this whole domain. They aren’t building a social network (at least till yet), and this is how they track your apps: If you are using a standard application, the RescueTime tracker records its usage as any other tracker. If, however, you are on a browser, the tracker records the website that you’re visiting as an ‘application’, which makes some sense in this era of online applications. You can then go to the website and assign ‘tags’ to applications. These can later be visualized to see how much time, for example, you spend ‘Watching Videos Online’.

Rescue Time Dashboard

So anyways, I’ve been itching to use the incredibly simple to use GChart APIs with an interesting enough data-set, and Wakoopa stats are sortof interesting (at least for me…), so last weekend I cooked up a script to make a pie chart of my recent application usage. Its available here, and at the point of writing this post, this is how my stats looked:

Application usage chart

Which, I suppose, is a pretty reasonable graph. Half of what we do on our computers these days is more or less on the web (50% of which is on YouTube, which is, IMHO, the greatest time sink ever invented). Mail takes about 20%, and the actual work takes the rest. (Source after the jump)

The source code for the vis is pretty simple. All it does is load the XML API URL, parse through to generate a Google Chart compatible format, and call the image URL for Pie Charts:

$request_url = &quot;http://api.wakoopa.com/sameer/most_used.xml&quot;;</p>

<p>//App names
$names = &quot;&quot;;
//Usage values
$values = &quot;&quot;;
//For calculations
$total = 0;</p>

<p>$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);</p>

<p>$xml = new SimpleXMLElement($data);</p>

<p>//Computing total
foreach($xml-&gt;software as $sw){
   $total += intval($sw-&gt;{'active-seconds'});
}
//Computing values in GChart-compatible format. Have a look at this: http://code.google.com/apis/chart/#pie_charts
foreach($xml-&gt;software as $sw){
       $names = $names.&quot;|&quot;.$sw-&gt;name;
       $values = $values.&quot;,&quot;.(round(intval($sw-&gt;{'active-seconds'})*100/$total, 1));
    }</p>

<p>//That's it! Load the image.
echo '&lt;br&gt;&lt;img src=&quot;http://chart.apis.google.com/chart?
cht=p&amp;chco=3587DCFF,99E142FF,993C99FF,90A4E5FF,DAD52EFF,C95854FF,AE4496FF&amp;
chd=t:'.trim($values, &quot;,&quot;).'&amp;chs=450x300&amp;chl='.trim($names,&quot;|&quot;).'&quot;&gt;';