<?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>MarkPNeyer.com &#187; Code</title>
	<atom:link href="http://www.markpneyer.com/wp/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markpneyer.com/wp</link>
	<description>Finding Interesting, Useful, and Beautiful Mathematical Patterns in the Universe</description>
	<lastBuildDate>Tue, 18 Oct 2011 01:11:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simplicity vs Speed</title>
		<link>http://www.markpneyer.com/wp/2009/07/09/simplicity-vs-speed/</link>
		<comments>http://www.markpneyer.com/wp/2009/07/09/simplicity-vs-speed/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 14:17:30 +0000</pubDate>
		<dc:creator>MarkPNeyer</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.markpneyer.com/wp/?p=427</guid>
		<description><![CDATA[This is a post about programming practices and design in general. Even if you&#8217;re not a programmer, you should read this and let me know what you think.
Consider these two C++ classes:

class SimpleFrobulotron
&#123;
  public:
&#160;
	SimpleFrobulotron&#40;const string &#38;name&#41;;
	string getName&#40;&#41;;
&#160;
  private:
	string m_Name;
&#125;;  
&#160;
class FastFrobulotron
&#123;
  public:
&#160;
	FastFrobulotron&#40;const string &#38;name&#41;;
	void getName&#40;string * outName&#41;;
&#160;
  private:
   [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post about programming practices and design in general. Even if you&#8217;re not a programmer, you should read this and let me know what you think.</p>
<p>Consider these two C++ classes:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> SimpleFrobulotron
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
&nbsp;
	SimpleFrobulotron<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> string <span style="color: #000040;">&amp;</span>name<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	string getName<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #0000ff;">private</span><span style="color: #008080;">:</span>
	string m_Name<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>  
&nbsp;
<span style="color: #0000ff;">class</span> FastFrobulotron
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
&nbsp;
	FastFrobulotron<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> string <span style="color: #000040;">&amp;</span>name<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">void</span> getName<span style="color: #008000;">&#40;</span>string <span style="color: #000040;">*</span> outName<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #0000ff;">private</span><span style="color: #008080;">:</span>
    string m_Name<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></pre></div></div>

<p>The main difference between the two designs is simple: The SimpleFrobulotron is easier to understand and use, but somewhat slower than the FastFrobulotron. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">void</span> printFrobulotronNames<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	SimpleFrobulotron simple<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;tweedle dee&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	FastFrobulotron fast<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;tweedle dum&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #666666;">//display the simple frobulotron's name</span>
	<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> simple.<span style="color: #007788;">getName</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #666666;">//display the fast frobulotron's name</span>
	string fastName<span style="color: #008080;">;</span>
	fast.<span style="color: #007788;">getName</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>fastName<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> fastName <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Is FastFrobulotron really <em>that</em> much faster than SimpleFrobulotron? A test on my machine shows that FastFrobulotron runs in 27% of the time that SimpleFrobulotron runs in. So it is clear that there&#8217;s a trade off here: Simplicity versus Speed. Code that squeezes every last bit of performance out of the machine is harder to understand. What side of this trade off do you favor, and why?</p>
<p>In this case, I think the answer is obvious: returning a string from a function is much slower than assigning it through a pointer. This is a simple enough optimization that most good programmers should be able to look at the code and understand what&#8217;s going on. Therefore it&#8217;s best to make use of it. Things can get much more complicated than this simple example, though. </p>
<p>Writing code that does what it&#8217;s supposed to do is something most programmers can do (unless you give them the <a href="http://en.wikipedia.org/wiki/Halting_problem">halting problem</a>.)  Writing code that&#8217;s easy to understand, however, is not. Neither is writing code that is as efficient as possible. The problem is that these two goals (simplicity and efficiency) seem to be at odds with each other. How do you balance between the two?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markpneyer.com/wp/2009/07/09/simplicity-vs-speed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another Bad Design</title>
		<link>http://www.markpneyer.com/wp/2009/07/02/another-bad-design/</link>
		<comments>http://www.markpneyer.com/wp/2009/07/02/another-bad-design/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 19:58:12 +0000</pubDate>
		<dc:creator>MarkPNeyer</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.markpneyer.com/wp/?p=424</guid>
		<description><![CDATA[I use iTunes to manage the music on my iPhone.  I went to add a bunch of music into my library, and a window popped up saying it was &#8220;Adding files.&#8221; There was a &#8220;stop&#8221; button, and a progress bar. This progress bar started off with a blue cursor on the left side, and [...]]]></description>
			<content:encoded><![CDATA[<p>I use iTunes to manage the music on my iPhone.  I went to add a bunch of music into my library, and a window popped up saying it was &#8220;Adding files.&#8221; There was a &#8220;stop&#8221; button, and a progress bar. This progress bar started off with a blue cursor on the left side, and that blue cursor gradually moved to the right. I presumed that when the blue cursor reached the right edge of the bar the work would be done.</p>
<p>I was wrong. Once it got to the right edge of the bar, the cursor just wrapped around and appeared at the left edge again. I understand the point of having some sort of animated graphic to indicate that work is being done, but why a progress bar?  A progress bar should only be used if it shows the extent to which the work has been completed. To indicate &#8230;  <em>progress. </em>A better design would be to have some kind of spinning wheels or gears, to make it clear that you have no idea how long you&#8217;re going to be waiting until you can listen to &#8220;I Wanna Sex You Up&#8221; by Color Me Badd. If, you know, you wanted to listen to that song.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markpneyer.com/wp/2009/07/02/another-bad-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On Genetics, Programming Languages, and God</title>
		<link>http://www.markpneyer.com/wp/2009/06/26/on-genetics-programming-languages-and-god/</link>
		<comments>http://www.markpneyer.com/wp/2009/06/26/on-genetics-programming-languages-and-god/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 14:34:36 +0000</pubDate>
		<dc:creator>MarkPNeyer</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Philosophy]]></category>
		<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://www.markpneyer.com/wp/?p=406</guid>
		<description><![CDATA[The genetic code is the programming language used to make living organisms.  Right now, biologists are attempting to &#8216;reverse engineer&#8217; this genetic code, in order to determine how it works and to make changes to it. I (in my infinite wisdom) think they&#8217;re going about this the wrong way.
To understand why, we must first delve [...]]]></description>
			<content:encoded><![CDATA[<p>The genetic code is the programming language used to make living organisms.  Right now, biologists are attempting to &#8216;reverse engineer&#8217; this genetic code, in order to determine how it works and to make changes to it. I (in my infinite wisdom) think they&#8217;re going about this the wrong way.</p>
<p>To understand why, we must first delve into the languages of computers. When humans program computers, they usually write in &#8220;high level languages&#8221;, which look like a series of mathematical formulas and instructions.  Here is an example of a simple function to compute the nth <a title="Fibonacci Number" href="http://en.wikipedia.org/wiki/Fibonacci_number" target="_blank">Fibonacci Number</a>, written in a high level language called C:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//computes the nth fibonacci number</span>
<span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span> fibonacci<span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span> n<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span> term1 <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span> term2 <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span> result <span style="color: #339933;">=</span> term2<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">&lt;</span> n<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		result <span style="color: #339933;">=</span> term1 <span style="color: #339933;">+</span> term2<span style="color: #339933;">;</span>
		term1 <span style="color: #339933;">=</span> term2<span style="color: #339933;">;</span>
		term2 <span style="color: #339933;">=</span> result<span style="color: #339933;">;</span>
		i <span style="color: #339933;">=</span> i <span style="color: #339933;">+</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> result<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The Computer cannot understand this program as it is written. It must be translated into instructions that make sense to the computer. This  translation process is called <em>compiling</em>. The compiled program will look different depending upon what computer it is compiled on, but all computers basically operate the same way: they can read from and write to memory locations, and they can add, multiply, divide, and subtract numbers.  Here is an English-language translation of what the compiled Fibonacci function might look like. Provided to make things more clear is a mapping of variable names to their memory locations:</p>
<table border="0">
<tbody>
<tr>
<td>n</td>
<td width="4"></td>
<td>0</td>
</tr>
<tr>
<td>term1</td>
<td width="4"></td>
<td>1</td>
</tr>
<tr>
<td>term2</td>
<td width="4"></td>
<td>2</td>
</tr>
<tr>
<td>result</td>
<td width="4"></td>
<td>3</td>
</tr>
<tr>
<td>i</td>
<td width="4"></td>
<td>4</td>
</tr>
</tbody>
</table>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># set the value in location 1 to 1</span>
<span style="color: #808080; font-style: italic;"># set the value in location 2 to 1</span>
<span style="color: #808080; font-style: italic;"># set the value in location 3 to the value stored in location 1</span>
<span style="color: #808080; font-style: italic;"># set the value in location 4 to the 1</span>
<span style="color: #808080; font-style: italic;"># if the value in location 4 is not less than the value in location 0, go to instruction 11</span>
<span style="color: #808080; font-style: italic;"># set the value in location 3 to the result of the value in 1 plus the value in 2</span>
<span style="color: #808080; font-style: italic;"># set the value in location 1 to the value in location 2</span>
<span style="color: #808080; font-style: italic;"># set the value in location 2 to the value in location 3</span>
<span style="color: #808080; font-style: italic;"># set the value in location 4 to the value in location 4 plus the value 1</span>
<span style="color: #808080; font-style: italic;"># jump to instruction 5</span>
<span style="color: #808080; font-style: italic;"># return the value in location 3</span></pre></div></div>

<p>Each of the above instructions would be represented with a single <em>word</em>, which on a top-of-the-line modern computer is 64 bits of information. The human genetic code is also a sequence of simple instructions, interpreted not by a central processing unit, but by intracellular organisms.  Instead of dealing with changing values in memory locations, the genetic code&#8217;s instructions are for amino acids used to build proteins.  There are approximately 6 billion instructions in the human genome, making it roughly 10 million times as complex as our simple Fibonacci function.</p>
<p>Notice that the machine language program is  no where near as easy to understand as the C program. If I gave you a machine language program with 100 million lines of code, you&#8217;d have a heck of a time trying to figure out how it worked.  Poking around and changing single instructions, then determining what happens when you change those instructions probably wouldn&#8217;t be a good start. Unfortunately, as I understand things, that is exactly how biologists are proceeding.  They are stepping through the genetic code piece by piece,  using experiments to try and figure out what different sequences of instructions do.</p>
<p>There is, I think, a better approach. The key to understanding this approach is a simple fact about computer programming: It&#8217;s easier (and more fun) to write your own program than it is to read someone else&#8217;s program and figure out what it&#8217;s doing. Instead of trying to reverse engineer existing DNA code, which evolved over millions of years and is therefore probably extremely convoluted and hard to follow, we&#8217;d be better off trying to &#8216;write&#8217; our own organisms.  Biologists could start by writing DNA &#8216;programs&#8217; to code simple proteins.  After getting good at this, they could invent a &#8216;high level language&#8217;  for DNA programming (AKA GeneticC) which could be used to speed up the development progress. The next step would be to write a single cellular organism, and then more complicated organisms.</p>
<p>Interestingly enough, this process of building our own organisms could provide a lot of insight into the question of whether there is some being who designed us.  Once we have a better understanding of genetic programming,  we could look at the quality of the code that builds human beings. If it&#8217;s clean, neat, and straightforward,  that would be strong evidence of a creator at work. If it&#8217;s messy, garbled, hacked together, redundant and nonsensical in parts, we could conclude that the code evolved over time.  Either that, or god is a perl scripter.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markpneyer.com/wp/2009/06/26/on-genetics-programming-languages-and-god/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What Does This Mean?</title>
		<link>http://www.markpneyer.com/wp/2009/05/18/what-does-this-mean/</link>
		<comments>http://www.markpneyer.com/wp/2009/05/18/what-does-this-mean/#comments</comments>
		<pubDate>Mon, 18 May 2009 22:44:23 +0000</pubDate>
		<dc:creator>MarkPNeyer</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.markpneyer.com/wp/?p=401</guid>
		<description><![CDATA[Do you know what this means?
htons

No Cheating via Google! Click for the answer &#8230;
The answer is &#8220;Host To Network Short.&#8221; It&#8217;s a function from the Berkeley sockets API. It&#8217;s needed because different computers use different methods for storing information, and htons converts a number from whatever format that machine uses, to the &#8216;network short&#8217; format.
This [...]]]></description>
			<content:encoded><![CDATA[<p>Do you know what this means?</p>
<p><code>htons<br />
</code></p>
<p>No Cheating via Google! Click for the answer &#8230;<span id="more-401"></span></p>
<p>The answer is &#8220;Host To Network Short.&#8221; It&#8217;s a function from the Berkeley sockets API. It&#8217;s needed because different computers use different methods for storing information, and <code>htons</code> converts a number from whatever format that machine uses, to the &#8216;network short&#8217; format.</p>
<p>This is a perfect example of terrible software engineering.  Maybe I&#8217;m totally out of line to criticize something created by people who are far more educated than I am, but how can writing cryptically short function names that give the reader absolutely no clue what they do be considered good engineering? What excuse could you possibly have? That you want to save time in typing? A reasonable name for the function, like, say, HostToNetworkShort, would take 5 seconds to type, as opposed to htons, which takes 1.  Any programmer who spends the majority of his time typing should probably be fired for posting too much on slashdot.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markpneyer.com/wp/2009/05/18/what-does-this-mean/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Removing SVN Bindings with Python</title>
		<link>http://www.markpneyer.com/wp/2009/05/16/removing-svn-bindings-with-python/</link>
		<comments>http://www.markpneyer.com/wp/2009/05/16/removing-svn-bindings-with-python/#comments</comments>
		<pubDate>Sat, 16 May 2009 16:41:28 +0000</pubDate>
		<dc:creator>MarkPNeyer</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.markpneyer.com/wp/?p=394</guid>
		<description><![CDATA[I had an SVN repository on my website that I was using to store a personal project of mine.  I wanted to move the files into a different SVN repository on another website. Doing this required that I first remove all of the .SVN folders in my project. It&#8217;s got a bunch of folders, so [...]]]></description>
			<content:encoded><![CDATA[<p>I had an SVN repository on my website that I was using to store a personal project of mine.  I wanted to move the files into a different SVN repository on another website. Doing this required that I first remove all of the .SVN folders in my project. It&#8217;s got a bunch of folders, so going through manually would have been a big pain. Besides, as a self-respecting geek, I&#8217;d definitely prefer spending twice as long writing a script to automate a boring process over just doing it manually. My script, which is based upon <a href="http://svn.games.stoprecording.com/starbreaker">this script here</a>, generates a batch file that you run to clean the directories out. I would have done it directly from python, but I kept getting &#8216;this directory could not be found&#8217; exceptions, probably becuase of the spaces in my folder names.</p>
<p>The script is below, for your edification. It only works on windows, but it could easily be modified to run on a UNIX based system. It is presented without any warranty, express or implied, not even that of suitability for a specific purpose.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> findFileGenerator<span style="color: black;">&#40;</span>rootDirectory, acceptanceFunction<span style="color: black;">&#41;</span>:
  <span style="color: #ff7700;font-weight:bold;">for</span> aCurrentDirectoryItem <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>rootDirectory, x<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">listdir</span><span style="color: black;">&#40;</span>rootDirectory<span style="color: black;">&#41;</span> <span style="color: black;">&#93;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isdir</span><span style="color: black;">&#40;</span>aCurrentDirectoryItem<span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> acceptanceFunction<span style="color: black;">&#40;</span>aCurrentDirectoryItem<span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">yield</span> aCurrentDirectoryItem
		<span style="color: #ff7700;font-weight:bold;">for</span> aSubdirectoryItem <span style="color: #ff7700;font-weight:bold;">in</span> findFileGenerator<span style="color: black;">&#40;</span>aCurrentDirectoryItem, acceptanceFunction<span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">yield</span> aSubdirectoryItem
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> acceptSVNChildren<span style="color: black;">&#40;</span>theFileOrDir<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">return</span> theFileOrDir.<span style="color: black;">find</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.svn'</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">!</span>= -<span style="color: #ff4500;">1</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> removeSVN<span style="color: black;">&#40;</span>rootdir<span style="color: black;">&#41;</span>:
	<span style="color: #483d8b;">&quot;&quot;&quot;recursively removes the SVN bindings from the directory specified in the argument&quot;&quot;&quot;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> dude <span style="color: #ff7700;font-weight:bold;">in</span> findFileGenerator<span style="color: black;">&#40;</span>rootdir,acceptSVNChildren<span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isdir</span><span style="color: black;">&#40;</span>dude<span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;rmdir /S /Q&quot;</span>, <span style="color: #483d8b;">'&quot;'</span>+dude+<span style="color: #483d8b;">'&quot;'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	<span style="color: #483d8b;">&quot;&quot;&quot;Removes the SVN bindings from the commandline dir specified in the argument.
	If no argument is specified, the root directory is used.&quot;&quot;&quot;</span>
&nbsp;
	dirToClean = <span style="color: #dc143c;">os</span>.<span style="color: black;">getcwd</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> == <span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>:
		dirToClean = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">getcwd</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>,<span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">elif</span> <span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Usage: remove_svn.py &amp;lt;dirToClean&amp;gt;&quot;</span>
&nbsp;
	removeSVN<span style="color: black;">&#40;</span>dirToClean<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span> : main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.markpneyer.com/wp/2009/05/16/removing-svn-bindings-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

