<?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>dragffy.com &#187; Programming</title>
	<atom:link href="http://dragffy.com/blog/posts/tag/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://dragffy.com/blog</link>
	<description>The development, documentation, and blogging domain of Gabriel Dragffy.</description>
	<lastBuildDate>Wed, 16 Nov 2011 11:17:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Using Python Doctests in Django with fixtures</title>
		<link>http://dragffy.com/blog/posts/using-python-doctests-in-django-with-fixtures</link>
		<comments>http://dragffy.com/blog/posts/using-python-doctests-in-django-with-fixtures#comments</comments>
		<pubDate>Tue, 24 Jun 2008 15:28:51 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[web dev]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/?p=61</guid>
		<description><![CDATA[Django is a pretty decent web framework for Python. Having brushed up on my Python programming I started to fall in love with doctests. I then went ahead and wrote about 100 lines of doctest for model in Django, then found all tests were failing because the database fixtures weren&#8217;t being loaded. I couldn&#8217;t find [...]]]></description>
			<content:encoded><![CDATA[<p>Django is a pretty decent web framework for Python. Having brushed up on my Python programming I started to fall in love with doctests. I then went ahead and wrote about 100 lines of doctest for model in Django, then found all tests were failing because the database fixtures weren&#8217;t being loaded.</p>
<p>I couldn&#8217;t find out how to install fixtures inside doctests from the official documentation, I did however, come across what seemed like a web page written in Japanese. I had to skip the Japanese but figured out the code samples. Getting fixtures working with doctests in django is fairly simple &#8211; once you know how!</p>
<p>At the top of your doctest you will need the following two lines:<br />
<code>>>> from django.core import management<br />
>>> management.call_command("loaddata", "project/fixtures/test.json", \<br />
        verbosity=0)</code></p>
<p>Replace <code>project</code> and <code>test.json</code> with your project name and fixture. Then continue with the doctests as per usual. After they are done put the following line at the end of the doctest:<br />
<code>>>> management.call_command("flush", verbosity=0, interactive=False)</code></p>
<p>That should be just about it <img src='http://dragffy.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/using-python-doctests-in-django-with-fixtures/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grope, a Ruby script for enhanced Grepping</title>
		<link>http://dragffy.com/blog/posts/grope-a-ruby-script-for-enhanced-grepping</link>
		<comments>http://dragffy.com/blog/posts/grope-a-ruby-script-for-enhanced-grepping#comments</comments>
		<pubDate>Wed, 19 Mar 2008 17:56:54 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[grope]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/posts/grope-a-ruby-script-for-enhanced-grepping</guid>
		<description><![CDATA[There was a time when I would recursively grep the contents of literally thousands of files at a time to search for particular occurances of characters. The usual starting place was something using grep, which we can time for crude benchmarking: user@localhost$ time grep -rn 'hello' * templates/temp.tpl:1:hello real 1m56.190s user 0m1.400s sys 0m0.940s Using [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when I would recursively grep the contents of literally thousands of files at a time to search for particular occurances of characters. The usual starting place was something using grep, which we can time for crude benchmarking:<br />
<code><br />
user@localhost$ time grep -rn 'hello' *<br />
templates/temp.tpl:1:hello</p>
<p>real    1m56.190s<br />
user    0m1.400s<br />
sys     0m0.940s<br />
</code></p>
<p>Using Ruby to write a script, which I named Grope, I made the search process 450 times faster, reducing an operation that took more than a minute to taking a blink of an eye&#8230;<br />
<code><br />
user@localhost$ time grope 'hello'<br />
templates/festival/06/temp.tpl: 1<br />
hello...</p>
<p>real    0m0.181s<br />
user    0m0.100s<br />
sys     0m0.070s<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/grope-a-ruby-script-for-enhanced-grepping/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby script for replacing tab delimeters with commas</title>
		<link>http://dragffy.com/blog/posts/ruby-script-for-replacing-tab-delimeters-with-commas</link>
		<comments>http://dragffy.com/blog/posts/ruby-script-for-replacing-tab-delimeters-with-commas#comments</comments>
		<pubDate>Tue, 11 Mar 2008 13:21:32 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/posts/ruby-script-for-replacing-tab-delimeters-with-commas</guid>
		<description><![CDATA[A trivial Ruby script for replacing any number of tabs in input.csv with a single comma and then writing it as output.csv. The first version works from the command line and makes use of concatenating a file and piping it to a ruby command which then diverts the output in to a file, a one [...]]]></description>
			<content:encoded><![CDATA[<p>A trivial Ruby script for replacing any number of tabs in <code>input.csv</code> with a single comma and then writing it as <code>output.csv</code>.</p>
<p>The first version works from the command line and makes use of concatenating a file and piping it to a ruby command which then diverts the output in to a file, a one liner:<br />
<code>cat input.csv | ruby -pe 'gsub( /\t+/, "," )' &gt; output.csv</code></p>
<p>This can be further enhanced by using the in-place-edit switch of the Ruby interpreter, editing the <code>input.csv</code> file and leaving a pristine copy with .bak extension.<br />
<code>ruby -i.bak -pe 'gsub( /\t+/, "," )' input.csv<br />
</code></p>
<p><code></code><br />
The final version is what you might put in to a Ruby file. Although the input and output files are hard-coded, it would be trivial to allow them to be specified on the command line.</p>
<pre>
#!/usr/bin/env ruby

# Initialise a new file object that is writable
file = File.new( "output.csv", "w" )

# Open the existing tab delimited file and read each line
File.open( "input.csv", "r" ).each do |line|
  # Perform a global substitution of tabs with commas and
  # put that in the new file
  file.puts line.gsub( /\t+/, "," )
end

# Tidy up by closing the newly written output file.
file.close</pre>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/ruby-script-for-replacing-tab-delimeters-with-commas/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protected: Practical Common Lisp &#8211; Apress 2005</title>
		<link>http://dragffy.com/blog/posts/practical-common-lisp-apress-2005</link>
		<comments>http://dragffy.com/blog/posts/practical-common-lisp-apress-2005#comments</comments>
		<pubDate>Mon, 10 Mar 2008 13:52:35 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[LISP]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/posts/practical-common-lisp-apress-2005</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://dragffy.com/blog/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-29">Password:<br />
<input name="post_password" id="pwbox-29" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/practical-common-lisp-apress-2005/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protected: Learning PHP 5 &#8211; O&#8217;Reilly</title>
		<link>http://dragffy.com/blog/posts/learning-php-5-oreilly</link>
		<comments>http://dragffy.com/blog/posts/learning-php-5-oreilly#comments</comments>
		<pubDate>Mon, 10 Mar 2008 10:49:30 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/posts/learning-php-5-oreilly</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://dragffy.com/blog/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-27">Password:<br />
<input name="post_password" id="pwbox-27" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/learning-php-5-oreilly/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protected: Ruby on Rails for PHP and Java Developers</title>
		<link>http://dragffy.com/blog/posts/ruby-on-rails-for-php-and-java-developers</link>
		<comments>http://dragffy.com/blog/posts/ruby-on-rails-for-php-and-java-developers#comments</comments>
		<pubDate>Thu, 06 Mar 2008 16:08:33 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/posts/ruby-on-rails-for-php-and-java-developers</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://dragffy.com/blog/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-25">Password:<br />
<input name="post_password" id="pwbox-25" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/ruby-on-rails-for-php-and-java-developers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protected: Pro PHP Security</title>
		<link>http://dragffy.com/blog/posts/pro-php-security</link>
		<comments>http://dragffy.com/blog/posts/pro-php-security#comments</comments>
		<pubDate>Thu, 06 Mar 2008 15:48:50 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/posts/pro-php-security</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://dragffy.com/blog/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-21">Password:<br />
<input name="post_password" id="pwbox-21" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/pro-php-security/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protected: CodeIgniter for Rapid PHP Application development</title>
		<link>http://dragffy.com/blog/posts/codeigniter-for-rapid-php-application-development</link>
		<comments>http://dragffy.com/blog/posts/codeigniter-for-rapid-php-application-development#comments</comments>
		<pubDate>Thu, 06 Mar 2008 15:43:14 +0000</pubDate>
		<dc:creator>Gabe</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://dragffy.com/blog/posts/codeigniter-for-rapid-php-application-development</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://dragffy.com/blog/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-23">Password:<br />
<input name="post_password" id="pwbox-23" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://dragffy.com/blog/posts/codeigniter-for-rapid-php-application-development/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

