Saturday, August 30, 2008

blah-001

The efficient programmer is a lazy programmer
Gibas, Cynthia, and Per Jambeck. Developing Bioinformatics Computer Skills
--
Explanation for dummies: she never wastes effort writing a program if someone else has already made it.

1277: Tinkering with Plotrave

Maybe many of you already know about it , but arduino NG based Flexi is availabe in India from techsouls. I have given an order. Hopefully it comes in the next few days.

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 () {
chomp;
if (/^WorkRaveStats 4$/) {
# Ignore header
next;
} elsif (m/^D\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)
\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s*$/x) {
if ($first) {
$first = 0;
} else {
dumpactivetime($misc);
dumpkeystrokes($misc);
}
$break = $misc = undef;
} elsif (m/^B\s+([012])\s+7
\s+(\d+)\s+(\d+)\s+(\d+)
\s+(\d+)\s+(\d+)\s+(\d+)
\s+(\d+)\s*$/x) {
next;
} elsif (m/^m\s+6\s+(\d+)\s+(\d+)\s+(\d+)
\s+([-0-9]+)\s+(\d+)\s+(\d+)\s*$/x) {
$misc = {
activetime => $1,
# mousemovement => $2,
# clickmovement => $3,
# movementtime => $4,
# clicks => $5,
keystrokes => $6,
};
} else {
die "Unrecognized line (line $.): [$_]\n";
}
}
close(SOURCE) or die "close $source: $!\n";
dumpactivetime($misc);
dumpkeystrokes($misc);
print "&chd=t:$timestring\b|$keystring\b|$averagestring\b";
no integer;
printf("&chm=r,f00000,0,%.3f,%.3f",$average/54000,$average/54000-0.002);
print "&chs=800x375&chdl=Activity|Keystrokes|Average Usage&chdlp=t\n";

--
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.

Monday, August 25, 2008

1277: Post-summer lethargy

Irrelevant Rambling

I have always been pretty jobless. But ah the bliss of joblessness right now is something different indeed. Gsoc finally came to an end a few days back. It was truly a very different experience from the past two years but at the same time equally enjoyable. Sean is willing to ask for an extension for CGR / ACM conference, but I don't think I would be able to come up with a good abstract in this state of lethargy.

Want to finish the R book. But am spending lesser and lesser time in front of the computer. Maybe Processing and R would take longer. After waiting for almost 2 years, I finally have the sixth edition of Wheelock's Latin . Going at a good pace in the usual Beginner's frenzy mode. Running at 5 am is getting interrupted almost every alternate day. Following routine is such a bitch :P And hopefully I can start playing violin this week. I have also never been very good with TODO lists as if just the existence of a list somehow compels me to deviate from it. But I guess I roughly have a few things in my mind for the next couple of weeks/ months :P

Awesome Projects
Arduino followed by RepRap would definitely be one among those things. In their own words
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

RepRap is short for Replicating Rapid-prototyper. It is the practical self-copying 3D printer ...- a self-replicating machine. This 3D printer builds the parts up in layers of plastic. This technology already exists, but the cheapest commercial machine would cost you about €30,000. And it isn't even designed so that it can make itself. So what the RepRap team are doing is to develop and to give away the designs for a much cheaper machine with the novel capability of being able to self-copy (material costs are about €500). That way it's accessible to small communities in the developing world as well as individuals in the developed world. Following the principles of the Free Software Movement we are distributing the RepRap machine at no cost to everyone under the GNU General Public Licence. So, if you have a RepRap machine, you can make another and give it to a friend..

Reading list
1. Mad: 1 - 100


2. Proofs from THE BOOK
Aigner and Ziegler.

as ma man said, you need not believe in God, but you should believe in The Book. And what a true pleasure it is turning out to be. I might never see the book, but this mortal attempt is no less wonderful. Just the 2nd page and they stun me with Erdős's divergence of the inverse sum of primes. I wish my math didnt suck so much. I guess


Valete.
--
Roger's equation editor is quite helpful , blogging-wise that is
1277th week on Planet earth

Friday, August 01, 2008

Mastercrap

Not taking up a job for a few months post graduation : 230 to 7800 USD per month

Having google pay you for a decent time in summer touching up your thesis with BRL-CAD : -4500 USD

Enjoying an amazing time at home with parents a.k.a : 000 USD
[
5am - 6am Run in the school ground where my dad studied
6am - 7am Loiter, Bath, Food
7am - 1 pm Read / Work
1 pm - 2 pm Long lunch
2pm - 8pm Sleep
8 pm - 9 pm Work out :P
9 pm - 10 pm Dinner
10 pm - 5 am Read / Work
]

Having parents who love you so much : Priceless

Being an irresponsible asshole who would rather have fun at home than do some work : Just another day of my life

There are somethings money can't buy. You have to be an asshole to extract them out of life :)

--

Slowly Progressing towards running for an hour non-stop so as to feel confident enough for a basic mountaineering course. And on a more serious note ( :P ) got a marriage proposal from a doctor today. and yes she was female .