Tuesday, April 26, 2011


A Real Developer is a side-project I built over the weekend poking around with WebMatrix.

It got a little out of hand. After publishing, I showed it to a few popular tweeps, and they were kind enough to mention it. 24 hours after the launch it has gotten over 3.5k unique visitors, 39k page views (see what I did there?) and over 240 submissions. Being mentioned by Scott Hanselman and Rey Bango helps.

I kind of felt like a mini - Mark Zuckerberg constantly refreshing the page and reading new quotes hours afer the launch.

I was somewhat surprised by how original and creative our community is. Some of my favorite quotes so far..

A real developer has changed live code in production at least once, begrudgingly. (by @jasonfamularo)
A real developer has code on his t-shirt. (by @stevenmilne)
A real developer knows family is more important than computers. (by @shanselman)
A real developer tries to write as little code as possible. (by @marknijhof)
A real developer works in the dark, but communicates with those in the light. (by @atcrawford)
A real developer understands code is nearly the same as an organic life-form that evolves. (by @stefandidak)

And so much more of them are awesome.

The future

I enjoyed the experience so far. I'm well aware that this buzz will end soon, but I'm going to try to maintain momentum as long as possible.

That's why I am eager to hear your suggestions and feedback.

Requests received so far:
  • Make it possible to up- or downvote quotes.
  • Make a smart algorithm based on those votes.
  • Make it easier to link to quotes.
  • Twitter authentication.
I might open source this little project (it's only 50 lines of code) and I might do a few blog posts on the making of in the next weeks.

Sunday, April 24, 2011

Prague impressions

Last year my girlfriend and I already made a trip to the Czech Republic, but we felt like we had spent to little time visiting Prague. We made up for that by making a follow-up trip last week.

Find some of our most memorable impressions captured on picture below..

The Lennon Wall

Love padlocks near the Lennon Wall.

Hiking route in the New Town district.

The Charles bridge from a distance.

The astronomical clock of Prague.

Hand painting Easter eggs like a boss.

More fairylike Easter festivities.

Close-up of a butterfly, shot in the Prague Fata Morgana.

Night at the National Technical Museum.

Prague by night.

Oh, iPads are for taking pictures.

All credit for these pictures goes to my girlfriend.

Anonymous type equality follow-up: Equals()

After publishing yesterday's post on anonymous type equality, I received an interesting comment from a fellow redditor. He stated that even if the sequence of the property assignment were the same, the equality comparison would still return false, because the types generated by the C# compiler are reference types, making their references being tested for equality and not their data.

This is very true, unless the Equals() method is overridden. And this is exactly what the compiler does for us when we define anonymous types.

In the Equals() method the equality of each property is evaluated by using a generic EqualityComparer.

That explains this behaviour.

   1:  var a = new { x = 1, y = 2 };
   2:  var b = new { y = 2, x = 1 };
   3:  var c = new { x = 1, y = 2 };
   5:  Console.WriteLine(a.Equals(b)); //Prints False
   6:  Console.WriteLine(a.Equals(c)); //Prints True

Saturday, April 23, 2011

Anonymous type equality

Let's say you instantiate two variables (a and b) using anonymous types. They both have the same two properties (x and y) with equal values.

   1:  var a = new { x = 1, y = 2 };
   2:  var b = new { y = 2, x = 1 };

Do you think these two variables are equal?

   1:  var areEquel = a.Equals(b);
   2:  Console.WriteLine(areEquel); //Prints false :O

These two variables are not equal. Not something I expected!

If we look at the IL the C# compiler produced, it starts making sense though.

There are two different types generated, although the properties we assigned are the same. What differs is the sequence of the property assignment.

This is defined in chapter Anonymous object creation expressions of the C# 4.0 specifications.
Within the same program, two anonymous object initializers that specify a sequence of properties of the same names and compile-time types in the same order will produce instances of the same anonymous type.


When defining anonymous types, the sequence of the property assignment matters. If the sequence of the property assignment differs, different types are defined by the C# compiler.

Also read the follow-up.

Monday, April 11, 2011

Using C# keywords as variables

Hold it, don't shoot me. I know this would be an awful practice, but it is an interesting C# compiler quirk nonetheless.
Keywords are predefined reserved identifiers that have special meanings to the compiler. They cannot be used as identifiers in your program unless they include @ as a prefix. For example, @if is a legal identifier but if is not because it is a keyword.
static void Main(string[] args) {           
    var @if = "oh my..";

========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

Sunday, April 10, 2011

It's not how good you are, it's how good you want to be

This Christmas, my girlfriend and I got this little book called It's not how good you are, it's how good you want to be. This book is mainly directed to (advertisement) designers, but since I feel that designers and developers do have a few things in common, we both like to create things, I also read it.

The content of this book is a collection of Paul Ardens observations on business and life presented in a very consumable format. As it turns out, although I am not part of the target audience, a good amount of his thoughts can be applied to software development as well.

Find a few of these thought-provoking quotes below.
If you are involved in something that goes wrong, never blame others. Blame no one but yourself.
Give away everything you know, and more will come back to you.
Don't look for the next opportunity. The one you have in hand is the opportunity.
The person who doesn't make mistakes is unlikely to make anything.
If you get stuck, draw with a different pen.
Don't be afraid to work with the best.

Thursday, April 7, 2011

Video, slides and source from my WebSockets talk

Yesterday, I gave a talk on WebSockets at HTML5 WebCamps Belgium.

I got a lot of positive feedback on Twitter, which makes me a very happy panda!

You can already find the video of my session on Channel9.

The slides can be found on SlideShare.

If you want to play with the demo yourself, you can download the source:
  • Make sure your firewall allows incoming TCP traffic on port 4502
  • Deploy the client access policy file to IIS
  • Also host the Demo.WebSockets.WebClient in IIS

More information on installing the WebSockets prototype here. If you have an issue with running the demo, feel free to ping me!