Wednesday, December 17, 2008

LTSP Training of Trainers conducted

LTSP (Linux Training of Trainers) technology is gaining momentum in Nepal considering the impact that it can cause at very low cost. Organizations like Help Nepal Network and FOSS Nepal have set up a vision of establishing 1 e-library per district. I am proud to be associated with this vision and was one of the deployers of the e-library project in Bhaktapur district.

The vision itself is very innovative since it not merely empowers rural Nepal but also students of technical institutions who are given opportunity to go to different parts of Nepal to set up the e-library. Since, not much students are familiar with the use of this technology, a training was conducted. This was the second training on LTSP being conducted, last one being conducted on 15-16 December '07. I was part of the instructing team for both the training events.

I have made a blog post of the training @ http://elibrary-ltsp.blogspot.com/2008/12/2nd-ltsp-training-of-trainers-conducted.html

Monday, December 1, 2008

Classifying data to class interval using AWK

Recently, I needed to do a 'Simulation And Modeling' assignment which required me to classify the discrete datas into class interval.
Thanks to my counting skill (or probably it was concentration), I ended up finding different frequencies for the class-intervals each time I counted.
I knew I would never complete the assignment if I continue counting. I thought I would better go for a script to do counting for me. And hence, I wrote a small one for myself using awk.
I copied the discrete data in a plain text file called dataset. The data was separated by a blank space and looked like this:

07 05 96 14 10 90 ..............

Had to write only a few lines of code to do the trick for me. In the class interval, I had to include the maximum class limit and exclude the minimum class limit. Wrote the following code in a file called class.sh and executed it.


#!/bin/bash
awk '
{
for(j=1;j<=NF;j++){
p[int(($j-1)/10)]++;
}
print "Class Inverval","\t","Frequency";
for(k=0;k<100;k+=10){
printf("%2d lt; r <= %3d",k,(k+10));
printf("\t\t%2d\n",p[int($k/10)]);
}
}' dataset

The output of the script would look like this:

Class Inverval Frequency
0 < r <= 10 8
10 < r <= 20 13
20 < r <= 30 8
30 < r <= 40 12
40 < r <= 50 7
50 < r <= 60 8
60 < r <= 70 8
70 < r <= 80 8
80 < r <= 90 12
90 < r <= 100 11



Easy, huh? Isn't it.