Wednesday, December 12, 2007

Work

There is no pleasure in having nothing to do; the fun is in having lots to do and not doing it.

courtesy : Anjali

War

War is young men dying and old men talking.

From the movie Troy

Tuesday, December 11, 2007

Happiness

Being happy doesn't mean everything is perfect. It means you have decided to look beyond the imperfections.

courtesy : Anjali

Monday, December 10, 2007

Java Interview FAQ

Below is a list of most frequently asked interview questions in Java. I am not furnishing any answers here because you can easily find them on google for one reason. And for many questions there is no single correct answer. So people are free to post their versions in the comments. Also, please do add to the list any other FAQ which I might have missed.
  1. Why is Java Platform independent? How does it acheive it?
  2. abstract class vs interface
  3. What is polymorphism?
  4. What is multiple inheritance? Does Java support it?
  5. overloading vs overriding
  6. String vs StringBuffer
  7. Why is String immutable? How do you make a class immutable?
  8. Hashtable vs HashMap
  9. What is multi-threading?
  10. How do you make a program multi-threaded?
  11. What is synchronized?
  12. What is final?
  13. final vs finally vs finalize
  14. How are Exceptions handled in Java?
  15. Checked Exception vs Unchecked/Runtime Exception
  16. What is serialization?
  17. What is singleton design pattern?
  18. What are inner classes?

Life

You need to keep running to stay where you are, because the world around you is running.

Thursday, December 6, 2007

Right vs Left

There is nothing Right in the Left brain while there is nothing Left in the Right brain.

courtesy : Priya

Deja Vu and Amnesia

Right now I am feeling Deja vu and Amnesia at the same time. I think I have forgot this before.

courtesy : baki

War

War does not determine who is right, just who is left.

courtesy : Priya

Wednesday, December 5, 2007

MySQL import data from flat file

Type the following SQL at the mysql prompt:

LOAD DATA LOCAL INFILE '/importfile.csv' INTO TABLE test_table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1, filed2, field3);

This is taken from How do I import delimited data to MySQL where more details can be found.

Java Class Loader

In a J2SE 2 (that is, J2SE 1.2 or later) environment, class loaders are arranged in a parent-child tree. Normally, when a class loader is asked to load a particular class or resource, it delegates the request to a parent class loader first, and then looks in its own repositories only if the parent class loader(s) cannot find the requested class or resource.

A crisp article on Java Class Loading explains the concepts.

MySQL convert or cast int to string

Suppose you have a table with 2 columns one int and other varchar. Now if you want to update varchar fields in all the records with the int value, use this query :

update table_name set varchar_Field = CAST(int_Field AS CHAR);

If you want to some text in addition to the int field, then use :

update table_name set varchar_Field = CONCAT(CAST(int_Field AS CHAR), 'sampleText');

vi search and replace all

:%s /search_text/replace_text/g

If either of the search or replace texts has a forward-slash '/', use the backward-slash '\' to escape it.