<?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>bc-programming.com</title>
	<atom:link href="http://bc-programming.com/blogs/feed/" rel="self" type="application/rss+xml" />
	<link>http://bc-programming.com/blogs</link>
	<description>Programming, Possums, and why you shouldn&#039;t mix the two.</description>
	<lastBuildDate>Thu, 29 Jul 2010 07:24:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=8148</generator>
		<item>
		<title>Parsing INI Files</title>
		<link>http://bc-programming.com/blogs/2010/07/parsing-ini-files/</link>
		<comments>http://bc-programming.com/blogs/2010/07/parsing-ini-files/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 07:24:03 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=234</guid>
		<description><![CDATA[If there is one thing that no two Operating Systems can seem to agree on, it&#8217;s how best to store configuration information. Linux programs generally store their configuration in .config files, which have a, ironically enough, &#8220;proprietary&#8221; text format (that is, program A&#8217;s config file will be unlikely to follow the same conventions as program [...]]]></description>
			<content:encoded><![CDATA[<p>If there is one thing that no two Operating Systems can seem to agree on, it&#8217;s how best to store configuration information. Linux programs generally store their configuration in .config files, which have a, ironically enough, &#8220;proprietary&#8221; text format (that is, program A&#8217;s config file will be unlikely to follow the same conventions as program B&#8217;s, and so forth). For Windows, there are a lot of options to choose from. the earliest model was a INI, or initialization file; an INI file was laid out something like this:</p>
<p><code><br />
[sectionname]<br />
valuename=value<br />
valuename2=value2<br />
[nextsection]<br />
morevalues=moreitems<br />
evenmorevalues=evenmoredata<br />
</code></p>
<p>Basically, it consisted of a set of &#8220;Sections&#8221; (the text in square brackets) each of which contained values (the name/value pairs within).</p>
<h3><u>WriteProfileString, ReadProfileString, WritePrivateProfileString and ReadPrivateProfileString</u></h3>
<p>
The two &#8220;private&#8221; variants of this Kernel32 function almost always appear in programming-oriented discussions about INI files, but the former two have been lost in time.</p>
<p>the &#8220;INI&#8221; file structure was essentially &#8220;standardized&#8221; as far as windows applications were concerned with Windows 3.0. This was more a de facto, rather then a de juere standard, because the win.ini, system.ini, and various other Windows system based &#8220;ini&#8221; files used that form. Windows 3.0 offered the WriteProfileString and ReadProfileString functions. These functions are still present, even in the windows 7 Version of kernel32.dll:</p>
<p><code><br />
C:\Windows\System32>dumpbin /exports kernel32.dll | find "ProfileString"<br />
        579  241 0001E6A7 GetPrivateProfileStringA<br />
        580  242 0003018B GetPrivateProfileStringW<br />
        606  25C 00032B13 GetProfileStringA<br />
        607  25D 00031E72 GetProfileStringW<br />
       1323  52A 00033FB8 WritePrivateProfileStringA<br />
       1324  52B 000335CA WritePrivateProfileStringW<br />
       1330  531 0008A982 WriteProfileStringA<br />
       1331  532 00033669 WriteProfileStringW<br />
</code></p>
<p>the non- &#8220;private&#8221; versions of these functions were pretty similar; there were also variations that allowed for writing/reading directly from integers as well as entire structures. Windows 3.0 only had the &#8220;non&#8221; private versions- and they all dealt exclusively with win.ini.</p>
<p>So, using WriteProfileString in kernel.dll, you could save your applications configuration data to and read it from a section in win.ini. This would have worked fine, with the minor inconvenience of a large win.ini file, but there was a caveat- the functions could not work with an INI file larger then 64K.</p>
<p>So, this technical limitation combined with the aftertaste of having a win.ini file that even comes near to approaching 64K guided the implementation of the &#8220;private&#8221; versions of these functions. These took, in addition to the values that the older functions did, a parameter specifying a filename. So now, applications could read and write values and sections to their own &#8220;private profile&#8221; INI files (thus the name). They still had the 64K limit, but this is hardly ever approached.</p>
<p>Fast forward a few years, and we have the Windows Registry. This is where Microsoft encourages us to save our application specific data. And I won&#8217;t argue- it works great. There is of course a minor caveat- it&#8217;s not as &#8220;user editable&#8221; as an INI file. if you ask somebody &#8220;change such and such value in program.ini&#8221; to solve a problem, they will usually have no problem, but ask them to change values in the registry and your asking for trouble, first- they could change the wrong value (after all, it&#8217;s pretty much a hierarchal version of the old win.ini, but without a size limitation), second, it&#8217;s not as &#8220;discoverable&#8221;. you can open an INI file, change it, make backups, etc. You can do this with a registry key but it&#8217;s not as simple and intuitive. backups involve exporting .reg files.</p>
<p>Now, with .NET, we are being encouraged to save our data into XML files. Are we not now back where we started? we started with text based INI files, moved to a monolithic binary hierarchal database, and we are now back to a text based format. The only real difference between INI and XML is the fact that XML is inherently heirarchal, so it&#8217;s easier to make code that works with either XML or the registry without problems. INI is limited to a fixed structure where there are two layers- the sections, and the values.</p>
<p>In either case, sometimes for a simple application there is no need to get involved in either the registry or XML; or, maybe you just like the simplicity and user-editability of an INI file. This is why I use INI files for most of my applications.</p>
<p>Given the fact that we have the API functions to work with INI files, you might think that my class-based solution may use them. This is not the case. you see, first, they are deprecated- second, they are limited to 64K, and lastly, and perhaps most importantly, they can sometimes not even read INI files at all- thanks to the fact that their functionality will often look in the registry for data. (this establishes it quite loudly as a compatibility function, not something to depend on for modern applications).</p>
<p>Instead, I opted to create a INI file parser. Thankfully, because of the simple structure it&#8217;s not hard to create something like this.</p>
<p>First, we need to think of an appropriate object model. we have sections, values, and the INI file itself. the base-level representation should be an abstract class that sections, and values can derive from:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; public abstract class INIItem</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public abstract override <span class="kw4">String</span> ToString<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>you may be thinking, &#8220;why make an abstract class?&#8221; well, consider for a moment, comments, in the INI file. by convention, an INI file can have comments inside it, indicated by a semicolon as the first non-space character on the line. We <i>could</i> simply discard them entirely, but ideally, we would preserve the comments between loading the INI file and saving it. Here, we can create a derived class representing a comment:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;public class INIComment : INIItem</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">String</span> Comment <span class="br0">&#123;</span>get;set;<span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; public INIComment<span class="br0">&#40;</span><span class="kw4">String</span> pComment<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Comment = pComment;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public override <span class="kw4">string</span> ToString<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> Comment;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>the Section itself can contain a list of INIItem objects, which can represent either INIComment or an INIDataItem, which is shown here:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;public class INIDataItem : INIItem</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">String</span> Name <span class="br0">&#123;</span> get; set; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">String</span> Value <span class="br0">&#123;</span> get; set; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public override <span class="kw4">string</span> ToString<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> Name + <span class="st0">&quot;=&quot;</span> + Value;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>At this point, I have decided that it would make sense to Load the INI file entirely into memory. INI files are usually small in size, and considering the convention with XML files is to keep the XMLDocument in memory it&#8217;s not that new of an approach.</p>
<p>Now, we need a INISection class; this will be used to represent each Section in an INI file; It needs a Name, a list of Values, and a &#8220;eolComment&#8221; (end of line comment) for when there is a comment on the same line.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;public class INISection</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public List&lt;INIItem&gt; INIItems;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">String</span> Name <span class="br0">&#123;</span> get; set; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">String</span> eolComment <span class="br0">&#123;</span> get; set; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public INISection<span class="br0">&#40;</span><span class="kw4">String</span> pName, <span class="kw4">string</span> peolComment, List&lt;INIItem&gt; Values<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Name = pName;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INIItems = Values;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>peolComment == <span class="kw2">null</span><span class="br0">&#41;</span> peolComment = <span class="st0">&quot;&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; eolComment = peolComment;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public INIDataItem this<span class="br0">&#91;</span><span class="kw4">String</span> index<span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INIDataItem returnthis =</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getValues<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">FirstOrDefault</span><span class="br0">&#40;</span><span class="br0">&#40;</span>w<span class="br0">&#41;</span> =&gt; w.<span class="me1">Name</span>.<span class="me1">Equals</span><span class="br0">&#40;</span>index, StringComparison.<span class="me1">OrdinalIgnoreCase</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>returnthis == <span class="kw2">null</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//returnthis = new INISection(index, null, new List&lt;INIItem&gt;());</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; returnthis = new INIDataItem<span class="br0">&#40;</span>index, <span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INIItems.<span class="me1">Add</span><span class="br0">&#40;</span>returnthis<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> returnthis;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//remove any existing value with the given name&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INIItem itemfound =</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getValues<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">FirstOrDefault</span><span class="br0">&#40;</span>w =&gt; w.<span class="me1">Name</span>.<span class="me1">Equals</span><span class="br0">&#40;</span>index, StringComparison.<span class="me1">OrdinalIgnoreCase</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>itemfound != <span class="kw2">null</span><span class="br0">&#41;</span> INIItems.<span class="me1">Remove</span><span class="br0">&#40;</span>itemfound<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INIItems.<span class="me1">Add</span><span class="br0">&#40;</span>value<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public IEnumerable&lt;inidataitem&gt; getValues<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach <span class="br0">&#40;</span>INIItem loopitem in INIItems<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INIDataItem casted = loopitem as INIDataItem;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>casted != <span class="kw2">null</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yield <span class="kw1">return</span> casted;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public override <span class="kw4">string</span> ToString<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="st0">&quot;[&quot;</span> + Name + <span class="st0">&quot;] (&quot;</span> + getValues<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">Count</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">ToString</span><span class="br0">&#40;</span><span class="br0">&#41;</span> + <span class="st0">&quot; Values, &quot;</span> +</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#40;</span>INIItems.<span class="me1">Count</span><span class="br0">&#40;</span><span class="br0">&#41;</span> &#8211; getValues<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">Count</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">ToString</span><span class="br0">&#40;</span><span class="br0">&#41;</span> + <span class="st0">&quot; Comments.&quot;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Now this can appear a bit more daaunting then it really is. The bulk of the code is in the indexer, which allows you to modify an INI file like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">INIFile myini= new INIFile<span class="br0">&#40;</span>INIFilename<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">myini<span class="br0">&#91;</span><span class="st0">&quot;section&quot;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&quot;value&quot;</span><span class="br0">&#93;</span>.<span class="me1">Value</span>=<span class="st0">&quot;a new value&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">Configurationsettions.<span class="me1">UseLongformat</span>=myini<span class="br0">&#91;</span><span class="st0">&quot;formatting&quot;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st0">&quot;uselongformat&quot;</span><span class="br0">&#93;</span>.<span class="me1">Value</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>It&#8217;s actually a lot shorter then it would have been had I not used lambda expressions:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;INIDataItem returnthis =</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getValues<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">FirstOrDefault</span><span class="br0">&#40;</span><span class="br0">&#40;</span>w<span class="br0">&#41;</span> =&gt; w.<span class="me1">Name</span>.<span class="me1">Equals</span><span class="br0">&#40;</span>index, StringComparison.<span class="me1">OrdinalIgnoreCase</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>first, this is operating on the IEnumerable being given back from getValues(); getValues is what is known as an iterator method, a simplified way to think of it is that the return value is a set of all the values that were &#8220;yield returned&#8221; from that function. In this case, getValues() returns all the items that can be cast to an INIDataItem. This ensures that the lambda expression used with FirstOrDefault() has access to the Name field to perform the appropriate comparison.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; public class INIFile</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public List&lt;INISection&gt; Sections <span class="br0">&#123;</span> get; set; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public INIFile<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sections = new List&lt;INISection&gt;<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public INIFile<span class="br0">&#40;</span><span class="kw4">String</span> filename<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LoadINI<span class="br0">&#40;</span>filename<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Indexer&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public INISection this<span class="br0">&#91;</span><span class="kw4">String</span> index<span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INISection returnthis =</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sections.<span class="me1">FirstOrDefault</span><span class="br0">&#40;</span><span class="br0">&#40;</span>w<span class="br0">&#41;</span> =&gt; w.<span class="me1">Name</span>.<span class="me1">Equals</span><span class="br0">&#40;</span>index, StringComparison.<span class="me1">OrdinalIgnoreCase</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>returnthis == <span class="kw2">null</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; returnthis = new INISection<span class="br0">&#40;</span>index, <span class="st0">&quot;&quot;</span>, new List&lt;INIItem&gt;<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sections.<span class="me1">Add</span><span class="br0">&#40;</span>returnthis<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> returnthis;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//remove any existing value with the given name&#8230;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INISection itemfound =</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sections.<span class="me1">FirstOrDefault</span><span class="br0">&#40;</span>w =&gt; w.<span class="me1">Name</span>.<span class="me1">Equals</span><span class="br0">&#40;</span>index, StringComparison.<span class="me1">OrdinalIgnoreCase</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>itemfound != <span class="kw2">null</span><span class="br0">&#41;</span> Sections.<span class="me1">Remove</span><span class="br0">&#40;</span>itemfound<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sections.<span class="me1">Add</span><span class="br0">&#40;</span>value<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; private <span class="kw4">static</span> INIDataItem ParseINIValue<span class="br0">&#40;</span><span class="kw4">String</span> valueline<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> equalspos = valueline.<span class="me1">IndexOf</span><span class="br0">&#40;</span><span class="st0">&#8216;=&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">String</span> valuename = <span class="st0">&quot;&quot;</span>, valuedata = <span class="st0">&quot;&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>equalspos == <span class="nu0">-1</span><span class="br0">&#41;</span> <span class="kw1">return</span> <span class="kw2">null</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; valuename = valueline.<span class="me1">Substring</span><span class="br0">&#40;</span><span class="nu0">0</span>, equalspos<span class="br0">&#41;</span>.<span class="me1">Trim</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; valuedata = valueline.<span class="me1">Substring</span><span class="br0">&#40;</span>equalspos + <span class="nu0">1</span><span class="br0">&#41;</span>.<span class="me1">Trim</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> new INIDataItem<span class="br0">&#40;</span>valuename, valuedata<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">void</span> LoadINI<span class="br0">&#40;</span><span class="kw4">String</span> Filename<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using <span class="br0">&#40;</span>var newreader = new StreamReader<span class="br0">&#40;</span>File.<span class="me1">OpenRead</span><span class="br0">&#40;</span>Filename<span class="br0">&#41;</span>, <span class="kw2">true</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LoadINI<span class="br0">&#40;</span>newreader<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newreader.<span class="me1">Close</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">void</span> LoadINI<span class="br0">&#40;</span><span class="kw4">String</span> Filename, Encoding pEncoding<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using <span class="br0">&#40;</span>var newreader = new StreamReader<span class="br0">&#40;</span>File.<span class="me1">OpenRead</span><span class="br0">&#40;</span>Filename<span class="br0">&#41;</span>, pEncoding<span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LoadINI<span class="br0">&#40;</span>newreader<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newreader.<span class="me1">Close</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">void</span> LoadINI<span class="br0">&#40;</span>StreamReader fromstream<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">String</span> currentline = <span class="kw2">null</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sections = new List&lt;INISection&gt;<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INISection globalsection = new INISection<span class="br0">&#40;</span><span class="st0">&quot;cINIFilecsGlobals&quot;</span>, <span class="st0">&quot;&quot;</span>, new List&lt;INIItem&gt;<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INISection currentSection = globalsection;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//while there is still text to read.</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>currentline = fromstream.<span class="me1">ReadLine</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> != <span class="kw2">null</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//trim the read in line&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentline = currentline.<span class="me1">Trim</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//if it starts with a square bracket, it&#8217;s a section.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>currentline.<span class="me1">StartsWith</span><span class="br0">&#40;</span><span class="st0">&quot;[&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//parse out the section name...</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">String</span> newsectionname = currentline.<span class="me1">Substring</span><span class="br0">&#40;</span><span class="nu0">1</span>, currentline.<span class="me1">IndexOf</span><span class="br0">&#40;</span><span class="st0">']&#8216;</span><span class="br0">&#41;</span> &#8211; <span class="nu0">1</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">String</span> eolComment = <span class="st0">&quot;&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>currentline.<span class="me1">IndexOf</span><span class="br0">&#40;</span><span class="st0">&#8216;;&#8217;</span><span class="br0">&#41;</span> &gt; <span class="nu0">-1</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; eolComment = currentline.<span class="me1">Substring</span><span class="br0">&#40;</span>currentline.<span class="me1">IndexOf</span><span class="br0">&#40;</span><span class="st0">&#8216;;&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentSection = new INISection<span class="br0">&#40;</span>newsectionname, eolComment, new List&lt;INIItem&gt;<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sections.<span class="me1">Add</span><span class="br0">&#40;</span>currentSection<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>currentline.<span class="me1">StartsWith</span><span class="br0">&#40;</span><span class="st0">&quot;;&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//add a new Comment INIItem to the current section.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INIItem newitem = new INIComment<span class="br0">&#40;</span>currentline<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentSection.<span class="me1">INIItems</span>.<span class="me1">Add</span><span class="br0">&#40;</span>newitem<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INIDataItem createitem = ParseINIValue<span class="br0">&#40;</span>currentline<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>createitem != <span class="kw2">null</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentSection.<span class="me1">INIItems</span>.<span class="me1">Add</span><span class="br0">&#40;</span>createitem<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>globalsection.<span class="me1">INIItems</span>.<span class="me1">Count</span><span class="br0">&#40;</span><span class="br0">&#41;</span> &gt; <span class="nu0">0</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sections.<span class="me1">Add</span><span class="br0">&#40;</span>globalsection<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">void</span> SaveINI<span class="br0">&#40;</span><span class="kw4">String</span> filename<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using <span class="br0">&#40;</span>StreamWriter swriter = new StreamWriter<span class="br0">&#40;</span>File.<span class="me1">OpenWrite</span><span class="br0">&#40;</span>filename<span class="br0">&#41;</span>, Encoding.<span class="me1">ASCII</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SaveINI<span class="br0">&#40;</span>swriter<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; swriter.<span class="me1">Close</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">void</span> SaveINI<span class="br0">&#40;</span><span class="kw4">String</span> filename, Encoding pEncoding<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using <span class="br0">&#40;</span>StreamWriter swriter = new StreamWriter<span class="br0">&#40;</span>File.<span class="me1">OpenWrite</span><span class="br0">&#40;</span>filename<span class="br0">&#41;</span>, pEncoding<span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SaveINI<span class="br0">&#40;</span>swriter<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; swriter.<span class="me1">Close</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; public <span class="kw4">void</span> SaveINI<span class="br0">&#40;</span>StreamWriter tostream<span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//save to the given stream.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach <span class="br0">&#40;</span>INISection loopsection in Sections<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//don&#8217;t write out &quot;[global]&quot; for the global section, if present.</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>!loopsection.<span class="me1">Name</span>.<span class="me1">Equals</span><span class="br0">&#40;</span><span class="st0">&quot;cINIFilecsGlobals&quot;</span>, StringComparison.<span class="me1">OrdinalIgnoreCase</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tostream.<span class="me1">Write</span><span class="br0">&#40;</span><span class="st0">&quot;[&quot;</span> + loopsection.<span class="me1">Name</span> + <span class="st0">&quot;]&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>loopsection.<span class="me1">eolComment</span>.<span class="me1">Length</span> &gt; <span class="nu0">0</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tostream.<span class="me1">WriteLine</span><span class="br0">&#40;</span><span class="st0">&quot; &nbsp;&quot;</span> + loopsection.<span class="me1">eolComment</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tostream.<span class="me1">WriteLine</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach <span class="br0">&#40;</span>INIItem itemloop in loopsection.<span class="me1">INIItems</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tostream.<span class="me1">WriteLine</span><span class="br0">&#40;</span>itemloop.<span class="me1">ToString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>And that&#8217;s the INIFile. the INIFile itself has a Indexer similiar to what  the INISection class has, but it deals with the list of Sections. relatively straightforward, for the most part. LoadINI and SaveINI are both overloaded with a few different parameters, from passing in a StreamReader/Writer to simply giving a filename. For reading in an INI file into a class structure we simply read every line (the while ((currentline = fromstream.ReadLine()) != null) loop ) and take an appropriate action based on what we find- if it starts with a square bracket, it&#8217;s treated as a section. a new section is added with that name, and the local variable &#8220;currsection&#8221; is changed to point to it. if it starts with a semicolon it is treated as a comment (and an appropriate INIComment object is added to the INISection pointed at by currsection, which by default is an imaginary &#8220;global&#8221; section). Otherwise if there is an equals sign in the line, it is parsed (using the ParseINIValue() function) into a appropriate INIValue object, and that object is added to the current section.</p>
<p>writing it back into a stream is pretty much the opposite; loop through all the sections, and for every section, if the name is not the globally defined intrinsic item, then write out the appropriate section header (the name in square brackets), as well as any end of line comment defined for that section. then loop through all the values and write out the ToString() from it as a single line. (remember, the INIComment will return a comment line (starting with <img src='http://bc-programming.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  and the INIDataItem object will return a properly constructed Name=Value string.</p>
<p>The Full Source can be downloaded here:</p>
<p><a href="http://bc-programming.com/downloads/files/Code/cINIFile.cs">CINIFile.cs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/07/parsing-ini-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IS there something wrong with changing requirements?</title>
		<link>http://bc-programming.com/blogs/2010/07/is-there-something-wrong-with-changing-requirements/</link>
		<comments>http://bc-programming.com/blogs/2010/07/is-there-something-wrong-with-changing-requirements/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 05:50:26 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Humour]]></category>
		<category><![CDATA[idiots]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=227</guid>
		<description><![CDATA[recently, I stumbled upon a ridiculous thread regarding system requirements for &#8220;Counter-strike: Source&#8221;. Well, I wouldn&#8217;t say stumbled, it was actually linked in a TheDailyWTF thread. the Poster claims that it&#8217;s &#8220;Unfair&#8221; that they can no longer play the game using a system that fits the specifications of the original &#8220;boxed&#8221; copy. They go so [...]]]></description>
			<content:encoded><![CDATA[<p>recently, I stumbled upon a ridiculous thread regarding system requirements for &#8220;Counter-strike: Source&#8221;. Well, I wouldn&#8217;t say stumbled, it was actually linked in a TheDailyWTF thread.</p>
<p>the Poster claims that it&#8217;s &#8220;Unfair&#8221; that they can no longer play the game using a system that fits the specifications of the original &#8220;boxed&#8221; copy.</p>
<p>They go so far as to claim that valve did this intentionally in order to force people to upgrade, which seems clearly ridiculous since upgrading doesn&#8217;t help them at all. Most of the people in the discussion (which, for reference, can be found <a href="http://forums.steampowered.com/forums/showthread.php?t=1363620&#038;page=2">here</a>) have clearly acquired their entire understanding of the justice system and law on episodes of Law &#038; Order, which, I&#8217;m sorry to say, wouldn&#8217;t help them pass their Bar exam. They have an equally deficient understand of anything remotely programming related.</p>
<p>They claim that Valve did this on purpose. First, Why? What do they have to gain? Sure, they did it on purpose, but I suspect the reason is that the API is almost completely different between all of DX7, DX8, and DX9, and they assumed that somebody who played a game as fad-inspired as Counter-strike would no longer be using a 11 year old video card.</p>
<p>From where I stand it sounds like a bunch of teenagers complaining about how they can no longer &#8220;pwn noobs&#8221; because their ATI Rage Pro is no longer fully supported. The cries to upgrade fall on deaf ears, because the have no jobs and rely entirely on their allowance to get anything at all. This is further proven by the fact that the complainant claims to actually understand anything about Law. Nobody understands anything about law. Nobody. Even lawyers simply pretend to understand. All &#8220;law&#8221; is apparently based on precedent (according to the law expert that is this particular CSS player, an oxymoronic statement I would rather not repeat) so it makes me wonder why they bother to write up all these other things. They quote a legal link as it it matters, with absolutely zero inference to the fact that A:) the product on their &#8220;box&#8221; is NOT the same product they have on their PC.</p>
<p>They are absolutely free to install the game form their original disks, and refuse all updates. They won&#8217;t be able to play online, but that restriction is clearly NOT COVERED by the law. So they can shove their links right back up their ass where they pulled them from.</p>
<p>This is one of the things that pisses me off. people pretending they know what they talk about when they are merely pulling arguments out of their ass or even out of thin air, and basing their entire stance on the subject on pure assumption. It really pisses off those of us who do know what we are talking about (hahaha)</p>
<p>I mean, for Possum&#8217;s sake, these people play COUNTER-STRIKE, and at the same time claim to have some sort of depper understanding of Legal issues. What a bunch of dumbasses. Hardly anybody who has an IQ higher then about 60 plays Counter strike, and those that do at least understand the basic premise that a software update changes the software in question and different software will have different requirements. Bitching and complaining because your 10 year old PC can no longer run a fully updated copy of a game you bought 9 years ago is like complaining to microsoft because the changed software scene has essentially antiquiated the minimum requirements they specified for nearly all their Operating Systems. When they were released they were minimum, and recommended, and they fit the description, but as software grew larger and adapted to the various changes the requirements became meaningless. Do we sue Microsoft because we can no longer run XP comfortably with 64MB of RAM? No, of course not. XP SP3 changed XP but the biggest factor is the different software being used.</p>
<p>And their constant cries &#8220;IT&#8217;S EEZEE TO FIX LOL ROXOR I GONNA {PLAY COUNTOR STRIKWERH NOW DUHG&#8221; clearly indicates they have no idea what they are  talking about. First, unless they have actually seen the source code, what needs to be changed, the regression testing that will need to be performed, the layout of involved data structures, and so forth, they cannot make a claim that &#8220;it&#8217;s easy&#8221; and since they clearly have not seen any of that they are basing their claim entirely on their observation of what that code does, which is <absolutely> no indication of the complexity of the code itself. Besides, they couldn&#8217;t understand the code anyway, but like most teenagers they like to think they do, despite their absolutely lack of the proper cognitive processes to do so. (most of the appropriate brain cells died in a mass suicide while they played Counter-strike)</p>
<p></absolutely></p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/07/is-there-something-wrong-with-changing-requirements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Phrase Examination II: &#8220;A penny saved is a penny earned&#8221;</title>
		<link>http://bc-programming.com/blogs/2010/07/phrase-examination-ii-a-penny-saved-is-a-penny-earned/</link>
		<comments>http://bc-programming.com/blogs/2010/07/phrase-examination-ii-a-penny-saved-is-a-penny-earned/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 23:08:40 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[Phrase examination]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=192</guid>
		<description><![CDATA[In today's episode of phrase examination, I examine the phrase "A Penny saved is a penny earned".]]></description>
			<content:encoded><![CDATA[<p><i>See the previous post in this series: <a href=http://bc-programming.com/blogs/2010/07/phrase-examination-1-happy-as-a-clam> Phrase Examination I: &#8220;happy as a clam&#8221;</a></i></p>
<p>In today&#8217;s episode of phrase examination, I examine the phrase &#8220;A Penny saved is a penny earned&#8221;.</p>
<p>This saying is usually used when somebody either finds a small amount of money or has made arrangements in which they save a small amount of money.</p>
<p>However, the concept is flawed! you see, saving a penny indicates placing it somewhere for safety and for the express purpose that it be spent or used later. Following this, it doesn&#8217;t matter how that money is acquired originally- stolen money can be saved just as easily as earned money.</p>
<p>Therefore, while on the surface the phrase is harmless, what it&#8217;s really doing is <i>encouraging criminals</i> the phrase essentially says that if you steal money, you&#8217;ve properly earned it simply by saving it. What utter nonsense that is, I say! The real meaning should be more like &#8220;A Penny Earned should be a penny saved&#8221;, since not only does it make assertions that are logical fallacies such as saying that all pennies that are saved were all earned. Since earn, by definition, means &#8220;acquire or deserve by one&#8217;s efforts or actions&#8221; they are saying indirectly (but quite clearly) that if you save money, no matter wether you stole it or acquired it by selling drugs or other illegal means, you still earned it legitimately. I take issue with this. </p>
<p>While assertions such as direct comparision saying &#8220;X is Y&#8221; when it is clear that not all of X can possibly be Y are rather common when it comes to phrases, this is one of the few that actually encourages criminal behaviour. Do we really want our children to learn these sayings? When a young child finds a penny on the street, do their parents say &#8220;a penny saved is a penny earned&#8221;? because a day might come where it is revealed that that child has saved up millions of dollars that they had stolen through embezzlement and theft, should we hold the parents responsible for telling their children that this is right? Should we allow these vagrant assertions to rule our daily lives, and fray the very fabric of morality in all of us for the purpose of a single cute saying?</p>
<p>I for one say no, I say no to these asserted logical fallacies and the results that they bring, and I encourage everybody to curtail their use of such ridiculous phrases!</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/07/phrase-examination-ii-a-penny-saved-is-a-penny-earned/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Phrase Examination 1: &#8220;happy as a clam&#8221;</title>
		<link>http://bc-programming.com/blogs/2010/07/phrase-examination-1-happy-as-a-clam/</link>
		<comments>http://bc-programming.com/blogs/2010/07/phrase-examination-1-happy-as-a-clam/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 21:26:49 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[Phrase examination]]></category>
		<category><![CDATA[barnacles]]></category>
		<category><![CDATA[bear bait]]></category>
		<category><![CDATA[clams]]></category>
		<category><![CDATA[exploded weevil]]></category>
		<category><![CDATA[mussels]]></category>
		<category><![CDATA[rusty bucket bay]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=188</guid>
		<description><![CDATA[In a new type of post I will class &#8220;Phrase Examination&#8221; I will examine common metaphorical phrases that, when examined deeper, often have deep existential implications. For example, often times, people, myself included, will use the phrase &#8220;Happy as a clam&#8221;. from the context, it suggests that clams are in fact happy. However, how do [...]]]></description>
			<content:encoded><![CDATA[<p>In a new type of post I will class &#8220;Phrase Examination&#8221; I will examine common metaphorical phrases that, when examined deeper, often have deep existential implications.</p>
<p>For example, often times, people, myself included, will use the phrase &#8220;Happy as a clam&#8221;. from the context, it suggests that clams are in fact happy.</p>
<p>However, how do we know a clam is happy? How do we even know a clam is capable of emotion? Oftentimes, I&#8217;ve wondered, since I really have too much time on my hands, wether it might actually be a reference to the clam&#8217;s physical shape itself, how, when you look at a clam from a isometric viewpoint, the clam often appears to be wearing a smile, which to the uneducated observer can seem to run to infinity. Of course, such a concept is rather foolish- a smile is defined as &#8220;a facial expression characterized by turning up the corners of the mouth; usually shows pleasure or amusement&#8221;. of note here are the terms &#8220;facial&#8221; and &#8220;mouth&#8221; a clam has no face, and the bivalve&#8217;s two-halves hardly form a &#8220;mouth&#8221; as much as it forms a &#8220;concave environment in which it spends it&#8217;s entire life&#8221;. Additionally, the concept is based entirely on a viewpoint- from above the clam. if you do the same from the bottom, the clams metaphorical expression becomes one of deep emo-like sadness, the type that makes you wonder if it cuts itself because it&#8217;s not worth it&#8217;s own blood.</p>
<p>Another Clam-related phrase, or more precisely, clam-related word, is the word &#8220;clammy&#8221; which means moist and warm, and can usually apply to nearly everything in a warm humid environment. contrariwise, the Clam is a saltwater bivalve that lives in seawater in the temperate regions of the Earth. under the water the humidity is at a constant 100%, for reasons I hope i need not explain, but the Clam doesn&#8217;t only live in warm water, nearly anything in the temperate region is suitable. Additionally, it&#8217;s cold-blooded, so the implication that warmth+moistness somehow implicates a relation to clams is only half-true, and truly the word &#8220;lobstery&#8221; or &#8220;octopussy&#8221; could apply equally as well. (although I think the latter is used to mean &#8220;deactivating a nuclear warhead at the last second while wearing a clown-suit that a colleague was killed in&#8221; or even as an alternative form to mean pulling the old &#8220;swithcharoo&#8221; where, for example, you replace a priceless artifact with a fake of the same artifact and take the original for yourself.). And of course such such words are far more sound metaphorically.</p>
<p>But back to the existential implications of a clam&#8217;s emotions. It&#8217;s rather rather stupid to assume it has emotions. And certainly if it does the predominant one cannot possibly be happiness, but rather complete and utter boredom. I mean, the creature spends nearly it&#8217;s entire life completely motionless, filtering the fish crap from the ocean and eating it. Now, I&#8217;m no food critic, but fish crap is hardly my definition of fine dining. Sure, clams have a foot and can even swim, so they aren&#8217;t completely immobile, but you never watch horror movies about piranha-like clams that strip a creature to the bone in seconds, nope, such honours are reserved for piranhas (although I suppose my simile comparing clams to piranha&#8217;s sort of gave that away) which reminds me of that awful 1978 &#8220;piranha&#8221; movie. Which of course buys into the whole notion that pirahna will eat anything. which is ignoring all the scientific efforts I put in years ago! Why, during my experiments, I was trying to figure out why piranhas will reduce a monkey to the bone, but leave a baked potato untouched. It was important scientific research, and if I had discovered why I might have cured cancer. I believe this is the same facility where we were performing experiments to do the following:</p>
<p>-make a cat laugh<br />
This had important connotations. First, we needed to determine wether cat&#8217;s simply had no sense of humour, or perhaps they were only amused by certain kinds of humour. We were unable to make a cat laugh, even after years of experimenting.  We were certain we saw some smiles on the cats when we showed them makeshift propaganda videos that depicted a great cat leader telling his cat followers that they had finally taken every single grain silo in the world, and it was time to begin phase 2. This video was produced by a strange fellow named Catty Felinous McKitten, whom we later discovered wasn&#8217;t a human at all but rather an inpromptu and unexpected alliance between the OCAWYCAFALWCFOD (Old Cats Against Whatever the Young Cats Are For and Also Like Wet Cat Food as Opposed to Dry) and the young cats, who by that time had decided on the name &#8220;Young Cats Who Hate Animaniacs and Will Ally With Older Cats Only When It Serves All Catkind In Their Struggle For Control of the World&#8217;s Grain Supply&#8221; known by the shorthand YCWHAWAWOCOWISACITSFCWGC. (pronounced why chwa wah wookow isackit cerwug gik).</p>
<p>-turn a piece of toast back into bread. </p>
<p>This was really a spin off of a previous experiment where we tried to turn a cooked boiled egg back into a raw egg. I forget the exact reasons, but it was somehow related to extending the battery life of AAA batteries. Also, the market demand for an untoaster would reach unprecedented levels, on account of the fact that toasters have this tendency to either overtoast or undertoast, and with the technology behind an untoaster one could integrate the two using a series of low-quality timers like those used in toasters today to make it so that regardless of how skewed or useless the thermosistor used in the &#8220;darkness&#8221; knob is, the toast will always come out perfect, and if it is too dark you could set it the &#8220;untoast&#8221; mode and resolve that easily. It was discovered however that simply using a less shitty variable resistance timer on a actual toaster one can make one that works properly. No company has tried this, and only a few expensive  (nearly 20 dollars) models are in existence.</p>
<p>-devising haircutting technology for frogs</p>
<p>We quickly met a dead end after many years of simulations when we realized that frogs didn&#8217;t have hair. we them wasted the next few years performing similar simulations for tadpoles, when the same was revealed for them. However, we were able to apply the haircutting technology successfully on true tadpoles (people with 1/8th or less Polish descent). The invention would have changed the world- it consisted of two blades, each with a single handle,  connected using a single flexibly axis. by using the thumb to hold onto one handle and the rest to hold the other side, one can easily cut paper hair, and other similarly low shear strength materials. funding stopped when it was realized that what we invented was actually a pair of scissors.</p>
<p>-creating a unit for measuring freedom</p>
<p>With this we hope to rate a number of first-world countries based on their &#8220;freedom quantity&#8221;. our initial attempts to devise the system were common among those trying to devise a unit of measure- we chose two reference points, and gave them values. We chose the freedom inside a prison as the low point, and the freedom of a bird as the high point. However, our progress soon slowed as we started arguing amongst ourselves about exactly how free a bird truly is, and wether a animal needs to be sentient to actually be free. Additionally, many birds are placed in cages, so the simile &#8220;as free as a bird&#8221; cannot possibly compare to them. Not to mention the fact that Canary&#8217;s were used extensively to test the dangers of deep areas of a mine. (except in areas, such as Canada, where Canary cages were hard to come by. We improvised and just sent some chinese guys, which worked out fine&#8230; well, for us, not necessarily for the chinamen)- (serious sidebar: this is absolutely true, that and even more inhumane acts, such as sending them in to explode dynamite without giving them enough time to get away. This was during the building of the transcontinental Canadian Railroad, which was a condition of British Columbia&#8217;s entrance into the confederation. Additionally, the line itself served as a buffer to keep those nasty American&#8217;s from yelling &#8220;manifest destiny&#8221; and scoffing up the remaining parts of British North America not yet confederated as provinces or territories)</p>
<p>-make a clam smile</p>
<p>This was actually a offshoot from the initial discussion about &#8220;happy as a clam&#8221; that we had in the lunchroom. We all agreed that since seeing a clam smile was completely dependent on your perspective, we should try to make it so the clam truly forms a smile in the traditional sense. We did modify our definition and define the &#8220;mouth&#8221; as the bivalve opening, And we did have to stop our experiments on howler monkeys, AND we never did get clams to smile. We wrote the experiment off after a few years as &#8220;as hard to do as getting a cat to laugh&#8221; difficulties which we of course had first hand knowledge of.</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/07/phrase-examination-1-happy-as-a-clam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YA2012P (Yet another 2012 Post)</title>
		<link>http://bc-programming.com/blogs/2010/07/ya2012p-yet-another-2012-post/</link>
		<comments>http://bc-programming.com/blogs/2010/07/ya2012p-yet-another-2012-post/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 21:51:00 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=183</guid>
		<description><![CDATA[Alright, so I sort of touched on this subject before, but I feel I need to revisit it for no reason. Also, because I can do whatever I damn well please. Now, as you are no doubt aware, there is quite a furor about &#8220;the end of the world&#8221;&#8230; well, more precisely, there was. as [...]]]></description>
			<content:encoded><![CDATA[<p>Alright, so I sort of touched on this subject <a href="http://bc-programming.com/blogs/2010/03/how-2012-type-crap-starts/">before</a>, but I feel I need to revisit it for no reason. Also, because I can do whatever I damn well please.</p>
<p>Now, as you are no doubt aware, there is quite a furor about &#8220;the end of the world&#8221;&#8230; well, more precisely, there was. as 2012 approaches it appears that they are changing their tune &#8220;well, it won&#8217;t be the end, but everything will change!&#8221;.</p>
<p>For &#8220;facts&#8221; proponents refer to the mayans, Nostradamus, and the bible.</p>
<p>for Facts.</p>
<p>please, tell me they aren&#8217;t serious?</p>
<p>First, they claim that the Mayans &#8220;knew&#8221; there was going to be a major change in our history. How? magic? Did a people who couldn&#8217;t even master the length of the solar year actually have somehow mastered time travel and seeing into the future? No. Of course not. Sure, their civilization was advanced, but if they couldn&#8217;t predict their civilizations own death I really don&#8217;t think it&#8217;s very smart to  believe any of their &#8220;predictions&#8221; (did anybody account for the fact that their solar calendar was busted, anyway?).</p>
<p>And don&#8217;t get me started on Nostradamus. Biggest phony ever. &#8220;hey, guys, I have an idea, I&#8217;ll write down completely meaningless gibberish and say it&#8217;s prophecy, and people will believe it and connect the dots for me.&#8221;</p>
<p>The sad thing is nobody sees it! They are purposely vague not because &#8220;he didn&#8217;t understand today&#8217;s technology or the various changes that he &#8220;saw&#8221;" but rather because if he was specific they would be wrong.</p>
<p>The fact that any otherwise reasonable human being with a solid understanding of either physics or the nature of space can even give any sort of creedence to an obvious fake and even go so far as to evangelize his name (well, if he predicted it, it&#8217;ll come true).</p>
<p>Except he didn&#8217;t predict anything! That&#8217;s the problem I have with it. If I wrote down that in 2013:</p>
<p>a great power will rise. Many will be killed.<br />
The Koala bear roams free. eucalyptus suffers.<br />
Olives drop. All dead. Great bird eats grapes for breakfast.</p>
<p>And enough people believed it &#8220;it would happen&#8221; not because I predicted it, but the very vague nature of the words opens them up to so many interpretations that during the course of the year it&#8217;s certain that there is a timeline that could fit this random gibberish. This doesn&#8217;t even touch on the fact that the man was french, so all of these predictions are translated. I decided to do a little digging, namely about his &#8220;power&#8221; to predict world events; for example, here is the original french passage that &#8220;predicted world war 2&#8243;:</p>
<blockquote><p>
    Bêtes farouches de faim fleuves tranner;<br />
    Plus part du champ encore Hister sera,<br />
    En caige de fer le grand sera treisner,<br />
    Quand rien enfant de Germain observa. (II.24)
</p></blockquote>
<p>Now, according to the website I originally found this the translation of this to english was:</p>
<blockquote><p>
Beasts wild with hunger will cross the rivers,<br />
The greater part of the battle will be against Hitler.<br />
He will cause great men to be dragged in a cage of iron,<br />
When the son of Germany obeys no law.
</p></blockquote>
<p>Note <specifically> how names and places are mentioned quite clearly. But this is a biassed translation- the translator restricted an otherwise vague quatrain to fit his own purposes. The literal translation is:</p>
<blockquote><p>
Beasts mad with hunger will swim across rivers,<br />
Most of the army will be against the Lower Danube.<br />
The great one shall be dragged in an iron cage<br />
When the child brother will observe nothing.
</p></blockquote>
<p>As with any of his passages, and even his strongest proponents agree &#8220;his predictions only become crystal clear after they have occured&#8221;.</p>
<p>What the fuck kind of use is that? &#8220;Oh, he can predict the future, but we can only know what it means after it happens&#8221; So, basically, he purposely phrased his quatrains in a vague, completely meaningless way and as I said those who want to are able to give meaning to any passage. It&#8217;s really quite simple, and the fact that people actually believe this utter and complete bullshit is beyond me. Not to mention they even go so far as to invent propesized events- apparently he predicted 9/11, but he didn&#8217;t. the entire thing was a hoax. So the real question is how many of his &#8220;predictions&#8221; are either biassed translations or completely fabrications? I find it interesting because a large quantity of his &#8220;followers&#8221; can&#8217;t even read french.</p>
<p>This is a rather similar case as with the bible itself. Now, I have no problem with Christians of course, and the bible certainly contains words that anybody can live by.</p>
<p>But it&#8217;s a spiritual guidebook, not a prophetic gypsy book. The problem is the bloody thing has been translated and re-translated that even if the original was in some way &#8220;the word of god&#8221; it&#8217;s become so mangled and filtered by so many people translating it between different languages that it&#8217;s only natural for some parts to lose cohesion.</p>
<p>It, just like most &#8220;predictions&#8221; is also rather vague, using symbolic imagery to try to pain a picture of the future (in those parts people claim it does that).</p>
<p>Now, the problem here is that the only place that &#8220;symbolic imagery&#8221; and &#8220;predictions&#8221; should ever be used in the same sentence is when you are referring to the horoscopes in a newspaper. No reasonable person is going to read a horoscope for their sign that says:</p>
<blockquote><p>
There could be some friction in your place of work or group gathering today, and it will be up to you to take the middle ground. Pay attention to the minor details in connection with a major project, because it&#8217;s the little things that will make the final picture work.
</p></blockquote>
<p>and actually believe it (well, nobody who is completely sane, anyway) because it&#8217;s often wrong and it&#8217;s sufficiently vague it could apply to nearly anything. and if you add the fact that desperate times calls for creating new meanings for literal words&#8230; for example, a die-hard advocate, upon seeing that t his has absolutely no relevance to anything whatsoever might try to say &#8220;well, maybe the friction represents&#8230;&#8221; or &#8220;by &#8220;middle ground&#8221; they must mean&#8230;</p>
<p>it&#8217;s all a load of smoke and mirrors and it&#8217;s the fact that these people understand, either conciously or sub-consciously, how the human mind has an arcane, even magical, ability to fill in the blanks and create connections where there are none. It&#8217;s really no more then a optical illusion with ideas and words. When you see the classic optical illusion whereby two images of the same size are placed on a perspective plane, do you truly believe that the object that appears larger (because it is &#8220;farther back&#8221;) is really larger?</p>
<p>No, of course not. Once you remove the backdrop of the perspective line and vanishing point the entire thing is clearly not as it seems. So too can people cleverly insert &#8220;perspective lines&#8221; in our very own perceptions of words. Just as our Visual Cortex fills in many blanks for us when there isn&#8217;t enough information, or as part of our perceptions (for example, our perception of contrast, colour, and so forth, can be changed by merely introducing a few lines, just as the way an entire scene looks can be changed by introducing a single element. So too does our mind &#8220;fill in the blanks&#8221; for many other topics. More precisely, we see what isn&#8217;t there because we <b>want</b> to see what isn&#8217;t there.</p>
<p>Many people have capitalizee on this.</specifically></p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/07/ya2012p-yet-another-2012-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The deadly Microconda snake</title>
		<link>http://bc-programming.com/blogs/2010/07/the-deadly-microconda-snake/</link>
		<comments>http://bc-programming.com/blogs/2010/07/the-deadly-microconda-snake/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 11:57:40 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=148</guid>
		<description><![CDATA[I previous discussed the dangers of the deadly giant Earthworm. Recently, a new discovery has been made, the tiny Anaconda, which has been dubbed the &#8220;MicroConda&#8221;. This is a force to be reckoned with. The Life cycle of the Microconda consists of the following phases: First, they are born as a sort of virus. Microscopic [...]]]></description>
			<content:encoded><![CDATA[<p>I previous discussed the dangers of the deadly <a href="http://bc-programming.com/blogs/2010/01/the-greatest-threat-to-mankind/">giant Earthworm</a>. Recently, a new discovery has been made, the tiny Anaconda, which has been dubbed the &#8220;MicroConda&#8221;.</p>
<p>This is a force to be reckoned with. The Life cycle of the Microconda consists of the following phases:</p>
<p>First, they are born as a sort of virus. Microscopic in size, and they infect bacteria that live in a mammal&#8217;s intestines. The bacteria don&#8217;t die, but the MicroConda Larvae virus infiltrates the cell nucleus and changes the mitocondrial DNA to collect phosporus from the bloodstream. This is used and combined to create a photosensitive mitochondria. The virus then uses it&#8217;s powers of nucleic persuasion to do this to two mitochondria, forming eyes. A side effect (and therefore a symtom of microCondal infection) is that all excrement from the mammal will glow bright Orange. Once the infected bacteria are released in this fashion,they seep into the ground where they are ingested by tree roots. Through a process known as osmosis, the tree sap (as well as the infected/mind-controlled bacteria) finds it&#8217;s way to the forest canopy, and finds it&#8217;s way into a leaf.At this point, the larvae form simply waits until a leaf-miner caterpillar eats it. It infects the caterpillar and reprograms it so that it eats almost three times as fast as your standard leaf-miner. At the same time, it reprograms the DNA instructions that will be &#8220;executed&#8221; when the caterpillar enters it&#8217;s chrysalis. The leaf-miner, due to it&#8217;s larger intake of food grows to epic proportions, to the point where it is nearly 3 feet long. Since this is readily visible to predators, the virus creates a networked computer system inside the caterpillar, using the caterpillars organs as a sort of Bio-Nemetic processor. Using this, it also puts up a meta-phasic shield around the caterpillar, which turns any predator within 3 feet of it into a flaming mess.</p>
<p>At this point, the larvae sets a course for the most stable branch of the tree, and begins the reconfiguration process by initiating the formation of a chrysalis. During this time, the larvae has created a sort of replicator technology and protects the chrysalis using a metal alloy, in addition to the shields described earlier.</p>
<p>During the reconfiguration process, the larvae reconfigures the caterpillar slightly so that instead of forming a butterfly, it creates a small interstellar spacecraft that is capable of faster then light travel (easier then it sounds really, in fact the butterflies as they are today are really a result of a cosmic ray that hit one of the first evolved caterpillars and knocked it&#8217;s gene sequence out of whack, so that they all have the &#8220;do not form a interstellar light-speed capable starship&#8221; gene.). Once the larvae emerges in it&#8217;s newfound starship, it spends exactly 13 nights hovering around the globe in front of very drunk and paranoid people, as well as those who like to form UFO conspiracy theories, knowing full well that not only will they think they were much larger then they were but also that they were real starships.</p>
<p>After the 13-day rest, the larvae sets course for Mars, where it sits dormant in the Martian soil in order to confuse scientists. It makes a deliberate effort to try to be scooped up in any Rovers that come by, in an attempt to further confuse people about wether there is life on Mars. After (usually in vain) waiting there for another 13 years, the Larvae (yes, it&#8217;s still a larvae) powers up it&#8217;s Engines and sets course away from Earth. This is where the cycle get&#8217;s confusing- Nobody really knows what happens to it, but it always returns on Memorial Day 15 years later at exactly 10:00 PM GMT, which is the exact time Oprah is on in Little Rock Arkansas, but because of the memorial day parades and stuff the Larvae doesn&#8217;t get to see it. Because of it&#8217;s long isolation on Mars, it blames humanity for it&#8217;s troubles, and is intent on causing at least 3 unsolved mysteries and one cold case that is eventually blamed on the victims father on law. It does this by cleverly shooting each subject in the face with a AA torpedo, which is similar to a Photon Torpedo but instead of a Engine driving by fictitious warp plasma it runs on 2 AA batteries. the cold case is inevitably solved in some way or another by the Larvae leaving behind one of the batteries.</p>
<p>About this time, it faces the alter-ego of itself- the Boogers. These are formed when the Larvae accidentally infects a caterpillar that becomes a moth instead of a Butterfly. Due to the increased complications involved in trying to reprogram the moth to become a spaceship (unlike the butterfly, which as I stated would naturally metamorphose into a Interstellar starship if not for the supression gene) the Moth instead has a gene that suppresses it from becoming Liam Gallagher, who, ineffectually, is in fact the single case where the Larvae was unable to change the DNA fast enough to prevent the onset of Gallagralitis.</p>
<p>Those Microconda Larvae which, after reading through a few pages of the code comments on the Caterpillar&#8217;s DNA, determine that they are in fact inside the wrong type of caterpillar, set quickly to work on trying to limit the damage and try ot set them to metamorphize into something more useful. The lucky ones are able to cause the Caterpillar to metamorphize into a large perfect cube of mucus, which have been dubbed &#8220;boogers&#8221; by most 5 year olds who have seen it. The unlucky ones (only one so far) are unable to prevent the inevitable and accidentally cause the caterpillar to metamorph into Liam Gallagher. Thankfully, this has only happened once, and the other few instances were deep in the jungle where he lived his life out as a Howler Monkey. (actually wait, that&#8217;s the same as the one who managed to pass as human&#8230; oh well).</p>
<p>Now, back to the &#8220;boogers&#8221;. Now, As I said, these were the lucky ones. they were able to salvage their situation and still create a interstellar starship with metaphasic shielding, however, the one difference is that they have to wait nearly 60 hours for their outter layer of mucus to try before they enter lightspeed. As it happens, they often encounter the more successful &#8220;butterfly&#8221; marvae when they return from their sabbatical on Mars. The Boogered Moth only has one goal in mind, assimilation of everything else. It wants to integrate everything into it&#8217;s collective. however, unlike the species that I am obviously basing this off, they are a lot smaller. Most of their drones consist of grasshoppers and the occasional Lichen, neither of which are very useful. The &#8220;mucus&#8221; implants are really just a thin coating of mucus that does nothing to enhance their abilities, and there is no need to supress their will because, I mean, their grasshoppers, lichens, and a few stray bits of fluff. Oh, and some wasps. The wasps are probably the easiest to control I would imagine, they have one of the simplest DNA programs. So anyway, they inevitably meet with the vastly superior Butterfly version, and they engage in combat- Usually in and around the Asteroid belt, where the Butterfly Larvae is able to fire far more AA torpedoes then it had originally. The Booger cube uses it&#8217;s established defense tactic of moving lazily to the left, which keeps the Butterfly version on it&#8217;s toes.</p>
<p>The outcome is different everytime.</p>
<p>Well, that&#8217;s not true, there are only 4 possibilities:</p>
<p>1. the Butterfly Larvae wessel destroys the booger cube</p>
<p>2. The Booger cube assimilates the Butterfly larvae ship.</p>
<p>3. Both are destroyed in an ambush by T.I.E fighters</p>
<p>4. Neither one is destroyed, and the butterfly larvae instead moves into a career as a rock musician, while the Booger cube supresses it&#8217;s &#8220;pretty&#8221; gene a little further and becomes a common member on &#8220;The View&#8221;.</p>
<p>Now, the Butterfly larvae wins most of the time, being that the Booger Cubes best defense against the AA torpedoes are mucus torpedoes, which aren&#8217;t very useful. At this point,  regardless of who wins, they celebrate by visiting my Aunt Martha for a bowl of Brown beans. Yes, she is intricately involved in the ecology of a species. I warned her that she was breaking the Prime directive, then I realize that was a completely fictitious law and it was a lot funner to do the opposite anyway. It actually all started when she left the spaghetti leftovers in the fridge for nearly a year. by the time somebody found them they had already grown sentient and had even started their own version of American Idol. (And no, being sentient and watching American Idol don&#8217;t <always> create an oxymoron). Apparently they had been holding frequent referendums between those spaghetti strands that lived touching the sauce (known as saucicans) and those not touching the sauce (whose name isn&#8217;t important, I think they called them John Mayer&#8217;s because of their intrinsic boring quality.) Anyway When my Uncle Ruddiger opened it up, he released the Flying Spaghetti monster, and it has become a ridiculous meme on internet forums and chatrooms ever since. The flying Spaghetti Monster laid eggs and gave birth to the very first Microcondan life forms, which are really only snake-like for a few days.</p>
<p>Anyways, After visiting my aunt Martha, the spend the next 2 years going back in time and just barely making it back, and finally decide that while they don&#8217;t necessarily like Fresca, it&#8217;s not the worst drink in the world, and it&#8217;s certainly good to hae around fort diabetics, who are rather sensitive to their sugar intake. After havingthis epiphany, the StarShip&#8217;s Self-destruct is activated and the Larvae leaves using an escape pod, this escape pod is in fact a long slender organic mass, and is a snake like form as well. At this point it hides itself in Cajun cooking and is ingested. There it lays it&#8217;s eggs and is excreted, and then flushed down the toilet. It makes it&#8217;s way to the sewage treatment plant, where, by careful planning, it manages to sabotage the entire place so that instead of outputting treated sewage it gives out Coca Cola (it only takes a few minor adjustments and a touch of lemon). With it&#8217;s newfound business sense, it now roams across the country converting sewage treatment plants to Coca-Cola bottling knock-off plants. However it is soon discovered that the MicroConda isn&#8217;t actually a human being, which puts a dent in his credibility (namely, the large speech bubble on every can saying &#8220;Yes, I am a human being&#8221;. It slinks off into the shadows, returning only shortly to plan a trip to the Amazon Rainforest where it grew up. At this point, in a twisted set of logic, the Microconda is thinking &#8220;haha, I am so doing this of my own free will, my base instincts would never send me back to the rainforest I grew up, when in fact, that is exactly what is happening. Little does he know it, but the cycle is about to complete.</p>
<p>So, he goes on a tour in the rainforest, pretty much the same one that they filmed that Anaconda film on. Speaking of which, that film was pretty awful. Anyways, once there, it ends up getting in a rather heated debate over toilet paper brands with a local Howler monkey, and soon things start getting personal, both sides start questioning the parentage of the other, the promiscuity of each of their mothers is brought up, as well as their immense weight and various other negative traits. (around this  time it becomes clear that while one is a howler monkey and  the other is a Microconda that a fraction their size, both of their mothers are some sort of diesel or other high octane fuelled locomotive.</p>
<p>After much debate, they both decide to settle their differences by agreeing to disagree, and they both go out for soda. The Microconda, because of his previous epiphany, orders a Fresca. The Howler monkey starts (what else) an intelligent debate about the carcinogenic effects of aspartame, to which the Microconda eloquently replies that there is no real solid evidence either way, and until there is an established, medically sound report that conclusively proves otherwise he wasn&#8217;t going to let nonsense rule over his choices. The howler monkey, at this time, requests that  they have butt sex, which the Microconda of course politely declines, &#8220;It&#8217;s not you, it&#8217;s me, I don&#8217;t have an anus&#8221; he replies. The howler Monkey, heartbroken but quite understanding to the Microconda suggests that he have anal reconstructive surgery in which he can finally achieve his lifelong dream of owning an Anus.</p>
<p>After many years of planning the operation, Dr A. Tear finally decides that it is doable. So, on the following Tuesday, The Microconda finally has an operation to give him an Anus. The Observatorium is packed with onlookers, I was among them- I distinctly recall ordering two hot dogs and a ice cold beer from the fellow selling refreshments, in fact, which I ate and drank while watching the Microconda being torn a new butt-hole, so to speak. Or should I say literally&#8230; I don&#8217;t know.</p>
<p>Unfortunately in the second half of the operation there were complications, namely, Dr. Ass Tear forgot which side of the Microconda was his new butt and which one was his mouth, and started working on the wrong side. This was quickly corrected when I threw my shoe at him from a distance.</p>
<p>After recovering from the surgery for nearly 12 minutes, the Dr. declared it was a complete success. At that point he informed us that he&#8217;d like to keep the Microconda here for at least a week for observation, which seemed fine to me, I mean, I was only sort of related to him through my Aunt martha, and even that was a Dubious connection. The Howler monkey did (what else?) differential equations to pass the time, and tutored his many advanced astrophysics students in the finer points of Einsteins Special theory of relativity, namely the importance of reference frames. Or maybe that the General theory. I don&#8217;t know, I was reading some awful MacCleans magazines from 1994. </p>
<p>After the Microconda recovered, he prompty returned home to his wife, Mrs.Howler monkey, with whom he engaged in frequent butt sex. Unfortunately, during one such episode, the chainsaw they were using became sentient and wrote rude words on the floor. The landlady of the area was not impressed at all and evicted both of them, where they both lived on the street as vagrants for a year before finally starting their own restaurant, &#8220;Howling Snake&#8221; It was mildly successful, at least until that incident where started to murder anybody who tried to pay with a discover card. Once again homeless vagrants in addition to being fugitives from the law, they started to live the homeless life which consisted of mostly not having a home. They made small change by having the Howler monkey do (what else) derived calculus equations on the street for money. unfortunately, their luck quickly got a lot worse. on a trip to the amazon rainforest, The Microconda caught a mild disease known as the &#8220;uncommon cold&#8221;. On his death bed, and dying of an unrelated anal aneurysm, the Microconda promised that wherever they met again, butt sex would surely follow. the Howler monkey did (what else?) spatial IQ puzzles. Shortly after, the Microconda died of Natural causes. As his last request, he wanted to be burned, transformed into a fine paste, spread on toast, and thrown into the rainforest. Nobody knows why- the common belief is that it was the fashion of the time. In any case, certain cells regenerated and formed new MicroConda Virii which continued the cycle once again.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6956635606003080";
/* 728x90, created 4/3/10 */
google_ad_slot = "6964619233";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></always></p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/07/the-deadly-microconda-snake/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>It&#8217;s not network lag unless there is a network involved.</title>
		<link>http://bc-programming.com/blogs/2010/05/its-not-network-lag-unless-there-is-a-network-involved/</link>
		<comments>http://bc-programming.com/blogs/2010/05/its-not-network-lag-unless-there-is-a-network-involved/#comments</comments>
		<pubDate>Tue, 11 May 2010 23:09:48 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[General Computing]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[lag]]></category>
		<category><![CDATA[networks]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=144</guid>
		<description><![CDATA[In the early days of networked gaming (I mean, the days of Doom- (not to things like imaginet)) connections were slow. If a game or application tried to pump too much data over the connection- it would take time. Also, sometimes the architecture itself and the hardware involved introduced a sort of &#8220;time-delay&#8221; into the [...]]]></description>
			<content:encoded><![CDATA[<p>In the early days of networked gaming (I mean, the days of Doom- (not to things like imaginet)) connections were slow.</p>
<p>If a game or application tried to pump too much data over the connection- it would take time. Also, sometimes the architecture itself and the hardware involved introduced a sort of &#8220;time-delay&#8221; into the equation. This was called &#8220;network lag&#8221;- a doom game might not be enjoyable due to network lag, for instance.</p>
<p>As Online gaming has become more prevalent and requires less PC familiarity, the term has started to be used completely erroneously in all sorts of situations.</p>
<p>For example- if your PC is underpowered for a new game, or you set the detail to high and it runs slowly, it&#8217;s not &#8220;lag&#8221; because there is no actual lag between your actions and what you see on screen. the term &#8220;lag&#8221; was originally used to indicate the time difference between when you pressed a key and when the server acknowledged you pressing that key. since even with the lowest framerates your key presses are being sent to the buffer in your local machine immediately. The term practically redefined itself when games such as quake implemented client-side prediction- you could see another player moving forward, and, instead of stopping dead as your PC is awaiting game state information, the client continues to draw that character moving in that direction. </p>
<p>The short story is- &#8220;Lag&#8221; is completely unrelated to framerate. they are separate. You can have a high lag/ping and a low framerate, or vice versa, or both, but that doesn&#8217;t suddenly make them interchangable. </p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/05/its-not-network-lag-unless-there-is-a-network-involved/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>&#8220;Spending my internets&#8221;</title>
		<link>http://bc-programming.com/blogs/2010/04/spending-my-internets/</link>
		<comments>http://bc-programming.com/blogs/2010/04/spending-my-internets/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 13:35:48 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[Humour]]></category>
		<category><![CDATA[everybody loves raymond]]></category>
		<category><![CDATA[free waffles]]></category>
		<category><![CDATA[hey look a bird]]></category>
		<category><![CDATA[internets]]></category>
		<category><![CDATA[potato chips]]></category>
		<category><![CDATA[tuesday night]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=142</guid>
		<description><![CDATA[During my time on forums and various online communities, I have acquired multiple internets, through my hard work. for example, providing the exact information somebody needs can often get me a "+1 internets for you", or creating a powerful burn on a troll member can often get me an internet as well.]]></description>
			<content:encoded><![CDATA[<p>During my time on forums and various online communities, I have acquired multiple internets, through my hard work. for example, providing the exact information somebody needs can often get me a &#8220;+1 internets for you&#8221;, or creating a powerful burn on a troll member can often get me an internet as well.</p>
<p>I banked up my internets, and now that I was low on funds, I tried to spend them. I decided to try to simply get some potato chips.</p>
<p>&#8220;that&#8217;s 1.49&#8243;</p>
<p>&#8220;how much is that in internets?&#8221;</p>
<p>&#8220;Excuse me&#8221;</p>
<p>&#8220;I don&#8217;t have any Canadian dollar on me, but I do have some Internets to my name; how many internets is that worth.</p>
<p>&#8220;we don&#8217;t take internets&#8221;</p>
<p>Imagine my horror, in discovering that this entire exchange of internets between online personas was nothing more then a sham. I stopped eating entirely, not because I lost my appetite but because I had quit my job under the impression that the many internets I&#8217;d earned over the years would be more then enough to sponsor my early retirement.</p>
<p>Every store I tried either said &#8220;we don&#8217;t take internets&#8221;, started laughing, or called for security. the security personnel were even worse, I tried bargaining with them- &#8220;if you let me go, I&#8217;ll give you some of my internets!&#8221; but they were unresponsive. could it be that the 8 dollars an hour they were making was somehow more valuable then the completely unquantifiable representation that is the internet? </p>
<p>A word of advice to all those like me- do NOT try to spend your internets! they are worthless! when somebody says &#8220;+1 internetz for you&#8221; it is <just A SAYING!> do not open up your checkbook and try ot pay off that money you owe your mother in law by writing &#8220;pay to the order of Ms. Schelzburg the sum of +1 internets and +2 intranets&#8221; It doesn&#8217;t work. It&#8217;s a sham I tell you! </just></p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/04/spending-my-internets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Mystery of the broken script</title>
		<link>http://bc-programming.com/blogs/2010/04/the-mystery-of-the-broken-script/</link>
		<comments>http://bc-programming.com/blogs/2010/04/the-mystery-of-the-broken-script/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 01:47:09 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[broken]]></category>
		<category><![CDATA[dead skin cells]]></category>
		<category><![CDATA[gumbi]]></category>
		<category><![CDATA[inside out socks]]></category>
		<category><![CDATA[mystery]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[the scary door]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=130</guid>
		<description><![CDATA[For quite some time I&#8217;ve been wrestling with a mysterious issue. You see, I have several COM components. COM, is, to be usable from the various Script languages installed with windows. I encountered this some time ago when creating a small demonstration script file, something along the lines of the following, which simply showed a [...]]]></description>
			<content:encoded><![CDATA[<p>For quite some time I&#8217;ve been wrestling with a mysterious issue.</p>
<p>You see, I have several COM components. COM, is,  to be usable from the various Script languages installed with windows. I encountered this some time ago when creating a small demonstration script file, something along the lines of the following, which simply showed a files size:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">Set</span> BCFS = <span class="kw1">CreateObject</span><span class="br0">&#40;</span><span class="st0">&quot;BCFile.BCFSObject&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">Set</span> ffile = BCFS.<span class="me1">GetFile</span><span class="br0">&#40;</span>WScript.<span class="me1">Arguments</span><span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">WScript.<span class="me1">echo</span> BCFS.<span class="me1">FormatSize</span><span class="br0">&#40;</span>ffile.<span class="me1">Size</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>Very basic.</p>
<p>However, upon running it, I was greeted with the helpful dialog shown in figure 22-1.<br />
<div id="attachment_131" class="wp-caption alignleft" style="width: 500px"><img src="http://bc-programming.com/blogs/wp-content/uploads/2010/04/helpful.png" alt="VBScript ActiveX Error" title="helpful" width="490" height="227" class="size-full wp-image-131" /><p class="wp-caption-text">Fig 22-1: VBScript Error</p></div></p>
<p>For some reason or another, the ActiveX Object simply couldn&#8217;t be created (I gathered this after many long hours of research). My first &#8220;retry&#8221; was simple- I at first simply assumed that I had to run as administrator, so I started a command prompt as administrator, and ran it again.</p>
<p>Same error.</p>
<p>This was getting to be annoying. I tried a equal script in JScript/ECMAScript or whatever the hell it&#8217;s called these days:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">BCFS = <span class="kw1">new</span> ActiveXObject<span class="br0">&#40;</span><span class="st0">&quot;BCFile.BCFSObject&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">ffile = BCFS.<span class="me1">GetFile</span><span class="br0">&#40;</span>WScript.<span class="me1">Arguments</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">WScript.<span class="me1">echo</span><span class="br0">&#40;</span>BCFS.<span class="me1">FormatSize</span><span class="br0">&#40;</span>ffile.<span class="me1">Size</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>It failed as well. so it wasn&#8217;t because of something I was doing wrong in the script. I then tried an alternative; I created a Visual Basic Project, and ran similar code.</p>
<p>It was able to create and use the object with absolutely no difficulty.</p>
<p>I was beginning to find this whole exercise at least as intriguing as it was frustrating. I decided to explore what happened with other operating Systems with VMWare. The script ran fine in Windows 2000 and Windows XP (assuming of course I had installed BCSearch or otherwise had BCFile.dll properly installed). However, it continued to fail. I went into a test frenzy. It failed on Windows 7 on both my laptop and desktop, worked in all my VMWare installations (including Vista) I was stymied.</p>
<p>Then, I ran it on two copies of Windows XP I had on my laptop. Windows XP Pro worked fine. Windows XP x64 did not.</p>
<p>So it was an architecture issue, I surmised. Going on that, I came to the realization that a 64-bit executable cannot instantiate a 32-bit COM object, at least, not an In-Process (DLL) COM object. This was likely the source of the error. I Ran a simple script with a msgbox() that would keep the Script runner running, and then opened Process Explorer.</p>
<p>Not surprisingly, the WScript.exe Process was 64-bit, this was the cause of my problems. the fix? Run the WScript or CScript in %systemroot%\syswow64\ instead. I did so, and the script ran without incident.</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/04/the-mystery-of-the-broken-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The importance of keyboard layout</title>
		<link>http://bc-programming.com/blogs/2010/04/the-importance-of-keyboard-layout/</link>
		<comments>http://bc-programming.com/blogs/2010/04/the-importance-of-keyboard-layout/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 03:05:00 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[General Computing]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=127</guid>
		<description><![CDATA[For the user interface between a user and a computer, the basic options are mouse, and keyboard. Of course, joypads and joysticks are available and can be programmed to do all sorts of things, but such interface devices are generally used only for games. For the seasoned Computer user, the keyboard is, IMO, far more [...]]]></description>
			<content:encoded><![CDATA[<p>For the user interface between a user and a computer, the basic options are mouse, and keyboard. Of course, joypads and joysticks are available and can be programmed to do all sorts of things, but such interface devices are generally used only for games.</p>
<p>For the seasoned Computer user, the keyboard is, IMO, far more powerful then the keyboard as far as strength of association and muscle memory is concerned. buying a new mouse that has a different shape can feel &#8220;Strange&#8221; for a while, but for me it takes maybe a few days, or a week. Buying a new keyboard with a different layout for the various &#8220;periphery&#8221; keys can take me upwards of a month.</p>
<p>As a user learned about the computer, eventually so too does their understanding of how various commands are done with the keyboard. When a person first learns to use a word processor, for example, they may use the Copy and Paste options on the menu, or in the toolbar. However, as they use these features more and more, they eventually discover, are told, or otherwise learn about the keyboard shortcuts for performing these tasks. In the same fashion, they will start out by selecting text, moving throughout their document, and so forth solely with the mouse. Eventually, they discover arrow keys, and later, the control block keys.</p>
<p><b>Arrow keys</b></p>
<p>The arrow keys were originally only present in the number pad area of the original IBM PC and XT keyboards. With the AT keyboard, the arrow keys were introduced and have traditionally been present beneath the control block keys, to the right of the main alphabetic keyboard block.</p>
<p>Today, the Arrow keys serve a myriad of functions. within any Windows edit box when it has the focus, the arrow keys can  be used to move about a document. in combination with the Shift key, such movement is accompanied by the selection of the text. combined with the Control key, the selection moves a word at a time. A seasoned keyboarder will always beat out a mouser at the same text operation. The reason is mostly because, for typing, ones hands are both busy, well, typing. in order to click a button, toolbar, or menu, one needs to move their main hand (depending on their left or right handed ness) and move the mouse, and click it&#8217;s button. in contrast, one can perform the same task of most toolbar buttons using a number of keyboard shortcuts.</p>
<p><b>Control Block keys</b></p>
<p>For what I do with my computer, which involves a lot of editing of programming code, blog entries, web page files, and forum posts, the control block keys have become invaluable. The control block keys are the often ignored block of keys consisting of the Insert, Home, Page Up, Page Down, End, and Delete keys. When used properly, and in conjunction with modifier keys such as Control and Shift, one can perform a myriad of functions that take 5 or 10 seconds using the mouse. Use of these keys for selecting, copying, pasting, and moving text around has become almost second nature for me. However, this streamlined use completely disappears when I am forced to use a new keyboard whose layout differs. my current keyboard (MS Wired 500) has the control block keys in a vertically biased rectangle consisting of Home and End, Insert and Page Up, and Delete and Page down.</p>
<p>when I first bought the keyboard, such a layout was clunky and took a lot of work to get used to. it ruined many a programming and debugging session as my mind was taken from the task and hand and instead had to focus on retraining my muscle memory. It took nearly, if not over a month before I became as proficient as I was. Oddly enough, my laptop used a even stranger layout, whereby the control block keys were aligned down the right side of the keyboard in a single column- Home,Page up, Page down, End. Delete is positioned in a horizontal block of keys above those, containing what is often the rightmost set of function keys on the top of the keyboard, Print Screen, Pause, Insert, and Delete. due to this layout the Delete key is actually right above the home/end&#8230; etc block of keys. The laptop I use now, a Toshiba Satellite L300, has a keyboard layout very similar to it&#8217;s &#8220;ancient&#8221; predecessor whose layout I was used to, my Satellite Pro 440CDX. the 440CDX had a few &#8220;quirks&#8221; in the keyboard department, for example, the windows and application keys were moved from their normal position on the bottom row to the left and right of the spacebar, respectively, to pinky stretching positions at the upper right, where my newer model satellite has the insert and delete keys, who, on the 440 CDX, took up positions to the immediate left of the Tilde key, which was also moved to the bottom row of keys with the space bar. So the bottom row went Ctrl, Fn, Alt, Spacebar, Tilde/backtick, Insert,Delete left, down, right. this made any attempt to use the right alt key (which, admittedly, is usually rather neglected on the average keyboard anyway) actually press the tilde/grave key. However, and perhaps more important, attempts to press tilde (which, having to type the short file name for long file names comes up more often then some people might expect) will type escape. Which could do any number of things.</p>
<p>Anyway, my point is, it was completely different from the normal keyboard I was using for my desktop. And yet I was equally fluent with it, as it became my main development machine for quite some time (I&#8217;m referring to the 440CDX). Therefore the main cause for such familiarity isn&#8217;t really a set number of &#8220;memorized&#8221; layouts, but rather frequency of use. To test, I started up my old laptop. I noticed several interesting changes keyboard wise. for some reason, I had difficulty typing keys in the upper left. my fingers would try to strike a key that they/I thought was there, only to meet the spot between two keys or pressing hte wrong key altogether. Additionally, and not strictly related to the keyboard, I found myself having the exact opposite problem I did when I first went to adjust to the newer laptop; mouse movement.</p>
<p>The older laptop used the TrackPoint II, or licensed clone, which is a small stick sticking out between the g and h keys on the keyboard. it&#8217;s nearly stationary and detects angular movement on the stick and converts it to mouse movement on-screen. the newer technology that has become the norm for laptops is the touchpad. I cursed loudly when trying to use this at first, often trying to use the trackpoint instinctively to move to mouse, only to meet with nothing, then remembering the touchpad, cursing again, etc.. basically, it took some getting used to.</p>
<p>However, now, whenever I fire up the old 440CDX to make sure it hasn&#8217;t died, I find myself trying to move the mouse cursor with a non-existent touchpoint. The exact opposite issue I had when first adopting it.</p>
<p>That being said, the first conclusion one might reach is that learning the touchpad &#8220;pushed&#8221; the trackpoint II out of my mind. However, I believe this is purely a case of how much I use it; if I used them both equally, I&#8217;d probably always know exactly which one to use based on some other number of unknown mental stimuli that tell me which one it is, much as I know automatically wether to use the Desktop control keys or the laptop control keys based when I&#8217;m using one or the other. It&#8217;s rather a case of how often I haven&#8217;t used the trackpoint that has caused it to become a &#8220;second attempt&#8221; sort of interface.</p>
<p><b>Function keys</b> </p>
<p>Another important and often described as &#8220;advanced&#8221; group of keys are the Function keys present on the top row of most keyboards. It was these keys that made my wireless keyboard completely unusable to me. Each block of keys is traditionally separated into groups of four. For some reason, the designers of my wireless keyboard decided to do so in groups of three. This completely screws up every single thing I do with any key other then F1,F2, and F3. For example, Pressing Control-F9 &#8220;naturally&#8221; (via &#8220;muscle memory&#8221; on that keyboard makes me press F7- the first key on the third set of keys. I would need to literally retrain my brain to use that keyboard as well, and I&#8217;d rather not go through the angst I did previously, especially not for a very specific layout which probably will not become standard even among MS keyboards.</p>
]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/04/the-importance-of-keyboard-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
