March 2010 Blog Posts

A New Closed Source Viral License

The “copyleft” provisions of the GPL (GNU General Public License) require that any changes or additions to a GPL licensed work must itself be licensed under terms that adhere to the GPL.

Critics of these “copyleft” provisions have derogatively labeled the GPL as a “viral” license. Such criticism points out that any code that seeks to incorporate GPL licensed code must itself adhere to the terms of the GPL, thus potentially “infecting” other code with its restrictions.

This has caused many developers of proprietary systems to be concerned about any usage of GPL code within their products for fear of turning their closed source codebase into a GPL licensed open source codebase.

But now there’s a new viral license to be feared. This new license us the product of a legal thought experiment that was assumed to be purely theoretical in nature, but impossible to actually realize. The experiment proposed the following question:

Just as there is a license which virally turns closed source code into open source code, is it possible to craft a viral license that does the opposite, turning open source into closed source?

locked-computer

Jim, I’m afraid it is.

The possibility of this specter has been a grave concern for many open source experts for years, but now has been realized by the new antithesis to the GPL called the CSPL, which stands for Closed Source Proprietary License.

Under the terms of the CSPL (pronounced Sess-Puhl), any codebase operating within the same user memory space of the CSPL licensed code is itself licensed under the CSPL which removes all rights to view or change the source code.

Famed Linux developer Linus Torvald, when presented with this news, could only muster the following comment.

Are you fucking kidding me?!

Which coincidentally was the same response uttered by notable Ruby on Rails creator David Heinemeier Hansson (aka DHH), apart from the fact that DHH omitted the words “Are”, “you”, “ing”, “kidding”, and “me”.

Noted open source developer Miguel De Icaza railed against this library in his twitter feed 140 characters at a time noting:

The CSPL is a travesty and a cancer and it must be stopped. OTOH, as long as http://trollcats.com/ is unaffected it can't all be bad. BRB...

Miguel could not be reached for further comment as he was ostensibly engaged in finding the proper TrollCats image to express his complete outrage.

TekPub co-owner Rob Conery glumly noted that sales of his developer focused educational videos have declined precipitously ever since he was forced to redact the source code from his screen casts.

redacted-code

Well regarded speaker and .NET luminary Scott Hanselman had this to say…

This reminds me of the panic that ensued when it was discovered that the last GUID had been used up. By the way, have you seen the Hamster on a Piano?

Prolific blogger and open source developer, Oren Eini (also known as Ayende) noted with dismay that he was finding it very difficult to continue working on his projects formerly known as open source while averting his eyes from the screen in order to comply with the license. His blogging and open source contributions took a noticeable hit as he only managed 256 blog posts in the past week while contributing 297,051 lines of new code to NHibernate, Rhino Mocks, and Log4Net.

Richard Stallman could not be reached for comment on this matter, but it can be safely assumed a legal challenge is brewing.

Querying the Future With Reactive Extensions

UPDATE: After an email exchange with Eric Meijer, I learned that I was a bit imprecise in this treatment. Or, as the colloquial term goes, “wrong”. :) I’ve changed the title to reflect more accurately what Reactive extensions provide.

Iterating over a collection of items seems like a pretty straightforward mundane concept. I don’t know about you, but I don’t spend the typical day thinking about the mechanics of iteration, much like I don’t spend a lot of time thinking about how a roll of toilet paper is made. At least I didn’t until watching Elmo Potty Time with my son. Now I think about it all the time, but I digress.

the-futureHistorically, I’ve always thought of iteration as an action over a static set of items. You have this collection of elements, perhaps a snapshot of data, and you then proceed to grab a reference to each one in order and do something with that reference. What you do with it is your business. I’m not going to pry.

It wasn’t till the yield operator was introduced into C# that I realized this was a very limited view of iteration. For example, using the yield operator makes it easy to enumerate over computed sets, as demonstrated by iterating over the Fibonacci sequence. In this case, the set of elements being iterated is not a static set.

Reactive Extensions

Recently, Matt “is his middle name really not F#” Podwysocki swung by my office to show me yet another way of thinking about iterations via the Reactive Extensions to JavaScript. These extensions are based on the same concept applied in the Reactive Extensions for .NET which I’ve sadly ignored until now.

There’s a channel9 video where Eric Meijer describes these extensions as push collections, as contrasted with normal collections where you pull each item from the collection.

Unfortunately, when I first heard this analogy, it didn’t click in my head. That’s not terribly unusual as it often takes a few bat swings at my head for something to stick. It wasn’t till I understood the pattern of code that reactive extensions are a replacement for, did it click. By inverting the analogy that Eric used, these extensions made a lot more sense to me.

Typically, when you write code to handle user interactions, you write events and methods (event handlers) which handle the events. In my mind, this is a very “push” way to handle it. For example, as soon as a user moves the mouse over an element you’re interested in, a mouseover event gets pushed to your mouseover event handler method.

Reactive extensions inverts this model by taking what I would call a “pull” model of events. Using these extensions, you can treat the sequence of user events (such as the sequence of mouse over events) as if it were a normal collection (well actually, as an enumeration). Thus you can write LINQ queries over the collection which do things like filtering, grouping, composing, etc.

Your code really looks like it’s dealing with a fully “populated” collection, even though elements of that collection may not have occurred yet.

Effectively, you’re enumerating querying over the future.

The mental shift for me is to realize that we’re actually working with sequences being “pushed” into our query in this case and not queries running over already populated collections.

Speaking of keyboard presses, Matt Podwysocki took my Live Preview jQuery Plugin and ported it to use the Reactive Extensions for JavaScript. You can see a demo of it in action here (view source for the code).

The snippet that’s pretty cool to me is the following:

textarea
  .ToObservable("keyup")
  .Take(1)
  .SelectMany(function() {
  return Rx.Observable.Start(function() {
    return textarea.reloadPreview(); });
  }).Repeat()
.Subscribe(function() {});

As Matt told me, if you squint hard enough, it looks like you’re writing a LINQ query in JavaScript. :)

Good Times and Vibes at Mix 10

Last week I spent a few days in Las Vegas attending the Mix 10 conference. Mix is billed as …

A 3 day conference for web designers and developers building the world's most innovative web sites.

Which certainly reflects its origins as a conference focused on the web and web standards. But this year, it seemed that the scope for Mix was expanded to be about, well, a Mix of technologies as the Windows Phone 7 series figured prominently at the conference.

shanselman-haacked-jeresig Scott Hanselman and I are seen here attempting to tutor this young man about a language called “JavaScript”

Mix of communities

One aspect I love about Mix is it’s also a Mix of communities. Sure, it’s heavily Microsoft dominated, since it is, well, Microsoft that puts it on, but this conference has never been shy about bringing in people outside of the Microsoft community to speak.

One of the speakers I was excited to finally meet in person was John Resig, the creator of the very popular jQuery JavaScript library seen in the above photograph to the right. Yes, for those of you amongst the humor impaired, the caption is a joke (thanks to Peter Kellner who took the photo).

Also speaking was Douglas Crockford (inventor of JSON) who had the best slide of the show with the words…

IE 6 Must Die!

Preach it brother Crockford! Since I was able to chat with him in person, I confirmed it was really Douglas who left this comment on my JSON post suggesting that requiring POST was a good change to the JsonResult in ASP.NET MVC 2. I really enjoyed having the opportunity to chat with him about security and JSON.

Sessions

If you’re interested in watching the keynotes, check out Day 1 (Silverlight, Windows Phone 7 series) and Day 2 (IE9, Web Development, OData).

I presented two sessions (click on the title for the video).

What’s new in ASP.NET MVC 2 

Come see and hear about the latest innovations in ASP.NET MVC 2 and the tooling support in Microsoft Visual Studio 2008 and 2010. We introduce you to a range of productivity (and extensibility) enhancements such as template helpers, model validation, and the new "Areas" feature, which enhances the team development of large websites. With template helpers you can get your website up and running for any data entity type without having to create UI. With improved server side validation and brand new client side validation support, your business data model can define the behavior of your application automatically. All this and more!

The HaaHa Show: Microsoft ASP.NET MVC Security with Haack and Hanselman

The HaaHa brothers take turns implementing features on an ASP.NET MVC website. Scott writes a feature, and Phil exploits it and hacks into the system. We analyze and discuss the exploits live on stage and then close them one by one. Learn about XSS, CSRF, JSON Hijacking and more. Is *your* site safe from the Haack?

For those interested in seeing the decks, trying out the code, and perhaps reading the checklist I use for my demos (the checklist is there to help in case I freeze from stage fright), I’ve made them all available for these two talks in a single zip file.

For the most part, I thought the talks went well, despite some technical difficulties. During my first talk, despite my preparation, I had a demo go wrong due to what I later realized was a comedic chain of errors.

I had a pre-baked attribute I just needed to add to my project containing my entities. However, I accidentally added it to my web project instead, which references the entities project. I then proceeded to import the namespace for the attribute on a class in the entities project. At least that’s what I thought I was doing, but since my entities project didn’t reference the web project (where I dragged said attribute), I accidentally ran the Generate from Usage command adding a new blank attribute class to the project.

You can probably see the surprise and then concern on my face as my big TADA moment where I show the feature working fails to materialize. ;) At least I was able to recover from this demo failure with the help of the audience. Scott and I had a demo failure where I had the wrong version of an app in our machines so we had to tap dance around that failure.

jQuery and Microsoft

If you missed it, one of the big announcements (at least big to me as an open source guy) was that Microsoft is going to focus on investing in jQuery as our primary technology for client browser scripting. Part of this includes contributing back to jQuery, though any contributions we supply will go through the same approval process as any contribution from any other contributor would. No special treatment as far as I know.

I’m very excited about this as it’s been a long time coming. Stephen Walther has more details on his blog post, Microsoft, jQuery, and Templating.

The Attendee Party

The attendee party this year was held at LAX in the Luxor. It was a nice venue except it didn’t have any sort of outdoor patio you could escape to get a breath of fresh air like there was at TAO.

Even so, we had a great time there and you can see many of the pics from the Mix10 flickr set. Afterwards, several of us went to Pure at Ceasars. When we got there, there was a huge line of beautiful people. However, we were able to go up to the rope, show the stamps from the attendee party, and the bouncers waved us right in. It was the total rockstar treatment, which was a lot of fun. I can only imagine the thoughts going through the heads of all those people waiting in line wondering who the heck are these nerds and why are they getting the VIP treatment? :)

Summary

All in all, it was a great conference. I always manage to have a good time in Las Vegas, even when losing a bit of money at Poker. I met countless people, many with interesting questions on ASP.NET MVC. If I forget your name the next time I see you, I apologize in advance. Don’t be shy in reminding me. :)

Ms-PL Source Release for System.Web.Mvc 2

Hot on the heels of the release of ASP.NET MVC 2 yesterday, I’m happy to announce that we are releasing the source code to ASP.NET MVC 2 under the Ms-PL license, an OSI approved Open Source license.

This continues the trend from nearly a year ago when we released ASP.NET MVC 1.0 under the Ms-PL. You can read my blog post there to learn more about the hard work that goes into such releases.

While I’m one who loves lawyer jokes, I do appreciate the work that they do (one of my best friends is a lawyer) and am grateful for the hard work our legal team put in to make this happen again.

Get the source!

To grab the source code, visit the ASP.NET MVC 2 RTM Download Details page and look for the file named mvc2-ms-pl.zip.

What’s next?

This time around, we’re not planning to stop with just the source code for System.Web.Mvc.dll. There’s a bit more source I would like to release under the Ms-PL which should hopefully be coming soon if I can get the ducks to line in a row (who knew releasing code required working with ducks?!).

ASP.NET MVC 2 Released!

It’s that time of year again when the sakura (cherry blossoms) bloom and allergies kick into high gear. When the drive home is no longer shrouded in darkness and when the ASP.NET team releases Software!

sakuraEarlier today we released the RTM of ASP.NET MVC 2 for Visual Studio 2008 SP1. See Scott Guthrie’s announcement about it. For download and install options, visit the ASP.NET MVC Download Page.

Here are a few helpful resources to help you learn more about this release.

My team and I are excited about this release as it adds a lot of great new functionality for those building web applications with ASP.NET MVC. As with ASP.NET MVC 1.0, the community (yes, that’s you people!) were heavily involved in the making of this product via multiple preview releases. So thank you!

What about Visual Studio 2010?

Keep in mind that this release includes project templates for Visual Studio 2008. Visual Studio 2010 RTM will be released fairly soon and that will contain project templates and runtime for ASP.NET MVC 2 RTM in the box.

If you have Visual Studio 2010 RC installed, you’ll find that the installer for ASP.NET MVC 2 RTM is blocked just as it was for ASP.NET MVC 2 RC 2.

To remedy the situation, you just need to uninstall the ASP.NET MVC 2 runtime first, and then run the ASP.NET MVC 2 RTM installer.

I’ve outlined the steps in more detail in a previous blog post describing how to install MVC 2 RC 2 on a machine with Visual Studio 2010 RC. These same steps apply, but switch “RC 2” with “RTM” of course. :)

Again, sorry for the inconvenience. Once Visual Studio 2010 RTM ships, this will all just work.

Source Code! Source Code! Source Code!

As always, the source code, along with our Futures library, is available on CodePlex. For those looking for the Ms-PL package, we will be releasing the source code for System.Web.Mvc.dll very soon.

What’s Next?

I’m glad you asked. While we’ve been very busy getting this release ready, preparing for Mix 10, closing down on ASP.NET 4 and Visual Studio 2010, we’ve still found time to start preliminary planning for ASP.NET MVC 3.

It’s very early and nothing is written in stone yet (of course not, it’d be written in C#), but you can read our rough roadmap that outlines some of the ideas we have for the next version.