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)

July 2010 Blog Posts

ASP.NET MVC 3 Preview 1 is out

Still not officially announced by anybody inside Microsoft, but quietly this morning the first preview of ASP.NET MVC 3 appeared on Microsoft Download.

And it’s exactly what everyone was expecting after last month’s announcement of Scott Guthrie of Razor, the new view engine for ASP.NET MVC.

What else does this new version bring to the table?

First of all it takes a dependency on .NET4. It means that you cannot be able to use it unless you migrate you applications to the latest version of the .NET framework (and if the story repeats itself, with the RTM coming out next year, this won’t be a big deal). And it also means that finally the framework can use all the cool features of C#3, like the dynamic keyword and the new features of .NET4 like the new data annotation’s attributes

  • Razor: already announced a few weeks ago by ScottGu, it’s a new view engine that tries to make it easier to mix code and HTML
  • Dynamic View and ViewModel: now you will be able to use “dynamic” view model and pass them to a view, without using the ugly hashtable approach. At the end of the day it’s still the same thing (no compile-time checking) but at least you don’t see all that ugly “magic strings” around
  • Global Filters: in ASP.NET 2, if you need to apply a filter to all your controllers you have to apply it to you own base controller, and have all your controller inherit from it (actually you could also apply the same attribute to all your controllers if you like writing lot of repetitive code). Now you can just register the global filters in the application startup, just like you do now with the modelbinders or view engines and so on
  • Dependency Injection support: this is probably the most important feature introduced with this release: the ability to use your favorite IoC Container (using the Common Service Locator) to create controllers, factories, views, filters and so on. Brad Wilson has a great series of posts about that.

It was just a very quick recap: I’ll follow-up with a more detailed post in the next days.

Now, run and download the preview and play with it.

7 hand-picked posts from CodeClimber (aka the 7 Link Challenge)

A few days ago, Darren Rowse from ProBlogger stated a blogging challenge: The 7 Link Challenge. Basically it’s about picking 7 posts that fit into 7 different “themes”. Without further ado, here they are. Sometimes I’ll break the rule and will link to 2 posts per category, but, after all, rules are made to be broken, aren’t they?

  • My first Post – I wrote my first post in October 2006. It was titled Subtext Halloween. Actually this is a post I previously posted in my Italian blog, together a few others before launching the “new” blog in the proper way.
  • The post I enjoyed writing the most - “My ASP.NET MVC stack and why I chose it” – After a lot of time doing kind-of team management and maintaining of old applications, last October I finally had the chance to work a green-field application with ASP.NET MVC, jQuery, IoC and applying all the best practices I had been talking and writing for so long.
  • A post which had a great discussion – “Why SketchFlow is not a mockup software” and “ASP.NET MVC brings FUN back inside web development, on .NET”. The first because it had many people I respect and the “owners” of the products being discussed commenting on the post, with great insights on the reasons behind why things are in certain way. And the second because it was nice to read different opinions on the first versions of  ASP.NET MVC, when people were still thinking the new framework was too much work compared to WebForms. Actually also the post “Do you wanna be the Picasso of programming? First learn the rules, and only after break them” had a great discussion about when and how to be strict applying the best practices for good design.
    If I take into account the number of comments only, probably the post with the most comments is “So Long Avanade, and Thanks for All the Fish”, where I announced my new job and my relocation to a new country. But they are mostly “congratulations”, so don’t qualify for a “great discussion” . Part of the reasons I don’t get 200-300 comments on posts is because I decided to auto-closing comments 2 months after a post is published. Probably I’ll change this policy in the future.
  • A post  on someone else’s blog that you wish you’d written - “Think before you bind” and the follow-up “Easy And Safe Model Binding In ASP.NET MVC” by Justin Etheredge. That topic is still relevant even with the latest version of ASP.NET MVC, and the two post show that you always have to think carefully about the consequences of what happens when you use the “auto-magical” features of a framework: in this case, you could be easily hacked.
  • A post with a title I am proud of - “How to make a Gmail-like loading indicator with ASP.NET Ajax” – It was still in the pre-twitter era, but I guess this is the kind of title that would get attention. And not so surprisingly, it’s my second most popular post.
  • A post that you wish more people had read - “13 ASP.NET MVC extensibility points you have to know” – I think that the extensibility story is one of the best feature of ASP.NET MVC. I think this is a must read for everyone that is working with it. Go and read it NOW!
  • My most helpful/visited post - “How to refresh an UpdatePanel from JavaScript” - This post written June 2007 is about something that should have been trivial, but it wasn’t. And surprisingly still generates 7-8% of my visits. Which shows 2 things: there are still a lot of people that are using UpdatePanel, and that abstractions are fine as long as you don’t need to do something they were not planned for.

I’m not going to nominate someone else to do the same, but it would be fun to see other .NET bloggers joining that “challenge”.

How to edit very old posts with Windows Live Writer

One day you find a link is broken in a post you wrote 4 years ago about a Halloween pumpkin carved with the Subtext logo, and you want to edit it. But since then you wrote more than 600 blog posts. How can you do it?

Your current options

You have two options:

  • you use the rich text editor of your blogging platform, but then you will not have all the nice plugins and preview of WLW
  • you open the post for editing using Windows Live Writer and you download all your latest 1000 posts and edit just the one you need (and if you are still using WLW Wave 3 if the post is after the 500th position you cannot even open it)

As you see there are really no an options.

I tried sending emails to the WLW team with my problem and the solution they came up with was just to add the possibility to download “all” the posts, which IMHO is pretty inefficient (you have to download all your posts just to edit one of them).

Fortunately a friend of mine working at Microsoft had the same problem and instead of just emailing the team decided to write a “plugin” to make it possible to edit a post just by having its post id (to be entirely true, it’s not a plugin but a url handler and an executable that calls  some internal WLW API). Without further ado, here are the steps.

Download and install the plugin

Just download the plugin and install it. If you read Italian you can also have a look at the download page of my friend’s blog for updates. Since it’s not a “real” plugin, you will not find anything in the plugins list in WLW, so don’t panic.

Edit your old post

Once installed the plugin you can edit your post just by finding the id of your post and typing in the address bar of your browser a Uri with a custom scheme “wlw”, for example:

wlw://example.com/?postid=yourPostId

Once you hit enter, a window will popup, downloading the post and opening it into WLW for you to edit.

wlwpostdownloaderplugin

Big thanks to Paperino for making that available to all of us, and look forward to a support for this in the admin of Subtext.

Download the plugin: WLW Post Downloader Plugin

Subtext vNext: which features would you like and on which framework?

Over the last month we released 2 versions of Subtext:

Now we are looking ahead for the next version (Subtext 2.6) which will mainly address the pains of some big blog sites like UGIdotNET and GeeksWithBlogs: with the current version it’s nearly impossible to manage the amount of blogs they have on their site and we will try to make that easier for them to do so. And on our plan there is also the upgrade of the rich text editor to CKEditor 3.

But we are still undecided whether to stay on .NET 3.5 or to upgrade to .NET 4.

Upgrading to .NET 4 which will enable us to take advantage of SQL CE 4 to provide an embedded database option that runs on medium trust, Razor for building skins in the future and using MEF for our plugin architecture.

So, without further ado, please take a second to answer to the following simple question: Which framework should Subtext vNext target/support? (if the form below doesn’t seem like working, please vote directly using the link)

And if you have other feature request, please feel free to comment on this blog post.

Tags:

Welcome to the WebMatrix, and my thoughts about it

When I saw the Gu writing 3 posts in a row about new technologies/products (IIS 7.5 Express, SQL Server CE 4 and Razor view engine) I knew something big was about to come. And in fact yesterday he announced the WebMatrix, a new web development stack that combines the 3 products above plus a new super-easy to use web development IDE and a new syntax for developing quick websites, called ASP.NET Web Pages.

The WebMatrix

First let’s share the official announcement:

WebMatrix includes a complete Web development stack that integrates a Web server (IIS Developer Express), database (Microsoft SQL Server Compact 4.0), programming model (ASP.NET Web pages with Razor syntax), and a tool (WebMatrix Beta) into a seamless experience.  You can use WebMatrix to streamline the way you create an ASP.NET Web site from templates, or by starting a new Web site by using the world’s most popular free and open source (ASP.NET or PHP) apps like DotNetNuke, Umbraco, WordPress, or Joomla!. With WebMatrix you can code your Web sites, customize them, optimize them for good search engine ranking, test them, and deploy them to an Internet hosting company, all through the tool.

Learn more about WebMatrix through:

For additional resources, visit:

Also available is a nice 200 pages eBook about the Razor syntax and the ASP.NET WebPages: ASP.NET Web Pages using the Razor syntax.

And finally, make sure to read the long and super-complete blog post by ScottGu, Introducing WebMatrix and ScottHa post with a detailed step by step example of WebMatrix and with links to more documentation.

Before moving on, one thing I want to make very clear to avoid confusion is that, while some parts of the WebMatrix stack are very interesting for professional developers (IIS Dev Express, Razor and SQL CE 4), all the rest (the IDE, ASP.NET WebPages) is targeted to hobbyists developers, that wants to quickly write their own website and that don’t need to build complex applications, or also people that want to make their own Subtext skin by modifying a default skin.

If you are a professional developer and are wondering how all these new things relate to WebForms and ASP.NET MVC, David Ebbo wrote an interesting post explaining how WebMatrix, Razor, ASP.NET Web Pages and MVC fit together.

Now my thoughts on it

Whereas I’m pretty excited by Razor, I’ve to say that I’ve mixed feelings about the WebMatrix IDE and ASP.NET WebPages: they lower the bars for new developers that want to start building their personal web sites on the MS stack, but doing so they also promote “bad” programming practices. Probably people that want to build their quick site to publish all their runs don’t care about unit testing, SOC and so on, but still seeing a SQL statement in the the “view” feels bad. But again, I’m not the target of this platform.

What I think will be important is the migration story from this PHP-like way of developing apps to a more professional one if the developers decides he/she wants to go that route.