<?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"
	>

<channel>
	<title>A Ranger's Tale</title>
	<atom:link href="http://www.pelennorfields.com/matt/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pelennorfields.com/matt</link>
	<description>The Pelennor Fields White Book: Red Book reincarnated</description>
	<pubDate>Thu, 17 Sep 2009 19:38:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Mercy killing</title>
		<link>http://www.pelennorfields.com/matt/2009/09/17/mercy-killing/</link>
		<comments>http://www.pelennorfields.com/matt/2009/09/17/mercy-killing/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 19:38:28 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Journal]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/?p=1932</guid>
		<description><![CDATA[This blog is the horse with three broken legs and a wheezing cough. It is the dog with three metastasized cancerous tumors the size of grapefruits and open sores all over. It is&#8230;no, that&#8217;s enough.

This is a grisly notice to the two of you still subscribed to this blog that you may now join me [...]]]></description>
			<content:encoded><![CDATA[<p>This blog is the horse with three broken legs and a wheezing cough. It is the dog with three metastasized cancerous tumors the size of grapefruits and open sores all over. It is&#8230;no, that&#8217;s enough.</p>

<p>This is a grisly notice to the two of you still subscribed to this blog that you may now join me in removing it from your RSS reader. I&#8217;ll leave the software up a while until I get some reasonable redirects worked out for the more popular and useful technical entries, but this is The Last Post. Perhaps (nay, likely) someday when I get spare time I&#8217;ll start afresh with a re-imagined online presence. Until then, re-imagine it on your own.</p>

<p>I could write something sentimental here, but I&#8217;m not like that.</p>

<p><strong>*BLAM*</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/09/17/mercy-killing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Code Magic</title>
		<link>http://www.pelennorfields.com/matt/2009/08/21/code-magic/</link>
		<comments>http://www.pelennorfields.com/matt/2009/08/21/code-magic/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 20:29:31 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/?p=1929</guid>
		<description><![CDATA[Magic is bad. There should not be anything magical in production code, because by definition, magic is something not understood. I&#8217;m on board with this notion.

But what happens when magic is twice as fast (or faster) than normal code? Fast magic is a temptation difficult to resist, particularly when the performance of the normal code [...]]]></description>
			<content:encoded><![CDATA[<p>Magic is bad. There should not be anything magical in production code, because by definition, magic is something not understood. I&#8217;m on board with this notion.</p>

<p>But what happens when magic is twice as fast (or faster) than normal code? Fast magic is a temptation difficult to resist, particularly when the performance of the normal code is not acceptable to begin with.</p>

<p>And so it is that I have done something I thought I never would: I have implemented the <a href="http://en.wikipedia.org/wiki/Fixed_point_combinator" title="I don't understand it, either">Y combinator</a>, in a useful fashion(!), in a C# project I&#8217;m working on. I used to think Y combinator had no place in C#, because the language itself supports recursion. However, LINQ doesn&#8217;t, and I don&#8217;t know of another way to employ it generically short of using Y.</p>

<p>I don&#8217;t understand all the ins and outs and mathematical equations and untyped lambda calculus on that Wikipedia page (in fact, I don&#8217;t understand any of them. Side question: do math-related Wikipedia pages make sense to <em>anybody,</em> including mathematicians?). But I do understand that after <a href="http://blogs.msdn.com/wesdyer/archive/2007/02/02/anonymous-recursion-in-c.aspx" title="It started innocently">trying to understand the real-world mechanics</a> and looking at an <a href="http://mikehadlow.blogspot.com/2009/03/recursive-linq-with-y-combinator.html" title="Recursive Linq...nice">example</a> or <a href="http://bugsquash.blogspot.com/2008/07/y-combinator-and-linq.html" title="Recursively get directories in a single line...nice!">two</a>, I was able to implement a function of my own that delves through a TreeView and gets all the TreeNodes that are checked. And, depending on how many nodes there are and how many are checked, this function is at least twice as fast as the conventional way of doing it, a speedup I attribute mostly (if not entirely) to LINQ&#8217;s deferred execution.</p>

<pre><code>public static Func&lt;A, R&gt; Y&lt;A, R&gt;(Func&lt;Func&lt;A, R&gt;, Func&lt;A, R&gt;&gt; f) {
    Func&lt;A, R&gt; g = null;
    g = f(a =&gt; g(a));
    return g;
}

/// &lt;summary&gt;
/// Gets all checked TreeNodes in the specified TreeView.
/// &lt;/summary&gt;
/// &lt;param name="treeview"&gt;&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
public static IEnumerable&lt;TreeNode&gt; GetCheckedNodes(this TreeView treeview) {
    var getNodes = Y&lt;TreeNode, IEnumerable&lt;TreeNode&gt;&gt;(
        f =&gt; n =&gt; new[] {n}.Concat(
            (from TreeNode node in n.Nodes select node).SelectMany(f)
        ));
    return (from TreeNode N in treeview.Nodes select N)
            .SelectMany(getNodes).Where(n =&gt; n.Checked);
}
</code></pre>

<p>(Yes&#8230;I desperately need to get a syntax highlighting plugin here. It&#8217;s on the todo list along with the site revamp. Copy the code into Visual Studio and pretend it wasn&#8217;t a hassle.)</p>

<p>Plus, the magic gave me a tingly sensation, which changed from frightening to slightly pleasant once I decided that this fixed-point combinator untyped lambda calculus business wasn&#8217;t going to open a portal to some other dimension and let a bunch of aliens through to take over the world. (I thought I saw the wall behind my monitors starting to distort into a torus shape, but after rubbing my eyes the effect disappeared.)</p>

<p>I still profess to be a hack and a neophyte at this magic, so gurus are invited to point me to a better way of accomplishing this without resorting to Y combinator magic. Though I do fear that tingly sensation may be habit-forming.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/08/21/code-magic/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why hackers are often libertarians</title>
		<link>http://www.pelennorfields.com/matt/2009/08/04/why-hackers-are-often-libertarians/</link>
		<comments>http://www.pelennorfields.com/matt/2009/08/04/why-hackers-are-often-libertarians/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 16:15:36 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Commentary]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/?p=1927</guid>
		<description><![CDATA[Code Free or Die() is an interesting short essay that attempts to explain why hackers are very often also libertarians. It is worth reading even if only to admire the author&#8217;s correct usage of the phrase &#8220;begs the question&#8221;, which occurrence is a rare thing of beauty indeed in today&#8217;s illiterate society. A few choice [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dfranke.us/cfod.html" title="Daniel Franke's musings on hacker society">Code Free or Die()</a> is an interesting short essay that attempts to explain why hackers are very often also libertarians. It is worth reading even if only to admire the author&#8217;s <em>correct</em> usage of the phrase &#8220;begs the question&#8221;, which occurrence is a rare thing of beauty indeed in today&#8217;s illiterate society. A few choice excerpts from the essay follow.</p>

<blockquote>
  <p>All the economic theory that goes along with libertarianism is a side show.  Libertarianism isn&#8217;t about what makes us rich; it&#8217;s about what&#8217;s <em>right.</em>  &#8220;We hold these truths to be self-evident&#8221; and all that. Libertarians don&#8217;t oppose big government because it&#8217;s clumsy or wasteful. They oppose it because it&#8217;s <em>evil.</em></p>
  
  <p>[...] I propose that we&#8217;ve been looking at the problem from the wrong angle. It isn&#8217;t that hackers tend to adopt libertarian politics, nor is there any third factor that influences both.  Rather, people with a naturally anti-authoritarian attitude tend to become attracted to programming.</p>
  
  <p>[...] People who have no interest in understanding computers are entirely accustomed to getting bossed around by them; it just seems like a fact of life. [...] But to those of libertarian temperament, this is an unacceptable state of affairs.  Getting bossed around by government is bad enough.  But
  getting bossed around by an inanimate object?  Simply intolerable.</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/08/04/why-hackers-are-often-libertarians/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Count source code lines with grep</title>
		<link>http://www.pelennorfields.com/matt/2009/07/31/count-source-code-lines-with-grep/</link>
		<comments>http://www.pelennorfields.com/matt/2009/07/31/count-source-code-lines-with-grep/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 02:02:24 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/?p=1925</guid>
		<description><![CDATA[Here&#8217;s a handy way to count lines in C# source files using grep and wc, excluding (most) comments and blank lines:

grep -Pr --include=*.cs "^.+$" TargetDirectory &#124; grep -v "^\s*//" &#124; wc -l


Note, however, that this expression still counts comment blocks enclosed in /*  */&#8230;my grep-fu (and level of caring) evaporated once I recognized that [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a handy way to count lines in C# source files using <code>grep</code> and <code>wc</code>, excluding (most) comments and blank lines:</p>

<pre><code>grep -Pr --include=*.cs "^.+$" TargetDirectory | grep -v "^\s*//" | wc -l
</code></pre>

<p>Note, however, that this expression still counts comment blocks enclosed in <code>/*  */</code>&#8230;my grep-fu (and level of caring) evaporated once I recognized that fact, and the expression above got me close enough. If you&#8217;re using Visual Studio and have that option turned on that prefixes each extended comment line with an asterisk, you could modify the second expression slightly to become <code>^(\s*//)|(\s*\*)</code> and that should grab them.</p>

<p>Based on this calculation, I estimate that I&#8217;ve written about 60 lines per hour on a side project I&#8217;ve been working on this spring/summer. I&#8217;m not sure whether that&#8217;s good, bad, or (most likely) meaningless, which is about par for the course as far as statistics are concerned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/07/31/count-source-code-lines-with-grep/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why don&#8217;t I just take care of that, then</title>
		<link>http://www.pelennorfields.com/matt/2009/07/21/why-dont-i-just-take-care-of-that-then/</link>
		<comments>http://www.pelennorfields.com/matt/2009/07/21/why-dont-i-just-take-care-of-that-then/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 15:30:47 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Humor]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/?p=1922</guid>
		<description><![CDATA[I wish I had known about this (if it existed) three years ago. Better yet, I wish I&#8217;d invented it! As with all good ideas, it is both simple and beautiful. Now, at last, I have an appropriate way to answer the people who come to me asking inane questions before conducting even the most [...]]]></description>
			<content:encoded><![CDATA[<p>I wish I had known about this (if it existed) three years ago. Better yet, I wish I&#8217;d invented it! As with all good ideas, it is both simple and beautiful. Now, <em>at last,</em> I have an appropriate way to answer the people who come to me asking inane questions before conducting even the most rudimentary Google search.</p>

<p><a href="http://www.lmgtfy.com/?q=How+do+you+publish+a+website+in+VB.NET%3F" title="Here--let me Google that for you!">How <em>do</em> you publish a website in VB.NET, anyway?</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/07/21/why-dont-i-just-take-care-of-that-then/feed/</wfw:commentRss>
		</item>
		<item>
		<title>It&#8217;s better than rayyy-ee-ayyy-nnn</title>
		<link>http://www.pelennorfields.com/matt/2009/07/17/its-better-than-rayyy-ee-ayyy-nnn/</link>
		<comments>http://www.pelennorfields.com/matt/2009/07/17/its-better-than-rayyy-ee-ayyy-nnn/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 19:50:25 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Commentary]]></category>

		<category><![CDATA[Humor]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/?p=1918</guid>
		<description><![CDATA[&#8230;even on your wedding day!

I used to think Amazon Kindles were kind of neat, in an abstract &#8220;I&#8217;d probably never spend the money&#8221; sort of way. Today, though, I&#8217;m pretty convinced that I&#8217;ll never buy one due to the heavy-handed reminder that you don&#8217;t actually own any of those e-books you purchase from Amazon, you [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230;even on your wedding day!</p>

<p>I used to think Amazon Kindles were kind of neat, in an abstract &#8220;I&#8217;d probably never spend the money&#8221; sort of way. Today, though, I&#8217;m pretty convinced that I&#8217;ll never buy one due to the heavy-handed reminder that you don&#8217;t actually <em>own</em> any of those e-books you purchase from Amazon, you just <em>license</em> them. And Amazon might buy that license back from you at any time, without warning, as <a href="http://pogue.blogs.nytimes.com/2009/07/17/some-e-books-are-more-equal-than-others/" title="'Oops, changed our mind!'">they just did in the case of a particular (dead) author whose publisher decided to pull its content from the Kindle store</a>.</p>

<p>Of course, who could the author possibly be but George Orwell, and the titles pulled: <i>Animal Farm</i> and <i>1984</i>.</p>

<p>Not a joke, but so hilariously ironic that you have to wonder if it was staged.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/07/17/its-better-than-rayyy-ee-ayyy-nnn/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A little esprit de corps</title>
		<link>http://www.pelennorfields.com/matt/2009/06/19/a-little-esprit-de-corps/</link>
		<comments>http://www.pelennorfields.com/matt/2009/06/19/a-little-esprit-de-corps/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 17:43:33 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Humor]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/2009/06/19/a-little-esprit-de-corps/</guid>
		<description><![CDATA[I am gratified to learn that developers are born brave.

Of course, were we to unceremoniously carry this picture&#8217;s metaphor to its logical (yet bitter) end, we would realize that the developer&#8217;s only brave because he put the rat there in the first place. So perhaps the correct conclusion is that developers are born scary.

I&#8217;ll take [...]]]></description>
			<content:encoded><![CDATA[<p>I am gratified to learn that <a href="http://www.flickr.com/photos/9968089@N05/2491967672/sizes/o/" title="According to various and divers blogs, anyway.">developers are born brave</a>.</p>

<p>Of course, were we to unceremoniously carry this picture&#8217;s metaphor to its logical (yet bitter) end, we would realize that the developer&#8217;s only brave because he put the rat there in the first place. So perhaps the correct conclusion is that developers are born <em>scary.</em></p>

<p>I&#8217;ll take either one.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/06/19/a-little-esprit-de-corps/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Seen someplace</title>
		<link>http://www.pelennorfields.com/matt/2009/06/12/seen-someplace/</link>
		<comments>http://www.pelennorfields.com/matt/2009/06/12/seen-someplace/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 03:53:06 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Humor]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/2009/06/12/seen-someplace/</guid>
		<description><![CDATA[Command-line Russian roulette:

[ $[ $RANDOM % 6 ] == 0 ] &#38;&#38; rm -rf / &#124;&#124; echo '*click*'


I like it.
]]></description>
			<content:encoded><![CDATA[<p>Command-line Russian roulette:</p>

<pre><code>[ $[ $RANDOM % 6 ] == 0 ] &amp;&amp; rm -rf / || echo '*click*'
</code></pre>

<p>I like it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/06/12/seen-someplace/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Some design pleasantness</title>
		<link>http://www.pelennorfields.com/matt/2009/06/11/some-design-pleasantness/</link>
		<comments>http://www.pelennorfields.com/matt/2009/06/11/some-design-pleasantness/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 17:16:51 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Journal]]></category>

		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/?p=1913</guid>
		<description><![CDATA[I&#8217;ve landed at Marc Grabanski&#8217;s site a few times on the business end of Google searches about jQuery, and every time I end up there I find myself wishing I could come up with a blog title image like his. Take a look. I love it.

The other, similar illustration style I like a lot is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve landed at Marc Grabanski&#8217;s site a few times on the business end of Google searches about jQuery, and every time I end up there I find myself wishing I could come up with a blog title image like his. <a href="http://marcgrabanski.com/" title="I'd replace the Starbucks with my Bialetti stovetop maker">Take a look</a>. I love it.</p>

<p>The other, similar illustration style I like a lot is exemplified by <a href="http://www.joyent.com/" title="Vector art FTW!">Joyent</a>. I freely admit to having clicked all over their site just to find all the pictures of their cast of characters, even though I have pretty much nothing to do with what the company offers (again&#8211;landed there after a Google search of a technical problem). I particularly commend the <a href="http://www.joyent.com/developers" title="I generally look like that, sans laptop">developer</a> and the <a href="http://www.joyent.com/support" title="That smirk is perfect">support staff</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/06/11/some-design-pleasantness/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Egotistical roller coaster</title>
		<link>http://www.pelennorfields.com/matt/2009/06/05/egotistical-roller-coaster/</link>
		<comments>http://www.pelennorfields.com/matt/2009/06/05/egotistical-roller-coaster/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 18:09:00 +0000</pubDate>
		<dc:creator>Matt Winckler</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.pelennorfields.com/matt/2009/06/05/egotistical-roller-coaster/</guid>
		<description><![CDATA[If you&#8217;re a programmer, there is no excuse for not knowing about Stack Overflow. I&#8217;ve never seen such a high signal-to-noise ratio combined with such fast responses to programming-related questions. It seems to take me longer to compose a question than it does for the answer to show up in response to it. (Of course, [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re a programmer, there is no excuse for not knowing about <a href="http://stackoverflow.com" title="Brilliance on tap">Stack Overflow</a>. I&#8217;ve never seen such a high signal-to-noise ratio combined with such fast responses to programming-related questions. It seems to take me longer to compose a question than it does for the answer to show up in response to it. (Of course, this may merely indicate that I&#8217;m a simpleton asking stupid questions. Don&#8217;t tell anyone.) I like to give back to the community that helps me out, so although I don&#8217;t have time to slavishly answer questions all day long (the way the SO community seems to), I do my best to browse the <a href="http://stackoverflow.com/unanswered" title="The masses seek knowledge">unanswered questions</a> for a softball that a hack like me can handle. The drawback to this is that browsing the questions that go unanswered for any significant period of time is a major blow to the ego. There are some seriously smart people out there!</p>

<p>So in order to get my programming ego back in line, I usually have to browse over to <a href="http://thedailywtf.com" title="Curious Perversions in Information Technology">The Daily WTF</a> for a few minutes. Following that, I feel much better about myself, and everything balances out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelennorfields.com/matt/2009/06/05/egotistical-roller-coaster/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
