Tuesday, June 9, 2009

Measuring Execution Time

DateTime startTime = DateTime.Now;
Console.WriteLine(startTime);

Wednesday, June 3, 2009

CSS Visibility vs Display

There is a difference when you want to hide things using CSS. Setting Visibility = 'hidden' and Display = "none" may appear similar at first, but actually it is not. If we have multiple lines of items arranged vertically that we want to hide, it will be obvious that the div layer set with visibility:none will have a whitespace placeholder wherelse a div layer set with display:none will not have a whitespace placeholder.


function showhide(header, childid)
{
var myHeader = document.getElementById(header);
var myLayer = document.getElementById(childid);
if (myLayer.style.display == "none") {
myLayer.style.display = "block";
} else {
myLayer.style.display = "none";
}
}

Random Number in C#

int RandomNo(int min, int max){

Random random = new Random();

return random.Next(min, max);

}