Installing Ruby on Rails, RubyMine and MongoDB on Ubuntu Linux

Here are some really basic instructions which should work on a virgin installation of Ubuntu Linux.  I tried following some instructions in a book but they were awful, these are what I ended up with. Install some installation helper tools etc sudo apt-get install build-essential git-core sudo apt-get install curl bash -s stable < <(curl …
Continue reading Installing Ruby on Rails, RubyMine and MongoDB on Ubuntu Linux

SpinLock SynchronizationLockException – The calling thread does not hold the lock

Here is the code from a console app. using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;namespace ConsoleApplication48{ class Program { static readonly SpinLock SpinLock = new SpinLock(); static void Main(string[] args) { bool lockTaken = false; try { SpinLock.Enter(ref lockTaken); if (lockTaken) Console.WriteLine("Lock taken"); } finally { if (lockTaken) SpinLock.Exit(); } Console.WriteLine("Done"); } }} So why would …
Continue reading SpinLock SynchronizationLockException – The calling thread does not hold the lock

How many times does a day occur within a date range?

Given two dates I need to know how many times each day of the week occurs within that range, so that I can calculate a value where the factor varies by day.  So I wrote the following code which returns an array of integers, position 0 will tell you how many Sundays there are, position …
Continue reading How many times does a day occur within a date range?

ASP MVC Silverlight control not appearing–404 not found

Just a quick tip in case you have deployed your ASP MVC app with silverlight controls in it which are not appearing.  I experienced this recently when deploying to IIS6.  The solution is Open the IIS manager app (Start->Admin->Internet Information Services (IIS) Manager) Expand the local computer node Then expand the Websites nodes Right-click your …
Continue reading ASP MVC Silverlight control not appearing–404 not found

Creating a pooled lifetime manager for Unity

My application has a child container per request, this is because there are a lot of services used in each request which depend upon an IUnitOfWork.  I thought it would be nice if I could define a pool of these IUnitOfWork instances so that any cost involved in creating them is reduced, they can just …
Continue reading Creating a pooled lifetime manager for Unity

ECO atomic operations

I’ve just created a simple class which I thought I’d share. Account1.Balance += 10;Account2.Balance -= 10; In this case we might expect the second line to throw an exception if the adjustment is not permitted, but the first line has already executed.  Obviously this isn’t a problem because we simply wouldn’t update the database, but …
Continue reading ECO atomic operations