November 27, 2011

Fixing ConcurrentModificationException

Here I am discussing the instances where, iterating over a collection throws the ConcurrentModificationException. As mentioned in the API documentation, the reason here is, "it is not generally permissible for one thread to modify a Collection while another thread is iterating over it."

Following is a code segment which can throw this exception.
Iterator itr = purchased_products.iterator();
while (itr.hasNext()) {
  if ( == product_id) {
    Purchase p =;

There are a number of different solutions provided in forums. Almost all of them are provided as tweaks to iteration which is already happening.If you need to keep using the iterator, solution here will not work.

This solution gives up the iterator. This is a simple code which we all have being through, but may have missed out for situation as this. I found this by referring the remove method in java.util.ArrayList.

for (int index = 0; index < size; index++)
  if (elementData[index] == null) {

As in the above code segment from remove(Object o) method, I too used a for loop to find the index of the item to be removed and then called upon the remove(int index) method to remove the element. This will not result in any such errors and is efficient than using iterator. But it will highly depend on your requirement.

So the revision for the above code segment given earlier would be as,
for (int index = 0; index < purchased_products.size(); index++) {
  if (product_id == purchased_products.get(index).getProduct_id()) {

November 23, 2011


"sqlfairy" is a pretty cool software which helps you in instantly visualizing any huge sql database, when all you have is it's schema.

You just have to do a quick installation with sudo apt-get install sqlfairy and you are all good to go.

Just refer some tutorials are available from :

November 21, 2011

Eclipse block comment problem

Eclipse by default formats the block comments when you save changes of a file. It is additional trouble when you need to uncomment.

To solve this problem,

  • Go to Windows->Preferences->Java->Code Style->Formatter->Edit->Comments 
  • Uncheck Enable block comment formatting
  • Click on Apply

November 20, 2011

Git Reference Sheet

Git Repository

It contains a set of 'commit objects' and 'heads' which are references to those commit objects. Commit objects are a set of files that reflect the state of project at any given time. They also include references to parent commit objects. Head is a reference to a commit object. a head has a name. By default, every repository has a head called "master". A repository can contain many heads but at any given time, one head is selected as the "current head" which is always named as "HEAD".

(In simple terms, HEAD is the current branch. But there are exceptions to this. Another definition is to refer to HEAD as a reference to the last commit in the current checked out branch.)


delete a remote branch
git push :mahee2

delete a branch

git branch -d mahee


Push is done when you want to push the work you have done upstream for sharing purposes.

General command is git push [remote-name] [branch-name]

If you want to push your master branch to origin server, run git push origin master

example : git push mahee

The real scene behind above commands are a little explanatory. when you give a command as git push origin mahee it means, to take the local branch named 'mahee' and push it to the remote 'mahee' branch. git push origin mahee:mahee does the same. (Take my local 'mahee' and make it remote 'mahee'). If it is a different branch in remote (e.g. test) just give the command as git push origin mahee:test

if above push doesn't work due to not having a common ancestor and you get the following error :-

! [rejected]        mahee -> mahee (non-fast-forward)
error: failed to push some refs to ''
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

Do force push using
git push --force
git push mahee --force (untested)

Actually force is not a very good option and is not encouraged. if a simple git pull and then pushing doesn't work, then you might have to use force.


to pull any new work since clone or last fetch

git fetch origin

here "origin" refers to the remote repository when a clone is taken. The fetch will pull all the data from the remote project which isn't currently available. after this fetch, references to all branches are available and it is possible to merge branches or inspect them at will. Fetch only pulls data to local repository. It does not do any merging or modification to current work. Those should be done manually.


git pull

If a branch is set to track a remote branch, you can use pull to automatically pull and merge a remote branch to the current branch.

When to fetch and when to pull?


git merge local mahee

merges local and mahee branches to local.

also, another method to do this merging is to checkout to local and then call on git merge mahee

Conflicting merge

git checkout branch1
git fetch origin branch2
git merge FETCH_HEAD

Auto-merging ......
CONFLICT (content): Merge conflict in ...........
Removing ..........
Auto-merging .........
CONFLICT (content): ..........
Automatic merge failed; fix conflicts and then commit the result.

when above output is received you can use a mergetool and perform merging in a little bit of a manual way.

git mergetool
merge tool candidates: opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse ecmerge p4merge araxis emerge vimdiff

Normal merge conflict for '....':
{local}: modified
{remote}: modified
Hit return to start merge resolution tool (kdiff3):

Normal merge conflict for '.........':
{local}: modified
{remote}: modified
Hit return to start merge resolution tool (kdiff3):


September 11, 2011

July 22, 2011

Regex matching any sign(.) + whitespace characters

To match any sign with a regex the following simple piece of code would work just fine.

Pattern pattern = Pattern.compile(".*"); //compile the pattern
Matcher marcher = pattern.matcher(string); //assign the string to be matched
matcher.find() //find whether the pattern exists. Returns a boolean

But, if you need to include whitespace characters, that is \n,\t, etc the '.' regex will not do the trick. (There is also "\s" regex which captures whitespace characters, but it didn't quite address my problem)

While wandering through the Java API I found a flag which addresses this problem. That is  DOTALL. It will include line terminators into the regex while compiling the pattern. Therefore the new code would be,

Pattern pattern = Pattern.compile(".*", Pattern.DOTALL); //compile the pattern with terminating characters
Matcher marcher = pattern.matcher(string); //assign the string to be matched
matcher.find() //find whether the pattern exists. Returns a boolean

Failed attempt :
  • Tried to include '\n' in the regex.
To specify any two types of characters in a regex usually it is as "[ab]*". Pattern  "[a\\n]*" also works fine. But for some reason "[.\\n]*" doesn't work. So above was the successful solution I found to deal with it.

For a very good tutorial on regex refer here.

  • Match period
    "." is the symbol used for any character. So if you want to match "." specifically, you need to define the regex as "\\."

June 8, 2011

Using EclipseFP for Haskell

Reference : 

May 20, 2011

Displaying Sinhala in JTextArea

When I first tried to display Sinhala characters in a JTextArea, I got the following result, where all the Sinhala letters were replaced by boxes.

Original text : තමා_PRP හයිටිය_NNPI අතහැර_VNF පලා_VNF ගියේ_VP කැමැත්තකින්

The reason for this is that, it does not render Sinhala fonts.It is not a problem with detection of encoding. You can simply check the system default encoding with code below.
This produced with UTF-8 encoding, which was ok for my requirement.

Now this meant, that the problem is in using an appropriate font for the JTextArea.
File fontFile = new File(fontpath); //load the font file
Font newFont = Font.createFont(Font.TRUETYPE_FONT, fontFile);
txtOutput.setFont(newFont); //set the font to JTextArea

The above code will add a font to a JTextArea. Out of the many fonts I tried, only "dinamina.ttf" rendered properly. Even lklug did not provide proper results (It only rendered Sinhala and English characters were not at all displayed). Following is the final output.

Download sinhala fonts from here

Updates :

  • Found our that lklug has only Sinhala fonts
  • Also Bhashitha is another font that worked fine with me
  • May 1, 2011

    for, while and do..while

    for, while and do..while are the three types of loops available for almost all imperative languages. But the concept is same for all of them and they only carry slight variations is syntax.

    One of the concerns when writing a loop is to identify which of the above three is most suitable. It is important if efficiency is an expectation of your program.

      //code here

      //code here

    for( i = 0; i < 10; i++){
      //code here

    while vs do..while
    The while and do..while loops both loop until a condition is false. But the difference between them is that the while loop will check the condition before the first iteration and the do..while will perform the first iteration and then after check the condition. Therefore the change is in the first iteration and after it is finished, there is no difference between the two loops.

    while vs for

    A common mis-use of the while loop is using a counter within it. That is use a counter to keep track of the number of iterations of the loop and making sure to exit the loop when the counter is exceeded.

    i = 0;
    while ( i < 5){
      //code here

    The purpose of the for loop is to be used in such situations.

    for ( int i = 0; i < 5; i++){
      //code here

    Therefore, the main difference between the two would be to use the for loop when the number of iterations is known and use the while or do..while when unknown. But there is no real difference in efficiency for a situation as above. Hence, I believe its more of de facto.

    April 25, 2011

    Working on your thesis with OpenOffice Writer

    I admit that open office writer is not as much as user friendly and resourceful as MSWord. But when you cannot use MSWord, I am going to tell you how to customize your headings, section breaks and page numbering.


    • Goto Tools->Outline Numbering ->Numbering
    • Select the paragraph style to whichever specify the before, after separators and the Number.
    • Do this for all heading styles.

    Page Numbering

    • Goto Insert->Footer->Default (Default will ignore the cover page)
    • Leave the cursor on the footer
    • Goto Insert->Fields->Page Number
    • Now format the footer as in alignment etc
    • If you want to change the numbering style,
    • Goto Format ->Styles and Formatting ->Page Styles
    • Select the footer and right click->Modify
    • In Page tab, the Layout settings has Format, which can be changed to customize the numbering

    Section Breaks

    April 14, 2011

    Ceylon Tea to replace Java coffee?

    I just came across a new project called "Ceylon Project", thanks to a tweet by @charithsoori. I couldn't find why it is called "Ceylon" though, I am curious to know.
    It has being a secret project for 2 years at RedHat and the first breifing of it has happened on last 9th at Beijing by Gaving King. A copy of the briefing presentation is available from here. I really didn't have time to go through what it is all about, but from what I read it seems to be a very revolutionary language and a challenge for Java. Gavin King has mentioned it as "The Ceylon Project - the next generation of Java language?" at his briefing. This is a good enough statement to give a little thought to as whether tea will replace coffee.

    The aim of the project has being to create a new programming language and SDK for business computing, to overcome the drawbacks of Java. When it is released it will run on the JVM itself. It seems to me as a little into functional programming. Any way hope I had more time to research on it and write a better post :|. The thing which interested me was the name. Why was it named "Ceylon"? Maybe I will be able to write about it some later time.

    සිංහලයාගේ හින්දු අළුත් අවුරුද්ද (ගෞතම සංදේශය 14)

    ජ්‍යෝතිෂය උපන් රට ඉන්දියාවයි. නමුත් එහි බමුණන් වත් සිංලහයන් තරම් ජ්‍යෝතිෂය අදහන්නේ නැත.

    ලංකාවේ බෞද්ධයන් වශෙයන් පෙනී සිටිනා අය සමඟ කතා බස් කළ විට පෙනන්නේ තිසරණය ගැන ඔවුන් තුළ කිසි විශ්වාසයක් නැති බවයි. ඔවුන් ලාභ ප්‍රයෝජන උදෙසා ඕනෑම වෙලාවක කිසි හිරිකිතයකින් තොරව බුදු දහම පාවා දෙන්නට සූදානම්ය. ඔවුන් තිසරණයට වඩා ජ්‍යෝතිෂය විශ්වාස කරන්නේත් කර්ම-කර්ම ඵලයන්ට වඩා නැකත විශ්වාස කරන්නේත් සාධාරණ කරුණු මතය.

    දැන් කාලයක් මුළුල්ලේ කේන්දරයටත් නැකතටත් අනුව කටයුතු කොට ඒ තුළින් ලත් සාර්ථකත්වය ලෝකයටම ඔප්පු කොට තිබේ. සිංහල ජනතාව මේ ලෝකය තුළ දියුණුවේ හිනිපෙත්තටම නැග්ගේ නැකතේ ආනුභාවෙයන් බව දැන් සියල්ලෝම දනිති. කොටින් ම ඇමරිකානු ජනාධිපතිවරයා පවා දැන් සිංහලයන්ගෙන් නැකැත් බලා ගන්නේලු. කේන්දරයේත් නැකතේත් ආනුභාවෙයන් දැන් මහා බලසම්පන්න සිංහල නායකත්වයක් බිහි වී තිබේ. දැන් රට තුළ කිසි ප්‍රශ්ණයක් නැත. ඒ තරම් ම සරුසාරය. ඔවුහු නැකතට කුඹුරු වපුරති. දැන් රට සහලින් ස්වයංපෝෂිතය. ඔවුහු නැකතට එළවළු පළතුරු වවති. දැන් ලෝකයටම එළවළු පළතුරු යවන්නේ ලංකාවෙනි. නැකතට කර්මාන්තශාලා අරඹති. ඒවා කොතරම් සරු ද යත් දැන් සියළු යාන වාහන ඉතා දියුණු මට්ටමින් නිෂ්පාදනය කෙරන්නේ ලංකාවේ ය. ඔවුහු නැකතට බැංකු විවෘත කරති. දැන් දුප්පත් රටවලට ණය දෙන්නේත් ලෝකයට ආධාර දෙන්නේත් ඒ නැකතේ ආනුභාවෙයන් දියුණු වූ බැංකු වලිනි. ලංකාවේ භික්ෂූන් වහන්සේලාත් අතිශයින්ම සිල්වත් ය. ගුණවත් ය. ධර්ම විනය පිළිබඳව අංග සම්පූර්ණ බහුශ්‍රැත බවකින් යුක්තය. ඔවුන් ධර්මය හැටියට පවසන්නේ ශ්‍රී සද්ධර්මයම පමණි. ඔවුන්ගේ මේ සා ආනුභාවයේ රහස කිම? ඒ වෙන කිසිවක් නොව නැකතට මහණ කිරීම නිසාය. දැන් දේශපාලකයෝ පවා සාමය ස්ථාපිත කිරීමට නැකතට පහන් පත්තු කරති.

    දැන් බොහෝ දෙනක් මත්පැන් බොන්නේ ත් නැකතටලු ය. නොහොඹිනා වැඩ කරන්නේ ත් නැකතටලු ය. හරියටම නැකතට ඒ කටයුතු කිරීමෙන් අපල නැතිවේ ලු.

    මේ දිනවල ඔවුන් කඩිමුඩියේ සූදානම් වන්නේ ඔවුන්ට මේ සා සෞභාග්‍යයක් ලබා දුන් සියළු නැකැත් වලින් සපිරි ඔවුන්ගේ අළුත් අවුරුද්ද සමරන්නට ය. සූර්යයා මීන රාශියෙන් මේෂ රාශියට සංකමණය වන්නේ ලු. එය යි ඔවුන්ගේ අවුරුද්ද. ඒ වෙනුවෙන් ඔවුන්ට සියළු කටයුතු කරන්නට සිදු වී තිබෙන්නේ නැකතට ය. ඔවුන්ගේ අවුරුද්ද සමරන්නට දැන් ඔවුන් හමුදාවක් මෙන් සීරුවෙන් සිටිති. නැකතට අනුව සියළු චාරිත ඉෂ්ට කරගත්තොත් ඔවුන්ගේ ජීවිත කිරියෙන් පැණියෙන් ඉතිරී යනු නිසැක ය.

    ඔවුන් සියළු වැඩ නවත්වන වේලාවක් තිබේ. ඒ නැකැත් නැති වේලාව ලු. ආයෙමත් නැකත පටන් ගනී. එවිට නැකතට ලිප පත්තු කරති. නැකතට බත් කති. නැකතට ඇඳුම් මාරු කරති. නැකතට වැසිකළි යති. ඔවුන් ඒ දිනවල සාමාන්‍ය විධියට වතුර නාගන්ටවත් කැමති නැත. ඒකට ද නැකතක් තිබේ. හිසට කොහොඹ කොළ පයට නිදිකුම්බා කොළ තබා නානු ගාගෙන ය නැකතට නා ගත යුත්තේ. ඒ අනුහසින් සියළු රෝග පීඩා සිරුරින් පහවී යනු ඇත.

    නැකතට ආරම්භ කරන ලද ලෝකෙය් දියුණු ම කර්මාන්තශාලා ඔවුන් සතු ය. ඔවුන්ගේ අවුරුද්ද වෙනුවෙන් ඔවුන් එහි වැඩ අල්ලන්නේ නැකතට ය. ඔවුන්ට සල්ලි වලින් කිසි අඩුවක් නැත. නැකතට පටන් ගත් ඔවුන්ගේ බැංකු වලින් නැකතට ගනුදෙනු කළ යුතුය. එවිට ඊළඟ අවුරුද්දේ නැවත සූර්යයා මාරු වී යන තුරු ඔවුන්ට මිළ මුදල් වලින් හිඟයක් නැත. නැකත යනු ඔවුන්ට සියළු දේ ලබා දෙන කප් රුකක් වැන්න. නැකත යනු ඔවුන්ට සිතූ පැතූ සම්පත් ලබා දෙන සිතුමිණක් වැන්න.

    මෙතරම් දේවල් නැකැත් තුළින් සාර්ථක කරගත් ඔවුන්ට තව දුරටත් කළ යුතු එක දෙයක් තිබේ. එනම් නැකතට දිවි නසා ගැනීම යි. එවිට ඒ නැකෙත් අනුහසින් ඔවුන් සුගතියේ යනු ඇත. ඊට ප්‍රථමයෙන් හොඳ නැකතක් බලා අං තට්ටුවක් පැළඳ ගත යුතු ය. එවිට ඒ නැකෙත් අනුහසින් කකුල්වල කුර හට ගැනීමෙන් ඒ කටයුත්ත සම්පූර්ණ වනු ඇත.

    මේ ගැන කිව යුතුව තිබෙන්නේ එකම එක දෙයකි.
    නැකැත් කේන්දර පිස්සුව අතහැර තිසරණය ට පැමිණෙන තුරාවට ඔවුන් සතර අපාය කරා ගෙනයන මිථ්‍යාදෘෂ්ඨියෙන් නම් ගැලවිල්ලක් නැති බවයි.
    - පූජ්‍ය කිරිබත්ගොඩ ඤාණානන්ද ස්වාමීන් වහන්සේ විසින් බෝධිඤාණ සඟරාවට සපයන ලද ලිපියක් ඇසුරෙන් -

    ‘ගෞතම සංදේශය’
    - මුලාවෙහි ගිලෙන්නට නොව අවබෝධයෙහි සැරිසරන්නට....

    (Copied from a note on FB)
    If you still believe in New Year, are hard to break. congrats :P

    Sinhala New Year

    It's Sinhala new year today and I broke the first rule for the day by eating twice during nonagathaya :D. Any way I would like to wish to whoever believe in it a very happy new year ahead.

    I don't know much about the philosophy behind the new year, but I believe it had a different purpose back then than it does now like forgiving and putting back anger/arguments, meeting up with family, eating, cleaning and bathing(for those who don't do it :P), etc . I think whoever invented the function wanted to bring out those ideas and just decorated it with some beliefs of nakath to make it more convincing for people. That must have being because the people didn't want to be reminded what they were missing as if it was a mistake. Instead, they made it a special occasion mixed with beliefs to convince them. That way people believed sun going from 'meena' to 'mesha' was actually a good and a inbuilt time to start fresh.

    I personally don't believe in this and I actually hate doing those rituals. I have a whole different plan set up for myself when I have control over my life ;)

    The only thing I like about new year is wearing a new frock and eating kawum and also getting money from all of my relations ;)

    When I have my own place, I would make sure to leave my home for a big trip during new year vacation. Probably for 3-4 days. And I wouldn't have to bother visiting relations, sending food back and forth the lane to neighbours, wishing everyone and all other trouble in the world. And the worst is replying to SMS and facebook photo tags, I hate them all. Anyway FB or twitter or email is better than SMS, it at least doesn't waste my credit.

    Again, wish you a very happy new year (for those who believe :D)

    April 12, 2011

    Harvard referencing on Microsoft Word

    As you might have seen, the bibliography and citations provided does not have harvard reference style. Imagine how easy it would be if it could be done automatically.

    You can customize the bibliography styles as you want. Just need to write a simple XSL. (I should try it when I have time and hopefully add a tutorial too ;))

    I tried putting in some styles I found at BibWord styles for now. it does not provide the exact harvard reference style expected from us, but I think it's handy enough to help a little, than doing everything manually. refer the styles provided from here

    Harvard-AGPS is the closest style to what is expected. bibliography seems fine for now(need to check), but citation does not come with initials.

    For example,
    bibliography - Pustejovsky, J 1998, 'Generativity and Explanation in Semantics: A Reply to Fodor and Lepore', Linguistic Inquiry, vol 29, p. 290.
    citation - (Pustejovsky 1998)

    we need to have citation as (Pustejovsky J. 1998). therefore I recommend that you keep these styles only as a guide and reshape it to whatever needed.

    You just have to extract the .zip file and put it in the C:\Program Files\Microsoft Office\Office12\Bibliography\Style folder.

    sad world cup :(

    i am very much broken since the end of this world cup, and i still cant muster up the courage to write a post on our heroes. i am grateful for them and am very proud of them. but sad ending it had.

    any way, i guess I should write about this sad story some other time. just put in this post to keep up with the time line ;) content will come later :/

    April 2, 2011

    Today is the big day..

    Today is a huge day..n i cant wait to see it end victoriously., the excitement is almost killing me.

    And to add to it, i feel so sorry for the of Indians these days. they are desperate and pathetic. the shows that they have been putting up is only because they are afraid to get crushed between the lion paws.., i would have never said it before, but you leave us Sri Lankans no choice, other than to disgust you. actually pity would be a better term. y do you want to make such a huge issue of something that is not even yet confirmed. and we will never go above rules. you know how we play the gentlemen's game in a gentlemen's way. you guys.., even if you win, u don't deserve to. you have made Sri Lankans stronger in their hopes and wishes for the lions. We being a small country, still our wishes will overcome yours, since we are genuine, unlike you. you will regret what you did. and definitely the indian team would feel it would have been better to be crushed between the lions' paws than being homeless and hit to death by rocks. that's the way you people are. you never respect your team. it's only when they win. if they loose, you are cursing them. for us, our team is always golden whether they win or not. and to end with,

    "When our mighty lions bring the cup to where it belongs, lets see what those brainless Indians have to say, u showed how desperate u are to have a bit of respect and honour, that we Sri Lankans have been having throughout by playing as gentlemen. We didn't gain it from criticising any one or cursing any one.that's the lions way.. lions strike wont see it wait and see...may indians go deaf with our roar.........!!!!!!!"

    I see only sanga's shadow on the cup..sry dhoni :P

    March 31, 2011

    WCC theme songs

    this year all the theme songs are fast tracks and accidently i came across,this theme song of 2007 and i don't know why, its very touchy than this times  songs and it made me cry and made me feel very proud. too bad v don't have a nice track as this this time.

    රන් හිරු නැගෙනා මේ ලෝ තලේ
    හෙළ රජවරු වේ අප මව් බිමේ
    නෙත් සිත් පිනා යයි, මේ අප ශක්තියයි,
    ජය ඝෝෂාවයි, මේ අනුනාදයයි..

    සැම අභිමානයෙන් ජය ටැම් කරා
    නිති එඩිතරයයි - නෑ කිසි බාධා
    රන් බර කිරුළමයි, ඒ අප සිහිනයයි
    ලොව ජයගන්නයි ඒ අපගේ නිති පැතුමයි..

    අප ජාතියේ නාමයෙන්
    දිදුලන ක්‍රීඩා තරුවක් සේ
    ආ මඟ දුරයි, ආ මඟ රළුයි
    ගම් පියසෙන් තණ නිල්ල කරා
    අප සොයුරන් සේ එක් වෙලා
    සිත් එඩිතරයි අප ශක්තියයි..

    ජය මං මාවත් දැන් ලං වෙලා
    ඔල්වර හඬින් කුල්මත් වෙලා
    නෙක වාරයක්, අප නැඟ එන්නම් සදා..

    අප ජාතියේ නාමයෙන්....

    Mid point..Lessons learnt

    This post will keep on updating as and when I find new stuff and I realize something that I should have done.., etc

    1. Read as many as research papers possible..i have gone through 125+ so far..:(

    2. Don't try to group the research papers and put them in separate folders, because one paper may have to be put into several folders then. (If you try you will end up getting a headache ;) )

    3. Rename the research papers to the name of the research.(windows might not let you have long names, but linux does.., so go for linux :P)

    4. Use Linux (to name the papers really long and help with dolphin, specifically tabs is amazing..or you could install KDE on windows)

    5. As told above put all research papers in one folder and number them. I used to number as "01_RP (name)" where RP means research paper, BK for book and AR for articles

    6. Maintain an excel sheet with the paper number, name of paper, authors(useful when referencing) and tag the papers according to its content(example i used TOK for tokenization, ENC for encoding.., etc). it is important that you save these data because incase you loose the files you can get help of google easily. and  i assure that time spent on this will not go wasted.

    7. Another tip for skimming through the papers is to, first read the abstract and see how relevant it is to your project, you can even colour code the excel sheet depending on their importance. for example, for me papers on Sinhala were the most important so I colour coded it. But don't use more than 2-3, because then it looks highly unprofessional and complex.

    8. Also check the references for the papers you skim and search for them and keeps going..that's how I ended up with 125 ;)

    9. So when u want to write about tokenization check the papers with TOK tag and read them.

    10. You don't have to read the whole paper to tag them. just skim through the headings, and highlight important stuff as you go through them. Okular would be a good option for reviews on pdf.

    11. Maintain only a single document. Don't try to break the doc to the modules or cores of your research, it will create inconsistencies. Make sure you keep the navigator window open when you are writing.

    12. Remember to keep back up always. Keep online back up as well. I have uploaded all my research papers to Google docs. All 125 of them ;)

    13. Finish doc as soon as you can. Leave at least 4-5 days to go through all the research papers again. Trust me, you will find loads more facts you have missed. It makes the doc complete because you will be thorough with the subject by then and will be able to grasp facts more quickly.

    14. Don't get worried if you feel like it takes too long (given that you have enough time for deadline), because that means you are getting it into your nerves.

    15. Always think how you actually do something, think "programming". Don't just put something on doc, put exactly what you will be doing, and in detail. If you feel like programming something is too much work, go for an API. It is very important that you think in programming level and will help you a lot later on. And I suppose anyone would have knowledge and experience to think deep. Think of the trouble you had earlier. Think of where you got stuck earlier. Think of where you could get into trouble. After all it's FYP, you should be able to do this ;)

    16. And finally your output should be professional. And here's where you should head back to windows, because Microsoft office is the best office package and to my knowledge no one has beaten it yet. This is where you must polish(format) your doc.

    17. When you do citations don't try to apply the Harvard guidelines at once. Now that you have numbered your research papers use numbered citations (e.g. [12]..). It is easy when documenting. If you have filled out the excel sheet I mentioned, then citing with Harvard is not difficult afterwards.

    Mind you, that this is what worked for me. It might not work for most, but have a go if you think it will be helpful.. :D

    March 30, 2011

    Lions to Mumbai !!

    ..and back to Sri Lanka with the cup..

    dream come true for all Sri Lankan. Our boys got qualified to the finals and that's second time in a row. 1996 aussie were runner up and champs for 3 consecutive wcc tournaments, last time we were runner up and isn't it obvious that we are gonna win it this time :D and hopefully forever after, sri lanka will dominate..
    wishing good luck to the most amazing cricket team at the tournament to bring the cup to SL as sanga said.
    I want to especially mention some key players I love in our team. First, without no doubt its Sanga. The best personality, outstanding captaincy (as mentioned at the presentation yesterday) and brilliant performance. and next I like Malinga and Mathews, who are equally brilliant and both of them being life saviors at any critical moment our team faces. Mahela too, though am not sure where to put him on 2nd place after sanga or at joint with Malinga and Mathews. And Dilshan who is turning out to be the hope of the team, but i don't like his attitude but he is amazing. and murali who is the legend of our time. I've heard of Aravinda and other players who are legends, but i have not seen them play. and to think what a luck Murali has. A wicket in last test match ball and a wicket in last ODI ball at SL. And I believe that how difficult it would be for us at finals, Murali's luck will bring us the cup. And above all players, I dont like murali as Sanga, Mathews or Malinga, but I respect him above all others. for making us proud as a nation.

    And I salute, all our heroes.., we are always with you.. and now......

    go get the cup guys....!!

    March 29, 2011

    mid point

    a big milestone in my life is yet to come, that's the day I mark my official closure of the degree. This is only a sub milestone. The mid point submission is on next Tuesday. (same day we are starting the 2nd sem :( ) I was supposed to write about my FYP, actually update it because, I am not doing what I mentioned previously I was doing ;) I am doing the POS tagger I had mentioned before. It is very interesting and better than all my previous ideas. I love it. :D

    I'll blog on all my experience as soon as I finish my submission. Kind of busy now. Consider this as a preface till then. .

    World Cup 2011

    With whole of Sri Lanka wishing whole heartedly for us to win the World Cup , it would be bad for the reputation of my blog to not to mention about it. :P

    So here goes.., in very few words and with all my heart,

    "I truly wish our cricket team all the luck in the universe to show there real talent to beat the Kiwis in the coming semis and bring the cup from to our mother land again !!! we are waiting anxiously..and Sanga you are one hell of personality and talent.Best captain I have ever seen..lead the team to the best they can achieve.We are always with you.."

    P.S. India or Pakistan.., who ever you meet in finals, no one is better than you guys..we believe in it..

    January 9, 2011

    first day with fsp

    As i said earlier, what happens here is you write the FSP code or rather the model to represent the concurrent behavior. So let's get started..

    First of all, download the LTSA tool from here. This tool will let you type in the FSP model and it can generate the Labelled Transition Systems or the LTS for you. What I feel is that this LTS diagram is what that really brings out the meaning of the model. So what you downloaded is the LTS Analyzer tool. Apart from generating the LTS, this tool also has an option to run animation, which helps to know whether our model is actually what you want. Stay tuned...I'l update this post soon with my FPS stuff. A little busy now. :)

    January 8, 2011


    FSP...????for those who don't know , google and see.., you will be definitely does not appear on the first page..:P now try "finite state process"..there u that's better..still not much luck in learning FSP. ha ha

    Now what is this FSP?? It's supposed to be used for modelling the concurrent behavior, though I am not very sure how it's done. But, from what I read, it is hardly used today..but sadly, that's how we learn concurrency at APIIT. :D Of course, there  are better models to learn concurrency. However.., we are stuck with this. The only source I found, that I could understand FSP from was, this which is from the book our syllabus is based on.

    Although the start was kind of bad.. gotta say..I enjoyed trying out this.its a little fun I would say. I will put down some of the FSP stuff I learnt today..

    January 3, 2011


    the final domain...

    ah..just got to know that the PPF submission has been postponed to next week..yipee...:D

    Lets talk about this domain...My first idea was to create a translator. My supervisor explained to me that it is almost impossible to do such a huge thing in 8 months. I would have to identify my scope. A very limited scope. According to him, doing the translation (Sinhala to English) itself is  a huge thing and therefore I don't have to worry about making scope wider. He said its very risky to do this in 8 months still and that is really huge work for FYP. He gave me an idea to develop a Sinhala spell checker instead. he said it would give me a fall back option.

    and then vacation started..and i was asked to research about the domain. I researched and sent him a mail but he did not reply me. So I was blank on what to finalize on. Finally just the day vacation ended he sent me a msg in reply asking to meet him the following day. During that time I made a post in the Sinhala Unicode group about my FYP. Dr. Ruvan Weerasinghe sent me a mail after seeing my post mentioning some of the areas he thinks I could focus for FYP and one of it interested me. That's POS tagging. I researched a lot about it and made up my mind to do it. When I met my supervisor the following day, he told me to choose anyone I like and that both were ok. But he said he thinks I better do the spell checker. And I mentioned to him about my new interest in POS tagging. And he said that it is not gonna work out. It's too wide and if I limit it to a domain, that means I am being unfair to it..and.."Dr.Ruvan told you about it because that has been his research area for past 10 years" :P phew..that was a narrow escape..

    Translation has a small problem. It means I need to find a domain as well as a POS tagged word list. And if I could not get the word list from UCSC I will had to do it myself, which means that's 2 projects. :( I don't think I can handle it..So am back to the spell checker.I think doing a browser plug-in would be more worth than for an editor. But am still working on it..good luck to me..:D
    Later :

    I decided to do my FYP on POS Tagger and the scope was achievable. I got help from LTRL and Dr. Ruvan. I finally finished the FYP and gained a 1st class :)

    fyp...ready.. am gonna write about my FYP progress. I am horrified at the thought that I need to submit the PPF tomorrow.. :( I still don't now what to do...

    I'll start from the beginning.

    I didn't want to continue with my 3rd year because I was null with most of stuff. But, then again  I changed my mind. And most of all, if I take a semester break APIIT will increase fees :P..don't have to pay them more than they deserve.. then I started my mission FYP. Since long time back, I wanted to do something related to databases. However, after some googling I had changed my course to data mining without even knowing. So I went through the projects in the library as well. I wanted to do a "Stock price predicting system". So I went to meet the lecturer who had been doing databases for our batch through out the degree program. He and also PM told me it's a highly uncertain domain. They asked me to either choose a different domain. But since I am not creative, I couldn't find another domain..I gave up data mining.

    My next idea was an "offline signature verification system" . PM said this was ok unless it's different from what is already done at APIIT. So i made it a ANN system. And that was stupid. PM said "you can't say it's NN. You have to research.Perhaps there are many other better ways to approach" i started to have my dilemma or not to do..and although I did research alot about image processing, I felt that it wasn't really my thing.

    Then...the 3rd topic. I was helpless. I didn't want to mess up with image processing or audio. Something people will use.  My to-be-supervisor gave me an idea to develop a speech to formula generator. It seemed ok. And i was told I could use the Java Speech API. I had a inclass exam at uni and had to go to that and i missed a FYP session. Unfortunately, that day someone else has got approval to it. My to-be-supervisor had mentioned it to him and asked him to check with me and he didnt. so i lost that topic as well..

    And then....a report generator plugin for PHP in eclipse ;), a text summarizer, a audio summarizer, english to sinhala subtitle generator...bang!!! i hit my final domain. Natural Language Processing in Sinhala..this redirected me to my to-be-supervisor. He was very interested and had even talked with PM and taken me for his supervisee even before I had finalised my topic..And have to say.., I have not yet even finalised it..Lets talk about it in the next post..