Wednesday, December 28, 2011

Anna's show a big flop in Mumbai - Think!

Anna called off his fast in Mumbai due to a poor response from people he thought he was fighting for. Stop. When Mahatma Gandhi returned from South Africa he did not just fight one war with British, he fought three. One that he fought against himself to get rid of pretentiousness, ego and bias and this constant battle of self cleansing continued till he died. Second was in fact against the Indian people itself. This was the war to wake them up - not just the lawyers in Mumbai but to awaken people in villages who did not even know what human dignity and self rule meant. It was a war because the majority were even afraid to get rid of the British empire fearing even bitter rule by some of their own brethren's. Unless you awake people and show them what they would be looking for how could you even think of fighting his decisive war against the British? And these three wars were chaotic, bleak at times and hurtful but remained physically non-violent.
What happened in Mumbai is no surprise. A poor show for Anna is no reason to get disheartened. It only shows people are not ready, they are not awakened yet. Instead of getting rid of a corrupt system they see it as an opportunity to join and loot. This has become a diamond mine that people think queuing on is unnecessary, instead chance to get in and loot. And don't forget Mahatma's bugle did not sound from a podium in Mumbai it sounded from a place called Champaran that no body even knew it existed where people did not discuss if a choice is good or bad but a place where there was no choice at all. Anna has to find his Champaran.

Tuesday, December 06, 2011

एक और शेर

ये धुंध और कम्बल में सिहरते लोग सोते किनारे,
चौराहों में लोग पीते हुए चाय, और वो भटकते रिक्शे वाले,
दूर से लाल बत्तियां चीरती निकलती रौशनी को काटते हुए,
वो छोटी सी बच्ची मांगती भीख आधी नंगी अपनी माँ के सहारे,
उन गलियों सड़कों की कहानी आज भी याद आती है,
और इस धुंध में लिपटी अपनी लखनऊ अब भी रुलाती है।

*Picture - courtesy Lucknow page on facebook

Wednesday, November 09, 2011

Coherence Transaction, Semaphore and a Joke

A DBA walks in a NOSQL bar hangs around for a few minutes, turns back and leaves. He couldn't find a table. [Quoted]

When the Data Grids came to existence it tried to solve a different set of problems that a typical relational database was not geared to address. Some failed trying imitating a Database, some remained distributed cache managers and some just got lost in space. The ones who succeeded were the ones who remained focused in solving the performance, scalability, manageability and predictability of the application state in the middle tier - actually all of them. But as they continued to sink in the Enterprise application strategies one question remained to completely solve - Transactions. Oracle Coherence couldn't defer a solution for too long either and announced a new cache scheme in its v3.6 to support true transactions extending and then deprecating its TransactionMap. Before I show how this new scheme could be used in one way lets talk about how some of these transactional problems were addressed earlier.

If an analogy has to be made between a Database and Coherence, we can think of cache schemes as a database schema and the caches as database tables.

Different solutions popped up for different level of sensitivities of desired guarantees.

Problem: Update Person and its Address together

Solving it in domain model
Solving it in the scheme
Solving it in process and, 
Solving it correctly

Domain Model
Coherence EntryProcessors provide an unique guarantee - Without an use of explicit lock only one process can modify an Entry at a given time no matter how many backups of that Entry is maintained in the grid. And as node fails the in-flight executions will move to the new owners of the partitions as Entries are repartitioned. For the clients as if nothing has happened other than some delays.
public class Person {
   private Address address;
}
NamedCache nCache = CacheFactory.getCache("Person");
nCache.put ("person1", new Person());

nCache.invoke("person1", new PersonAddressUpdaterEntryProcessor());
made sure that Person and his address were updated together while the Person was already locked. The key to this solution lies in the domain model by hiding any direct access to the Address by encapsulating it inside the Person who owns it.
But what if everytime a Person is updated its not always that his Address is touched? This requires that Person and Address can be split into multiple caches and for cases when only Person is updated the deserialization cost can be reduced.

Key Association and Transaction Lite
Everyone who has bought or rented a place knows the following three words - Location, Location, Location. When it comes to Transactions its colocation, colocation, colocation. Move related data together so that challenges of failures like network, nodes and partial failures can be contained with in a single node. In pre v3.7, not completely safe in all scenarios but as long as Addresses are not directly updated a clever solution could be used to update them together.
public class Person {
 private String id;
 public String getKey() {
    return id;
 }
}
public class Address implements KeyAssociation {
 public Address (String personId) { .. }
 public Object getAssociatedKey () {
    return personId;
 }
}
NamedCache pCache = CacheFactory.getCache("Person");
NamedCache aCache = CacheFactory.getCache("Address");

pCache.put ("person1", new Person());
aCache.put ("address1", new Address("person1"));
nCache.invoke ("person1", new MyEntryProcessor());

The key association between the Person and the Address will make sure that no matter if two different caches are used to put these two Entries they will end up together as long as these two caches use the same cache scheme. And then the following:
public class MyEntryProcessor implements InvocableMap.EntryProcessor {
public Object process (InvocableMap.Entry entry) {
  final BackingMapManagerContext addressCtx = ((BinaryEntry) entry).getContext();
  Map map = addressCtx.getBackingMap ("Address");
  Address address = map.get ("address1");
  ...
  entry.setValue(...);
}
}
This works as long as no other process updates the Address while the Person is locked by the EntryProcessor.
If you are already using v3.7 the getBackingMap() API has been deprecated and replaced with thread safe getBackingMapEntry() API and this new framework is called TransactionLite.  If Entries could be co-located then Transaction Lite is worth looking at.
Following code replaces the one above with TransactionLite framework:

// -- Assuming EntryProcessor is executed on "Person" cache and the address in the "Address" cache with its key AddressKey key associated to the Person's key.

final BackingMapManagerContext ctx = ((BinaryEntry) entry).getContext();
BackingMapContext backingMapContext = ctx.getBackingMapContext("Address");
Map.Entry backingMapEntry = backingMapContext.getBackingMapEntry(
                ctx.getKeyToInternalConverter().convert(new AddressKey(personId)));
((BinaryEntry) backingMapEntry).setValue(.., true);


A dirty little way if you know your finger crossing has yielded positive results
Problem of transactions become severe when associated objects are meant to be updated in parallel. What if the same Address is being shared by multiple People? Using KeyAssociation is not recommended. As more and more People share the same Address (like a Dorm) KeyAssociation will make the partition bloated and unevenly balanced something that preferably be avoided. If provisioning is done right (or even over provisioned) and cluster nodes appear to not fail and atomicity is not absolutely required but good to have then an EntryProcessor can be invoked with in another EntryProcessor as long as the Person and Address caches use different cache schemes (Different service names). But all bets are off once say Address's EP succeeds but the Person's fail. Setting the backup count to '0' would minimize the error window but still this is just not a solution. Coherence did have a now deprecated API TransactionMap that allowed multiple operations to be committed in a single transaction albeit nothing goes wrong as described here. This API has now been deprecated and replaced with the Transaction scheme.

Transactional Scheme
A new cache scheme has been added post v3.6 that allows updates to multiple cache entries in a single transaction as long as the caches belong to the same transactional scheme. Make sure following cache scheme is defined:
<cache-config> ...
<caching-schemes>
 <transactional-scheme>
     <scheme-name>transactional-scheme</scheme-name>
      <service-name>TransactionalCache</service-name>
      <autostart>></autostart>
  </transactional-scheme>
</caching-schemes>
</cache-config>

If Person and Address use the same TransactionalCache scheme


This is a simpler problem to solve with the current scheme.
DefaultConnectionFactory factory = new DefaultConnectionFactory();
Connection connection = factory.createConnection("TransactionalCache");
connection.setAutoCommit (false);
connection.setIsolationLevel(Isolation.READ_COMMITTED);

OptimisiticNamedCache personCache = connection.getNamedCache("Person");
OptimisticNamedCache addressCache = connection.getNamedCache("Address");

Person p = personCache("p1");
Address a = addressCache("a1");

update(p, a);

try {
 connection.commit();
} catch (..) { }
finally {
  connection.close();
}

Twist - Person and Address in two different cache schemes

Modified Problem: Update two Persons in a single Transaction and then update the Address if the previous transaction succeeds

This is tricky and this is what I call a dependency transaction

Lets take a twist and introduce a new type of InvocableMap.Entry:
public interface TransactionalEntry extends InvocableMap.Entry { 
  Status status getTxStatus();
  Object getAnotherEntry (Object key); 
  void update (Object key, Object value, Filter predicate);
}


Lets use this new interface in line with running an EntryProcessor:
public class SomeUtilClass {
   public Object invoke (final K key, final InvocableMap.EntryProcessor processor) {
   final DefaultConnectionFactory factory = new DefaultConnectionFactory();
   final Connection connection = factory.createConnection ("TransactionalCache");
   connection.setAutoCommit(false);
   connection.setIsolationLevel (Isolation.READ_COMMITTED);

   final TransactionState state = connection.getTransactionState();

   TransactionEntry entry = new TransactionalEntry () {
     private final OptimisticNamedCache oCache = connection.getNamedCache(cacheName);

     @Override
     public Object getKey() {
       return key;
     }

     @Override
     public Object getValue() {
       return oCache.get(key);
     }

     @Override
     public Object getAnotherEntry(Object relatedKey) {
       return oCache.get(relatedKey);
     }

     @Override
     public void update(Object key, Object value, Filter predicate) {
       oCache.update(key, value, predicate);
     }

     @Override
     public Status getTransactionStatus() {
       return state.getStatus();
     }

     // -- Other methods
     ...
  };
    try {
        processor.process (entry);
        connection.commit();
    } catch (Exception exp) {
         connection.rollback();
    } finally {
          connection.close();
          synchronized (entry.getTransactionStatus()) {
                entry.getTxStatus().notifyAll();
           }
    }

}

}
Now which processor is passed in the previously declared invoke method? It is an EntryProcessor that is not necessarily executed as an EntryProcessor but this model could gain some solid points in the design consistency.
public class MyProcessor implements InvocableMap.EntryProcessor {
   private final ValueExtractor extractor = new Reflectionxtractor ("currentVersion", ...);

 public Object process (final InvocableMap.Entry entry) {
   final TransactionalEntry txEntry = (TransactionalEntry) entry;
   final Person firstPerson = (Person) txEntry.getValue();
   Filter predicate = new WhateverFilter (extractor, firstPerson.currentVersion());
   firstPerson.incrementVersion();

   Person anotherPerson = (Person) txEntry.getAnotherEntry ("anotherPersonKey");
   anotherPerson.incrementVersion();

   // -- This needs to be transactional
   doSomething (firstPerson, anotherPerson);

   txEntry.update (entry.getKey(), firstPerson, predicate);

     // -- Use the Status as a Semaphore
   executerService.execute (new Runnable () {
         @Override
         public void run () {
            Status status = ((TransactionalEntry) entry).getTransactionStatus();
            synchronized (status) {
              try {
                status.wait();
              } catch (InterruptedException i) { ... }
                     
              switch (status) {
                 case COMMITTED:
                   // -- Update the Address.
                   // -- Now the two Person objects are guaranteed to be single transactionally
                   // -- updated and address could have been done in the same way, had address
                   // -- used the same Transactional scheme. 
                   // -- If Address is in a different cache scheme and the system is provisioned
                   // -- right that put() succeeds then the Address will only get updated after
                   // -- Person(s) have been successfully updated. 
                   // -- The updateAddress() could use another EntryProcessor 
                   updateAddress (address);
                   break;
                 case ROLLEDBACK:
                   break;
                 default:
              }
            }
         }
      });
    return firstPerson;
 }
}
Enjoy!

Monday, October 31, 2011

Politicians should be traded in stock exchange

Lets see when it comes to our hard earned money who we then bet on. It would be a peoples verdict on a daily basis and lets see if they would be willing to lose their "investments" because of caste, religion, regional based selections. And lets see who turns out to be the consistent performers.

Saturday, October 29, 2011

They should be conferred Bharat Ratnas

For their exemplary achievement in their field of work.

  • Rajani Kanth
  • Sachin Tendulkar
  • Amitabh Bachchan
  • Anna Hazare
  • Sam Manekshaw

Thursday, October 20, 2011

Don't lose decency in war

When the war broke out between India and Pakistan over Kargil two things happened - Some Indian soldiers were captured and their bodies were found mutilated. Second, on numerous occasions both the countries exchanged bodies of their soldiers with full honor and salute. Professional armies of the world are expected to do the same. Also bound by Geneva conventions it is necessary to respect the dead and PoWs to keep your honor if not theirs. There has to be a decency in war. What we saw during Saddam Hussain's execution and now with Gaddafi's body being dragged only shows how savagery has sunk in our frustrations. Dictators who did the same deserved what they got but if the "good guys" do the same what values would you be establishing? Responsibility of revolution peaceful or not is not only a change from tyranny but also establishing a foundation for future with human dignity and values. You can not remove a color with the same color. Revolution is good if its for better but better in a way that it establishes compassion, dignity, honor and core human values.

Thursday, October 06, 2011

Tribute to a legend we called Jobs

By the time I started my career in Software Industry Apple was no where at the fore front. It was a company that I heard people talking around me with lots of past tenses. For many months I believed it was another SGI - A cool company no one wanted. Only later that I found what it would have been liked to have experienced the storm Macintosh brought in the PC industry. First time in my life I wished I was older. For many years I was so overwhelmed by what Bill Gates had achieved that it overshadowed the aura of Steve Jobs, "Pirates of Silicon Valley" did not help. As I grew I started appreciating what Apple Computers stood for - Quality. Jobs was an icon. He brought in that sense of cool breeze. And he was the one who "Thought Differently" and succeeded. What else could anyone say but to quote this:
"Here's to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes... the ones who see things differently -- they're not fond of rules... You can quote them, disagree with them, glorify or vilify them, but the only thing you can't do is ignore them because they change things... they push the human race forward, and while some may see them as the crazy ones, we see genius, because the ones who are crazy enough to think that they can change the world, are the ones who do"

Tuesday, October 04, 2011

SAPlugin for JVisualVM on Ubuntu 10.10+

The Serviceability Plugin for JVisualVM would not work on Ubuntu 10.10 and up. I found the following work around wants to blog about for a reference:

Run the following for making a temporary change:

$ echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope 


Run the following for making a temporary change:

$ sudo vi /etc/sysctl.d/10-ptrace.conf

kernel.yama.ptrace_scope = 1

kernel.yama.ptrace_scope = 0

and reboot your system.

Friday, September 23, 2011

दोस्त

कुछ यादें भूली रहती हैं, पलकों पर कुछ ही सजते हैं।
कुछ दोस्त बिछड़ कर भी, हमेशा दिल में रहते हैं।

Thursday, September 15, 2011

इस बार इक कहानी सुनो

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

Saturday, September 10, 2011

9/11 - A remembrance

Ten years ago I just got out of the shower and getting ready to go to work I heard my roommate's voice - "Ashish just come here and see the news. There has been an accident, a plane hit a tower in New York". I ran and by the time I was there my Oh boy turned into Oh F$%#! Did the traffic control made this big mistake? I didn't want to believe International Terrorism just hit this shore too.
Mood in the office was sombre. Palestinians? Iranians? But by the lunch it was clear who. Even smiles on faces were filled with million questions. That day we were allowed to leave early and so we did but not before a friend had made sure talking to me at the Gym that I was a Hindu from India. Though I was happy to tell him but it was like as if some one just had let me go in the middle of a Riot knowing if I was one of them. The question kept coming to my mind as I drove back home.
I had rented out two of my rooms to two other Indian Guys. They had a bigger social circle and my house in the evening at least had two other cars besides three in the house parked. My neighbor was a nice man. He had helped me move in. Like mine he had many questions to ask about us. So do you Guys go to school here? He wanted to make sure if we three brown guys were not going to school, for looking some correlation. That day I also found out how little many here knew of Geography and culture beyond the American and European continent. A few days later a neighbor's kid punctured my car tires - it was a hate crime, I didn't report. Some of my friends were chased with a car while returning from a Diner but the situation remained in control something you could easily shrug off.
Tenth year and we got the news that everyone waited for. Osama is dead. Threat is not. US ended up with two unfunded wars that we thought would be just shock and awe. Didn't happen. We got a new President who once felt like a cool breeze. No one knows if he struggles with problems he got in legacy or is creating them. What we do know is its our problem and only its people can solve it. Lets pray together No 9/11 happens again, not in US, not in India and no where else in the world. Lets salute the Heroes and the victims and the Soldiers who died on and because of 9/11. And a message to all those who still are on the path of violence - It is easiest to kill someone else, easier to kill yourself, a little difficult to live your own life peacefully and the most difficult is to help others live with peace. God accepts and loves those who take the high road.

Thursday, September 08, 2011

This is how Lucknow created Jobs, once

The year was 1784 and the region of Oudh had suffered one of its worst famine of that time. Nawab Asaf-Ud-Daulah knew how proud the citizens of Lucknow were. Lucknowites did not accept charities as long as they had an ability to work. Quality of a ruler is to know the pulse of its citizens, to hear it when it beats something today's leaders have failed to do. He had money collected overtime as revenue and he had it to dispose it off for good. And in spite of mounting debt that he owed to Britishers he chose to create jobs first. Even then he knew if people have Jobs and they are proud to do it is a solution for a greater threat like Famine. He knew threat of British rulers were more on him than his riyayah while in case of Famine it was opposite. He chose the people's way. Learn.
Dilemma was, though people from Royal and other noble families did want to work even physical but wanted to preserve what they believed was their honor. The honor they thought they achieved by learning, by producing literature, by administering and by protecting the state. It was not a socialist society and neither it was a time to change it to one, and the Nawab knew it. So he planned a novel method. He invested in construction projects building Imambaras places that are public in nature. There is no other feeling of goodness if you could use what you have built. While under the day light he asked laborers to construct walls and pave roads once a week under the Moon he let the members of the noble families destroy them. This cycle continued and he was doing it preserving the real map till the Famine was over and its citizens could get back on track with their lives. The buildings the Imambaras are still standing undestroyed, untouched, undetered and proud. It was a people's place that continued to wither out the test of time. Nawab was a great ruler and a great human being who was successful in addressing one of the biggest problem of that time with dignity, with honor and with the satisfaction of all affected.
The story has some startling resemblance with what we find today. We have mounting debts here in US, Jobs are difficult to create and find. Honor of people are affected and the education and experience is not always getting appropriately rewarded during the current hardships caused by the bad economy. We have a famine. While the President Obama is about to announce his plans around it, Nawab Asaf-Ud-Doulah is becoming relevant again. And we want to invest in something that could stand up right for centuries to come, proud.

Friday, September 02, 2011

इक और शेर

सोचा था सजा रक्खूं इक पत्थर सीने में उसकी याद में,
समय के साथ तब्दील हुआ वो पत्थर भी तेरी मज़ार में।
ढूंढ पाता नहीं अब वो भी उस याद की शम्मा लेकर,
दिखते हैं बस कुछ साए इन आईनों की बाज़ार में।


Wednesday, August 31, 2011

Jan Lokpal - how will it hurt you?

You know how we all love Gandhi Ji and wanted him to get us all freedom from the British clutches. We sat and sang "Vaishnav Jan to tene Kahiye", wore the Topi and white Kurta and still so conveniently forgot about that minor washing the kitchen plates in our house. Its astonishing how few really applied and adopted his teachings in its essence.
We then jumped over a few generations and were almost getting ready to forget him for ever, this Anna guy came and revived what Gandhism is. But now there is a problem. It was so easy to point fingers to those White Gora guys. Those outsiders were the reasons for every problem India had. Now what? That brown Guy sucks! Oops!! And then Anna asked - you know what we are really suffering from? Its that damn corruption he said. And I thought wasn't that the way we get our work done? A minor traffic violation and it would cost you a Rs 100. A Bank loan - 5%. Getting started with pension - 500/-, Birth Certificate - 100/-. I was almost expecting Government to release a Table of work-bribe chart just to formalize it across the Nation. These surcharges differ so much between UP, Maharashtra and Karnataka.
I am sure people involved in 2G scam (huh?) had good intentions too. They saved Lacs of Crores of Rupees in foreign banks. It takes over one hour to withdraw 500/- from a local bank, think how much time it would take to withdraw 100 Crores from our banks. I am sure Foreign banks must be doing a better job. And saving is good isn't it? Thats what I was taught as young. If they had kept this much money in India we would have spent it in Pav Bhaji, Chai pakora and fire crackers. What a waste it would have been. Now Anna says it was all wrong from the beginning. I don't have a finance degree so am not sure why? We will now have Lokayukts and Lokpal - I guess new job openings are good. We Indians need more jobs. I am sure its examination will be very tough. Lets see if I could clear its prelims in the first shot. The Job application is not out yet so am not sure if at my age I can apply or not. Bureaucracy is bigger than me. Vidhayaks are bigger than bureaucracy. Saansads are bigger than the Vidhayaks. Prime Minister is bigger than Saansads. And this Lokpal is even bigger than the Prime Minister. So am I still in the same position or did I move up? Huh! too complex. But I do like one provision though - If that traffic police does not settle for 50/- I would be able to report him as corrupt.

Tuesday, August 30, 2011

ईद मुबारक़

आया ज़माना याद, वो सेवैयाँ लाजवाब।
पैर छूते मिलती थी ईदी, हम भी कहते थे आदाब।
गले मिलना बना रहता था सुबह दूध की घोसी तक,
झुकते थे सर हमारे, बड़े रखते थे उस पर हाथ।
न सोचा वो थे मुसल्मा हम हिन्दू बच्चे शादाब,
क्यूँ खो गए वो दिन, कहाँ खो गयी वो चाँद रात?

Sunday, August 28, 2011

How to defame a movement in India?

  1. Its just a regional demand
  2. Nah South India doesn't care
  3. Its leaders are corrupt
  4. Its alienating Muslims
  5. Its a fascist movement
  6. No safeguards for and is against the weaker sections
I am glad Anna overcame all these hurdles before Congress could read any more pages from "How to rule India - By British Empire" hand book.

Saturday, August 27, 2011

My Poems on Android

Just launched a collection of my poems as an Android application - also happens to be my first book. I am the author, I am the publisher, I am the designer and I am the distributor. The Android installable can be downloaded from My Android Apps

अब मेरे शेर अन्द्रोइड फ़ोन के अप्लिकेशन के रूप में प्रकाशित हैं। इसका शायर भी मैं हूँ, प्रकाशक भी मैं हूँ और वितरक भी। शेर का अप्लिकेशन यहाँ से डाउनलोड किया जा सकता है मेरे अन्द्रोइड एप्स

Monday, August 22, 2011

Anna (अन्ना)

We Indians needed a Guru to tell us what we already knew but tell us the same with Vinamrata (a must watch):


Saturday, August 20, 2011

लखनवी

यह है लखनऊ मेरा:

न उर्दू है ज़ुबां इसकी,
न हिन्दू ही धरम इसका।
यहाँ अजान पे थमते हैं कदम सबके,
और घंटे तो सुभांअल्लाह।

मुश्किल न करें समझना शहरे लखनऊ को,
सादगी अब और कहाँ जिंदा छोड़ सरज़मी औध के?

Friday, July 29, 2011

How to name your cache

When my daughter was born one of the first things we had to deal with was to come up with her name. As we had not discussed it earlier, the arguments ensued and for a long time me and my wife did not have a complete agreement. Now besides her official name we call her by ten other names and 8 out of these 10 does not even have a literary meaning. But we love to call her by those names as they express hers and ours different moods. Naming your cache is one such process.

Common Cache Conventions

  • All upper case
  • All lower case
  • Upper or lower case with delimiters
  • Application Name dot cache name
  • Camel case
  • Cryptic internal looking name
  • No exposed names
All upper case
Though by Java conventions all upper case words are considered constants you would need to be cautious with cache names. Cache configurations are considered to be "updatable" at deployment time. As the updates are manual, cache names should also be humane. All upper case though are okay if short but long words or a combination of words all upper case does have a screaming feel and should be avoided.

All lower case
Though much easier on eyes all lower case cache names suffer from the problem of illegibility if the name is either long or a combination of words. Use of "-" or "_" can also be considered as long as this convention is followed throughout the configuration.

Schema qualification
Some coherence grids are configured to provide cache services for more that one application. Usually the cache access to this type of infrastructure are also backed up by a policy file that could define access permissions like application(A) can read but not write into a cache belonging to application (B) etc. These kinds of caches are better configured with names qualified by the application name. The application name should be short max 4 letters and could be all upper case. Like, a cache "Positions" of a Finance application can be named FIN.Positions while an audit cache "Statistics" could be AUD.Statistics and the Java policy (if any exists) can use regular expressions based on application names to set the Permissions.

Camel case
This is likely the most human readable format. As it also follows the Java class naming convention there exist an uniformity in how the classes and the caches are named.

Cryptic Names
A new convention has been introduced since Coherence transaction schemes after version 3.6. Some caches that are supposed to be used internally i.e, not meant for business usage can be defined with cryptic names. For example the Transaction scheme uses cache names starting with prefix "V$TXN-". If you desire to follow this convention then it would be good to create an internal cache configuration and use the DefaultConfigurableCacheFactory to initialize the caches through its ensureCache APIs. It will also be the responsibility of the application developer to tune these named caches - typically. Do not expose such a cache configuration for deployment time tuning.

No Names?
Some application may not want to expose the names at all. This may fall under two categories:
  1. Coherence bundles a default cache configuration that can be used to create caches with names starting with dist- or repl- etc. Following this convention makes the configuration very short and clean. But it also risks a loose usage pattern where caches either can be wrongly created or not known at all unless the code flow initializes it. A typical use of this pattern is when we do not know the cache names up front. Like if an application provides employee Id to email address mapping for companies. As companies use this service the application can create dist-CustomerA or dist-CustomerB as they join this service. No infrastructure changes would be needed and it is easier to expand the application.
  2. Cache mappings does not need to exist in the configuration and the application can use the name of the cache service to create its own caches. Though this either should be discouraged or be used in some advanced use cases. Either way, the naming convention should be consistent across all the components of the application.
Though there is no right or a wrong convention when it comes to cache names care should be taken to make it consistent, self explanatory and in some cases to show their usage. At the end of the day it is your baby, name it what you are comfortable with.

Sunday, July 17, 2011

Happy Birth Day Shona

Thursday, June 30, 2011

Enums, PropertyChangeListener and State machine

State machines are key structures to build stateful applications over stateless messages. Following is a simple uni-directional state machine used as a compute engine with different processes triggering at different state of the machine. The machine has three states - Begin, Work and Finish.

When a Session is started the Machine sets itself in a Begin state, Each next() then switches the machine from the current state to the next. Processor(s) can be registered at different states of the machine.

The states are Begin -> Work -> Finish -> Null (Sink) and are defined via an Enum:
public enum State {
  BEGIN,
  WORK,
  FINISH;
}

Lets start with a Session (Also the state machine)

public class Session 
{
  private String BEGIN;
  private String WORK;
  private String END;

  /**
   * Create a Session state machine with three uni-directional states.
   * BEGIN -> WORK -> FINISH -> Null
   */
  private enum SessionState 
  {

    BEGIN() {
        @Override
        public SessionState next() {
            return WORK;
        }
    },

    WORK() {
        @Override
        public SessionState next() {
            return FINISH;
        }
    },

    FINISH() {
        @Override
        public SessionState next() {
            return null;
        }
    };

    public abstract SessionState next();

   }

private SessionState STATE = SessionState.BEGIN;

private String sessionId;

private PropertyChangeSupport propertyChangeSupport;

private Session() {
    propertyChangeSupport = new PropertyChangeSupport(this);
}

public static Session newSession() {
    return new Session();
}

void next() {
    synchronized (STATE) {
        SessionState old = STATE;
        STATE = STATE.next();
        if (STATE != null) {
            propertyChangeSupport.firePropertyChange(STATE.name(), old, STATE);
        }
    }
}

boolean isValid() {
    return STATE != null;
}

String sessionId() {
    switch (STATE) {
        case BEGIN:
            if (sessionId == null) {
                sessionId = UUID.randomUUID().toString();
            }
            return sessionId;
        case WORK:
            if (sessionId == null || sessionId.trim().equals("")) {
                throw new IllegalStateException("Session Id can not be null in WORK");
            }
            return sessionId;
        case FINISH:
            if (sessionId == null || sessionId.trim().equals("")) {
                throw new IllegalStateException("Session Id can not be null in  FINISH");
            }
            return sessionId;
        default:
            throw new IllegalStateException("Session has not yet started");
    }
}

void addStateChangeListener(State state, PropertyChangeListener listener) {
    propertyChangeSupport.addPropertyChangeListener(state.name(), listener);
}

}


Lets build some processing units - One for Work and the other for Finish states


public class WorkSessionListener implements PropertyChangeListener {
private final String sessionId;

public WorkSessionListener(String sessionId) {
    this.sessionId = sessionId;
}

 public void propertyChange(PropertyChangeEvent evt) {
    System.out.println ("[" + sessionId + " - Working]=" + evt.getOldValue() + " -> " + evt.getNewValue());
}
}

public class FinishSessionListener implements PropertyChangeListener {

 private final String sessionId;

public FinishSessionListener(String sessionId) {
    this.sessionId = sessionId;
}

public void propertyChange(PropertyChangeEvent evt) {
    System.out.println ("[" + sessionId + " - Finish]=" + evt.getOldValue() + " -> " + evt.getNewValue());
}
}


Now lets test it


import org.junit.Test;

public class SessionStateChangeTest {
@Test
public void testSessionStateChange() {
    final Session session = Session.newSession();
    final Session session2 = Session.newSession();

    session.addStateChangeListener(State.WORK, new WorkSessionListener(session.sessionId()));
    session.addStateChangeListener(State.FINISH, new FinishSessionListener(session.sessionId()));


    session2.addStateChangeListener(State.WORK, new WorkSessionListener(session2.sessionId()));

    Thread t1 = new Thread(new Runnable() {
        public void run() {
            while (session.isValid()) {
                session.next();
            }
        }
    });

    Thread t2 = new Thread(new Runnable() {
        public void run() {
            while (session2.isValid()) {
                session2.next();
            }
        }
    });

    t1.start();
    t2.start();

    try {
        t1.join();
        t2.join();
    } catch (InterruptedException exp) {

    }
}

}


We should see two BEGIN -> WORK and one WORK -> FINISH messages for two session ids.

Enjoy!

Wednesday, June 29, 2011

Adios chavanni

Today was the last day of Indian chavvani or chaar aana that to be legally used. It was launched in 1950 as an Indian rupee unit and served its purpose well for 61 years. I still remember seeing ek aana or one paisa being in circulation. Though, as I started to recognize the world around me ek aana was put to rest. It became a collector's item and we as kids could not keep our hands off of one. As I lost my piggybank I don't even know if I will ever see it again. That time ek aana could not buy anything but one single "Kampat" a locally made toffy. On the other hand while ek aana was setting down in oblivion the other unit - 10 paisa quietly lost its value. Time spiked and even beggars stopped asking for a 10 paisa grant. Thats when the chavanni had its value. Unlike its predecessors chavanni was special. Its value hovered around as a unit that can make the "other unit" bigger. An increase of 25 paisa in bus/tempo fair raised eyebrows as students. Having one in my pockets made me feel richer and losing one could have meant loss in purchasing power. Chavanni was small and circular, like our world. It was easy to exchange as a favor, like love that could put a smile on a face without hurting the giver. Chavanni was the only unit that I have ever heard used as a name to call the boys working on road side dhabas or assistance to truckers. But like many other good things it did find its abuser too. It came with a class system. Calling one a chavanni would mean to demean him. Many people would not know that India used a different metric system in its past. 1 Rupee (or 100 paisa) was equivalent to 16 aanas. Chavanni (a quarter - 4 aanas) and Atthanni (8 aanas or 50 paisa) were the only two units that were quietly migrated to the new metric system as they were easier to divide between 100 and 16 a challenge that 10 paisa could not deal with. Now Atthanni is alone. It has lost its partner. Its the last bastion of the old aana system though not in use. As Chavvanni slowly leaves the market with heavy remembrance of its past I can hear it sing this tune:

जाते हैं ये जगह छोड़ के अंधेरों कि तरफ,
काश बैठा न होता मैं संग नोट हज़ार के।
जबकि उड़ते रहे बड़े नोट मॉलों में हर तरफ,
मैं धूल खाता रहा ताउम्र छोटे बाज़ार के।

Sunday, June 26, 2011

Has Hindi Literature died after Agyeya? Or not!

Its ironic to write about Hindi literature in English. But if your sentiments are not publicly searchable in Google then I guess they do not exist, times have changed. If there were no Jai Shankar Prasad, Premchand or Mahadevi Verma Hindi would still have only be known for Tulsi, Sur and Kabir. But after this era as time got shorter and shorter new literature started to find its place more on podiums than in books and even lesser in class rooms. Hasya Kavi Sammelans became forefront channels to spread what they thought was Hindi. Poems became story telling that has little to no lifetime beyond the relevancy of the story itself. The conditions of writers fared not so bad some even turned out to be huge commercial success, thanks to the Bollywood and Television. Now some of the same very writers question why Hindi should be easier, I guess they are the ones who could find their roots in novels sold on the Railways kiosks. So where is this language? Like many other non-English international languages it does find challenging to keep up. The most dangerous is lack of quality Writers who can express today's challenges in a timeless manner. Aloofness from Government and mid to poor financial backing from India's Hindi belt are also some contributing factors. मंचीय कवियों पर Doctorate हो रहे हैं। चुटकुले लिखने वाले आज के साहित्यकार बन बैठे हैं। बस अब तो यही कह सकते हैं:

न रह गयी समझ मुझमे, न लिखने का मन ही करता है।
कभी थे यायावर हम भी, अब तो बस कल की ही चिंता है।
जो अग्नि थी भी कभी मुझमे, बुझी सी अब वो रहती है,
जलाया सोच कर ये था कि स्याही इसी से बनती है।
किताबें हो गयीं वो कम कसम खाके जिसे सच बोलूँ,
सुनेगा कौन सच मेरा किताबें झूठ की जो खोलूँ?
कवि वो जा चुके हैं सुन जिन्हें आँखें नम होती थीं,
कलम उठता नहीं मेरा खीझ अब मेरी ये पीड़ा है।
कभी थे यायावर हम भी, अब तो बस कल की ही चिंता है।

Wednesday, June 01, 2011

Are the new age companies bastardizing names?

There was a time when the name of the killer companies (Companies at the forefront) had a lot of weight. "International Business Machine", "Computer Science Corporation", "General Electrics", "General Motors", "Scientific American" and so on. The names sound similar to people of that era like the names of our Grand parents. Each name has at least two words compounded with titles. Names had deep meanings and somewhat reflective of what they do. Then like an era of James Brown, Father of todays Rap music names of the companies turned more hip and shorter. "Oracle", "Apple", "Sun", "Amazon". Things started to change and the names reflected a new generation of companies. Instead of names that sounded more like "King Richard 1 The Lion Heart" it became simpler but still meaningful like "Prince Charles". The best thing about Generation is that it changes and brings new approach to life. "Google", "Twitter", "Facebook", "LinkedIn" - you won't know what they do unless you use them. Websters and Oxford must be having hard time scratching their heads on how to recognize these vehemently meaningful names in their dictionary? How would "Search anything on the web Corporation" sound instead of just Google? Or "Express thoughts in 140 characters Private limited" for Twitter? No they won't sound right. Name of a company has nothing to do with what they do. In this fast paced life we don't have three seconds to pronounce a name, we only have one - so better use it right.

Tuesday, May 31, 2011

Recommend me a vacuum cleaner

I am in a vacuum cleaner market again. Would appreciate your honest suggestions. This is what I am looking for:

  • Easy to use
  • Must work on carpets, hardwood, vinyl and stone floorings
  • After vacuuming I should feel 100% safer for my infant to crawl on
  • Easier to maintain and long lasting
I have had varying experience with different cleaners I have owned so far.
  1. Hoover canister - The plastic broke and lost suction otherwise loved it. Was too loud.
  2. Brissell Upright with bag - Use to lose suction and frequent bag replacements.
  3. Shark bag less - Absolutely loved it. But the one I had was relatively small.
  4. iRobot Discovery - Loved it at first but then started giving problems till it almost broke.
  5. Dirt Devil - Was tired of expensive vacuums so bought this one. It was okay at first but now loses suction and does not pick up hair or even small crumbs.
So? I am looking for one again and this time am more resilient and looking for one that I could own for the next 15 years without having to replace one. Suggest!

BTW: I bought a Shark Navigator from BBB (A real great store) and it just blew my expectations. Carpet feels like I just had it installed.

Thursday, May 26, 2011

Scooters India Limited - A potential on sale

This is a part of an email conversation that I had with Scooters India Limited (now on sale) in the beginning of year 2001. Even then I was fascinated with electric vehicles and being from Lucknow I wanted SIL to take a head start at least in India as they had successfully launched an electric three wheeler then. I hear the company is on sale and Lohia auto who makes electric mopeds are interested in its stake. Even before Tata Nano I had envisioned a Vikram EV sized car run on electric to be launched and target a market segment that existed even then. That conversation ended in informal exchanges and "why would a company react on some enthusiast's email" thing. But now I wish if they had acted or if I had enough Money to buy them now. I still see a grand Indian market up for grabs.

Tuesday, May 24, 2011

How to be a successful Software company?

1. Build a rock solid product to keep fewer issues.

2. Hire a few star QA developers and keep them close to product engineers
3. Provide a easy to use web interface to report problems.
4. Respond to email as it is received.
5. Personalize the response.
6. Keep the customer in confidence by updates and describing challenges, if any.
7. Build a repo and build further on top of this relationship.

Barely it matters what your product is but it is going to be successful.

Monday, May 23, 2011

Chrome unable to find Google

Now this what I really find hilarious:




Tuesday, May 17, 2011

My view on DDD

In any DDD practice there are two concerns : core-domain and core-challenges. Core challenges like performance, throughput, scalability, latency etc drives the selection of the most efficient model that projects the core-domain.

Friday, May 13, 2011

A letter from Barack to me! yay!

And I am so enthralled! So as you have befriended me please solve all my problems now!
















Yeah I know, but still!

Monday, May 09, 2011

Why Pakistan is not incompetent but they are lying

While I do meet people from Pakistan who do not hate India but may have a mixed feeling of dislike, distrust, betrayal or jealousy - true or not, I risk using the word Pakistan here as a generic noun. My use of the word mostly means its government, intelligence, Army and Jihadist/Terrorists. Keeping the general masses out, these four elements itself create a web of entangled policies that the country has followed since its inception.
Even though an ally of many decades, Pakistan does not love America. Their hate and distrust for India is way more profound than their love for America. They need America only to keep things at home in place when it comes to economy and defense. Its like a Bank - We use it to get loans but leave no opportunity to curse its higher interest rates. After the debacle of 1971 war with India, Pakistan realized and was convinced that it needed a new instrument. That instrument was gifted to it by Indian politicians in the form of Kashmir and for a short while Punjab. While their early experiments in Punjab appeared to succeed they knew basing it entirely on a political unrest is not sustainable. They needed religion. Kashmir turned out an ideal platform. While similar experiments were done by US in Afghanistan, Pakistan was quietly repeating it inside India. India's political proximity to USSR gave a good platform for US-Pak friendship, two political partners with different domestic values.
Then came Kargil - a huge miscalculation by Pakistani Army. They banked on their strategic assets and a political neutrality from America. Their Army felt betrayed by American response which was hugely pro-Indian. American pressure on Pakistani Government averted a full scale war between the two nuclear nations but left a seed of distrust in Pakistani intelligentsia. They now found themselves dependent on US but someone they cannot hedge against India. Even though at a high capital cost, Kargil turned out to start a new political chapter between India and US. Then came 9/11 and an arrow in their quiver went rogue someone they so effectively used against the Russian occupation in Afghanistan. By then Osama already had become a symbol of global Jihad the term Pakistani ISI were already knee deep in using in Kashmir. Pakistan found itself in a precarious triangle made up of Army, ISI and Jihadists, where losing the effectiveness of one meant losing another. They could not lose this triangle. These three elements do not just work for the country, they own it and neither of the three need the country's political establishment. Alas, this is the only branch that is kept so less informed.
Osama is killed. He is killed inside Pakistan. He is killed in a well designed safe house unlike some hole where Saddam hid himself inside. He is killed in a relatively westernized city. And, he is killed in a place surrounded by Military installations. If nothing else the sanity itself tells that he could not have done this without anybody's knowledge. This anybody just can not be his own personal network, It has to be from this triangle. If the countries President and Prime Minister are saying they did not know about it then possibly they are speaking the truth. After all they did not know about the Kargil either. If ISI or Army says it, then its an out right lie. They seem to not only have known it but seem to have been instrumental in moving him from the mountains of Afghanistan to the heart of a Military city. What US does after this episode is just anybody's guess but they may find themselves in the same place and similar scenario when they had to bail out corrupt banks because the risk of their failure was too high.

Thursday, April 14, 2011

A story I told my friend

Once upon a time a King died. The death agents came and decided he has always been a good guy so he should go to heaven and not to the hell. The King said all his life he has always chosen things after looking and testing it and he would like to see the heaven first before moving in. So the agents decided to give him a solo tour for a few minutes, after all he has been so good all his life. Just after a few minutes passed the King came back running nodding his head. Nope I would not go to the heaven, Its not what I thought it would be like - he said. What's wrong? After all people only wish to enjoy it - asked the agents. NO! the angels are not as beautiful as I thought they would be!! - King remarked.

Sunday, April 10, 2011

Bharat Ratna for Sachin

Bharat Ratna awardees should show exemplary achievements in the field of Arts, Science, Social service or Literature. Though the word sports does not appear in the statement but it is implicit. Sports is an Art played with in scientific parameters, produces and has one of the most well read literature and if look at Cricket does a great social service to unite the Country and Internationally. So included or not sports personalities achieving exemplary feats should be awarded Bharat Ratna. And what a beginning of it would be with Sachin!

Monday, April 04, 2011

Mr Afridi - be graceful in defeat

First of all congratulations Team India for winning the Cricket World Cup after a long 28 years of wait. It was a deserving win and every bit of celebrations for a team the way they planned, played and stuck together. That said for many Indians the Semi-Finals against Pakistan was almost a Final and would have been content even if India would have lost to Sri Lankans. At the end what surprised us the most was Afridi's humility in accepting defeat. It was the first time ever in his career that he seemed one decent Guy passionate about Cricket. World, specially Indians were ready to forget his waywardness. Afridi thanked the "Indian Nation" and even while in Pakistan asked one aggravating journalist - "Why do we hate India?". And, I thought for two nations who put Cricket before religion this could be a new way to friendship - Not to be. Afridi appears in a Pakistani channel and challenges the Indian hospitality and media and even appeared to claim that Pakistan and India can never be friends and live together. Those were some very strong words coming out of someone whose butt just got kicked not too long ago. I still give Afridi a benefit of doubt. It is all but natural for him to give contradicting statements to appease those who are readying themselves to avenge the defeat on Afridi's career. Only this time he seems unlikely to continue as a Captain of his team if past history of that nation is to be believed. And Thanks to those Pakistanis who still think India and Pakistan can not be friends and neighbors - You don't deserve to be a neighbor of any country.

Thursday, March 31, 2011

इक और लिखा, सुनो

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

Monday, March 28, 2011

The Indo-American pronunciation mess

Plenty you will see laughs at Indian pronunciations and use of words. But don't you dare to think you are right.
- What you say Flashlight we say Torch.
- What we say Torch you use it for arson.
- The way you say arson sounds an (Yoga) Aasan.
- When we mention Yogi you think of Baseball, while ball is Hair to us.
- We keep Hair Black and long, you kept Black away for long.
- Your money is on your Black leader, our leaders have a lot of black money.
- Even our common bond is (mis)pronounced by you as demaucracy the word we only use to demo.

Wednesday, March 16, 2011

Playing 11 against West Indies

So with all the dismal (not so impressive) to an absurd performance (Remember English and SA games?) by the Indian team they need to be extra cautious when they play West Indies next, if not for points but to rebuild the confidence. My opinion of the playing 11 be:

  • Sehwag
  • Tendulkar
  • Gambhir
  • Kohli
  • Yuvraj
  • Dhoni
  • Yusuf
  • R Ashwin
  • Zaheer
  • Harbhajan
  • Ashish Nehra

Tuesday, March 15, 2011

To find which class contains a method in a given jar

Okay.. I vaguely remembered a method that existed somewhere that could do what I wanted but could not recall the class it was in, and all I had was the jar. So I wrote this:


#!/bin/bash
for i in `jar tvf $1 | grep class | awk '{print $8}' | sed -e "s/\//./g" | sed -e "s/\.class//g"`;
do
echo $i;
javap -classpath $1 $i | grep $2;
done

Enjoy!

Friday, February 25, 2011

Why I got disenchanted with my Karate Sensei?

Years ago I used to learn Karate, Shotokan Karate to be more precise. It was an easy thing to join. I was looking to learn some self defense and the Office Gym introduced a program on Shotokan Karate. I am not a very physically active guy so my reason to join was not to get exercises that I could do in 24hr fitness. I wanted to learn the art. And bang it started with a flyer. We had a sixth degree blackbelt as our Sensei. In the first few sessions he explained the history of Shotokan and how this is one of the few traditional martial arts still in practice. He also explained how many American Dojos are more into sports Karate and not the traditional ones. He explained Shotokan was about low stances, not so much moving and an art of very high concentration. Traditionally only one blow was thrown by its practitioners and the fight would be over unlike many frequent kicks and punches. It fit very well with a Guy who was slow, did not want to move, could sleep while in one stance and I was in. Sensei did not have to explain the history and give an impression he favored traditional and I could have been happily be doing sports Karate without really knowing its traditional variant. But the pretext set my expectations to a different level. I thought I was learning something more deadly than those romanticized Gym activities. I was enthralled.
The membership grew and more folks started going to his real Dojo. The class in the Gym started to become physical exercises and talks of participating in Tournaments started to become more frequent. Instead of how-to decapitate your opponent, points were given for touching your opponent's ribs during sparring. In no time I figured out I was into Sports Karate. There was no problem as such, I was still enjoying it but my expectations were thrashed and I started to look for reasons to leave. That reason came a few years later when Dojo fees were increased that I thought was too high for me. I was disenchanted with the Sensei and I thought he too became commercially inclined. I respected him. Next few months saw me taking a KravMaga class that I thought was run by some street fighters. I ended up joining Wing Chun paying more than what I thought was expensive and learned more in three months than what I learned almost in four years of Karate. There was nothing in the art itself, Karate is still as deadly as any other art but it was more to the sincerity of its coach that increased my keenness in learning. I left Wing Chun because work load along side my School turned out to be too much to handle. The gist of the story is it is very important to set the expectations right. It matters less what you are really doing what matters is if you are still steered in the same direction that you had set your feet on.

Wednesday, February 16, 2011

Ambassador Car Ad

- एक भरोसा जो समय के साथ मजबूती से चला आये - हमारा Ambassador
- A faith that continues with time - My Ambassador

Thursday, February 10, 2011

चलो एक मज़हब पर शेर

नारंगी हरियर हुआ, अपना अपना रंग,
पर मंदिर मस्जिद एक है, जो तू है भिखमंग।
फिरता माला फिर रहा, चढ़ा किताबी भंग,
ना जाना इक राह वो जिसपे चलें सब संग।

Sunday, January 30, 2011

In support of Vastanavi

I did not know who Vastanavi was not until a few weeks ago. I am no fan or a supporter of Modi either. In fact I don't like him. I have lived in Ahmedabad for a few years and am quite familiar with its dynamics. I also have some opinions about political parties now reacting in response to Vastanavi controversy and above all I always have had a respect for Darul uloom deoband as an institute because of its unquestioned contribution to Indian freedom struggle in spite of its theologies being associated to one militant form of Islamic belief. Darul Uloom has always had a pro-India stance that very few Islamic institutions come out very vocal on. I am also concerned with a slow poisoning of Islamic educational system with a strict form of religious fanaticism. That said, financial situation of a common Gujarati irrespective of his religion is better compared to any other state. This is not something you would have to talk about just go and see it. And if this is acknowledged by Vastanavi then where was he wrong? In spite of Gujarat witnessing one of the worst and deplorable religious riots of recent times there does exist an environment for growth and there is nothing wrong in acknowledging that either. Indian Islamic Institutes have to decide if they should take a progressive path or go back in times. Calling water a water is no crime making it drinkable is a challenge.

Thursday, January 13, 2011

चलो शेर सुनो

अपना रस्ता छोड़ के मैं क्यूँ यूँ मुड़ा था?
कुछ तो तेरे अश्क थे, शायद कुछ मैं थका था।
ठौर वो ली जिस पर देखा फूल थे,
छुप रहा वो शूल मुझे दिख न सका था।
अब पड़ा हूँ थक रहे पैरों को लेकर,
धूप की गरमी को इक कम्बल समझकर,
हाथ मेरे पड़ रहे उन शूल पर,
झुकती जाती दर्द से अब ये कमर,
भागना क्यूँ छोड़ कर देखा समय?
शायद वो तेरे अश्क थे या मैं थका था,
अपना रस्ता छोड़ के जब यूँ मुड़ा था।

Sunday, January 09, 2011

25 weirdest interview questions - what would my responses be?

yahoo.com published this article - the-25-weirdest-interview-questions-of-2010 Even though these are meant to be instantaneous replies but what would my responses be (skipping those I would say no idea)?

1. If you were shrunk to the size of a pencil and put in a blender, how would you get out?

=> I will have a "lead"ing scream!

3. What is the philosophy of martial arts?
=> To avoid fight as much as possible.

5. Rate yourself on a scale of 1 to 10 how weird you are (Reportedly from Capital One (NYSE: COF - News))
=> 10 - not weird at all.

6. How many basketballs can you fit in this room? (Reportedly from Google (NasdaqGS: GOOG - News))

=> If this room is empty then atleast = lxhxw/(4/3*pi*r3) or practically infinite if you take the air out of the basket balls.

7. Out of 25 horses, pick the fastest 3 horses. In each race, only 5 horses can run at the same time. What is the minimum number of races required? (Reportedly from Bloomberg LP)

=> Minimum 5 races are needed. Measure the timings from each race and pick the first three.

9. You have a birthday cake and have exactly three slices to cut it into eight equal pieces. How do you do it? (Reportedly from Blackrock Portfolio Management (NYSE: BLK - News))

=> if three slices make one piece then cut it in eight equal pieces.

10. Given the numbers 1 to 1000, what is the minimum number of guesses needed to find a specific number if you are given the hint "higher" or "lower" for each guess you make? (Reportedly from Facebook)

=> 1 (The first guess is the right one)

11. If you had 5,623 participants in a tournament, how many games would need to be played to determine the winner? (Reportedly from Amazon (NasdaqGS: AMZN - News))

=> one

12. An apple costs 20 cents, an orange costs 40 cents, and a grapefruit costs 60 cents. How much is a pear? (Reportedly from Epic Systems)

=> A "pair" of what?

13. There are three boxes. One contains only apples, one contains only oranges, and one contains both apples and oranges. The boxes have been incorrectly labeled such that no label identifies the actual contents of its box. Opening just one box, and without looking in the box, you take out one piece of fruit. By looking at the fruit, how can you immediately label all of the boxes correctly? (Reportedly from Apple (NasdaqGS: AAPL - News))

=> Pick the "Apples + Oranges". If the fruit is apple then relabel the Apple box to Apple and Oranges.

14. How many traffic lights are in Manhattan? (Reportedly from Argus Information and Advisory Services)

=> Three - Red, Yellow and Green

15. You are in a dark room with no light. You have 19 grey socks and 25 black socks. What are the chances you will get a matching pair? (Reportedly from Convergex)

=> pick three you will always get a matching pair.

16. What do wood and alcohol have in common? (Reportedly from Guardsmark)

=> Two o's

17. How do you weigh an elephant without using a weigh machine? (Reportedly from IBM (NYSE: IBM - News))

=> Put the elephant in a water tub completely filled with water. Measure how much water it displaced. measure the difference.

18. You have 8 pennies. Seven weigh the same, but one weighs less. You also have a judges scale. Find the penny that weighs less in three steps. (Reportedly from Intel (NasdaqGS: INTC - News))

=> Split in 4x4. find the four that weigh less. Split in two -> Find that weighs less. Split 1 and 1 and find the lightest.

19. Why do you think only a small portion of the population makes over $150,000? (Reportedly from New York Life)

=> labor report.

22. What's the square root of 2000? (Reportedly from UBS (NYSE: UBS - News))
=> 20 root 5

23. A train leaves San Antonio for Houston at 60 mph. Another train leaves Houson for San Antonio at 80 mph. Houston and San Antonio are 300 miles apart. If a bird leaves San Antonio at 100 mph, and turns around and flies back once it reaches the Houston train, and continues to fly between the two, how far will it have flown when they collide? (Reportedly from USAA)

=> 0 miles. The bird and houston train are at the same location

24. How are M&Ms made? (Reportedly from USBank)

=> with a machine

25. What would you do if you just inherited a pizzeria from your uncle?

=> I will ask my wife to run it.