Saturday, January 24, 2009

Friday, January 23, 2009

"Be pleasant until ten o'clock in the morning and the rest of the day will take care of itself." - - Elbert Hubbard

 

Confusion are not just within me...good to know that :-)

“Among other things, you’ll find that you’re not the first person who was ever confused and frightened and even sickened by human behavior. You’re by no means alone on that score, you’ll be excited and stimulated to know. Many, many men have been just as troubled morally and spiritually as you are right now. Happily, some of them kept records of their troubles. You’ll learn from them - if you want to. Just as someday, if you have something to offer, someone will learn something from you. It’s a beautiful reciprocal arrangement. And it isn’t education. It’s history. It’s poetry.”

- 
J.D. Salinger, The Catcher in the Rye, Chapter 24

Friedrich Nietzsche: "It is hard enough to remember my opinions, without also remembering my reasons for them!"

 

Monday, January 19, 2009

Free to work

Being honest about what we can do frees us to work - Kent Beck

StringBuffer vs. StringBuilder?

 

Never ever String concatenate

Use String.format()

APIs in Java Interfaces

No access specifiers in method signatures specified in Interfaces. Implementation qualifiers like “final” not to be included in arguments. Details follow.

A close shave

“What might have been” causes you to be sad because you are comparing yourself with how good things would have been had you been successful.

Your comparisons can determine your happiness

The bronze medalist is happiest because he compares himself with those who did not get any medal.

 

The silver medalist is not as happy because he compares himself with the gold medalist. Happiness is a function of who you compare yourself with.

Secret of happiness is mild contentment not extra-ordinary happiness

People who are have extra-ordinary happiness also experience extra-ordinary sadness. Details

 

Friday, January 16, 2009

Vanity - Excessive pride in one's abilities

Another nice word that.

Strange are Madoff's ways

The $50 Billion Ponzi scheme fraudster was investigated thrice by the SEC and they could find nothing wrong with him. Strange world this.

U.S. not the country with most cars person....surprise!!!


Interesting facts these:

 

There are more cars per person in Iceland (which is now is a financial doom) than in U.S. Details.

 

Wednesday, January 14, 2009

Listing all check-ins on a specific day

The following SVN command lists all check-ins on a specific day(s).

 

> svn log --revision {20090113}:{20090114}

------------------------------------------------------------------------

r4900 | bsubburu | 2009-01-13 16:54:12 -0700 (Tue, 13 Jan 2009) | 1 line

 

XYZA-2823. Implemented blah blah blah

------------------------------------------------------------------------

r4902 | jweight | 2009-01-13 17:28:38 -0700 (Tue, 13 Jan 2009) | 1 line

 

XYZA -2823. Increased blah blah blah

Friday, January 09, 2009

Nice talk on India, Pakistan conflict

http://fora.tv/2008/11/20/Neil_Joeck_The_US_And_Pakistan_Next_Steps

Thursday, January 08, 2009

Treatment (yesterday and today) of Mr Ramalinga Raju - a glaring example of how assuming we are

I have always felt that we Indians are very assuming. If somebody is successful in creating of perception of being good the first few times then he is good for the rest of his life and vise-versa (If we get a perception of somebody being bad the first few times then he is bad for the rest of his life).

 

Till yesterday Mr Raju, for the Indian media and Indians in general, was a super here of India Inc. Because we bought into his image promotion. We bought into his false-hood (or public relations as it is called to give it legitimacy).

 

Something like the size of a Maytas acquisition needed to wake us all up and smell foul. Now we start the journey to the other side. Mr Raju the evil of corporate India. Yesterday, a news item in NDTV that said they could not find where Mr Raju was. There were news reporters at the Satyam headquarters, Mr. Raju’s residence all saying “Ohh….He is not here”, “He is not here too”. They just stopped short of vocally uttering the word “abscond”. But the word was wide written everywhere in the news item.

 

Till yesterday Mr. Raju was, actually, a liar. To us, He was a super hero of corporate India. Today Mr. Raju is, actually, less a liar than yesterday. To us, He is a super villain of corporate India. When will we start rational views and stop having extreme ones.  

 

I am no big fan of Mr Raju. In fact I do not know much about him. But my point is our (the Indian society) treatment of him brings out the flaw in our attitude.

Wednesday, January 07, 2009

A british territory in Indian ocean?

Pretty surprise to see a territory of UK in here.

Why use @Override annotation

If a method is annotated with @Override but does not correctly override a method (in one of the super-classes or interface), then the compiler will report an error. So this is a means to use the compiler to enforce your idea that the methods overrides some other method.

 

E.g. of a startElement() method exposed in ContentHandler.

 

    /**

     * ……

     */    

    @Override

    public void startElement(

            final String uri,

            final String localName,

            final String qName,

            final Attributes atts

    ) throws SAXException

    {……

 

Tuesday, January 06, 2009

BidiMap

This Map can be looked up by both the key and the value WITH the same performance. The catch is that the values should also be unique. Which is expected as the values become the keys in reverse lookup.

 

A simple example:

 

import org.apache.commons.collections.BidiMap;

import org.apache.commons.collections.bidimap.TreeBidiMap;

 

public class BidiMapDemo {

    public static void main(String[] args)

    {

        BidiMap map = new TreeBidiMap();

        map.put("US", "USA");

        map.put("IN", "India");

        map.put("UK", "United Kingdom");

       

        System.out.println(

            String.format(

                "Lookup by Key. key: %s Name: %s",

                "US",

                map.get("US") // returns "USA"

            )

        );

 

        System.out.println(

            String.format(

                "Lookup by value. Name: %s Key: %s",

                "India",

                map.getKey("India") // returns "IN"

            )

        );

       

    }

}

 

Output:

 

Lookup by Key. key: US Name: USA

Lookup by value. Name: India Key: IN

Monday, January 05, 2009

Indian deep space network

Until recently, I was of the idea that the space facility at Byalalu was custom buily only for the Chandrayan project. But only now did I come to know that the 2 antennas at this facility is part of the deep space network. Pretty Impressive.

Sunday, January 04, 2009

java and sax xml programming basics

How to read an xml document using SAX
Notes:

Sax exposes a org.xml.sax.XMLReader interface which must be implemented by all XML parsers. xerces implemented this interface in the org.apache.xerces.parsers.SAXParser class.

The first step is to create an instance of XMLReader. So

package test;

import org.xml.sax.XMLReader;

public class SaxRead1
{

public static void main(String[] args)
{
XMLReader reader = null;
}
}


Next to create an instance of SAXParser and assign it to XMLReader reference. So

package test;

import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.XMLReader;

public class SaxRead1
{
public static void main(String[] args)
{
XMLReader reader = new SAXParser();
}
}


SAX call backs: