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)

November 2008 Blog Posts

What to do if Mighty Mouse stops scrolling

Unlike all other mice that have a small wheel spinning around an axis, Apple's Mighty Mouse has a scrollball that transmits the rotation via friction: so when the ball gets dirty or when particles get into the internal hardware, the mouse doesn't scroll any more.

The solution is just: clean it!

Seems like a pretty common problem, and Apple published a KB article that explains how to clean the mouse, emphasizing on how to clean the scrollball: How to clean your Mighty Mouse.

They also published a quicktime movie that shows you how to properly do it.

And if cleaning with a cloth is not enough, some suggest to insert a piece of paper to help remove the dust.

Subtext 2.1 released

Taking advantage of the Thanksgiving Day’s holiday, Phil wrapped up a few changes and bug fixes and released the first update of Subtext 2: Subtext 2.1.

This new version fixes also on flaw that could allow a potential XSS attack via comment.

To read more about the release, go to Phil’s post: Subtext 2.1 Released! Contains Security Update.

If you are on Subtext 2.0 there are no database schema changes, so just replace the dlls and merge the web.config file, and you are done.

Download the latest version here.

Technorati Tags:

MSTest Tip: Double click to go to failing test

When you run a test suite, Visual Studio shows the results in a grid: the passing ones with the green icon and the failing one with the red icon.

By default, if you double click on the line with the test, Visual Studio shows the details of the test, with the stack trace and the details of the exception. If you right click on the line and you select “Open Test” you will go to the test case, on the line that caused the error.


But if you follow a TDD approach, you want to go straight the test with just one single click. Visual Studio can be configured to do this: just go to Tools>Options>Test Tools>Test Execution and flag the option “Double-clicking on Failed …”


It took me a while to find it out, so I thought to share it.


uTorrent for Mac officially released in beta

I was a big fan of uTorrent on Windows, and since I moved to Mac I missed it a lot. I started using Transmission but what I really missed was the possibility to start a download as soon as a new item appear in a RSS feed.

But the wait is over: I just received an email announcing the release of the beta version of uTorrent for Mac. I’ve to wait this evening when I get back home to install it on my Mac, but on LifeHacker I found a a screenshot of it.

Technorati Tags: ,

How to add a test run configuration to a test project with Visual Studio 2008

When you create a test project from scratch the test run configuration file is automatically added by the project template, but if the test project is created by the ASP.NET MVC web application project template it’s not. And if you want to enable Code Coverage you have to it manually.

It took me a while to find out how to add a test run configuration to a test project. The problem was: it cannot be added to the test project, but must be added as Solution Item to the solution that contains it.


Maybe the ASP.NET MVC team could consider adding the test run config file also in their project template.

Visual Studio Team System 2008 Database Edition GDR goes RTM

Seems like Microsoft just RTM-ed the GDR version of Visual Studio 2008 Database Edition.

Although the name "GDR", which stands for "General Redistribution Release", implies otherwise, this really is a complete new release, based on a new architecture. We have taken the architectural changes from the Rosario project (Visual Studio Team System 2010) and rolled them forward in time.

The coolest feature IMHO are:

  • the Standalone Deployment Engine, which makes it possible to deploy the database schema on target databases that are not all up to date or are different point in time;
  • the new Model based architecture makes loading projects with thousands of objects way faster;
  • Partial Projects: “Conceptually "Partial Projects" are comparable with C/C++ #include files.”

You can read more on the official announcement: Visual Studio Team System 2008 Database Edition GDR – RTM

And download the release (which is only a 11Mb) on Microsoft Download site.

On thing worth noticing: it changes the format of the database project file: if more than one developer is using it, they all must upgrade to the GDR version.

Technorati Tags: ,

Processing goes 1.0

After 8 years of development Processing is finally production grade and has been tagged with the 1.0 version number.

You can download it from the usual site.

I’m really happy they finally made it: congratulations to Ben Fry and Casey Reas for the accomplishment.

Technorati Tags:

How to clean up a folder tree with NAnt

If you want to redistribute the source of a Visual Studio project you cannot just zip the folder tree because otherwise the archive will contain lots of useless files and folders:

  • the bin and obj folders;
  • the _ReSharper.projectName folder that contains the ReSharper cache;
  • the .svn folders with the Subversion state files;
  • all the .user files which contains the user specific configurations for a visual studio project;
  • the .suo file with contains the user specific settings for a given Visual Studio solution.

All these summed up, not only clutters the archive, but also make it grow in size, sometimes even 3 times the “clean” folder structure.

I’m in this situation right now, since I’ve to pack all the code samples for my book, and doing it manually is pretty boring (I’ve 10 chapters with an average of 5-6 sample solutions per chapter). Furthermore I’ll have to rebuild all the solutions when the RTM of ASP.NET MVC comes out, so I’ll have to repeat the cleanup again.

Another thing I’ve to remove is the Company Name and Copyright from the AssemblyInfo.cs file: when Visual Studio creates a solution it automatically puts the name of company VisualStudio was registered for, but the samples for the book don’t need to have a copyright. So I’ve to remove them as well.

Without further ado, here is the quick hack I came out with, using NAnt and embedding the Regex replacement call inside the build file.

<?xml version="1.0"?>
<project name="CleanUp" default="clean">
    <property name="debug" value="true"/>
    <target name="clean">
        <foreach item="Folder" property="foldername">
                <items basedir=".">
                    <include name="**\bin" />
                    <include name="**\obj" />
                    <include name="**\_ReSharper.*" />
                <delete dir="${foldername}" />
        <foreach item="File" property="filename">
                <items basedir=".">
                    <include name="**\*.user" />
                    <include name="**\*.suo" />
                <delete file="${filename}" />
                <foreach item="File" property="filename">
                <items basedir=".">
                    <include name="**\AssemblyInfo.cs" />
                <echo message="${filename}" />
                <property name="AssemblyFileName" value="${filename}"/>
                <property name="find1" value=".*(assembly:\sAssemblyCopyright).*"/>
                <property name="find2" value=".*(assembly:\sAssemblyCompany).*"/>
                <property name="replace" value=""/>
                <call target="regex-replace" />
    <target name="regex-replace">
        <script language="C#">
                    <import namespace="System.Text.RegularExpressions"/>
                    <import namespace="System.IO"/>
        public static void ScriptMain(Project project) {
              StreamReader reader = File.OpenText(project.Properties["AssemblyFileName"]);
              string file = String.Empty;
              try {
                    Regex expression1 = new Regex(project.Properties["find1"]);
                    Regex expression2 = new Regex(project.Properties["find2"]);
                    file = reader.ReadToEnd();
                    file = expression1.Replace(file, project.Properties["replace"]);
                    file = expression2.Replace(file, project.Properties["replace"]);
              } finally {
              TextWriter tw = new StreamWriter(project.Properties["AssemblyFileName"]);
              try {
              } finally {

Probably not the best piece of software, but it does it’s job, and saved me going into each of the 50+ folders and removing the the lines in the assemblyinfo file.

For your convenience, I uploaded a zip file containing the build file and bat file to launch it.

Technorati Tags: ,

At the Italian Agile day in Bologna

Tomorrow I’ll be at the Italian Agile Day in Bologna: it’s going to be “my first time” at an Agile conference and I’m pretty excited about that.

Two members of the UGIALT.NET user group, Emanuele Del Bono and Claudio Maccari, are going to drive a TDD on .NET lab, and for those that were not able to take part at the lab (only 12 seats out of 400 people attending the conference) and are interested on listening to SCRUM-W (the wrong approach to Scrum), there is going to be an OpenSpace that will probably be about tools for an Agile .NET.

At the Agile Day there will also be to evangelist from Microsoft that are going to speak about how Microsoft is going to facilitate the adoption of Agile practices on the .NET stack:

I’m probably going to have a small part in Pietro’s talk. Thank you Pietro for this opportunity.

I’ll be twittering during the event, so, if you are not coming and are interested, follow me on twitter. And if you are coming, see you there.

Not even in my worst nightmare

I warn you, send your child to bed before reading this code snippet:

<span id="lblUser Birthday">User Birthday</span><br>
<input type="text" name="txtUser Birthday" ID="txtUser Birthday">

OK, the HTML4 DTD allows spaces inside the NAME attribute (it’s a CDATA) but it’s one of the worst practices I ever saw (even the control’s name autogenerated by ASP.NET web forms uses $ to separate names’ parts).

And spaces are not allowed inside the ID attribute.

Pragmatists would say that IE and Firefox are pretty tolerant and eat up everything, but this is pretty scary anyway.

I didn’t dare to ask “Who wrote this code?!

Technorati Tags: ,,

Configurable indentation for NHaml

NHaml, an alternative view engine for ASP.NET MVC written by Andrew Peters, uses indentation instead of opening and closing tags to identify code blocks.

If you never saw something written in NHaml here is taste of it. If you want to loop over a list and put it inside a unordered list with webform you would write:

<div class="list">
    <%foreach (var route in ViewData.Model) { %>
      <li><%= route.Name %></li>
    <% } %>

The same code in NHaml will be:

    - foreach (var route in ViewData.Model)
        = route.Name

The biggest problem of NHaml is that it’s behavior depends on the number of spaces you put at the beginning of the line: one level of indentation is made by 2 whitespaces.

Yesterday Andrew wrote a post on his site announcing the beta of NHaml version  2, and a few people, including me, complained that the default indentation of Visual Studio is 4 spaces, but someone even uses tabs. So, he made quick change in the code, and now NHaml features a configurable indentation (2, 3, 4, 5 spaces or even tabs). A very quick response to users’ requests, well done Andrew.

Technorati Tags: ,

How an extensive downtime influences traffic and search rank

At the beginning of October, the server that powered the Ugidotnet blog site (and all the other sites, including the article library and the forums) had a hardware failure (2 HDD in the RAID broke at the same time and some other bad luck) and went down. And it took a few weeks before the new server arrived and the admins of the server set it up again.

As result of this failure, all the blogs stayed offline for 12 days, from the 8th to the 20th of October. My Italian blog is not my primary blog, so I didn’t care too much of the downtime period: I thought that everything would have gone back as before once the server was up again. But I was wrong: today, which is almost one month after the restore of the server, I still receive only 1/3 of the visits I received before the crash (here the last month)


What did happen? Probably Google, while refreshing its indexes, found the pages as not available and removed them from the its database. And when the site went back online it treated it as new.

Here is the graph with the visitors coming to the site before and after the crash (last 12 months, visitors by week):


Maybe now it’s too early to notice an improvement, but I don’t see a growing slope, so I guess it will take long to go back to volume of traffic I had before.

This is a warning for everybody that is serious about blogging: if you are hosting your blog on a 3rd party blogging site, be it, or, you are putting yourself in the situation that you can loose traffic or, even worse, all your posts because someone unplug the service or the machine crashes. (I was lucky that one of the member of the ugidotnet team downloaded the backup of subtext database just 1 day before the crash, otherwise I’ll not be complaining about the decreased traffic, but also about the loss of all my posts).

And that’s the main reason why I started this blog on my own domain and on my own hosting space.

Before someone start misreading this post, I’m not pointing the finger to the ugidotnet team, which indeed did a great job restoring everything in such a short period of time, given the fact that they are all working on their spare time.

Technorati Tags: ,,,

PS: The drop in the stats is the usual traffic decrease caused by Italians going on holiday in July and August.

How to call controllers in external assemblies in an ASP.NET MVC application

If your ASP.NET MVC is growing large, it’s likely that you are partitioning your controllers in different namespaces, or maybe even in different assemblies, and it might happen that you have controllers with the same in different namespaces.

Phil Haack and Steve Sanderson wrote some great write-ups on how to partition an ASP.NET application down into Areas, a concept that exists in MonoRail but not in the core ASP.NET MVC framework. The two posts above allow grouping both the controllers and the views, so if you want a complete solution to the aforementioned problem make sure you read them.

What I want to point out here is that both the two approaches above are based on a hidden feature of the framework and the way the ControllerFactory looks for controller class. So it can be used in your own hand-made “area grouping” solution.

Let’s start directly with the solution: if you add to a route a datatoken named “namespaces” with a list of namespaces, the controller factory will look in these namespaces.

Route externalBlogRoute = new Route(
new MvcRouteHandler()

externalBlogRoute.DataTokens = new RouteValueDictionary(
namespaces = new[] { "ExternalAssembly.Controllers" }

routes.Add("BlogRoute", externalBlogRoute);

With the MapRoute helper method the things are easier since one of the many overloads allows you to specify directly an array of strings:

new { controller = "Home", action = "Index", id = "" },
new[] { "ExternalAssembly.Controllers" }

This is easier than having to remember the name of the datatoken key.

The default controller factory already takes into account the namespaces datatoken. In fact it follows this flow:

  1. Look in the namespaces provided inside the route
  2. if not found, then will look into all the namespaces

This is useful if you have many controllers with the same name in different namespaces: by specifying the namespace in the route definition, you are limiting where the framework will look for the controller.

As last point, if the namespace is in an external assembly, you have to add it as reference of the ASP.NET MVC web application project, otherwise it will not probe it.

kick it on

Technorati Tags: ,,

SEO starting guide for ASP.NET

Today I just found two great sources of information on Search Engine Optimization.

Google’s search engine starter guide

The first has been released directly by Google: Search Engine Optimization Starter Guide

It covers the most common areas that might need a bit of optimization: urls, titles, metatags, image’s alt attributes, robots.txt file and other topics. A must read for everybody that is interested in the topic.

SEO for ASP.NET podcast

The second resource is the great (as always) podcast by Polymorphic Podcast about SEO for ASP.NET.

The guest, Michael Neel, talks about which are the main points of Search Engine Optimization, especially with ASP.NET.

And the main point is:

have the full url (without the query’s parameters) of the page, the page title and the H1 all with the same keywords.

All the rest is micro optimization that is irrelevant if the first golden rule is not applied. As also the Google’s document confirms, the description meta-tag is used to show the description of the page in the result’s list, but not used in the indexing of the page

Good to know… now I’d better change the structure of the HTML of my blog since the H1 is the blog name (codeclimber) and not the title of the post as are all the other two elements.

One good tool to help see the layout of a page is the “Document outline” command of the WebDeveloper toolbar plugin for Firefox. This is the outline of my blog as retrieved by the Document Outline tool.


Then it covers also another interesting topic: ASP.NET Sitemaps. And finally, another sitemap, the one that Google can use to index exactly what you want him to index.

If you are interested in SEO, as with the Google’s doc, I really recommend you listen to this podcast: ASP.NET SEO.

Windows Live Writer doesn’t cope well with small screens

Probably the team that is developing Windows Live Writer never tested it with “small” resolutions: I’ve a 15” LCD display on my Dell D830 with a native (and thus maximum) resolution of 1280 x 800 and I cannot insert “object” inside my posts using the shortcuts in the left sidebar since they are at the bottom of the sidebar, and slip under the bottom status bar.


The biggest problem is the plugins are at the bottom of the list, so, even if I maximize the window, the second plugin will never show up. Ok, I can use the menu or the toolbar to insert a snippet of code, but using the sidebar requires just one click instead of two.

Not sure how they can solve this usability problem: maybe adding a scrollbar, or adding the possibility to collapse each section of the sidebar (Drafts, Posted and Insert).

Technorati Tags: ,

Red X on Build folder on Team Explorer

Today a colleague asked me to allow him to schedule a new build on the project. I thought “he is an admin of the project, he should already be able to do so”. But still he was not able to access the list of builds.

Looking at his Team Explorer he had a red X on the “Build” folder: this was even more strange because usually the folder is named “Builds” (with the s). On the left is my colleague’s team explorer, and on the left it’s mine.

Red_X_Build_folder  correct_build_folder

It seems like it’s a pretty uncommon problem, since I had a hard time finding someone else with the same problem and after a few searches I found this post on the MSDN forum: Red X on Build node.

My colleague didn’t upgrade from TFS2005 to TFS2008 as happened to the other people on the thread, but the proposed solution worked fine:

first of all you should to rename the cache folder for Team Foundation "C:\Documents and Settings\[accountname]\Local Settings\Application Data\Microsoft\Team Foundation\2.0" (in Vista or Windows 2008 the path is “C:\Users\[accountname]\AppData\Local\Microsoft\Team Foundation\2.0\Cache”)

Then execute this command line: Start > Run : “devenv /resetuserdata".

With this you reset your VS user data, you must to be care with this because you will lose all your personal options for VS, but this solve the problem for me.

I’m not sure what it might have caused the problem, maybe, as someone suggests in the thread, some corruption of the profile or a failed Power Tools installation, but this solved the problem without many side effects (unlike the other proposed solution, which was to delete your local user profile and recreate it from scratch).

Technorati Tags: ,

How to start the day in good mood in a rainy November morning


  1. Stay up till 3am to work on an ASP.NET MVC book and write some samples on alternative view engines
  2. Wake up at 7am and tumble out of bed
  3. Grab the Vespa and ride 20 minutes under a pouring rain
  4. Got to the swimming pool, and swim for 1000 meters
  5. Walk to the subway station (and leave the Vespa to your wife), still under the rain
  6. Go to work while listening how pragmatism and getting things done killed the purism and the security concerns (ie How Stackoverflow was built)

And this is not sarcasm: the 30 minutes of swimming and listening to how StackOverflow was build, with not attention to physical security, no tests as would have delayed the release and with less-than-best-practice architecture really lightened my morning start, regardless of the only 4 hours of sleep. There should be more of this kind of podcasts.

Technorati Tags: ,

One year at Avanade

Exactly one year ago I started working at Avanade: wow, time passed fast, way faster then the 10 months I worked for Calcium (7 of which in Wellington). And now that I think, it’s the my second longest job.

Another funny coincidence is that the weekend before starting my job I was showing Milano to David Silverlight, and this weekend I showed Milano  (and other cool places around, including a flooded Lake Maggiore) to another of two guys I met in NZ through the “enlarged” .NET community, Nic Wise and his wife Leonie.

But back to the main topic: Avanade is great place to work, I feared it was more Accenture-like (which means, at least in Italy, 12hrs a day and at least one weekend per month), but it is not. And comparing to my previous experiences, where I had no training provided and no possibility of professional growth, here is the opposite: training, possibility to make a career, to attend to Microsoft conferences are invaluable. And for a technology enthusiast like me, the close connection to Microsoft and the deep technology focus of Avanade are a big plus of the job.

The only downside is that most of my time is now spent managing a team, so I don’t get to write a lot of code: but I guess it depends on the size and the scope of project you end up working for. On the other side, this is good since I love to share my knowledge, and help other people grow.

Another thing I think is good about this first year is that I started working with technologies I never really used before, like MSBuild, Reporting Services, Notification Services, and a little bit of Sharepoint.

All in all, a very positive first year. Looking forward to seeing how the second one will be.

Technorati Tags:

How to keep track of ideas with a mind map

Lately I’ve been a bit busy writing a book on ASP.NET MVC and with some Microsoft events, so unfortunately I didn’t have a lot of remaining spare time to write the interesting posts I used to write before. But my mind never stop running, so sometimes an idea for a good post popped up in my mind. At first I thought I would have been able to remember them all, but soon I discovered I was keeping forgetting them, so I looked for a solution to this problem. And I found out a post that suggested (sorry, don’t remember which one it was) to use a mind map to keep track of all the ideas. The mind map format also allows the ideas to flow, as from one idea many other might come out, like other posts on the same topic or more in-depth posts.

And among the few online mindmapping tools I found, I started to use MindMaster (the other options were and Mindomo) which has a free membership that includes 6 maps.

Down below is my current mind map with the ideas for posts I collected in the past few months:


So, as soon as I finish writing the book, which will hopefully be done by mid-late November, I’ll go back in blog writing mode, so, stay tuned as there are interesting posts on the way.

Technorati Tags: ,,

My community weekends, with photos

October was a pretty busy month for me, especially because of two events I attended in two weekends:

Italian MVP OpenDays

It was great to meet all the other MVPs, especially the ones of other specialties like Office and IT.

We had an overview of how MS is moving about the community, and where it’s heading in the market. We had a brief overview of the Azure thing (at the time it was still called Red Dog).

But the most important thing of the event is networking and being able to meet with the internal people of Microsoft and help them to interact with the community of developers and IT professionals.

And in the Saturday’s random draw I won an X-Box… I still have to turn it on since I need a custom cable to connect it to my only display which is an Apple Cinema Display.

Thanks to the “Official” photographer of the event, Roberto Restelli, MVP on Office Outlook, for the pictures. Here you can see some of them.

TheNewMVPs ListeningToSomeTalk

CelebratingWithAGlassOfWine WinningAnXBox

More pictures of the event can be found on Roberto’s site: the event, the MVPs, the dinner, the draw.

And of course, a big thank to Alessandro Teglia for organizing all of this.

DotNetSide Workshop

I already wrote about the event, my impressions, and posted the slides, but I forgot the pics.

Here are some of them:

crowded-room presenting-jquery


And a cool DeepZoom collage of all the pictures is also available, thanks to Vito.

What’s next?

Hopefully the snow will start to fall, the temperatures will go down, and during the weekends I’ll be starting to go cross-country skiing and ice-climbing. But there are some other events planned in the future and something I’m planning together with the Italian DPE guys, in particular with Pietro Brambati and Gabriele Castellani. Stay tuned, especially if you live in Italy.

Technorati Tags: ,,

The Thunderdome Principle and a very opinionated MVC stack

Last week Jeremy Miller introduced their own opinionated MVC stack built on top of the MS ASP.NET MVC framework.

They talked about this at the KaizenConf that was held last weekend in Austin and as it happened for all the PDC sessions, here are the videos of their “Using and Abusing ASP.NET MVC for Fun and Profit” session.

It’s available in two parts: Part 1 and Part 2.

Technorati Tags: ,

PDC 2008 Videos I’m watching – part 3

That’s the latest “episode” of my review of the PDC videos I’m downloading and plan to watch in the future. I’m now at 8Gb of videos.

For those who are interested, on Channel9 the same video are available also in lower quality WMV, formatted for the Zune and in MP4 for those who want to watch on a iPhone or iPod.

In case you missed, I posted also a part 1 and a part 2 of my list of PDC videos.

If the videos I download are enough for you (for example you are in interested in the hype of the PDC, which is Azure), Nigel Parker posted a comprehensive list of all the PDC’s sessions available online.

Technorati Tags: ,,,,,