Sunday, October 31, 2010

It works on my machine

Problem

This problem can be occure when QA or someone else found a bug and ask you to fix it. So you check it and you said it works on my mechine.But other people do not get the result as you get.


Mistake

Most of the time we do not simulate the exact environment as problem exists.Can be occured becuse of following reasons ;
  • Different Database
  • Database has changed
  • Slightly differnt code base
  • You have already fix it and not committed yet
Lesson learned

Simulate the same environment as the bug exists.


laughing smileys NOTE: [It's better if you can share the factors you already had that can be direct to such problem. Then ]

Thursday, October 28, 2010

The transaction is in doubt

Sometimes you may get this error when you use transaction scope .
The transaction is in doubt
I also got this error recently and able to find the reason for it. That is because of the some of the readers had not properly disposed. Actually in this case you can use Using keyword to overcome this.

Exception :System.Transactions.TransactionInDoubtException was unhandled by user code
Message="The transaction is in doubt."

Solution : using (reader)
{
}

Saturday, October 16, 2010

Ship It Review -1

This books has been described Habits in interesting manner. Following story took from it and the story shows how we should go for a decision rather considering everybody doing it or becuse of we have already done it.

Story:

Did you hear the story of the woman who always cooked ham by cutting off and discarding a third of it first? When asked why, she said that was how her mother always cooked hams. When asked, her mother said that was how her mother had always cooked. They finally confronted Grandma, who admitted that when she was young, she didn’t have a pan big enough for an entire ham, so she always just cut the end off,
and it became a habit.

Ship It

Recently i got a book called Ship it . That is quite inserting book .

Friday, October 15, 2010

Dead Code Problem

Problem

Actually this problem occurred when i was doing integration two projects. [Phase1 and phase2 of a project] . Phase 2 is developed on top of the phase1. Parallel phase1 had changed lot . Mean time those were working on phase2 has commented existing phase 1 code without comments . Phase 1 and phase 2 merged with some conflicts. So we commented such places with the descriptive comment . After merged the result code base has merged those phase 2 commented parts. Also there was some of already dead code in phase 1. So it is difficult to understand weather this is actual dead code or commented one from phase 2.

Mistake

Had left dead dead code and missing comments .

Lesson learned

Normally developers leave dead code in their original code with the mind of future purpose. But this not a good habit to continue.As long as you use source control ,earlier code may exist. Problem will occur if you are not using such version control. In such a situation you can keep dead code with descriptive comment . Otherwise omit them . That is the best way to achieve clean code.

Tuesday, October 5, 2010

Schema Compare does not support SQL Server 2008

If you going to compare two SQL Server 2005 databases with SQL Server 2008 database using Visual 2008 you would get this error.

Schema Compare does not support SQL Server 2008

To resolve this you can use :