I have never really been a web guy and have never found web development interesting, never ventured into web-based programming? err.. whatever it is called..
Completely useless statistics though has always interested me. And when you do think about it, when is statistics really useful?
The above image was generated using google charts api, using data extracted from workrave statistics files using a perl script. As you can clearly see, I don't even know the equivalent in Perl of backslash in C. The scipt is a modification of this one, which just extracts data from the file into columns. 3 types of data are plotted and a line is drawn to denote the average computer usage. In particular, most things are hardcoded, like the date and scale . Maybe sometime later I can write a more parametric extractor.
#!/usr/bin/perl -w
use strict;
use integer;
use POSIX qw(strftime);
use Time::Local;
$ENV{'PATH'} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin";
my $timestring = "";
my $keystring = "";
my $averagestring ="";
my $average=0;
my $count=0;
sub dumpactivetime($)
{
my ($misc) = @_;
die "No misc at line $.\n" if !defined($misc);
no integer;
my $t = "@$misc{activetime}";
$count = $count + 1;
$average = $average + ($t-$average)/$count;
$timestring = $timestring.sprintf("%.2f",$t/540.0).",";
$averagestring = $averagestring.sprintf("%.2f",$average/540.0).",";
}
sub dumpkeystrokes($)
{
my ($misc) = @_;
die "No misc at line $.\n" if !defined($misc);
#my $miscstr = join(" ", @$misc{@$miscstats});
no integer;
my $t = sprintf("%.2f",@$misc{keystrokes}/1000.0);
$keystring = $keystring.$t.","
}
#
# Initialize RRD
#
my @miscstats = qw(activetime keystrokes); #mousemovement clickmovement movementtime clicks
#keystrokes);
my $step = 24 * 3600; # 24-hr steps
my $heartbeat = 4 * $step;
my (@DS);
foreach my $miscstat (@miscstats) {
push @DS, "DS:$miscstat:GAUGE:$heartbeat:0:U";
}
umask(022);
#
# Populate data
#
my $source = "$ENV{HOME}/.workrave/historystats";
my $first = 1;
my ($tmdate, $break, $misc) = (undef, undef, undef);
open(SOURCE, $source) or die "open $source: $!\n";
print "http://chart.apis.google.com/chart?cht=lc&chg=7,33.33,2,4";
print "&chxt=x,y,r,x,y,r&chxr=0,8772,8877|1,0,15|2,0,100000";
print "&chxl=3:|Day|4:|Hours|5:|Number&chxp=3,50|4,50|5,50";
print "&chco=4d89f9,008000,fd0f0f";
print "&chtt=Computer+Usage+Statistics";
print "&chts=ff9900,15";
while (
--
Epilogue:
The subject (moi) is mostly a web-technology illiterate guy.
Let us substantiate the same.
Things the subject DOESN'T know : Javascript, VBScript, Java, CSS, CGI, Ruby, PHP, MySQL, AJAX etc . Beyond this, the subject is even unaware of the topic names , pointing to his complete ignorance.
The ONLY web services/technologies I use:
Mail : The subject was/is a great fan of gmx. But he mostly uses gmail via imap now. The author checks the mail approximately once a day.
IM: Jabber via talk.google.com using freetalk/gajim.
Social Networking-esque sites : Ohloh, LinkedIn
Blogging: blogger and wordpress
Games: chess.com, though active use is mostly a seasonal phenomenon.
Demonoid.com & textbooktorrents.com: The subject honestly hopes *they* don't send him to jail for this.
The subject also Passively uses
last.fm
sourceforge.net[1]
Valete
--
1. Due to the subject's involvement with open source he uses Subversion as per requirements.
No comments:
Post a Comment