Williamo's Blog

March 17, 2008

Null-Coalescing Operator

While at a rather disappointing MSDN event yesterday, I came across one gem of C# 3.0 candy in the form of a null-coalescing operator. This is basically a short-cut for the oft seen:

string emailAddress = parsedValue != null ? parsedValue : “(Not provided)”;

OR

string emailAddress = String.Empty;
if (parsedValue != null) {
emailAddress = parsedValue;
}
else {
emailAddress = “(Not provided)”;
}

Using the Null-Coalescing Operator
These can now instead be re-written using the new null-coalescing operator as:

string emailAddress = parsedValue ?? “(Not provided)”;

This can roughly be read as “Set emailAddress equal to parsedValue unless it is null, in which case set it to the literal (Not Provided)”.

(via Null-Coalescing Operator)

Jon Kabat-Zinn on mindfulness and “falling awake”

Filed under: Fascinations — willwm @ 8:46 pm
Tags: , , , ,

Jon Kabat-Zinn is the founder of the Center for Mindfulness in Medicine, Health Care, and Society at U Mass, and he’s highly regarded for his role in bringing mindfulness into the mainstream of medicine. He’s also an illuminating writer and speaker on the ways that mindfulness meditation can improve health and reduce stress.

(via 43folders.com)

Install multiple versions of IE on your PC

Filed under: Fascinations — willwm @ 7:05 pm
Tags: , , , , , ,
Multiple IE Versions

Ever wanted to test your website in various versions of Internet Explorer?

It is possible to run Internet Explorer in standalone mode without having to over-write previous versions thanks to Joe Maddalone who came up with a way of achieving that in November 2003. Basically, Internet Explorer is run by exploiting a known workaround to DLL hell – which was introduced in Windows 2000 and later versions – called DLL redirection.

Manfred Staudinger perfected the standalone versions by adding IE version numbers to the title bar of the standalone browser window. Moreover, by removing the “IE” key in the registry subkey [HKLM\SOFTWARE\Microsoft\Internet Explorer\Version Vector] Internet Explore defaulted to respecting conditional comments based on the version number prebuilt in the program.

It is not difficult to follow the instructions and get any version of IE running in standalone along side other versions. Most of you probably know of evolt’s archive of Internet Explorer which has them readily packaged in ZIP files. Now suppose you want to download them all. An installer that would conveniently automate the whole process would be great. Thanks to this comment for the idea.

So I made an installer which contains IE3 IE4.01 IE5 IE5.5 and IE6

(via Install multiple versions of IE on your PC)

Blog at WordPress.com.