Tuesday, December 21, 2010

Debugging into NServiceBus so you can solve your own questions

Blog_Image In my previous post I talked about how one of the main problems with NServiceBus is the learning curve to become familiar with all the setup and configuration options. As NServiceBus is an Open Source project, you are able to to download the code. Once you’ve done this in a few simple steps you can start stepping into the source code as if it's your own code. Which makes solving some of the more complex questions with NServiceBus soooo much easier. For example, what does the "Lite" profile do? Well we can find out by stepping through the code. Here is a quick guide on setting up NServiceBus so you can debug into the code.

Downloading the Source code

The NServiceBus downloads page explains how to download the source code. I went for version 2.0 of the code.

You can get the source for the 2.0 release here.

Wednesday, November 24, 2010

Changing Default Logging Behaviour for different profiles with the Generic Host in NServiceBus

nservicebus logo I’ve been doing a lot of work with NServiceBus recently. I have to say it’s an amazing framework, saving my company hours and hours as we didn’t have to write out own Publish and Subscribe framework over the top of MSMQ. One of the tough parts about the framework is the learning curve to become familiar with all the setup and configuration options. Hence this post, I thought I’d share some of the things I’ve learnt over the last 2 weeks, lucky you eh?

Monday, May 10, 2010

Creating jQuery plug-ins for an unordered list

I've been writing a lot more JavaScript recently, sometime's following other peoples code and sometime's writing my own from scratch. A lot of this JavaScript has been done using jQuery. As most of our development team was new to JavaScript the code quickly became unstructured and messy. There had to be a better way.

I was really pleased to discover that it didn't have to be this way and jQuery had created a really easy to use plug-in architecture. As you'll see from this quick guide it's very easy to create a neat and elegant JavaScript solution using a jQuery plug-in. What I really like about the jQuery plug-in solution is that it makes it easy to provide "Progressive Enhancement" to your site. So that if JavaScript has been disabled, the mark-up will remain unchanged. It' like you are rewarding people with JavaScript and providing a richer browsing experience.

The following example is similar to a real world example I was recently asked to create. The client wanted an un-ordered list to only show the first 5 elements and then provide the user with a link to see the other element. They also wanted the list to be sorted. For this I decided to break the problem down into it's 2 parts.

Part 1 would be to create a "listsort" plug-in, Part 2 would be the "hideextra" plug-in to
show/hide the extra elements.

Here's what the final List ended up looking like:

...and these are the steps to create the above:

Monday, February 22, 2010

Creating an ASP.NET MVC 2 Controller Factory with Ninject


Recently I've been getting into Test Driven Development and one useful thing that helps me out with this is making use of the Inversion of control principle. This makes it easy to pass a Mock version of all my services for the purposes of testing.

However this presents a challenge with the standard MVC Controller Factory. It only supports the parameterless contructors. However, one of the great things about ASP.NET MVC (2) is that it allows you to override most aspects of the framework. It doesn't restrict you as much as it's ASP.NET webforms predecessor. So to avoid the so call "Anti Pattern" of having both a Parameterless Constructor for your "Real Services" and an overloaded constructor for your testing/Mock Services, you can follow this guide to create a Controller Factory which uses ninject. Then you'll only have 1 constructor and you'll sleep soundly.

Creating Ninject Controller Factory

Sunday, January 31, 2010

Faceting and Multifaceting syntax in Solr 1.4


So you've installed Solr 1.4 and you've managed to get some data indexed. Now you're ready to have some fun with faceting. Faceting is basically just filtering the results of a search without effecting the relevance score. Sites such as ebay use faceting to help narrow down the results of a generic search like TV, to give you options such as 32" wide-screen LCD etc.


It makes for a very pleasant user experience. It's one of the main reasons to use Solr and Solr makes this process very easy. There are actually 3 types of faceting. In this post I'm only going to talk about "field faceting". Once you've mastered "field faceting", the other 2 types ("query faceting" and "date faceting") are very easy and the basic Solr Wiki will be enough for you to get going.

Field Faceting

Now when you're indexing data in Solr, it's best to use the "text" field type, as this applies lots of filters which will help sort out plurals, remove white space etc. However when it comes to faceting, the values returned will be the values after the filters have been applied. Therefore it's best to create new versions of any fields you wish to facet.

Monday, January 4, 2010

Adding AssemblyVersion to ASP.net MVC Site using Helpers


I was looking around for some information on how best to add the AssemblyVersion to an MVC site. In the end I thought I'd do it my self as it can't be too difficult. It wasn't and I've included how to do it in this post to help other people out.

Adding a Helper Class to MVC project

The first thing to do is add a Helper class to your existing project. I decided not to use a namespace so I didn't have to import the namespace into the View.

Friday, January 1, 2010

Syntax Highlighting with Blogger Engine


I've been using Blogger as my blogging engine for a couple of weeks. I've been quite impressed at how easy it makes it to update your blogs look and feel and how free you are with the HTML and semantic layout of the pages.
One thing that seemed to be missing was allowing developers to copy and paste code into their blogs and allow other users to copy and paste the code from the blog into their own code.

Using SyntaxHighlighter Javascript Library

So in my search to find something better i came across this post which uses syntax highlighter.

Adding Syntax Highlighter to Blogger Template