First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)

December 2011 Blog Posts

Best of 2011: top 5 posts of the year

top5-2011This is the time of year when people look back at the year just passed, review and looks out for the year to come.

My retrospection post will come in the new year, but for the moment I want to review my top posts of 2011.

The most popular post of 2011

1. The history of ASP.NET MVC, so far – This blog post contains the list of all the version of ASP.NET MVC, and the features that were brought into each version. It was featured in the home page of the asp.net portal for a few days at the beginning of July.

2. 10 articles on ASP.NET MVC Extensibility to land on Simple-Talk in the next months – This post announces a series of articles I’m writing for Simple-Talk, the online portal of RedGate. The series is about a very important topic about ASP.NET MVC: Extensibility. Two article have been already published: An Introduction to ASP.NET MVC Extensibility and ASP.NET MVC Routing Extensibility and more are coming in the future months.

3. Lucene.net is back on trackTop post from 2010 was about Lucene.net, and its possible death, and one of top 5 post of this year is about the revived activity of the project and the first release after the new team took the lead on the project.

4. Summer time learning: Getting started with Node.js – Included in my usual summer reading list, this year I also included a specific post about Node.js, some books and also some online resources and libraries.

5. Beginning ASP.NET MVC 1 is now available as a DRM-free PDF ebook – This was just an announcement that my book about ASP.NET MVC 1 was released as DRM free eBook.

2011 in numbers

In 2011 I wrote 47 posts (48 with that one) which is just 5 less than 2010, and considering the increased usage of twitter, this is not that bad after all. Compared to 2010, the page views increased, by almost 25%, going from 400k to more than 500k page views (490k with still more than week to go before the end of the year).

And now, the obligatory season wishes…

MERRY XMAS AND HAPPY NEW YEAR!

What's new in ASP.NET MVC 4 webcast: 17 January

ASP.NET MVC 4 is the new version of ASP.NET MVC that came out during Build in September: it included a few pretty interesting features like a newly revamped project template, a better asynchronous controller and, the main feature, native support for mobile version of the site, with device detection and mobile only views.

Also some productivity enhancement were introduced, like recipes to automate repetitive coding tasks. And finally, if you run ASP.NET MVC 4 on top of ASP.NET 4.5, you also get its new features, like script&styles minification and bundling.

I’ll talk about all that and, hopefully something else if Microsoft releases a new version by that time, during the webcast I’ll do for Microsoft Belgium on the 17th of January, titled, with much fantasy “What's new in ASP.NET MVC 4”.

It’s online and, given the particular linguistic situation of the country, it will be in English, so also non Belgian can attend. The webcast is scheduled to start at 14:00 CET. A bit early for people on the West Coast (5AM), but the right way to start a working day for people on the East Coast of the US (8AM).

Before you go on holiday, remember to register to the webcast: What's new in ASP.NET MVC 4

UGIALT.net conf sessions are published

The voting for the UGIALT.net conference just ended, and just in time for the opening of the registration at noon we published, on the new web site the list of the 19 sessions chosen by the more than 180 voters:

  • Perché a fare i preventivi facciamo così schifo? (Cristiano Rastelli)
  • DDD Brutto Sporco e Cattivo (Alberto Brandolini)
  • Organize your chickens: NuGet for the enterprise (Xavier Decoster)
  • SignalR. Code, not toothpaste. Using SignalR for realtime client/server communication (Maarten Balliauw)
  • WinRT e il futuro dello sviluppo per Windows (Lorenzo Barbieri)
  • oData può rappresentare il futuro del DataLayer? (Raffaele Rialdi)
  • Using RavenDB in the wild (Mauro Servienti)
  • ASP.NET MVC, Javascript MVVM e WCF REST Services: web to the max (Roberto Messora)
  • TDD everywhere (Matteo Migliore)
  • Sviluppare applicazioni web mobile con Asp.Net MVC, HTML5 e jQuery Mobile (Michele Aponte)
  • Git Happens! (alessandro cinelli)
  • Layered Expression Trees feat. CQRS (Andrea Saltarello)
  • Roslyn: un compilatore per amico (Alessandro Melchiori)
  • Java Viene da Marte, Ruby da Venere (Paolo Perrotta)
  • I Love Async! (Antonio Liccardi, Emanuele Garofalo)
  • Building awesome games with WebGL and Node.js (Rob Ashton)
  • Come implementare un server per giochi on line in real time (Massimiliano Mantione)
  • OOP vs COP - Classi contro oggetti (Gianluca Padovani)
  • Oltre lo schermo: la user experience delle "cose" (Daniela Panfili)

Interesting to see is the fact that there will be 3 speakers from the .NET Belgian community, Maarten, Xavier and Rob.

Another interesting fact is the list of topics not selected by the voters:

  • Neither of the almost 10 proposals about Azure and cloud have been selected: is cloud a topic that still not many people care about, at least in Italy? Or just SignalR and WinRT and RavenDB are just more interesting?
  • Also not a single proposal about Agile practices reached the top 19. Is people sick of listening to the same things? or are user-stories, kanban, and friends something that are now part of the standard development practices?
  • Other topics that didn't make the top 19 are mobile web and "advanced" javascript: still people think of javascript as a toy language and see mobile web as something unnecessary?
  • Finally I was relieved not to a single session about ORMs… I hope it means that we finally reached a level where we don't need to debate on how to save data any more

If you speak or understand Italian, and want to come to the conference, the registration opens this noon, 12 Dec at 12:12. If you don't speak Italian, there will be 3 presentations (out of 5 time slots) in English, so you could still enjoy more than half of the conference. The places are limited, so be quick with your mouse if you want to secure a place.

Set the AsyncTimeout attribute for your async controllers

Today I decided to convert an action that was making various long calls to external webservices to be asynchronous. With the synchronous version it was long but still under the default script timeout of ASP.NET, so I was very surprised when the async version was returning a System.TimeoutException, even if it was still taking the same amount of time. I tried increasing the ScriptTimeout, but still no luck: the page was timing out.

After a bit of searching online I found out that for some strange reason, async controllers have a different timeout, specified by the Timeout property of the AsyncManager; and by default this value is 45 seconds.

Instead of manually setting this value in your action, you can use two action attributes so that infrastructural code doesn’t interfere with your actions’ code:

  • AsyncTimeoutAttribute – you can set the timeout of the async action. It is specified in milliseconds: 10 minutes is 600000.
  • NoAsyncTimeoutAttribute – if you want to set the timeout to indefinte (ie the action will run forever)

Here following a very simple example of an Async controller with the AsyncTimeout attribute set to 10 minutes.

public class SyncController : AsyncController
{
    [AsyncTimeout(600000)]
    public void SyncAllAsync()
    {
        syncManager.OutstandingOperations.Increment();
        var bg = new BackgroundWorker();
        bg.DoWork += (o, e) => DoStuff("Some other stuff", e);
        bg.RunWorkerCompleted += (o, e) =>
                 {
                     AsyncManager.Parameters["model"] = e.Result;
                     AsyncManager.OutstandingOperations.Decrement();
                 };
        bg.RunWorkerAsync();
    }
    
    public ActionResult SyncAllCompleted(SyncViewModel model)
    {
        return View(model);
    }
    
    private void DoStuff(string input, DoWorkEventArgs e)
    {
        SyncViewModel model = new SyncViewModel();
        Thread.Sleep(60000);
        model.Text=input;
        e.Result = model;
    }
}

The code doesn’t do a lot, just fires up the background worker and calls the DoStuff method asynchronously. I just realize I could have also probably used the TPL and the Task with continuation… maybe I’ll write an update to this blog in the next days while I work on my project and need to process more “stuff” in parallel.

Lucene.net 2.9.4 is out, now with NuGet

Last week  Lucene.Net 2.9.4 was released on the official site.

Lucene.net 2.9.4

There is no official news feed for the project, so I’m just copying here the announcement from their homepage:

We finally got it out the door, it took a lot longer than we expected. However, we have a ton of bug fixes rolled into this release as well as a number of new features.

  • Some of the bug fixes include: concurrency issues, mono compilation issues, and memory leaks.
  • A lot of work has been done to clean up the code base, refactoring the code and project files, and providing build scripts
  • A couple of new features: Search.Regex, Simple Faceted Search, and simple phrase analysis in the Fast Vector Highlighter
  • Download it now on our downloads page

Just around the corner is a 2.9.4g release (early January), that has been substantially refactored and uses generics across the board.

And there is a Nuget Package

There are now 2 official nuget packages for Lucene.net:

  • Lucene.net, which contains version 2.9.4.1 and is strongly named
  • Lucene.net contrib, which contains also the various additional feature like highlighter, faceted search and so on

lucene.net-nuget

If you already got Lucene via the pre-existing Lucene package, I recommend you change the package reference to the package with id Lucene.Net. But even if you don’t, and just update your package, you will get a DEPRECATED warning, but for the moment you will still get the new Lucene.net package.

Don’t worry, there is not risk of getting confused: the old packages are well marked as deprecated when you search for Lucene

lucene.net-nuget-window

In the future we will probably release also a package with a quick start.

Thanks to

Getting hold of the package id was the most complicate part of the process, and for that I want to thank Phil Haack for granting us ownership of the old lucene id (which didn’t have any owner), Roger Knapp for granting us ownership of lucene.net and Michał Latoszek for the Lucene.Contrib id.

Also to the Nuget team with which I spent an hour chatting online on the nuget channel on jabbr.net: thank you for giving advises on which was the best way to handle the “deprecation” of a package id.