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)

March 2008 Blog Posts

Testing ASP.NET MVC on DotNetSlackers

My second article on the ASP.NET MVC is now live on DotNetSlackers.

This time the article is about how to test ASP.NET MVC web applications: unit testing, how the ASP.NET MVC framework facilitates testing and how to test Controllers, both with mocking and with the Extract and Overide Call method.

Check it out here: ASP.NET MVC Framework – Part 2: Testing

Any comment is welcome.

If you missed the first article, with a introduction to the ASP.NET MVC framework you can read it here: ASP.NET MVC Framework – Part 1.

Community Credit add-on for Community Server 2007

A few years ago I developed an add-on for Community Server 2.0 to automatically submit contributions to the Community Credit website.

Yesterday I finally found the time to test it with the latest version of Community Server (version 2007), I made some small changes and published it on my public code repository on Google Code.

How does it work?

For those who don't know what Community Credit is I suggest he goes and visit the site and the post I wrote about it more than a year ago "Get Credits for you Community involvement".

The main concept behind Community Credit is that when you contribute to the .NET community you earn some points based on the category of your contribution. But to earn the points you have to submit your contribution to the site. In some categories contributions happen once in a while (like "Attend to MIX 08" or "Received an MVP Designation" or "Start a User Group"), in other like "Blog about something" and "Post a reply on a Discussion Board" they might happen more frequently so going each time to the submission page can become tedious. That's why the Community Credit add-on for CS exists: every time you write a blog post, reply to a thread on a forum or write a comment to a blog post the add-on automatically notifies Community Credit of the event, and you get the points without going to the submission page and inserting the url, title, date and category of your post.

In detail at the moment the Add-On manages 4 categories:

  • if you write a blog post your contribution will receive 500 points
  • if you write a comment to a blog post you get 100 points
  • if you ask a question on a forum (you start a new thread) you get 25 points
  • if you answer a question on a forum you get 75 points

How to install the Add-On

  • Download the compiled Add-On from my Google Code repository.
  • Unzip the file in a directory of your choice and copy the 2 assemblies (CommunityCredit.CommunityServer2007.SubmissionAddOn.dll and CommunityCredit.CommunityServer2007.SubmissionAddOn.XmlSerializers.dll) in the \bin folder of your Community Server installation (if installed in the default location it will be C:\Program Files\Telligent\Community Server 2007\Web\bin)
  • Add a new CSModule into the communityserver.config file
<add name = "CommunityCreditPointSubmission"
type = "CommunityCredit.CommunityServer2007.SubmissionAddOn.CommunityCreditPointSubmission,
CommunityCredit.CommunityServer2007.SubmissionAddOn"
>
<AffiliateKey Value="[YourKeyHere]"/>
<AffiliateCode Value="[YourCodeHere]"/>
<Trace Value="true"/>
</add>

In order to get the AffiliateKey and AffiliateCode you have to register as Affiliate to Community Credit: the Affiliate Key is the one you specify on the form, while the Code will be sent to you by email after the registration.

The Trace element turns on and off the tracing to a text file: useful when trying to troubleshoot in case something doesn't work. It traces to a file named CommCreditSubmissionModule.txt in the \bin folder, so make sure the user on which the CS is running under is allowed to write to that folder.

What's next

But what if your post is not just a post, but is something more? For example an Announcement or a Software Review?

I'm working on a new version of the Add-On that will allows you to specify which kind of contribution you are adding, so if you are writing a blog post about the Tech Event you attended the day before you will be able to specify it and get 1000 points instead of 500. You will be able to do this by tagging your posts with some specific tags.

If you want to have a look at the code, it is available on the subversion repository on GoogleCode, and if you have any feedback, questions, desiderata, just let me know.

Update: I update the link to the source code after I reorganized my repository

Happy Easter

gold-bunny_2008-A.jpg

Wish you a Happy Easter. Be back after a few days in the wild.

Spring Cleaning

Yesterday it was the first day of Spring, and it think I'll spend a few time in the next weeks doing a bit of Spring cleaning of my blog (maybe a redesign, but not sure yet).

I've already something in mind, like implementing a real print-css and fixing the misalignment in IE6, but I'm open to suggestions: what do you like in the design and structure of my blog? What do you like?

And while I'm asking suggestions: any topic you prefer or you don't want me to ever talk about it again?

Please, write in the comments or via the contact page.

Testing websites on different browsers/platforms

I'm thinking about redesigning my blog and just for curiosity today I tried BrowserShots. It allows you to test any website on 60 different combination of browsers and platforms (35 on Linux, 20 on Windows, 5 on Mac). And as result it takes a screenshot of how the website is rendered.

I tried it with 40 default combinations and in 1 hour (the time after which shots in queue expire) it took 34 different shots, from the latest Safari 3.1, IE8 and FF3 to the older IE4.

My blog looks as I expected it to be on 30 out 33 browsers: the 3 failing are... IE 6, IE 5.5, IE 4.

I had no visitors with IE 5.5 or IE 4 in the last few months, but 15% of the overall visitors came with IE6, and sometimes they don't see the site I designed it. I'll see if I can find a VM with IE6 to try and debug the problem.

In all the others it looks good, including IE8 and the various flavors of Opera.

Here is how it looks on IE8. Pretty much the same as in IE7 and FF2 and all the other browsers.

ie8_shot.png

Twittering Again

twitterrific_icon.pngLast June Steve Harman convinced me to start using Twitter. But when I came back to Italy I stopped using it, both because of the continuous outages and because I lived for 3 months without an always-on internet connection.

Last week I decided to start using it again: I installed Twitterrific on my my Mac and Snitter on my PC laptop.

So, if you are interested in knowing what I am doing between blog posts:

twitter.com/simonech

Google adds SiteLinks to searches on blogs

Yesterday looking for CodeClimber on Google I found out that Google is listing some posts as SiteLinks.

codeclimber_sitelinks

The same happens with all the blogs I tried so far (it seems to work only if the blog is hosted on 2nd level domain):

Not sure why it shows the posts he shows (since some are not even in the homepage at the moment), but nice to see this.

Technorati Tag: ,,

Videos on ASP.NET MVC from ScottHa

I just spent the last 3 hours watching all the latest videos available on the ASP.NET MVC MIX08 Preview Release:

If you haven't done yet, I recommend you to watch them all, especially the last one, which is summing up of all the first 4 screencasts, but enhanced with some technical and architectural details on the framework and the great live speech of Scott Hanselman. On Scott blog you can also find other versions of the video (zune, iPod) and, even if most of the coolness of the session was inside the demos, you can also download the the PowerPoint Presentation as well. And here are the demos. (About the demos, Scott promises will be available shortly).

200803120120.jpg

Let's tag all ASP.NET MVC contents with aspnetmvc

One thing that is wrong with the ASP.NET MVC framework is the name: ASP.NET MVC Framework is too long, it's composed by 4 words, and so not easily usable as "tag".

Usually social sites have problems when dealing with multi-word tags:

  • some split them in more tags: ASP.NET MVC becomes ASP.NET and MVC
  • other needs you to enter them with a + between the words: ASP.NET+MVC
  • yet another behavior is using the underscore: ASP.NET_MVC

Given all these different behaviors people tag posts, articles and whatever else related to that topic with many creative different tags. I saw using (and I also used myself):

  • ASP.NET, MVC
  • MVC
  • ASP.NET MVC
  • MVC.net
  • aspnetmvc
  • ASPNET_MVC
  • and so on

My opinion is that the best tag is "aspnetmvc" since it's just one word, and uniquely identify the topic (while mvc could refer also to other kind of mvc framework like RoR or MonoRail).

So, whether you are tagging someone else contents, or writing your own content, please tag it with "aspnetmvc".

Furthermore using this tag when adding a bookmark to del.icio.us it will help build the list of all the resources on the topic that Jeffrey Palermo started to build: http://del.icio.us/tag/aspnetmvc

kick it on DotNetKicks.com

Technorati Tag:

Wanna extend Visual Studio? Read Keyvan book

0470230843s Keyvan Nayyeri just announced the official release of his book about Visual Studio Extensibility, published by Wrox.

This is quite a unique book since the VSX technology is new with VS2005 and is a leap forward compared to the old macro-based extensibility, but nothing has been written on this topic, yet.

The book will cover all the aspects of Visual Studio Extensibility: Macro, Add-Ins, Visualizers, MSBuild, VSPackages, DSL tools, using the Shell.

I also what to thank Keyvan for adding me to his acknowledgement page on the book:

I would thank anyone else who helped us get this book done, both inside Wiley and Wrox and also outside, including Ken Levy, the product manager of the Visual Studio Ecosystem team at Microsoft, and Simone Chiaretta, my dear friend in Italy who helped me with some translations.

Actually I didn't do that much: I just translated some "Hello" to "Ciao" used in the chapter on Localizing Add-Ins. But anyway, thank you Keyvan for this: it's my first appearance on a published book.

Now looking forward to get the book.

UPDATE: I made some corrections to the post following Keyvan comment.

Technorati Tag: ,,,

Testing ASP.NET MVC P2

I'm playing a bit around with the ASP.NET MVC "MIX08 preview" and I wanted to use a different approach to testing the RedirectToAction method.

SubText fellow Phil Haack wrote some sample tests back in December with the previous preview version of aspnetmvc, but I wanted to play around a bit so I wrote my own version.

[TestMethod]
public void AboutOverride()
{
HomeControllerForTest controller = new HomeControllerForTest();

controller.About();

Assert.AreEqual("Index", controller.SelectedViewName,
"Should have redirected to Index");
}

internal class HomeControllerForTest : HomeController
{
public string SelectedViewName { get; private set; }

protected override void RenderView(string viewName,
string masterName, object viewData)
{
SelectedViewName = viewName;
}

protected override void RedirectToAction(RouteValueDictionary values)
{
string action = (string)values["action"];
GetType().GetMethod(action).Invoke(this, null);
}
}

Here I'm using the "Extract and Override Call" testing pattern that is used in testing "Legacy code" (also called "Test Specific Subclass") to have the controller call "my" implementations of the RenderView and RedirectToAction methods that don't have dependencies on the http and  MVC contexts.

Even though it's a testing pattern for Legacy code, and the ASP.NET MVC is a brand new framework I prefer using this approach over the Catalog of TDD Anti-Pattern (I can spot at least 3 TDD anti-patterns in that test) that is the same version with mocking and setting internal behaviors, at least for this kind of tests.

Probably Phil test is more "unit" than mine since he only tests that the action only calls a redirect while mine tests 2 things: the redirect itself  and the fact that the Index action renders the Index view. Furthermore one could easily make the test pass rendering the Index view directly from the About action. But I was just playing with code, so, don't shoot me for that.

Technorati Tag: ,,

Web Developers, Web Developers, Web Developers!!!

At the first MIX08 keynote we saw ScottG juggling for a fictitious job interview for Cirque du Soleil that was demoing his new recruiting tool. But at the second keynote Steve Ballmer replayed his famous Monkey Developer dance, this time for web developers.

Have a look at this video recorded by one of they guys that was lucky enough to sit in of the first rows of the theater:

Steve Ballmer screams “Web developers. Web developers. Web developers”

The links from MIX08 already available: MVC 2 and Silverlight 2.0

I'm watching MIX keynote online, but for curiosity I browsed the MS download site, and I found those 2 interesting links:

kick it on DotNetKicks.com

How to survive to (Pre) Mix Envy - MIX08 webcast

Just watch the MIX '08 webcast live. Tim Sneath just announced that the keynote will be webcasted live from Vegas.

mix.jpg
 

The live webcast will begin at 9:30AM Pacific Time on Wednesday March 5th, which is:

  • 5:30PM GMT (London time)
  • 6:30PM CET (Italy, France, Spain and Germany)
  • 11:00PM Indian Time
  • 6:30AM, Thursday 6h Wellington

For other times: TimeAndDate.com

I have to make sure I get home in time for the live webcast: there will be 3 different bandwidths:

kick it on DotNetKicks.com