dotnet, vs comments edit

Just got word from the folks over at Typemock

  • if you have an open source project and you want to use Typemock Isolator, they’re going to be coming out with a new (free) license type that allows your open source project to use it. Here’s the new licensing structure I’ve seen:

  • Commercial - $449 (same as today)
  • Personal - $200 (will include one year maintenance)
  • Open Source Project - Free
  • 21-Day Trial - Free

And, of course, discounts for upgrades, etc., on the paid licenses.

This is huge. I’ve been wanting to add tests to CR_Documentor, but it’s almost impossible to do that because of the tight coupling DXCore plugins have with the DXCore engine. For example, I’d love to be able to create a fake language element and unit test the syntax generator… but I don’t want to have to write wrapper interfaces and services for everything in DXCore that I interact with. Now I can!

Big side benefit - the folks who are unfamiliar with Isolator can see how open source projects use it and see the benefits. Sweet!

downloads, vs, coderush comments edit

I just posted the new version of CR_Documentor, version 2.1.0.0, over at Google Code. This new one hosts a tiny internal web server (instead of manually poking things into the IE DOM) so as long as you can get to localhost, you should be able to see the preview without that nasty warning. I also fixed the focus issue so it shouldn’t steal focus when the preview refreshes.

If you upgraded before and are ready for a fix, go get it!

web comments edit

Jeff Atwood posts about the exact thing I thought when I saw the MVC tidal wave coming to overtake web forms. It feels like I’m back in the 90’s, doing old-school ASP, because of the tag soup.

Don’t get me wrong - I’m all about separation of concerns and such, but every time I look at something like MVC, I see all roads leading to web forms. Maybe different web forms, but web forms nonetheless.

  • Too much tag soup? Package stuff up in helper methods.
  • Oh, wait, the helper methods that generate control structures aren’t really flexible enough to allow overridden behaviors or wire things up (like validation). Let’s make them instance methods on objects.
  • Hmmm, there’s sort of an object lifetime to manage here, and wouldn’t it be nice if the packaged widget could be a little smarter about handling view data? Like dynamically populating itself based on data and letting me know if the user changed stuff, because writing that every time is such a pain.
  • Hang on, that’s web server controls.

Some folks argue they want that “tighter control over the HTML” that the tag soup provides. I, personally, am much less interested in hacking HTML. Let the framework do it for me. I’m more concerned with the business logic anyway.

I’ve done my share of classic ASP style development in lots of different server side languages, and it always ends up that to get rid of the tag soup, you head towards web forms.

Since my birthday falls in the middle of the week this year, we’re sort of splitting up the festivities across weekends - some this past weekend, some this weekend.

Friday night I started out by playing some GRAW 2 co-op with my dad and uncle. We normally spend a lot of time struggling through just one of the missions (none of us are super-good and some of the missions really need four or five people), but this time we beat two in one night. My uncle came out with the medal of honor on this one, finishing out the mission after my dad and I had both gotten killed.

Saturday morning I went to the DMV and got my license renewed and actually got out far sooner than I thought I would. In the afternoon we saw The Dark Knight, and it was awesome. Heath Ledger was amazing as the insane Joker and really made him a believeable bad guy, not the cartoonish villain you might envision with the Joker. I hope they make more Batman in this style, and maybe adopt it for future super hero movies. Comic movies don’t have to be all cartoonish.

Sunday we went to the driving range with our friends K and Angela to have lunch and hit a bucket of balls. It was a beautiful day out and we had a great time. I’d never hit a golf ball before in my life, so this was a fun intro, even though I didn’t do too well. Most of my shots went about 40 or 50 yards, though I had a few that went… a bit shorter than that… and some that darn close to injured people. My furthest went about 140 yards. K put all of us to shame going way past everything we did.

K said we might be sore today, but I’m not doing too bad. My back is a little tight and the inside of my right arm is kind of sore (so I can’t really grip things or pick up heavy stuff on the right), but other than that, I’m doing well. I think Jenn is mostly feeling it in the back. Regardless, it was a heck of a fun time and we’ll definitely be trying that again.

We stopped by on the way home at Baskin-Robbins, had some ice cream, and finished off the day with a barbecue at our place. Someone was outside cooking something delicious smelling and we couldn’t resist - we had to cook our own.

This coming weekend I think we’re going to hit the Washington County Fair so we can see the Pirate’s Parrot Show and maybe have a funnel cake. Since it’s free admission, we may even go Friday night and Saturday. It’s a lot of fun and only a few minutes away from home.

gists, dotnet, csharp comments edit

You really have to be careful when you use generic types. Say you have a generic type Foo<T> like this:

public class Foo<T>
{
  public static string StaticValue = "Unset.";
}

Fine, right? Well, what happens if you do this?

Console.WriteLine("Foo<string>: {0}", Foo<string>.StaticValue);
Console.WriteLine("Foo<int>: {0}", Foo<int>.StaticValue);
Foo<string>.StaticValue = "String value.";
Foo<int>.StaticValue = "Integer value.";
Console.WriteLine("Foo<string>: {0}", Foo<string>.StaticValue);
Console.WriteLine("Foo<int>: {0}", Foo<int>.StaticValue);

I bet you can guess what the output is.

Foo<string>: Unset.
Foo<int>: Unset.
Foo<string>: String value.
Foo<int>: Integer value.

That’s right - each closed generic type (a generic that has a type parameter provided) has its own set of static values.

Think about how that can bite you - if you have multiple parameters on your generic type, like MyType<T, U, V>, and you have three different types that are used in each of T, U, and V, you end up with 27 sets of static values (it’s combinatoric). Possibly not what you’re thinking at the time you write the code.

I really can’t find any documentation on this. There’s a nice CodeProject article about it that shows why this can really work against you if you’re trying to make a strongly-typed generic singleton factory, but beyond that, MSDN really only yields up an FxCop rule that’s fairly unrelated.

Be careful with your generics and static values!