<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Missal&#039;s Blog</title>
	<atom:link href="http://lostechies.com/chrismissal/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/chrismissal</link>
	<description>Thoughts while working and playing as a Software Developer</description>
	<lastBuildDate>Fri, 13 Apr 2012 01:41:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>I accidentally the code</title>
		<link>http://lostechies.com/chrismissal/2012/04/12/i-accidentally-the-code/</link>
		<comments>http://lostechies.com/chrismissal/2012/04/12/i-accidentally-the-code/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 01:41:14 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[For Fun]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[meme]]></category>
		<category><![CDATA[south park]]></category>

		<guid isPermaLink="false">http://lostechies.com/chrismissal/?p=126</guid>
		<description><![CDATA[I&#8217;m not going to sit back and let Ryan slip all the memes into Los Techies. After a slip up earlier today&#8230; here&#8217;s something that I couldn&#8217;t help but say inside my head:]]></description>
			<content:encoded><![CDATA[<div>
<div>I&#8217;m not going to sit back and let <a href="http://lostechies.com/ryanrauh/">Ryan</a> slip all the memes into Los Techies.</div>
<div>After a slip up earlier today&#8230; here&#8217;s something that I couldn&#8217;t help but say inside my head:</div>
</div>
<p><a href="http://lostechies.com/chrismissal/files/2012/04/git-bad-time.jpg"><img class="alignnone size-full wp-image-127" title="git-bad-time" src="http://lostechies.com/chrismissal/files/2012/04/git-bad-time.jpg" alt="" width="480" height="360" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2012/04/12/i-accidentally-the-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebApiContrib is Alive</title>
		<link>http://lostechies.com/chrismissal/2012/04/04/webapicontrib-is-alive/</link>
		<comments>http://lostechies.com/chrismissal/2012/04/04/webapicontrib-is-alive/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 00:47:55 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[ASP.NET Web API]]></category>
		<category><![CDATA[asp.net web api]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[webapicontrib]]></category>

		<guid isPermaLink="false">http://lostechies.com/chrismissal/?p=117</guid>
		<description><![CDATA[Just a heads up for anybody that hasn&#8217;t seen it, but WebApiContrib (the community contributions to ASP.NET&#8217;s new Web API framework) is alive and kicking! Pedro Reys wrote up an excellent introduction about what&#8217;s going on with the project(s), where&#160;&#8230; <a href="http://lostechies.com/chrismissal/2012/04/04/webapicontrib-is-alive/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just a heads up for anybody that hasn&#8217;t seen it, but <a href="http://webapicontrib.github.com/">WebApiContrib</a> (the community contributions to ASP.NET&#8217;s new Web API framework) is alive and kicking! <a href="https://twitter.com/#!/pedroreys">Pedro Reys</a> wrote up an <strong><a href="http://bit.ly/webapicontrib">excellent introduction</a></strong> about what&#8217;s going on with the project(s), where we are, and what we have left to do.</p>
<p>If you haven&#8217;t gotten a chance to look at <a href="http://www.asp.net/web-api">ASP.NET Web API</a> yet, please do so, it&#8217;s a very promising addition to the newly open sourced ASP.NET web stack. As always, we&#8217;d love to get some feedback and contributions, let us know what you think and how we can improve our project!</p>
<p><strong>Links:</strong></p>
<ul>
<li><a href="http://webapicontrib.github.com/">Official WebApiContrib Site</a></li>
<li><a href="https://github.com/WebApiContrib">WebApiContrib Organization on Github</a></li>
<li><a href="https://github.com/WebApiContrib/WebAPIContrib">WebApiContrib Source Code</a></li>
<li><a href="http://jabbr.net/#/rooms/webapicontrib">The JabbR room for WebApiContrib</a></li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2012/04/04/webapicontrib-is-alive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Newline at end of file</title>
		<link>http://lostechies.com/chrismissal/2012/03/23/newline-at-end-of-file/</link>
		<comments>http://lostechies.com/chrismissal/2012/03/23/newline-at-end-of-file/#comments</comments>
		<pubDate>Sat, 24 Mar 2012 04:32:20 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[Rant]]></category>
		<category><![CDATA[newlines]]></category>

		<guid isPermaLink="false">http://lostechies.com/chrismissal/?p=107</guid>
		<description><![CDATA[This is just me asking a question in public and doing as little research on the subject as possible, but why wouldn&#8217;t you want a newline character at the end of a file? There are several reasons why I can&#160;&#8230; <a href="http://lostechies.com/chrismissal/2012/03/23/newline-at-end-of-file/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is just me asking a question in public and doing as little research on the subject as possible, but why wouldn&#8217;t you want a newline character at the end of a file?</p>
<p>There are several reasons why I can see they are more beneficial to have than not, I&#8217;ll list those out now:</p>
<ul>
<li>Diffs display better on files that end in newlines</li>
<li>When I press &#8220;Ctrl + End&#8221; or &#8220;Cmd + Down&#8221; I don&#8217;t expect the file to scroll right (if the line is long enough)</li>
</ul>
<p>So maybe bullet points weren&#8217;t necessary there because I only had two points, but it&#8217;s always been a pet-peeve of mine and I&#8217;m curious if there&#8217;s ever a good reason not to have one at the end.</p>
<p><em>Sure, the newline can go away in minified files, but I shouldn&#8217;t really care about diffs and actually editing them in an editor, so that doesn&#8217;t really count. I would consider that a deployment version, not a development version. I&#8217;m just referring to files that are shared in source control.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2012/03/23/newline-at-end-of-file/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Super Simple Versioning of Third Party Scripts</title>
		<link>http://lostechies.com/chrismissal/2011/12/09/super-simple-versioning-of-third-party-scripts/</link>
		<comments>http://lostechies.com/chrismissal/2011/12/09/super-simple-versioning-of-third-party-scripts/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 12:21:53 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[Continuous Improvement]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://lostechies.com/chrismissal/?p=91</guid>
		<description><![CDATA[My attention span decreases every day too&#8230; tl;dr &#8211; Scroll to bottom of page for a neat code example&#8230; Working on a large eCommerce web site gives me the &#8220;privilege&#8221; of working with other companies that integrate with us via&#160;&#8230; <a href="http://lostechies.com/chrismissal/2011/12/09/super-simple-versioning-of-third-party-scripts/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>My attention span decreases every day too&#8230; <em><em><strong>tl;dr</strong> &#8211; </em></em>Scroll to bottom of page for a neat code example&#8230;</em></p>
<p>Working on a large eCommerce web site gives me the &#8220;privilege&#8221; of working with other companies that integrate with us via JavaScript files placed in our code. Privilege is a euphemism here, it&#8217;s usually a pain. Some are good yes, but many of these companies write crappy JavaScript. Coming from me, that&#8217;s a harsh statement, I love JavaScript but I&#8217;m not as good at it as I&#8217;d like to be.</p>
<p>One of these companies has a couple files on their servers that are slow loading for our users at times. Since we sell to most anybody worldwide our users can come from all over the world. These files are slow to load sometimes because our partner doesn&#8217;t have a very robust server network. We were told that they could not be downloaded from them and served through our domain because they change too often. We were skeptical so I thought it would be interesting to see how often they actually change.</p>
<p>I posted a question on <a title="Me on Twitter" href="http://twitter.com/ChrisMissal" target="_blank">Twitter</a> asking for a program that could be scheduled at a configured interval to download a file via http and version it. I&#8217;d like to see how the file changes over time. It seemed to me like something was probably out there and that I shouldn&#8217;t write something myself, this is why I asked before I started coding like a mad-man. I got some good responses and <a href="http://en.wikipedia.org/wiki/Cron">cron</a> was the most common response, but I&#8217;m running Windows because that the best OS for our company and the work we do.</p>
<p>The smart and talented <a href="http://www.bphogan.com/">Brian Hogan</a> (follow him, seriously, do it!) suggested <a href="http://en.wikipedia.org/wiki/Wget">wget</a>, which I already had on my machine at work. In my limited experience with wget, I realized I could schedule a task to run a batch file to issue the wget command. Simple enough, right? Now, when it comes to versioning&#8230; we use <a href="http://en.wikipedia.org/wiki/Git_(software)">git</a> for all of our source control so why not just set up a local git repo? Brian&#8217;s suggestion and my love of git made this task super simple.</p>
<p>The code is (generically) as follows:</p>
<p><em>(you have to run &#8216;git init&#8217; and commit your first version, but from then on&#8230;)</em></p>
<div id="gist-1450416" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'>call wget http://domain.com/directory/file.js -r</div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'>call git add -A</div><div class='line' id='LC4'>call git commit -am &quot;Current version&quot;</div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1450416/cd2ce5d78676757a51cfeb7b343f65f3d4c25e77/version.bat" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1450416#file_version.bat" style="float:right;margin-right:10px;color:#666">version.bat</a>
            <a href="https://gist.github.com/1450416">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>The moral of this <del>story</del> blog post is that there&#8217;s probably already a good way to do something that I just haven&#8217;t figured out yet. It&#8217;s super common, but can be tough to consider at times. This is why we pair when coding, ask for advice on code design and generally shouldn&#8217;t work in a &#8220;silo&#8221;. Just some food for thought!</p>
<p>If you have more questions on this hit me up on Twitter <a href="http://twitter.com/ChrisMissal">@ChrisMissal</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2011/12/09/super-simple-versioning-of-third-party-scripts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Queue is Always Empty Using yield return</title>
		<link>http://lostechies.com/chrismissal/2011/05/04/queue-is-always-empty-using-yield-return/</link>
		<comments>http://lostechies.com/chrismissal/2011/05/04/queue-is-always-empty-using-yield-return/#comments</comments>
		<pubDate>Wed, 04 May 2011 11:45:21 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://lostechies.com/chrismissal/?p=69</guid>
		<description><![CDATA[I ran into an issue in a C# application the other day. Thankfully I figured out what was going wrong right away, but it could have turned into a big headache potentially. The View was strongly typed as IEnumerable&#60;string&#62; and&#160;&#8230; <a href="http://lostechies.com/chrismissal/2011/05/04/queue-is-always-empty-using-yield-return/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I ran into an issue in a C# application the other day. Thankfully I figured out what was going wrong right away, but it could have turned into a big headache potentially.</p>
<p><span id="more-69"></span></p>
<p>The View was strongly typed as IEnumerable&lt;string&gt; and looked something like this:</p>
<pre>
&lt;% if(Model.Any()) { %&gt;
&lt;ul id="messages"&gt;
&lt;% foreach (var message in Model) { %&gt;
    &lt;li&gt;&lt;%: message %&gt;&lt;/li&gt;
&lt;% } %&gt;
&lt;/ul&gt;
&lt;% } %&gt;
</pre>
<p>The code behind for putting the Model into the view was also pretty simple:</p>
<p><code>&lt;pre&gt;<br />
public ActionResult Messages()<br />
{<br />
	return PartialView(messageService.GetMessages());<br />
}</p>
<p></code></pre>
<p>The implementation of MessageService was also very simple:</p>
<p><code>&lt;pre&gt;<br />
public IEnumerable&lt;string&gt; GetMessages()<br />
{<br />
	while (Queue.Count &gt; 0)<br />
		yield return Queue.Dequeue();<br />
}</p>
<p></code></pre>
<p>I could set a breakpoint and see messages being queued up, but the list items weren't being rendered on the page. See the problem?</p>
<p>The issue isn't in the Messages() action or the GetMessages() method. In the view, when .Any() is called, it will enumerate the collection and dequeue all the messages. After that happens, there is nothing to loop through in the foreach. This was fixed easy enough with the following in MessageService:</p>
<p><code>&lt;pre&gt;<br />
public IEnumerable&lt;string&gt; GetMessages()<br />
{<br />
	return GetDequeuedMessages().ToArray();<br />
}</p>
<p>private static IEnumerable&lt;string&gt; GetDequeuedMessages()<br />
{<br />
	while (Queue.Count &gt; 0)<br />
		yield return Queue.Dequeue();<br />
}</p>
<p></code></pre>
<p>Hopefully this helps you from pulling your hair out if you didn't catch it right away!</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2011/05/04/queue-is-always-empty-using-yield-return/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using AppHarbor for Continuous Integration</title>
		<link>http://lostechies.com/chrismissal/2011/03/12/using-appharbor-for-continuous-integration/</link>
		<comments>http://lostechies.com/chrismissal/2011/03/12/using-appharbor-for-continuous-integration/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 01:12:00 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[AppHarbor]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">/blogs/chrismissal/archive/2011/03/11/using-appharbor-for-continuous-integration.aspx</guid>
		<description><![CDATA[I thought it would be interesting to use AppHarbor as a quick way to get some code with tests under a continuous integration environment. Along with this, if I could also use the AppHarbor deployed web site to serve that&#160;&#8230; <a href="http://lostechies.com/chrismissal/2011/03/12/using-appharbor-for-continuous-integration/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I thought it would be interesting to use <a href="http://appharbor.com/">AppHarbor</a> as a quick way to get some code with tests under a continuous integration environment. Along with this, if I could also use the AppHarbor deployed web site to serve that file, even better!</p>
<h3>AppHarbor</h3>
<p><strong>What:</strong> If you haven&#8217;t heard about AppHarbor yet, go check it out. They offer Git and Mercurial hosting that will also run unit tests (with various frameworks). You&#8217;re able to deploy different versions of your site with a single click and they have SQL Server support.</p>
<p><strong>Why:</strong> It&#8217;s free and easy. It runs your tests. It lets you deploy any version of your code. It&#8217;s getting better each day.</p>
<h3>Continuous Integration</h3>
<p><strong>What: </strong>Why should I describe it when others can do so much better:</p>
<p style="padding-left: 30px"><i>Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily &#8211; leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. This article is a quick overview of Continuous Integration summarizing the technique and its current usage. &#8211; <a href="http://martinfowler.com/articles/continuousIntegration.html">Martin Fowler</a></i></p>
<p><strong>Why:</strong> Deliver your most current build through a web site by typing &#8220;git push AppHarbor master&#8221;. It wont build your binary unless your tests pass. This means there&#8217;s no way to push a new downloadable version of your code unless all tests pass; it&#8217;s just nice and easy.</p>
<h3>How to do this?</h3>
<p>The code is super simple, you can download the assembly to do this from the application that actually does it. Visit <a href="http://cheap-ci.apphb.com">http://cheap-ci.apphb.com</a>.</p>
</p>
<h3>Some Questions and Thoughts</h3>
<p>I don&#8217;t know if this is useful or not, but I wanted to try it. Let me know what I&#8217;m missing or doing wrong. Let me know if there&#8217;s something to do better. The thought popped in my head the other day, and now that I have a proof of concept, I thought I should share.</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2011/03/12/using-appharbor-for-continuous-integration/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New (to me) Applications</title>
		<link>http://lostechies.com/chrismissal/2011/03/10/new-to-me-applications/</link>
		<comments>http://lostechies.com/chrismissal/2011/03/10/new-to-me-applications/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 11:07:00 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[Favorites]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">/blogs/chrismissal/archive/2011/03/10/new-to-me-applications.aspx</guid>
		<description><![CDATA[Recently, I&#8217;ve been using some new applications on which I should share some thoughts. LinqPad I won a copy of this at our local .Net Users Group, CRineta, and it has been great since I started using it! If I&#160;&#8230; <a href="http://lostechies.com/chrismissal/2011/03/10/new-to-me-applications/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I&#8217;ve been using some new applications on which I should share some thoughts.</p>
<h3><a href="http://www.linqpad.net/">LinqPad</a></h3>
<p>I won a copy of this at our local .Net Users Group, <a href="http://crineta.org">CRineta</a>, and it has been great since I started using it! If I just want a single quick query of a DB, the &#8220;object-like&#8221; format it returns the data in is really nice. Querying large log files (by different names, on different servers) for interesting data is also a breeze.</p>
<h3><a href="http://www.mremote.org/wiki/">mRemote</a></h3>
<p>Throughout a standard work day, I&#8217;ll remote into a couple or more servers for various reasons or need to open up PuTTY to SSH into network hardware. This allows me to keep one app open to do all these things while keeping different sessions on tabs. It also saves my settings so I don&#8217;t have to remember them.</p>
<h3><a href="http://swypeinc.com/">Swype</a></h3>
<p>I recently upgraded my phone from the crumby Motorola Backflip to the awesome Motorola Atrix. Since the Atrix ships with Android 2.2, you get Swype right out of the box. It&#8217;s hard to describe how Swype works, you&#8217;ll just have to watch a video or have a friend show you. It&#8217;s so much faster than tapping and seems to start to figure out what you&#8217;re thinking before you&#8217;re even done telling it what to input. I&#8217;d list this as the best mobile device technology since touch screens; it&#8217;s great!</p>
<h3><a href="http://evernote.com/">Evernote</a></h3>
<p>I&#8217;ve had Evernote for a bit now, but i&#8217;m using it more and more lately. It&#8217;s letting me get rid of some paper clutter and cutting back on emails (or drafts) to myself to remind me of things.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2011/03/10/new-to-me-applications/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>ReSharper Easter Egg?</title>
		<link>http://lostechies.com/chrismissal/2011/03/06/resharper-easter-egg/</link>
		<comments>http://lostechies.com/chrismissal/2011/03/06/resharper-easter-egg/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 23:55:00 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[For Fun]]></category>
		<category><![CDATA[Reading Code]]></category>

		<guid isPermaLink="false">/blogs/chrismissal/archive/2011/03/06/resharper-easter-egg.aspx</guid>
		<description><![CDATA[A while ago, I was looking through some C# code and came across something fun that was being added by ReSharper. In comments, the words &#8220;gold&#8221; and &#8220;silver&#8221; are underlined with that color. I don&#8217;t know if this is just&#160;&#8230; <a href="http://lostechies.com/chrismissal/2011/03/06/resharper-easter-egg/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A while ago, I was looking through some C# code and came across something fun that was being added by <a href="http://www.jetbrains.com/resharper/">ReSharper</a>.</p>
<p><img src="//lostechies.com/chrismissal/files/2011/03/resharper-gold-silver.png" /></p>
<p>In comments, the words &#8220;gold&#8221; and &#8220;silver&#8221; are underlined with that color. I don&#8217;t know if this is just an <a href="http://en.wikipedia.org/wiki/Easter_egg_(media)">easter egg</a> or if there&#8217;s more to it. I&#8217;m curious if anybody else has noticed this or other words. Ideally, this is some sort of golden ticket added by <a href="http://www.jetbrains.com">JetBrains</a> and I win a prize visit to the &#8220;factory&#8221;! ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2011/03/06/resharper-easter-egg/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Quirk with Invalid Git Config</title>
		<link>http://lostechies.com/chrismissal/2010/12/23/quirk-with-invalid-git-config/</link>
		<comments>http://lostechies.com/chrismissal/2010/12/23/quirk-with-invalid-git-config/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 00:34:00 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[git]]></category>

		<guid isPermaLink="false">/blogs/chrismissal/archive/2010/12/22/quirk-with-invalid-git-config.aspx</guid>
		<description><![CDATA[I bumped into what seems like a weird quirk with one of my git config files today. A bad value was reported: error: Malformed value for branch.autosetuprebasefatal: bad config file line 18 in .git/config &#160; In the image, you&#8217;ll notice&#160;&#8230; <a href="http://lostechies.com/chrismissal/2010/12/23/quirk-with-invalid-git-config/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I bumped into what seems like a weird quirk with one of my git config files today. A bad value was reported:</p>
<pre>error: Malformed value for branch.autosetuprebasefatal: bad config file line 18 in .git/config</pre>
<p><img src="//lostechies.com/chrismissal/files/2011/03/git-line-18.png" />&nbsp;</p>
<p><i>In the image, you&#8217;ll notice the branch reads &#8220;(ref: re&#8230;)&#8221;</i></p>
<p>I was getting this error because I incorrectly had the value of &#8220;true&#8221; for branch.autosetuprebase instead of &#8220;always&#8221;. Luckily, the error line tells me which setting has the incorrect value, but reports it as line 18 when in actuality, the line is 17. If I misspell autosetuprebase, the following error is reported:</p>
<pre>fatal: bad config file line 17 in .git/config</pre>
<p><img src="//lostechies.com/chrismissal/files/2011/03/git-line-17.png" /></p>
<p>It seems weird that an error on the same line would report two different line numbers depending on whether it was the key or the value that contained the issue. If you run across a config error like this, just try to remember to look at the value if it supplies you with the setting. If it&#8217;s generic enough like the second error, it&#8217;s probably the right line number. Since I&#8217;m not a pro at git, I&#8217;d be curious to know why it behaves this way if anybody can provide any insight.</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2010/12/23/quirk-with-invalid-git-config/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AutoMapper Tests Made Simple</title>
		<link>http://lostechies.com/chrismissal/2010/12/22/automapper-tests-made-simple/</link>
		<comments>http://lostechies.com/chrismissal/2010/12/22/automapper-tests-made-simple/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 04:37:00 +0000</pubDate>
		<dc:creator>Chris Missal</dc:creator>
				<category><![CDATA[AutoMapper]]></category>
		<category><![CDATA[DRY]]></category>
		<category><![CDATA[NUnit]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">/blogs/chrismissal/archive/2010/12/21/automapper-tests-made-simple.aspx</guid>
		<description><![CDATA[I work primarily on a C# ASP.NET MVC application that deals with many other systems which seem to dish out strings all over the place. Hence the need for something like AutoMapper. When converting this data into objects or enumerations,&#160;&#8230; <a href="http://lostechies.com/chrismissal/2010/12/22/automapper-tests-made-simple/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I work primarily on a C# ASP.NET MVC application that deals with many other systems which seem to dish out strings all over the place. Hence the need for something like AutoMapper. When converting this data into objects or enumerations, I find it&#8217;s easiest to extend TypeConverter&lt;TSource, TDestination&gt; with our own class that we can cover with several data/unit tests. A lot of these test fixtures were very similar and I was looking to clean up some of these tests to make them easier to maintain and less &#8220;copy/paste&#8221; when a new one is ready to be added.</p>
<p>I believed had an abstraction almost ready to go with NUnit&#8217;s TestCaseSource and TestCaseData classes, but there was one little piece that was bothering me. Our previous tests were subclassing our TypeConverters and overriding the ConvertCore method to make it public. This seemed goofy, but also seemed necessary after upgrading AutoMapper from 0.4 to version 1.0 a while back. Today I asked whoever was listening on Twitter for ways that they test their TypeConverters, and Matt Hinze (@mhinze) pointed me towards ResolutionContext.New(), which makes our tests much simpler, and removes the need for subclassing. From here, there&#8217;s not much to do.</p>
<p>Our original tests looked something like this:</p>
<pre>[TestFixture]
public class StringToSectionConverterTests
{
	[TestCase(null, Section.Unknown)]
	[TestCase("", Section.Unknown)]
	[TestCase("category", Section.Category)]
	[TestCase("brand", Section.Brand)]
	[TestCase("machine", Section.Machine)]
	[TestCase("model", Section.Machine)]
	[TestCase("make", Section.Make)]
	[TestCase("jacky treehorn", Section.Unknown, ExpectedException = typeof(ArgumentException))]
	public void ConvertCore_returns_expected_result(string source, Section expected)
	{
		// Arrange
		var resolver = new TestStringToSectionConverter();

		// Act
		var result = resolver.ConvertCore(source);

		// Assert
		result.ShouldEqual(expected);
	}

	private class TestStringToSectionConverter : StringToSectionResolver
	{
		public new Section ConvertCore(string source)
		{
			return base.ConvertCore(source);
		}
	}
}
</pre>
<p>After some fairly easy changes and some excellence from NUnit, we now have something like this:</p>
<pre>public abstract class TypeConverterTesterBase where T : TypeConverter
{
	public abstract IEnumerable GetTestData { get; }

	[TestCaseSource("GetTestData")]
	public TDestination Source_can_be_converted_to_expected_destination(TSource source)
	{
		var typeConverter = Activator.CreateInstance();
		return typeConverter.Convert(ResolutionContext.New(source));
	}

	public TestCaseData CaseReturning(TSource source, TDestination destination)
	{
		return new TestCaseData(source).Returns(destination);
	}

	public TestCaseData CaseThrowing(TSource source) where TException : Exception
	{
		return new TestCaseData(source).Throws(typeof(TException));
	}
}

[TestFixture]
public class StringToSectionConverterTests : TypeConverterTesterBase&lt;StringToSectionConverter, string, Section&gt;
{
    public override IEnumerable GetTestData
    {
        get
        {
            yield return CaseReturning(null, Section.Unknown);
            yield return CaseReturning("", Section.Unknown);
            yield return CaseReturning("Category", Section.Category);
            yield return CaseReturning("brand", Section.Brand);
            yield return CaseReturning("machine", Section.Machine);
            yield return CaseReturning("model", Section.Machine);
            yield return CaseReturning("make", Section.Make);
            yield return CaseReturning("section", Section.Section);
            yield return CaseThrowing("jacky treehorn");
        }
    }
}
</pre>
<p>For tests like this where you&#8217;re testing data transformations, NUnit has TestCaseSource and TestCaseData. These are super helpful; check them out if you haven&#8217;t used them before.</p>
<p>&nbsp;</p>
<ul>
<li><a href="http://www.nunit.org/index.php?p=testCaseSource&amp;r=2.5">NUnit TestCaseSource</a></li>
<li><a href="http://automapper.codeplex.com/">AutoMapper</a></li>
</ul>
<div>Enjoy and be sure to ask me questions if you have any. I feel like I rushed my thoughts here! :P</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/chrismissal/2010/12/22/automapper-tests-made-simple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

