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 @

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 and executed it.

awk '
print "Class Inverval","\t","Frequency";
printf("%2d lt; r <= %3d",k,(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.

Wednesday, November 26, 2008

FOSS Nepal wins best SFD '08 event for consecutive year

Today, it was a day of wonderful surprise for the FOSSians here.

The results of the best SFD (Software Freedom Day) events was announced and guess what we have managed to stand one of the best SFD events team for the second time in a row!

Thanks to the effort put by together by the collective effort of volunteers. Bibek Paudel ensured that our effort were properly logged in a report to be submitted. And here we are!!!

SFD announces three best SFD events team every year (in no particular order). The other two teams who managed to tell precisely how they managed the event were: SFD Nicaragua and DabaweGNU. The information is available at :

FOSS Nepal was declared one of the best events even last year ('07) along with SFD Nicaragua and Beijing SFD.

SFD was celebrated throughout the world on September 20 this year. You can find a post about activities in this year's event in Nepal on Pravin Gautam's weblog

Everyone is enthralled and we will soon be having party to celebrate this victory!!! And, now that we have tasted the fruit of success, we are looking at making a hattrick. :)

Friday, November 21, 2008

A week long journey to hightech rural Nepal

It was unexpected but very pleasant surprise for me to receive a call from Basanta Dai ( asking me if I could manage time to go to Nangi for follow-up training of PAN localization, a project by MPP (Madan Puraskar Pustakalaya: I needed to teach the trainees about Blogging and CMS.

But then I was a bit hesitant since I needed to miss college for at least 10 days. I talked about this to Suraj, Manish and Shishir Dai. Everyone said that I should go. And so I was ready for a lifetime experience.

We started our journey from Kathmandu on Nov. 17 and had a night stay at Beni. The next morning we had to trek for 10 hours to reach our destination, Nangi. It has been the most difficult trek of my life till date but such a beautiful place is worth every pain.
The view of Annapurna South, Annapurna II, Dhaulagiri, Gurja Peak all make you feel like a heavenly creature.

While you trek, you wonder if you would even find salt at such a place, you will be amazed that most of the villagers use VOIP as the sole telephony medium. Most of them are good at emailing, chatting and you would find most of the communication in the neighbouring villages taking place through forum on a local webpage. What more, they have a tele-medicine centre.
I was really stunned to see this hightech village. And despite this all, they are so friendly to you.

The training was arranged by ENRD (E-Network Research and Development). Uttam Sir and Ambika Madam from ENRD accompanied us.

While Basanta Dai needed to discuss the new features in Nepalinux 3.0 like Text-to-speech, Nepali Sabdakosh, Nepali spell checker in Open office as well as GIMP, English/Nepali Wikipedia, Web Domain Registration, I was assigned the task of teaching Blogging and Website building using CMS. I chose Drupal (

From the next day, we had to start the training session. And, it was supposed to be a 9 day training session.

The trainees (or probably I say trainers since it was a Training of Trainers programme) were from 5 different locations namely: Krishna Sir, Kishan Sir and Boj Sir from Nangi (Myagdi), Sete Sir and Yamshree miss from Shikha (Myagdi), Narayan sir and Amrit ji from Tolka (Kaski), Shivaram Sir from Dandagaun (Rasuwa) and Chhanu Sir from Jhuwani (Chitwan).

In these 9 days, we got along very well with everyone and it was all fun inside and outside the class. We would take classes from 9.30 AM to 4.30 PM with an hour break and would then go for walk around village.What more, we also got to participate in the traditional Magar dance. I am glad that I got to experience all this.

In the meanwhile, Amar Sir from MPP joined us on training on 8th day while on his way to Ghorepani with his friends. We organized a small feedback session. And it was pretty good that we received good remarks about the training from the participants. Only the complaint that the participants had was that the curriculum in schools had to be Vendor independent so that they themselves had the opportunity to use Nepalinux regularly and teach their pupils. We assured that we would do the best we can. By the way, let me bring it to your notice that we are already putting the curriculum issue before CDC (Curriculum Development Committee) and I am taking charge on this front on behalf of FOSS-Nepal.

By the end of the training, the participants from the centers had developed the center's respectives sites. The following are the links to the sites:

Dandagaun --

Jhuwani --

Nangi --

Shikha --

Tolka --

Well, I have a lot to say, but let photos express it in a better way.

Thursday, November 20, 2008

GMail launches themes

Just today, when I was about the check my mails, I read the feed of GMail blog that talked about launch of Themes in GMail. I was so excited by the thought. I signed in to find no 'Themes' tab under Settings.

I went through the whole article to find that Google was updating each account and the process may take some time. And hence, it was a long long day for me. Then, finally, I got to see 'Themes' tab in the Settings which looked like this.

Themes tab with 'Mountains' Theme activated.

What more, some of the themes work with your local time. Like the 'Beach' theme would change the appearance of your GMail to simulate the look of a beach at your local place.

There is a theme for everyone. Even a theme called Terminal for console fans and geeks!!!

So, I am a much more happy GMail user now :)

Monday, October 20, 2008

Dynamic svg graphics using PHP

If you have ever used Inkscape, I am sure you must have loved the power of the software. Besides nice and easy to use interface, what makes it a really powerful tool is the graphics standard that it follows - SVG or Scalable Vector Graphics.

The SVG format is an XML based open standard for Vector Graphics. The XML format makes SVG a powerful resource for dynamic graphics with the help of some programming or scripting language. Many web browsers now support SVG format. All you have to do is include the following header:
header('Content-Type: image/svg+xml');

Let me present a small demo to give you a glimpse of what can be done with SVG and PHP together. I have used a very simple example with minimum graphical components to make it easy to illustrate the concept. Though, there is huge possibility of making things better.

Say, if marks of a student in various subjects were to be presented in the format shown below, where the name of the subject and the marks are fetched from a database table, you would probably have used a complete graphics library package.
You would notice that the color intensity of the bar graph for various subjects are different. I have chosen 40 to be pass marks. Anything below it would be rendered in red with highest intensity for 0 marks and lowest for 39. And anything above it would be rendered green with lighest intensity for 40 and it gets darkest at 100. The number of subjects are also dynamic.

This task can easily be performed using svg graphics and php. So, where do I begin?

Well, writing the complete xml script for svg by yourself may be difficult if not impossible. The best way is to draw the initial framework using Inkscape or any other Vector graphics tool. I drew something like this.
Don't worry about the accuracy of color intensity and percentage. We will leave the mathematics for PHP. And you don't need to be accurate about positioning and other stuffs. You can always edit them later. All you have to do is prepare basic framework.

If you notice properly, you would identify that there are 4 components that are dynamic for our purpose. The text that writes "Maths" (it will be fetched from database), the container for the bar (it will have to be replicated for all the subjects), the bar itself (besides being replicated, it will have varying color and width) and the percentage text of course. Note down the id of these components from the graphics tool you are using.

Now, open your svg file in some xml editor (almost text editor would open it). Copy the whole script. Create a PHP file as follows:

header('Content-Type: image/svg+xml');

$query="SELECT * from TABLE"; //TABLE has two fields: subject and marks


The code above should be self explanatory. Now, locate the section of the dynamic components and keep them in loop as:

for($i=0;$i<$count;$i++){ $subject=mysql_result($result,$i,subject); $marks=mysql_result($result,$i,marks);


Now, the tasks that you will have to undergo are as follows:

1> Make the y value of all those components dynamic as every subject will appear at different value of y. Something like this:


2> Replace the static text 'Maths' with $subject and '23' with $marks.

3> Vary the width of bar component.


4> Now all we have to do is vary the color of the bar to meet our requirement.
It was done as follows:

echo '#00'.(dechex(210-2*($marks-40))).'00;';
echo '#f82d00;';

echo 'fill-opacity:';
echo '1';
echo (1-$marks*195/(255*39));
echo ';stroke:none;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"

While I chose a certain sort of colors to depict on the graph, you can choose your own sets of color. If you go through the above code carefully, you would easily realize how the colors were generated.

While this should have given you an idea about the power of svg, you can refer to more resource on integrating svg with php at's wiki with complete source code.

So, if you are a nice designer with good programming skills, you have both your hands in a pool of treasure now!!!

This article has also been published in the first issue of 'The init Magazine' released by IOE FOSS. The magazine can be downloaded from

Monday, September 29, 2008

Managing your mails with Labels and Filters

I have often noticed most of the newbies who subscribe to an active google group unsubscribe soon after being troubled by messy inbox because of the email flood. Or, as an alternative they choose not to receive Emails.

Hey! in case you have a gmail account, it was never that difficult to be receiving the discussions in your mailbox without bothering to locate an important mail in an ocean of mails from the group. The task can be easily accomplished with the help of Label and Filter. Not just groups, you can also you it to filter your mails as per your convenience.

Let me tell you the way to vanish away the cause of your daily migrane.

Go to Labels->Edit Label link from Left panel or Settings->Labels from the top bar.

Type the name of the label in the text box accompanying 'Create' that you would want to associate with your mail filter. You can choose any name you desire. And press Create button.

For example, if you wanted to filter all the mails from ioefoss google group, you could name the label IOE-FOSS or anything you deem suitable.

Huh! will that filter the mails from ioefoss in my mailbox? No not yet, you have just created a label, you need to filter the mails now.

Now, choose Filters from Settings. And click the link 'Create a new filter'.

So, you see so many criterias for filtering your mail. You can filter on the basis of the sender, receipant, subject, etc etc.

So, if a friend of you frequently communicates to you and you want to filter the mails from him, you would simply type in the email address of your friend in the 'From' textbox.

And in case, you wanted to filter the mails from google groups, you would type in the email address of the group in 'To' textbox.

For eg, to filter your emails from ioefoss google group, you would type '' in 'To' textbox. If you are confused how to select the field for filtering the mails, you would better check the header of the mail and find something common the mails you want to filter. You can do this by clicking 'Show details' in your mails.

After this, click 'Next step' button.

So, now you have various ways of filtering the mail.

If you wanted not to receive your filtered mails in your inbox and directly go the the Label, check 'Skip the Inbox' and then 'Apply the label'. In our case, the label would be 'IOE-FOSS'.

If you wanted to apply this for the prior communications, check 'Also apply filter to ___ conversations below'.

And that is all you had to do to get rid of your headaches. Simple, isn't it?

So, happy GMailing (thanks Dhruba for coining the term!!!).

Monday, May 12, 2008

Do you still love your old snake game?

With the development in graphics hardware and computing power, the games developed these days are very powerful and challenging. But still there is something fascinating about the traditional computer games. Most of us have must have played snake game popular on cell phones. I am sure there are many who are very crazy about it. I am myself a fan of the game and I love the simplicity of the game. But as far as I believe, after a certain time you adapt to the game and get hold of timings and strategy which may dilute your enthusiasm after sometime. And there is really no time factor for eating the food. How about being able to limit the time within which a player must eat the food? Hmmm.. not convinced with the idea.

Ok how about adding a timing limit indirectly by making you compete for a food which your friend in network also tend to occupy. That is making it go multi-player. Ah, now that sounds interesting. Want some more challenge? How about an intelligent snake which the computer controls and which is capable of determining the shortest path to food? Scared? Ain't you excited about it? Yup, there is a game that adds these feature to the snake game-iSnake. The project has been developed in Java. And just to let you know I am one of the developers of the game.

We developed this game as a part of our academic project and with the purpose of research in AI and real time gaming. But that doesn't mean we ignored factors like smooth gaming experience. We twicked the original swing components in Java to give the GUI a game like touch. The project uses Apache Mina Framework for communication. Besides, the game uses an algorithm for shortest path finding which we developed ourselves. The biggest challenge in the project was path computation in real time. Each game cycle is of 100ms and computing path within 100ms with other threads simultaneously running is really tough. Most of the path computations are rarely done in real time. We code- named the algorithm that we are currently using in the game as Viper. The game won the first prize at 'KUCC Software Meet 2008' and we participated with the project in 'LOCUS-Technical Fest 2008' for which the results are still awaited.

The game is hosted at and has been released on 07 May. The game is registered under GPL and can be launched from web page using Java Webstart. You can find the complete documentation of the project including the path finding algorithm on the website.

So what are you waiting for? Browse the url:, download the game. And get going. Give your friends a difficult time eating food. Happy Gaming!!!