Tuesday, March 18, 2014

Using hibernation in Ubuntu 12.04

I missed the hibernate option in Ubuntu 12.04 since its not enabled by default in the system menu. The only option remaining was the suspend option. However, still the hibernate option is available as a command in the terminal.

First its better to check whether its OK to use hibernate command. We need to have equal or higher Swap space in hard disk than our RAM. In my current system, both are 2GB. I checked it from the system monitor application. Since the conditions are preferable, I decided to try the hibernate option. Issue the following command in terminal to hibernate the system.

sudo pm-hibernate

After entering the password, system will be turned off after few seconds. When I turn it on again, it came back to its last state without any problem. So, I hope everything works fine.

Monday, January 13, 2014

Humpty Dumpty: A Personal Voyage

In a recent day, I visited a friends house where about a 1 year old fellow was also present. His parents were playing so many nursery rhymes in a laptop to please the little guy so that he will stay calm. Among the various songs I heard there, I heard one with which I have a connection. Its about Humpty Dumpty, my good old friend. He reminds me my childhood.

Once upon a time I was a kid. I'm sure I was so little even though I cannot even guess the age. In a nice evening, I was sitting in front of the television and was eating a biscuit as I remember. My younger brother was sitting with me according to my memory but I'm not sure whether my elder brother was sitting there with us. We were waiting for Amma to make afternoon tea. The television was telecasting some kind of a kids programs with cartoons and songs. 

Now here's this little guy. He looked like an egg. He was wearing a hat and I had no idea what the nursery rhyme meant playing in the background. He was funny and looked happy in his mood. He walked on top of some place following the rhythm of the background music. Suddenly something went wrong. The little fellow lost his control and fell down from the wall where he was standing on. His face turned into red. His disfigured face reflected the pain he was suffering. I saw cracks over his body. Some people with a shocking look, gathered around him but I didn't see them put some fair effort to heal the fallen guy.  And thats all I heard about him on that day. I had tears in my eyes and I had no way to find out what happened to the poor guy. Amma was wondering what happened to me, but I think I didn't try to say anything.

From that day onwards for a long time in my childhood, whenever I see an egg, I remembered Humpty Dumpty. What exactly happened to him, why can't somebody fix him; so many questions flew around my head. He was happy for a moment. And then he is unhappy, suffering with an extreme pain till the death. When the time flies, I think I grew up and realized it was just a cartoon or something and nothing in real. However, there's a reality behind Humpty. Life is like a drop of water on a lotus leaf. The distance between the happiness and the sufferings is unimaginably small. The moment we loss it, there's nobody on this universe who can fix it for us. No matter how far we go, which wall we climb, I think its more important to save the most precious things in life which nobody else can fix for us when things go wrong.


" Humpty Dumpty sat on a wall,
Humpty Dumpty had a great fall.
All the king's horses and all the king's men, 
Couldn't put Humpty together again... "

~ *------------------------------------* ~

Tuesday, December 17, 2013

Processing PDF files in Linux

When preparing research papers on Linux using open source tools such as Latex, sometimes it is necessary to handle files in PDF format. For example, for a research paper submission, I had to attach all the diagrams and graphs included in the paper in a separate annex of the PDF file. However the Latex manuscript wants me to have my diagrams and graphs in EPS file format to be included in the paper. So I had to process the PDF of the paper and the diagrams in EPS format separately and then merge them together. For future usage, I'm noting down the tools I used and how they were utilized. 

When I prepare my diagrams I used DIA tool. Then I exported them as EPS files to be used in the Latex manuscript. If I want to convert such an EPS file to a PDF file, I can easily use a command line tool called "epstopdf". For example, lets say I have a EPS file named as "collision_ratio.eps". I can convert it to PDF format in the command line as follows.

epstopdf collision_ratio.eps

Another new requirement arose after the above conversion. The diagram in the PDF file is smaller and does not fit in to the total A4 page size. So, I wanted to resize it to the A4 size which was done by using "Ghostscript" tool as follows. The input file is "collision_ratio.pdf" and the resulting resized file will be "collision_ratio_A4.pdf".

gs  -sOutputFile=collision_ratio_A4.pdf  -sDEVICE=pdfwrite  -sPAPERSIZE=a4  -dCompatibilityLevel=1.4  -dNOPAUSE  -dBATCH  -dPDFFitPage  collision_ratio.pdf

Finally my requirement was to merge multiple PDF files together and sometimes to rearrange the pages inside the same PDF file accordingly. There are so many open source tools which can be used in Linux to perform such kind of a task. In my case I used a tool called "PDFMod". We can install it on Ubuntu Linux by the following command.

sudo apt-get install pdfmod

This tool is a GUI based tool and therefore users can graphically add many PDF files as possible, rearrange them and finally export the resulting new PDF file. It is a really useful tool for manipulating PDF files. Even though these are the tools I used for my recent work, there are so many other available tools for processing and manipulating PDF files.

Friday, November 29, 2013

Aqua-Sim For Simulating Underwater Acoustic Sensor Networks

When working on terrestrial wireless sensor networks (WSN), we are dealing with electro-magnetic waves to propagate our signals from a sender to a receiver. However, underwater sensor networks are significantly different from their terrestrial counterpart due to the usage of acoustic signals for communication. In underwater environments we are unable to depend on radio signals for communication in long distances since higher attenuation of radio signals when traveling through water. Therefore acoustic signals is the only or most prominent and practical solution so far.

Simulating underwater acoustic sensor networks (UASN) requires special propagation models and other considerations specific to the unique features of acoustic physical medium . Due to this reason, its not possible to simulate UASNs using simulators used for terrestrial WSNs with same configurations. That means we need simulators which specifically support UASNs. Aqua-Sim is such a simulator which is based on NS-2 and therefore I found it easier to use than learning a completely new simulator. Today I installed it and ran a test TCL script to initiate using it for my simulation requirements of UASN. Since its a modified version of standard NS2 simulator, there's nothing new to be done to install it. However since I faced some error during the installation, I decided to write down the steps I followed for future reference.

First I had to download the source files of Aqua-Sim from the following link. At the end of the page pointed by this link, they have provided a download link for 1.0 version of Aqua-Sim. After downloading I extracted the compressed folder to the desktop of my Ubuntu 12.04 system. Entered the following commands in the terminal to install Aqua-Sim on my system.

cd Desktop/Aqua-Sim-1.0/
./install

After running the installation process for a while, suddenly it turned out with an error saying "ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined". After searching in the web for this error I found the solution mentioned in this blog. According it, I had to edit a configuration file, so I opened the file Aqua-Sim-1.0/otcl-1.12/configure and searched for the line SHLIB_LD="ld -shared" inside it. Then I commented and added a different line as shown below.

#SHLIB_LD="ld -shared"
SHLIB_LD="gcc -shared"

Then I ran the command "./install" again and this time it worked. At the end of the installation process, as usual in NS2 installation, it asked for setting some environmental variables in my system. So I opened the "/etc/profile" file and added the following lines at the end of the existing content and saved.

export PATH=$PATH:/home/asanka/Desktop/Aqua-Sim-1.0/bin:/home/asanka/Desktop/Aqua-Sim-1.0/tcl8.4.13/unix:/home/asanka/Desktop/Aqua-Sim-1.0/tk8.4.13/unix

export LD_LIBRARY_PATH=/home/asanka/Desktop/Aqua-Sim-1.0/otcl-1.12:/home/asanka/Desktop/Aqua-Sim-1.0/lib

export TCL_LIBRARY=/home/asanka/Desktop/Aqua-Sim-1.0/tcl8.4.13/library

Now we are done with installation. Just to make sure that the installation went fine, I ran the validation script as follows. It takes a long time for the validation scripts to complete.

cd Aqua-Sim-1.0/ns-2.30
./validate

After the validation script finished the execution, I ran a sample TCL simulation script as shown below.

cd /ns-2.30/underwatersensor/uw_tcl
ns tmac-example.tcl

This script executed successfully indicating that everything is OK and Aqua-Sim is ready for my future simulations of UASN networks. Cheers!

Wednesday, November 6, 2013

Invited talk of Professor C. K. Toh at DGIST

Professor C. K. Toh
At the end of last month, I got a chance to attend to an interesting talk conducted by Professor C. K. Toh from National Tsing Hua University in Taiwan. In his visit to Korea, he conducted this invited talk at the DGIST (Daegu Gyeongbook Institute of Science and Technology) where I got the opportunity to attend with my lab mates. Professor C. K. Toh is a collaborator and an advisor to our Monet research lab and therefore he is more important to us. However it was the first time I met him in person. The topic of his talk was "The Green Internet" where he talked about the modern trends he observed in the Internet and how it is going to effect the energy crisis of our century. DGIST institute is located in a beautiful place in Daegu, far away from the main city area. It took nearly an hour for us to drive to their place. In addition to us from Monet lab in KNU, there were some other attendees mainly from DGIST itself.

My lab mates and me in front of DGIST building
In his talk, Professor Toh showed how our modern Internet is going to face a challenge from the energy crisis. The number of users of Internet is rapidly increasing and therefore the number of computers connected to the Internet is also increasing. Due to this always connected nature of the Internet, users expect all the network resources to be available anytime anywhere. Data centers has to run 24/7 making them consume power always. Almost all the networked devices including user PCs, routers and servers are powered on all the time even when nobody is using them. The ultimate result of this trend is a huge energy crisis in the near future due to the Internet. He showed that as the Internet bill, actually what we are paying is mainly an energy bill. When the energy consumed to run the Internet infrastructure gets increased, the cost for Internet access also can go higher. In conclusion, he suggests to take proactive actions to reduce the excess energy wasted on Internet related devices. One simple suggestion is to turn of the computers when not in use. He suggested some more interesting ideas as solutions for this issue.

After his lecture we all had lunch with him. He has got his PhD from  University of Cambridge. I didn't know that he is such a giant in the field until I read his profile. He has even worked on some DARPA research projects.
 

Sunday, October 27, 2013

"Incredibly Exciting Thing, This One, Meaningless Life"

Dreams were my driving force. Still they are. Recently I came across a wonderful speech which caused an intellectual quest inside my head about what I'm really doing. At first, I thought it is a challenge to me just like a revolver pointed right on to my head. After reading it again and again, I realized its not such a challenge. It's a wonderful attitude of a wonderful guy which asked me to revise my own attitudes. He is correct at some points according to my own attitudes and he is absolutely wrong at some other points according to my own point of view. Anyway it is such a beautiful speech which deserve my own attention.

Tim Minchin is an Australian artist. He must be a very famous guy I guess, even though I hadn't hear much information about him. Oh, poor me. Anyway, very recently, he attended to a graduation ceremony and delivered an amazing speech at University of Western Australia. First of all, I have to mention that he speaks in a so beautiful way. Its really attractive whatever he say. Secondly I have to accept that I got shocked at some points in the middle of his speech. Some ideas he expressed in his speech challenged my own perspective about life. It caused me to rethink and be prepared to adjust anything that could have gone wrong in my life. So, here we go.

Among the life lessons he mentioned, I'm starting from the points which I agree and which I consider so beautiful. Minchin says, "Happiness is like an orgasm: if you think about it too much, it goes away. Keep busy and aim to make someone else happy, and you might find you get some as a side effect". This is really the definition of happiness. Throughout the past two decades I've realized that happiness is not about doing things which generates it on my own. Happiness is about making others happy. Specially the people who really cares you, the people who are ready to loss their own self for your own good. They will do everything they can to keep you happy and alive. So, they deserve your care and sacrifices to maintain their happiness. When you see they are happy, you will realize that you are happy too. That's the ultimate happiness. The selfless happiness. At some other point, Minchin expresses about the definition of our own self. He says, "Define yourself by what you love". I truely believe him in this point. I always prefer to define myself by what I really love to do. That's where I put my genuine effort, my sweat, my tears and everything I have. I always tried to do things which I really love to do. So, thats the way I can define myself, who I am, whom I really want to be and how I should get there. I'm with Minchin in there in that point.

Now it's time to talk about the things which challenged me, which shocked me and pushed me to an intellectual quest. Minchin said in his speech that, "You don't have to have a dream". The way he elaborated his view convinced me like those who have big dreams are crazy and just wasting their short lifetime. Well, I'm a dreamer. I make progress in my life by trying to chase dreams. Sometimes I succeeded and sometimes I failed. But I never blamed my dreams. They were with me almost all the time of my life. Sometimes they were with me even when nobody else was. They have been dragging me so far in life which makes me face so many challenges. Sometimes they makes me tired. Sometimes they makes me fall down and even cry. But they sit besides me until I wipe the tears, take a long breath and start moving again. So, I have a great respect on my dreams. Sometimes they are the only hope. I will keep them, feed them and love them. They will not leave me alone when I fall down next time in the battle field of life.

So, in conclusion, thank you Tim Minchin for this wonderful speech. Its truly wonderful, incredible and enlightening. Its true that there are some places where I don't agree with you. But your speech really deserve my time. He says at the end, "It’s an incredibly exciting thing, this one, meaningless life of yours". Of course, its an incredibly exiting thing, this life. And yes its truly meaningless since we are a result of random events occurred in the universe for millions and billions of years. But still, I believe its worth searching for a meaning, chasing dreams until oneday I fail, fall down and die somewhere in this universe. That might be the meaning of my life. Nobody knows. Perhaps I will never know.

Tuesday, October 8, 2013

Wandering around: what life has to offer?

I'm in almost the same place. Same milky way  galaxy, same solar system, same planet. But in a different country. Far away from the home which I considered as my own place. After being here more than half of a year, today, at this particular point of time, when I stop everything and turn back to see what happened so far, I see some great insight. During last seven months, I forgot lot of good things which I used to practice for many years. There was a time I used to day dream a lot. At home I usually walk here and there from living room to the kitchen, from front door to the rear door thinking about so many crazy things. May be I have walked so many kilometers inside our home a day. I used to read a lot of books. They helped me to improve the quality of my day dreams. They added good ingredients to life. But suddenly I quit living that life and stayed alive for about seven months .

image credit: Udaya Wijenayake
During this time period I could not find time to walk around day dreaming for hours. Everything is scheduled. Wakeup, have breakfast, goto lab, lunch time, dinner time, come back to dormitory and goto sleep. Everything has a specified time. I'm not used to follow these time tables which are virtually unbreakable. At home I used to hold my plate during lunch for more than an hour since I was thinking while eating. I used to stand under the shower for a long time keep thinking. How much wonderful the day dreaming was. I made a mistake by quitting it. Now I know I have initiated to roll back. Back to the mysterious world of day dreaming. Whatever the reasons are, back to the dream world is good. It feels good. Its not easy to find time for that. So I do it all the time. The ingredients provider has started the service again. I'm reading books again. Not just the research papers like last seven months. I read good books. Good as a good book can be. Besides that, the most important function is started now. Let me try to tell you how it feels. 

About a week ago, we had a holiday. That's last Thursday. I couldn't find any enjoyable plan to spend that holiday. After different failures, finally I had the only choice that is going for a ride. A ride on my bicycle. Just me and the bicycle. On that day I woke up late at the lunch time. Had the lunch from dormitory cafeteria, took the bike and left. In my backpack there was a really good book. The book I'm still reading these days. My plan was simple. Go to the river side near the university, ride the bicycle in the track along the river and when I get tired, sit down on a bench and read the book until the stars appear and ask me to go home. However the plan started to shift away from the very beginning. Riding the bicycle along side the river felt so joyful than ever. From one side, the river that flows so calmly. Ahead, the never ending bicycle track. All over I see mountains, trees, and the clear blue sky above me. The faster I ride, the cooler the river side breeze which washed my face. There was nothing to stop me from keep moving. So, I kept moving, riding like crazy.

Carl Sagan once said, "We began as wanderers and we are wanderers still". I was wandering without a hope for no particular destination. I didn't know when I will fed up, when my legs start to hurt and ask me to stop moving. I didn't know when I should turn back and get to home. I just knew that there is a long way ahead and I can try to move a little bit more before I fed up of this long way joyful campaign. For a long time I wondered what life has to offer. What it will bring up finally. Its always the curiosity and uncertainty what fills our lives. There's nothing for sure. We just see the blue sky, the surrounding mountains, the long way ahead and the memories of our starting position of this journey. Whatever the decisions we make either to keep moving ahead hoping for the best or to turn back and go to the beginning is totally based on the limited information we have at the moment. But most importantly, whatever the decision we made, we should have the courage to stand by it without giving up easily. The situations can be really unfavorable for keep moving. But still its worth keep moving until we are really sure that it's time to give up and turn back.

image credit: Udaya Wijenayake
Anyway, this lonely voyage didn't last longer. Suddenly I got a message from Udaya Aiya who is a senior and a close friend of me. He was worrying where I was and then he decided to join the journey. Within the next half an hour, he arrived with his bicycle. Then Pathum joined. Finally Nadee akka. Together we all, traveled a long way. It was so much an exciting experience. We decided to turn back and go home when it was darkness all over, leaving the distant stars staring at us. I returned to the dormitory but not as the person who left in the lunch time. My mind was full of fresh thoughts and great insights into life which I collected from the cool breeze of river side. I hope they will last long with me in the voyage of life. 

- -------------------- -