Simone Chiaretta

Syndicate content CodeClimber
Climbing the Cliffs of C#
Updated: 1 hour 57 min ago

At the Italian Agile day in Bologna

Fri, 11/21/2008 - 06:48

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.

Technorati Tags: ,,,

Not even in my worst nightmare

Thu, 11/20/2008 - 02:04

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

Tue, 11/18/2008 - 21:28

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"> <ul> <%foreach (var route in ViewData.Model) { %> <li><%= route.Name %></li> <% } %> </ul> </div>

The same code in NHaml will be:

.list %ul - foreach (var route in ViewData.Model) %li = 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

Tue, 11/18/2008 - 06:05

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)

no-hits

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):

downtime

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 blogs.mysuburb.org, wordpress.com or blogs.msdn.com, 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

Sat, 11/15/2008 - 03:05

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(
"blog/{controller}/{action}/{id}",
new MvcRouteHandler()
);

externalBlogRoute.DataTokens = new RouteValueDictionary(
new
{
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:

routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
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 DotNetKicks.com

Technorati Tags: ,,

SEO starting guide for ASP.NET

Fri, 11/14/2008 - 19:23

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.

document-outline

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.

Technorati Tags: ,,,

Windows Live Writer doesn&rsquo;t cope well with small screens

Fri, 11/14/2008 - 00:19

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.

wlw-too-big

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

Thu, 11/13/2008 - 05:52

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

Wed, 11/12/2008 - 21:27

swimmingpic

  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

Tue, 11/11/2008 - 21:55

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

Fri, 11/07/2008 - 00:55

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 bubbl.us 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:

mindmap

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

Thu, 11/06/2008 - 01:27

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

book-cover 

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

Tue, 11/04/2008 - 05:59

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&rsquo;m watching &ndash; part 3

Tue, 11/04/2008 - 04:14

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: ,,,,,

PDC 2008 videos I&rsquo;m watching - part 2

Sat, 11/01/2008 - 02:12

As PDC goes one, other sessions are being redistributed online as downloadable videos.

I already wrote about the sessions I downloaded from the first two days @ PDC 2008, but now more from day two and from day three are appearing online:

As you can imagine by looking at the sessions I’m watching, I’m not really that excited about all the Azure thing.

Technorati Tags: ,,,

PDC 2008 video I&rsquo;m watching

Wed, 10/29/2008 - 21:54

I’m not at PDC 2008, so I’ve to keep up with what’s being announced in LA only through videos.

I watched the two keynotes live (for those who missed them, they are available on demand from the homepage of PDC site).

But there are many other interesting videos to watch. Here is a list of the ones I’m downloading and I’m planning to watch over the next days (well, probably nights):

Hope to attend to an event like this one in the next years.

Technorati Tags: ,,,,

Workshop &ldquo;ASP.NET 3.5 and beyond Web Development&rdquo;: slides and samples

Sun, 10/26/2008 - 10:52

Yesterday I talked about what’s new with the SP1 of .NET 3.5 and about ASP.NET MVC in front of around 50 people in the sunny city of Bari: I really enjoyed doing these two talks, and the public was fantastic. Furthermore it was a pleasure to meet in person people I only “met” virtually on the forum or through blogs.

Today, after recovering from the trip from Milan to Bari, I organized the material and I put everything on the server for everyone to download. Slides are in Italian, but samples are language-agnostic and most of the terms in the slides are in English anyway. So, even if you weren’t among the 50 guys (and gals), you can download the slides and the samples and have a look at them.

I also want to give the url for fun stuff that people really liked:

If you attended the presentation, I’d like to hear a comment from you, and I hope to meet you again soon.

I just realized I didn’t talk about my first official meeting as MVP, at the MVP Italian OpenDays last weekend: I’ll post some pics and talk about it in few days.

Technorati Tags: ,,

Talking about ASP.NET MVC in Apulia

Thu, 10/23/2008 - 01:38

Another weekend, another community event: last Friday/Saturday I was at the Italian MVP OpenDays in Milano and next Friday (October 24th) I’ll be talking in front of more than 70 person (the event is sold out) at the “ASP.NET 3.5 and beyond Web Development” workshop organized by DotNetSide, the .NET usergroup of South Italy.

I’ll speak for 3 hours (and probably more) about ASP.NET MVC and the new features that the .NET 3.5 SP1 brings to the table.

There will be 2 sessions:

  • Life after SP1: I’ll talk about Dynamic Data, Routing, the new ASP.NET Ajax features and the improved javascript intellisense combined with the annotated files for jQuery. (Level 200)
  • Introduction to ASP.NET MVC: what it is, how it works, why it matters and how to test it. (Level 300)

For more information and the agenda go to the usergroup site (sorry, Italian only).

This will be my 6th presentation on the ASP.NET MVC Framework of the year (4 public and 2 held internally in Avanade).

A bit thank to Wrox for the free books about Web Development (ASP.NET 3.5, Silverlight, etc…) that will be given to people asking interesting questions (or answering trick questions).

Technorati Tags: ,,

Italian MVP Open Days 2008

Thu, 10/16/2008 - 21:57

MVPBanner_3

Tomorrow I’ll be attending my first MVP event: the Italian MVP Open Days 2008.

I’m looking forward to it, as it’s a great opportunity to meet all the other guys involved in MS communities in Italy, especially the ones of areas I’m not involved with (like all the server and desktop products). And I’ll finally be able to ask to the Italian MVP lead all the questions that came to my mind about what I can/can’t do and the general information I still have an hard time to grasp.

They said there will some news coming out from these 2 days, I guess probably about how the involvement of Microsoft in the communities is changing. Stay tuned for more news.

Technorati Tags:

How to solve the &ldquo;Visual Studio vanishing&rdquo; bug of ASP.NET MVC P5

Thu, 10/16/2008 - 01:31

The latest release of ASP.NET MVC had a weird bug: with Visual Studio 2008 SP1, when you open any view page, Visual Studio just vanishes, with no error dialog displayed. The Application log contains an item with the following error message:

.NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (6AFD0F92) (0)

With a bit of trial and error, and thanks to some other posts and comments I found out that the reason for this is some conflict with the Visual Studio PowerCommands tool: uninstalling it fixes the problem.

In my previous installation, I found out that uninstalling and reinstalling the TFS Power Tools fixes the problem as well.

Technorati Tags: ,,