Wednesday, September 24, 2008


Racism in America: A few weeks ago I took a right turn at a red light where I was not supposed to. In Colorado there are not many traffic lights where right turn is not allowed, unlike many cities in East coast where it is quite typical. And where you least expect them they will be there. Yes Cops stopped me and gave me a ticket. And When I saw the paper closely my race was written as a "White".
Socialisism? On no!: The house prices are down 30% of its value. Thousands of dollars of losses in 401K and stock investments (even conservative ones). Gas prices and health insurance costs are sky rocketing and no one bails us out. Now our money is taken out to bail out the corporations who made wrong and risky business decisions at our expense. Bailing these huge financial corporations is still capitalism, bailing us out on main street would be socialism. Oh no, we can not be a Socialist nation. And if these steps are necessary to save the economy at least please guarantee that our $7000 dollars will be returned back at 8% yearly.
Lets not have a debate: McCain is good hearted and wants to suspend the campaign and work in Washington to resolve the economic crisis. He does not want Friday's debate. I thought during these times is the best way to connect with people on main street. Even Bush had a special speech. Is McCain avoiding direct people contact? I remember that Office episode when Steve Carell hides all day and gives Dwight to chose health care plan.
A VP that believes in witch craft?: Thats the only thing left for Americans to see!

Tuesday, September 23, 2008

Replacing proxy information on the fly

This is another neat trick under Coherence's arm. Lets say you have an *Extend client that connects to a set of Coherence proxies. If the proxies for some reason are down and none is available and you do want to connect to another cluster that you know is up (like a DR), how could you connect to it without restarting the application or using any DNS Switch? Following is a way to replace the Extend configuration on the fly:

public void changeConfigOnTheFly (String host, String port) {
ConfigurableCacheFactory factory = CacheFactory.getConfigurableCacheFactory();
XmlElement cc = new SimpleElement ("cache-config");
XmlElement rcs = cc.addElement("caching-schemes")
.addElement ("remote-cache-scheme");
XmlElement xE = rcs.addElement("initiator-config")
XmlElement rAs = xE.addElement("socket-address");
XmlElement add = rAs.addElement("address");
XmlElement port = rAs.addElement("port");

// -- Now set the new XmlElement

// -- And of course you need to restart the Cache Service thread
factory.ensureService("ExtendTcpCacheService").stop ();
factory.ensureService("ExtendTcpCacheService").start ();

Yay! And you can keep your *Extend cache configuration simple and tidy by replacing the proxy configuration on the fly. Something is missing in this configuration though - The cache mappings. Actually you do not need it. As long as cache schemes are defined, caches too can be created on the fly:

CacheService cS = (CacheService)CacheFactory.getService("ExtendTcpCacheService");
NamedCache sCache = cS.ensureCache("MyCache", null);

Don't you just love Oracle Coherence?

Saturday, September 20, 2008

Death of a Policy

History did not start on September'11th 2001. There was a world before that and roots of an evil were planted decades ago. In 1947 a country named Pakistan was born. No the country itself was not evil but the path it followed and policies it implemented resulted in a nation that its legendary creators would not have ever imagined. India pre-independence was a nation of multiple cultures. Mainly two - Hindu and Islamic traditions. For centuries a mixed culture took roots with an influence of Sufism that brought two religions together. But it was not always rosy. Uncertainties of early 1930's and some political opportunism ended up making some Muslim leaders insecure in the nation they were born in. While India continued its multi-culture secular way, Pakistan took refuge in religion. The partition which was mostly based on differences of political views was turned religious. While the leaders of North west frontiers (the region close to Afghanistan) whose cultures and traditions were very different from the main stream Pakistan never wanted a partition but they ended up abstaining from voting and hence a nation named Pakistan was born. Pakistan as it means a "Pure place" very soon got tainted and bloodied after thousands of Hindus and Sikhs were massacred in the worst ever riots of the last century. Elements in India responded with the same evil reaction and a country was split into two nations. Pakistan as its creator M.L. Jinnah thought of making - A free and progressive country rooted in Islam was soon caught in disillusions. Their suspicion and hatred for India grew and instead of strengthening the people they strengthened the Anti-India institutions of its military. With Soviet Union moving into Afghanistan Pakistan became the hot bed for US to make its presence felt in that region. While Pakistan continued to be used, Long story cut short - Taliban was formed and no one had any clue how to deactivate this Machine if it ever gets out of hand.
It was not like if the thought process followed by Taliban was any new. It was at the heart of the kings like Babar who invaded centuries ago and brought Islam to India and followed by Aurangzeb the last Mogul king of India. The soul of secular kings or leaders like Akbar and M.L. Jinnah died and replaced by a policy that was too dangerous to control. While Pakistan continued to be ruled by Military Generals that world cozied up to, it was the democratic institution of Pakistan that remained the victim. Then came Kargil misadventure, solely orchestrated by then Pakistani Military chief Musharraf. The same elements that never liked any peace initiatives by elected leaders of that country with India. Once again Pakistan came under a Military rule that only ended after 9 years. Then 9-11 happened and not the world but only West's perspective towards this long lasting evil changed. Common Americans who cared about a very small World realized that it was bigger and filled with more hatred towards US than they had earlier thought. It was a new reality beyond the cold war. Musharraf knowing exactly what he was up against chose to side with US or at least officially. He took a gamble that elements his institutions and his predecessors created and helped would be easy to deal with over a span of number of years. We all got used to the situation. Okay.. US will stay in Afghanistan. Musharraf will not allow situation to get out of hands. Iraq will get solved by itself. One day Osama Bin Laden and its kingpins will either be captured or killed. The world felt more peaceful. Then something unprecedented happened. Benazir Bhutto was assassinated. Musharraf was ousted and new elected leaders took oath in Pakistan. The most important nation in the fight against terror was back on track. Or so it seemed. A series of US strikes inside Pakistan and its Military's attempt to cross its border snowballed into an issue that has swung most of the undecided common Pakistanis towards Taliban. Marriott's bombing in one of the most protected areas is not an isolated act but a sign of changing ground realities inside Pakistan. Its a challenge that a new nascent government is ill prepared to deal with. Its a sign of failed policy and is screaming to get a new look. This problem is bigger than Iraq. People in hiding not only had their eyes set but now have a reach to not only to the deadly nuclear weapons but its delivery systems. Hope it is not a beginning of the fall of a nation we called Pakistan.

Saturday, September 06, 2008

Bringing Database application to Grid Computing in one day

So you have a Database application with Tables and Relations. Application is poorly performing, and not scaling and it is time to move. But it is so critical that rewriting it should be taken with precise planning. This is a common scenario at numerous clients. "Is there a way I can use Coherence Grid without too much programming effort by the time my IT staff learns the new technology?" Yes! as long as you know what a Map is. Follow the following steps and you are ready to Griditize your application in no time:

    Set up the tools:
  1. Download jDeveloper 10g (or latest) from Oracle.

  2. If jDev is not already enabled, Download AspectJ plugin from this link. Drop the jar in $JDEV_HOME/jdev/extenstions.

  3. Create Java Objects from Database tables:
  4. Start jDeveloper and go to Connections Tab. If Connection Tab does not appear, click the "View" Menu option and select Connection Navigator.

  5. Right click on Database connection and create a new connection. Test the connection for Success.

  6. Create a new jDeveloper project and give it a name.

  7. Right click on the Project and select Project Properties. Under Technology Scope, select Toplink to add. Don't worry, we are not mandating to use Toplink even though highly recommending it when you need database persistence and data load (Cache Stores etc). Click OK.

  8. Right click on the project and select New. A new Window appears, select Toplink option under Business Tier. Select the first option - "Java Objects from Tables". Give a name to Toplink Map and select the Database Platform and Database Connection you had created in step (3/4). Select the appropriate schema and import Tables. Select Tables that you want to create Java POJOs from. Move them from Available area to the Selected area. Click Next-> and provide a Java package name, say pkgname. Note this package name, you will have to use it later. After finishing the process you would see a bunch of Java classes in your project. You are half way there. Go and grab a cup of coffee.

  9. Kill some time:
    While you are finishing your coffee read this: Aspect programming with Coherence

    Make the Java POJOs Grid Ready:
  10. Create a new empty Java class under <pkgname>.root package. I would name it EzRoot (Motto is if it is not EZ (easy) it is useless). Copy the ELHelper class from the blog that you just read.

  11. Create a new Aspect by name EzRootAspect with the code copied from TestAspect.aj as was shown in the earlier blog. Replace all "Test." strings to "EzRoot." and add the following:
    declare parents: <pkgname>.* extends EzRoot; right below the aspect declaration. Don't forget to import EzRoot. Make sure package names of ELHelper and EzRootAspect are correct.

  12. Right click on the Project and select Rebuild. Or you can also create a new Deployment Profile and build a jar file. The compiled jar contains Coherence Grid ready Java classes. Each Java class represents a Table from your data model and now can also directly be used with Coherence.

In ten steps you have cut your week's work to half hour. The rest is your creativity. Whats next? Lets see.. I would love to give you a way to generate dirty but quickly a Coherence Cache configuration and you can go live in one day ;). May be some seasoned Domain Modeler can tell me the best way to tell a difference between an Entity and a Value Object without searching for an "ID" attribute. That way I can make an intelligent decision on how many caches should be created. The fun begins now...

Thursday, September 04, 2008

Obama vs McCain

So it is official now...
Obama's message: Enough!
McCain's message: WYSIWYG

I like McCain and salute to his services for this country, but if Democrats could not make a case this election they should forget it for another eight years. Do not Re-Kerry. Republicans have everything going against them. Economy, Last eight years, Economy, Iraq, Economy, Afghanistan, Economy, US foreign leadership, Economy, Health care and Economy but seems like divided democrats is still struggling to challenge a united republican house.
1. Why Women Clinton supporters should swing for Palin? After 42 male Presidents are all US men happy and satisfied?
2. Did they ever ask if she had won nomination, would she have picked Obama? I guess she would have picked Biden herself.
3. Why is this indirectly projected as if it is being un-American, selfish and un-patriotic to support Obama? USA, USA was a treat to hear in Beijing but why during Republican convention? Are the rest coming from Cuba?
4. Why are facts not used? Why is this being told that Obama's Tax increases will hurt common Americans? Does a common American make more than 250K a year?
5. Why McCain's Vietnam days are being repeated again and again? He did suffer tremendously and he suffered in the hands of enemies. Does anyone care how does it feel to suffer in hands of your own fellow countrymen? It is easier to defeat evil if it is recognizable. Two forces with guns out to kill each other. Yes you can see evil and defeat it. What about hate crime, racism, sexism those no-face evils? How to defeat evils that exist in character?
6. Yes, McCain is different. He will bring change and probably positive change. He is a uniter not a divider. But can anyone stand up and take responsibility for last eight years? 4000+ precious lives have been sacrificed on wrong pretexts, why were they blind folded for first five years? Why harping on the fix (surge) which should have been done from the beginning?
7. Why is there no accountability for lost 10 Billion Dollars that should have been spent to chase evil to the doors that houses them?
8. And Why experience has been such an issue? Has it been not a White house tradition lately that a President does everything that his VP tells him to do? ;) - Okay this was a humor!!
9. Republicans all kudos to you for choosing McCain as a nominee. If anyone can come victor in a face of adversity it is John McCain, his resolve and his character are his strengths. He masters this art.

After many years we have two very likable candidates. Both will bring change. They both have awesome character, sincerity and possess love for this nation and its people. You won't go wrong in choosing either of the two. But choose on policies. Choose on facts not on revenge and prejudice. Change is coming indeed but choose who can bring confidence as well, sooner than later.

Fact: Bush has more approval rating in India than in US.