Monday, March 31, 2008

C# quiz: 2/?

Continuing on the series of C# and/or .NET Framework short questions:

        private void Foo(List<int> bar) {
bar = new List<int>();
// ...

With the method above and the code below:

        List<int> bar = null;
if (bar != null) {
} else {
Console.WriteLine("still null");
If or else ?

EDIT: fixed typo in code sample.

C# quiz: 1/?

I'm starting a series with small questions C# and/or .NET Framework related questions:

First out, NaN values:

            double foo = double.NaN;
// ...
if (foo == double.NaN) {
} else {
Console.WriteLine("a number");

If or else ?

Wednesday, March 19, 2008

Safari - first impressions

I thought that I might give it a shot after all so I installed it. First impressions:

- it's a memory hog! 4 sites in 4 tabs consumes a whopping 210MB, while Firefox 3 beta 4 for the same sites consumes "only" 74MB

- the UI is ugly

- scroll wheel doesn't work properly in bookmarks

- close tab X button on the left !?!

- As I don't have mouse gestures, I often right-click and choose back. If I happen to have the cursor over a word, (quite likely), safari chooses to select the word and only select search with google or copy. WTF? default browser isn't changing.

Tuesday, March 18, 2008

Safari for Windows - Apple spamming users

I have an ipod, and therefore I have ITunes installed. Today Apple Software Update popped up and greeted me with the following totally unrelated thing: Safari 3.1 (22.65Mb)

Safari for Windows is the fastest and easiest-to-use web browser for the PC.  It displays web pages faster than any other browser and is filled with innovative features -- all delivered in an efficient and elegant user interface.

For more information on Safari 3.1, please visit

Hmm, that sounds too good to be true.

...and why does it notify me about it in the first place?

Friday, March 14, 2008

Gotcha: Hidden [Flags] attribute on bitfield enumerations


Just got reminded of a still unfixed bug.

Consider an enumeration of the following kind:

    /// <summary>
/// Modes enumeration
/// </summary>
public enum Modes {
/// <summary>
/// Yes
/// </summary>
Foo = 1,
/// <summary>
/// No
/// </summary>
Bar = 2,
/// <summary>
/// Maybe
/// </summary>
Both = Foo|Bar

For the user of this enumeration, it is essential to know that it in fact is a bitfield (as specified by the FlagsAttribute).

However, both Intellisense and object browser fails to give any hint about this fact!?! (Yes, this occurs in both VS 2005 and VS 2008)

So for now, remember to document (within in the summary, so it is visible) this fact for your fellow developers.