Skip to main content


Showing posts from February, 2007

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 run…

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 appl…

Arguing with a egg head !

Well, after posting a mail on Stringbuilder vs String to a group in Sri Lanoka (BITPROJECTS), A guy named Ranga, started pointing out a mistake in my example, well I proved that he was wrong !!.
But I guess the guy did not wanted to give up, so he started talking about everything else other then StringBuilder
Think he might have got really frustrated, loosing !!!.
So finally I thought of giving up, as I did not want him to go to ANGODA .
Damn, I can’t think there are people in this world who think they are PERFECT. All for sure he was not perfect, he was a egg headed MUTT, who was stubborn to listen to anyone. People like him are going to have a hard time living in this world !!!.
I hope god helps him out!!!.

String vs StringBuilder

Take a look at the code given belowstring str = string.empty;for(int i= 0 ; I < 100; i++){str += i.ToString();}You should never use string concatenation inside a loop, the reason for this being that strings in java and c# are Immutable.What this mean is that each time you concatenate a string, a whole new string object is created with the older value appended to the concatenated value, ok what happens to the older string object ?? well it is left for the garbage collector.So we got two points here1) object creation means processing power and memory usage 2) in this example the garbage collector needs to clean up nearly 100 string objects !!!So what’s the solution ?? Use StringBuilder class (C# - found in the System.Text anmespace), StringBuilder (java not sure of the namespace).What StringBuilder class does is it actually appends, without actually creating a string object on concatenating , therefore u will be using only one StringBuilder instance in this example, which basically m…

Java vs C# - Virtual methods

In Java, instance methods are virtual by default—they can be overridden in subclasses unless they are explicitly declared final. In C#, by contrast, instance methods are non-virtual by default. To make a method virtual, the programmer must explicitly declare it virtual. Why is non-virtual the default in C#? There are several reasons. One is performance. We can observe that as people write code in Java, they forget to mark their methods final. Therefore, those methods are virtual. Because they're virtual, they don't perform as well. There's just performance overhead associated with being a virtual method (more on this in the next mail). That's one issue. There are two schools of thought about virtual methods. The academic school of thought says, "Everything should be virtual, because I might want to override it someday." The pragmatic school of thought, which comes from building real applications that run in the real world, says, "We've got to be real…

Something I ran into

This something I found out about ASP.NET 2.0, As I am not doing at the moment, I thought of just logging this, incase I may need it.You can not simply address a control in java script. (I am using Master page) 
document.getElementById('TextBoxEmpName').value you have to replace the above code line with..
document.getElementById('<%=TextBoxEmpName.ClientID %>').value

If you use GridView and  you have a  " Date " field column that you want to format it using  DataFormatString="{0:d}" , this won't happen unless you change the property HtmlEncode="false".Actually this is not an issue, this is what my friend Sanjaya has found, for 24 hour display time column field you have to use formating string as DataFormatString="{0:HH:mm}".[]

Workout machine

I was gaining waight has hell, so i decided to buy my own work-out machine.What really caught my eyes was the Obitrek, it was a cool peice of machine and cheap, I decided to buy it.
Now it is laying near the kitchen(not in the kitchen), I had a go yesterday and today morning, it was amazing cos' it does not develope cramps as normal jogging does.

Back to work !

After a long relexation,I am back in a new project. This time it was a project from a huge service provider, the part I am working on is a plug in to a bigger project. Currently it just me and the tech-lead in the project, the scary thing about this project is that I am playing the role of a senior software engineer. Well anyway I am only allocated into the project for a period of less then 2 months, Thats a relief !!!.
My frist task is to localize the appliaction into 14 different languages, hope everything would go fine.