Friday, August 10, 2012

Myna's Struggle, Two Girls and Computer Science


Today morning I could just come closer to the main entrance of UCSC building complex. I heard a huge noise. There were three birds on the ground in front of the auditorium. Two were Crows and the other one was a Myna. The crows were pulling the Myna from two sides and Myna tried it's best to escape from this trouble. I didn't think twice even though I could be interrupting some natural event happening in the environment everyday. I didn't care. I just wanted to save the Myna.

When I run towards them, the two crows flew away while the Myna was still on the ground. One leg of the Myna was trapped in some kind of a nylon string. Because of that it was in trouble. I think the Crows were trying to take the advantage of it. Anyway I tried my best to remove that string but it was not that easy. And also the bird seemed so weak and I thought it was going to die. At this time a good idea came to my mind. The Department of Zoology in University of Colombo has lot of bird lovers. I have seen some events they organise every year about birds and different kinds of other animals. I thought they could do something. So I took the bird and walked towards the Department of Zoology.

Near the department, there were two girls having a chat and I talked to them. When they saw the bird they quickly responded by taking it from my hand. They said they can fix that nylon string problem and take care of the bird. Then they ran into their department building. So, there was nothing left for me to do about the bird.

While I was walking back to our UCSC building, some nice things came into my mind. When I was doing Mathematics back in my A/Ls, I felt like Mathematics is the greatest thing in this world and any other subject is just nothing in front of it. When I started to do Computer Science in university I felt like CS is the most powerful collection of knowledge within the human knowledge boundary. Sometimes it felt like we know a huge part of human knowledge base when I approach my final year. Today I learnt the lesson of the importance of experts in different fields thanks to the Myna, two Crows and the two girls. If we didn't had people with different interests and passions on different subjects this world would have become so different than today. Thanks to this diversity of passions, humans are still ahead of any living being we know in this universe.

Friday, August 3, 2012

An Unforgettable Collaboration

About a year ago I received the opportunity to work with a wonderful person on a wonderful research journey which is now about to end. Lakmal Weerawarne (for me, Lakmal Aiya) worked as a research assistant at WASN lab playing a leading role in our most of the research works in Sustainable Computing Research (SCoRe) group. He is now leaving us to work for his Ph.D at University of Binghamton. I closely worked with him in most of the project works throughout past time period producing lot of unforgettable memories which will last a life time. All those moments of challenges, difficulties and happiness move around my head just like everything happened today. This is my personal memoir of that wonderful collection of life experiences I earned working with him.

    During my third year first semester at university everybody in my batch were so busy finding a place to do their internship training in the second semester. I didn't had any rush or uncertainty in my mind since I had decided how and where I should spend my internship period. It is Wireless Ad-hoc Sensor Networks (WASN) laboratory at UCSC. I had been voluntarily contributing to some of research works at WASN lab since my second year and therefore it wasn't a new place to me. I knew that if I need a semester full of research, WASN is where I should be. In this way I became a member of WASN lab in my internship started in March, 2011.



    From the beginning Dr. Kasun, my supervisor assigned me to different project works where I played a supportive role to the research assistants who were mainly working on those projects. He had a plan to start a new project of deploying the database abstraction of sensor networks on a smart home application. This work goes beyond the conventional sensor network hardware platforms we were working with those days since we needed lot of specialized hardware and related low level software components to make this new project a success. Dr. Kasun said that a new research assistant will join with the lab to work on this project from the Physics department of University of Colombo. I was supposed to work with him in this project after this recruitment.



After about a month, Lakmal joined with us. Even though he was not coming from a computer science background, he seemed a quick learner. He easily understood everything we were working on our sensor network projects and immediately jumped into the subject matter. He was really passionate on embedded and ubiquitous systems related works making him the main contributor in this smart home project. We become good friends from the beginning. The early days of the project went smoothly without any issues and we were generally easy going. Later on, unbelievable challenges and tough times occurred in our works and when I look back about those days, I feel we would not get through those tough times if both of us didn't had the required amount of patience and the trust on the capabilities of each other.

    A typical day starts with some particular part of our problem and we work on it carefully. Lakmal set up hardware components and write low level drivers for them while I work on the high level database abstraction layer works. When we integrate all these things and program our applications to MCU in sensor nodes, unexpected results come out. Sometimes it takes several hours or even worse several days to figure out which went wrong in which component. We missed our lunch so many number of days since both of us didn't wanted to stand up from our seats to go for the meals leaving our mind blowing problem alone in the lab. When we felt too tired, we went to the canteen at about 4 or 5pm and ate something while drinking tea. However our typical days didn't end here. We usually left university at about 8.00pm after struggling with our project works. If the university does not close at 8.00pm, I'm pretty sure we would have even stayed all the time working on our project. There's a nice array of words which can explain our situation in those days briefly. "When the going gets tough, the tough get going" That's exactly what happened. The more the problems got tough, the more we got encouraged to fix them.



    A different kind of a task was done during this time period adding another set of experiences. A school in Ampara district had received some grants to buy few computers for their school. The principal of that school had heard about our Linux based PokuruPC project where a single computer system unit can be used by 4 people with 4 monitors, 4 mouses and other peripheral devices. Even though they had money to buy about 5 ordinary computers, if they use PokuruPCs they could have 12 computers. Dr. Kasun asked our research group to visit that school in Ampara to set up their computer lab. So our group including Lakmal and me went their and stayed at Ampara for about 2 days and we did a little workshop for the school kinds to make them familiar with computers and Linux. I wrote an article about this journey those days which you can find here.

After my internship period I started my 4 year at university and therefore I couldn't be at the WASN lab all the time. However still our collaboration on the project works continued. Another nice thing was the WASN course in the 4th year first semester. While Dr. Kasun handles the lectures of that course, Lakmal was the person who carried out all the practical stuff. When comes to course works I think he is a little bit tough guy. All the reports and other stuff had to be properly prepared and after each practical in every week he asked questions from the students which were not that easy to get through sometimes. We couldn't do some serous work together after I started my 4th year since I had my own works to do. But after some new interns from my junior batch started working at WASN lab we all did some more improvements to the smart home project making it much more usable.

In my short life time in research works at university, I have been working with different people on different projects and I can honestly state that Lakmal is the best research colleague I ever had. I learned a lot from him and he improved my enthusiasm towards research works and academic life to a great extent. So, even though I'm losing a great research colleague I ever had, I wish him success in every step he move towards his Ph.D and the rest of his life and moreover I wish one day we will again get a chance to work on a tough research work and publish together.
"When the going gets tough, the tough get going"


Monday, July 23, 2012

Talk On Enix Operating System

Today in our research seminar, I did a presentation on a research paper. The paper I selected was "Enix: A Lightweight Dynamic Operating System for Tightly Constrained Wireless Sensor Platforms" [link] which is published in year 2010 at ACM SenSys conference. Since Operating Systems is one of my favourite courses I learnt in university, I wanted to present an OS related paper in the research seminar. Additionally, since this Enix OS is intended for wireless sensor network platforms it is related to my final year research too. Therefore I picked this paper.











Enix is currently implemented to run on an experimental platform called EcoSpire nodes. However according to the authors it can be easily ported to other platforms too. Among the features provided in Enix, the most significant work they contribute according my point of view is the virtual memory implementation.

Virtual memory functionality in Enix


Enix supports virtual code memory with the assistance of the compiler. Library functions are compiled in to position independent code (PIC) segments and stored in the Micro-SD card. All the user application calls to these functions are directed to a special run-time loader in the kernel space. This loader finds the required functions in the Micro-SD card and load it to an empty space in memory. Since these functions are compiled in position independent manner, no run-time relocations required. Copied functions can just start running from wherever they loaded. This is how the overhead of run-time relocation is removed in Enix with the assistance of compiler. However I think position independent codes introduce some computational overhead than normal executable codes. In  addition to the virtual memory, Enix provides an it's own file system called EcoFS. 

After my presentation we had a nice discussion where we talked about different aspects in particular Enix and in general about WSN operating systems. Even though I was a little bit nervous before the presentation, I think I could do it without any issue. :) I'm feeling so much happy about it.

Thursday, July 5, 2012

Dr. Erik Billing is here



















Dr. Erik Billing from UmeĆ„ University of Sweden visited here. As I heard he just defended his Ph.D in last January. Even though he writes his name as "Erik", it is pronounced like "Earik" or something. Anyway we were allowed to call him "Erik" just like we pronouns an English name. :)  I received few opportunities to attend to his lectures conducted during this visit. He is mainly interested at artificial intelligence and intelligent robotics like stuff. He is a nice guy.

His Ph.D dissertation


The title of his Ph.D dissertation is Cognition Rehearsed - Recognition and Reproduction of Demonstrated Behavior. Since he gave some copies of his dissertation to some other people, I got a little chance to take a look at it and it was the first time I saw a Ph.D dissertation. Unlike the thesis we are writing for our B.Sc degree, this Ph.D thesis have a very nice professional look. I don't know whether usually doctoral thesis's of any other person is like that. However this one is good.







During his lectures, he discussed about different theoretical aspects mainly in Robotics area. Additionally he did some demonstrations with robotics simulators. He said that he will stay here for few weeks more, so I hope I will get more chances to talk with him and learn something.
There's an article with his idea's here (English translation).

Wednesday, June 13, 2012

In Love With Computer Science



There's a nice article written by a senior lecturer of UCSC, Dr. Chamath Keppitiyagama about the Turing Machine. I really like that article since I'm a big fan of theoretical computer science. It is a good attempt to show up an important concept to the ordinary people. I thought to repost it's content here to make it secure so that if the original article goes off, I won't miss it. :)

Link to original article: http://www.nation.lk/edition/component/k2/item/3666-a-computer-for-hundred-rupees?.html


A computer for hundred rupees?

No, I did not miss by several zeros – I meant it. We can build such a cheap computer and I guarantee that it can solve any problem that can be solved by those fancy and expensive computers. Now do not rush to buy processors, power supplies and other equipments, because we do not need them!

You can get the following ‘parts’ under hundred rupees. You need a long paper tape (a very long one), a pencil, an eraser, and a note pad. Take the long paper tape and using the pencil draw equal-sized squares along the tape.

That is it. Now there are some rules to follow. You can move the tape one square to the left or one to the right. You can write ‘1’ or ‘0’ on the square directly under your hand. If you wish you can erase anything on the square directly under your hand. After taking any action you can write a number in the note pad to indicate your ‘state’. The note pad has a table that you can consult before taking any action. This table tells you what to do – write, erase, move left or right – when you are in a given state and after reading a particular value from the tape. All that you can do is limited to those few actions.

That is your 100 rupee computer. I am not joking, but this machine is so powerful that it can solve any problem that can be solved on fancy computer. In fact, if a problem can be solved using a computing device, this computer can solve it. If this computer cannot solve a problem then it can never be solved using even a super computer. Unbelievable, isn’t it? Yet, it is true.

This machine is called a Turing machine. It was designed by Alan Turing in 1936, quite a long time before anybody made a computing device that resembles modern day computers. He did not propose it as a machine to be built and used for actual computation, even though you can easily build one if you really want to and use it for computation. Alan Turing proposed the Turing machine as a model of computation. He proposed that if any problem can be solved using computers this extremely simple machine can solve it and only the problems that can be computed on this machine can be solved on computers. It makes our 100 rupee computer a very powerful one indeed!

I have simplified the description of the machine quite a bit. A Turing machine needs an infinitely long tape, but let us ignore those details. Initially, the problem to be solved is written on the tape using ones and zeros on the squares (strictly speaking they do not even have to be ones and zeros, they can be any symbols). When the machine stops – that is when you stop moving the tape back and forth – the answer will be on the tape encoded in ones and zeros.

Computer scientists and mathematicians use this simple machine to study whether problems can be solved on computers and if so what are the most efficient ways to solve them. They do not actually build the machine, but use it to think of computing as a sequence of those actions allowed in the Turing machine. Even though they look very complicated, modern day computers try to mimic this machine. The role that you played in our 100 rupee computer is played by the processor and the memory chips take the place of the paper tape. The electronic processor is just faster than you and the problems can be solved faster, but apart from the speed, modern computers are not more powerful than a Turing machine. In fact, they are less powerful since none of them have an infinite memory whereas the Turing machine has an infinitely long tape (memory).

The power of this simple machine does not stop there. I am sure you have heard of those wonderful programming languages such as Java, C# and Python. Those programming languages are no more powerful than the simple set of instructions on our rudimentary computer. If you can write a nice program using those languages, you can write the same one using our simple set of instructions, but that would be tedious. Most of us have the notion that computers are all powerful devices. Well they are in some ways, but so is our Turing machine! I am sure now you have lost your faith in computers.

(The writer is a Senior Lecturer, University of Colombo School of  Computing)

Wednesday, June 6, 2012

Gnuplot For Visualizing Data


When writing research papers and technical documents, displaying data in a useful manner is really important. Specially when presenting different evaluation results in a statistical form in documents we  need to draw different types of graphs. Since it is important to me, I was looking for a good tool for that for sometime. Since I'm using Ubuntu Linux, the best recommended one I could find on the Internet was Gnuplot. It's a free tool and very powerful to draw different types of graphs.


Since it is a command line tool it takes some time to learn about how to use Gnuplot for our requirements. Therefore I postponed my Gnuplot learning process several times and finally today I got some first hand experience. At first I found this blog post. Then it sent me to this tutorial which contained so many helpful information. I recommend it if you really want to learn to use Gnuplot tool from the beginning.

To make my mind easy to memorise what I have learnt up to now, I decided to write a little summary of the basic things I need to use Gnuplot. So, here we go.

 1. To install gnuplot on my Ubuntu-11.04 system, I issued the following command in the terminal.

         sudo apt-get install gnuplot-x11

2. No I can start gnuplot by issuing the following command.

    gnuplot

It will show a prompt like the one showed in the above picture and all the other thing has to be done on this prompt. If you want to exit from the gnuplot, type 'exit' on the prompt.

3. Now let's create an example plot and write it in to an image file. To do that issue the following commands on the prompt.

    set terminal jpeg 
    set output 'our_file_name.jpg'
    plot sin(x)

Now in a new terminal you can go to the working directory of the gnuplot and open the 'our_file_name.jpg' file to view your graph. You can find out the working directory of gnuplot by typing 'pwd' on the prompt just like you do in normal terminal. To change the working directory use 'cd' as follows on the prompt.

cd "/path/to/new/directory"

4. To add the names of the graph, the x axis and the y axis use the following commands.

         set title "My graph title"
    set xlabel 'x axis'
    set ylabel 'y axis'

After changing these settings we have to re-run the previous plot command with new changes. We can do it in shorten way by using 'replot' command as below so that you don't have to write a plot command again and again since sometimes plot command is too long with so many parameters.

    set terminal jpeg
    set output 'plot.jpg'
    replot

5. Even though we set different parameters in gnuplot as above, they are gone if we exit from gnuplot and start it again later. Therefore it's useful to save current configurations so that we can load them again.

View the current configuration by issuing the following command.

    show all

You can save the configuration to a file as below.

     save "savefile.plt"

You can load a saved configuration from a file by the following command

      load "savefile.plt"

6. Now we want to draw a graph using the data which comes from another data file. Consider the following file named 'my_data.dat'.

 1 10 11   
 2 20 23   
 3 30 34   
 4 40 45   
 5 50 56   
 6 60 67        
 7 70 78   
 8 80 89   
 9 90 100  

We have three columns of data in that file. Let's draw a graph with first two columns.

      set terminal jpeg
     set output 'first_graph.jpg'
     plot "./my_data.dat" using 1:2 title "First line" with lines


first_graph.jpg


















Now let's draw two graphs in the same figure. The first graph use first column as x-axis and second column as y-axis while the second graph use the first column as x-axis and third column as y-axis. Here's how we do that. 

     set terminal jpeg
     set output 'second_graph.jpg'
     plot "./my_data.dat" using 1:2 title "First line" with lines, "./my_data.dat" using 1:3 title "Second line" with lines


second_graph.jpg



















There are so many other things to learn in Gnuplot to create nice graphs. I believe that learning gnupot would not be a wastage of time since good data visualisation is an important skill which should be in a computer scientist. So, I should expertise it in the future.  :)

That's all for now. Enjoy drawing graphs with gnuplot!

Tuesday, June 5, 2012

Moving Into an Important Time

I couldn't write something useful here for a considerable time. Even though I'm really busy on my final year project works I was unhappy about leaving my blog without writing something. I'm writing this post to make my mind although there's nothing useful in it.

Currently I'm in a crucial time period in my final year project. The designing phase went without any pain but now I'm facing so many issues from the beginning of implementation phase. So, for about a month I had a huge pressure in my head. But I think now most of those issues are solved to a considerable extent and therefore I hope to move in a straightforward process. That's about my project.

EasyPic Board (thanks to Chathika for the picture)

In this semester I'm taking the Robotics & Embedded Systems course and therefore I have to work with electronic stuff. Even though I'm working closely with embedded platforms from a longer time in Wireless Sensor Networks research work, I hadn't step into much lower hardware level. In this semester with this new course I think I will earn the necessary skills in electronics that I was lacking for years.


There's another important thing we have ahead. It's the ICTer 2012 conference. International Conference on Advances in ICT for Emerging Regions (ICTer) is mainly organised by our university with so many partners. As the SCoRe research group we hope to submit a paper to it. So, currently we are completing the paper writing task these days. The call for papers notice can be found here.

So, in every aspect it's a busy time. But I will try my best to keep my blog alive since this is the place which allows me to write anything I like.