Saturday, September 30, 2006

நிம்மதி சுழ்க!

This poem was written & read out by Vairamuthu, in front of public of Tiruppur (Tamil Nadu) at a opening ceremony of a cemetery! This poem was very much appreciated and consoled many hearts over the audience.

(Ananda Vigatan published the poem in last week issue).

நிம்மதி சுழ்க!

ஜென்மம் நிறைந்தது
சென்றவர் வாழ்க
சிந்தை கலங்கிட
வந்தவர் வாழ்க
நீரில் மிதந்திடும்
கண்களும் காய்க
நிம்மதி நிம்மதி
இவ்விடம் சூழ்க!
....

ஜனனமும் பூமியில்
புதியது இல்லை
மரணத்தைப் போல் ஒரு
பழையதும் இல்லை
இரண்டுமில்லாவிடில்
இயற்கையும் இல்லை
இயற்கையின் ஆணைதான்
ஞானத்தின் எல்லை
...

பாசம் உலாவிய
கண்களும் எங்கே?
பாய்ந்து துழாவிய
கைகளும் எங்கே?
தேசம் அளாவிய
கால்களும் எங்கே?
தீ உண்டதென்றது
சாம்பலும் இங்கே
கண்ணில் தெரிந்தது
காற்றுடன் போக
மண்ணில் பிறந்தது
மண்ணுடல் சேர்க
எலும்பு சதை
கொண்டஉருவங்கள் போக
எச்ச்ங்களால் அந்த
இன்னுயிர் வாழ்க
...

பிறப்பு இல்லாமலே
நாளொன்று இல்லை
இறப்பு இல்லாமலும்
நாளொன்று இல்லை
நேசத்தினால் வரும்
நினைவுகள் தொல்லை
மறதியையப்போல் ஒரு
மாமருந்தில்லை
...

கடல் தொடும் ஆறுகள்
கலங்குவதில்லை
தரைதொடும் தாரைகள்
அழுவதுமில்லை
தி மழை போன்றதே
விதியென்று கண்டும்
மதிகொண்ட மானுடர்
மயங்குவதென்ன?

- வைரமுத்து.

Thursday, September 28, 2006

Lyrics.

The lyrics which I read recently. I wish to blog them, before they leave my memory. Cool lines!


1. இந்தியாவைச் சுற்றி மூன்று பக்கம் கடல்கள்,
நான்கு பக்கம் கடன்கள்.
- யாரோ.

2. கலீலியோவின் உலகை சதுரமாக்கியது
என் ஜன்னல் வழிப் பார்வை.
- கமல் ஹாசன்.

3. நெஞ்சு பொறுக்கு திலையே! - இந்த
நிலைகெட்ட மனிதரை நினைந்துவிட்டால்,
அஞ்சி யஞ்சிச் சாவார் - இவர்
அஞ்சாத பொருளில்லை அவனியிலே
வஞ்சனைப் பேய்கள் என்பார் - இந்த
மரத்தில் என்பார்; அந்தக் குளத்தில் என்பார்
துஞ்சுது முகட்டில் என்பார் - மிகத்
துயர்ப்படுவார் எண்ணிப் பயப்படுவார்.

- பாரதியார்

Tip #3: Difference: Jvm, JRE, JDK, J2SDK, HotSpot...

JVM, JRE, JDK, J2SDK, HotSpot... : These terms are often parts of Java programmers communication. But, it seems.. all such terms sound to mean a same thing – no, they just seem, not really. Let’s discuss and distinguish the terms in detail.

JVM- Otherwise called as 'Java virtual machine' that actually takes the .class file as input, interprets it and executes it. JVM is platform dependent. The java.exe, found in your J2SDK/bin folder is called as JVM!

JRE - JRE includes a JVM and standard libraries (which are imported by default during execution). Note, JRE doesn't include other tools like jdb, javac, javap and etc. It includes only the jvm (java.exe) and default packages. JVM can be thought as a proper subset of JRE.

JDK - JDK is a box in which everything is put together. JDK includes JRE as well as other necessary tools and libraries. You have JRE, JVM and all the standard & extended libraries.

Important differences:

1. The important difference between JRE and JDK is that, Java License allows any one to re-distribute the JRE along with his product. But, it is illegal to re-distribute the JDK with your product!

2. JDK and J2SDK exactly refer to a same thing. But, what is difference? The term ‘JDK’ is just re-branded (re-named) to ‘J2SDK’ to bring a Standard (guts?) to Java. Seriously! :-)

The following simple formulas can help you to understand easily what were said above:

JVM = java.exe
JRE = JVM + Standard Libraries – Other java tools like jdb, javac.
JDK = JRE + Other java tools + all core libraries and packages.
J2SDK = rename (JDK)

Exercise:

The term ‘HotSpot’ is left unexplained. If you are curious to know, Pl, spare some minutes to find out yourself and post the answer as comment.
Or, let me post the answer in next tip.

Wednesday, September 27, 2006

Mr. Smart: Jackie Chan



I haven’t ever seen any one being this much smart in his old age! Jackie Chan is an exception. He is a most famous martial artist, asia’s most paid, and the most brisk, never seen ever.

If you pay keen attention to his kicking and jumping, first time you would wonder how these things are possible to him. But, the risk and pain he takes behind the screen is horrible. The News is true that no one insurance company is ready to give Jackie, a insurance policy. They are afraid of his risk stunts.

I guess the first Jackie’s film I saw is ‘Police Story II ‘. He acted as a cop. He usually take the roll of a cop and chases smugglers. He never assists dupes. He himself acts in any challenging fight & chase scenes. He would have become world’s hero if he had been into Holly Wood. But, time didn’t make it happen. All his famous adventures are limited only within Asian countries. Only, very few of his films went to Holly Wood and they are block busters, of course. Rush Hour, Shangai Noon are some few to name.
I am, sort of his fan, and don’t miss his films!

And, yes, he has rewarded with numerous awards. He’s been the best actor in Hong kong over many years. His films were also big Box Office drawers in many Asian countries and American cities.




The wonder full films by Jackie, I have seen are: The Myth, New Police Story ,Around the World in 80 Days, The Medallion, Rush Hour I & II , Shanghai Noon , Who Am I?, Mr. Nice Guy , Miracles , Super cop , Project A II, Police Story, Drunken Master, The Young Master, Armour of God, Thunderbolt.



He is the Mr. Smart!

Sunday, September 24, 2006

Tip #2: How to access the private variables outside the class in java?

Is that possible?

Yes, it is. Have you ever heard of ‘Java Reflection API’?. If no, then this brief intro can help. Java Reflection API: has set of classes and methods to access the runtime behavior and memory foot print of classes and objects”

Using the reflection API, you can access (any) instance member variable of an object. Yet, you can do a lot more with that.

Don't you thing this is a loop hole in Java? Breaking the integrity of Oops?

Not in that way. This API actually meant for helping people tracing the memory foot print and for developing applications like ‘Java Debugger’, ‘Java Profiler’, ‘Java Application Monitor’ and the likes. Usually, other applications programmers are advised not to use this API unnecessarily.

The following simple example demonstrates how to access the private variable of an object outside the class (using Reflection API):

(This example is referred from javareference.com)

java.lang.reflect.*;

class Example {

private int x = 10; // means not available to outside the class
public int y = 10; // accessible from anywhere.

}

public class ReflectionDemo

{
public static void main(String[] args) throws Exception {

Example e = new Example();
Class ref = e.getClass(); //will return ‘Example’ – right?
Field f = ref.getDeclaredField("x"); // watch here! :)
f.setAccessible(true); // Now the ‘x’ is accessible!
Object obj = f.get(e);
int val=((Integer) obj).intValue();
System.out.println("Private var X is = " + val);

}
}


That’s it!

If you want to know more about Reflection API, spend some minutes at Sun sites/ Tutorial.

Answer for Tip #1

Here comes the answer for the question asked in last tip (Tip #1 Java Memory Issues) : To run the program successfully, you have to increase the memory by using JVM command line options –Xmx and –Xms, like

$java –Xms20m –Xmx120m Memory

The -Xms20m options instructs the JVM to set the initial heap size to be 20 MB and the –Xmx120m options instructs the JVM to set the Maximum heap size to be 120 MB. (If this doesn’t work for your machine, you can try changing the numbers).

Friday, September 22, 2006

After the rain..

I can’t obviously tell the things went around after my last blog post. But, they went well as I expected. I am very much satisfied and happy at this moment.

I see things lying before me as how something would look like after it stopped raining!

Sunday, September 10, 2006

Tip #1: Java Memory issues.

Hmm. I am going to write some tech bits frequently, which might help others. So, let’s start the first one.

Memory issue:

The most critical problem, most of us might be experiencing is memory leak. Your JVM may brainlessly spit out “OutofMemoryException”, then say “bye” and exit. It’s because your heap memory ( heap -the memory used for storing objects used in the program) might have become full.

So, in order to fix this issue, you have to increase heap space size using the JVM command line arguments –Xms (Initial Heap size) and –Xmx (Maximum Heap size)

Exercise: (If you wish!)

1. Just compile and run the below code. Watch curiously what happens. Then, use the tip presented above and fix the issue.I may get a chocolate for you if you get it running :-)

class memory {

public static void main (String args [] ) throws Exception {

int[] a = new int[18000000] ; // Watch here! :-)
System.out.println("Code is running");
}

}

Note:I will post the ans when I post next Tip. :-)

Saturday, September 09, 2006

Java/JDBC Questions

I have prepared set of questions for Java/J2EE (may be helpful to test one's knowledge). Here, first comes the questions from JDBC.

I don't have time to type the answers here:-) Pl, find yourself by reading books or googling or by asking someone who had lost his life in java.

If unable to find answers anywhere, you can directly mail ( or scold) me via: manivannan.p (at) gmail.com

JDBC – Questions: Manivannan.P (at) gmail.com, 14th Aug, 2006.

[For Beginner/Advanced/A bit experts]


1. What are all the available types of JDBC drivers? Give example for each type.
2. Which one of the available drivers is better?
3. Give sample scenarios where you would choose each one.
4. Write a sample JDBC code to connect to any database.
5. What do you understand by Class.forName(“drivername”).newInstance() ? (give alternative syntax for this)
6. What is a Statement and a PreparedStatement?
7. What is the difference between Statement and PreparedStatement. Which one is advisable to use?
8. How will you execute a DML statement using JDBC?
9. How will you traverse the ResultSet?
10. What exception will you probably get when you have no data in Resultset?
11. How will you print Meta data of Resultset like column count, column names and etc.
12. How will you execute a stored procedure using JDBC?
13. How will you pass parameters to stored procedure using JDBC?
14. Can you give example code for using IN, OUT and INOUT parameters stored procedure using JDBC?
15. How will you capture the return value of a function using JDBC?
16. How will you print the warning message, error code, status generated by the database (while using JDBC)?
17. How will you catch/escalate the exception generated by the database?
18. How will you manage the concurrency while using JDBC? (Just write down a sample code)
19. Give example for managing transaction using JTA.
20. How will you make the Resultset become scrollable by back and forth?
20.a) Can you move the Resultset to a particular row absolutely or relatively?
21.b) Can you give an example for inserting/updating/deleting a specified row on ResultSet?
21. How will you apply concurrency for Resultset?
22. How will you refresh the Resultset, without repeating the code?
23. How will you send sql statements in bulk? [Batchupdates]
23.a) How will you capture & analyze the return value of BtachUpdate?
23.b) What is the limitation of BatchUpdate ?
23.c) What is the difference in using Stored procedure and BatchUpdate
24. Can you explain what is connection pooling & how it is implemented? [provide sample code for connection pooling and a client that uses it]
25. What are all the parameters you need to pass while configuring connection pooling?
26. Do you know about two-phase and three-phase commit, can you explain it?
27. How will you handle blob, clob fields using JDBC?
28. Can you write code for storing and retrieving an image file/ text file using JDBC? [hint: using blob and clob]
29. Can you tell any noticeable differences between JDBC1.0, JDBC2.0, JDBC3.0 APIs?


Disclaimer: The questions [or answers] presented here are purely based on my perspective alone. There may be number of alternative answers.

Sunday, September 03, 2006

Life is beautiful

Book :

I was little seious about some thing last week. I am completely engaged with some serious things till this mid of Sept, (perhaps over October). Then, I've been trying to get a template/layout for the book for more than a week, but I've not yet got one still. I have sent request to somebody, let me wait for their reply.

Life is beautiful:

I wanted to imagine my life without computers and computer related books. In these sat & sunday, I didnt touch any book, didnt type anything on keyboard and even didnt think of anything related to technology. My mind was completely free; I didnt feel such a beautiful life before - seriously!

But, it can only be an imagination. I am getting ready to start-out the next day - Monday!
(which I ever hate from school days..) :-)