Saliya's Blogs

Mostly technical stuff with some interesting moments of life

Either "either", "or","and" or "and/or"?

http://en.wikipedia.org/wiki/And/or

Copy Path to Clipboard : Another Life Saver

Want to copy the path of a file to clipboard in Windows without having to open properties window? Just try Copy Path to Clipboard v 1.00 (http://www.softpedia.com/get/System/OS-Enhancements/Copy-Path-To-Clipboard-JA.shtml). It's a pretty neat tool that saves quite a bit of human I/O time :D

Note. It works fine with Windows 7 as well.

ReSharper: Life Saver for Visual Studio Users

If you are using Visual Studio for application development then most probably you may have noticed the lack of built-in refactoring support. At least for me it was so obvious, probably because I was used to the rich environment provided by IntelliJIDEA (http://www.jetbrains.com/idea/) for Java development. So finally did some search to see if there's any third party plug-in for Visual Studio on this aspect and guess what! The same guys who build IntelliJIDEA has a plug-in called ReSharper (http://www.jetbrains.com/resharper/). I had no second thoughts to use it based on my experience and it sure changed my clumsy feeling towards Visual Studio :)

Unfortunately it's not free, but if you are doing open source development they give you it for free. Anyway, the cost isn't sky-high to purchase as well.

It's Cold Again

අඳුරු වළා ලං වුනා ද
එලිය නුඹේ නැති වුනා ද
සීත අහසෙ රජ වුනා ද
නුඹ ආයෙත් සැඟ වුනා ද

2/22/11

(C) Saliya Ekanayake

Subscript and Superscript with MS Word 2007 Equations

If you happen to use MS Word 2007 for equations and wonders why the heck there isn't a shortcut to subscript and superscript then you will like what I just found couple of minutes ago.

If you want to type e1 with 1 as subscript just type e_1. The moment you hit space it will become what you want. To make 1 superscript type e^1 and space. Enjoy!

Open Cubicles and Work

I wanted to blog about this for a long time and finally it's out today. If you are in the computer science world working in some company or doing research, cubicles will not be a new thing for you. A large room partitioned into blocks of small cubicles and two or more people working nearby are the typical nature of these work areas.

Honestly, I really really don't like this setting. I wonder who came up with this idea of having people sit nearby in the open and work. May be people are thinking that having open cubicles give more freedom to people because they are not physically constrained by walls or doors. But have they ever thought the effect on mind? Does physical boundaries affect the same way to mind? In fact, I think it's totally the other way around. You cannot think effectively when you are in open with others. Essentially what happens is that you are physically free, but mentally constrained.

The truth with everyone, no matter how much they don't like to show it, is that they have unique ways of working optimally. This may include things like clapping and rubbing the hands when your code works and say "Oh! Sh*t" when it doesn't. Not to mention the luxury of thinking silently. How much of these can you do when you are in a professional setting surrounded by others? Also, how much actions of others can you tolerate. Here's one of my personal experience. A person who sat next to me used to sip his coffee so loud and end each sip with the sound "aah". I understand that it's how he likes to enjoy his coffee. That's perfectly fine, but for me that sipping was annoying and disturbing.

So in my view, if you want to work effectively specially when you have to think, open cubicles are nothing but jail to your mind. If you think I am crazy, think of theses (http://www.guardian.co.uk/books/2009/sep/19/books-written-in-prison). These guys were in prison physically, but they had all the "space" in mind to think. No I am not suggesting to go to prison to work :D.

Anyway, another good video on "Why work doesn't happen at work", by Jason Fried from one the TED talks can be found from here (http://www.ted.com/talks/jason_fried_why_work_doesn_t_happen_at_work.html).

Great Feedback: MapReduce In Simple Terms

My presentation on MapReduce has received some great feedback via Pragmatic Integration. Isn't it really nice to see how somebody who you don't even know benefits from something you have?

WCF Hosting with IIS7

I started working with services in Windows world recently and got stuck pretty badly when I tried to host a WCF service in IIS 7. I was receiving errors no matter what solution I tried with Googling. All of them mentioned that I may not have installed ASP.NET properly, but I have installed it properly.

So I was clueless for a while, but luckily found this great article in WCF Tools team's blog, which mentioned that it may be because I installed Visual Studio prior to installing IIS. I did the simple command mentioned there and wow! it worked.

I will post a step-by-step guide in a later post on how to deploy your WCF Service in IIS7.

Hadoop: Writing Byte Output

Recently, I wanted to write the set of value bytes (only them; no key) from the Reduce task of a Hadoop MapReduce program. The signature of the reduce function looked like this.

public void reduce(Text text, Iterator<byteswritable> itr, OutputCollector<text,> output, Reporter reporter)


In the main method I used SequenceFileOutputFormat as the output format. But it turned out that this way I get output as a SequenceFile, which I cannot later read by a separate Java program to extract out the values. May be I am wrong here, but as far as my searching went on, I couldn't find a way to easily do this.

After being fed up with searching I thought of writing a custom FileOutputFormat just to suit my job. So I wrote this ByteOutputFormat class, which simply writes the value bytes as a binary file. So later I can read it using a normal (non Hadoop aware) Java program to extract the bytes.


import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.DefaultCodec;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.RecordWriter;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.util.Progressable;
import org.apache.hadoop.util.ReflectionUtils;

import java.io.DataOutputStream;
import java.io.IOException;

/**
* @author Saliya Ekanayake
*/
public class ByteOutputFormat<K, V> extends FileOutputFormat {
protected static class ByteRecordWriter<K, V> implements RecordWriter<K, V> {
private DataOutputStream out;

public ByteRecordWriter(DataOutputStream out) {
this.out = out;
}

public void write(K key, V value) throws IOException {
boolean nullValue = value == null || value instanceof NullWritable;
if (!nullValue) {
BytesWritable bw = (BytesWritable) value;
out.write(bw.get(), 0, bw.getSize());
}
}

public synchronized void close(Reporter reporter) throws IOException {
out.close();
}
}

@Override
public RecordWriter<K, V> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress)
throws IOException {
if (!getCompressOutput(job)) {
Path file = FileOutputFormat.getTaskOutputPath(job, name);
FileSystem fs = file.getFileSystem(job);
FSDataOutputStream fileOut = fs.create(file, progress);
return new ByteRecordWriter<K, V>(fileOut);
} else {
Class codecClass = getOutputCompressorClass(job, DefaultCodec.class);
CompressionCodec codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, job);
Path file = FileOutputFormat.getTaskOutputPath(job, name + codec.getDefaultExtension());
FileSystem fs = file.getFileSystem(job);
FSDataOutputStream fileOut = fs.create(file, progress);
return new ByteRecordWriter<K, V>(new DataOutputStream(codec.createOutputStream(fileOut)));

}

}
}


Hope this would be helpful for you as well.

MapReduce: Explained Simply as The Story of Sam

Couple of days back I made a presentation I made to explain the concept of MapReduce simply. I have attached the slides here for anyone interested. Please note, this doesn't include animations. If you want to get a better feeling feel free to download the original version of this MapReduce presentation.

.NET Naming Conventions

A good place to learn about .NET naming conventions.

Command Line: Relaxing Colors

I have been using a color theme for the command line in both Windows and Ubuntu for sometime now and it has been really comfortable for the eyes. So if you feel tired or bored using the white on black try these.

Background Color: #3A4237 (in RGB this is 58,66,55)
Text Color: White

It will give you this feeling of a good old chalk board. Here's a screen capture of how it looks.

Sinhala Poems by My Wife

My wife, Kalani, has started a blog to post her Sinhala poems. It's nice to see her archive of poems are finally coming up online.

I am waiting to see the poem written for me :D

Synergy: Share Keyboard and Mouse

I wanted to use two computers running separate OSs, yet use the same keyboard and mouse. After searching a bit I found Synergy (http://synergy2.sourceforge.net/index.html). I should say it's one of the most easy-to-use software I have ever encountered. Here are the quick steps (you can read more on their user's guide).

1. Install Synergy on both machines.
2. Setup one machine as the server.
3. Add the machines left, right, top, and bottom of the server (if any).
4. Start synergy as client on those other machines.

That's it and it's working. Only thing is that all machines should be in the same network.

One cool thing is that clipboards of all machines are shared. So copy from one machine and paste in the other is possible. Also it enables you to activate screen saver on all machines at once.

Split View in Firefox

After being able to split the Eclipse windows, I felt the need to split Firefox. Luckily I came across this add-on called "Split Browser", which simply does this for you. It enables you to split tabs both horizontally and vertically. Here's a screenshot of this.

Split View in Eclipse

I really wanted the split view feature to be in Eclipse as with most of the other IDEs. In fact, Eclipse has this feature, but doesn't give a visible menu/tool option to do it. The simplest way is to drag the tab containing the source until you can see an arrow mark. Then it will split the view as soon as you let go of the mouse. Here's a nice video I found on how to do this.

http://addisu.taddese.com/blog/split-windowview-using-eclipse/

Here's a screenshot of how it looks.


FireFox Keyboard Shortcuts

Great! Now I can stop using mouse for the most part of browsing.

http://support.mozilla.com/en-US/kb/Keyboard+shortcuts

Internet Speed: Isn't this nice?

In Sri Lanka, I used to connect to Internet using dial-up connection before ADSL came in. Then I felt "wow! ADSL is fast". But today here in IU, I would say "WOW! what a speed". See the picture below to see why I say this.




Windows7: Desktop Icons: CTRL + Wheel

I wanted to change the size of the icons in Windows7 desktop as they were bit larger than I like. The solution was a simple one, though I had to do some Googling to find it out.

Just scroll the mouse wheel while pressing CTRL key. That's easy :). In fact, it can be used in many other places like in windows explorer to change the way how items are showed.

Windows7 and Ubuntu 9.10

I just wiped out my Dell Insipiron E1505 notebook and installed Windows7 Professional and Ubuntu 9.10. I had enough of the Windows XP Media Center Edition. I thought of moving to Ubuntu 9.10 as well, just feel the fun.

Unlike in the previous experience with Windows, the Windows 7 performs really well. Regarding Ubuntu, it's better than 9.04 (I was happy with 9.04 as well). The only funny thing is that I had to find drivers and manually install my ATI Raedon X1300 VGA for Windows7. Earlier I used to do this for Ubuntu installations :)

For the moment, these two OSs seems to be a great combination if you are planning to get the best of both worlds.

Pidgin: Unable to Connect to Yahoo

Pidgin was giving trouble when connecting to my Yahoo account since recently. Today I got to know that it's because of this (http://www.celticwolf.com/useful-information/faqs/26-pidgin-yahoo).

Then I wanted to install a latest version of pidgin on my Ubuntu 9.04. I tried the "how to" given in the official pidgin site (http://www.pidgin.im/download/ubuntu/), but it was unsuccessful. Then I came across these debs (http://linux.softpedia.com/progDownload/Pidgin-Download-6.html) which solved the issue.

Just a quick how-to:

1. Download the i386 (or amd 64) debs
2. Download the two DEB ALL debs
3. Use dpkg -i to install the debs. Start with libpurple-bin_2.6.3-1~getdeb1_all.deb.
Then libpurple0_2.6.3-1~getdeb1_i386.deb (or amd 64 one).
Now move ahead with pidgin-data_2.6.3-1~getdeb1_all.deb.
Next pidgin_2.6.3-1~getdeb1_i386.deb (or amd 64 one)

That's it! no more troubles with Yahoo ;)

Design Defect: Dell E1505

See what has happened to the paint and you can understand the defect. Dell, you really need to think more on the paint material :)

Functional Vs Relational

After sweating my brain over functional programming in Prof. Daniel Friedman's class over the past several weeks, I got the chance to play with relational programming with miniKanren.

It took me some time to adjust my brain to accept the difference. Finally, I told myself

"Going to the grocer and paying for what you got is functional programming, but going to the grocer and handing over 10$ asking to give whatever that fits is logic programming"

Just a thought :)

Identify Ports: Weird Holes in Your Laptop

Ever wondered what is the purpose of a weird shape hole in your laptop? I did and luckily I found this nice site (http://techplore.com/technology/know-your-connectors-ports-a-visual-guide/) with all the info I needed.

Internet Explorer 8: Replacement for Chrome

After installing Windows7 on my machine, I went on installing my usual set of software including Google Chrome. But, I wanted to test InternetExplorer 8, which is the default browser, as well. So why wait, I started using it. Wow! I have to admit that it's cooler than Chrome. Why I say this mostly because it has a nice set of customizable accelartors. Also so far it is reliable than Chrome in Windows7. Moreover, it's way better than IE 7, which I consider as a pretty bad version of IE.


Jython Web Service Framework

My friend, Heshan, has done an interesting work to provide a framework extension to Axis2 which enables Jython based Web services and clients. Read more on his article (http://www.ibm.com/developerworks/web/library/wa-jython/)

Record Scheme Sessions: Transcript

Ever wanted to save what you type in your Scheme interpreter? I wanted :). So after a small Google search I found these nice two commands.

To start recording type,
(transcript-on "filename")

To end recording type,
(transcript off)

That's it. Now your session is saved in the file given by you.

BGT: The Humble Peformer

I've been watching Britain Got Talent (BGT) for some time now and I've never come across a performer so humble like Eugene.

Really touching video, yet happy for his courage to come forward.

Running Matlab Remotely: ssh -X

I wanted to run Matlab by logging into the university account remotely from my machine. Everything went fine except for the graphics. Matlab started in no graphics mode.

After bit of a search I found the solution. You have to set the X11 forwarding in you ssh configuration file. Here's how to do it.

1. cd /etc/ssh
2. sudo vi ssh_config
3. uncomment the lines "ForwardAgent" and "ForwardX11". Set their values to "yes"
4. sudo vi sshd_config
5. uncomment "X11Forwarding" and set it value to "yes" as well.

that's it and you are good to go.

Type ssh -X username@domain

To test if everything works fine try running xclock once you log in. It should open up a graphical clock window.

Funny Infinite Loop with C#

What will happen when you run the following C# code? It's a never ending loop. Oh! really? yea, note the "Name" inside set method. I have used uppercase N. Now it will call setter recursively.

Interesting isn't it? :)


public class Person
{
private String name;
public String Name
{
set
{
System.Console.WriteLine("assigning wow");
Name = value;
}
}
}


public class Hello
{
static void Main()
{
Person person = new Person();
person.Name = "wow";
}
}

Scheme Way: Eclipse Plug-in

I thought of searching for an IDE for Scheme, after being bit lazy to learn Emacs. Lucky enough I found a nice plugin for Eclipse named SchemeWay. It took me a bit of time, however, to configure and set up the plug-in to work as I like.

If you are struggling to set it up (as I did) here are few steps to help you with.

1. Download Eclipse from http://www.eclipse.org/downloads/. I chose the classic version

2. Download SchemeWay update pack from

3. Unpack the UpdateSite-1.3.0.alpha7.zip and copy the stuff inside plugins and features folders to eclipse features and plugins folders.

4. Start Eclipse and go to Help --> Install New Software.

5. Click Add on the on the Install window you get. It will give you a small window with two text boxes.

6. Click Local next to the Name text box. Now you can browse to your extracted folder of the SchemeWay update pack.

7. After couple of Ok presses Eclipse will show that it found the SchemeWay plugin. Then go ahead and install it.

8. Once everything is done, you can switch to the Scheme perspective from Window --> Open Perspective --> Other --> Scheme

9. Next task is to set the Scheme interpreter. I use the free version of Chez Scheme (i.e. Petite). So I have to set my interpreter as an external interpreter. To do this click Scheme --> Select Interpreter --> External Interpreter.

10. Now you have to give the necessary parameters to the plug-in to start your interpreter. To do this click Window --> Preferences. It will show you the preference window. On the left hand side of it you can expand the Scheme configurations. Select the External Interpreter configurations from there and set the necessary parameters.

Great! now you are good to go. Just create a new project and add a new Scheme source file. Then once you are done with typing your code, you can load it to the interpreter using CTRL+SHIFT+L.

You can play around a bit and get use to many other key short cuts.

One thing to note: you will have to set the indentation for some definitions to suit your style. You can do this by going to the same scheme configuration from Window --> Preferences.

Ubuntu 9.04: Way better than 8.10

I have used Ubuntu since it's version 6.04 simply because I felt that it is easy to work with. Anyway, for me, the versions x.04 never gave a good impression. So I used to say "hey! if it's not a x.10 version then it's not what I like". Interestingly, I am finding it is hard to say with Ubuntu 9.04.

Here's a list of things I felt really cool with 9.04.

1. No configuration necessary for the ATI drivers. Yea I had a really fun time configuring stuff with 8.04, 7.10, and 6.10 (Um, I can't remember what I did with 6.04).

2. External display detection is really awesome. It can even arrange the displays in any order I like (e.g. external one on top of default one).

3. Intel wireless card works like a charm.

4. Easy configurations for printers; hmm, I should really admire this.

5. Reliable (so far). Didn't crash, didn't reboot with errors, and most interestingly hibernate seems to work better than in previous versions.

6. Improved graphics.

In summary, I am beginning to like x.04 s as well :)

Scheme: Trace Functions

I found this really useful command in Scheme which helps to trace the function calls, while playing around it.

Say you have define a function named func. Now if you want to trace how it works when you invoke it, just type this.

> (trace func)

The next time you invoke func you will see the trace of function calls.

GSoC and UoM: Who let the "sharks" out

"...University of Moratuwa in Sri Lanka continues to dominate the field with 22 students accepted."

Wow! am I not happy to see this line in the Internet? I truly am. As a former student of University of Moratuwa, Sri Lanka, I am really happy to see the continuous achievement of its student in Google Summer of Code. To think of the fact that I too was a contributor to this success, makes me happy even more.

Keep up the good work "sharks"

Running Scheme on Ubuntu 8.04

Just hitting "scheme" in the console does no good if you are in Ubuntu 8.04. A workaround is explained here (http://ubuntuforums.org/showthread.php?p=4868292)

Here's the solution in brief:

sudo sysctl -w vm.mmap_min_addr=0

Now run scheme

Last Day at WSO2

It has been nearly 14 months since I joined WSO2. Gosh! I feel I joined just yesterday and I strongly believe that it is the wonderful community at WSO2 which made it so pleasant. Today, the time has come to say good bye, yet I am wondering how. It is hard to let go of a place you like.

I am truely grateful to Dr. Sanjiva Weerawarana for giving me the opportunity to work at WSO2 and supporting me to prepare for my future endeavors. Mr. Ruwan Linton played an invaluable role as my team lead and gave the confidence to move forward. Mr. Asankha Perara too did the same prior to Ruwan. My heartiest thanks for you two. I would like to give my sincere gratitude to the rest of the WSO2 team as well for being very much supportive throughout this time.

WSO2 a place like no other!



Ubuntu: Resizing Partitions

"No space left on device": Damn, how did this happen?, I told my self. I am pretty sure that I gave enough space for my home partition to carry on with Maven builds at WSO2. Out of curiosity, I issued df -h to see the partitions. Gee, I have accidentally assigned the larger partition to / (root) and smaller one for the home. The only solution is to resize the partitions. After a while, I remembered the great tool that comes with Ubuntu distribution, i.e. gparted.

I booted my machine using an Ubuntu CD and ran gparted. I was very much pleased with its graphical view and was done with my problem in just minutes. Initially my paritions were like,

|------------home----------|--------------/ (root)---------------------------------------------|

After resizing it looked like,

|----------------home----------------------------------------|----------------/ (root)---------|

I was pretty happy with this little tool since it saved me from one hell of a trouble.

Marriage: A Step Forward

Kalani and I got married on 29th May 2009 after being in love with for nearly five years.



Flash Demo: WSO2 ESB, Mashup Server

WSO2 ESB is a feature rich light weight Enterprise Service Bus. If you are new to what it has to offer, just see the 4 minute flash demo.

WSO2 Mashup Server is another cool product which let you instantly create mashups. See demo for this too.

11 Year Old to Shake the Floor: Aiden Davis

I was astonished to see this video of Aiden Davis performing on BGT 2009. I really liked George Sampson on last year BGT. Aiden simply is better than him in dancing. Wow! I was thrilled

Second Independence: A Day to Remember

LTTE brought terror for the last 30+ years in Sri Lanka. They claimed to represent Tamils, but it is a lie to protect their acts of violence. They gave no peace for the Tamils nor for Sri Lankans. The cowardly acts of suicide bombing, child soldiers, and killing of innocent civillians revealed us just one thing about LTTE, i.e. their hatred towards peace.

It is of great pleasure to hear that SL forces have put an end to all this terror by killing the leader of LTTE, the coward Velupillai Prabhakaran. This is the second independence day that we should celebrate.

All the blessings and thanks should go to the brave soldiers and the leader, the President Mahinda Rajapakha for giving hope which eventually became the reality.

Label Cloud

I just added a nice label cloud to my blog. Gosh! I now understand that I should have organized my labeling properly :)

Deploying WSO2 ESB in JBoss 5.0 GA

It is nice to users themselves trying out new things with WSO2 ESB. Now, Ramanathan has found the steps necessary to deploy WSO2 ESB in JBoss 5.0 GA. Here is the link to his blog entry (http://wso2.org/blog/ramanathan/5318)

WSO2 in Wikimapia

I just saw WSO2 Inc. in Wikimapia

IntelliJIDEA: A Feature I Like to See

Recently I was doing some tiresome debugging with Java using IntelliJIDEA. It was then that I thought that there is a great improvement we can do. This is totally my imagination, so I am not sure on any implementations in the Internet (yet).

The IDEA enables you to put debug points. These debug points may serve in creating a virtual path to traverse through the code. Thus, you are able to quickly jump to the next important point of code by just hitting F9. All this works really well for your debugging scenario. Now, what if you want to debug a different scenario, yet do not want to remove the older debug points? Then you have no option other than to add any new break points for the new scenario along with the older break points. This works okay, but makes the life bit hard since F9 will jump to points which are useless for the new scenario.

So what I suggest is to have a mechanism to define break points separately for each debugging scenario. So when you place a break point you can give it a scenario ID and inform the debugger to follow the break points for the relevant ID. It will be like layers that you find in Adobe Photoshop. You can on/off layers. Similarly we can deactivate a set of debug points based on their ID.

I wonder what JetBrains would think about this :)

Huawei E160 on Ubuntu 8.04

Recently, I subscribed to a 3G Internet connection provided by Mobitel. The modem I purchased is Huawei E160. Just like the most other plug-n-play devices this gadget did not include drivers for Ubuntu :). Anyway, I decided to give a try to set it up and voila! it worked.

E160 has two modes of operation. It can act as a GSM modem and a data storage. So when you plug it in under Ubuntu it will attach it under one of these modes. If your network manager is older than version 0.97 then you it will normally get attached as a data storage device. You can see info on this by reading the kernel ring buffer with dmesg -c command (you will need root privileges, i.e. sudo dmesg -c). If it get attached as an storage device use usb_modeswitch to change its mode to a GSM modem.

If everything went well then the rest is pretty easy. You will need to install wvdial (i.e. sudo apt-get install wvdial). Then edit the /etc/wvdial.conf file to include the following settings. Note: these are valid only with Mobitel M3 service in Sri Lanka. You may have to change some settings depending on your service prvoider.

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 3600000
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2
Init3 =
Area Code =
Phone = *99#
Username = ppp
Password = ppp
Ask Password = 0
Dial Command = ATDT
Stupid Mode = 1
Compuserve = 0
Force Address =
Idle Seconds = 0
DialMessage1 =
DialMessage2 =
ISDN = 0
Auto DNS = 1


Now execute sudo wvdial and that's it. You are ready to go online with E160 :D

Unlock Toyota Corolla 141

On the eve of the Sinahala New Year, I was with my parents in our village. All the members of my mother's family were there to enjoy the occassion. Everything went fine until I accidently locked the car while the key was inside. The situation got worse when we found out that the extra key was inside the car as well. 

After trying out things in "Gone in 60 Seconds" I realized that they were not going to work. One of my relatives, however, found the dust hole cap of the driver's seat and tried to push the carpet hoping to create an entrance into the car. Aha! luck strucked, the carpet elevated the trunk opener and trunk popped. We were, yet, no way near to any of the keys in the car. Then I thought I could slide my hand through the joint of the back seat to grab the extra key. Oh! boy it was hard. So left with no hope, we searched for other ways to get in. 

The elder son of my aunt, however, was able to slide his hand without getting stucked and finally was able to grab the extra key, which was on the back seat. So much fun for the New Year :)

So here are few tips to avoid yourself getting into this situation.

1. Keep the extra key at home
2. Check the key before locking the car
3. If your key has a tag number keep it written in your pocket (this number can be used to cut an extra key for your car from the dealer)

Now the bottom line is that things in your trunk are not safe since it can easily be popped ;)

New Year Drink: Mango

Just before the Sinhala New Year I got the chance to taste a raw mango with salt and pepper. If you have not tried this before then my advice is do it today itself. Yep, the taste is awesome :)

Anyway, while eating I wanted something to drink as well. Um, so why not try a mango drink, I felt. 

What you need:
1. A raw mango (gira amba, rata amba, pol amba) except for karthakolomban
2. A mug (yea, who wants to get satisfied with just a cup of water) of water
3. Two table spoons of sugar (depends on your likeness)
4. Salt (very little)

How to:
1. Clean and peel the mango
2. Slice the peeled mango into small sections
3. Put the mango pieces into a blender and add water
4. Blend the mixture till you get a nice light greenish color
5. Filter the final mixuture to a jug and add sugar and salt as you like
6. Add two ice cubes and drink it.

Enjoy the drink while you wait for the New Year !

3G Experience with Mobitel M3: Huawei E 160

After relocating ourselves back to the village, I missed the luxury of Sri Lanka Telecom's (SLT) ADSL broadband connection. CDMA was the saviour till yesterday. Suntel, thogh charge a little bit than other providers, gave a fairly good connection (note: fairly good is w.r.t. the available connection speeds in Sri Lanka). 

Anyway, the need for a high speed connection grew pretty quickly. I tried Dialog, but it seems they do not have the 3G coverage out here. Taking bit of a risk, I decided to purchase a Mobitel connection. Honestly, their customer service was great. The only thing I did not like is the vendor locking of the 3G modem. I mean, the modem is from Huawei, so why do they want it to be locked only for Mobitel SIMs?

Regardless, of the vendor locking the connection was satisfactory with 3.6Mbps. I had to purchase a separate antenna for better reception, yet it is worth the price.

WSO2 Carbon: Feature Packs

I just realized the flexibility of WSO2 Carbon when I tried to install Business Process capability into WSO2 ESB, which is based on WSO2 Carbon.

Simply extracting and copying the bundles in the feature pack does the job. Try it out at http://wso2.org/downloads/carbon/feature_packs

Sri Lanka and GSoC

Sri Lankan students gave a huge impact on Google Summer of Code 2008. This is a video by ICTA on that where my good friend Heshan and others giving out there idea on GSoC.

Java Regex: Check for non word characters

I wanted to test a given string to see if it contains any non word characters in Java. Initially I came up with a lengthy version ;) Then after a bit of search I could simply shorten it.

Version1: regular expression

"\\p{Alnum}*[~!@#$%^&*()\\+=\\-:;<>\\s?\\[\\]{},/\\\\\"]+\\p{Alnum}*"

Version2: regular expression

"\\p{Alnum}*\\W+\\p{Alnum}*"

Here's a nice guide (http://java.sun.com/docs/books/tutorial/essential/regex/index.html) to start with Java regular expressions

Java Threads and Concurrency

The Sun's tutorial (http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html) on concurrency with Java is a great place to start with multi-threading.

Have fun with threads :)

Batch Resize Images

I was searching for a tool to scale images batch wise in Ubuntu and it seems that ImageMagick is just the one for it. Here's how you can get it working as well.

Step1: install ImageMagick

$ sudo apt-get install imagemagick

Step2: go to the images folder and type

$ mogrify -sample 1280 x 800 *.JPG

Here 1280 x 800 is the final size you want and *.JPG is the file set.

To get more info on command options, visit http://linuxuser32.wordpress.com/2007/06/16/batch-image-convert-scale-thumbnail-jpegs-pdf/

Playing with BlueProximity

I recently came across this nice blog which had a post on locking the screen automatically. Anyway after seeing the comments I found it will be interesting to use Bluetooth to achieve this. I wanted to write some script on my own to get it done. Anyway as an initial step I tried BlueProximity which comes with Ubuntu. Here is a list of steps to get everything working.

1. Install blueproximity:
$ sudo apt-get install blueproximity

2. Pair up your computer with your phone using Bluetooth. You can use System -> Preferences -> Bluetooth to do so.

3. start blueproximity:
$ blueproximity &

You will see the blueproximity icon appearing on your system panel.

4. Configure blueproximity to suit your likings, i.e. the distance after which your screen will get locked, time duration, etc.

That's it.

Anyway it is not kicking unless I can write my own code :D

Lectures at UoM

I started lecturing Data Structures and Algorithms to Level 2 students of the Dept. of Computer Science and Engineering, University of Moratuwa, Sri Lanka. Overall, it is a great experience and I really enjoy it. The bottom line that I understand is that it is only when you start teaching that you understand that you have to learn more ;)

Build Your Own SOA Middleware

If what comes out of the box does not suit your way of SOA requirements then try out WSO2 Carbon. The ebook (http://wso2.org/project/carbon/making_good_soa_great.pdf) says it all.

Beautiful Sri Lanka

Access Vista from Ubuntu

Ever tried accessing a shared folder in Vista from Ubuntu? Here are the simple step I followed.

For this example say your Vista user account is vista-pc and password is vista-pw. Also say the IP is 192.168.1.2

----Do the following in your Vista machine----
1. Start/Run secpol.msc
2. Open Local Policies/Security Options, find "Network Security: LAN Manager"
3. Change it to "Send LM & NTLM"
4. share the folder that you want (say movies)

---Do the following in your Ubuntu machine---
1. sudo apt-get install smbfs
2. sudo apt-get install smbclient
3. sudo mkdir /mnt/hd
4. sudo mount -t smbfs -o username=vista-pc,password=vista-pw //192.168.1.2/movies /mnt/hd

That's it :) You can now access the shared Vista folder from /mnt/hd

Increase Java Heap Memory for Maven

If you ever encounter an error saying Java heap is not enough, while building a project using Maven, the following content will help to get out of it. Thanks Charitha for finding this.

Set the MAVEN_OPTS system property,

e.g. MAVEN_OPTS=-Xmx1024m  will give you 1024 Mb heap

NBQSA Merit Award for Rampart2

Sameera, Kalani, Isuru and I developed a Web services security module for the well known Apache Axi2 middleware. The existing security module, Rampart, has issues concerning performance. Therefore, our solution mainly focused on high performance. We used the code name Rampart2 to refer our project, though it is not part of Apache yet. The performance comparison of Rampart and Rampart2 can be found here.

BCSLanka organizes a competition named National Best Quality Software each year. Rampart2 got selected and was given a merit award in this year's competition. 

We are happy with our achievement and are waiting for more good news on Rampart2.

Hard Times

I broke my spectacles and got a new pair from George Gooneratne Optometrists. Guess what? They have taken wrong measurements and I had to visit them again to replace the glasses with correct measurements. After spending about two hours at their lab I finally got my sparkling shiny spectacles. 

 

The day after I was playing basket ball at WSO2 when I got hit by the ball right on my face at a most unexpected time. I was actually catching my breath and I look up only to see something crashing on to me. The shiny new spectacles were broken into pieces and my nose got wounded. The wounds were not that serious and I was lucky not to bleed internally. I found the broken frame of my spectacles and thought, hey that's not too bad because I still have the frame to which I can get a pair of glasses fixed. I put all the pieces into my bag and came home. The next day I was getting ready to go and get new glasses fixed. I collected broken frame and believe me, one side arm was missing. What the hell? I told myself. I searched every possible place I could look into but came up with nothing. Hmm, that's life, I thought and went to optometrist and get a new spectacle fixed. 

 

The next day I was happy with my new spectacles and spent the day peacefully at WSO2. The entire day I was in a meeting and later in the evening I and the others were invited to dinner at an Indian restaurant. The food was okay, but it didn't sound right for me. The next morning I woke up to find that I am suffering from a very bad stomach ache. I spent the entire day at home unable to do anything. The medication came to effect only in the evening. Today is the second day of the very unpleasant "Digesting Error", and there is yet another day to go to end the week. I am expecting what next :)

Google Chrome - Fast and Elegant

I had couple of issues with IE and FF3 in Windows and I decided to give it a try with the Buzz: Google Chrome. Amazingly, it's pretty fast than I expected. The next thing I like about chrome is it's simplicity, no stupid buttons hanging all over your browser :). 

I like the concept of having processes for each tab. I am wondering that browser technology is going to be much like the OSs. I mean the comic book is filled with many OS concepts I have learnt :). 

Kudos to Chrome !!

Java Strings: literal.equals(param) OR param.equals(literal)

Comparing strings is bit tricky :) Say for an example you want to test a String reference against the literal "hello". In simple terms you have a String (say helloStr) and you want to see if the content of that is equals to "hello". You have two choices here,

1. helloStr.equals("hello")

2. "hello".equals(helloStr)

Both will do fine, but which is the better one? I've been using the second form but never thought of the difference (hmm, that's bad ;) anyway people do remember certain things bit later). In one of the code reviews at WSO2 it was revealed. The first form can lead to a Null pointer exception in the case when the helloStr is null. The second option will save you from this since the literal "hello" is not null always and you are invoking a method of a not null object. In this case even if the helloStr is actually null it doesn't matter because it'll only cause the program to check "hello" against null which results false.

If you are checking two String references then you have no option, but always try to invoke the equals() from the most probably not null reference.

Little things do matter :)

Setup Browser in Pidgin

After installing FF2 because I was fed up with FF3 I had to setup the default browser in Thunderbird (see my previous post). I was happy after that but today I found that I cannot open any links from Pidgin messenger as well. Argh! I was unhappy again :-/

Fixing this issue, however, was pretty much easy ;) Open Pidgin, go to Tools --> Preferences --> Network. Then you can find a button saying Configure Browser. You'll get a tool window where you can set the command you want to execute in order to open up the browser. In my case FF2 can be started by issuing firefox-2 %s

Just that. It works fine :)

Apache TCP Monitor - How To?

If you are searching for a tool to monitor messages that are exchanged between a client and a server, then Apache TCPMon is one of the best easy-to-use utilities available at zero cost. You can download three different flavors of this utility, i.e. standalone, IntelliJIDEA plug-in, and Eclipse plug-in. To get an in depth knowledge on how to use this nice tool see my blog post at wso2.org.

The following blog posts too give an insight into this tool.

http://charithaka.blogspot.com/2008/08/how-to-use-tcpmon-inside-eclipse.html
http://www.keith-chapman.org/2008/07/using-tcp-monitor-to-debug-web-service.html

Internet in Two Machines

I wanted to get the Internet connection to my notebook. The Internet facility is given by a CDMA service. So it's one machine only thing. That's bad because I need it to be given to two machines. Luckily I found this nice way of doing it from Dr. Sanjiva's blog. I'll try to find a pocket router similar to the one he has used and give it a go soon.

Anyway if you want to know about how to setup IP forwarding see the following links.

http://www.ducea.com/2006/08/01/how-to-enable-ip-forwarding-in-linux/
http://www.linuxforums.org/forum/linux-networking/64083-simple-ip-forwarding.html

Default Browser Settings in Thunderbird

I wanted to remove FF3 (Firefox 3) and install FF2 in Ubuntu because some of the web applications didn't work well in FF3. After doing a apt-get remove for FF3 and an apt-get install for FF2 I noticed that in Thunderbird when clicked on a link in a mail, will not open up a browser tab. So the hunt began :)

The solution was to tell Thunderbird the path of the browser to open. You need to create user.js file inside your ~/.mozilla-thunderbird/xxx.default/ (the xxx means any weird set of letters and numbers, e.g. 20art4c7). Type (or edit the path as to suit your browser) the following lines into that file and save it.

user_pref("network.protocol-handler.app.ftp","/usr/bin/firefox-2");
user_pref("network.protocol-handler.app.http","/usr/bin/firefox-2");
user_pref("network.protocol-handler.app.https","/usr/bin/firefox-2");

That's it :)

XPath with Axiom

Apache Axiom, which is the popular open source StAX based XML infoset model, supports XPath out of the box. If you ever want to know how to use this feature, WSO2 Oxygentank has a very nice tutorial.

The tricky part is, how to work with Namespaces? To get an idea on to the matter consider the following XML document.



The following code fragment will retrieve the ns1:c1 element and the two ns2:color attributes of each element.

// root is the document
OMElement root = builder.getDocumentElement();

AXIOMXPath xpath = new AXIOMXPath("//a:c1");
xpath.addNamespace("a", "http://namespace1.com");
OMElement c1 = (OMElement)xpath.selectSingleNode(root);
System.out.println(c1);

xpath = new AXIOMXPath("//@b:color");
xpath.addNamespace("b", "http://namespace2.com");
List colors = xpath.selectNodes(root);
System.out.println(colors.get(0).getAttributeValue());
System.out.println(colors.get(1).getAttributeValue());

The important line in this code is the xpath.addNamespace(prefix, uri) method. This prefix doesn't have to be the exact prefix used in the actual document (which in fact is not known in most cases).

That's it, have fun with Axiom :)

ATI X1300 with Ubuntu 8.04 (Hardy)

In one of my previous posts I mentioned how to setup ATI X1300 graphics card in Ubuntu Gusty. Recently I installed Ubuntu Hardy because Gusty came up with couple of bugs. Unfortunately I had to set up my graphics card again :(

So I tried with the Unofficial ATI Wiki and it worked just as expected. Try method 2 mentioned here.

The great news is hibernation works with it :)

Convert ByteArrayInputStream to String

Recently one of my friends wanted to get the string contained in a ByteArrayInputStream in Java. The method do this was bit tricky and I thought it'd be nice to share it.

ByteArrayInputStream bais = // get your ByteArrayInputStream instance

int length = bais.available();
byte [] buff = new byte[length];
bais.read(buff);

That's it!!

@ WSO2, Inc.

The university life ended last Wednesday (7th May) and it was time to move into my first job in life :)

I joined WSO2 Inc. on 12th May and it has been few busy days until today :). I am waiting for some build to complete and thought to jump in and blog on this.

I feel life has changed a bit compared with the life at the university, yet it is the same old me sitting in front of the computer :)

Repair Sony VAIO VGN FE855E Keyboard

My girlfriend's notebook was "attacked" by ants recently. This is the famous attack of eating the rubber membrane of the keyboard. They have eaten the contact material of the rubber button and several keys were not working after that. The following picture gives you the model number of the notebook.




I searched for keyboard replacements and found that they are expensive (Sony service require 169$ to replace a keyboard). There are refurbished keyboards available in e-bay for prices around 70$, but I couldn't get one since I live in Sri Lanka. The price and tax is too much if I deliver something from US. So I gave a go by myself. Bottom line is I fixed all the keys for a price just around 1$ (one dollar :)

I thought of giving the steps I followed in case if some one else is in trouble like me.

Step 1: Identify the not working keys.

You can simply use a text pad to type the keys and identify the ones that doesn't work. To test function keys you can do many things. The easiest thing I did was to run a program in command line and then to press function keys in the same shell (note you should not run the particular program you chose as a background process). There each time you press a function key some kind of symbols appear. So you can see if it works or not. See this is a very primitive way but it works.

Step 2: Removing the plastic plate of the key

In notebook keyboards the plastic key plate is clipped to an underlying plastic support mechanism. See the following picture (the bad key in this case is F11)





Use a small flat screw driver to lift the plastic plate from top left corner and bottom left corner. Note: If you are trying to remove normal keys (like A, B, etc.) then you need to lift from bottom left and bottom right corners of the key plate. Once removed you can see it as follows.




Step 3: Removing the plastic hinges

You can use the same screw driver to remove the white plastic hinges. See IraqiGeek's blog to see more information. One advice is that don't force too much on these small plastic items as they tend to break easily. Once removed you will see something similar to the pictures given below.




Step 4: Peeling off the rubber button

The next step is removing the rubber button. It is little bit hard and needs lots of patience. The rubber button is fixed to the same plastic sheet which contains the touch points. So it is virtually irreplaceable :). The option I selected was to cut off the rubber button. You need a sharp blade to do this. I used a razor blade. Once again, be careful when you cut because a single mistake could damage the underlying carbon contact lines, leaving no option other than to replace the entire keyboard. Once you cut it off you can see it as follows (the second image shows another bad key, i.e. Esc key).




Step 5: Finding a replacement rubber button

If you can get away with this step then you are basically done with repairing. If you see the two images above you can clearly see the carbon touch plats (see the thin white "s" shape in the place where the rubber button is taken off. That is the margin separating the two carbon plates). The keyboard simply works if you can somehow find a button which will contact these two plates when pressed. There are numerous solutions you can find in day to day stuff which can be used as a replacement. The one I found was a simple push button. You can easily find a similar type of thing any electronic parts seller. See the images given below.




The first image shows the small switch I found and the next one shows the rubber button of it removed. You can remove it simply by pulling off gently from the sides of the rubber button (Note: be careful not to tear it off). The third one shows the underside of the rubber button and you can clearly see the carbon dot in it. This is the one which get pressed on to the carbon plates of the keyboard. The side view of this button is given below (in fact this is the same side view of the original notebook's rubber button as well).


The replacement button I found had this problem that the distance of pressing is smaller than that is of the original button. So when you fix the key plate it acts much like a touch button. I didn't like that feeling. So I simply shorten the rubber cylinder by removing a part of it and gluing the two parts. This is though seems simple requires a lot of patience. So drink lot of water before you do this :D and take a deep breath. Ah! one thing I forgot to tell was that not all type of glues can be used to bond rubber. So better to find a super glue which can bond rubber. In my case I found a cheap Indian made super glue (I think the name was Evlico or something like that).

Once you adjust the pressing distance and the button is ready to go you need to one more thing. The rubber button used here acts as a vacuum when pressed and sticks to the key board's plastic sheet. So I made two tiny holes symmetrically. That way it becomes very easy to press and feels much like the original button. See the images given below. I think you can see the tiny holes.




Step 6: Replacing the key plate

First replace the plastic hinges. I think you can do it by yourself. The advice here is don't push too much if the thing isn't attaching. You may probably trying to fit it wrongly. Then place the key plate on top of the rubber button and gently push from four corners (you can hear the "tick" sound as you press which indicates the correct fitting of the plate).

This completes the repair and following is a list of additional rubber button replacements you can use.

1. The calculator touch pads have a nice a rubber membrane with touch switches similar to the one I used.

2. TV / VCR remote controllers too have nice rubber buttons inside.

3. There are various types of rubber push buttons available in the market. So better to find a similar one that suits your machine.


If you have any doubt on the matter just drop a reply to this post.






How to Access Linux (Ext2) Partitions from Windows OS

I've been using Explore2fs for sometime to access my Linux partition from Windows OS. But it was very boring to copy files from Ext2 partition all the time when I wanted to access them. So I decided to search for a better option. So here it is, Ext2 installable file system. It's very cool. You can even write to Ext2 partition. Here is the good article where I found these stuff.

60th Independence Day

Today is the 60th independence day of Sri Lanka.

My Woodwork

I wanted to add an extension to my desk so that I can keep my laptop on that. The laptop when put on the desk forms a very bad position. It's basically not ergonomic. So I decided to do bit of carpentry and the result was amazing. I really like it. The finished work is shown in the picture.

Google Pages

Google always come up with cool ideas. This is not boasting but they really do. I recently came across this idea of Google pages. I was searching for a place to share some of my files with others. It's then I found this and it was more than a place to share files. I gave it a try and here is my hOme up and running :)

Brain and Your Fist

This is some nice fact I've noticed but it may not mean anything. Have you seen a diagram of the brain from side view? I guess you probably have. Now try to keep your fingers in the right hand as if you are going for a fight (fisted). Then see your fist from side view. You will see a similar shape to that of brain. Isn't that interesting?

ATI x1300 with Ubuntu Gusty (7.10)

Ah! I had to give another fight to get my x1300 ATI card working properly with Ubuntu Gusty. The restricted driver that comes by default would correct the wide screen problem but video quality is changed. You will find lot of illuminant people while watching a film in totem.

So here goes the answer

Good luck and have fun :)

Something to Remember

It's great to remember sweet moments in our past. But I never thought it would be as sweet as this.

Big hug my dear for this lovely creation.

Ubuntu 7.10 on DELL E1505 Notebook

I installed Ubuntu (Gusty Gibbon) on my Dell notebook and I felt the beauty of it from the very beginning.

The two most interesting features I see:
1. Read/Write facility to NTFS (Windows) partitions
2. Easy configuration of restricted drivers (no need to worry about setting up your ATI video card :)

Perceptron in Java

I'm following Neural Networks class for my final year and I felt it's a cool subject. I'm still a newbie in this field. But I gave a try to implement a simple perceptron to train few logic gates. It was a cool experience.

HUAWEI ETS 2251 with Ubuntu 6.10

We recently purchased a CDMA data phone and I wanted to connect to the Internet with Linux (Ubuntu 6.10). Try the following steps:

1. plug-in the USB cable (your cable should be Serial (phone side) to USB one).
2. sudo dmesg -c

you should see the following at the bottom

ti_usb_3410_5052 2-1:2.0: TI USB 3410 1 port adapter converter detected

if you see ti_usb_3410_5052: probe of 1-1:1.0 failed with error -5 after the above line then copy the following lines,

#TI USB 3410

SUBSYSTEM=="usb_device" ACTION=="add" SYSFS{idVendor}=="0451",SYSFS{idProduct}=="3410" \

SYSFS{bNumConfigurations}=="2" \

SYSFS{bConfigurationValue}=="1" \

RUN+="/bin/sh -c 'echo 2 > /sys%p/device/bConfigurationValue'"


and save them as /etc/udev/rules.d/026_ti_usb_3410.rules


Now run sudo dmesg -c again and you'll see the following two lines,

ti_usb_3410_5052 1-1:2.0: TI USB 3410 1 port adapter converter detected
usb 1-1: TI USB 3410 1 port adapter converter now attached to /dev/ttyUSB0



3. Now configure the /etc/wvdial.conf as follows, please note that you need to replace your given username, password and phone number with my configuration (abc@prepaid, 1234, #777) given here.


[Dialer suntel]

Modem = /dev/ttyUSB0

Baud = 230400

Phone = #777

Init1 = ATZ

Stupid Mode = 1

Dial Command = ATDT

Username = abc@prepaid

Password = 1234


4. Now type sudo wvdial suntel and enjoy the Internet. If you can't browse then plese add the DNS addresses to /etc/resolv.conf (these DNS addresses can be found in the command line while connecting).

Thanks Farhan Naeem for sharing knowledge on this matter


The Notebook

If a film can touch someone's heart so deeply, The Notebook did it.

TMNT Two Thumbs Up!!

I loved watching Teenage Mutant Ninja Turtles cartoon when I was a little kid and now I got hand on the movie. I really like it, two thumbs up TMNT!!

Advanced OS Paper - Nightmare

Oh! boy, today we had our Advanced Operating Systems paper. It was one hello of a paper.

Anyway may be things happen for good. That's all I know :)

Sri Lanka Telecom ADSL Service Sucks

I and my roommate took an ADSL Internet connection to the boarding from Sri Lanka Telecom. It was great in the first few months. But now it sucks. We bought the package which advertises 512Kbit/s (kilo bits per second) down load speed and 128Kbit/s upload speed. But the damn thing won't support even 100Kbit/s download speed. Damn, that sucks.

The most funny thing is that their customer service guy came and inspect the system and said that he feels it's normal. Can you believe it? He even says if we don't like it then we better disconnect it. Yea that's what we wanted as a solution, yikes.

Mailing list is much like Instant Messaging

Google announce that code submission for GSOC 2007 is available few minutes before. The student's mailing list got fired with the news :) Everybody (including myself) was posting questions telling that link for the submission doesn't work. Oh! Leslie (at google) must have had a nightmare replying to those emails and we really appreciate your kind and speedy responses.

The mailing list became like a chat room with mails flying within seconds :)

PyDev - Python Development Plug-in for Eclipse

Oh! yes, I'm loving this Eclipse! Now I can use it to develop python programs. Use pydev plug-in and you can really give a go with it :) Here is a nice tutorial explaining step by step on how to use the plug-in.

Tip for Linux users: When you go to configure the python interpreter use /usr/bin/python (the tutorial explains only for Windows users )

Fire on Ice

Is it a miracle that I'm going to talk about? No, it came to life on 17th July 2007 at CS&ES (Computer Science & Engineering Society) AGM (Anual General Meeting).

I was asked to display fire on a block of ice for the AGM. Yea, I did it at the end and it was better than expected. The simple theory behind was burning Trimethylbenzene (a.k.a. paint thinner) on top of ice. Hmm, it's easy to say than do. There were several challenges to face, i.e. what happens when ice melt down due to heat, how to stop spreading fire, how to ignite thinner automatically, how to make an ice cube with a carving to fill thinner, etc. Oh! boy it was a night mare to think all of this.

I tried with few prototypes and they all worked fine. The most interesting part was the igniter. I used two clutch pencil leads touching together with applied voltage of 12V to ignite a match stick. I created a simple stand to hold the thing (unfortunately it was burnt with the fire before I could take a picture) so that giving the power would do the job.

I'm greatly disappointed because no one had taken a picture of the burning ice. Anyway it was a great experience and I'm really happy with the success.

I need to mention few of my friends who helped me to make it a success. They are Rajika (one big thank to this guy), Dinesh (it was his idea to burn ice), Charith, Malaka and Tharindu (they helped me with the final touches).

Fibonacci Calculator in Visual C++

#include "stdafx.h"
#include

using namespace std;

int calculate_fibonacci(int n);

int main(int argc, char* argv[])
{
int n;
cout << "Enter n: "; cin >> n;
cout << "Fibonacci of " << int="" b="1," bb="0," return="" else="" if="" n="="> 1) {
for (i = 1; i < result =" 0;" bb =" b;" b =" result;">

C plug-in for Eclipse - CDT

Ever thought of using an IDE in Linux to type C? For pure C guys this is not a problem because they have the nice little VI or VIM. Yea it's very true that you can do a great lot of things with VI. The only problem for me was that I used to do a lot with Java using Eclipse. So suddenly when I wanted to use C for one of my assignments I found it very difficult to adapt with it.

Little bit of googling came up with this wonderful tool, CDT. It's a plug-in for Eclipse and you can do a great lot of things with C with rich IDE features. Try this tutorial to learn about the plug-in.

Dr. D. A. I. Munidradasa has Passed Away

He was one of the great lecturers in the University of Moratuwa and it's my great condolence to mention that he has passed away today. He taught us the principles of Electronics and he showed his expertise throughout his teaching, yet he was a very kind teacher.

He left us with a blank which would hardly get filled in the near future. May you attain nibbana dear sir!

Innovative Tools

Did you ever think about automatic level tools. Hmm, Black and Decker has thought about it and has given this wonderful laser level, Bulls Eye. The demo is really cool. I also like their Handisaw. I've used several Black and Decker products (can opener, vacuum cleaner, iron and toaster) and all of them were of great quality. Hmm I wish I could buy one of those Handisaws from Sri Lanka :)

CSE Formula

The Department of Computer Science & Engineering organizes a toy car race each year for the new comers. The first year entrants to the department are grouped and given the task of creating a remote controlled (not RF controlled actually, hmm I wonder why it is ?) toy vehicle which is to be powered by a 12V DC power source. Eventual grading (not GPA) includes a test run of each vehicle on a track made with few obstacles.

This event is really cool. Bad thing I miss this chance since this event with the batch junior to us. Anyway I'm really interested in such events because I personally believe that students should have some skills to build things rather to design them in papers. Yet it is little bit pathetic to see the construction of vehicles of some groups. One student has tried to give the power of the motor directly to the wheel. I wonder why such situations arise because even they know that it is not the case in any toy. They need to use gear wheels. I hope things would get corrected with time as students begin to like the event.

Good work CSE :)

Ency

I have developed a little tool to embed text messages inside image files using Java called Ency. I'm really interested in this steganography and security stuff. Ency is in its primary stage. It needs more modifications to step into maturity. I found this nice link explaining about steganography while trying to improve Ency. Enjoy hidden messaging with Java ;-)

Google Summer of Code 2007

My proposal on implementing C14N based on Axiom for Google Summer of Code 2007 has been accepted. Wow! I really feel excited. Thanks specially for Ruchith Fernando for being the mentor of this project. Thanks for everyone else as well who thought to give a vote for the proposal.

ADSL is Up and Running

Ah! I was able to configure the ADSL router at last. The username and password provided by the ISP did not work. Can you believe it? I was astonished when I received the "authentication failed" error. The 24hr help center, however, gave me the clue to change the password. Luckily I had a dial-up connection as well. At last it worked. Gosh! what a fun it is to play with something new.

DVD to AVI

I was searching for a free and easy-to-use DVD to AVI converter today. Check this out. It is very impressive.

File Converter

I was searching for a simple tool to convert OpenOffice word documents to pdf. Then I found this site which simply converts files between a number of different formats. It even keep the file hosted for 24 hours free.