Saliya's Blogs

Mostly technical stuff with some interesting moments of life

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