Monday, May 10, 2010
Creating jQuery plug-ins for an unordered list
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
Introduction
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
- Firstly go here http://ninject.org/download
- Then click on the Release version of ninject.
Sunday, January 31, 2010
Faceting and Multifaceting syntax in Solr 1.4
Introduction
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
Introduction

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
Introduction
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
Monday, December 14, 2009
Installing LocalSolr onto Solr 1.4 Server (Step by Step)
Introduction
I created this guide, so you don't have to go through the 2 days of hell I had to go through. Mainly trawling countless websites that all seemed to contradict them selves.. However this is how i managed to get LocalSolr working on my Solr Server. Enjoy
Prerequisites
Before you start using LocalSolr, you'll need to install solr. You can following my guide on installing Solr 1.4 on windows here
Steps
Installing Solr 1.4 on Windows XP (Step by Step)
Introduction
I've been spending a lot of time using Solr recently.. So here's my guide to installing it on windows XPSteps
Please follow the following steps to get Solr 1.4 running on a windows box: