Skip to main content

Posts

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 a...

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.

InitilizeComponent() visited

Well these are two scenarios that happened to me: In one of the earlier projects, just before a release I was working on a alignment issue in an aspx page and no change to the code behind file was done. But when the setup was tested on a fresh machine, the application threw exceptions !!. Finally what we found out was that the code behind of the file has really changed, to make things worse, the URL of the web service was hardcode to “Localhost” . After the release (went home at 6.30 in the morning that day), had some time to investigate this matter. What I found was that someone has instantiated the web service proxy reference inside the InitilizeComponent() , and every time there is a change in the aspx page design , the InitilizeComponent() gets regenerated, and because the web service proxy reference was instantiated inside this method , the auto-generated code assigns the URL property of the proxy to “Localhost”. I ran into the same sort of problem yesterday, the application was r...

More on localization...

I was changing the Region and language settings in the control panel, and was expecting that text in the forms to show up in the language that I had set, with no luck.Did some reading and …… CurrentUICulture is a per thread settings that governs from which resource file the ResourceManager class uses in a localized application. CurrentUICulture is a language setting and does not have any thing to do with date or currency formats. The CurrentUICulture is determined from the users default language, or if this is not set, the language used by the o/s The CurrentUICulture can be changed as follows Thread.CurrentThread.CurrentUICulture = new CultureInfo(“fr”); The CurrentCultrue is not a language setting, CurrentCultutre determines the date formats , currency formats etc.. This can be changed from the Regional option from your control panel. The CurrentCulture ctor takes a culture (a region and a language) as a parameter and will throw an exception if a neutral culture is specified In a web...