All posts in Lab49

The Right Way to do INotifyPropertyChanged

It’s sad how much controversy there is in doing something as simple as raising property change notification to our subscribers. It seems to me that we should have settled on something by now and moved on to bigger problems, yet, still, I see developers at every level of experience doing it differently.

I want to inform you all that you’re doing it wrong. Read more


How to Actually Change the System Theme in WPF

When I first started working with WPF professionally, it wasn’t very long before I realized I needed to change the system theme of WPF to give my users a consistent experience across platforms. Not to mention that Vista’s theme was much improved over XP and even more so over the classic theme. Conceptually, this should be feasible, since WPF has its own rendering engine, as opposed to WinForms relying on GDI. Read more


Interview with Kalani Thielen: Trends in Programming Languages

Last week I interviewed colleague Kalani Thielen, Lab49′s resident expert on programming language theory. We discussed some of the new languages we’ve seen this decade, the recent functional additions to imperative languages, and the role DSLs will play in the future. Read on for the full interview. Read more


The Value of Experience

I was reading a blog post by my colleague Doug Finke in reference to a “programmer competency matrix” by Sijin Joseph. I took a look at the matrix and it seemed like a set of pretty reasonable benchmarks for a programmer’s growth. My only reservation with the chart was that they claim that you need a certain number of years experience under your belt to be a certain grade of programmer. Here’s Sijin’s criteria:

  • Level 0: 1 year
  • Level 1: 2-5 years
  • Level 2: 6-9 years
  • Level 3: 10+ years

To be perfectly honest, I find the entire idea reprehensible. According to this matrix, nobody could be considered an “expert” programmer in C#, since the language has only been around since 2001. I’m not breaking the news to Anders. Ok, maybe that’s a bit of a “gotcha” exception, but I think the entire idea can’t hold water. The problem with the assertion is that it assumes that all years are equal in quality. There’s no comparison between a year in a challenging company on the cutting edge of your technology field working with the leaders in industry and a year making small changes to an enterprise CMS. No offense to the latter group, but it’s just the ugly truth. Read more


Alpha-Blending Colors in PowerShell

The other day I was given the task of converting a particularly poorly designed VisualBrush into a LinearGradientBrush. One of the problems I came across very quickly was the use of semi-transparent colors layered on top of each other, and, of course, I needed a “flattened” color for my GradientStop. Now, I could have used Paint.NET or GIMP or Photoshop to put out a couple layers of colors, set the transparencies and used the color dropper to get the result. Of course, since I’m not a designer, I don’t have any of those things installed on my work computer, so I decided to just find the equation to blend the channels myself. It didn’t take long, and Wikipedia delivered the goods. According to the article, the formula to merge two colors, C_a and C_b, into some output color, C_o, looks like this:

C_o = C_a\alpha_a+C_b\alpha_b(1-\alpha_a)

Since a color can be thought of as a three-tuple of its R, G, and B channels, the formula is easily distributed to each of these values.

At this point, I decided I could probably just pull out a calculator and crunch the numbers. But maybe, in about the same time, I could also whip something together, say in PowerShell, to do it for me. Since I’m still learning PowerShell, I figured the learning experience would be worth at least something. Read more