Friday, February 29, 2008

Sun shining

Warm quite weather. Sun shining up to steps of the living room. Soothing sound of an old ceiling fan. Sitting on an old sofa with legs stretched. Surfing Sunday's news paper. Gosh I remember home, my heaven. I have to go home, I have to go home.

Wednesday, February 27, 2008

I run, run, run

I run, run, run as fast as I can.
I run with zeal, pride and exertion.
And I want to win.
Am I winning? Or am I running on a wrong track?

So Is it...

So it is a Database, right?
Ah it is an ESB, right?
Oh so I can replace my application server, right?
ORM? I won't need an ORM, right?
It sure looks like a MQ, right?
Hmm so its just a Cache, right?

Dammit! Its a Data Grid!!

Saturday, February 23, 2008

Breaking up Big states of India

India is not shining on UP and Bihar. This needs to be dealt with soon. For UP in Noida looks very different from UP in Gorakhpur. Its high time to accept the demand for Poorvanchal and break up the state further. Uttaranchal started to do well after it became a state. Jharkhand is better off not being part of Bihar. Look what Chhatisgarh has become after breaking away from Madhya Pradesh. It is important that equal opportunity and equal share be granted to all parts of the states. Here is what Poorvanchal should look like:
Bahraich, Gonda, Shrawasti, Balrampur, Siddarth Nagar, Basti, Sant Kabir Nagar, Ambedkar Nagar, Jaunpur, Azamgarh, Ghazipur, Ballia, Mau, Deoria, Gorakhpur(C), KushiNagar and MaharajGanj.
Let them handle their own problems and take the development in their hands and btw this is also true for Telangana region of Andhra.

Friday, February 22, 2008

Hillary - A naively smart lady

After what we have seen for months one thing is for sure that Hillary's campaign staff sucks. They don't know what they are up against. They have not read the ground realities. They were not prepared and seems they don't know what they are doing now. Bringing in Bill early backfired. Attack on "Hope" backfired. And sarcasm on speeches is not working either. Instead of strengthening her position on issues that matter she is wasting it on personal attacks. The problem is if smart lady like Hillary can't fix her staff how would she bring confidence that she can run this country?

Wednesday, February 20, 2008

McCain's affair

Who cares about this story? He is so liberal anyway!! And btw, haven't we loved our presidents with extra marital affairs already?

Tuesday, February 19, 2008

Friday, February 15, 2008

Multiplexed CacheStore

Oracle Coherence provides a hook called CacheStore that can be used to store and load data to and from an external data source. Typically this external datasource is one relational database. You may encounter a scenario to design a disaster recovery and high availability and the data in Coherence grid needs to be replicated to multiple datasources. For example, to a relational database and to another Coherence cluster. Coherence configuration does not support a composite CacheStore for one Cache configuration. There are two approaches that can be taken:

1. Write everything in one CacheStore.
2. Make it pluggable with a Multiplexed CacheStore.

For the sake of clean code and domain scope it is better to avoid the option (1). What is the (2)nd?

Its nothing but a sweet use of Java reflection and JDK1.5 new threading model. Here are the steps to how you do it:

1. Create a MultiplexCacheStore that implements CacheStore interface.
2. Configure the coherence cache config to set MultiplexCacheStore as the CacheStore provider.
3. Write different CacheStore implementations each for each data source that needs data replicated to.
4. Pass the class names of those other cache stores to the MuliplexCacheStore's constructor.
5. Load the cache stores in MultiplexCacheStore. One way is:
for-each cachestore:
ExternalizableHelper.loadClass (className, getContextClassLoader(), null);
6. Initialize each CacheStore as (CacheStore)cClass.newInstance (). Define a default constructor in each of your CacheStore implementations.
7. Add the following method in MultiplexCacheStore that prepares Java Task to be submitted:



// -- Initialize the ExecutorService
service = Executors.newSingleThreadExecutor(new ThreadFactory() {
// -- Return a new daemon thread
public Thread newThread(Runnable r) {
Thread thread = new Thread(r);
thread.setDaemon(true);
return thread;
}
});

// -- Now some methods...
private void createTasks(CacheStore[] cS, String method, Object[] o) {
for (int i = 0; i < cS.length; i++) {
Task task = new Task(cS[i], method, o);
submitTask(task);
}
}

private void submitTask(Runnable r) {
service.execute(r);
}

Now, use the following example to submit store tasks on each of the CacheStores you want data replicated:

// -- sCS and eCS are two CacheStores that MultiplexCacheStore is composed of
public void store(Object key, Object value) {
createTasks (new CacheStore [] {sCS, eCS}, "store",
new Object[] { key, value });
}


// -- Repeat the same for the other store and erase methods. load and loadAll doesn't have to
be from all the datasources, just pick one.
Tasks can be defined as follows:

private class Task implements Runnable {
private CacheStore cS;
private String methodName;
private Object[] args;

public Task(CacheStore cS, String methodName, Object[] args) {
this.cS = cS;
this.methodName = methodName;
this.args = args;
}

/**
* The method invokes a method specified by the methodName on the
* specified CacheStore instance.
* @since 12/02/2008
*/
public void run() {
try {
ClassHelper.invoke(cS, methodName, args);
} catch (Exception e) {
// -- whatever
}
}
}

Enjoy Coherence!

Don't give right reasons to wrong people

The recent events in Mumbai and Nasik should awaken the Indian establishment. Attacks on Indians from UP and Bihar should remind the State and Central governments of the responsibility of respecting and saving the republic framework of the nation. The events have given people like Raj Thackrey and Amar Singh a new lease of life for their political survival. So why is this issue after all and why are they so hated? Simple. It is much easier to push around poor people. Its not the first time that U/Bians have been targeted. They were targeted in Punjab, they are targeted in Kashmir and they are targeted in Assam. Its a slap on their faces. In spite of rich human and natural resources they themselves are to be blamed for the poverty and lawlessness in their states for the kind of leaders they have chosen as their representatives. Why can't Gujarati and Punjabis be pushed around in Mumbai? Because they are financially strong. They are not the poor laborers, they are investors. And btw, if Amar Singh felt so bad about Raj's actions and comments then besides the resistance in Maharashtra why doesn't he come back and work for the upliftment of poors in U/B? You have everything that is required for a phenomenal economic growth. Show the rest of India what these states really are and can do. Don't be "an Africa" of the world - High potential but still poor.

Wednesday, February 13, 2008

Why is Mouth important?

Snakes are wonderful animals. Long sleek body. Shining silky skin. Dancing movements. But still people are afraid of it because of a few drops of poison in its mouth. On the other hand Bees with honey in their mouth do have a dangerous sting in it's tail.

Tuesday, February 12, 2008

Any reason to piss-off Russia?

Russia has been staunchly opposing any missile shield plan in it's back yard. Of course US is keen to find partners and friends in that region to do so. As far as an official position is concerned, US missile shield is only meant to deter countries like Iran and North Korea to attack US and US interests. So, if we do not respect Russia's opinions and it goes to a level where it really pisses them off how bad could it be? Now what ifs.. What if they arm Iran with nuclear technology and materials they have been dying for? What if Russia ends up triggering a dangerous Arm race? What if a small surgical strike snowballs into a bigger war? What if Russia becomes a leader of "Islamic world"? One aspect of "Don't create enemies" is to make friends. Does anyone even care about the lives of simple little unknown people like us? Are we really represented?

Sunday, February 10, 2008

The best part of US Presidential race

As a quasi-liberal and quasi-conservative immigrant who does not have a voting right, I am free to analyze US presidential candidates on their merits on what they say and what they have done. The best part of the up coming general elections is that whoever wins the race I will be satisfied that this nation is in safe hands. I like McCain and Obama because of their sheer sincerity. I will be happy with Clintons because it will be Clinton(s) and would love to see Bill coming to fore again in some capacity and also for the energy Hillary brings in. [H]illary, [O]bama or [M]cCain, Americans you would get a HOMe run.

Saturday, February 09, 2008

Should tablename be passed to CacheStore?

No. Table name should not be passed to the Coherence CacheStore constructor. Following are the reasons:
1. CacheStore does not have any knowledge of the "type" of datasource. Only Its implementation knows it. And CacheStore implementation should encapsulate this information.
2. Grid is about objects. Its better to use an ORM and hide the data-model in its internal mapping file.
3. If Multiplexed(?) CacheStore needs to be written its easier to instantiate individual CacheStores with common arguments.

Friday, February 08, 2008

Puzzlindromia!

So here I am doing 'Z' but I want to do that 'X' because the folks at 'X' are fu@#!$g exceptionally smarter than me and I want to be like that. 'X' I don't think believe I am any close to what they would like to have. While 'Z' tells me that I am doing exceptionally well and they have plans for me. I don't want to continue doing 'Z' because I see folks at 'Y' who are not doing what I do at 'Z' but still have higher satisfaction doing it. I have not told 'X' that I want to be part of that clan. Neither 'Z' that I am not satisfied nor have started looking for 'Y'. Puzzlindromia!

Tuesday, February 05, 2008

A French priority

Did I invent a new phrase? Anyway, France unveiled a next generation bullet train today - faster, more advanced, and I guess greener. While GM@Home might still be working on a bigger truck may be Hybrid this time (service to the society). Its not a question if US can or cannot do the same, its a matter of priority. Huckabee might not win the Presidential race but his priority to invest in infrastructure has a huge value. Just look at France..

Sunday, February 03, 2008

Whats up with Maharashtra Navnirman Sena?

I am not writing this because I am from UP but against a desperate attempt of MNS and Raj Thackrey of provoking regionalism for political survival. Raj Thackrey should accept that his splitting from Shiv Sena did not work and he is short of the fodder to feed on. On his demand of people from outside Maharashtra (Specially from UP and Bihar) to "behave" and disown their customs while in Maharashtra is not only illegal but a direct challenge to the fundamental rights provided by the Indian constitution to its people. Would he ask Maharashtrians who live outside Maharashtra or even India to disown their traditions? If influx creates security concerns then it has to be dealt as per the rules of the law. If he has problems with likes of Amar Singh and SP then stop giving inflammatory comments against an entire community and target them individually. SP don't represent North Indians. Raj should better watch out for what he says. Concern towards a problem is one thing, challenging the constitution is entirely different.

Saturday, February 02, 2008

I want this.. Build me one

Throughput of an asynchronous system that behaves as a synchronous unit with a complete data replication across WAN and maintaining the sequence of data processing to protect an event that has a probability of 0.001 of happening.

Friday, February 01, 2008

Who would hire me?

If I start looking for a job today? Its not that I am looking though.
Strong selling points: A loyal Rottweiler who could work like a donkey and feed on dry grass.
Caution: Sleep deprivation could lead to grumpiness.