• Enter Slide 1 Title Here

    This is slide 1 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

  • Enter Slide 2 Title Here

    This is slide 2 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

  • Enter Slide 3 Title Here

    This is slide 3 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

Tuesday, August 1, 2006

World Record Test Cricket Partnership - 624

The two Sri Lankan cricketers Mahela Jayawardana (captain) and Kumara Sangakkara (vice captain) put a world record partnership - 624 for any wicket on last Saturday (29/07/2007) against South Africa, a leading cricket team. This is the first time a partnership grew over 600 mark in cricket history.

In this brilliant knock the scorecard of the two players;
  • Mahela J - 374 (752 mins, 572 balls) with 43x4 & 1x6
  • Sangakkara K - 287 (675 mins, 457 balls) with 35x4

This is Sangakkara's 4th double hundred (& carrier best) while Mahela's first ever 300. This is the 21st time a player passed the 300 mark ever in history.

Updates for record books

World
  1. Best partnership for any wicket - 624 runs (& so the best partnership for the 3rd wicket as well)

    • 576 - Sanath Jayasuriya & Roshan Mahanama (SL) v IND 1997
    • 467 - Andrew Jones & Martin Crowe (NZ) v SL 1990

  2. Best scores by two batsmen in the same innings.

    • Garfield Sobers (unbeaten 365) and Conrad Hunte (260) for the West Indies against Pakistan in 1958

  3. 4th best score by a player (374)

    • 400 - Brian Lara, WI v ENG (2003)
    • 389 - Mathiew Hayden, AU v ZIM (2003)
    • 375 - Brian Lara, WI v ENG (1993)

  4. 6th top score in a inning by a team

    • 952-6d SL v IND (1997)
    • 903-7d ENG v AU (1938)
    • 849 ENG v WI (1929)
    • 790-3d WI v PAK (1957)
    • 758-8d AU v WI (1954)
Sri Lankan
  1. Best score by a player (374)

    • Previously held by Sanath Jayasuriya - 340 SL v IND (1997)

  2. 2nd Best score in a inning

    • 957 - SL v IND (1997)

[I believe these statistics are correct and if there's something missing just remind me]

And.....Congradulations
SL won this match by an innings and 153 runs.


This is a wonderful time for Sri Lankan cricket which reminds the 1996 world cup tournament. All cricket fans are waiting to see the coming adventures of Sri Lankan team while wishing their success.

All the very best guys.

Tuesday, July 18, 2006

Mastering Enterprise JavaBeans 3.0


Mastering Enterprise JavaBeans 3.0 book is publshed. I still could not read it but must be a great book, same as Mastering EJB Third Edition which we usually read when ever small clarification is needed on EJB.

The book is available for download in PDF format at theserverside.

I feel this is really a great work.

Monday, June 26, 2006

What is CRUD?


The word 'CRUD' is a acronym in the computer world. It stands for Create, Read, Update and Delete. Sometimes R in 'CRUD' is used for the word Retrieve and D for Destroy.

Most of the time 'CRUD' is related to SQL database operations as follows.
  • C: INSERT
  • R: SELECT
  • U: UPDATE
  • D: DELETE

Tuesday, June 20, 2006

JUnit Getting Started

Main object:   Write a test case using JUnit as simple as possible.
Approach:   First write a class, then write the TestCase and the TestSuite.
Readers:   Should have some experience or knowledge in Java

by Kamal Mettananda

JUnit is a regression testing framework written by Erich Gamma and Kent Beck. This is used by developers to implement unit tests in Java.

Why unit testing is needed?
With unit testing the end product is completely checked for the correcteness of the code. With the time, the set of tests grow and the ease of testing improves. One of the most important things is that developers can be confident on the code and less time needed for debugging.

What is JUnit?
JUnit is a Test framework. The features available are;
  • Assertion methods (test methods)
  • Running tests (TestRunner)
  • Aggregating tests (test suites)
  • Reporting results (text based and GUI based)
One factor that developers may worry is : the developers has to write tests.

Writing a JUnit Test in 5 minutes
First add the junit.jar file to the project (All the following classes are tested using junit-3.8.1.jar). Then write the follwing classes.

Writing JUnit class
  1. Define a subclass of TestCase.
  2. Override the setUp() & tearDown()methods.
  3. Define one or more public testXXX()methods
    all the methods starting with test will be run by the TestRunner
    • call the methods of tested object
    • check the expected results with assertXXX() methods
  4. Define a static suite() factory method
  5. Create a TestSuite class containing all the tests.
  6. Optionally define main() to run the TestCase in batch mode.

1. Write a class - Calc.java


package com.parcelhouse.myproj;

public class Calc {

     public Calc() {
          super();
     }
     public int add(int a, int b){
          // errorneous method
          return a+b+1;
     }
     public int multiply(int a, int b){
          return a*b;
     }
}


2. Write the test case - TestCalc.java (anyname can be used)


package test.com.parcelhouse.myproj;

import junit.framework.TestCase;
import com.parcelhouse.myproj.Calc;//testing class

public class CalcTest extends TestCase {

     Calc c = null;

     public CalcTest(String name) {
          super(name);
     }

     protected void setUp() throws Exception {
          super.setUp();
          c = new Calc();
     }

     /*
      * Test method for 'com.parcelhouse.myproj.Calc.add(int, int)'
      */
     public void testAdd() {
          int x = c.add(5,6);
          assertEquals(11, x);
     }

     /*
      * Test method for 'com.parcelhouse.myproj.Calc.multiply(int, int)'
      */
     public void testMultiply() {
          int x = c.multiply(5,6);
          assertEquals(30, x);
          }

     public static void main(String[] args) {
          junit.textui.TestRunner.run(CalcTest.class);
     }
}

  • Run test case using;
    >java CalcTest

  • The line junit.textui.TestRunner.run(CalcTest.class) is where the trick occurs. The TestRunner runs all the methods in the CalcTest class which has testXXX() signature using reflection.

  • c.add(5,6) line should return 11 if the method works fine. The return value is checked against the expected value in the assertXXX() method.
    As the method is errorneous, this throws junit.framework.AssertionFailedError.
    But the multiply() method works fine and causes no errors.

3. Write the Test Suite - TestSuite.java (anyname can be used)


package test.com.parcelhouse.myproj;

import junit.framework.Test;
import junit.framework.TestSuite;

public class Tests {
     public static void main(String[] args) {
          junit.textui.TestRunner.run(Tests.class);
          //junit.swingui.TestRunner.run(Tests.class);
          //junit.awtui.TestRunner.run(Tests.class);
     }
     public static Test suite() {
          TestSuite suite = new TestSuite("Test for test.com.parcelhouse.myproj");
          //$JUnit-BEGIN$
          suite.addTestSuite(CalcTest.class);
          suite.addTestSuite(ComputerTest.class);//another test case
          //$JUnit-END$
          return suite;
     }
}

  • Run Tests class with >java Tests
    all the testXXX() methods in all the testCases which are added to TestSuite inside suite() method are called.
  • junit.textui.TestRunner.run() gives results in text mode.
    But if junit.swingui.TestRunner.run() or junit.awtui.TestRunner.run() used, results come in UI mode.
  • Add the TestCase to the TestSuite inside suite() method, when ever a new TestCase is needed.

Oh! you are done. The complete TestSuite is completed.
One important thing to keep in mind, write code to do small operations as much as possible.

If you have any question or comment, just add as a comment and will be here to help you guys.

References:
www.junit.org
www.javaworld.com/javaworld/jw-12-2000/jw-1221-junit.html
www.admc.com/blaine/howtos/junit/junit.html

Monday, June 5, 2006

06:06:06 06/06/06



If you check the date and time today at 06:06:06 in the morning, you will see that it's full of sixes.

06:06:06 06/06/06

This will appear again only after 100 years. If you were living at that time (2106), better to add a comment saying this blog is 100 years older.

Related Posts:
01:02:03 04/05/06

Thursday, May 25, 2006

My first car

Today I bought my first ever car. It is a Toyata Corsa of 1986 model. I drove it a bit as well.

Still I could not get some photos of it, wait for the coming photos.

Tuesday, May 16, 2006

WWW (Which Wolf Wins?)

A valuable story...

One evening an old grandfather told his grandson about a battle that goes on inside people.

He said,
"My son, there is a battle between two wolves inside all of us.
One is Evil. It is anger, envy, jealousy, sorrow, regret,greed, arrogance, self-pity, guilt, resentment, inferiority, lies, false, pride, superiority, and ego.
The other is Good. It is joy, peace, love, hope, serenity, humility, kindness, benevolence, empathy, generosity, truth, compassion and faith."

The grandson thought about it for a minute and then asked his grandfather,
"Which wolf wins?"

The old grandfather simply replied, "The one you feed."

Wednesday, May 3, 2006

01:02:03 04/05/06

On the 4th of May (today), at two minutes and three seconds after 1:00 in the morning, the time and date will be 01:02:03 04/05/06.
That won't ever happen again in our lifetime.

It is said that, it will be approximately 400 generations before it happens again!!!

Monday, May 1, 2006

A Rare coconut tree

Wednesday, April 26, 2006

The 20 dollar's bill

This is a story with a valuable advice which I read today.

A well known speaker started off his seminar by holding up a $20 bill. In the room of 200, he asked:

"Who would like this $20 bill?"
Hands started going up. He said:
"I am going to give this $20 to one of you but first, let me do this."
He proceeded to crumple the dollar bill up.

He then asked:
"Who still wants it?"
Still the hands were up in the air.
"Well," he replied, "what if I do this?"
And he dropped it on the ground and started to grind it into the floor with his shoe. He picked it up, now crumpled and dirty.

"Now who still wants it?" Still the hands went into the air.

"My friends, you have all learned a very valuable lesson.
No matter what I did to the money, you still wanted it because it did not decrease in value. It was still worth $20.
Many times in our lives, we are dropped, crumpled, and ground into the dirt by the decisions we make and the circumstances that come our way. We feel as though we are worthless.

But no matter what has happened or what will happen, you will never lose your value. To those who love you, you are priceless.
The worth of our lives comes not in what we do or who we know but by who we are!

Wednesday, March 8, 2006

Extend Firefox Contest - Winners


Extend Firefox Contest winners are announced, a set of great developers are appreciated. Congradulations to all.

Grand Price

  • Best New Extension Overall:
    Reveal by Michael Wu

  • Best Upgraded Extension:
    Web Developer by Chris Pederick

  • Best Use of New Firefox 1.5 Features:
    Firefox Showcase by Josep del Rio

  • Extension Evaluation

    Reveal Extension
    Reveal allows you to see thumbnails of pages in your session history and quickly find the page you want. Reveal also includes a magnifying glass to help you see everything. Try it now - it comes with a quick tour of all features. Screenshots do not fully capture the experience of using Reveal.

    As Reveal is an extension that I'm not familiar, I installed and experienced it.
    It is really easy to use, as a small tutor comes with it so that anybody can easily pick up the idea. Thanks and Congradulations Michael Wu.


    The thumbnails of my browser looked like above.

    Related Topics:
    Extend Firefox Contest finalists

    Source
    addons.mozilla.org