Windows LiveID an OpenID Provider

Microsoft is going to support the open standard OpenID by making LiveID an OpenID provider. Say Whaaat?!

Who are you and what have you done with our Microsoft?!

Windows Azure

I’m watching the PDC 08 keynote on Windows Azure, and it’s pretty cool. The speakers are kind of horrible, and the product demos were pretty crappy, but I get the idea. This is big.

Windows Azure, for all the bad presentation, is going to be really cool. I’m sure everyone and their dog is going to talk about specs and technologies, so I won’t bother with that.

An interesting thing caught my eye, they mention how it will be accessible to hobbyists all the way to enterprise customers. An interesting thing about the cloud platforms, Google App Engine, Amazon EC2, and now Windows Azure, is that it causes smalltime developers and bigtime developers to collide.

Hobbyists don’t typically have access to enterprise class resource, SANS, Racks upon Racks of Blade Servers, etc. etc. Now we have a unified platform for deploying my recipe catalog as well as an enterprise accounting system. The value for the small fish is that they don’t have to deal with managing their own servers. For the big fish, the value is the near infinite scalability the platform provides through a commoditization of a lot of technology and knowledge in horizontally system scalability.

The small fish can get away with a hosting company, but for startups, knowing that the systems they build can scale through their (hopeful) successes…  That’s pretty big.

NH-1520 or: Oren is a Machine

Please direct your attention to http://jira.nhibernate.org/browse/NH-1520.

It’s a simple bug, annoyed me a few months back, but I didn’t get a chance to investigate further until recently, when I was reminded of it by someone posting on the Rhino Tools Dev Google Group who was experiencing similar pains.

The impressive thing to notice about this JIRA are the timestamps.

  • 4:35PM Reported
  • 4:40PM Ayende Accepts Ticket
  • 4:43PM Fixed
  • 4:45PM Closed

That, my friends, is open source. And further proof that Oren isn’t quite right. I think he may be a set of triplets, masquerading as a single person.

Let’s all take a moment to thank our open source contributors and maintainers. They rock so hard.

Capture.Exception – BDD-esque w/ NUnit or: The Ikea Nightstand

UPDATE: After some feedback from Scott Bellware, Check below for the updated version.

I’ve been experimenting with BDD (or at least a BDD-inspired syntax, so as not to invoke the rage of the BDD mafia). I wove my own Spec class on top of NUnit back in this blog post. If you recall, I had encountered a problem however:

public class When_setting_the_password_on_a_null_user : PasswordServiceSpecification
{
    private string newPassword;

    protected override void EstablishContext()
    {
        base.EstablishContext();
        newPassword = "password";
    }

    protected override void Because()
    {
        passwordService.SetUserPassword(null, newPassword);
    }

    [Test]
    [ExpectedException(typeof(ArgumentNullException))]
    public void Should_throw_an_exception()
    {
        // Do Nothing
    }
}

This code doesn’t work. If I’m testing an error, and my Because throws the error, it asplodes. The exception isn’t generated in the [Test], it’s generated in the [SetUp] and NUnit doesn’t like that.

I was irritated. So I hacked something together. Something dark and horrible.

public class When_adding_a_null_Node_to_a_Graph : FeatureSpecification
{
    private CapturedException capturedException;

    protected override void Because()
    {
        capturedException = Capture.Exception(() => graph.AddNode(null));
    }

    [Test]
    [ExpectedException(typeof(ArgumentNullException))]
    public void Should_throw_an_exception()
    {
        capturedException.ReThrow();
    }
}

It’s a little… malevolent. But it works, and well, that’s ok with me. My ivory tower is more like an ivory nightstand. I put my phone on top of it, and my keys, and there’s a lamp with a cute picture of a kitten chewing on a puppies ear. And it’s not ivory, it’s Ikea.

So what powers my Ikea Nightstand? This:

public static class Capture
{
    public static CapturedException Exception(Action action)
    {
        var asyncResult = action.BeginInvoke(null, null);
        asyncResult.AsyncWaitHandle.WaitOne();

        return new CapturedException(action, asyncResult);
    }
}

public class CapturedException
{
    private Action action;
    private IAsyncResult asyncResult;

    public CapturedException(Action action, IAsyncResult asyncResult)
    {
        this.action = action;
        this.asyncResult = asyncResult;
    }

    public void ReThrow()
    {
        action.EndInvoke(asyncResult);
    }
}

I’m abusing just about everything here. CPS is going to knock on my door and ask me where my children are. My casual reply? “The wood chipper, where they belong.”

UPDATE: I GOT SCHOOLED!

Scott Bellware commented below about how I should just use an assert once I’ve captured the exception to make things more legible. Consider it done!

public class When_adding_a_null_Node_to_a_Graph : FeatureSpecification
{
    private Exception capturedException;

    protected override void Because()
    {
        capturedException = Capture.Exception(() => feature.AddNode(null));
    }

    [Test]
    public void Should_throw_an_exception()
    {
        Assert.That(capturedException, Is.InstanceOfType(typeof(ArgumentNullException)));
    }
}

And the accompanying new Capture.Exception():

public static class Capture
{
    public static Exception Exception(Action action)
    {
        try
        {
            action.Invoke();
        }
        catch (Exception e)
        {
            return e;
        }
        return null;
    }
}

Much simpler. Much cleaner. Much better.

Thanks, Mr. Bellware!

MEF, MS-LPL, MS-PL, IServiceLocator, Oh My!

Microsoft recently release the Managed Extensibility Framework on CodePlex under an open source license, the MS-LPL. There were some issues with the license selected for release, and it looks like Glenn Block spearheaded an effort to rerelease the MEF under a more permissive license, the MS-PL.

That’s pretty cool. From what I understand the MEF is this sort of service locating dll loading extensibility-fu framework. Here is a pretty simple introduction to it. It looks powerful.

Now, push that onto the stack, and think about JQuery being included in a release of MS software. Woah! Can you say, “Holy Crap!” because I can. Microsoft is including an open source library as part of various Visual Studio, ASP.NET MVC packages!  That’s frickin’ huge! I can’t think of any other open source library ever included in a Microsoft release.

Now, push JQuery onto the stack and read this. Microsoft collaborated with leaders of the open source community to jointly design and develop CommonServiceLocator, a shared interface for service locators/IoC Containers. Everyone writes one of these interfaces/static gateway doohickies at some point in time, so a single one jointly developed by the people who wrote our IoC containers with an apparent nod of support from Microsoft itself makes my head spin.

It’s a lot harder to blindly hate Microsoft these days. In a time when Apple is treating their development community like complete fecal matter, we have to acknowledge and recognize efforts by Microsoft to reach out to us, listen to us, and attempt to give us the tools we need to do our jobs.