Richard's blog

  • Top five ways to invest your spare freelance time

    Since going freelance I started to view my time as an asset. When I’m working for a client I turn my time and skills into money and also a project that I’m proud of and can add to my CV. Between client projects I like to take some time out to work on a small project for myself. I see this time as an investment and it’s essential that I invest this time well if I want to continue doing well with my career.

    The problem is there are so many possible time investment opportunities that it’s hard to know what the wisest investment is. Here are five possible ways you can … more

  • Using extension methods to filter IQueryable data collections

    As I talked about in my post Do we need the repository pattern? I’ve been thinking about how we can make a testable data access layer with Entity Framework without using a repository pattern. I showed how you could do that in my post Mocking your Entity Framework data context and testing it in .NET MVC. However losing the repository also loses a nice centralised place to keep your query logic. In this post I’ll show you a nice simple way to use extension methods to do this.

    Suppose you’re using Entity Framework to store a collection of foos and there are several places in … more

  • Mocking your Entity Framework data context and testing it in .NET MVC

    I explained in my previous post Do we need the repository pattern? why you might want to mock your Entity Framework context rather than using the repository pattern. In this post I'll show you how to do that and how to test your .NET MVC controllers with a fake data context.

    The way you do this varies slightly depending on whether you're using code first or database first. I'll cover both in this post.

    Using Code First in Entity Framework 4

    My implementation of code first is based heavily on the blog post by Rowan Miller.

    A mockable data context (EF Code First)

    When you create your … more

  • Do we need the repository pattern?

    As we learn new technologies, we discover new mistakes. The Entity Framework makes data access very quick to develop, but also introduces a new set of mistakes that can be made. On my last project I used the Entity Framework Profiler and found my code blighted with a scourge of N+1 problems. I discussed this in my blog post Reviewing my data access layer using the Entity Framework Profiler.

    I was also worried that my code wasn’t testable. From what I’d read, the repository pattern seemed to be the agreed best practice for making your data access testable.

    However my N+1 problems … more

  • Bridge statistics, manga and SQL

    I didn't enjoy stats at school very much. It seemed a very dry subject that involved a lot of tedious calculations and I didn't really see the point. Perhaps if we'd been encouraged to use computers to do the tedious stuff and been given data sets that were more interesting I'd have realised that actually stats can be a very interesting subject.

    After reviewing and enjoying The Manga Guide to Relativity, I was excited to be sent a copy of The Manga Guide to Statistics to review. It inspired me to look at statistics again. Perhaps they do have a point, perhaps with some interesting data and … more

  • Moving from Subversion to Mercurial and Bitbucket

    I've been using Mercurial for source control on my own small projects for a while and have really liked it. I've also wanted to stop supporting my own Subversion server, but previously I've found hosted solutions too expensive. That's why I like Bitbucket's pricing structure. I have lots of projects that need source control, but I either work alone or as part of a small team. Bitbucket charges by the team size, not the number of projects (which seems like a much better way to judge the budget of a project) and it's free for teams of 5 or under.

    I've wanted to move my existing subversion … more

  • Movember at Old Broadcasting House

    November has been Movember for some of us at Old Broadcasting House.

    Movember is all about growing a moustache to raise awareness and money for prostate and testicular cancer. There's only one day left and I will be shaving my moustache off as soon as possible. However Chris and Leo like theirs so much they're planning on keeping them for a bit longer into Mocember.

    You can donate to any of us or the team at our Movember pages (in order of photo appearance):

    Leo (fantastic tache) Fowler

    Chris (killer whiskers) Kenworthy

    Richard (gringo) Garside

    Cactus photo by: Alan Levine more

  • A .NET MVC Helper to create HTML wrapping elements

    In HTML when you want to create a box around some content with rounded corners or some other nice feature it would be nice if you could just wrap that content in a <div> or a <section> tag and CSS would do the rest. However this rarely seems to be the case, particularly if you want the HTML to render well in older browsers. The views in my latest .NET MVC 3 project were full of repeated opening and closing sections of HTML for something that we called a chunk, which is just our word for a box with rounded corners that groups together related elements on the page. Sometimes a chunk … more

  • MailChimp Orchard Module and the Integration Fund

    Back in November 2010 MailChimp announced their One Million Integration Fund. They were offering pots of money to people using their API to integrate with their product. It was early days for me and my new client working on Pianola, but we both loved MailChimp and thought it could be something that would help us out.

    I was also working a lot with Orchard CMS and wanted to use it on this project. As part of building up interest in Pianola while it was being developed we created a sales site using Orchard and we wanted to be able to collect interested people’s email addresses so we could … more

  • Pianola in Toronto

    Since December last year I’ve been the lead developer in a start-up making a product called Pianola. Pianola is a web based product to help bridge clubs manage their club and to bring their members a personal way to review their results and interact with the club. This week I’m in Toronto at the North American Bridge Championships demoing Pianola to club managers and members from across the pond.

    This has been my first business trip abroad and Toronto is an amazing city. The first thing I’ve learnt is that when travelling for business and when carrying a lot of extra … more