Visual Studio Tip

April 3rd, 2009

If you are normal, you must be loving Intellisense in source editor in visual studio. You press ‘.’, and you get help.

It is good, with one bad side effect. When intellisense window is opened, you cannot see source code beneath it. So, sometimes when you need to see that part of source code, you have to close intellisense window, look at source code, and open intellisense window again.

Do not blame microsoft, as they have provided a solution. Just press ‘Ctrl’ when intellisense window is open. Try it now.

Instance Failure

April 3rd, 2009

If you are successful in getting visual studio barking at you with error message “instance failure”, there is a very good chance that you have used \\ in your connection string in configuration file. Replace all \\ with \ and you should be okay.

I learnt it hard way!

Why NOT to use triggers in RDBMS….

December 31st, 2008

Reason 1: Triggers are not maintenance friendly.

Triggers are basically “Side Effects” and too many of them will create complexity of understanding.
Triggers are “hidden” in data definition language (DDL).

Reason 1: Buggy triggers can create issues.

Any buggy code can create issues, but triggers have context to create tricky concurrency ones.
Triggers are fired even when transactions are rolled back. And that means, even if inserted rows rolled back, “after insert” triggers would have fired! If this fired triggers are doing something outside RDBMS (like sending mail), that will be a problem.
In general, triggers must not do anything with external entities if they are not participating in transaction.

Also, triggers must not work on mutating tables. This means if trigger is executed as result of query operating on table X, then trigger must not query table X. Simple reason is that for one query, trigger may be fired many times and each time trigger will see different data in table X. In general, it is difficult to keep entity integrity via triggers.

Advice: Treat triggers as last resort to solve a problem.

Source:oracle.com

What is Framework?

December 6th, 2008

Framework is incomplete, though concrete, driving solution to recurring high-value problem. To elaborate more, let me go through properties of framework one by one.

1. Framework is concrete.

In other words, framework has physical components - usually files usable during production.
Java and .Net frameworks are set of concrete components like dlls, arjs, exes etc.

GoF Design Patterns are not framework as they are practical design ideas. It is up to you to apply those ideas to context. Design patterns are logical ideas which you convert to concrete software in a project, whereas framework is concrete already.

2. Framework is incomplete.

Framework itself is not usable on its own. Framework does leave some fill-in-the-blanks for its user.

If you deploy Java/.Net framework to a end-user computer, it does not add any usability value unless you write your own code to use Java/.Net and then deploy that code in executable form along with framework.

More powerful is framework, less complex are fill-in-the-blanks and more efforts in learning to use framework.
Frameworks pose trade-off challenge between learning curve and saving-coding-time.

3. Framework drives solution.

Framework dictates how you do fill-in-the-blanks. Framework dictates overall architecture of complete specific solution.

You have to follow ASP.Net rules, if you have to use ASP.Net framework to build a website.

4. Framework helps solving recurring problems.

That just means that framework are very much reusable as they are helpful in many recurring problem contexts. This also implies commercial case for building a framework for set of problem contexts.

5. Framework deal with high-valued problems.

How to add two number is a problem. Solution is a routine in a form of library. But then it is not a framework as problem is not high-valued.

Providing object persistence is high-valued problem and you can build framework for same. Note that value is relative term.

If you look at these properties, it does not make sense to try to solve any specific non-trivial problem without help from a already existing and proven framework!

What costs more? SMS or Hubble Data Transmission?

November 24th, 2008

Dr Nigel Bannister (University of Leicester) worked out cost of obtaining 1 megabyte of data from Hubble – and compared that with the 5p cost of sending a text SMS.

He said: “The bottom line is texting is at least 4 times more expensive than transmitting data from Hubble, and is likely to be
substantially more than that. The maximum size for a text message is 160 characters, which takes 140 bytes because there are only 7 bits per character in the text messaging system, and we assume the average price for a text message is 5p. There are 1,048,576 bytes in a megabyte, so that’s 1 million/140 = 7490 text messages to transmit one megabyte. At 5p each, that’s £374.49 per MB - or about 4.4 times more expensive than the ‘most pessimistic’ estimate for Hubble Space Telescope transmission costs.”

There you go!

Identify cancer early…

October 24th, 2008

Here are symptoms of cancer (of various kinds) taken from a postal mail from http://www.globalcancer.org/:

C: Change in bowel or bladder habits
A: A sore throat that doesn’t heal
U: Unusual bleeding or discharge
T: Thickening or lump in breast or elsewhere
I: Indigestion of difficulty in swallowing
O:Obvious change in wart or mole
N: Nagging cough or hoarseness

Spread this knowledge…

How to identify a gujarati?

September 8th, 2008

I received a forward from cousin on - How to identify an Indian. Based on that I have come up with sysptoms of being gujarati.

Enjoy!

  1. Everything you eat is savoured in sugar.
  2. You reuse gift wrappers and boxes at least twice.
  3. You do not know what is aluminium foil.
  4. You are Always standing next to the two largest size suitcases with too many small ones all around your body at the Airport.
  5. You arrive one or two hours late to a party - and expect host to behave as if you are early.
  6. You peel the stamps off letters that the Postal Service missed to stamp.
  7. You recycle Wedding Gifts, Birthday Gifts and Anniversary Gifts - and everybody knows about it and considers you good for that.
  8. All your children have funny pet names, which sound nowhere close to their real names.
  9. You take snacks anywhere it says ‘No Food Allowed’ .
  10. You talk for an hour at the front door when leaving someone’s house.
  11. You load up the family car with as many people as possible. Still, everybody is okay. If somebody refuses to sit in full car, that is considered arrogance.
  12. You try to keep wrapper plastic that comes with anything new in your house whether it’s the remote control, VCR, carpet or new couch. Note these new things are convered in that plastic.
  13. Your parents tell you how to do ‘everything’.
  14. You buy and display crockery, which is never used, as it is for special occasions. On special occastion, you do not use them so that they can be kept for show.
  15. You have a vinyl tablecloth on your kitchen table which moves if you move anything on table.
  16. You use grocery bags to hold garbage. You throw these bags anywhere you feel like.
  17. You keep leftover food in your fridge in as many numbers of (smaller and smaller) bowls as possible.
  18. Your kitchen shelf is full of jars, varieties of bowls and plastic utensils. Approximatelly, half of these are got free with purchase of other stuff.
  19. Your mother forces you to carry a stash of your own food whenever you travel (and travel means any car ride longer than 15 minutes).
  20. You own a pressure cooker.
  21. You diplomatically plan to make sure somebody else pays dinner bill.
  22. You live with your parents. Neither your parents nor you want otherwise to be separated.
  23. You don’t use measuring cups when cooking, though you use smallest utensil to make sure amount food looks less to guests (so that they eat less!).
  24. You take pride in breaking a queue.
  25. You can only travel if there are at least 10 persons (some of them distant relatives) to see you off or receive you. If there are less persons, you feel alone.
  26. If it is is NOT your issue, you always take interest in it, analyze it etc and feel proud to spread it at velocity of more than speed of light.
  27. Your wedding gifts are mostly in cash with a one rupee coin added to the note in a cover.
  28. If you don’t live at home, when your parents call, they ask if you’ve eaten, even if it’s midnight.
  29. You call an older person you never met before Uncle or Aunty.
  30. When your parents meet strangers and talk for a few minutes, you discover you’re talking to a distant cousin.
  31. Your parents don’t realize phone connections to foreign countries have improved in the last two decades, and still scream at the top of their lungs when making foreign calls.
  32. You have bed sheets on your sofas so as to keep them from getting dirty.
  33. It’s embarrassing if your wedding has less than 600 people.
  34. All your Tupperware is stained with food colour.
  35. You have drinking glasses made of steel.
  36. You have mastered the art of bargaining (Not only in shopping!).
  37. When you go to restaurant, you make sure to take all tooth picks.
  38. When you go to Hotel, you make sure to take all consumables. You think that you have paid for it and it is your right.
  39. You speak Gujlish (Gujarati + English).
  40. If your mothers sees you after few days, she feels your health is not good.
  41. If you meet two more Gujaratis, your volume become very loud automatically.
  42. You go to any commercial establishment, you tend to try to speak in Hindi, even if opposite party is Gujarati.
  43. You can always find a fault in best of airports, best of hotels, best of shops etc.

Would I switch to Google Chrome?

September 7th, 2008

Nope. I will not. I tried it by making it my default browser for few days.

Pro: really fast, Easy to use, Good for casual browsing
Con: No add-ons like FireFox 3.x

I will still keep using FF3.x…

Golden rule of decision making…

September 6th, 2008

If you have to decide on something important enough, do you get in a dilemma?

You want to buy a car. At the same time, you do not want to spend too much money. Your old car is still good enough, though just reaching a point where you should sell it off. No new car is good enough is your budget and you are scared that you may end up buying accident-damaged second hand car. You end up in a situation where all options have some negatives for your context and you think too much over it which keeps you away from making decision.

To get you out of this dilemma, think if following statements are true.

* All non-trivial decisions have +ve and -ve possibilities.
* All non-trivial decisions have impact (good, bad, etc) when actually taken. Impact may not have been seen as possibility before.
* You can learn from impact.
* Only you are responsible for impact of decision supposed to be taken by you, even if you take ‘advice(s) or guarantee(s)’ from no-matter-whom.
* Nobody can guarantee success, though somebody can help/influence/guide/opine etc. Note that anybody can guide you towards good or bad decision based on their own incentive.
* Anybody can do only this : Make sure to try hard enough, in reasonable time frame, that decision is ‘good’ in a context, in any case.

All in all, here is golden rule.

Take a conscious decision and take responsibility for impact.

Note that keeping decision pending is also a decision!

nFAQ: Air Travel

June 22nd, 2008

nFAQ: Not Frequently Asked Questions

Q: Why do they ask us to make seatback upright while landing and taking-off?
A: So that if aircraft crashes, we do not easily slip out of our seat belt.

Q: Why do they ask us to keep window lid open?
A: So that if there is something wrong outside (i.e. engine is on fire), one of us can see and inform them.

Q: Why do they ask us to keep mobile phones in switched off mode?
A: So that there is no chance of interference with radio devices on aircraft.
Note that it is just about not taking chance. If every phone would cause interference then they would not allow us to carry it on aircraft at all.

Q: Why do they serve candies before take-off?
A: So that we can ’suck’ candies to avoid ear-whistles or change in blood pressure.

Tree of Knowledge about Tea !

June 5th, 2008

Tea
Tea

  • From warm weather plant - Camellia sinensis
    • Except herbal tea
  • Black tea
    • Oxydized for 2-4 hours
    • Most used
    • Adding milk ruins advantage!
    • Helps in
      • Blood Pressure irregulation
      • Arteries get relaxed
  • Green Tea
    • Not oxydized
    • Leaves are steamed, rolled and dried
    • Has antioxidant - rich in polyphenols - epigallocatechin gallate (EGCG)
    • Helps in curing
      • Cancer, Rheumatoid arthritis, High cholesterol levels,
        Heart disease, Infection, Impaired immune function,
        Obesity, overweight, High blood sugar levels, Ageing
  • Oolong Tea
    • Leaves are withered, rolled, semi-fermented and fired
    • Rich in polyphenols
    • Helps in
      • Obesity, tooth decay, atopic dermatitis
      • Drink after high-cholesterol meal to reduce fat intake
  • White Tea
    • Least processed
    • Leaves and buds are steamed and dried
    • Helps in
      • Like Green tea, but better
  • Matcha Tea
    • High quality green tea
    • Leaves are ground fine
      • Tea particle goes to water
      • instead of steeped/strained like other tea
    • Strong, sometimes bitter flavor
    • Helps in
      • Like green tea, but better
  • Pu-erh Tea
    • processed, fermented, formed into bricks or cakes and aged
    • Older is costier
    • Named after chines town
    • Strong earthly taste
    • Helps in
      • Cholesterol level, indigestion, hangover
  • Red Tea
    • rooibos
    • Herbal tisane grown only in South Africa
    • Rich in polyphenols and flavonoids
    • Naturally caffeine free
    • Has iron, potassium and copper
    • Helps in
      • Boosts immune system
  • May contain fluorides and pesticides like all veg
    • Harms bones

List of ‘Joke’ ideas!

May 20th, 2008

Source: Outlook

  •  Paperless Office
  • Five Year Plan by Indian Government
  • World Institutions like UN
  •  Nine-To-Five work time
  • Corporate Social Responsibility

Accidental ideas are valueable, too! do not ignore them!

May 20th, 2008

To prove, here is partial list of useful things produced, discovered or invented by accidental idea(s):

1. Microwave Oven
2. Pacemaker
3. Velcro
4. Slinky (Spring like toy)
5. Saran Wrap
6. Safety Glass
7. Urea Synthesis
8. Teflon
9. Super Glue
10. Scotch Guard
11. Helium
12. Iodine
13. Polycarbonates
14. Celluloid
15. Rayon
16. Indigo
17. Saccharin, Aspartame, Acesulfame - sweeteners
18. Penicillin
19. LSD
20. Viagra
21. Laughing Gas
22. Oral contraceptive
23. Vaccination
24. Uranus
25. Superconductivity
26. X Rays
27. Inkjet printer’s working principle
28. Rubber Vulcanization
29. Corn Flakes
30. Ice Cream Candy Bar
31. Post-It Notes
32. Potato Chips
33. Frisbee
34. Sandwich
35. Coca-cola
36. Champagne

Happening changes in India

May 20th, 2008

Here is 25 things which would change things in India. And so, may have effect elsewhere in world as well .
List is from Outlook Business May Anniversary Edition.

If you are not from India, this will give you an idea of what is going on in India.

1. India, with China, will dominate world economy.
It is still early days. Too many things need to be done, before ‘world domination’ can be claimed.

2. $3000 Car
Negative: Road infrastructure is too bad. Traffic is going to be too bad even in small cities of India.
Positive: Hopefully this will awaken governments, both local and central.

3. Rice Intensification System (RIS)
This will double rice production in India. Rice is staple food in India. And RIS is needed for India’s growth.

4. Smart Cards
All numbered cards (Income tax card, election card, ration card) will be unified. Hopefully, there will be better control over corruption.

5. Aerotropolis (Airport City)
City center will shift. If Airport will have SEZs around them, then lot of things will change.

6. Rs 5 Lakh ($12500) House
This, though less than one bedroom apartment, will make lives of people living in slums better.

7. Rural BPOs
Rural areas will develop. Villagers will have wealth.

8. Piped Gas Ecosystem
Gas will always be cheaper than crude. And it will help fight pollution.

9. Micro-pension schemes
This will increase social security for poor people by making them able to financially self reliant during old age by investing micro-amounts while they are earning.

10. Mobile Wallet
Mobile will not be only for talking anymore. Not too much cash needed to be carried.

11. Commodities Aggregators
This will make agricultural supply chain more efficient and fair to farmers.

12. Migration Services
India already Border-less workers! This will happen internally among Indian states, too.

13. Coal to Oil
Oils is and will be made from coal instead of crude. India has lots of coal. And various gases are by-product.

14. Work from Home
Less traffic, less fuel, more work, happy employee, …

15. Solar For Poor
India has lots of Sun. Solar lamps will become cheap enough.

16. Alternative Public Distribution System
New system is to execute most operations at village level. It is more efficient and fair.

17. Plastics to Fuel
This will be boon for environment as waste plastics will be used for production of fuel.

18. Digital Delivery of Movies
This will allow ‘real’ all India release to as many cinemas without too much distribution cost. Piracy can be beaten.

19. Bar Camps
These are informal forums with objective of sharing ideas. These will become brain storming vehicle.

20.Vernacular Keyboard
These gesture keyboards will allow villagers (who do not know English or cannot handle complex keyboards) access to computer and Internet.

21. Telemedicine
Remote and relatively cheap health-care delivery which knows no distance will become widely available.

22. Pay per Use
DTH, Video on Demand, Audio on Demand….

23. Online Education
Always available, no distance issue, cheaper once infrastructure is setup. Then India will have more people educated.

24. Computer-based Functional Literacy
Multimedia based literacy programs will make sure literacy rate increases.

25. Electric Vehicles
Average cost per Km will come down drastically.

Where eagles dare - Find a phone number!

March 27th, 2008

I was in Gurgaon, and I wanted some pizza to fill empty spaces in my body. Not my fault, my body was craving for it!

But good things do not come easy, they say. Guess what, I did not have Gurgaon Domino’s number or at least I believed so. My first massiah was Domino’s toll free number stored in my mobile phone.

Alas, that won’t work from my mobile. So, next nearest massiah was Guest House’s manager. I called him and asked how I can make local call from my reasonably good room. I cannot, he said, but he can call and transfer. Well, would work for me. And then he got busy with internet problem he was facing. It seems that he had bigger problems than mine, and forgot. So, onus came back to me.

Your brain can give crazy ideas somehow. Mine asked me to check newspaper. I immediately went to gather all news paper for that day recieved by Guest House. And to my horror/delight, I found that there are five with so many pages. Believe me that I went through all. And of course, my stars were not in good condition. Domino’s had not given any ad.

Not everytime powerful devices can do good to you. I searched my mobile phone for “pizza” and voila, there were not one number, but two of them. I realized how chaotic my contacts list was. One was of Raffle’s pizza in Delhi, and another was of Domino’s but from Bangalore. For people new to India, Gurgaon is part of Haryana state which shares border with Delhi. So, I dropped idea of
Domino’s and called up Raffle’s. Pizzas are pizzas, no matter where they come from, as far as they are tasty pizzas! But you know it by now. My stars are not in good condition.Raffle’s does neither deliver to Gurgaon nor have branch in Gurgaon. Sad!

So, I have to make call to Bangalore Domino’s to get number of Domino’s Gurgaon. So, I did. If you think, I would have succeded now, you cannot be more wrong. Story starts now!

I called number0. I was said that I should call number1 for help.
I called number1. I was said that I should call number2 which is regional Domino’s office.
I called number2. I was said that they cannot help me, but he gave me number3 for Domino’s office of Noida which also shares border with Delhi.
I called number3. I was said that I should call number4 which is regional office.
I called number4. I was said that I should tell my address as there are many Domin’s in Gurgaon. I told him postal address of Guest House. He could not figure out where I was. So, he chose random Gurgaon number and asked me to call on number5.
I called number5. I explained him address. He gave me number6.
I called number6. Nobody picked it! I missed, I think, few heart beats. Note that these all was while I was on roaming.
And then there was light. I incremented last digit of number6 and called number7.
Somebody took my order! Oooh la la!

Don’t you dare think I am bluffing! Here are numbers:
011-41708111,080-25322333,080-41314984,080-41530660,
0120-2516820,0120-2512050,0124-2312636,0124-2563236,0124-2563237

Life is not bed of roses!

Stress Management

March 25th, 2008

Right click and open link in another Tab to get tips on Stress Management

Public Speaking

March 24th, 2008

Click to see image

Question: Is man supposed to be vegetarian?

March 20th, 2008

Answer:
Mahatma Gandhi said “An examination of the structure of the human body leads to the conclusion that man is intended by nature to live on a vegetable diet. There is closest affinity between the organs of the human body and those of the fruit - eating animals. The monkey, for instance is so similar to man in shape and structure and it is a fruit - eating animal, its teeth and stomach are just like the teeth and stomach of man, while those of carnivorous animals, as for instance, the lion and tiger, are entirely different.”

Let us compare man with meat eaters and herbivores. Decide answer of above question for yourself!

Meat Eater Herbivore Man
Has claws No claws No claws
No skin pores Has skin pores Has skin pores
Perspire through tongue Perspire through skin pores Perspire through skin pores
Sharp front teeth for tearing No sharp front teeth No sharp front teeth
No flat molar teeth for grinding Has flat rear molars Has flat rear molars
Intestinal tract 3 times body length Intestinal tract 10-12 times body length Intestinal tract 12 times body length
Strong stomach acid to digest meat Stomach acid 20 times less strong than meat eaters Stomach acid 20 times less strong than meat eaters

A saying and a fact:
The stamina of a camel, the strength of an elephant, the beauty of a horse are all sustained on a vegetarian diet. :-)

New features of C# in simple source code

January 1st, 2008

New features of C# in simple source code

Egyptian sales techniques!

August 7th, 2007

Egyptians are smart salesmen:
Here are techniques used by them.
Please note that dialogs are just summaries. Real dialogs are quite long and time consuming.

“2 Pounds”
He lures you by offering to sell items 2 EGP each.
You, greedy, stop and select an item.
You decide to buy and take item in your hand.
You get amazed that only that selected item is 35 EGP, rest is still 2 EGP!

“Currency Conversion”
He lures you by offering to sell item at 2 Pounds.
You, greedy, stop as you think that item is worth 5 EGP.
You decide to buy and take item in your hand.
You get amazed that selected item is 2 British Pounds!

“Negotiating”
You stop and want to buy two pieces of same item. You estimate that both pieces are worth 30 EGP total.
You: “How much?”
Him: “Hmm, this one?” (pointing at an item)
You: “Yeah”
Him: “Very cheap price, for you, 30 British Pounds per one piece”
You: Put down the item, thinking that it is out of budget
Him: “Very good item, my friend, blah blah…”
You: “Very expensive”
Him: “How about 30 British Pounds for both pieces?”
You: “I do not want to buy, it is very costly”
Him: “No, my friend, it is cheap. In tourist market, it is 60-70 British Pounds”
You: “Ok, shukran” Start walking
Him: “Wait, wait. I give you at 30 US Dollars for both. Very cheap.”
You: “It is too costly for me; Thank you”
Him: “How much?”
You: “30 EGP for both”
Him: “Egyptian Pounds?”
You: “Yeah”
Him: “Friend, give me good reasonable price”
You: “No, only 30 EGP”
Him: “Ok, take it at 50 EGP”
You: “No”
Him: “Last, very good price 45 EGP”
You: Already tired, brain dead and you want to buy and finish off. You buy.
You get amazed that you paid 15 EGP more.

“No Change”
He will never have enough change. So, you will end up losing little more than what you agreed with him.

“Money is no problem”
You: “How much?”
Him: “Money - no problem. Select. No money for selection”
You: Spend time in selecting and talking blah blah blah
You: “How much for this one?”
Him: “Friend, money is no problem. This item is very very good, blah blah blah”
You: you even get involved in this blah blah blah
Him: “Pack this for you?”
You: “yeah, but how much?”
Him: “My Friend, money no problem” Packs item and hands over to you
You: “How much?”
Him: “75 EGP”
You: “Errr, hmmm, aha, this, err, little costly”
Him: “ohh, my friend, for you, 70 EGP”
You: Hand over 100 EGP note as if he obliged by telling you lots of blah-blah-blah about that item.
Later, you get amazed that you paid double.

“Show Respect”
You: “How much?”
Him: blah blah
You: blah blah
Him: blah blah

You: “Ok, this is costly. I do not want to buy. Thank you.”
Him: “Hey, show some respect. You spend too much time, I gave you drink. Do not walk away. This is not good. BLAH BLAH BLAH”
You: Feel guilty, and stop to negotiate further!

“Let Customer Speak”
You: “How much?” Thinking that item would be around 10 EGP
Him: “200 EGP”
You: Jaws dropped. “What?”
Him: “Ok, my friend, you tell me - how much?”
You: “25 EGP” Thinking that your estimation was too wrong.
Him: “Hmm, ok, give me good price. No 200 EGP. No 25 EGP”
You: …
Later, you get amazed that you paid too much!