<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>

  var _gaq = _gaq || [];
  _gaq.push([‘_setAccount’, ‘UA-24538377-1’]);
  _gaq.push([‘_trackPageview’]);

  (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
  })();</description><title>Notes from a .NET and ruby/rails dev obsessive</title><generator>Tumblr (3.0; @mr-dev)</generator><link>http://mr-dev.tumblr.com/</link><item><title>My new blog</title><description>&lt;a href="http://www.matt-roberts.me"&gt;My new blog&lt;/a&gt;: &lt;p&gt;I’m just not cool enough for tumblr, so I finally got around to sorting out a “proper developer” blog hosted on github using the amazingly effective jekyll (&lt;a href="http://jekyllbootstrap.com/"&gt;&lt;a href="http://jekyllbootstrap.com/"&gt;http://jekyllbootstrap.com/&lt;/a&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Hope to see you there!&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/20108882693</link><guid>http://mr-dev.tumblr.com/post/20108882693</guid><pubDate>Thu, 29 Mar 2012 08:45:11 +0100</pubDate></item><item><title>Formatting those sql_exec profiler outputs..</title><description>&lt;p&gt;I was debugging some long running queries the other day, using SQL Server profiler (BTW - here is a very decent free equivalent of this for those of you using SQL Express - which doesn&amp;#8217;t come with the profiler: &lt;a href="https://sites.google.com/site/sqlprofiler/" title="https://sites.google.com/site/sqlprofiler/"&gt;&lt;a href="https://sites.google.com/site/sqlprofiler/"&gt;https://sites.google.com/site/sqlprofiler/&lt;/a&gt;&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Anyhoo, one thing that has always been a pain for me is that the output you get from a sql_exec command - which is how most ORMs execute SQL against the database. Take this example command:&lt;/p&gt;
&lt;pre class="brush:sql; gutter:false; toolbar:false"&gt;exec sp_executesql N'SELECT [t1].[CableSweepChangeId], [t1].[FrontEndId], [t1].[FrontEndPortNum], [t1].[IncomingTime], [t1].[Description], [t1].[ChangePoint], [t1].[OldLength], [t1].[NewLength], [t1].[EquipmentId], [t1].[DataLinkStateChange], [t1].[IsLink], [t1].[IsConnection], [t1].[IsLaptopChange], [t1].[EquipmentPortNum], [t1].[EquipmentName], [t1].[CableId], [t1].[CableLabel], [t1].[InstallType], [t1].[ConnectionSide]
FROM (
    SELECT ROW_NUMBER() OVER (ORDER BY [t0].[IncomingTime] DESC) AS [ROW_NUMBER], [t0].[CableSweepChangeId], [t0].[FrontEndId], [t0].[FrontEndPortNum], [t0].[IncomingTime], [t0].[Description], [t0].[ChangePoint], [t0].[OldLength], [t0].[NewLength], [t0].[EquipmentId], [t0].[DataLinkStateChange], [t0].[IsLink], [t0].[IsConnection], [t0].[IsLaptopChange], [t0].[EquipmentPortNum], [t0].[EquipmentName], [t0].[CableId], [t0].[CableLabel], [t0].[InstallType], [t0].[ConnectionSide]
    FROM [CableChangeDetail] AS [t0]
    ) AS [t1]
WHERE [t1].[ROW_NUMBER] BETWEEN @p0 + 1 AND @p0 + @p1
ORDER BY [t1].[ROW_NUMBER]',N'@p0 int,@p1 int',@p0=0,@p1=15
&lt;/pre&gt;
&lt;p&gt;Now, if I want to tweak this or play around with it, it&amp;#8217;s not much fun having it in this format.. I would prefer it in a format with all those params as DECLARE statements at the top. Which is why I wrote, and present to you now&amp;#8230;.. SQLEXEC FORMATTER!!!&lt;/p&gt;
&lt;h2&gt;&lt;a href="http://execsqlformat.com" title="http://execsqlformat.com"&gt;&lt;a href="http://execsqlformat.com"&gt;http://execsqlformat.com&lt;/a&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;And here it is in action.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://dl.dropbox.com/u/292924/blog/execsqlformat.PNG"/&gt;&lt;/p&gt;
&lt;p&gt;At the moment the copy to clipboard button is a bit bad at formatting the text, but I&amp;#8217;ll sort that one day, and you can always just copy the text manually.&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/17553961535</link><guid>http://mr-dev.tumblr.com/post/17553961535</guid><pubDate>Mon, 13 Feb 2012 16:00:05 +0000</pubDate></item><item><title>Test post from live writer…</title><description>&lt;p&gt;Well this is a very dull post, I’m simply trying to post to &lt;strong&gt;tumblr&lt;/strong&gt; from live writer. That is all.&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/16753774018</link><guid>http://mr-dev.tumblr.com/post/16753774018</guid><pubDate>Mon, 30 Jan 2012 08:57:09 +0000</pubDate></item><item><title>WCF and netTcpBindings</title><description>&lt;p&gt;Is it just me that hates the way that WCF seems to break if you just look at the config file the wrong way? &lt;/p&gt;
&lt;p&gt;Anyway, after spending a couple of hours fighting with WCF trying to get it to work with netTcpBindings, I thought i&amp;#8217;d share this blog post with some tips on what to check:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://goneale.com/2010/04/01/error-connecting-to-was-enabled-net-tcp-wcf-service-hosted-through-iis/"&gt;&lt;a href="http://goneale.com/2010/04/01/error-connecting-to-was-enabled-net-tcp-wcf-service-hosted-through-iis/"&gt;http://goneale.com/2010/04/01/error-connecting-to-was-enabled-net-tcp-wcf-service-hosted-through-iis/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#8217;d pretty much done everything in this list except enable &amp;#8221; &lt;strong&gt;Windows Communication Foundation Non-HTTP Activation&lt;/strong&gt; &amp;#8221; in windows features. After I found that and enabled it, and then fixed the port bindings (it will revert your tcp port bindings back to the default of 808), all was working well for me in WCF land once more. Hooray.&lt;/p&gt;
&lt;p&gt;PS: If you do tick the non-http activation, and you already have .net 4 installed on your system, and you need to make use of the wcf from a web application using .net 4, then you&amp;#8217;re going to hit some more problems and you&amp;#8217;ll need to re-register .net 4 with iis - see &lt;a href="http://blogs.iis.net/webtopics/archive/2010/04/28/system-typeloadexception-for-system-servicemodel-activation-httpmodule-in-asp-net-4.aspx"&gt;&lt;a href="http://blogs.iis.net/webtopics/archive/2010/04/28/system-typeloadexception-for-system-servicemodel-activation-httpmodule-in-asp-net-4.aspx"&gt;http://blogs.iis.net/webtopics/archive/2010/04/28/system-typeloadexception-for-system-servicemodel-activation-httpmodule-in-asp-net-4.aspx&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/15560642122</link><guid>http://mr-dev.tumblr.com/post/15560642122</guid><pubDate>Mon, 09 Jan 2012 09:11:00 +0000</pubDate></item><item><title>Keep your code simple!</title><description>&lt;a href="http://daniellang.net/keep-your-code-simple/"&gt;Keep your code simple!&lt;/a&gt;: &lt;p&gt;I found this post really refreshing, since I’ve been guilty of blindly following what is deemed to be best practice without fully understanding why I was doing it. Well worth a read.&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/12256079396</link><guid>http://mr-dev.tumblr.com/post/12256079396</guid><pubDate>Wed, 02 Nov 2011 21:54:29 +0000</pubDate></item><item><title>Postcod.es - Get your postcode from a lat/lon</title><description>&lt;a href="http://postcod.es"&gt;Postcod.es - Get your postcode from a lat/lon&lt;/a&gt;: &lt;p&gt;Something I’ve been playing with and decided to release into the wild - this little site and API attempts to give you a postcode from a lat/lon location. The geo-location side of it can be a little off, since it all depends what you’re using to access the site.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lsdw5xJexc1qgzw8y.png"/&gt;&lt;/p&gt;
&lt;p&gt;It was fun to create technically, I used node.js with &lt;a title="Express" href="http://expressjs.com/"&gt;Express&lt;/a&gt; (although in hindsight Express was overkill), and I store all the UK postcodes with their lat/lon location in a hosted mongoDB database (with &lt;a title="MongoHQ" href="https://mongohq.com/home"&gt;MongoHQ&lt;/a&gt;). MongoDB has some handy  &lt;a href="http://www.mongodb.org/display/DOCS/Geospatial+Indexing"&gt;Geospatial features&lt;/a&gt; that made this all a doddle.&lt;/p&gt;
&lt;p&gt;Hopefully it’s useful to someone out there! &lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/10884350137</link><guid>http://mr-dev.tumblr.com/post/10884350137</guid><pubDate>Sat, 01 Oct 2011 12:02:00 +0100</pubDate></item><item><title>Zombies Oh My Zsh!</title><description>&lt;p&gt;I was at Preston Geekup &lt;strike&gt;last night&lt;/strike&gt; last week and came across a very nice looking terminal on &lt;a title="Martin Rue's" href="http://twitter.com/#!/@martinrue"&gt;Martin Rue&amp;#8217;s&lt;/a&gt; mac. Turns out he was running zsh, and &amp;#8220;&lt;a title="Oh My Zsh" href="https://github.com/robbyrussell/oh-my-zsh"&gt;oh my zsh&lt;/a&gt;&amp;#8221; for additional functionality and themes. &lt;/p&gt;
&lt;p&gt;I decided to check it out, and now I&amp;#8217;m totally hooked on zsh, theres no going back to bash for me. As a total scripting n00b, I can&amp;#8217;t comment on how well it does or doesn&amp;#8217;t make scripting easy, but I can comment on the nice looking interface you get with the combo of zsh and oh my zsh:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lq1eu23HXQ1qgzw8y.png"/&gt;&lt;/p&gt;
&lt;p&gt;Pretty nice right? As well as the multi-coloured prompt, it&amp;#8217;s telling me that I&amp;#8217;m using git in the current folder, and that I&amp;#8217;m on the master branch. Nice! That all comes from the oh-my-zsh project. As for zsh itself, so far I can say I&amp;#8217;m loving:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;That tab-complete lists commands not only in the current folder (e.g. mv&amp;lt;tab&amp;gt; would bring up mvim)&lt;/li&gt;
&lt;li&gt;That it tries to correct my many spelling mistakes (type lls, it asks if you meant ls. Type sl, it just does an ls anyway!)&lt;/li&gt;
&lt;li&gt;Secondary tab completion (Type brew install &amp;lt;tab&amp;gt;, it will list all avail brew tools, and you can even scroll through them all - sweeeet!)&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;That&amp;#8217;s all I&amp;#8217;ve discovered now, I&amp;#8217;m sure they&amp;#8217;ll be loads more. &lt;/p&gt;
&lt;p&gt;Now, back to the day job, on windows, with no zsh. Sigh.&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/9286027146</link><guid>http://mr-dev.tumblr.com/post/9286027146</guid><pubDate>Tue, 23 Aug 2011 08:34:01 +0100</pubDate></item><item><title>Some Node.JS resources</title><description>&lt;p&gt;I&amp;#8217;ve been messing about with node.js a little bit recently and thought i&amp;#8217;d post some of the resources I found particularly helpful, in case anyone else finds them of use&lt;/p&gt;
&lt;p&gt;Then I realised that Stack Overflow probably had this covered, and sure enough:&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;h1&gt;&lt;a href="http://stackoverflow.com/questions/2353818/how-do-i-get-started-with-nodejs"&gt;How do I get started with NodeJS&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The only thing I&amp;#8217;d add that isn&amp;#8217;t in there is &lt;a title="Eloquent Javascript" href="http://eloquentjavascript.net/"&gt;Eloquent Javascript&lt;/a&gt;&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/8428338219</link><guid>http://mr-dev.tumblr.com/post/8428338219</guid><pubDate>Wed, 03 Aug 2011 15:35:24 +0100</pubDate></item><item><title>Developer vids from NDC2011</title><description>&lt;a href="http://ndc2011.no/"&gt;Developer vids from NDC2011&lt;/a&gt;: &lt;p&gt;Go here and grab the torrent for some pretty good sessions recorded at the Norwegian Developers Conference. That is all.&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/8135605920</link><guid>http://mr-dev.tumblr.com/post/8135605920</guid><pubDate>Wed, 27 Jul 2011 19:05:06 +0100</pubDate></item><item><title>Ayende and _that_ Microsoft N Layer App Sample Architecture.</title><description>&lt;p&gt;Ayende has finished with his &lt;strike&gt;review &lt;/strike&gt;destruction of the domain oriented n-layered .net 4 sample app (&lt;a href="http://microsoftnlayerapp.codeplex.com/"&gt;&lt;a href="http://microsoftnlayerapp.codeplex.com/"&gt;http://microsoftnlayerapp.codeplex.com/&lt;/a&gt;&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Well worth a read if you have time - the last in his series of reviews can be found &lt;a title="here" href="http://ayende.com/blog/35841/review-microsoft-n-layer-app-sample-part-xndash-architecture-for-the-space-age"&gt;here&lt;/a&gt;. In it, he summarises with this advice:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I can’t emphasize this enough, avoid this codebase, don’t look at it, and never try to follow anything shown there, it will end in tears, pain and suffering.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;No sitting on the fence there then :) Mostly I agree with the comments Ayende makes in his posts - this architecture says all the right things, and makes all the right noises, but in the end it looks rather like a good example of architecture for architectures sake. Without a good discussion of the context of the problem and why the various architecture pieces were chosen, and the benefits they bring to the codebase versus the downside of further complicating the architecture, it falls short. That said, I&amp;#8217;ve not checked the &amp;#8220;updated&amp;#8221; version of the guidance, so perhaps they&amp;#8217;ve addressed a lot of these issues&amp;#8230;&lt;/p&gt;
&lt;p&gt;Anyway, I found it to be a useful exercise to read through Ayende&amp;#8217;s reviews, and check that I wasn&amp;#8217;t doing any of the things he was talking about :) Luckily I wasn&amp;#8217;t, although I have plenty of problems with my own architecture that I&amp;#8217;m sure Ayende would point out if he ever got hold of my code :) &lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/8129961026</link><guid>http://mr-dev.tumblr.com/post/8129961026</guid><pubDate>Wed, 27 Jul 2011 16:00:06 +0100</pubDate></item><item><title>Very amusing - “.. it runs 10x slower than PHP, but you...</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/5GpOfwbFRcs?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Very amusing - “.. it runs 10x slower than PHP, but you get an architecture you can blog about”&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/7607352775</link><guid>http://mr-dev.tumblr.com/post/7607352775</guid><pubDate>Thu, 14 Jul 2011 08:37:50 +0100</pubDate></item><item><title>Postcodes</title><description>&lt;p&gt;I was talking to Phil (the creator of &lt;a title="carspy.co" target="_blank" href="http://carspy.co"&gt;carspy.co&lt;/a&gt;) a while ago, and suggesting that he should look at using geolocation on his site to work out where you are and thus find cars near you.&lt;/p&gt;
&lt;p&gt;Once you have the lat lon, I said, it shouldn&amp;#8217;t be too hard to get the UK postcode for that location, and then pre-fill the user&amp;#8217;s location in. Well, as it turns out there are a few services that will give you the lat lon for a given postcode, but none that will take a lat lon and try to guess your nearest postcode for you. Well, none that I could find anyway (for free).&lt;/p&gt;
&lt;p&gt;So, that was my excuse for writing a simple app in node.js to do this for you :) The idea behind it is a simple API that you can pass a lat,lon, and you get back a postcode. The postcodes are all available from &lt;a href="http://data.gov.uk/dataset/os-code-point-open"&gt;&lt;a href="http://data.gov.uk/dataset/os-code-point-open"&gt;http://data.gov.uk/dataset/os-code-point-open&lt;/a&gt;&lt;/a&gt;, albeit without Northern Ireland and a few other places.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not far from finishing this, so I&amp;#8217;ll post about it when I get it done. I&amp;#8217;m going to be using Node.JS and MongoDb to store the postcodes and associated lat/lon.&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/7606931777</link><guid>http://mr-dev.tumblr.com/post/7606931777</guid><pubDate>Thu, 14 Jul 2011 08:15:58 +0100</pubDate><category>postcodes</category></item><item><title>WHAT IS YOUR FAVORITE INANIMATE OBJECT?</title><description>&lt;p&gt;My Mac of course! Currently an iMac, but one day I hope to have a mac book air, just as soon as I can convince my wife how important it is to get one :)&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/7606707922</link><guid>http://mr-dev.tumblr.com/post/7606707922</guid><pubDate>Thu, 14 Jul 2011 08:04:56 +0100</pubDate></item><item><title>String.IsNullOrWhiteSpace</title><description>&lt;p&gt;I came accross &lt;a title="String.IsNullOrWhiteSpace" target="_blank" href="http://msdn.microsoft.com/en-us/library/system.string.isnullorwhitespace.aspx"&gt;String.IsNullOrWhiteSpace&lt;/a&gt; recently, and thought I&amp;#8217;d pass this on, it&amp;#8217;s one of those simple methods that once you notice you find yourself using more and more. I won&amp;#8217;t tell you what it does, I think the clue is in the name ;)&lt;/p&gt;
&lt;p&gt;On the subject of strings, I also found this extension method which I find myself using a lot:&lt;/p&gt;
&lt;pre class="brush:csharp; gutter:false; toolbar:false"&gt;        
/// 
/// replacement for String.Format
/// 
public static string With(this string format, params object[] args)
{
    return string.Format(format, args);
}
&lt;/pre&gt;
&lt;p&gt;&lt;br/&gt;It means I can write code like&lt;/p&gt;
&lt;pre class="brush:csharp; gutter:false; toolbar:false"&gt; var myString = "Hello there {0} and welcome to {1}".With(User.Name,Site.Name);
&lt;/pre&gt;
&lt;p&gt;&lt;br/&gt;Which I find a whole lot easier to manage than ugly error-prone string concatenation and slightly more convenient than using String.Format. I came across that on &lt;a href="http://code.google.com/p/sutekishop/"&gt;Suteki Shop&lt;/a&gt; when I was browsing the source. I&amp;#8217;m finding I use that a lot!&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/7075746865</link><guid>http://mr-dev.tumblr.com/post/7075746865</guid><pubDate>Thu, 30 Jun 2011 08:45:00 +0100</pubDate></item><item><title>Simple way to unit test your WCF duplex services (and avoid that dependency on OperationContext)</title><description>&lt;p&gt;I&amp;#8217;m building a set of secure WCF services to communicate with a bunch of client machines. Because the communication is duplex, you need to use a Callback in the service method:&lt;/p&gt;
&lt;pre class="csharp"&gt;OperationContext.Current.GetCallbackChannel&amp;lt;IClientCallBack&amp;gt;()&lt;/pre&gt;
&lt;p&gt;But the problem with this is that if you write any unit tests against this method, it will fail because there is no OperationContext! So what do you do?&lt;/p&gt;
&lt;p&gt;Well, there are a few blogs out there with various suggestions, and there&amp;#8217;s &lt;a title="WCFMock" href="http://wcfmock.codeplex.com/"&gt;WCFMock &lt;/a&gt;which I did initially use and allowed me to mock out the OperationContext, but what I couldn&amp;#8217;t suss out with WCFMock was how to specify my own call back handler for my tests - so that I could record when the callback was being called by the service.&lt;/p&gt;
&lt;p&gt;In the end, I came up with a solution that works well for me. Basically, I create a constructor overload for my service that accepts a Func&amp;lt;IClientCallBack&amp;gt; - I am abstracting out the code that instantiates a callback to this function. &lt;/p&gt;
&lt;p&gt;Now, when running inside IIS as normal, WCF isn&amp;#8217;t going to call my constuctor, so I just modify my default constructor so that it uses OperationContext ONLY if nothing else has been set. Here&amp;#8217;s the code:&lt;/p&gt;
&lt;pre class="brush:csharp"&gt;    public class ScannerManagerService : IScannerManager
    {
        private readonly Func&amp;lt;IClientCallBack&amp;gt; _createCallbackChannel;        

        public ScannerManagerService() : this(null)
        {
        }

        /// 
        /// If you pass in a callBack, messages will be sent to that. Otherwise, as is the case in IIS, null will be passed in which will result
        /// in the OperationContext being used.
        /// 
        /// &lt;param name="callBack"&gt;
        public ScannerManagerService(Func&amp;lt;IClientCallBack&amp;gt; callBack)
        {
            if (callBack != null)
            {
                this._createCallbackChannel = callBack;
            }
            else
            {
                this._createCallbackChannel = () =&amp;gt; OperationContext.Current.GetCallbackChannel&amp;lt;IClientCallBack&amp;gt;();
            }
        }

        private void DoSomeWork()
        {
            var callBack = _createCallbackChannel(); 
            ...
        }

&lt;/pre&gt;
&lt;p&gt;And here&amp;#8217;s how I use that service in my unit tests:&lt;/p&gt;
&lt;pre class="brush:csharp"&gt;        [SetUp]
        public void Setup()
        {
            _scannerManager = new ScannerManagerService(() =&amp;gt; new SimpleClientCallBack());
        }
&lt;/pre&gt;
&lt;p&gt;SimpleClientCallBack is just a simple implementation of IClientCallBack which allows me to test the call backs, it looks like this:&lt;/p&gt;
&lt;pre class="brush:csharp"&gt;    public class SimpleClientCallBack : IClientCallBack
    {
        public static int messageCount;
        public void SendClientMessage(ScannerMessageWrapper message)
        {
            messageCount++;
        }
    }
&lt;/pre&gt;
&lt;p&gt;And that&amp;#8217;s that. It&amp;#8217;s pretty simple, and does the trick for me. &lt;/p&gt;
&lt;p&gt;Hope it helps someone else out there&amp;#8230;&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/5387936162</link><guid>http://mr-dev.tumblr.com/post/5387936162</guid><pubDate>Wed, 11 May 2011 11:36:00 +0100</pubDate></item><item><title>Manage your database with Visual Studio's "Database Project"</title><description>&lt;p&gt;It was with some trepidation that I set about looking into Visual Studio&amp;#8217;s Database projects, but it looks like an awesome tool that you really should be aware of if you do a lot of work with SQL Server databases in your project..&lt;/p&gt;
&lt;h2&gt;The background&lt;/h2&gt;
&lt;p&gt;We needed some way to track changes to our database for our startup. The database was evolving all the time, and while all the code was being tracked in svn, the database was just being hacked at, with nothing more than a daily backup. We needed something (a tool/process) that we could use to:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Get the database into source control so we could track schema changes&lt;/li&gt;
&lt;li&gt;&amp;#8220;Deploy&amp;#8221; the database - generate a &amp;#8220;new install&amp;#8221; script to create an instance of the database&lt;/li&gt;
&lt;li&gt;Generate a &amp;#8220;test database&amp;#8221; - something we can use to fire databasey tests against, where we know the state of the database and the data in it.&lt;/li&gt;
&lt;/ul&gt;&lt;h2&gt;Enter &amp;#8220;Database Project&amp;#8221;&lt;/h2&gt;
&lt;p&gt;So, in Visual Studio 2010 (and in 2008 &amp;#8220;Database Edition&amp;#8221;), you now have the option of creating a database project. You can then import an existing schema into your database project, which creates sort of mini-scripts for all the objects that make up your database. You can &amp;#8220;deploy&amp;#8221; the database from here, which depending on how you&amp;#8217;ve configured it will either install the database for you, or will just generate a SQL script for the schema install.&lt;/p&gt;
&lt;p&gt;Once you&amp;#8217;ve imported a schema, you can then make changes by editing the files corresponding to your change - so if you want to change a table, you edit the MyTable.table.sql file, make your change, save, and &amp;#8220;deploy&amp;#8221;. One clever thing is that you can target a specific database instance for the deployment, and if that database already exists, then only the changes required to bring it upto-date with the latest schema changes will be generated.&lt;/p&gt;
&lt;h2&gt;It gets much much better&lt;/h2&gt;
&lt;p&gt;Ok so I can keep track of schema changes, generate new install scripts that will deploy my database, all good stuff. But the &lt;em&gt;really useful&lt;/em&gt; stuff is yet to come (and you can only do this in the &lt;strong&gt;Ultimate &lt;/strong&gt;or &lt;strong&gt;Premium&lt;/strong&gt; version btw)&lt;/p&gt;
&lt;h3&gt;Schema Comparisons&lt;/h3&gt;
&lt;p&gt;You can compare 2 database schemas, or a database schema with your database project, to see if they are synced. If they are not synced, you can generate a script to bring the &amp;#8220;target&amp;#8221; in line with the &amp;#8220;source&amp;#8221;. That&amp;#8217;s pretty awesome. Using this, we can for example easily make sure that our production instances are upto-date, and if not quickly bring them upto-date without losing the data on them. You could also use this for example at the end of a release cycle, to generate a migrate script, which you could then tweak and include with your release for existing clients.&lt;/p&gt;
&lt;h3&gt;Data Comparisons&lt;/h3&gt;
&lt;p&gt;As the name suggests, you can also perform data comparisons between 2 database, to see what is different about the contents of the 2 databases. You can then choose which of the tables you want to generate an update script for - really useful stuff. Even better is the fact that the scripts generated maintain the actual primary key identity value, rather than just generating new id&amp;#8217;s.&lt;/p&gt;
&lt;h2&gt;So, In Summary..&lt;/h2&gt;
&lt;p&gt;I like it. A lot. I&amp;#8217;m going to be using this to track database changes in svn, generate test databases with test data pre-loaded, and to automate the deployment process so that the target database gets updated automatically.&lt;/p&gt;
&lt;p&gt;If you want to find out more and get started, then I found the best information to be the collection of walkthroughs available on MSDNs site, starting from here: &lt;a href="http://msdn.microsoft.com/en-us/library/aa833292.aspx"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa833292.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa833292.aspx&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/4254762522</link><guid>http://mr-dev.tumblr.com/post/4254762522</guid><pubDate>Fri, 01 Apr 2011 09:35:29 +0100</pubDate><category>visual-studio database-project</category></item><item><title>So, this is my new blog.. for now.</title><description>&lt;p&gt;Quick &amp;#8220;hello world&amp;#8221; post to test out my new blog. I&amp;#8217;ve moved from my old blog (&lt;a href="http://www.geekswithblogs.net/mattrobertsblog"&gt;www.geekswithblogs.net/mattrobertsblog&lt;/a&gt;), it&amp;#8217;s feeling a bit out-dated on there, and I wanted to be somewhere more hip ;)&lt;/p&gt;
&lt;p&gt;Hopefully I&amp;#8217;ll be stepping up the game a bit and blogging about some of the interesting things I&amp;#8217;m working on at the moment.&lt;/p&gt;
&lt;p&gt;The idea is that I&amp;#8217;m going to eventually roll out my own blogging engine, just to say I&amp;#8217;ve done it, but that&amp;#8217;s not going to happen anytime soon, so for now tumbl looks like a nice place to be. &lt;/p&gt;
&lt;p&gt;TTFN&lt;/p&gt;</description><link>http://mr-dev.tumblr.com/post/4141857134</link><guid>http://mr-dev.tumblr.com/post/4141857134</guid><pubDate>Sun, 27 Mar 2011 21:23:00 +0100</pubDate><category>welcome</category></item></channel></rss>
