<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Richard's blog</title><link>http://www.nogginbox.co.uk:80/blog</link><description>Richard's blog</description><item><title>Creating a snap view with XAML in Windows 8 (WinRT)</title><link>http://www.nogginbox.co.uk:80/blog/xaml-snapview</link><description>&lt;p&gt;If you create a new WinRT solution using the Grid or Split Application Template you'll get all the code you need to create a layout aware page that shows a different view when in snap view. If you start of your project using the blank project template, you need to do a little bit more work to get it working.&lt;/p&gt;
&lt;p&gt;First you need to change the page to be a layout aware page. LayoutAwarePage is a class provided by the template and is in the Common folder.&lt;/p&gt;
&lt;p&gt;In BlankPage.xaml.cs change:&lt;/p&gt;
&lt;p class="code"&gt;public sealed partial class BlankPage : Page&lt;/p&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;p class="code"&gt;public sealed partial class BlankPage : LayoutAwarePage&lt;/p&gt;
&lt;p&gt;In BlankPage.xaml you need to change a view things:&lt;/p&gt;
&lt;p&gt;The main page tag now needs to be a LayoutAwarePage so change it from this:&lt;/p&gt;
&lt;p class="code"&gt;&amp;lt;Page&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x:Class="Application1.BlankPage"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns="&lt;a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;http://schemas.microsoft.com/winfx/2006/xaml/presentation&lt;/a&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:x="&lt;a href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:local="using:Application1"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:d="&lt;a href="http://schemas.microsoft.com/expression/blend/2008"&gt;http://schemas.microsoft.com/expression/blend/2008&lt;/a&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:mc="&lt;a href="http://schemas.openxmlformats.org/markup-compatibility/2006"&gt;http://schemas.openxmlformats.org/markup-compatibility/2006&lt;/a&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mc:Ignorable="d"&amp;gt;&lt;/p&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;p class="code"&gt;&amp;lt;common:LayoutAwarePage&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x:Name="pageRoot"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x:Class="Application1.BlankPage"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns="&lt;a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;http://schemas.microsoft.com/winfx/2006/xaml/presentation&lt;/a&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:x="&lt;a href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/a&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:local="using:Application1"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:common="using:Application1.Common"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:d="&lt;a href="http://schemas.microsoft.com/expression/blend/2008"&gt;http://schemas.microsoft.com/expression/blend/2008&lt;/a&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:mc="&lt;a href="http://schemas.openxmlformats.org/markup-compatibility/2006"&gt;http://schemas.openxmlformats.org/markup-compatibility/2006&lt;/a&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mc:Ignorable="d"&amp;gt;&lt;/p&gt;
&lt;p&gt;Your page is now a layout aware page, so all you need to do is add a visual state manager that will control how things look in each different view. You may choose to show or hide different elements based on the view, or just change some sizes. Either way you include all the elements you want in the page set at the size you want them to be in the standard view. You hide them if you only want them to be visible in the snap view. Here is a simple example of a visual state manager:&lt;/p&gt;
&lt;p class="code"&gt;&amp;lt;VisualStateManager.VisualStateGroups&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;nbsp;&amp;lt;VisualStateGroup&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;VisualState x:Name="FullScreenLandscape"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;VisualState x:Name="Filled"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;VisualState x:Name="FullScreenPortrait"/&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;lt;VisualState x:Name="Snapped"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;Storyboard&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="MyListScroller" Storyboard.TargetProperty="Visibility"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/ObjectAnimationUsingKeyFrames&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="MyGridScroller" Storyboard.TargetProperty="Visibility"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/ObjectAnimationUsingKeyFrames&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/Storyboard&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/VisualState&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;/VisualStateGroup&amp;gt;&lt;br /&gt;&amp;lt;/VisualStateManager.VisualStateGroups&amp;gt;&lt;/p&gt;
&lt;p&gt;In this example I have a list view which is initially hidden for snap view and a grid view for my full screen view which I hide for the snap view.&lt;/p&gt;</description><pubDate>Mon, 14 May 2012 12:17:15 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/xaml-snapview</guid></item><item><title>Creating app bar buttons in WinRT</title><link>http://www.nogginbox.co.uk:80/blog/app-bar-buttons-in-winrt</link><description>&lt;p&gt;If you start a new blank Windows 8 App in Visual Studio you get loads of app bar button styles to choose from in StandardStyles.xaml including:&lt;/p&gt;
&lt;ul class="code"&gt;
&lt;li&gt;SkipBackAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;SkipAheadAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;PlayAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;PauseAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;EditAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;SaveAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;DeleteAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;DiscardAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;RemoveAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;AddAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;NoAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;YesAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;MoreAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;RedoAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;UndoAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;HomeAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;OutAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;NextAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;PreviousAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;FavouriteAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;PhotoAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;SettingsAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;VideoAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;RefreshAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;DownloadAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;MailAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;SearchAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;HelpAppBarButtonStyle&lt;/li&gt;
&lt;li&gt;UploadAppBarButtonStyle&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If that list doesn't quite cover you then it's really easy to create a metro button style that will. The easiest way is to create a style based on AppBarButton and to use an icon from the font Segoe UI Symbol. The advantage of using a font is that it is automatically scaleable. Segoe UI Symbol has a lot of symbols for you to choose from and is the font used by AppBarButtonStyle, which we are basing our style on. You can use Character Map to find a good one, or I've included some of my favourites at the end of this post.&lt;/p&gt;
&lt;p&gt;Here is my style for a crop button. Include this style in a resource dictionary that will be accessible to all the xaml files that need it:&lt;/p&gt;
&lt;p class="code"&gt;&amp;lt;Style x:Key="&lt;strong&gt;CropAppBarButtonStyle&lt;/strong&gt;" TargetType="Button" BasedOn="{StaticResource AppBarButtonStyle}"&amp;gt;&lt;br /&gt; &amp;lt;Setter Property="AutomationProperties.AutomationId" Value="&lt;strong&gt;CropAppBarButton&lt;/strong&gt;"/&amp;gt;&lt;br /&gt; &amp;lt;Setter Property="AutomationProperties.Name" Value="&lt;strong&gt;Crop&lt;/strong&gt;"/&amp;gt;&lt;br /&gt; &amp;lt;Setter Property="Content" Value="&lt;strong&gt;&amp;amp;#x25F0;&lt;/strong&gt;"/&amp;gt;&lt;br /&gt; &amp;lt;/Style&amp;gt;&lt;/p&gt;
&lt;p&gt;The text in bold is the text you need to change to make different sorts of buttons. The Content property contains the hex unicode value for the font character you want to use as your icon. I wasn't aware of an accepted standard for a crop icon, so I found one that I thought worked pretty well.&lt;/p&gt;
&lt;p&gt;To use this style on your button you just x like this:&lt;/p&gt;
&lt;p class="code"&gt;&amp;lt;Button x:Name="Crop" Style="{StaticResource CropAppBarButtonStyle}" Click="OnCropButtonClick"/&amp;gt;&lt;/p&gt;
&lt;p&gt;Here are some font characters from Segoe UI Symbol that you might want to use:&lt;/p&gt;
&lt;table valign="middle" border="1" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;th width="220"&gt;Icon&lt;/th&gt;&lt;th&gt;Code&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="/Media/Default/segoe-symbols/E006.png" alt="E006" height="220" width="220" /&gt;&lt;/td&gt;
&lt;td&gt;&amp;amp;#xE006;&lt;/td&gt;
&lt;td&gt;Outline heart&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="/Media/Default/segoe-symbols/E05A.png" alt="E05A" height="220" width="220" /&gt;&lt;/td&gt;
&lt;td&gt;&amp;amp;#xE05A;&lt;/td&gt;
&lt;td&gt;Filled heart&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="/Media/Default/segoe-symbols/E13D.png" alt="E13D" height="220" width="220" /&gt;&lt;/td&gt;
&lt;td&gt;&amp;amp;#xE13D;&lt;/td&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="/Media/Default/segoe-symbols/E125.png" alt="E125" height="220" width="220" /&gt;&lt;/td&gt;
&lt;td&gt;&amp;amp;#xE125;&lt;/td&gt;
&lt;td&gt;Group&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="/Media/Default/segoe-symbols/E141.png" alt="E141" height="220" width="220" /&gt;&lt;/td&gt;
&lt;td&gt;&amp;amp;#xE141;&lt;/td&gt;
&lt;td&gt;Pin&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="/Media/Default/segoe-symbols/E18B.png" alt="E18B" height="220" width="220" /&gt;&lt;/td&gt;
&lt;td&gt;&amp;amp;#xE18B;&lt;/td&gt;
&lt;td&gt;Peek, look, reveal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="/Media/Default/segoe-symbols/E201.png" alt="E201" height="220" width="220" /&gt;&lt;/td&gt;
&lt;td&gt;&amp;amp;#xE201;&lt;/td&gt;
&lt;td&gt;Refresh with angles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="/Media/Default/segoe-symbols/E202.png" alt="E202" height="220" width="220" /&gt;&lt;/td&gt;
&lt;td&gt;&amp;amp;#xE202;&lt;/td&gt;
&lt;td&gt;Outline star&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;There are hundreds more. I'm going to keep updating this list as I find more symbols that I want to use in my apps. Let me know in the comments if there are any symbols you think should be included and what their hex codes are.&lt;/p&gt;</description><pubDate>Wed, 09 May 2012 20:59:48 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/app-bar-buttons-in-winrt</guid></item><item><title>Do we need the repository pattern?</title><link>http://www.nogginbox.co.uk:80/blog/do-we-need-the-repository-pattern</link><description>&lt;p&gt;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 &lt;a href="/blog/reviewing-my-data-access-using-entity-framework-profiler"&gt;Reviewing my data access layer using the Entity Framework Profiler&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I was also worried that my code wasn&amp;rsquo;t testable. From what I&amp;rsquo;d read, the repository pattern seemed to be the agreed best practice for making your data access testable.&lt;/p&gt;
&lt;p&gt;However my N+1 problems led me to read a lot of blog posts by Entity Framework Profiler creator Ayende Rahien. In his post &lt;a href="http://ayende.com/blog/3955/repository-is-the-new-singleton"&gt;Repository is the new singleton&lt;/a&gt; he explains why the repository pattern is no longer required when you have a decent ORM such as NHibernate or Entity Framework. It just adds a layer of abstraction over the ORM, which is in itself a data access abstraction.&lt;/p&gt;
&lt;p&gt;This layer of abstraction can distance you from the features of your ORM. One of these features is allowing you to specify exactly which tables you want to be retrieved in your query. This is one of the things that helps prevent N+1 problems. In the Entity Framework you do this using the include method. I&amp;rsquo;ve seen some Entity Frameworks Repository examples that use the Include method, but most don&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;I still see the repository pattern put forward as best practice and although I agree with Ayende, the repository still seems to be the majority point of view. This excellent article by Tugberk Ugurlu explains &lt;a href="http://www.tugberkugurlu.com/archive/generic-repository-pattern-entity-framework-asp-net-mvc-and-unit-testing-triangle"&gt;how to create a testable generic repository with EF&lt;/a&gt;. I have previously found that using the repository pattern leads to repeating myself a lot, and this implementation fixes that. When I wrote this article his generic repository didn't give you access to the Include method which would have led to N+1 problems. He has informed me in the comments this has now been fixed, and in a nice elegant way. Even with this very nice implementation, does the repository pattern gives us any extra benefit if there is another way to create a testable data access layer?&lt;/p&gt;
&lt;p&gt;Ayende&amp;rsquo;s suggested alternative to using the repository pattern and keeping things testable is to use a mockable interface to your ORM&amp;rsquo;s data context. In NHibernate it sounds like this is quite straight forward, however it wasn&amp;rsquo;t immediately obvious how you could do this using Entity Framework. The advice I found online using this approach was quite scattered, so I&amp;rsquo;ve brought what I found together in this post:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/blog/mocking-entity-framework-data-context"&gt;Mocking your Entity Framework data context and testing it in .NET MVC&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This approach has worked really nicely in my project and I think it is better than using the repository pattern. I&amp;rsquo;m still really open to being told I&amp;rsquo;m wrong and that repositories rock, but I no longer see what they bring to the party.&lt;/p&gt;</description><pubDate>Mon, 16 Apr 2012 20:38:50 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/do-we-need-the-repository-pattern</guid></item><item><title>Drawing TEDx Bradford</title><link>http://www.nogginbox.co.uk:80/blog/drawing-tedx-bradford</link><description>&lt;p&gt;I went to &lt;a href="http://www.tedxbradford.com/lifeonline/"&gt;TEDx Bradford&lt;/a&gt; on Friday. I kept visual notes of the talks using &lt;a href="http://itunes.apple.com/gb/app/paper-by-fiftythree/id506003812"&gt;Paper for iPad&lt;/a&gt;. I got better at using Paper with practice so my notes start to look better in the later talks. I had to leave a little bit early, so I didn't get to make notes on all the talks.&lt;/p&gt;
&lt;h2&gt;Tim O&amp;rsquo;Reilly&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://p.twimg.com/ApPEW6bCEAAVii4.jpg" height="412" width="550" /&gt;&lt;/p&gt;
&lt;h2&gt;Jane MacDonald, Tales of Things &amp;amp; Electronic Memory&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://p.twimg.com/ApPG0BoCAAA3owo.jpg" height="412" width="550" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://p.twimg.com/ApPJ4a2CEAIXQDz.jpg" height="412" width="550" /&gt;&lt;/p&gt;
&lt;h2&gt;Mark Graham, Internet &amp;amp; information geographies&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://p.twimg.com/ApPMBzlCQAIi8JC.jpg" height="412" width="550" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://p.twimg.com/ApPPDniCIAEHZgf.jpg" height="412" width="550" /&gt;&lt;/p&gt;
&lt;h2&gt;Maureen Pennock, Archiving the Web&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://p.twimg.com/ApPUbc_CAAAARkg.jpg" height="412" width="550" /&gt;&lt;/p&gt;
&lt;h2&gt;Dominic Smith, Open source, Art &amp;amp; Wizardlyness&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://p.twimg.com/ApPZ57PCIAAvuAs.jpg" height="412" width="550" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://p.twimg.com/ApPdw6eCAAA0LE8.jpg" height="412" width="550" /&gt;&lt;/p&gt;
&lt;h2&gt;Dr Kieran Fenby-Hulse, The Modern Mixtape&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://p.twimg.com/ApPgSDBCAAAb0wI.jpg" height="412" width="550" /&gt;&lt;/p&gt;</description><pubDate>Mon, 02 Apr 2012 18:59:29 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/drawing-tedx-bradford</guid></item><item><title>Launching Font Picker for mac</title><link>http://www.nogginbox.co.uk:80/blog/launching-font-picker</link><description>&lt;p&gt;&lt;img src="/Media/Default/BlogPost/blog/launchfontpicker.jpg" alt="Demo of choosing fonts" height="119" width="550" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.fontpicker.net/"&gt;Font Picker for Mac&lt;/a&gt; was waiting for approval in the Mac App Store when I agreed to talk at &lt;a href="http://lsx.co/lsxcafe/"&gt;LSxCafe&lt;/a&gt;. Luckily it was approved the morning of the LSxCafe on Tuesday 6 March 2012, so it became my 'high profile' launch.&lt;/p&gt;
&lt;p&gt;Font picker is my first mac app and I'm really excited that it's now available for sale. I made the &lt;a href="/blog/choosing-a-font"&gt;original version of Font Picker&lt;/a&gt; in 2008. It's popularity gradually grew and I started to get really nice feedback emails and ideas for new features. I really wanted to improve it and add those extra features, but I couldn't afford the time. The new Mac App Store (hopefully to be followed by other app stores) gave me hope that it will be possible to make a business out of producing apps and the revenue will pay for developing those apps further.&lt;/p&gt;
&lt;p&gt;In my talk I talked about how &lt;a href="/blog/top-5-ways-to-invest-freelance-time"&gt;developers can invest their free time best&lt;/a&gt;, why I'd decided to make Font Picker and how I'd found switching from .NET development to Cocoa development. When I announced that Font Picker was available in the Mac App Store I got a little cheer, which was cool.&lt;/p&gt;
&lt;p&gt;It's been over a week now since the launch and I'm not yet bored of checking my sales figures as soon as they come out at 1am. How well sales go will affect how much time I can afford to put into further development. I had no idea if I would sell a few copies a month, or hundreds a day. The reality so far has been pretty good. I've already earned enough to pay back the money I spent on joining the developer network. Sales have averaged out at 10 a day so far. If this rate continues I will have earned back the time I spent on the project in about 3 months. The hope is that sales might increase as people start telling their friends how amazing Font Picker is. I'm currently on the first page of mac design apps and I think sales will probably drop when I fall off that page. So, I'll probably need to put some more effort into marketing then. Software development is only one part of running a successful software business and I can't forget that.&lt;/p&gt;
&lt;p&gt;Font Picker is a simple app that helps you choose a font for your design project. You can find out more at the &lt;a href="http://www.fontpicker.net/"&gt;Font Picker site&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Photo credit: &lt;a href="http://www.flickr.com/photos/imran/6818025350/"&gt;Imran&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Sat, 17 Mar 2012 12:57:12 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/launching-font-picker</guid></item><item><title>Choosing a font</title><link>http://www.nogginbox.co.uk:80/blog/choosing-a-font</link><description>&lt;p&gt;&lt;a href="http://www.fontpicker.net/"&gt;&lt;img src="/Media/Default/BlogPost/blog/fonts.png" alt="Font Picker screen shot" height="169" width="300" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When I do a piece of design that involves typography I spend ages choosing the right font. The font that will endow the work with the right feeling and the font that is most similar to the one I've got pictured in my head.&lt;/p&gt;
&lt;p&gt;This normally takes ages, but I've written a &lt;a href="http://www.fontpicker.net/"&gt;Font Picker&lt;/a&gt; program in Flash to help me do it. It shows you a sample of your chosen text displayed using all the fonts on your computer. You can then whittle down this list by removing unsuitable fonts.&lt;/p&gt;
&lt;p&gt;The best thing is that this works straight from your browser and still displays the fonts that are on your computer. I've also made a version you can download and install if you have a PC or a Mac.&lt;/p&gt;
&lt;p&gt;Picking the right font still takes ages, but hopefully you'll find this tool helpful in visualizing the typefaces you're considering.&lt;/p&gt;
&lt;h3&gt;You can use this fantastic tool here&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.fontpicker.net/air/"&gt;Font Picker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;But how does it work?&lt;/h3&gt;
&lt;p&gt;In Flash ActionScript 3.0 there is a very useful function called:&lt;/p&gt;
&lt;p class="code"&gt;&lt;a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/Font.html#enumerateFonts()"&gt;Font.enumerateFonts&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This allowed me to get a list of all the fonts on the computer running the flash program and display any text I wanted using them.&lt;/p&gt;
&lt;p&gt;I've also used Adobe AIR to make a desktop version of this program. I've got some planned extra features for that version, including tagging for fonts and possibly some export features. The great thing about Adobe AIR is that it really was very easy indeed to take my web based Flash App and make it an AIR application.&lt;/p&gt;</description><pubDate>Mon, 12 Mar 2012 21:29:55 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/choosing-a-font</guid></item><item><title>15,000 people have downloaded Font Picker</title><link>http://www.nogginbox.co.uk:80/blog/15000-people-have-downloaded-font-picker</link><description>&lt;p&gt;&lt;a href="http://www.fontpicker.net/"&gt;&lt;img src="/Media/Default/BlogPost/blog/fp15000.jpg" alt="Font Picker screen shot" height="166" width="400" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I created &lt;a href="http://www.fontpicker.net/"&gt;Font Picker&lt;/a&gt; to solve a problem I had and released it in September 2008 hoping that other people would find it helpful. Since then &lt;strong&gt;15,000&lt;/strong&gt; people have downloaded it and its page has had 57,000 unique views. That makes it by far my most successful personal project so far.&lt;/p&gt;
&lt;p&gt;Font Picker is a simple AIR app that helps you choose a suitable typeface for a project. It's down to word of mouth and the wonders of the Internet that so many people have found it. I got my first peak in traffic when it was mentioned in a &lt;a href="http://boagworld.com/podcast/134/"&gt;Boag World podcast&lt;/a&gt;. I'm really greatful for that as it the break that lead to everything else.&lt;/p&gt;
&lt;p&gt;It's now been featured in several articles, including ones on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://lifehacker.com/5134199/font-picker-previews-text-using-your-own-fonts"&gt;Life Hacker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://refreshingapps.com/showcase/app/font_picker/"&gt;Refreshing Apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.smashingapps.com/2009/03/30/17-adobe-air-apps-that-can-save-your-time.html"&gt;Smashing Apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.smashingmagazine.com/2009/01/27/css-typographic-tools-and-techniques/"&gt;Smashing Magazine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.pcworld.com/article/163041-11/banish_your_browser_with_innovative_adobe_air_apps.html"&gt;PC World&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It's been really exciting to watch my web traffic and see all the spikes. I've really appreciated everyone's feedback. It's helped improved the program and given me ideas of how to improve it further. I'm really pleased that people are finding Font Picker useful and hopefully even more will too. I'll let everyone know if it reaches 30,000 downloads. I'd be over the moon if that happened.&lt;/p&gt;</description><pubDate>Mon, 12 Mar 2012 21:28:28 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/15000-people-have-downloaded-font-picker</guid></item><item><title>Top five ways to invest your spare freelance time</title><link>http://www.nogginbox.co.uk:80/blog/top-5-ways-to-invest-freelance-time</link><description>&lt;p&gt;&lt;img src="/Media/Default/BlogPost/blog/time.jpg" alt="Wish I had a time machine" height="200" width="550" /&gt;&lt;/p&gt;
&lt;p&gt;Since going freelance I started to view my time as an asset. When I&amp;rsquo;m working for a client I turn my time and skills into money and also a project that I&amp;rsquo;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&amp;rsquo;s essential that I invest this time well if I want to continue doing well with my career.&lt;/p&gt;
&lt;p&gt;The problem is there are so many possible time investment opportunities that it&amp;rsquo;s hard to know what the wisest investment is. Here are five possible ways you can invest your spare freelance time:&lt;/p&gt;
&lt;h2&gt;Training&lt;/h2&gt;
&lt;p&gt;Training yourself is always a good solid way to invest your time. This might just be reading some tech manuals or doing some tutorials. I try to do this as I&amp;rsquo;m going along. You don&amp;rsquo;t need to have a full break from client work to read a lovely geeky book before you go to bed. I learn best by doing, so I like to make a project using a technology that I want to learn about. When I wanted to learn about the Orchard CMS I made a few simple modules that helped me learn what I needed to know. Since then I&amp;rsquo;ve done client work where I was able to put those new skills to use. This is a low risk investment. New skills are always useful and even if you spend time learning something that ends up not being useful, you have still learnt that it&amp;rsquo;s not useful.&lt;/p&gt;
&lt;h2&gt;Promotion&lt;/h2&gt;
&lt;p&gt;Promoting yourself and meeting people is an essential part of freelancing if you don&amp;rsquo;t want to completely rely on recruitment agents. This is also something you must invest time in, and it&amp;rsquo;s easy to let slip when you&amp;rsquo;re busy. I&amp;rsquo;ve been trying to blog more this year, but it takes me a long time and it&amp;rsquo;s hard to measure the ROI (to borrow a financial term). I have had clients find me through twitter and my blog though, plus I enjoy doing it, so although it&amp;rsquo;s hard to measure it&amp;rsquo;s another worthwhile investment. There are also lots of networking events, some of are also fun and/or educational, which is a bonus. Promotion time is a slightly riskier investment. You don&amp;rsquo;t know which blog posts will be ignored or heralded and you don&amp;rsquo;t know which events will lead to great opportunities. I&amp;rsquo;ve heard that titling your blog post as a &amp;lsquo;top 5 something&amp;rsquo; is an effective, but slightly cynical way to get attention. So let&amp;rsquo;s see if this works. Generally with promotion; little and often is a good strategy, but not one that I always manage to follow.&lt;/p&gt;
&lt;h2&gt;Toolbox&lt;/h2&gt;
&lt;p&gt;I like the term software craftsmanship. A craftsman has a box of tools. To become a better craftsman it&amp;rsquo;s a good idea to invest some time in evaluating new tools and building your own. When you&amp;rsquo;ve worked on a few projects you start to find things that need doing again and again. Sometimes you find that someone else has had to do the same thing and has created a code library or tool to do that job. Trying out those tools can save you a lot of time if you find a good existing solution. Creating your own if you have too is also a good investment. It will save you time in the future and if you choose to share them, it will save other people time. This sort of reciprocal investment, found particularly in open source software is really good; we all save more time if we share.&lt;/p&gt;
&lt;h2&gt;Product&lt;/h2&gt;
&lt;p&gt;I have an ideas book that I carry with me and write my ideas in when I&amp;rsquo;m struck with inspiration. Some of the ideas are product ideas, and some of those are software based products. Thinking from an investment point of view a successful product is one that in its lifetime produces more revenue than you invested in it. As a freelancer with a daily or hourly rate money and time are interchangeable. If a product does really well, the money it brings can buy you more time to add new features to the product, or to invest in one of the other ways I&amp;rsquo;ve talked about.&lt;/p&gt;
&lt;p&gt;This is probably the riskiest strategy. It is something I&amp;rsquo;ve really wanted to do, but not something I&amp;rsquo;ve successfully pulled of yet. The problem is that you actually need a lot of time to make most ideas a polished reality. You also need time to market and support the product. And you don&amp;rsquo;t know if you&amp;rsquo;ll be able to make enough revenue to pay back the time you put in.&lt;/p&gt;
&lt;h2&gt;Fun&lt;/h2&gt;
&lt;p&gt;The danger thinking too seriously about investing your time is that you forget that you need to use some of it for having fun. There are plenty of project ideas in my ideas book which are not potential money making products, but I know I&amp;rsquo;d enjoy making them. I also love cycling, swimming and catching up with my friends. Finding time for these and other activities is essential if you want to remain sane.&lt;/p&gt;
&lt;h2&gt;My latest investment&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;m coming to the end of a gap between client projects and this time I chose to invest my time in making a product. I&amp;rsquo;m generally quite risk adverse so I&amp;rsquo;ve followed the advice in &lt;a href="http://www.amazon.co.uk/gp/product/0670921602/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=garsonix-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=0670921602"&gt;The Lean Startup&lt;/a&gt; and made a minimal viable product. This version one product is a way to test the waters. There are lots of potential features for version 2, but I would need to invest more time that I don&amp;rsquo;t have at the moment. If the product is a success it will pay for itself and buy me more time to make version 2.&lt;/p&gt;
&lt;p&gt;This product is &lt;strong&gt;&lt;a href="http://www.fontpicker.net/"&gt;Font Picker for Mac&lt;/a&gt;&lt;/strong&gt;, which will be available in the Mac App Store soon. It&amp;rsquo;s currently waiting for approval. I&amp;rsquo;ve tracked the time I&amp;rsquo;ve spent on it so far and I will need to sell approximately 600 copies to recoup the time I have invested so far. I will also have to invest some more time in marketing it and answering any support emails I get. I don&amp;rsquo;t know if I&amp;rsquo;ll break even, but this has also been a fun and education project for me so either way it&amp;rsquo;s been a winner.&lt;/p&gt;
&lt;p&gt;You can follow &lt;a href="http://twitter.com/FontPicker"&gt;@FontPicker&lt;/a&gt; on twitter to find out more and know when it hits the store.&lt;/p&gt;
&lt;p&gt;Photo credit: &lt;a href="http://www.flickr.com/photos/st3f4n/4356185807/"&gt;St&amp;eacute;fan&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Mon, 05 Mar 2012 20:11:27 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/top-5-ways-to-invest-freelance-time</guid></item><item><title>Richard's beard</title><link>http://www.nogginbox.co.uk:80/blog/richards-beard</link><description>&lt;div id="kensei_media_player_a7a44e34-e770-4e70-894b-39801c508494"&gt;&amp;nbsp;&lt;/div&gt;
&lt;script type="text/javascript" src="http://public.services.kenseimedia.com/js/km_integration.1.3.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;// &lt;![CDATA[
var kmobj = new kenseiMediaItem();kmobj.apikey = '2d7f656b-d4cd-4f67-99ef-dff582d9cc8f';kmobj.mediaId = 'a7a44e34-e770-4e70-894b-39801c508494';kmobj.playerContainerId = 'kensei_media_player_a7a44e34-e770-4e70-894b-39801c508494';kmobj.loadMediaPlayer();
// ]]&gt;&lt;/script&gt;
&lt;p&gt;I grew a beard, because I didn't feel like myself. When I shaved it off I expected to feel like myself again. I didn't, but it was the start.&lt;/p&gt;
&lt;p&gt;&lt;img src="/Media/Default/BlogPost/blog/beard.jpg" alt="Richard Garside with a beard" height="256" width="320" /&gt; &lt;img src="/Media/Default/BlogPost/blog/beardno.jpg" alt="Richard Garside without a beard" height="256" width="320" /&gt;&lt;/p&gt;
&lt;p&gt;My friend &lt;a href="http://www.vjpistolpete.co.uk"&gt;Pete&lt;/a&gt; committed the whole thing to film. I wanted to capture what I felt was a deep spiritual moment. Pete added the music, which reveals wonderfully that shaving off a beard, is in fact, quite silly.&lt;/p&gt;
&lt;p&gt;I published the video in the same month that You-Tube released it's first beta. However, I didn't know that at the time, so I published it on my own site.&lt;/p&gt;
&lt;p&gt;My &lt;a href="http://www.boingboing.net/2005/05/17/high_speed_video_of_.html"&gt;video was featured on Boing Boing&lt;/a&gt; and about 50,000 people flooded to my site in response. My very understanding hosting company decided not to charge me for the extra bandwidth I used. This is lucky as it would have cost me over &amp;pound;1,000 at their stated charges.&lt;/p&gt;
&lt;p&gt;The shear ridiculousness of it all really made me smile. It also inspired me to get stuck into playing about with my own ideas outside of the normal 9 to 5. The beard has led to a number of very fantastic things.&lt;/p&gt;</description><pubDate>Tue, 28 Feb 2012 17:57:06 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/richards-beard</guid></item><item><title>Using extension methods to filter IQueryable data collections</title><link>http://www.nogginbox.co.uk:80/blog/extension-methods-filter-iqueryable</link><description>&lt;p&gt;As I talked about in my post &lt;a href="/blog/do-we-need-the-repository-pattern"&gt;Do we need the repository pattern?&lt;/a&gt; I&amp;rsquo;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 &lt;a href="/blog/mocking-entity-framework-data-context"&gt;Mocking your Entity Framework data context and testing it in .NET MVC&lt;/a&gt;. However losing the repository also loses a nice centralised place to keep your query logic. In this post I&amp;rsquo;ll show you a nice simple way to use extension methods to do this.&lt;/p&gt;
&lt;p&gt;Suppose you&amp;rsquo;re using Entity Framework to store a collection of foos and there are several places in your app that you want to show a list of foos that are special in some way. You want to keep the logic for foo specialness in a central place as you don&amp;rsquo;t want to repeat it. An extension method gives us a really nice way of doing this.&lt;/p&gt;
&lt;p&gt;Here is how our extension method would be used:&lt;/p&gt;
&lt;p class="code"&gt;var specialFoos = _data.Foos.WhereSpecial();&lt;/p&gt;
&lt;p&gt;And here is the implementation:&lt;/p&gt;
&lt;p class="code"&gt;public static class ModelFilters&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static IQueryable&amp;lt;Foo&amp;gt; WhereSpecial(this IQueryable&amp;lt;Foo&amp;gt; foos)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return foos.Where(f =&amp;gt; f.IsSpecial &amp;amp;&amp;amp; HowSpecial(f) &amp;gt; 10);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;Now all your query logic is in one place and you can test it because the extension method is on the IQueryable interface rather than a concrete collection class.&lt;/p&gt;</description><pubDate>Mon, 20 Feb 2012 09:41:48 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/extension-methods-filter-iqueryable</guid></item><item><title>Mocking your Entity Framework data context and testing it in .NET MVC</title><link>http://www.nogginbox.co.uk:80/blog/mocking-entity-framework-data-context</link><description>&lt;p&gt;I explained in my previous post&amp;nbsp;&lt;a href="/blog/do-we-need-the-repository-pattern"&gt;Do we need the repository pattern?&lt;/a&gt; why you might want to mock your Entity Framework context rather than using the repository pattern. In this post I&amp;rsquo;ll show you how to do that and how to test your .NET MVC controllers with a fake data context.&lt;/p&gt;
&lt;p&gt;The way you do this varies slightly depending on whether you're using &lt;a href="#codefirst"&gt;code first&lt;/a&gt; or &lt;a href="#dbfirst"&gt;database first&lt;/a&gt;. I&amp;rsquo;ll cover both in this post.&lt;/p&gt;
&lt;h2 id="codefirst"&gt;Using Code First in Entity Framework 4&lt;/h2&gt;
&lt;p&gt;My implementation of code first is based heavily on the &lt;a href="http://romiller.com/2010/09/07/ef-ctp4-tips-tricks-testing-with-fake-dbcontext/"&gt;blog post by Rowan Miller&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;A mockable data context (EF Code First)&lt;/h3&gt;
&lt;p&gt;When you create your code first DBContext it is very easy to make it include an interface that can be mocked. Here is a simple example:&lt;/p&gt;
&lt;p class="code"&gt;public interface IContext&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IDbSet&amp;lt;Foo&amp;gt; Foos { get; set; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IDbSet&amp;lt;Bar&amp;gt; Bars { get; set; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int SaveChanges();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class EFContext : DbContext, IContext&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IDbSet&amp;lt;Foo&amp;gt; Foos { get; set; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IDbSet&amp;lt;Bar&amp;gt; Bars { get; set; }&lt;br /&gt;}&lt;/p&gt;
&lt;h3&gt;Using you mockable context in a controller (EF Code First)&lt;/h3&gt;
&lt;p&gt;This is also very easy. I&amp;rsquo;d recommend using a proper dependency injection framework like AutoFac, but in this example I&amp;rsquo;m going to use to use poor mans DI to keep it simple.&lt;/p&gt;
&lt;p class="code"&gt;public class HomeController&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private IContext _data { get; set; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public HomeController(IContext dataContext = null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _data = dataContext ?? new EFContext();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public ViewResult Index()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var items = _data.Foos&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Include(f =&amp;gt; f.FooBit)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .ToList();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return View(items);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;The nice thing here is we&amp;rsquo;ve been able to specify that we want to bring down information from the related entity FooBit. This means our view can show information from both the list of Foo objects and all the separate FooBits without creating a N+1 problem.&lt;/p&gt;
&lt;h3&gt;Unit testing our controller (EF Code First)&lt;/h3&gt;
&lt;p&gt;For this to work we need to a fake implementation of IDBSet. I&amp;rsquo;ve borrowed this &lt;a href="http://romiller.com/2010/09/07/ef-ctp4-tips-tricks-testing-with-fake-dbcontext/"&gt;one from Rowan Millar&lt;/a&gt;:&lt;/p&gt;
&lt;p class="code"&gt;public class FakeDbSet&amp;lt;T&amp;gt; : IDbSet&amp;lt;T&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where T : class&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; HashSet&amp;lt;T&amp;gt; _data;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IQueryable _query;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public FakeDbSet()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _data = new HashSet&amp;lt;T&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _query = _data.AsQueryable();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public virtual T Find(params object[] keyValues)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new NotImplementedException("Derive from FakeDbSet&amp;lt;T&amp;gt; and override Find");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Add(T item)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _data.Add(item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Remove(T item)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _data.Remove(item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Attach(T item)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _data.Add(item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Detach(T item)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _data.Remove(item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type IQueryable.ElementType&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _query.ElementType; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Linq.Expressions.Expression IQueryable.Expression&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _query.Expression; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IQueryProvider IQueryable.Provider&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _query.Provider; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _data.GetEnumerator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IEnumerator&amp;lt;T&amp;gt; IEnumerable&amp;lt;T&amp;gt;.GetEnumerator()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _data.GetEnumerator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;Now you&amp;rsquo;ve got a fake IDBSet you can create a simple test for our controller. I&amp;rsquo;ve used NUnit and Moq.&lt;/p&gt;
&lt;p class="code"&gt;[Test]&lt;br /&gt;public void IndexReturnsList()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create fake data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var inMemoryItems = new FakeDbSet&amp;lt;Foos&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Foo {Id = 1, Title = "One"},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Foo {Id = 2, Title = "Two"},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Foo {Id = 3, Title = "Three"},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Foo {Id = 4, Title = "Four"}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create mock unit of work&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var mockData = new Mock&amp;lt;IContext&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mockData.Setup(m =&amp;gt; m.Foos).Returns(inMemoryItems);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Setup controller&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var homeController = new HomeController(mockData.Object);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Invoke&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var viewResult = homeController.Index();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var foosFromView = (IEnumerable&amp;lt;Foo&amp;gt;)viewResult.Model;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Assert&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.NotNull(foosFromView);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.AreEqual(4, foosFromView.Count());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.AreEqual(1, foosFromView.First().Id);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;And there you have it. Everything is tested, and we didn&amp;rsquo;t need a repository.&lt;/p&gt;
&lt;h2 id="dbfirst"&gt;Using Database First in Entity Framework&lt;/h2&gt;
&lt;p&gt;My implementation of database first is based on this &lt;a href="Testability%20and%20Entity%20Framework%204%20http://msdn.microsoft.com/en-us/ff714955.aspx"&gt;article by Scott Allen&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;A mockable data context (EF Database First)&lt;/h3&gt;
&lt;p&gt;When you use the database first wizard the code generated for you is not so easy to mock. So you need to wrap it in a mockable wrapper. Here is an example:&lt;/p&gt;
&lt;p class="code"&gt;public interface IContext&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IObjectSet&amp;lt;Foo&amp;gt; Foos { get; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IObjectSet&amp;lt;Bar&amp;gt; Bars { get; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void SaveChanges();&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;Here is the wrapper implementation:&lt;/p&gt;
&lt;p class="code"&gt;public class EFContext : IContext&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private readonly EFEntities _data;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public EntityFrameworkUnitOfWork()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _data = new EFEntities();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IObjectSet&amp;lt;Foo&amp;gt; Foos&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _data.CreateObjectSet&amp;lt;Foo&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IObjectSet&amp;lt;Bar&amp;gt; Bars&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _data.CreateObjectSet&amp;lt;Bar&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void SaveChanges()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _data.SaveChanges();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;h3&gt;Using you mockable context in a controller (EF Database First)&lt;/h3&gt;
&lt;p&gt;This is exactly the same as with code first, but I've included it again for completeness. As I said before it's very easy. I&amp;rsquo;d recommend using a proper dependency injection framework like AutoFac, but in this example I&amp;rsquo;m going to use to use poor mans DI to keep it simple.&lt;/p&gt;
&lt;p class="code"&gt;public class HomeController&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private IContext _data { get; set; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public HomeController(IContext dataContext = null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _data = dataContext ?? new EFContext();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public ViewResult Index()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var items = _data.Foos&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Include(f =&amp;gt; f.FooBit)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .ToList();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return View(items);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;The nice thing here is we&amp;rsquo;ve been able to specify that we want to bring down information from the related entity FooBit. This means our view can show information from both the list of Foo objects and all the separate FooBits without creating a N+1 problem.&lt;/p&gt;
&lt;h3&gt;Unit testing our controller (EF Database First)&lt;/h3&gt;
&lt;p&gt;For this to work we need to a fake implementation of IObjectSet. I&amp;rsquo;ve borrowed this &lt;a href="http://msdn.microsoft.com/en-us/ff714955.aspx"&gt;one from Scott Allen&lt;/a&gt;:&lt;/p&gt;
&lt;p class="code"&gt;public class InMemoryObjectSet&amp;lt;T&amp;gt; : IObjectSet&amp;lt;T&amp;gt; where T : class&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public InMemoryObjectSet()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : this(Enumerable.Empty&amp;lt;T&amp;gt;())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public InMemoryObjectSet(IEnumerable&amp;lt;T&amp;gt; entities)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _set = new HashSet&amp;lt;T&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var entity in entities)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _set.Add(entity);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _queryableSet = _set.AsQueryable();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void AddObject(T entity)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _set.Add(entity);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Attach(T entity)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _set.Add(entity);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void DeleteObject(T entity)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _set.Remove(entity);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Detach(T entity)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _set.Remove(entity);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Type ElementType&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _queryableSet.ElementType; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Expression Expression&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _queryableSet.Expression; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IQueryProvider Provider&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _queryableSet.Provider; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IEnumerator&amp;lt;T&amp;gt; GetEnumerator()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _set.GetEnumerator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IEnumerator IEnumerable.GetEnumerator()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return GetEnumerator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; readonly HashSet&amp;lt;T&amp;gt; _set;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; readonly IQueryable&amp;lt;T&amp;gt; _queryableSet;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;Now you&amp;rsquo;ve got a fake IObjectSet&amp;nbsp; you can create a simple test for our controller. I&amp;rsquo;ve used NUnit and Moq.&lt;/p&gt;
&lt;p class="code"&gt;[Test]&lt;br /&gt;public void IndexReturnsList()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create fake data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var fooList = new List&amp;lt;Foo&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Foo {Id = 1, Name = "One"},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Foo {Id = 2, Name = "Two"},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Foo {Id = 3, Name = "Three"},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Foo {Id = 4, Name = "Four"}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var inMemoryItems = new InMemoryObjectSet&amp;lt;Foo&amp;gt;(fooList);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create mock unit of work&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var mockData = new Mock&amp;lt;IContext&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mockData.Setup(m =&amp;gt; m.Foos).Returns(inMemoryItems);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Test&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var homeController = new HomeController(mockData.Object);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Invoke&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var viewResult = homeController.Index();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var foosFromView = (IEnumerable&amp;lt;Foo&amp;gt;)viewResult.Model;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Assert&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.NotNull(foosFromView);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.AreEqual(4, foosFromView.Count());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.AreEqual(1, foosFromView.First().Id);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;And there you have it. Everything is tested, and we didn&amp;rsquo;t need a repository. It was a bit trickier with database first, but not much.&lt;/p&gt;
&lt;h2&gt;What about query logic?&lt;/h2&gt;
&lt;p&gt;Another reason to use a repository is to centralise your query logic that might be needed by various controllers. In my next post I will show you &lt;a href="/blog/extension-methods-filter-iqueryable"&gt;how to store your query logic in extension methods&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description><pubDate>Mon, 20 Feb 2012 09:40:51 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/mocking-entity-framework-data-context</guid></item><item><title>Bridge statistics, manga and SQL</title><link>http://www.nogginbox.co.uk:80/blog/bridge-statistics-manga-sql</link><description>&lt;p&gt;&lt;a href="http://www.amazon.co.uk/gp/product/1593271891/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=garsonix-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=1593271891"&gt;&lt;img src="/Media/Default/BlogPost/blog/manga-stats.jpg" alt="Book cover of Manga Guide to Statistics" height="396" width="300" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;After reviewing and enjoying &lt;a href="/blog/manga-relativity"&gt;The Manga Guide to Relativity&lt;/a&gt;, I was excited to be sent a copy of &lt;a href="http://www.amazon.co.uk/gp/product/1593271891/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=garsonix-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=1593271891"&gt;The Manga Guide to Statistics&lt;/a&gt; to review. It inspired me to look at statistics again. Perhaps they do have a point, perhaps with some interesting data and a computer doing the tedious number crunching the numbers will come to life. As I didn't really listen at school to this subject, I had a lot of catching up to do and this book was really going to have to grab my attention to convince me that statistic could be interesting.&lt;/p&gt;
&lt;p&gt;I enjoyed the Manga guide to Relativity so much that this book had a lot to live up to and initially I felt a bit let down. I think that has a lot to do with the subject matter. Statistics is just a subject that doesn't interest me as much as the fundamental wierdness of the universe. On my first attempt at reading The Manga Guide to Statistics, I treated it like a book. It's very heavy in numbers. I found that it was hard to follow and the facts did not stick in my head. But, it's not really a normal book. It's a text book and should be treated as such. That means you need to read a bit and then do some exercises that practice what you've learnt.&lt;/p&gt;
&lt;p&gt;When used like this the Manga Guide to Statistics is an excellent text book for someone trying to learn about stats. The story and illustrations keep you engaged and are an excellent starting point to apply the concepts to your own data. They also do a really good job of illustrating the concepts in a way that makes sense and gives you a mental model of what is being explained.&lt;/p&gt;
&lt;p&gt;While reading through the book I decided to apply my new stats knowledge to a data set that I've been working with a lot lately. &lt;a href="http://www.pianola.net/"&gt;Pianola&lt;/a&gt; is a web app for Bridge clubs. This means I have access to a lot of raw numbers about bridge and I decided that would be my data set. I also wanted to write a set of SQL scripts that would help me get the statistical data that I was interested in. SQL was the thing that was going to do the number crunching for me.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://chart.apis.google.com/chart?chxl=1:|1-5|6-10|11-15|16-20|21-25|26-30|31-35&amp;amp;chxp=1,1,3,5,7,9,11,13&amp;amp;chxr=0,0,80|1,0,14&amp;amp;chxs=0,676767,11.5,0,lt,676767|1,676767,11.5,0,lt,676767&amp;amp;chxtc=1,4&amp;amp;chxt=y,x&amp;amp;chbh=a&amp;amp;chs=550x300&amp;amp;cht=bvg&amp;amp;chco=A2C180&amp;amp;chds=0,80&amp;amp;chd=t:74.9,20.2,4,0.3,0.3,0.1,0.1&amp;amp;chdlp=l&amp;amp;chtt=Times+members+played+bridge+in+November&amp;amp;chts=8E8989,14.5" alt="Times members played bridge in November" height="300" width="550" /&gt;&lt;/p&gt;
&lt;p&gt;When I first started work on Pianola I was surprised at just how much people play bridge. The graph above is a &lt;strong&gt;histogram&lt;/strong&gt; that shows how often the people using Pianola played bridge at their bridge clubs in November.&lt;/p&gt;
&lt;p&gt;A histogram is a useful way of visualising a set of data. In this case I'm looking at how often people play bridge in a month. Rather than plot a bar for every different number of times someone has played bridge, I've grouped them up into &lt;strong&gt;classes&lt;/strong&gt; that group 5 numbers together.&lt;/p&gt;
&lt;p&gt;I could have plotted the number of people in each class. This would have been the frequency of that class. Instead I've plotted the &lt;strong&gt;relative frequency&lt;/strong&gt;, which is the percentage of that frequency in relation to the total frequency of all classes. Our total frequency is the total number of Pianola members who played bridge in November. 74% of our members' played bridge 1 to 5 times in November. A far smaller number, 0.4% played bridge 31 to 35 times in November. Some people are very keen, and our histogram shows this very clearly.&lt;/p&gt;
&lt;p&gt;Pianola keeps track of the games everyone plays, but to count the number of games everyone played and then to count the number of people who played a certain number of games took a bit of working out. &lt;em&gt;[Note: All the SQL in this post was written for MS SQL Server 2008 and may need tweaking to run on a different database.]&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;First I stored the number of times everyone has played in a temporary table:&lt;/p&gt;
&lt;p class="code"&gt;CREATE TABLE #PlayCounts(mId int, playCount int );&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;// Store start and end date in variables so we can easily change date range&lt;br /&gt;declare @startDate datetime, @endDate datetime&lt;br /&gt;set @startDate = '2011-11-01'&lt;br /&gt;set @endDate = '2011-11-30'&lt;br /&gt;&lt;br /&gt;INSERT INTO #PlayCounts(mId, playCount)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (SELECT MemberId mId, COUNT(MemberId) playCount&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM Game&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE [DateTime] BETWEEN @startDate AND @endDate&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GROUP BY MemberId);&lt;br /&gt;GO&lt;/p&gt;
&lt;p&gt;Now we have the number of times everyone has played we can count the number of members who have played a certain number of times. I wasn't sure if I could easily group the counts up into classes of values, but this funky SELECT CASE statement and this &lt;a href="http://stackoverflow.com/questions/232387/in-sql-how-can-you-group-by-in-ranges"&gt;Stackoverflow question on grouping by ranges in SQL&lt;/a&gt; came to my rescue.&lt;/p&gt;
&lt;p class="code"&gt;DECLARE @totalFrequency int;&lt;br /&gt;SET @totalFrequency = (SELECT COUNT(*) FROM #PlayCounts);&lt;br /&gt;&lt;br /&gt;SELECT t.range as [score range], COUNT(*) as frequency, (COUNT(*) / CONVERT(FLOAT, @totalFrequency))*100 as [relative frequency]&lt;br /&gt;FROM&lt;br /&gt;(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT CASE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN playCount BETWEEN 1 AND 5 THEN '1-5'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN playCount BETWEEN 6 AND 10 THEN '6-10'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN playCount BETWEEN 11 AND 15 THEN '11-15'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN playCount BETWEEN 16 AND 20 THEN '16-20'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN playCount BETWEEN 21 AND 25 THEN '21-25'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN playCount BETWEEN 26 AND 30 THEN '26-30'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN playCount BETWEEN 31 AND 35 THEN '31-35'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN playCount BETWEEN 36 AND 40 THEN '36-40'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE 'other' end as range&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM #PlayCounts&lt;br /&gt;)t&lt;br /&gt;GROUP BY t.range&lt;br /&gt;ORDER BY frequency DESC&lt;br /&gt;&lt;br /&gt;DROP TABLE #PlayCounts;&lt;/p&gt;
&lt;p&gt;In my select statement I've worked out both the frequency and the relative frequency of each class. I can easily re-run the query for different date ranges. It should also be pretty easy to take this SQL and rewrite it to look at different data sets.&lt;/p&gt;
&lt;p&gt;Next I read about the &lt;strong&gt;mean&lt;/strong&gt; and the &lt;strong&gt;median&lt;/strong&gt;. The mean is the more accurate term for what we mostly call the average and can be worked out in SQL really easily. The only slight complication is that we need to convert playCount to a float so that the AVG function returns a float and doesn't round the number to an integer.&lt;/p&gt;
&lt;p class="code"&gt;SELECT AVG(CONVERT(FLOAT, playCount)) AS Mean FROM #PlayCounts;&lt;/p&gt;
&lt;p&gt;The median is the frequency for the person in the middle if you order everyone by how often they play. There's no built in SQL command for this, but this &lt;a href="http://stackoverflow.com/a/2026609/31569"&gt;Stackoverflow answer for median SQL&lt;/a&gt; sorted me out.&lt;/p&gt;
&lt;p class="code"&gt;SELECT&lt;br /&gt; (&lt;br /&gt; (SELECT MAX(playCount) FROM&lt;br /&gt; (SELECT TOP 50 PERCENT playCount FROM #PlayCounts ORDER BY playCount) AS BottomHalf)&lt;br /&gt; +&lt;br /&gt; (SELECT MIN(playCount) FROM&lt;br /&gt; (SELECT TOP 50 PERCENT playCount FROM #PlayCounts ORDER BY playCount DESC) AS TopHalf)&lt;br /&gt;) / 2 AS Median;&lt;/p&gt;
&lt;p&gt;For our bridge dataset the mean number of times someone played in a month was 4.22, and the median was 3. The median value can give you a more accurate view of the behaviour of most people. If one person played bridge 120 times a month they could skew the mean and give a false impression. In our case the two values are quite close.&lt;/p&gt;
&lt;p&gt;This is all quite basic statistics. So basic I actually remember most of it from school, but The Manga guide provides a good reminder in the first two chapters. One last thing from those chapters is standard deviation, which is starting to get a bit more advanced. &lt;strong&gt;Standard deviation&lt;/strong&gt; describes how scattered the data is. The more data varies from the mean, the higher the standard deviation.&lt;/p&gt;
&lt;p&gt;Here is the very easy SQL to work it out:&lt;/p&gt;
&lt;p class="code"&gt;SELECT STDEV(playCount) AS [Standard deviation] FROM #PlayCounts;&lt;/p&gt;
&lt;p&gt;The standard deviation for our set is 3.41. I think this is quite low.&lt;/p&gt;
&lt;p&gt;That's as far as I've got so far and I wouldn't want to spoil the whole book for you. The joy in it for me has been thinking of places in my projects I could use the statistical methods I've learnt about. The histogram alone is a really nice device that jumped out at me as something that would be useful to the projects I'm working on. So, if you think that you could do with improving your statistics then this is a great book to work through, particularly if you have a dataset that you'd like to work with and make more sense of.&lt;/p&gt;
&lt;p&gt;However, if you really want to be inspired about how great statistics are then you really should watch the video of this &lt;a href="http://vimeo.com/6261630"&gt;presentation by Hans Rosling&lt;/a&gt;. I saw it at Thinking Digital in 2009 and was blown away by his enthusiasm.&lt;/p&gt;</description><pubDate>Mon, 16 Jan 2012 16:32:50 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/bridge-statistics-manga-sql</guid></item><item><title>The Manga Guide to Relativity</title><link>http://www.nogginbox.co.uk:80/blog/manga-relativity</link><description>&lt;p&gt;&lt;a href="http://www.amazon.co.uk/gp/product/1593272723/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=garsonix-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=1593272723"&gt;&lt;img src="/Media/Default/BlogPost/blog/manga-relativity.jpg" alt="The Manga Guide to Relativity" height="397" width="300" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I knew I had a sort of idea what relativity was, but I also knew I didn't actually understand it. I thought it was probably one of the things that I would never get round to understanding. Then I was presented with &lt;a href="http://www.amazon.co.uk/gp/product/1593272723/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=garsonix-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=1593272723"&gt;The Manga Guide to Relativity&lt;/a&gt;, and I knew that if anything could explain it, then this book would be that thing.&lt;/p&gt;
&lt;p&gt;The guide starts in manga form and tells the story of Student Body President Ruka Minagi who is challenged by Headmaster Iyagi to write a report on relativity over the summer vacation. The beautiful physics teacher Alisa Uraga steps in to teach Minagi all he needs to know to complete the report.&lt;/p&gt;
&lt;p&gt;The scenes in the story change seamlessly and often surreally between the classroom and the setting of the examples used to explain the various facets of relativity. Alisa Uraga chooses to explain some of the complicated elements of relativity at the swimming pool while wearing a bikini and other parts while they both float in space. Other characters like Einstein and the Vice Principal who is a dog also step in at times to say hello.&lt;/p&gt;
&lt;p&gt;Following a discussion between two characters is actually quite an effective way to learn about a complicated topic. The sections are punctuated by more traditional text book like pages that talk you through the equations and examples in more depth.&lt;/p&gt;
&lt;p&gt;The events in the manga that carry the story forward are often bizarre and surreal, but not as surreal as the theory of relativity itself. After reading this book I still wouldn&amp;rsquo;t pretend to fully understand it, but what I do think I get completely blows my mind.&lt;/p&gt;
&lt;p&gt;The example that really blew me away was this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;If astronauts travel to the Andromeda galaxy (approximately 2,500,000 light years away) at 99.999999999 percent of the speed of light, 11.2 years will pass for the one-way trip in the space ship, but nearly 2,500,000 years will pass on earth.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now that is more bizarre than a school having a dog as a Vice Principal. I&amp;rsquo;m not going to try and explain it, but time is not the same for everyone. It depends on how fast you&amp;rsquo;re going and also on gravity. You don&amp;rsquo;t need to travel faster than the speed of light because as you approach the speed of light distances get shorter and your time slows down. If I understand this correctly the human race could scatter itself through the universe using close to light speed ships. The only thing is that we would also have scattered ourselves through time. You can&amp;rsquo;t travel huge distances through space without also effectively travelling a huge amount forward in time. That&amp;rsquo;s not how it worked in Star Trek.&lt;/p&gt;
&lt;p&gt;If you want to have a go at understanding relativity then I think this book is an excellent way to do so. If you really want to understand it, you might need to read it more than once. Relativity is a strange and wonderfully weird thing.&lt;/p&gt;</description><pubDate>Sat, 14 Jan 2012 16:00:49 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/manga-relativity</guid></item><item><title>Moving from Subversion to Mercurial and Bitbucket</title><link>http://www.nogginbox.co.uk:80/blog/subversion-mercurial-bitbucket</link><description>&lt;p&gt;I've been using &lt;a href="http://mercurial.selenic.com/"&gt;Mercurial&lt;/a&gt; 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 &lt;a href="https://bitbucket.org/"&gt;Bitbucket&lt;/a&gt;'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.&lt;/p&gt;
&lt;p&gt;I've wanted to move my existing subversion projects over to Bitbucket, but I thought that keeping the revision history would be too difficult. Turns out that it was really simple.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Step 1: Enable &lt;a href="http://mercurial.selenic.com/wiki/ConvertExtension"&gt;hg convert&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;Assuming you've already installed mercurial command line or as I prefer &lt;a href="http://tortoisehg.bitbucket.org/"&gt;Tortoise HG GUI&lt;/a&gt; on your computer you can enable this extension by finding mercurial.ini in your user directory and adding the following lines:&lt;br /&gt;&lt;span class="code"&gt;[extensions]&lt;br /&gt;hgext.convert =&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 2: Create a new mercurial repository in bitbucket&lt;/strong&gt;&lt;br /&gt;Use bitbucket's web interface to create a new repository.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 3: Clone this locally on your machine&lt;/strong&gt;&lt;br /&gt;Use either tortoise or the command line to clone this empty repository:&lt;br /&gt; &lt;span class="code"&gt;hg clone https://{bitbucket-username}@bitbucket.org/{bitbucket-username}/{bitbucket-repository-name} {local-directory-name}&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 4: Get revisions from your subversion repository&lt;/strong&gt;&lt;br /&gt;Use the command line to use the convert extension, then update your local copy:&lt;br /&gt;&lt;span class="code"&gt;hg convert {svn-repository} {local-directory-name}&lt;br /&gt;cd {local-directory-name}&lt;br /&gt;hg update&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 5: Push all these revisions to your bitbucket repository&lt;/strong&gt;&lt;br /&gt;&lt;span class="code"&gt;hg push&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 6: Set up aliases&lt;/strong&gt;&lt;br /&gt;The usernames used by Mercurial and Bitbucket will not match those imported from Subversion. The easiest way to fix this is using aliases in bitbucket. On the commits screen any unknown user has a little question mark by it. Clicking on that lets you alias that username to a Bitbucket user.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That's it.&lt;/p&gt;
&lt;p&gt;The hg convert command can do fancier stuff, like renaming branches and changing usernames, but I've found that I don't really need that.&lt;/p&gt;</description><pubDate>Thu, 12 Jan 2012 20:50:56 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/subversion-mercurial-bitbucket</guid></item><item><title>Movember at Old Broadcasting House</title><link>http://www.nogginbox.co.uk:80/blog/movember-obh</link><description>&lt;p&gt;&lt;img src="/Media/Default/BlogPost/blog/Movember.jpg" alt="Photo of the Movember Boys" width="550" height="354" /&gt;&lt;/p&gt;
&lt;p&gt;November has been Movember for some of us at Old Broadcasting House.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;You can donate to any of us or the team at our Movember pages (in order of photo appearance):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://uk.movember.com/mospace/1963796/"&gt;Leo (fantastic tache) Fowler&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://uk.movember.com/mospace/2130500/"&gt;Chris (killer whiskers) Kenworthy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mobro.co/NogginTache"&gt;Richard (gringo) Garside&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="small"&gt;&lt;em&gt;Cactus photo by: &lt;a href="http://www.flickr.com/photos/cogdog/4209441149/"&gt;Alan Levine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;</description><pubDate>Tue, 29 Nov 2011 23:53:17 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/movember-obh</guid></item><item><title>A .NET MVC Helper to create HTML wrapping elements</title><link>http://www.nogginbox.co.uk:80/blog/mvc-html-wrapper-helper</link><description>&lt;p&gt;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 &amp;lt;div&amp;gt; or a &amp;lt;section&amp;gt; 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 has a title, sometimes it doesn't.&lt;/p&gt;
&lt;p&gt;Really any repeated code like this should be in some sport of template or helper, to keep the code clean and make it easy to change in the future. But, as there was opening code and closing code there would need to be two templates and this seemed messy. Inspired by how .NET MVC writes the opening and closing tags for forms on the page I thought that using the using statement and a chunk class that implemented IDisposable might be the way to go.&lt;/p&gt;
&lt;h2&gt;The razor code&lt;/h2&gt;
&lt;p&gt;The aim was to have razor code in my view that looked like this:&lt;/p&gt;
&lt;p class="code"&gt;@using(Html.BeginChunk("Optional chunk title"))&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;p&amp;gt;Normal HTML content.&amp;lt;/p&amp;gt;&lt;br /&gt;}&lt;/p&gt;
&lt;h2&gt;The BeginChunk helper&lt;/h2&gt;
&lt;p&gt;The BeginChunk helper returns an IDisposable class whose Dispose method is called when the closing brace is reached. The helper code looks like this:&lt;/p&gt;
&lt;p class="code"&gt;using System;&lt;br /&gt;using System.Web.Mvc;&lt;br /&gt;&lt;br /&gt;namespace NogginBox.MVC.Extensions.Helpers&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static class ChunkHelpers&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static Chunk BeginChunk(this HtmlHelper html, String title = null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var htmlText = (title != null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ? "&amp;lt;div class=\"chunk\"&amp;gt;&amp;lt;h2&amp;gt;" + title + "&amp;lt;/h2&amp;gt;&amp;lt;div class=\"chunk-inner\"&amp;gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : "&amp;lt;div class=\"chunk\"&amp;gt;&amp;lt;div class=\"chunk-inner\"&amp;gt;";&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html.ViewContext.Writer.Write(htmlText);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new Chunk(html);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void EndChunk(this HtmlHelper html)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html.ViewContext.Writer.Write("&amp;lt;/div&amp;gt;&amp;lt;div class=\"chunk-bottom\"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;h2&gt;The Chunk class&lt;/h2&gt;
&lt;p&gt;The actual chunk class is very simple. The helper does most of the work. The chunk class looks like this:&lt;/p&gt;
&lt;p class="code"&gt;using System;&lt;br /&gt;using System.Web.Mvc;&lt;br /&gt;&lt;br /&gt;namespace Pianola.MVC.Extensions.Helpers&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class Chunk : IDisposable&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private readonly HtmlHelper _html;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Chunk(HtmlHelper html)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _html = html;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Dispose()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _html.EndChunk();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;And that's it. Using this helper has resulted in my views being much cleaner and far easier to modify.&lt;/p&gt;</description><pubDate>Tue, 29 Nov 2011 23:33:42 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/mvc-html-wrapper-helper</guid></item><item><title>Developing for the iPhone - what you need to know</title><link>http://www.nogginbox.co.uk:80/blog/developing-for-the-iphone-what-you-need-to-know</link><description>&lt;p&gt;&lt;img src="/Media/Default/BlogPost/blog/iPhone-dev.jpg" alt="Picture of iPod touch with tools" height="297" width="400" /&gt;&lt;/p&gt;
&lt;p&gt;They say the future is mobile. &lt;em&gt;(Ed. Two years on since originally writing this post, it almost seems like the future is here. We might have all missed the App Store gold rush, but app development for mobile is still exciting and now there's Android, Windows Phone 7 and iPads to think about.)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So, I'm quite excited to learn about developing for this new platform and see what I can create. Will I be able to use my existing web development and programming skills, or will I need to learn a new set of skills. This is what I've learnt so far about what I'll need to know.&lt;/p&gt;
&lt;p&gt;There are two options when developing for the iPhone (or iPod touch): Develop a web application or develop a native iPhone application. There are plusses and minuses for both, and both require a completely different set of skills. Until recently you could only develop web applications, but Apple has recently released a beta of the iPhone SDK building up towards the planned opening of the iPhone App Store.&lt;/p&gt;
&lt;h3&gt;Developing a web based iPhone application&lt;/h3&gt;
&lt;p&gt;If you're a web developer like me, then this is going to be the easiest and possibly best option. You can use your existing web development skills and you can host your application on your current server.&lt;/p&gt;
&lt;p&gt;I bought myself an iPod touch using the excuse that it would help me test websites on the iPhone. They're the same except the iPod touch doesn't have all the applications the iPhone does (most notably, and understandably the phone application). However, I've discovered that you don't even need an iPod touch. The iPhone Software Development Kit (SDK) includes an iPhone simulator. You will need a Mac though to run the SDK.&lt;/p&gt;
&lt;p&gt;If you have an existing web application, it will probably already work on the iPhone, unless it uses Flash or a few other non-supported technologies. There are several things you could do to make it work better on an iPhone, some of these things will be helpful for other mobile devices.&lt;/p&gt;
&lt;p&gt;You can add an iPhone, or small screen specific style sheet. This will allow you to lay things out better for the available screen size. You may also wish to take advantage of some Safari and iPhone specific CSS. For example there's CSS support for simple animation and transitions.&lt;/p&gt;
&lt;p&gt;You may wish to detect that the browser is on an iPhone and serve them a specialised version. Facebook is an excellent example of this and creates an experience that is very similar to using a native iPhone application.&lt;/p&gt;
&lt;p&gt;You can make use of iPhone JavaScript handlers that respond to touch gestures. The touch interface is one of the things that makes the iPhone shine, so it'd be great to take advantage of this in your web apps.&lt;/p&gt;
&lt;p&gt;There are also some custom meta tags which allow you to control the screen area and whether the user can zoom. You can also add custom links that will launch other iPhone applications. You can even store data in a client side SQLite database, which is apparently part of the HTML 5 spec.&lt;/p&gt;
&lt;p&gt;There's a lot you can do and that just scratches the surface. Using and building upon you existing HTML, CSS and JavaScript knowledge you could make something very exciting.&lt;/p&gt;
&lt;p&gt;Now that all sounds great, but there are limitations with an iPhone web app. Firstly it's not going to work when the user is offline, and it's going to be slow when their connection is slow. You're also not going to be able to access all of the features of the device such as its location awareness, orientation awareness or be able to access things like the address book. If you want to make use of all the power and all the features then you're going to have to make a fully native iPhone application.&lt;/p&gt;
&lt;h3&gt;Developing a native iPhone application&lt;/h3&gt;
&lt;p&gt;If you've previously developed software for Apple Macs then you're probably going to find you can quite easily turn those skills to iPhone development. If you haven't then there's a lot your going to need to learn. It's aimed at software developers, rather than web developers and the skills needed are very different.&lt;/p&gt;
&lt;p&gt;Before you begin there are a few things you will need. You'll need a Mac, you'll need to download the iPhone Software Development Kit (SDK) and it'd help for testing if you had a iPhone or an iPod touch (this last bit isn't essential as there is a simulator).&lt;/p&gt;
&lt;p&gt;The SDK includes all the tools you'll need to develop iPhone applications. These tools include an interface designer, a code editor, profiling tools and an iPhone simulator. They're completely free, but there is an option to join the iPhone Developer Program. This costs $99. As far as I can tell, you need to join this if you wish to share your applications with anyone. Otherwise you can only install your programs on one designated test iPhone. I've also read in forums that the Developer Program is so popular that Apple are putting everyone on a waiting list. I thought I'd wait till I created a program worth sharing before I joined the program. There's a lot to learn before I can even think about doing this.&lt;/p&gt;
&lt;p&gt;If you've not done Mac development before, the first you'll need to learn is the programming language Objective C. Knowing PHP and JavaScript, probably isn't going to help you that much, although it'd be a start. It's most similar to C and C++, although knowing something like Java, Ruby on Rails, or ASP.NET would also be helpful. Although I've used C++ in the past and currently use ASP.NET, I've found Objective C too different to be able to pick up from code samples. I'm currently reading Apple's reference guide to it and I've been reccommended the book &lt;a href="http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.co.uk%2Fdp%2F0672325861%2F&amp;amp;tag=garsonix-21&amp;amp;linkCode=ur2&amp;amp;camp=1634&amp;amp;creative=6738"&gt;Programming in Objective C&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You'll also need a good understanding of object orientated programming. If you've used Ruby on Rails, you'll be pleased to know that they seem to make heavy use of the Model View Controller architecture that Rails is built on.&lt;/p&gt;
&lt;p&gt;All the actual fun stuff seems to be contained in the various frameworks that provide the iPhone functions and features that your application can use. I've not had time to explore this fully as learning Objective C has slowed me down a bit. These frameworks seem to be the Foundation Framework, UIKit and the Cocoa Touch Framework. You'll need to understand the basics of these frameworks so you can start making use of the functions they provide.&lt;/p&gt;
&lt;p&gt;Once you've got your head round Objective C you can start looking through all the code examples they've got. It's probably a good way to start understanding how all the framework features work.&lt;/p&gt;
&lt;p&gt;If you want to find out more, the iPhone Dev Centre has load of videos, reference material and code samples to work through:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://developer.apple.com/iphone/"&gt;iPhone Dev centre for Native Applications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.apple.com/webapps/"&gt;iPhone Dev Centre for Web Apps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><pubDate>Fri, 25 Nov 2011 15:20:11 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/developing-for-the-iphone-what-you-need-to-know</guid></item><item><title>Pianola in Toronto</title><link>http://www.nogginbox.co.uk:80/blog/pianola-in-toronto</link><description>&lt;p&gt;&lt;img src="/Media/Default/BlogPost/blog/cntower.jpg" alt="Toronto" height="500" width="299" /&gt;&lt;/p&gt;
&lt;p&gt;Since December last year I&amp;rsquo;ve been the lead developer in a start-up making a product called &lt;a href="http://www.pianola.net"&gt;Pianola&lt;/a&gt;. 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&amp;rsquo;m in Toronto at the North American Bridge Championships demoing &lt;a href="http://www.pianola.net"&gt;Pianola&lt;/a&gt; to club managers and members from across the pond.&lt;/p&gt;
&lt;p&gt;This has been my first business trip abroad and Toronto is an amazing city. The first thing I&amp;rsquo;ve learnt is that when travelling for business and when carrying a lot of extra baggage with things like exhibition stands and flyers, be prepared to be grilled intensely about what you&amp;rsquo;re doing. You should also check to see if you need any permits. Even if you don&amp;rsquo;t, you should be able to say confidently to the immigration and customs people that you researched this. You should also know exactly where you are exhibiting and have a business card or flyer for the product you&amp;rsquo;re showing. Business card stickers do not go down too well in a serious border crossing situation.&lt;/p&gt;
&lt;p&gt;We did get through though; it just made us a little bit nervous. Also if you can avoid changing at an airport than makes you recheck in your bags like New York JFK then that will save you going through two lots of customs. Actually, if you can, avoid JFK. It&amp;rsquo;s a very scary airport.&lt;/p&gt;
&lt;p&gt;Our first day of demos was a pretty intense day. We&amp;rsquo;d done most of our setup the day before, but got in at 9:30am to finish things before the tournament competitors arrived at 10am. Things didn&amp;rsquo;t finish till 7:30pm so it was a very long day. I took a lunch break, but James, the CEO of Pianola stayed there the whole time.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m not a natural sales man and I think I&amp;rsquo;ve got a lot to learn about letting people know what the benefits of Pianola are for them. However I've been getting better at it. It helps that everyone here is really friendly and people like what we&amp;rsquo;ve done. We've got a really good spot on the corner where everyone can see us. Now that we've been here for a while more and more people are coming to us rather than us having to try and get their attention.&lt;/p&gt;
&lt;p&gt;I was also very excited to find out that Bill Gates plays bridge and sometimes comes to this championship. I've not seen him yet, but I've met someone who's played with him. Seeing him would make my trip, but failing that I'm just pleased that so many people have liked what we've done.&lt;/p&gt;
&lt;p&gt;You can see my &lt;a href="http://www.flickr.com/photos/richard-g/sets/72157627247258450"&gt;photos of Toronto&lt;/a&gt; here, and follow what Pianola is up to on the &lt;a href="http://blog.pianola.net/"&gt;Pianola blog&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Fri, 14 Oct 2011 21:38:58 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/pianola-in-toronto</guid></item><item><title>MailChimp Orchard Module and the Integration Fund</title><link>http://www.nogginbox.co.uk:80/blog/mailchimp-orchard-module</link><description>&lt;p&gt;Back in November 2010 MailChimp announced their &lt;a href="http://blog.mailchimp.com/mailchimp-launches-1-million-integration-fund/"&gt;One Million Integration Fund&lt;/a&gt;. 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 &lt;a href="http://www.pianola.net/"&gt;Pianola&lt;/a&gt;, but we both loved MailChimp and thought it could be something that would help us out.&lt;/p&gt;
&lt;p&gt;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&amp;rsquo;s email addresses so we could let them know how we were getting on.&lt;/p&gt;
&lt;p&gt;So, it made sense to apply to the fund, cross our fingers and hope for the best. We did, and were surprised to find that we&amp;rsquo;d been successful. Unfortunately we didn&amp;rsquo;t get the whole million, but we did get enough to cover development of the module.&lt;/p&gt;
&lt;p&gt;So I created a module for Orchard that will let your visitors subscribe to your MailChimp email list, letting you keep them up to date with all your exciting news. I actually finished the module quite a while ago, but I&amp;rsquo;ve been so busy with Pianola, that I&amp;rsquo;ve not had a chance to blog about it, or even install the module on my own blog.&lt;/p&gt;
&lt;p&gt;So, if you would like to be kept up to date with all Noggin Box news then please do &lt;a href="/subscribe"&gt;subscribe to my mailing list&lt;/a&gt;. You can get the &lt;a href="http://www.orchardproject.net/gallery/List/Modules/Orchard.Module.NogginBox.MailChimp"&gt;MailChimp Orchard module&lt;/a&gt; here.&lt;/p&gt;
&lt;p&gt;As MailChimp didn&amp;rsquo;t give us the whole million and they&amp;rsquo;ve shared it about a bit they&amp;rsquo;ve been able to encourage other integrations and you can find them in the &lt;a href="http://connect.mailchimp.com/category/cms"&gt;MailChimp Integrations Directory&lt;/a&gt;. If you have any great ideas for using their API, I think they still have some of the million left.&lt;/p&gt;</description><pubDate>Fri, 14 Oct 2011 21:38:39 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/mailchimp-orchard-module</guid></item><item><title>Stickers are the new business cards</title><link>http://www.nogginbox.co.uk:80/blog/stickers-are-the-new-business-cards</link><description>&lt;p&gt;&lt;img src="/Media/Default/BlogPost/blog/stickers.jpg" alt="NogginBox stickers" width="300" height="500" /&gt;When I first went freelance and needed to meet people, I found that business cards were a staple of the networking world. I knew that I needed some, but as a new face on the networking scene I wanted mine to stand out. I came up with the idea of &lt;a href="/blog/origami-business"&gt;origami business cards&lt;/a&gt;. These have served me well over the last four years and definitely made me stand out, although they didn't always fit in people's wallets.&lt;/p&gt;
&lt;p&gt;I fancied a change and also wanted a business card that would fit with the new design of my blog. One problem I've discovered with traditional business cards is that there's nothing obvious to do with one after you're given it. All the ones I've collected are in a drawer. If you're given a sticker, it's obvious what you should do with it. You should stick it on something (like a note book), which is what I'm hoping people will do.&lt;/p&gt;
&lt;p&gt;Since I collected my stickers from the &lt;a href="http://www.awesomemerchandise.com/stickers-c-162.html"&gt;printers&lt;/a&gt; I have become a little obsessed with sticking them on everything I own. It turns out I've never really grown out of stickers. I'm hoping that the people I meet haven't either. If you'd like a sticker then come and find me or get in touch through &lt;a href="http://twitter.com/_richardg"&gt;twitter&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Sun, 12 Jun 2011 11:07:39 GMT</pubDate><guid isPermaLink="true">http://www.nogginbox.co.uk:80/blog/stickers-are-the-new-business-cards</guid></item></channel></rss>
