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 :

http://softwarefreedomday.org/Competition2008

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 (http://basantashrestha.blogspot.com) 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: http://madanpuraskar.org/). 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 (http://www.drupal.org).

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 -- http://dandagaun.com.np

Jhuwani -- http://jhuwani.com.np

Nangi -- http://nangi.com.np

Shikha -- http://shikha.com.np


Tolka -- http://tolka.com.np


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

http://www.flickr.com/photos/jitendra-pic/sets/72157609561027757/

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:

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

mysql_connect(HOST,USERNAME,PASSWORD);
mysql_select_db(DB_NAME);
$query="SELECT * from TABLE"; //TABLE has two fields: subject and marks
$result=mysql_query($query);
$count=mysql_affected_rows();

echo 'PASTE THE COPIED TEXT HERE';
?>


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:

y="'.(405.21936-$i*60).'"

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

3> Vary the width of bar component.

width="'.($marks*5).'"

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

style="opacity:1;fill:';
if($marks>=40)
echo '#00'.(dechex(210-2*($marks-40))).'00;';
else
echo '#f82d00;';

echo 'fill-opacity:';
if($marks>=40)
echo '1';
else
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 svg.org'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 http://ioefoss.ioelive.com