A couple of times now my MongoDB windows service won’t start after rebooting my machine. If you look at it in the services list it flicks between Starting and Started states but never really startsm and there doesn’t seem to be a way to get it to stop.
To fix this delete the mongod.lock file in your MongoDB data directory. It will immediately create a new one, but then the service will start.
Dynamically editing lists of data and binding back to the model with MVC is a little complicated as the id’s of the form elements need to all tie up for binding to succeed. Recently I had a model, which contained a list of an object, which in turn contained another nested list. Getting this to easily bind back to the model when adding to the lists dynamically was a bit of a headache so I’ll explain how I did it.
This article is inspired by this article by Steve Sanderson, but I also explain how to adapt it to bind nested lists.
I’ve just started using Autofac, where I’ve previously used Ninject and StructureMap.
UPDATE (09/06/2001): Although this post is about registering all instances that implement a specific interface, my reason for doing so was to create a bootstrapper task. I’ve recently found AutoFac has an IStartable interface which basically does the same thing.
I have an interface called IBootStrapperTask that looks like this:
public interface IBootStrapperTask
I then have several tasks that implement this interface, which I want to get and run when my application starts. First I need to register all types that use this interface, which I don’t want to do by automatically registering all types. I can do this like so:
var builder = new ContainerBuilder();
builder.RegisterAssemblyTypes(Assembly.Load("MyAssesmbly")).Where(t => typeof(IBootStrapperTask).IsAssignableFrom(t)).InstancePerLifetimeScope().AsImplementedInterfaces();
From what I can tell you can only do this on a per assembly basis. Now I have all my types registered I can get and execute them all:
var container = builder.Build();
var tasks = container.Resolve<IEnumerable<IBootStrapperTask>>();
foreach (var task in tasks)
It’s always important to page your data on the server side so that you are only hitting the database to get the page you currently need, rather than getting all the results and paging on the client. In this post I’ll explain how to perform simple ajax paging on the server side using ASP.NET MVC 3.
I haven’t blogged for a while as I’ve been really busy in my new role as Platform Lead at Community Engine where we are currently looking to expand our team.
We’re doing some awesome stuff here to create a cutting edge product platform that will host our future client websites. The team is probably the best technically that I’ve worked with, and our implementation of SCRUM is the best I’ve seen. We’re also using all the latest and greatest technologies from Microsoft so it’s a great opportunity to get these skills and get them on your CV!
The product platform is a multi-tenant web application hosted in the cloud with Amazon EC2 written with ASP.NET MVC and .NET 4 and Entity Framework 4. We’re also making use of MongoDB which is used by the likes of FourSquare and SourceForge, along with Solr for searching and distributed caching with Redis. Who wouldn’t want to work with this technology stack?
If you want to get involved you can apply through our careers page. Make sure you mention my blog when you do. We are also interested in hearing from candidates overseas.
We are looking for a Technical Lead and a number of mid/senior developers, as well as many other roles:
I just wasted what seems to be far too much of my life (about 30 minutes), trying to figure out why the jQuery UI Datapicker wouldn’t work when it was applied to a text box within a Fancybox.
It turns out it was working, but it was being placed behind the Fancybox which had it’s z-index set to 1101.
Adding the following CSS worked a treat
z-index: 1102 !important;
One of the things that annoys me with the IEnumerable.Distinct method is that it has no overload allowing you to give a lambda expression to specify a particular property to perform the distinction, you have to give an IEqualityComparer.
I did a quick Google search and found this post. The guy here provides the following LambdaComparer class:
I was just trying to upgrade my wordpress blog to version 3 using the automatic upgrade but it kept stopping after 30 seconds while unpacking the update. I checked on my server and it hadn’t completed the unpacking. I loaded up the PHP.ini file and after a look around found the max_execution_time setting which was set to 30 seconds. I increased this and the update worked fine.