Skip to main content

Posts

Showing posts from March, 2007

Wrestle Mania 23

Finally, Wrestle mania 23 is here… Yep folks, it’s on April 1st. These are some of the events I would not want to miss watching.. Undertaker vs Batista - for the World heavy weight championship. John cena vs Shawn Michel - for the WWE championship. Battle of the billionaires – Umaga vs Bobby lashly For more information visit wwe.com

A Crouching tiger waits for it’s prey

A Crouching tiger waits for it’s prey… Sometimes you will not respond immediately to your foe, but rather wait until the correct time. This does not mean that this person is not smart enough to defend him self, but what it really means is…, planning the attack takes time.

Hack of a week

This week has been frustrating for me. First I did not have sufficent work at office, and I had to stare at the monitor for half of the time I was there at work. Then the hard disk of my computer at home got corrupted, so I had to buy a new computer (anyway I was planning to buy one cos' the one I had was a bit old. All that money!!). Thirdly, I got soar throath and a fever, and the drugs that I take to cure these makes me feel sleepy all the time at office.

Localization tips..

These are something that you would need to consider when planning to localize your system.               Externalize all the hard code strings, that is, move it into a separate resource file.               Do not move your strings into the forms own resource file (talking about .NET Win forms), this is because every time you add a new language support or even if you change something on the form through the designer, the forms resource file gets regenerated, and your newly added keys are lost !!! , therefore move it into a separate resource file.   Do not use hard code string concatenations, for an example : String str = “Something ”  + value + “ something more”; Don’t move only the strings “Something ” and “ something more” into the resource file, try adding a value in the resource file as “Something {0} something more” and in your program code : String str = string.Format(resource.GetString(“the_key”,value)); The reason for this is that in another language, the who

Method inlining

Executing a method has a cost, this cost can be partially avoided by method inlining. Method inlining means basically moving the method into the callers body for an eg. Take a look at the code int Calc() { return x * y; } int num = Calc(); when Calc() is inlined what it basically means is int num = x * y; Unlike C++ (as I read) C# does not have inline keyword to explicitly inline methods, this is due to JIT handling it by itself. JIT uses heuristics to select methods that are to be inlined. The following are some of the heuristics JIT uses Function code that produce less then 32 bytes IL Function code the has simple control flow , this includes if- else if – else statements, functions containing swith and while flows are not inlined Virtual functions are not inlined Functions containing exception handling blocks are not inlined , but if the exception is just thrown without handling code it would be inlined.