Sunday, December 30, 2007

oops

1.+(2) = 3

Thursday, December 27, 2007

Making of a leaderless country

The entire world should be shocked by the Assassination of Benazir Bhutto and salute her courage and dream of making Pakistan a country with Moderate Islamic values. In fact she is not the first leader to be assassinated. This time the entire world should take notice though. If we are finding difficult to deal with a rag-tag leaderless Taleban, think what you will have to deal with one nuclear capable one? She was the first Pakistani leader who was widely respected in India too for her courage to work towards normalization of relations between these arch rivals. Two young leaders of their times - Rajiv and Benazir did give the hope to the entire region that these two countries can be friends. They both are gone, sacrificed to the menace of terrorism.
It is important that the entire democratic world stand behind the democratic forces in Pakistan. Benazir was one of the very few faces left who believed in a Democratic Pakistan. That dream has moved miles farther. With Nawaz Sharif virtually inactive, Benazir gone and Musharraf acting as an American representative but a leader, Pakistan is in a making of being a leaderless country.

Tuesday, December 25, 2007

No wonder Amir is still the best

A must watch movie - Taare Zameen Par (Stars on Earth). I watched myself in this movie - Different characters at different times. Sensitive issues like what a 8-9 year old kid goes through is very difficult to portray and Amir has done just a phenomenal job. I would be surprised not to find this movie an entry for the next film awards.

Sunday, December 23, 2007

History of Kayasthas

2 AM in the morning and Googled the city my Family belongs to and ended up finding some interesting articles about Kayasthas: On Wikipedia and, A List of famous Kayasthas.
Its like searching the ancestry on ancestors.com. Few things earlier I had no clue about:
1. Srivastavas are originally from Kashmir near Shrivaas region of Srinagar.
2. There existed a Kayastha dynasty and they even once ruled the region we belong to. Hmm! Hmm!
3. Historic cities like Chittor and Chitrakoot were established by Kayasthas.
4. Pandya Kingdom of South India were established by Kayasthas to all the way to Madurai.
5. They ruled Ayodhya before the Raghvanshies (Shree Rama).
6. That Kayastha are Brahmins and Kshatriya together for whatever that means.
7. That they were not only traditionally Scribes but warriors too (Saxenas - Shaksena who once ruled Kabul, Afghanistan).

A few famous ones:
1. Dr. Rajendra Prasad - First President of India
2. Lal Bahadur Shastri - Second Prime Minister of India
3. Bal Thackeray
4. Munshi Premchand - One of the best Novelist of Hindi Literature
5. Mahadevi Verma - One of the best Poetess of Hindi Literature
6. JC Bose - Father of Radio Science
7. Amitabh Bachchan and,
8. Subash Chandra Bose

I don't know why am I blogging about it but a few minutes donated to some history. Enough of history, Stop! And look at the future :)

Thursday, December 20, 2007

India lifts ban on Woman bartender

India allows Woman bartenders. What else can I say but:

मुहब्बत याद न आये इसलिए मैखाने में जाना था,
जनाना हैं वहां भी अब, किधर जाएँ किधर जाएँ?

-Shayar Nawab Mirza Ashish Lucknowi

Wednesday, December 19, 2007

I kinda like Ron Paul

This story of keeping $500 from a white supremest just only raises my respect for Ron's approach to the Presidential Candidacy. A very good response and a lesson to those candidates who end up returning the donations.

"Dr. Paul stands for freedom, peace, prosperity and inalienable rights. If someone with small ideologies happens to contribute money to Ron, thinking he can influence Ron in any way, he's wasted his money," Paul spokesman Jesse Benton said. "Ron is going to take the money and try to spread the message of freedom.
"And that's $500 less that this guy has to do whatever it is that he does," Benton added.

Ron Paul has always been good to hear. And this story with $6M in a day stuff is positioning him to be one strong candidature.

Monday, December 17, 2007

How Come?

How come we approve billions of Dollars to help Iraqis "build their homes" and raise eyebrows to bail sub-prime mortgage perils?

Thursday, December 13, 2007

Disadvantages of Remoteness and problems with Space

One problem that almost all the Distributed applications suffer from is the concept of Remoteness and lookup. One of the toughest problem in Software Engineering is to design a system with a single Interface. The Remoteness of an application should be hidden from the client application. How many components have we worked on where we need to do a "Lookup"? EJB, JMS, JINI and they all suffer from the javax.rmi.Remote interface. Even though powerful but these technologies expect not only the managed domain object be of type Remote but also to do the discovery to find them. The Remoteness is a behavior of the container not of the application. The Application should behave exactly the same way with or without a specific infrastructure. Of course I don't consider JVMs to be an infrastructure, some may disagree. Isn't Serializable interface enough to tell the container(?) that the application could be Remote?

EJB3.0 addressed this issue to some extent. At least the annotations remove the requirements to have some specific remote interfaces implemented. The EJB classes can then be used in a standalone applications too.

Even JavaSpaces suffer from the same problems. JavaSpace expects the Object to implement net.jini.core.entry.Entry interface. Of course the Space has to identify an Object type. But what else does the Entry interface contribute to?

  1. Its a Marker interface that extends Serializable. This architecture pretty much blocks users to make the Serialization any more efficient than what the default provided by the JVM is.
  2. The operations read and write on a Space works similar to the get () and put () operations on a Collection. take () is a little different but can be categorized as a specialized get (). The "Space" is made logically more close to a Collection. The use of a Space should be like a Map not a Collection. A space with houses, have defined addresses. Template based lookup is inefficient. It should have been a much better design if net.jini.space.JavaSpace had extended java.util.Map interface and read () and write () were renamed as get () and put () respectively.
  3. The third problem is the concept of Discovery or Finding the Space. Why? Why should the client application know that there is a Space out there that needs to be found? Isn't the discovery a role of the container and not of the end-client's?
  4. At last what does it take to migrate your existing application to a distributed environment? Not easy with JavaSpaces. That will require a lot of changes to your application. If JavaSpace extends Map then migrating could have been a trivial task as to just replacing your HashMap, TreeMaps etc with JavaSpace.
Oracle Coherence has a better approach. Its NamedCache is not only based of java.util.Map but there is no concept of Discovery. Coherence is infact a distributed application, but by replacing the discovery by a Consensus protocol the product has made the entire architecture much easier. Even though NamedCache and JavaSpace are designed to function the same way but the design approach makes NamedCache much scalable.

PS: Of course APIs can be built on top of JavaSpace to address these issues.

Wednesday, December 12, 2007

Its my girlfriend

The beggar asked $6 for a cup of tea. Why? The tea only costs $3 said the passer-by. Ah, the rest 3 is for my Girlfriend's. Huh! You are a beggar and got a girl friend? I was not, before I met her!

Why did you marry that 90 year old? Asked someone to a 20 year old blonde poetess. First for his high Income second he has "din kam". (First for his high Pays second he has less days).

What you call if your girlfriend ends up marrying you? - Treachery.

Monday, December 10, 2007

My new hero - Tyra Banks

I do not watch Tyra Banks show. I deliberately make sure not to look Sissy in anyways and not watching a "fashion" show was always on my cards. I was wrong. I did watch one episode and Tyra is my new Hero. I always felt these skinny models have some sort of disease, they just don't know it yet. Tyra represented them. Not anymore. A healthy body with healthy taste buds is a new beauty. Please tell me girl please! That a man with a tummy looks equally handsome and I will stop my push-ups.

Sunday, December 09, 2007

Review - Speed 2007

I feel Ajaa Nachale was so better movie after watching Speed 2007. Nice songs but what a poor execution. Also, Jayed introduced himself as Sandeep Malhotra to the Taxi driver and Sandeep Arora to Gayatri Devi. And the presidential suite hahaha. Has anyone seen how a presidential suite looks like? And MI5? Give me a break. MI5 agents I am sure don't look buttery weak like Sid. In the last four bolly movies I watched - Ajaa Nachale, Speed, 16th December and Johnny Gaddaar, JG still is far better than the rest.

Friday, December 07, 2007

Review of Aaja Nachale

Aaja Nachale - A weak movie.

1. The teacher and Madhuri more seemed working for a third rated Circus instead of a Kala-Kendra where Art is worshiped. She seems for 'Sanskruti' but what kind of songs did she dance on?

2. Madhuri acted like a typical Indian who live here in US and think they are the better Indians just because their 'Rs' are more twisted.

3. Her first speech to the people of Shamli was a fiasco. No power, no substance.

4. The director could not decide if Shamli is a small village or a decent town.

5. The half hour Laila-Majnu drama was better than the rest of the movie.

6. Even though this can not be a come back movie but Dance in bollywood is back.

Google co-founder to marry

Page to marry - Wondering what took this SEARCH so long?

Thursday, December 06, 2007

Sorry NRA - You kill people.

Hawkins the teen who killed eight people in Omaha mall got the AK-47 from his Step-Father. Something seriously needs to change. How can you allow fully automatic weapons for civilian use? And if yes, how come there is no control over who would end up using it? Does the person who gave AK-47 to Hawkins not have any responsibility to what he did afterwards? Shouldn't any criminal case be filed against him? I may buy in to a theory of keeping Guns with Freedom but at least make license laws tougher and if the Gun is transferred by him/her to someone who is not a licensed user will be a party to crime if committed? If your laws end up killing innocent people then the law has to change.

Tuesday, December 04, 2007

The dream of being a Daaroga

This was an interesting true story I came across, inspirational as well equally funny. So let me blog it:

There was a small village that had a Thana (A Police Station) near by. The villagers were mostly laborers and illiterate, including the family which this story is about. The parents were very fascinated by a Daaroga (The Police In-charge) for his power, clout, lifestyle and the respect he demanded and unequivocally got. The Daaroga controlled the truth. Nothing was possible if he said 'no' and his 'yes' was a command from the God, what we see in a typical western cow-boy movie. The parents wanted their Son to be a Daaroga - Their ultimate dream. From an early age they sent him to a near-by City to his Aunt's for his education. With the inspiration of the Parents on his side, the boy was good in studies. After his graduation he successfully qualified for the Civil services and became a Commissioner. During his training (before the posting) he visited his Parents in the village. Even though happy, he did not find any relief on their faces. Something was missing and he was not sure what? As if their dreams were not fulfilled. The news of him becoming a Commissioner had spread fast. One day, the Daaroga came running to visit his family and to introduce himself. An usual arrogant Daaroga looked humble as he paid his respect to the Commissioner and his Parents. First time in their life had anybody shown any respect to them. They were not only happy but relieved. We didn't know a Commissioner was bigger than a Daaroga, said the deeply touched Father.

Saturday, December 01, 2007

At the time of Thriller

Can't believe it has been 25 years since the Thriller came out and made Michael Jackson a Pop-God. I did not hear that music the same year though. I rarely listened to any 'western' music then. But even without internet, Cable or mp3s what a reach that music had, heard it in '84 during a school fare and what a ecstatic moment that was! My first introduction to a music world beyond the shores of Bollywood. This RnB killed all other forms of music as the hip-hop returned the favor later - for a short while. And then came a series of copy cat songs in bollywood produced by some junk music producers. A new beginning of trashy music in India that lasted almost a decade inflicted further by the death of Kishore Kumar in mid 80's. But the melody is back in Bolly and Michael remains one of the most well-known faces of pop/RnB and an icon of many Hip-Hop artists. Michael is gone and oblivious to the current world. Media's trick of isolation, expectation and pushing to the edge has worked on yet another artist and remains an unpunished culprit. Either way, a salute to Thriller and Michael for the profound affect they had on how we heard our Music.

Wednesday, November 28, 2007

Spaghetti delay

1. Meeting with Director - Can you do it at 11AM? Umm No I have to catch a flight. On Wednesday how come?
2. Meeting on phone while driving.
3. Working from Airport.
4. Mechanical problem with the plane. Possibly canceled.
5. Rebooked from San Fran. instead.
6. Flight delayed.
7. Sitting at Airport and working.
8. Will arrive east coast after mid-night and have to be at Client's at 8:30 in the Morning.
9. With 3hr Time difference (ahead), bracing for a short night and red eye.
10. One day and back to west coast.
11. Vertical stack in west and Horizontal scale in east.

Question: Why burning myself? Anyone listening?

Saturday, November 24, 2007

How spicy is your spicy?

I prefer spicy food but I am particular about it. My world is somewhere in the middle though. My coat size is not 40 short, it is 40.5 short. The waist is not 33 but 32.5. My food has to be a notch up from medium but not suicidal hot. There are a very few Restaurants who understand what my 'hot' mean. Most of them just screw it up. My question always is - How spicy is your spicy? I have asked spicy and it turns out to be just medium, someplace too spicy and burning hot and a hot has turned out to be just a dull medium. I do not understand if the chef already has the curry prepared, why don't they just serve it as a taste? The question - How hot do you want? puts us in an unknown space. The body part that is not participating in that conversation is the tongue. Make it hot but not too hot. Hotter than a medium. Hold on! this is a Thai place.. Is your medium really hot? Is this a real Indian food? Do you really mean hot when you said so? Just putting the tongue in a harm's way. Something like promising a SLA and then engaging the developer afterwards.

Friday, November 23, 2007

Condemn the blasts

Three simultaneous bomb blasts killed 13 and injured 45 in the state of Uttar Pradesh. One of the cities happened to be Lucknow, the state capital. These terrorists are really becoming pain in the neck. Thoughts sometime did cross our mind to listen to what they demand but they do not deserve it. These are a group of barbaric fanatic killers and a follower of a fanatic version of the religion. There are so many soft targets to choose. States have been so irresponsible so far in handling these threats. The country with astronomical GDP has given no thoughts on employing cameras and CCTVs in sensitive areas like Airports, Train/Bus stations, Courts and Places of religious importance. You need to be more aggressive. BTW, the chronology of this attack is:

1. India captures the mastermind of a terrorist attack.
2. Terrorists plan to kidnap an Indian politician to demand his and 45 other's release.
3. The plan got busted and three Pakistani terrorists captured in Lucknow, India.
4. Lawyers manhandled these terrorists and refused to take up their case.
5. Simultaneous blasts killed 13, most of them lawyers. A terror organization takes responsibility.

Where did they deserve mercy? These people are not killing because of any political reasons, or because of injustices. If left unchecked, in future they will kill just because you do not follow their form of religion. Democrat/Republican alike, look at your left and look at your right. If you see a terrorist, could you please just beat $h!t out of him?

Thursday, November 22, 2007

Mama, when would you retire EJBs?

If you answer yes to any of the following then it is time to retire your EJBs:
1. Just because you had an Application server.
2. Because that was the buzz and talking about it was cool.
3. Everyone was using it.
4. Even if the client and the EJB are run in the same network.
5. Thought EJB is SOA.
6. EJB on the resume looked hot.
7. There was no other way you knew to expose the application.
8. Container was a magical term.
9. Believed what servlet is to front-end was EJB to the back-end?

Its time to look beyond your traditional J2EE and look at Grid computing.

Shame in the manifesto

1983 riot - Attributed to Congress
Gujarat riot - Attributed to BJP
Nandigram - Attributed to the communists

These are our only three national level parties. I don't see any shame listed in their manifesto.

Sunday, November 18, 2007

Invoking EJB from a BPEL process using WSIF

BPEL is about integration. It is about standard governed by a world body. It is about Open standards. I am helping one of my clients with BPEL integration with system interfaces ranging from JMS, Relational Database, E-Business suite, FTP/File and EJBs. And I recently got a call about HTTP posts, but thats for a later day. Oracle's BPEL process manager has pre-defined adapters for almost all the interfaces we can think of. If not, then it provides an Embedded Java Activity that can be used to write custom codes. I found some challenges with EJB. Oracle BPEL PM implements these integration using Apache's WSIF infrastructure. WSIF requires system's interface to be exposed as a WSDL. Quite powerful it is as it can be done for standalone Java APIs to services exposed as EJBs. But as lazy-ass I am, I do not want to hand-write WSDLs. Oracle has a product WSA which makes life much easier. Following are the steps to be taken with caveats and bugs/problems I ran into.

1. With every Oracle application server installation you would find a wsa.jar in the $ORACLE_HOME/webservices/lib directory. wsa.jar can be used to generate WSDL for the EJBs.

2. Problem (1): The EJB interface has to implement javax.rmi.Remote interface and its' methods has to throw RemoteException. Anyone who is familiar with EJB3.0 specification knows that its not required anymore. On top, the EJB implementation does not even need to implement any interface as long as @Remote annotation defines what interface to expect. Quite a powerful specification indeed. Unfortunately WSA needs to catch up a little. Not too behind though.

3. So if you have a fancy EJB and you have a control over its' source code, make sure you make the changes described in step (2).

4. Run the following command:


java -jar wsa.jar -genWsdl -output <directory> -wsifEjbBinding true \
-style rpc -use encoded \
-jndiName SessionEJB -jndiProviderUrl ormi://localhost:12401/<context_name> \
-initialContextFactory oracle.j2ee.rmi.RMIInitialContextFactory \
-interfaceName <EJB_INTERFACE> -className <EJB_CLASS_IMPL> \
-classpath <THE_DIR_WHERE_EJB_CLASSES_ARE_COMPILED>


5. The WSDL is generated in the directory specified. Edit the file to remove any HttpSoap ports and bindings. Another a must to note is only RPC-encoded style of WSDL has to be generated.

6. Now, in the BPEL process add a partner link and import this generated WSDL. Invoke the appropriate methods.

7. Make sure in the bpel.xml file EJB authentication/credentials properties are set for the EJB partner link.

<partnerLinkBinding name="IEJBA">
<property name="wsdlLocation">IEJBARef.wsdl</property>
<property name="java.naming.security.principal">oc4jadmin</property>
<property name="java.naming.security.credentials">admin123</property>
</partnerLinkBinding>


8. Make sure the EJB classes are in the CLASSPATH for bpel process to find out.

Deploy the EJB and deploy the BPEL process.

Problem (2):The wsa.jar does not work with EJB2.1. If you create an EJB2.1, its' interface extends EJBObject which extends Remote. But wsa.jar fails on methods it does not understand part of EJBObject. I highly discourage hand-writing WSDL for even simple interfaces, the task becomes daunting for complex ones. Of course either I do not understand something or it is an unsupported feature in WSA. Hope soon to be resolved.
Solution:I encourage to change the EJB version to 3.0 if it is under control and can sell the advantages to your business units. With little faith they usually have on its' IT, there exist a work around. With all the dislikes I have for vertical stacks we still can introduce a custom EJB3.0 deployed locally which in turn can invoke the EJB2.1 internally. The BPEL process instead of talking to 2.1 can talk to 3.0 and 2.1 problem can be circumvent.
The other solution is to use jDeveloper that has a graphical interface that lets you choose the methods you want to import. When WSDL is generated this way, you can deselect the methods specific to EJBObject interface.

British Hawk's beautiful artistry

Friday, November 16, 2007

Biden for Vice-President

In the world of politics if strong candidates suddenly starts praising someone, all it means that they want him/her out of the race and endorse them instead. After months of debates Joe Biden has found himself in the same position. Biden was never a strong candidate for the final nomination but he has the best chance to be the next Vice President of the country. And the kind of bi-partisan work he has done over the years he could end up being one of the most remarkable VP of recent years. The question is if it will be witty flip-floppy, sophomore honesty or the underdog we call Edwards as his boss? With a strong VP on their side I guess either of the three would do just fine.

Sunday, November 11, 2007

Oracle Openworld

I won't be in SanFran to attend Oracle's openworld. I know a lot of folks from my customers are attending it. My colleagues will be at Coherence table so don't forget to stop by and listen to what they have to stay. I am sure it will be a fun event.

Monday, November 05, 2007

Emergency in Pakistan or..

Musharraf knows if he goes for elections he is out. Advantage may not be to Benazir Bhutto either as it seems. So lets connect the dots. Bhutto returns and an assassination attempt shakes the entire region. Could this be a handy-work of Mushharraf too? Using this as a precursor to impose emergency in the state. Reminder guys.. he is an Army commando. He knows what he is playing against. He knows how far the world will go. Can the west live with a democratically elected Taleban/Al-Queda sympathetic govt in Pakistan? I guess not and he knows it. A few arrests here and there and he is extended for another two years. The problem is if the world does not do anything now then the people who do believe in democracy will be alienated further.

Saturday, November 03, 2007

Beautiful Niagara

Democracy tastes good. Try it!

Pakistan's declaration of state of emergency has prompted me to blog about democracy. What is it worth? I am not only passionate about the subject but equally confused as well. I always wanted to ask people who sleep on streets and barely have food and shelter of their opinion on democracy. I wonder what would they say? I would rather prefer to live in a country run by a kind hearted King who would take care of me, my security, my job, my house and all that. Why to live under democracy when this system is only about majority instead of equality?
I am a programmer by profession. I test my software under two scenarios - The best case when things are just perfect. Unlimited memory, 100% uptime, lots of CPU power etc. The second, when the application is susceptible to failures, what we call the worst case scenario. We can get more insight on applying the same philosophy to the political systems of today. What if the King or the General is not so good? What if there are human rights violations? What if the Army is used to suppress people and their freedom instead of protecting them? We can not win a war with an army can we? What options are we left with then? Not only Pakistan, we have seen this in many other parts of the world too. Even though the best-case was far better than any other system we know about, suddenly the worst-case scenario looks far more terrible. Recovery for them seems impossible and doomed.
So what is Democracy worth? For one, It never leaves you option-less. Helpless may be, may be painful at times but never option-less. You may not end up getting equal opportunities to succeed but you always have an option to gather people around your beliefs and push for a change. Opportunities may not come your way but you have an option to scream about not having them. A great fighter is the one who recovers from his fall, again, again and again. Democracy lets you recover. It smells sometime but it tastes good.

Tuesday, October 30, 2007

Earthquake shake

Had just given the credit card to the waiter and finished my dinner when the building shook. Two seconds later every one realized it was an earthquake and we all ran out of the building. A few minutes later it was all good. A few laughs and drove back to hotel.

Monday, October 29, 2007

And I swung again

Whenever I watch McCain speak I feel he has a good chance of winning the next presidential race. Obama is not doing so well, even though he is still the smartest out there. Hillary is just one mistake away but McCain has shown extremely articulated ethics and commitment to his principles. We have already seen down and out candidates winning the primaries before. With some military gains in Iraq this country can still live with a committed republican in the office. Whadya think?

Sunday, October 28, 2007

Sleep on the couch but don't buy Serta

I bought a Serta mattress about four months ago and paid $400+. Just with in these four months the bed has developed bowing in the middle and that too with a 150lb person who sleeps on that bed only two nights a week. What a waste of money. As ofcourse my 30-day return policy has expired, all I can do with it is throw it in the guest room. Buying Serta was a waste when I saw so many a little bit more pricier Sealys. So I would rather prefer to sleep on the couch than to ever consider Serta again. If still any sane Serta employee reads this please remind yourself what a customer satisfaction means.

Friday, October 26, 2007

Prime number game

I was asked to prove (n2 - 1) will always be divisible by 24 where n being a prime number greater or equal to 5. Here you go: A prime number will always be an (even number + 1) or an (even number - 1). The even number can be replaced with 2*x and the number becomes: (2*x + 1) or (2*x - 1). For n greater than 5, x > 3 and the formula will now be (6*x + 1) or, (6*x - 1) [Not the same x though]. Lets go back to the original question and replace (n2 - 1):

#For (6x + 1) -
((6x + 1)2 - 1) = (36x2 + 12x + 1 -1) = 12x(3x + 1). For any number 'x' either x or (3x+1) will be even. This means no matter what x(3x + 1) is, it will be equal to 2*M where M could be any number. So, (n2 - 1) now becomes 24*M which is always divisible by 24.

# For (6x - 1) -
((6x-1)2 -1) = (36x2 - 12x + 1 - 1) = 12x(3x-1). Same thing again, for any 'x' either x or (3x - 1) will be an even number and 12x(3x - 1) = 24*L where L could be any whole number. Either way, the number is still divisible by 24.

Sunday, October 21, 2007

Need to integrate your applications? Collapse the stack!

Each technology addresses a specific set of problems. It is common to see various functional overlaps in these solutions. In the integration world it is even more messy. Ooh Ooh Ooh! MoM, JMS, ESB, Adapters, BPEL the jargons keeps on growing. Each vertical stack adds further complexities. In many cases it may make sense, in many other it does not. Ask a few questions? Do you really have to XMLify all your conversations? Are your applications all Java, .NET or a mix? Are you overkilling the solution and performance for no specific gains?
Let me take a popular and a simple business scenario. You have a web-site and you sell your products. A user starts a shopping cart, adds some items in it and checks out. Expects a delivery and may be some contract. Now, we have three systems here, your Web-app, your quote approval and the contract system. A Quote is not very different from a shopping cart. A Contract is not very different from a Quote. That means an object which represents a Shopping cart can be mutated to a quote and then to a contract object. Now the fun part - Integration!
Instead of building a huge vertical stack of solutions, deploy Oracle coherence. Configure a Partitioned cache topology on some cheap commodity hardware. Configure 50-60 JVMs (depends on the volume to be supported) to be the nodes of your grid. Now, create three distributed Caches - Cart, Quote and Contract. Attach MapListeners on the cache your specific application will be interested in. In our example, the quoting system would be interested in the checked out shopping cart. The quote system can read this cart, apply a set of business rules and converts it to a quote. After the quote has been verified and created, the quote system can put it in the Quote Cache. The contract system does the same. Reads the quote from the Quote Cache, mutates it to a Contract. It can then put the contract in its database (Write-Behind at Close of Business day). Add the contract object in the Contract Cache for other systems to use. Any worries yet?
What if not all the systems exist in one reliable network? Do you have a .NET application sitting some place working on your objects? Use Coherence*Extend whenever you have WAN or any unreliable network. Use Portable Object Format if you worry about the serializations. Try to get rid of XML communication as long as you are okay to distribute the same application libraries. Keep your system management team lean. Take a hard look and find why this simplification won't work for you? Don't burn yourself writing XML Schema for each system. Collapse your fat stack.

Either I need a long vacation or ..

Last week I got another email telling one of my friends has left his full-time travel job, taking some time off and joining a local company. This was the fifth such email in past some 8 months. I love my company and I love traveling, it has its perks. But the travel is good when you have a home base. You go, travel, help your clients and come back and continue your job. You have one context to work on. It has been a lot of context switching for me lately. Not so physical but it is mentally tiring. It has been so that I seriously am considering retirement, marriage, buying a yacht, taking a long vacation, becoming manager, starting my own business, franchising or something different from what I am doing. When you find every next person happier than you are, it is time to rethink about what you wanna do.

Saturday, October 20, 2007

Fantastic service...

Internet has become a strong communication channel between me and my family in India. These are the festive seasons and it has been days since I had chatted with my family on a webcam and I really wanted to. It has been two days now since the connection back home is down. I called home and found out that "they" do it deliberately so that when they fix it later can get the holiday appreciation money. "They" are the telephone linemen who deliberately disable/plug-off the connections they manage so that they can ask for "tips" when they come home and fix it. The concept is the same here when you are supposed to leave some "holiday money" in your mailbox for your mailman during Christmas. But keeping the service hostage? And if thats true, what a frustrating service!

Sharing the cricketing honors

India ended the Aussie series with an emphatic win in the only T20 match they played. Even though Aussies trounced India with a 4-2 victory in the longer version of the game but I feel the honors were equally shared later with India winning 1-0 in its' shorter version. India even came very close to make the series 3-3 before the middle order had scrambled the advantage its openers provided in the 6th game of the series. But they did come together and won the last two games they played. Its surprising to see Indian team enjoying the shorter version of the game without Sachin, Ganguly and Dravid. Had Dravid been any closer to his abilities the result could have been even better in the 50 overs game. Good to see Gambhir continuing his form. Surprisingly no body talked about Dhoni's six off Brett Lee's first ball of his last over and sealing the game off. That was a good end to a gruiling series for both the teams.

Friday, October 19, 2007

Recipe for survival for GM/Ford/Chrysler

#Ford:
1. Launch a Hybrid for Mustang
2. Keep Mustang/GT, Taurus, Fx50 and Explorer. Retire the rest.
3. Offload Jag and Rover.
4. Strengthen Volvo further.

#Chrysler:
I don't understand why should this company struggle?
1. Keep the technology coming from the Merc's.
2. Push the HEMI and the Charger further
3. Cut gazillion models of Jeep. Keep the existing models and improve upon it.
4. Don't launch too many models. Do not confuse the customers.
5. Get the new Diesel engine.
6. Start a compact hybrid.

#GM:
1. Continue on heavy machinaries.
2. Pontiac needs an extra push.
3. Launch something soon on the Hybrid research your labs have been doing.

Friday, October 12, 2007

Nahane ka kya?

video

Zagua 神谕

Monday, October 01, 2007

The news from the past week

1. Britney loses the custody - Thanks Kevin the super jerk and play safe manipulator for destroying a perfect life.
2. Handcuffed Mom's death - Airlines can get to your nerves. They behave as if they are doing us a favor for letting us in. I can perfectly see the reasons for Mrs. Gotbaum agitation. Some can control it and some cannot and its important to handle these "agitating-reason-driven-reactions" in more humane way. To maintain calm at that airport gate should have been less important than to make sure a life could be saved.
3. Putin for PM - A weird concept indeed but let the people of Russia decide.
4. Unrest in Burma - Where are the champions of democracy now?
5. Outcry on McCain's Christian comment - Isn't that true? And how come is this truth derogatory to any other religion practiced here? US may not be a Christian nation but its' constitution is certainly influenced by the teachings of Christianity same as Saudi Arabia being built on top of the human dignity as described in Islam. And thats even an official Islamic nation. Stop whining.

Friday, September 28, 2007

Coherence - A reminder to self

Coherence is not about speed. It is about (horizontal) scalability and a very predictable performance. And, its system of records is the cache. The rest are reactive components.

The horoscope of the day

As I continue to not believe in horoscopes, here is one I saw which made me curious how the heck does he/she know?
" This is a good day to start listening to your body, ASHISH. You tend to push yourself very hard. It's quite possible that you always feel a little tired or run down. This could be for one simple reason. You need more sleep! If you are used to sleeping only six hours a night, start scheduling eight hours. Your body might need more time each night to repair and rid itself of toxins."

Thursday, September 27, 2007

Kids misadventure and a reunion

The pretext of the story is we had lost communication with a good friend of ours (Ex-Sun too), when he decided not to respond to our voice mails or emails. It was not just for me but to the entire friend circle and we had the suspicion of this being deliberate. The reasons known only to him.

Today, My Mom calls me from home asking if I had called her. It was already night and I thought it was some advertising solicitation call. I checked on the website and the number was (508). Coincidence, this week I am in Boston too where the call came from. Hmm, somebody might be trying to reach me I thought and called that number back which I rarely do unless there is a voicemail. Found, he has moved to Boston, has bought a house and his kid had "accidentally" dialed the number. After a few embarrassing moments and a few lame excuses he invited to visit his place. It will be fun to visit him and see him "caught".

Tuesday, September 25, 2007

Coherence Contd. Listening the cluster

I am assuming my other blogs related to Coherence has been read. The nodes in a cluster are also called Members. Like Cache events, cluster also generates events when a Member joins, leaving or left. Say, if we need to clear some of the resources if a Member leaves or dynamically increase the pool size of a resource when additional members join in (I don't know, I am just making the requirements up!). Here is a sample code showing where and how to do it:


NamedCache nCache = CacheFactory.getCache ("Cache");
nCache.getCacheService ().addMemberListener (new MemberListener () {
final Member local = nCache.getCacheService ().getCluster ().getLocalMember ();
public void memberJoined (MemberEvent evt) {
// -- The Member which the event is associated to
Member eM = evt.getMember ();
// -- Do the fancy stuff
}

public void memberLeaving (MemberEvent evt) {
}

public void memberLeft (MemberEvent evt) {
}
});


And thats it again!

Sunday, September 23, 2007

Is this an end of Sachin and Ganguly era?

Cricket has a new form - The Twenty20: Fast, exciting and rapid fire. T20 tournament has been a success and is seems the future of the world cricket. This form of the game has also exposed some of the weeknesses of Aussies, the undisputed champions otherwise. For India, Dhoni and Yuvi have led the team to excellence. There is a new blood, new enthusiasm and the killer instinct which had died after Chappel took the reigns. T20 finals is also a message to not write off this sub-continent yet. For India, a win in the finals will be bugle of a new young team and an opportunity for stalwarts like Sachin and Ganguly to retire from the active ODI duty.

Thursday, September 20, 2007

The Presidential Candidates

Hillary - Buy one get one (Bill) free.
Obama - I am sick, I am sick, I am sick.
Romney - So what if I look rich?
McCain - Atleast listen to me!
Giuliani - Presidentship is scope creep.
Edwards - Hang on, the rest will falter.

Wednesday, September 19, 2007

Tell me why?

BBC ran a story on the ever elusive Green card. Here are some scripts:


**When Pankaj Kakkar sang the American national anthem on the Capitol Hill lawns,
Congressman Jim McDermott commented: "Son, you sing it better than me."

Unfortunately, this compliment does not take Mr Kakkar, a computer professional
working for Google, any closer to the Green Card dream he has been chasing for the
past 11 years.

**Meenal Sinha says not having a Green Card means you have to stick with the same
company that got you a work visa - and that means fewer promotions and salary rises.

"We have given the most productive years of our careers to this country. We have
always played by rules, yet this endless delay," she says.

**"It's so embarrassing when our peers ask, 'You don't have a Green Card yet?',"
says Niti

**A study by Harvard University warns of "increasing frustration among skilled
immigrants who have to wait for years for a permanent residency".

Thursday, September 13, 2007

Coherence Contd.. Some more things

Oracle Coherence is all about [Fast access to Coherent] data. Having said that lets dive a little deeper. I came across a funny definition - It is the costliest implementation of java.util.Map. Coherence is also a Data Grid. Its a Data Cluster solution. The nodes in a cluster can partition data among themselves and provide access to it. It won't be possible to use any off-the-shelf Map's implementation in particular partitioned cache strategy. Why? Take the fastest data-structure for Map.. Its java.util.HashMap. To access data from it we either need a key or iterate through it. You can not Query the data like SQL does on database tables. Its also an event-less data structure. Wouldn't you like to receive events if the data has been updated or Inserted or removed? HashMap could not do that. There are also concurrency issues in a Clustered environment. Hmm, it so sounds like a database table. Even though logically but actually it is. When we talk about data in a networked environment, we should also talk about latency. One of the strongest features of Java is to move the code/processor to where the data are. Anyone remember Java Applets? Instead of passing data to the processor, the Code can be downloaded to where the data are. What does it buy us? Ask the System Administrators who manage hundreds of nodes spread across slow and unreliable network. The network latency kills applications.
Now lets talk about Coherence' most important APIs. If you had read my earlier Coherence blogs: this and this you already know how to use NamedCache. com.tangosol.net.NamedCache implements java.util.Map. Why? Because its a Cache and you would need functionalities like get and put. But, here is the difference - it also implements other interfaces like:


  • com.tangosol.util.QueryMap

  • com.tangosol.util.ConcurrentMap

  • com.tangosol.util.ObservableMap and,

  • com.tangosol.util.InvocableMap.


Rang a bell yet? Aren't these features required in a Clustered data grid? Thats what makes Coherence' NamedCache the costliest implementation of java.util.Map. Costly in a sense for features you would like to pay for.
I tend to blabber much before the real thing. So You already know how to use the Cache and Query the cache. If you have followed my sample codes before you know how to populate data in the cache. We have Objects in the Cache now, and we need to use it isn't it? What do you use data for? Just to access it? Yes but not necessarily always. You want to do computation on it. You may want to do some mathematical operations on the Objects or its' attributes. Lets take an example of a Student database. You may wanna know whats the average age or height or weight of your students. And why not? You may want to compete against the strongest football team in the league and you have to know these stats before you sign up. To do these computations, Coherence provides an API called Aggregator. The concept is simple, provide a set or a subset of data to your Aggregator to do computation on. Oracle Coherence provides a ton of off-the-shelf implementations for AbstractAggregator. The following sample code uses one of them - A AbstractDoubleAggregator.

Lets say, your Serializable Object is the following:

#SClass - Student's class
public class SClass implements ExternalizableLite {
private int height;
private String name;

public SClass() {
}

public void setName(String a) {
this.name = a;
}

public String getName() {
return name;
}

public String toString() {
return name;
}

public void readExternal(DataInput dataInput) throws IOException {
height = ExternalizableHelper.readInt(dataInput);
name = ExternalizableHelper.readSafeUTF(dataInput);
}

public void writeExternal(DataOutput dataOutput) throws IOException {
ExternalizableHelper.writeInt(dataOutput, height);
ExternalizableHelper.writeSafeUTF(dataOutput, name);
}

public void setHeight(int height) {
this.height = height;
}

public int getHeight() {
return height;
}
}

So, if you want to take a Sum of the heights of your class for the students with name starting letter [A]... What do you do? You know it. You create a Filter...

NamedCache nCache = CacheFactory.getCache ("Students");
// -- Populate the data
...
Filter filter = new LikeFilter ("getName", "A%");
Set keySet = nCache.keySet (filter);
// -- Now what? The keySet has a Set of Students with names starting with A
Double result = (Double) nCache.aggregate (keySet, new CacheAggregator ());

Now, what is this CacheAggregator? CacheAggregator is the implementation of
AbstractDoubleAggregator and here is its code:

#CacheAggregator:
import ....
public class CacheAggregator extends AbstractDoubleAggregator {
public CacheAggregator() {
super(IdentityExtractor.INSTANCE);
}

protected void init(boolean b) {
super.init(b);
m_dflResult = 0.0;
}

protected void process(Object object, boolean b) {
if (b) {
// -- What the heck is this? Scroll down for the explanation
m_dflResult += ((Double)object).doubleValue();

} else {
SClass sC = (SClass)object;
// -- Keep on adding the Heights
m_dflResult += sC.getHeight ();
}
}

protected Object finalizeResult(boolean b) {
return new Double(m_dflResult);
}
}

So, what does it do? When the aggregate () method is invoked on a Cache, the process () method is called for each Cache Entry in the keySet. The example is a little tricky. Why? Usually the input and output types for an Aggregator are the same. You provide a Student and you get a Student. In this case, you are providing a Student but at the end you are expecting is its' height. Input is SClass but output is a Double.

And here you go.. By using this example you can build more complex Computations on on your data Objects.

The issue of Adam's Bridge or Ram Sethu

A new issue has been cropping up in India around the historic Adam's bridge or Ram Sethu between Southern India and Sri Lanka. There was a myth (?) that to fight off an evil King Ravana, Lord/King Rama and his army built a floating bridge over the ocean. That myth seemed right when NASA took some pictures and found a similar structure submerged in water. Indian government however has been working on a new maritime route for past few years which will require to destroy "that" structure. Archaeological Survey of India has given a new statement recently that on Historic grounds existence of Lord Rama can not be established. The books like Valamiki Ramayana and Tulsidas' Ramcharit-Manas can not be considered as historic artifacts. I am not sure what can be considered a historic artifact? Geographically, story of Rama has spanned from North to all the way to Southern India. The temples and other places of evidence found are so interconnected that its highly impossible that this being mere an imaginative story. The numbers could be wrong. It may not be even a bridge or not built around the same era, or a natural extension of the Earth mass, even the concept of a "Year" could be wrong but I don't think there should be any question regarding the existence of an Aryan King Rama which Hindus consider an Avatar of Vishnu. We should be dealing with these issues the other way round though. Instead of asking if Rama existed, prove that he did not. If can not then the beliefs of millions of people should be respected. Destroying the structure will not negate the importance of Rama in Indian social and religious lives but keeping it will only strengthen it. And besides, don't give the political parties an opportunity to make this a national issue.

Monday, September 10, 2007

Single liners

1. If Barack does not succeed then Romney has already won.
2. Want a BMW? Get your car detailed. You can keep your dreams alive this way.
3. Its better to struggle with technology than with products.
4. If you call a Horse a donkey and a Mule a horse, what would you call an ass?
5. I even tried with the jar twice in the CLASSPATH.
6. Don't keep the bread runners unfed.
7. If your Dog wants to say something then listen to him.
8. If he was that stupid why was he elected twice?
9. Dye Osama dye.
10.Don't tip your manager for his/her work. He already earns more than you do.

Saturday, September 08, 2007

The irony of Osama's videos

The numerous videos released by Osama in past 6 years have gone down from Horror documentaries to Comic skits. From "Oh My Gosh, he released a new Threat" his messages have transformed to "What the heck is he saying now?" or "Darn is he still alive?". His new call for Americans to convert and relating it to the Iraqi war is not only ridiculously insane but hysterically funny. I am not sure if he asked the 19 of his terrorists to count the number of Muslims in the WTC before realizing their heinous crime. Somebody please tell him, the combined earnings of NFL and NBA players of Muslim faith is far more than the GDP of most of the countries his organization operates from. The only irony is even after six years of 9/11 and billions of dollars spent, he has still managed to buy a shit load of magnetic tapes, a video camera and a few packs of hair dye.

Thursday, September 06, 2007

Coherence Contd.. Querying Cache

One of the features of Coherence is that it provides a "Queryeable" data structure. So if you followed my last blog you already know how to populate data in a Cache. A Cache is typically like a Database table and only one "type" of values should be stored. Even though a Cartesan product can be implemented (Storing two types of data in the same table) but should be avoided. Assuming the Cache service is running and has data in it, the following class shows how to use Filters to make a Query. It is important that the Cache does have data in it and not expired before the query can be run against it.


package com.ezduck.coherence;

import com.tangosol.net.NamedCache;
import com.tangosol.net.CacheFactory;

import com.tangosol.util.Filter;
import com.tangosol.util.filter.LikeFilter;

import java.util.Map;
import java.util.Set;
import java.util.Iterator;

public class QueryCache {

private static NamedCache nCache;

static {
nCache = CacheFactory.getCache("Name");
}

public QueryCache() {
}

public static void main(String[] args) {
QueryCache queryCache = new QueryCache();
// -- Look for Names which starts with A
Filter filter = new LikeFilter ("getName", "A%");
Set set = nCache.entrySet(filter);

Iterator iter = set.iterator();
while (iter.hasNext()) {
System.out.println ("Val: " + ((Map.Entry)iter.next()).getValue().toString());
}

}
}


And Thats it!

Tuesday, September 04, 2007

Hamare Hockey mein Chhakke nahi hote

A must watch movie for Bollywood lovers - "Chak de India"

Monday, September 03, 2007

CPI, Please explain

After opposing the Indo-US nuclear deal, the CPI and its isotopes are now opposing a joint Naval exercise in the Bay of Bengal with the Quad members which includes India, US, Japan and Australia along with Singaporean presence. Now, Could CPI explain this action? Why do their nerves get ticked when it comes to China? Do they report to 1450 Kms west or 3200 Kms North? And for their own records, just a few months back India and China conducted a joint naval exercise.

Sunday, September 02, 2007

Problem with Google's algorithm

Here is a Google Ad that appears on my Blog on Barack Obama. The Ad is exactly opposite and demeaning to what I write about him. All of my blogs on Obama has mostly praises and appreciations with some constructive criticism on him. So, instead of similar sentiments, what does the automated Google Ad show? "Obama exposed!". Is their Grammar analysis tool all screwed up? I think their Researchers are missing the point with counting words and index driven popularity rankings. They are efficient in analyzing single Sentences but seems failing miserably on how Sentences join to create one Sentiment. How difficult is to implement the following?


Read the text (Like the blog(s))
Find the Subject (Like a Person)
Break the text in individual sentences
Create Two maps - Positive and Negative
Analyze each Sentence, Rank the words and fill the maps.
Look for words like "All I said", "Aforementioned", "Contrary to what I said", etc
and add a weight to the Map entries.
Count the entries in the map.
If one is higher than the other by 80%, then find a Positive Ad or vice-versa.

Monday, August 27, 2007

Coherence is suspiciously easy to use

Do you need fine grained control over your Cache? Do you need advanced cache management? Do you need cache partitions? Then Tangosol Coherence is for you. The cache objects must be Serializable or Externalizable. Because of the high performance, Oracle recommends to use ExternalizableLite instead. So here you go:


#The SClass to cache
public class SClass implements ExternalizableLite {
private String a;
public SClass () {
}
public void setA (String a) {
this.a = a;
}
public String getA () {
return a;
}
public String toString () {
return a;
}

public void readExternal (DataInput dataInput) throws IOException {
a = dataInput.readUTF ();
}

public void writeExternal (DataOutput dataOutput) throws IOException {
dataOutput.writeUTF (a);
}
}

# Now how to use it?
public class CacheClient {

private NamedCache nCache;

public CacheClient () {
nCache = CacheFactory.getCache ("Name");
}

public static void main (String[] args) {
CacheClient cacheClient = new CacheClient ();

// -- Put the Object in Cache
SClass sC = new SClass ();
sC.setA ("Srivastava");
cacheClient.putValue ("a", sC);

// -- Now retrieve it
System.out.println ("Entered: " + cacheClient.getValue ("a"));
}

private void putValue (String k, Object v) {
nCache.put (k, v);
}

private String getValue (String k) {
Object obj = nCache.get (k);
// -- Assuming the Object was added in the Cache and not expired
// -- More details on Object expiration later.
return obj.toString ();
}
}

Thats it! And you get a high performing Caching infrastructure.

Saturday, August 25, 2007

How about Java Microsystems?

SUNW is changing to JAVA starting this September. According to Jonathan people know Java more than Sun. He is right. I met a few people in the Industry who said Sun? What do they do? I am not an admirer of those folks but they do exist. But the question is, Is Sun left with only Java to identify itself with? Is this an indication of Solaris losing to Linux? How about their hardware business? Why did they buy the Storage? Its confusing as Java is not well integrated with them all yet. Even though I agree with this move, but with no leading Java products, I am afraid if the shop called Antique be selling the scrapes.

Friday, August 24, 2007

Zen Vision not found in Explorer?

I had to reinstall my XP and found my Zen Vision M was not recognized to be connected in the creative source explorer. Even though the USB was working. Here is the solution: Go to the Control Panel and double click on the System. Click the Hardward tab and click on the Device manager. Probably the player is either listed under Unknown or some place mismatched. Right click on it and go to its properties. In the details, select the Hardware Ids. Note the first line and find the number (strip all the characters and symbols). Open the Windows registry (Run regedit). Go to HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> UsbFlags and delete the key(s) matching that number. Connect the device again and look at the device manager. If you see the device under the Portable Devices with an yellow exclamation mark, double click it and select to reinstall the driver. That should fix it.

Monday, August 20, 2007

CPI - The biggest shame in Indian Politics

The communist party of India and its other isotopes are opposing the Indo-US nuclear deal. They are threatening to pull the support from the Congress government. I am no supporter of Congress either but here are my thoughts on CPI-X. They have done nothing constructive for India in last 60 years and before. They are still battling if after the downfall of USSR and Chinese quasi-capitalism, "Communism" remains a viable philosophy . They have destroyed the city of Calcutta, once the lead metro of the country. They have encouraged illegal migration from Bangladesh by not taking any strict actions. Its party workers resort to violence in the name of civil rights. I have to give one thing to them though: When the communists have failed all over, they have spread their wings in India through coalition politics.
So why are they opposing the nuclear deal? Is it them or their philosophical masters who did not like the word "US" in it? Do they seriously oppose the deal or opportunity has given them a chance to play the support card? Whats the clause they did not like? That India has to give back the technology if they do another nuclear test? An estimate say that India already possesses 100+ nuclear bombs in its arsenal. How many more do you need as a deterrent? There is no stopping the laboratory tests or improving it or even making many more, or even physical tests for that matter. There will be a cost India has to pay if they decide to go though. If guys remember, Scientists had said India had enough test data after the 1998 blasts that they could use it to improve the design and delivery systems. The only unwritten adage is a possible arm twisting of the Indian Foreign Policy. The country should be politically matured to deal with it. That twisting goes between US and Russia and US and China all the time. Then why should India show its political immaturity? Do you need bombs to eat or energy and growth for your people? Ah! the growth of People which CPI has never cared about.

Tuesday, August 14, 2007

Found an admirer of this name

I have been having trouble with my Dell laptop for past couple of weeks and had been in touch with the Dell support. Today I called them again and here what I hear:


Support: Hello My name is Rachel, how can I help you?
Me: Yes, this is Ashish.. <interruption>
Support: Oh I know you
Me (Thinking): Huh?
Support: You remember last week I talked to you.
Me: Aa..Oh yeah (I partially lied - I remembered something)
Support: <Elated>Yeah I named my Video game character Ashish.
<Repeats> Ashish.. Shish.. Ashish
Me (Thinking again):Hope the character was not a cartoon
The rest of the conversation continues...

What was the chances of this happening?

Happy Independence Day India

India is celebrating its' 60th Independence day from the British Raj. It has come a long way in relatively a very short time. The world is going ga-ga about its 8-9% growth. It has proved itself to be politically stable and reliable nation. The context of India-Pakistan has now changed to India-China. Without any major experimentation the democracy has so far proved to be an ideal system for its' secular citizens. But where are we really? What does this growth mean to us? Yes, today pretty much all the International names are on Delhi's and Mumbai's streets. Finding latest cell phone models is easier in the corner shops than on Cingular's US website. The Air travel has become more prevalent. The school kids use more American slangs than I even bothered to know. The government knows that using Nuclear technology to produce energy is more important than making bombs. The land prices have doubled. Delhi feels more closer than ever. But what about the poor? The illiteracy rate is still bad. Clean water and sanitation services are still not available to everyone. The rich have become richer but the life of average, sub-average and poor has not improved much. The life of middle and lower middle class has been squeezed between materialistic aspirations and the corrupt realities. Even though the realizations are harder but the dreams are more, and I guess thats one positive thing which came out of it. Still a long way to go but the country is definitely on the right track. Hope its' growth permeates to the general masses. Happy Independence Day India.

Monday, August 13, 2007

Dravid spoils Kumble's century

...Or so I believe. Dravid could have enforced a follow-on on England and hoped to save three quarters of the 5th day to fend-off the English bowling either in a Victory or a valiant draw. But he didn't. I am quoting myself off of a comment I posted on Pri's blogs: "Dravid being a visionary saw an English victory, on defense he saved the Test very methodically. He got on to back foot and drove the result to the long off draw".

Sunday, August 12, 2007

Wednesday, August 08, 2007

Obama - Sincerity in being wrong

With every debate, my respect for Obama has been increasing. Hillary keeps on proving her opportunistic astuteness. This time on what should US do if they sight Bin-Laden in Pakistan and Musharraf refuses to act? Simple question. Yes Musharraf is standing strong and we need to support him, but should he be the only hope? For US, Is Musharraf an ally or is Pakistan? And what did Hillary say? "Don't say it out loud even if you meant it". What kind of openness is that? How does killing a global terrorist a breach of country's sovereignty? If He is sighted in London's waters and Mr. Brown fails to act, wouldn't US go and do this job alone? Didn't US forces kill Natzis in France? Was that a breach of French sovereignty? Aren't we at war together? Then whats wrong in what Obama said even if its politically wrong? Are we sleeping?

Friday, August 03, 2007

Obama - A Nehru In America


I wanted to title this blog "Obama - A Gandhi in America" but as I finished reading his book "Audacity of Hope" I realized he is more close to Nehruvian views than Gandhi's resolve. All the 362 pages of his book I felt as if I was reading about India, its struggles and its problems. And if Americans, you don't think he is fit for being your next President then please allow me to borrow him for five years for India. I wish if the job of Presidents can be reverse-outsourced. I watched the last Democratic debate and how Clinton supporters have been over joyous to prove naivety of Barack. I want to complete the sentence which Obama did not say - "I am not averse to talk to the leaders of Iran, Cuba, Syria and N. Korea in my first year of the Presidency, not because of the weakness but because the citizens of these countries can not and should not wait that long anymore". A tree full of fruits usually lean towards the ground.
Anyhow, why Nehru and not Gandhi?
Gandhi never cared about a position in a political system. His playground was social justice which reverberated into India's political freedom. Obama's social cause is not entirely free from his political ambitions. He has Nehru's political astuteness, clean but dreamy.
My disagreements
I did not agree to everything he has put in his book. First, I got confused of what the Senator calls to being an American? He compared the Asians and East European employees working in Google with the employees of Maytag's manufacturing unit. I don't see why they both can't be called Americans? I do see his pain of this imbalance but I don't see why he can't be proud of those Asian or East European Americans working in Google. Also, Its not the China beating America, but the Chinese Americans getting ahead in the Black and White America. The second he tend to criticize the "Non-Aligned Movement" of 1950's. We lest not forget that it was the crazy ambitions of two super-powers which held the entire world hostage. When the countries were asked to be either with us or them, it took a lot of courage and belief to take the middle path - A non-aligned position. The third, his generalization of poor professional ethics of African Americans. My experience has been far different. Whoever I have worked with so far had tremendous work ethics. I am sure he has seen many more.
So who is Obama?
He is one person who is genuinely serious about solving the problems as they exist. He is not shy of admitting the struggle with some of his ideas but you can't deny he does think about them. His views of the current socio-political situation comes directly as he has seen through his own experiences and his own eyes. He is as passionate about his work as he finds his calm retreat with his family. He is a devout Christian but not blind to not see goodness in other religions including Islam or Judaism. His foreign policy is based on trust and not military influence. He wants to spread America not in the numbers of Marine corps stationed but with the core American values of freedom and equality. He is young and has dreams.
Whats Next?
I don't know if he will be the next President of United States of America. But, he does have a loooong political career ahead of him. He is running for the highest office when his political career has just started. It will take him a long way. I will be happy if he wins but won't be sad if he does not. He has already scored a point and touched so many hearts. He does look like Gandhi but has grass root growth of Nehru's vision. Either way, he is a good man and every American should be proud of the fact.

Wednesday, August 01, 2007

Why I love watching Seagal's movies?

...Because they come closest to a song-less Bollywood Movie. Be it Above the law, Hard to Kill, Out for Justice, Under Seige, On deadly ground, Glimmer man or the Fire down below, all good "throw your brain out" movies. Thanks AMC for throwing one every day.

Saturday, July 28, 2007

I am disappointed with HP

Bought a HP Pavilion laptop a couple of years ago and as the first year warranty got over, this notebook started giving problems.
1. The battery used to get too hot and the system started getting shutdown.
2. I called HP and they told me the system was out of warranty but upgraded the BIOS and asked me to run some Power routines. Neither of the two helped.
3. Just to send the laptop for them to look at would cost me $100 plus whatever fix they do.
4. I opened the section close to the fan and found a lot of dirt/lint which might have been blocking the free flow of air. I cleaned it and the system seemed okay, for a while.
5. It boots and immediately shutsdown if I login.
6. Sometimes just keeping the system running without logging-in shuts it down.
7. The system only boots in the Safemode.
8. Even if the system comes up sometimes, it shuts down in just a few seconds of Symantec virus checker, if run.
9. It boots up right If I remove the power cord and run the system just on the battery power.
10. Looks like something related to the power controller, not sure if MB has a problem.

Overall, my experience with HP has been very frustrating. The so called "cheap" laptops do not turn out cheap anyhow. I have seen a little pricey IBM Thinkpads running for years even if they were dropped on the floor. I only thought HP sucked in the Unix server market but they do in the laptops too. Not sure someone from HP ever reads my blogs and only if they had genuine desire to help its customers.

Monday, July 23, 2007

Is Edwards running for Vice President?

My prophecy... Edwards is seems readying himself to endorse Hillary at some point and rather being a strong Vice President candidate of Clinton's.
BTW, the best answer from Democratic debateBy Sen. Obama: Most of us on the stage can accept to live on minimum wage because they have plenty.

Saturday, July 21, 2007

India elects its first female President

First of all congratulations to Dr. Pratibha Patil for being the first female President of India. I would have liked to see Dr. Kalam re-elected but I guess he was not a Congress' loyalist. Good for him, he has better things to do. There is also a rumor of Dr. Ansari, an ex-Foreign Service officer, an Ambassador and a Padma Shree awardee to be nominated for Vice President. All accomplished and qualified nominations. The twist to all these is, in recent times Hindu Males have miserably failed in Indian Politics. There is no credible face appearing from the Indian National Congress, Anyone left from BJP is more or less look and sound fanatic or stupid. Left front has never had any credible central figure (God forbid if they produce one) and we would not want to go back to the regional politics of early 90's. The failure of Atal as a Prime Minister (Yes thats true - What happened in Gujarat was a national shame) has had long term affects on the local Indian politics and is going to be a trend for many years to come. But its good in many aspects too. Patriarchal hindu society has not been very successful in recent history. It has failed to address dowry and casteism - the two biggest evils facing the present Hindu society. Even some of the religious heads have turned out to be corrupt. Its an old Indian saying if the family fails, let the Mother lead the house.

Friday, July 20, 2007

The July'4th conversation

...With someone [A]


A: So you don't have to go to work today?
Me: No its off because of July'4th
A: Its US' Independence day, right?
Me: Yep
A: So are you planning to do anything today?
Me: I dunno. May be go to Cape May, a tourist town.
A: So how old is American Democracy?
Me: I guess more than 250 years old.
A: Vow! India is like a baccha (kid).
A: Who was Martin Luther King?
Me: He lead the Civil Rights Movement here. African Americans didn't
have voting rights till 1965. Read his books he is very respected.
A: So were they Migrants?
Me: Yeah, but not like me on a Visa. They were American citizens.
A: Huh? They were American citizens and had no voting rights?
Me: Yep.
A: Then really America got its independence in 1965 right?
Me: Huh?

** I had no answer **

Two weeks later I have started to think thats what matters right? To continuously re-invent yourself? Getting independence every now and then? A free flowing water never smells bad.

Thursday, July 19, 2007

10 thingy about Me

[Have been tagged so have to disclose 10]:
1. I love dark Red, Navy blue and Military Green colors.
2. I have started working thrice on products which I thought were great ideas. Never completed them and later found highly publicized products being launched by bigger companies. I found, its something to do with common problems.
3. I don't like thin and skinny models.
4. I love Dogs (except Pit Bulls) and thought to get one twice in last 10 years.
5. I hate arrogant people.
6. I am an impulsive shopper. Love to go to Garage Sales and Flea markets.
7. Simple little things move me. Would not care about the house but a well made table lamp.
8. Greencard is one issue that touches my aching nerve.
9. I was a very sharp Chess Player in my childhood. Now, I am scared to look at it.
10. I avoid taking any written exams.

Tuesday, July 17, 2007

The bus this close...

was dangerous.... I had to shoot!

Monday, July 16, 2007

Google Cookies - U care?

The Google cookies' will now be deleted after two years of the visit instead of year 2039 as was set before. Do you care? If Privacy is an issue, you can always go and selectively delete all the cookies of Google from the browser. And what does a cookie do anyway? It can only keep track of your Googlization and nothing else. And what if the cookie expires after two years? Are you not planning to visit the site(s) with in the two years of the first surf? And even if you don't, the cookie (A text entry) is not going to collect your "private" data and send it to the Google. Why to perceive a cookie as an "evil" empire? Are we inherently fearful or what? The evil empire would know what my surfing habits are... Big deal! Doesn't your local grocer know what you buy?

Wednesday, July 11, 2007

Met Elisabeth Von Trapp today..


Went to a Symphony Orchestra today and saw Elisabeth Von Trapp sing. Met her later and got her autograph. I think everyone remembers Maria Von Trapp and Sound of Music, don't we all? Elisabeth is her grand daughter and sang songs like "My Favorite things", "Kaiulani" and "All I ask of you" a duet with Michael Hope. A powerful voice and a lovely evening.

Tuesday, July 10, 2007

Godfather in Gorakhpuri

Not for my English friends. WTH, its not for all of my Indian friends either. The story is in a local dialect we call Gorakhpuri or simplified bhojpuri. Here it goes:

एक थो एकदम्मे बड़ा माइकल कहिके गुंडा रहल. एकदम्मे टॉप का गुंडा. बहुते पैसा, पॉवर बंगला गाड़ी रहल उहके पास. खुदा सब दिहले राहिलें पर ऊ एक बिटवा चाहत रहा. बिटिया रहिल पर ओकरे मन में ई खटका हमेशा रहत रहा की ई सब जमीन जैदाद के समल्हिये? बिटिया एक दम्मे बौड़म. कुछ जानत वानत नहीं रही दुनिया दरी के बारे माँ, बस एक लोफ़र टाइप के लर्कवे से मुहब्बत करत रही. पर उकरे दुश्मंवे सार चुप थोड़े ही रहले. ऊ पूरा परिवार निकलत रहा पूजा पाठ करिके, फिर ऊ गोली ऊ बारूद चला की का बतैयें. मैकलवा तो झुक के बच गईल, बिटिया के मालूमे नहीं चला की का होवत रहा, बस गोली लाग गई और ऊ तो वहीँ ढेर. ओकरे बाद माइकल ऐसन रोवा की का कहें. बाकी मंनैवे भाग लीहन, ई उधर ऊ उधर. ऊ लरकावा भी गोली निकार दौड़े लगा पर सब भाग गइलें गाड़ियाँ से एइल रहलें. एकरा पूरे खन्दन्वेइ सार गोली बारूद गुंडा गर्दी में रहलें. ओहका बाप भी बहुते टॉप का बदमाश रहा. बुढ़ा गैएइल रहा फिर भी सार बतावत रहा बिटवा के की का करत चाही का नाही. ऊ तो शुर्वात्ते में कट-पीस बेचत रहा गली गली. और ऐसन भइल एक दिन की एक मोहल्ला में रहत रहा भाई करके, ऊ हफ्ता वाफ्ता वसूलत रहा सबसे. ई बेचत रहा कपड़ा की इहके मिलल ऊ और पुछलस काहें पैसा वैसा नाही भिजवात रहा टाइम पे. पर ई तो एक दम्मे गरम मिजाज. पैसा वैसा बाद माँ ई तो ओकरे ही गोली दाग दिहिस. फिर का? सब बड़े भैयी बड़े भाई हो गैयिलें. एक्कै अंतर रहा ईहमे और उहके बपवा माँ, बपवा सार मानत रहा भाई, दोस्त. लइकवा त सबके मर दर्लस। न भैयी देख्लाल न बंधू, जेके मन से उतर्लस बस ठोंक दिहिस. यी पाप कहाँ जाई भैया? सब उहके बिटिया के मिलल.

Friday, July 06, 2007

Voice in Opera

I liked two features in the Opera browser, first the way selective history can be removed. Not sure, why Mozilla or IE has not done it yet. The second was its' Voice enabled browsing. I am a little disappointed when I try to enable the voice. It keeps asking me to download the binaries. Even after the download and install, the browser keeps asking to redownload when the feature is enabled in the perference. How stupid can a browser be? The other problem is how the Java is handled. I have JDK1.5 and any applet is never shown. I am sure there are resolutions to these issues but because I have so many other options, Mozilla, Safari and IE7 I have no reason to put my time on Opera to fix these issues. So I am almost ready to uninstall it and free up about 20MB of space.

Wednesday, July 04, 2007

Why Mitt Romney has a chance?

I do not have a voting right here so I can be an independent non-prejudiced eyes. I started as and still a big fan of Obama. But lately I have been analyzing why among this group, Mitt Romney has a much better chance.
For Obama I think he is peaking at the wrong time. I don't think he can secure a good support among the traditional southern votes. When it will matter, Obama - A great thinker, a visionary and an assertive and no-dirty politician will easily be looked as just one strong African American leader. Would be bad, but..
If Hillary wants to get serious she has to get out of Bill's shadows. Bill's mentioning "My Wife" in Iowa for Hillary did not help either. Its true, but for her to be the President, he has to be her Husband.
John Edwards is not even the strongest Dem candidate. I don't think he is going too far.
McCain and Guilliani suffer from the same deficiency. They are looked at from a very narrow perspective. Their position on Economy, international policy and other domestic issues are not clear. Even though their position on security is well known and strong.
If there was any hope of Al Gore running, his son has today killed it.

Now, why does republicans still have a strong case? Simple... Because the Terrorism is not dead. What happened in Glasgow will reverberate in this elections. The incident proves that there are still elements who want to hurt us in anyways possible. The democrats are still far behind in giving a strong solution to this problem. When it comes to the security, speculations and hope does not help. Pulling out of Iraq does not guarantee anything. US presence in that region does. The position of Mitt Romney on various issues are very clear. His recent popularity also reflects the same. So, if me being a judge of America got talent, I will choose Romney and Obama to go to the next round. And let the public decide.

Tuesday, July 03, 2007

Paris to Libby

[From Bollywood Movie Deewar]
Paris Hilton: I have mansions, luxury cars, Thick bank balance, Papparatzis. What do you have?
Libby: I have George Bush!

-> See who goes to Jail?

Sunday, July 01, 2007

Tony Blair had proposed in the Toilet

"Tony Blair proposed to Cherie while she was on her knees cleaning a toilet, she has revealed in a BBC One documentary." ...Read More. Bad boy Tony you should have cleaned yourself. Either way, how romantic!

Friday, June 29, 2007

Yay to Tendulkar

Sachin became the first to score 15000 Cricket ODI runs. What a feast, yay! Now get us a World cup guys and transform yourself from History to History books.

Thursday, June 28, 2007

Stevie Wonder and Toplink

This was a funny dream happened about two weeks ago and I never had a chance to blog about it right away. I was thinking about a Toplink problem and slept when there was this dream of Stevie Wonder singing who in the middle morphed into Little Richard but continued with his song. And believe me I was enjoying it. I woke up early that day and I had the solution of the problem which I implemented before heading for a shower. Thanks Stevie!

Monday, June 25, 2007

The Indian Banking System

A news script from the TimesOfIndia on how a Bank in India sent the Muscle Men to recover money which resulted in a death of the loanee. Shouldn't the Government take tough actions against this bank and its' hired "recovery agents"?

Loanee dies in scuffle with bank agents
24 Jun, 2007 l 0223 hrs ISTlTIMES NEWS NETWORK

Write to Editor
HYDERABAD: Despite the Supreme Court ordering banks not to use strong-arm tactics to recover money from defaulters, a leading bank in the city did just that on Friday and sent its ‘recovery agents’ to a state government employee’s house to reclaim its dues. And within hours of the visit, the 42-year-old loanee breathed his last at a hospital in Ameerpet. The family alleged that he was beaten to death by the bank’s agents.

This comes barely four months after the Supreme Court pulled up commercial banks for employing ‘musclemen’ to recover loans.

On Saturday, the relatives of the victim staged a dharna with the body in front of the bank’s Begumpet branch and demanded compensation. According to family members, A Yadaiah, a resident of Kindi Basthi in Yapral and an electrician with the health department, took Rs 15,000 as personal loan from ICICI Bank a few months ago. He reportedly defaulted on his repayments, ignoring repeated reminders from the bank.

"The bank has outsourced its loan recovery jobs to Elite Financial Services based at Ameerpet," Punjagutta police inspector G Narsaiah told STOI. Yadaiah’s wife Sunanda told police that Elite’s agent Raju came to her house on Friday morning at around 9 am. By then, Yadaiah had left to his office at Koti. Raju even took a photograph of Yadaiah from Sunanda to identify him.

The apex court in its February order had said that banks had a right to recover dues, but they cannot use force. "You can’t send goondas to their (defaulters) house, there are ladies alone at home," the judge remarked, disposing of an appeal filed by ICICI Bank against an order passed by the Allahabad High Court rejecting its plea to quash the criminal cases registered by the UP government against the managing director and top officials for using criminal force against a loan defaulter.

The Supreme Court asked banks to stop the illegal practice forthwith. It asked them to deal with defaulters as per the procedure laid down in the law and the Reserve Bank of India guidelines.

But quite oblivious to this SC order, another executive reportedly went to Yadaiah’s house late in the afternoon and asked Sunanda to speak to her husband over the phone. "My husband asked me to arrange Rs 10,000 immediately to repay the loan. He told me that he was being beaten up by the recovery agents," she said. Even as Sunanda was making efforts to arrange the money, the recovery agent left the place. A little later, Sunanda got a call from a private hospital at Ameerpet stating that her husband had died due to injuries. Sunanda alleged that her husband was beaten to death by the recovery agents trying to make him cough up the loan amount. The agency, however, claimed that Yadaiah suffered convulsions and collapsed before their office.

Punjagutta inspector Narsaiah said they were waiting for the post-mortem report to ascertain the reasons behind the death of Yadaiah. Police, however, had registered a case against the agency for wrongful confinement and culpable homicide not amounting to murder based on a complaint.

Friday, June 22, 2007

What is a Pojo? Again?

Keep hearing this word? With numerous definitions already, here is one more: A Pojo is not just a javabean with getter/setter and isX() methods but can have other behaviors too, provided they only work on the attributes owned, associated or inherited by it. The definition extends to the anemic and rich domain modeling. Event handling in Toplink is an example of a rich domain model. The following is a Pojo even though DescriptorEvent and ClassDescriptor raises eyebrows but its fine as in ORM, the Domain object "is a" descriptor.


public class Domain {
protected String name;
public String getName () { return name; }
public void setName (String name) { this.name = name; }
// -- Richness for postBuild events..
public void addHandler (DescriptorEvent event) {
...
}
// -- More Richness for After Load...
public static void addOrder(ClassDescriptor desc) {
.....
}
}

Tuesday, June 19, 2007

Obscenity of another kind

Someone bought a $300M Super Jumbo Airbus-380 for a personal use. And we raise eyebrows for people driving Hummers?

Monday, June 18, 2007

Taj is not Sanjaya, So please sincerely vote

Taj Mahal is at the verge of not being included in the seven wonders of the world. So how can an icon of love for more than a billion people lose? Taj is not Sanjaya so please sincerely vote here : Vote for Taj

Wednesday, June 13, 2007

Safari on Windows crashes

I don't own a Mac but decided to give a shot with Safari on windows. Installed the beta version of Safari which crashed the first time I opened it. This is a snapshot of the two. Safari (at the back) still loading and Mozilla had it loaded in under two seconds. So, their claims that it is 1.6 times faster than Firefox I guess is doubtful too.

Tuesday, June 12, 2007

Ford rejects to coach Indian Cricket Team

Good work Ford! Good lesson to the knuckle heads sitting in BCCI. And why does this Indian Cricket team need a coach? They don't make use of it anyway? They only need less fatty food and fodder to feed their gigantic egos.

Saturday, June 09, 2007

To make your database work

In one of my blogs I had talked about the perils of matching the domain model with the data model and how to solve it using Toplink. In one of my weekend projects I also talked about Twitterizing your Sunbird. Sunbird uses a small footprint of its' data-model based on the open source, open standard SQLite. And its' database is stored in a sdb file. So lets marry Toplink with the SDB file. Yes you can do that and its fairly simple and straight forward. So if you have a small data model with fewer number of tables and you want to run on a small database like what is used by Sunbird then let Toplink handle it. The Toplink workbench has a feature to recreate the data model on a database based on it's descriptors. So be it any complex data model, it can be recreated on any other database. But hold on.. Is it that simple? SDB does not support any Foreign keys and two tables can not be joined by any such relationships. Except the primary key constraint, no other constraints can be created in SDB. Big problem huh? No. Toplink does not care because the constraints it bothers about should be present in its' Object graph and not necessarily on the database. Remember the small check-boxes in the workbench asking if you want to create it on a database? And here is where the real power of Toplink comes from. The other example would be to create foreign key constraints on a database View? Even though logically it behaves like a table but a view is nothing more than a select statement providing a limited view of a certain data set. In Toplink though a view can be imported as a table descriptor. So, even with a view we can create foreign key constraints which does not have to exist in the database and in this case not even allowed. You would also watch out for default sequencing. Many small size databases like SDB do not support Native Sequencing and this would need to be changed in Toplink if not supported. What a better way to make your application agnostic to your database?

Friday, June 08, 2007

Will Paris case affect Sanjay Datta's?

So the American law has proved that no one is above the law (with all the sympathies to Paris Hilton). We have to wait and see if this case affects the like of one against Sanjay Datt and Salman in the Indian court.

Should be smart, good looking and well educated

No I am not advertising anything for myself. I was going through some matrimonial websites to find the Indian grooms (not for me dammit!) and found this one as a common statement: What are you looking for? "The girl should be smart, good looking and well educated". The rest is usually stated in different ways but mostly obfuscated. The essence will be "To excel both in managing home and outside. And should be working. And should bring a huge dowry. And should be smarter than he is. And better looking than he is. And should listen to his instructions for the rest of his life. And he should be treated like a god etc etc etc...". May be they find this the only way to improve their own gene bank - Male chauvinist jerks. Not all of them though. There are some really good people out there who do not write themselves as being Executives in their matrimonial profiles. God knows how can one become an Executive with 5 years of work experience. May be some other blog on the resume pet peeves.

Wednesday, June 06, 2007

Could someone please find Kelsey's killer?

I don't want to know what the law of the land says but could someone please catch this killer and peel his skin off, hang him upside down and leave hungry hyenas on him? Don't you think the law needs something higher than the death penalty? These beast's head needs to be chopped off and the body thrown for dogs to feed on. It is not possible that someone does not know the guy on Target's camera. Please help the law enforcement, her family and the rest of the society.

Monday, June 04, 2007

So KGMU loses its name

The name of KGMU/KGMC - King George Medical University has been changed to CSMMU - Chhatrapati Shahuji Maharaj Medical University. With every name change comes a phase of adaptation. I meet friends with Mumbai connection who still call the Shivaji Terminus as VT (Victoria Terminus). With all the respect to Shri Chhatrapati Shahuji Maharaj whose contribution to the society should be recognized, it still raises question of how the institutes should be named. Are we losing our liberal mindset to still be offended by name King George? After all, this Prince of Wales had laid the foundation of this premier medical institute in Lucknow. Foreigner/Occupier indeed but the cause was good and shouldn't that be recognized too? It was okay to change Bombay to Mumbai or Madras to Chennai because those were their historic names. Or, naming a brand new University on Mahatma Gandhi or Chhatrapati Shahuji Maharaj. But places with strong historical bonds or someone's constructive contributions should also be recognized and so what if it was a Prince of Wales?

Saturday, June 02, 2007

To find what data has changed in the database?

The problem statement is to find out what data has changed in the database if a transaction is committed. I am helping one of my Customers to build a similar application. Before I jump to the solution let me babble a bit.
We do work on a core application and then new requirements pop up time and again which do not disturb the core process but threatens to affect it. Such requirements are called crosscutting concerns. In one of my old blogs I have cursed such requirements. Things like Logging, Auditing, Profiling etc which does not restrict itself to a single component but affects the entire application. The solution to these problems is the concept of Interceptors. The code need not be changed but new Interceptors are written which can be added/hooked to the "project" which can provide the wanted solution. The concept of Interceptors is not new. Like HTTP plugins (like NSAPI and Apache plugins) Or ServletFilters which are added to intercept the HTTP requests and add/change the default behavior of the web server. Or even more powerful like EJB3 Interceptors or AOP.

So coming back to the original problem: In terms of databases there are two broad categories:
1. To implement it as a database trigger
2. To let the O-R mapper do it for you

Even though they both work, Option(2) is more elegant. It also provides the portability to the application with all the other goodies which O-R mapper gives. In Oracle's Toplink, it can be implemented as a SessionEventListener. The oracle.toplink.sessions.SessionEventListener is an interface which provides all the predefined events which take place in the lifecycle of a Session. If you do not want to implement or have empty methods, your class can extend SessionEventAdapter which does the same thing. The SessionEventListener is then hooked to the Toplink project with its' Toplink session. Here is how you do it:


# Client.java

public class Client {
...

public Session getSession () {
TestProject tP = new TestProject ();
DatabaseSession session = tP.createDatabaseSession ();
MySessionEventListener mL = new MySessionEventListener ();
session.getEventManager ().addListener (mL);
return session;
}
}

# MySessionEventListener.java

public class MySessionEventListener implements SessionEventListener {
...
public void postCommitUnitOfWork (SessionEvent event) {
Session session = event.getSession ();
UnitOfWork uow = (UnitOfWork) session;
UnitOfWorkChangeSet uCS = uow.getCurrentChanges ();
if (uCS != null) {
Enumeration enums = uCS.getAllChangeSets ().elements ();
// -- Traverse through the elements of what has changed.
}
}
}

Thats all you need... Run the application and Toplink will make sure that all the attached listeners keep an eye on all the events and in this case all what has changed.

Happy Toplinking...

Wednesday, May 30, 2007

Twitterize your SunBird (Calendar)

Aren't you tired of typing all the twitter updates? But still want to let your friends know what you are doing? So here you go... I have twitterized your SunBird. SunBird is Mozilla's open source calendar. My code reads the events from the SunBird database every half hour and updates the Twitter with the first upcoming event. So, if you have a meeting at 11PM and Lunch @ 12:30 then this application will update the twitter with Meeting@11PM. So all you have to do is to update your Calendar (SunBird) with the events and Twitter will be your flash screen. Save some typing Guys!

So what do you do?
I have uploaded the entire application at the download section of ezduck.com so go ahead and download it. Cut and paste the link if the href does not work: http://www.angelfire.com/co3/ashish7s/download/s2t.jar. I have provided the source under the open GPL license, so feel free to enhance it, make it fancier and redistribute it. Just think about me before you do so

How does it work?
SunBird uses the OpenSource SQLite format for its' data storage. So, if you are using any Calendar system which uses the same format, you can use this application against it. Sorry Outlook folks! Microsoft has to open a bit. The application uses the SQLite jdbc driver to connect to the SDB file and selects the future events from the CAL_EVENTS table. It brings the title of the first upcoming calendar event and then connects to the twitter.com to log you in and publishes the message.

How to run the application?
All you need is Java. The manifest file has already been updated to set the mainClass. Open a terminal/console/command prompt and run the following command:
java -Ddb=<location_of_sdb> -Dun=<twitter_login> -Dpw=<twitter_password> -jar s2t.jar
Where,


  • db is the fully qualified location of the SDB file. Usually, Mozilla SunBird saves the calendar in $HOME/.mozilla/sunbird/<id>.default/storage.sdb file on Unix and something similar to "/c:/Documents and Settings/<username>/Application Data/Mozilla/Sunbird/Profiles/<id.default>/storage.sdb" on Windows. Make sure the location of this file is correct. Guys this is your database!

  • un stands for your twitter.com user name. Usually its' your email address.

  • pw stands for your twitter.com password. This is legible text. As SunBird runs locally on your system and so is the terminal which you are running this application on, so its not too bad to type this in. If you are geek enough then go ahead and update the code to encode it.


Future Enhancements:
1. Behind a proxy server? its simple to modify but not done in this release. [Done]
2. A properties file to save the input parameters. [Why to complicate]
3. Targetted messaging from Calendar.
4. From Twitter to your Calendar.

Keep reading the comments on this blog for more options and happy Twittering and Calendaring friends!