<?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>pushin&#039; and poppin&#039; your eax</title>
	<atom:link href="http://blog.mahmoudimus.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mahmoudimus.com</link>
	<description>a hacker&#039;s moleskine</description>
	<lastBuildDate>Sat, 24 Dec 2011 00:13:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Developing a nose-test plugin to time python tests</title>
		<link>http://blog.mahmoudimus.com/2011/02/developing-a-nose-test-plugin-to-time-python-tests/</link>
		<comments>http://blog.mahmoudimus.com/2011/02/developing-a-nose-test-plugin-to-time-python-tests/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 22:28:11 +0000</pubDate>
		<dc:creator>Mahmoud</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.mahmoudimus.com/?p=228</guid>
		<description><![CDATA[Nose is a fantastic testing framework. What surprises me though, is that there&#8217;s no out of the box plugin to time tests to see which tests are the slowest, and most likely, problematic. After all, unit tests are supposed to be wicked fast. I googled, but nothing really came up except an insightful google-groups post. [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://somethingaboutorange.com/mrl/projects/nose/1.0.0/">Nose</a> is a fantastic testing framework. What surprises me though, is that there&#8217;s no out of the box plugin to time tests to see which tests are the slowest, and most likely, problematic. After all, unit tests are supposed to be wicked fast. I googled, but nothing really came up except an <a href="http://groups.google.com/group/nose-users/browse_thread/thread/ad51415d14bda06e">insightful google-groups post</a>.</p>
<p>I figured, what the hey, might as well just write a simple nose plugin to time the tests. I modeled it slightly off the <a href="https://bitbucket.org/jpellerin/nose/src/734bc7bc40ab/nose/plugins/xunit.py">xunit nose plugin</a>. With the xunit plugin as a guiding example, I thought it was pretty trivial to write a nose plugin, definitely a testament to the great design chosen by nose.</p>
<p>Here&#8217;s the plugin below:</p>
<div id="gist-848183" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="sd">&quot;&quot;&quot;This plugin provides test timings to identify which tests might be</span></div><div class='line' id='LC2'><span class="sd">taking the most. From this information, it might be useful to couple</span></div><div class='line' id='LC3'><span class="sd">individual tests nose&#39;s `--with-profile` option to profile problematic</span></div><div class='line' id='LC4'><span class="sd">tests.</span></div><div class='line' id='LC5'><br/></div><div class='line' id='LC6'><span class="sd">This plugin is heavily influenced by nose&#39;s `xunit` plugin.</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'><span class="sd">Add this command to the way you execute nose::</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'><span class="sd">    --with-test-timer</span></div><div class='line' id='LC11'><br/></div><div class='line' id='LC12'><span class="sd">After all tests are executed, they will be sorted in ascending order.</span></div><div class='line' id='LC13'><br/></div><div class='line' id='LC14'><span class="sd">(c) 2011 - Mahmoud Abdelkader (http://github.com/mahmoudimus)</span></div><div class='line' id='LC15'><br/></div><div class='line' id='LC16'><span class="sd">LICENSE:</span></div><div class='line' id='LC17'><span class="sd">            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE</span></div><div class='line' id='LC18'><span class="sd">                    Version 2, December 2004</span></div><div class='line' id='LC19'><br/></div><div class='line' id='LC20'><span class="sd"> Copyright (C) 2004 Sam Hocevar &lt;sam@hocevar.net&gt;</span></div><div class='line' id='LC21'><br/></div><div class='line' id='LC22'><span class="sd"> Everyone is permitted to copy and distribute verbatim or modified</span></div><div class='line' id='LC23'><span class="sd"> copies of this license document, and changing it is allowed as long</span></div><div class='line' id='LC24'><span class="sd"> as the name is changed.</span></div><div class='line' id='LC25'><br/></div><div class='line' id='LC26'><span class="sd">            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE</span></div><div class='line' id='LC27'><span class="sd">   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</span></div><div class='line' id='LC28'><br/></div><div class='line' id='LC29'><span class="sd">  0. You just DO WHAT THE FUCK YOU WANT TO.</span></div><div class='line' id='LC30'><br/></div><div class='line' id='LC31'><span class="sd">&quot;&quot;&quot;</span></div><div class='line' id='LC32'><br/></div><div class='line' id='LC33'><span class="kn">import</span> <span class="nn">operator</span></div><div class='line' id='LC34'><span class="kn">from</span> <span class="nn">time</span> <span class="kn">import</span> <span class="n">time</span></div><div class='line' id='LC35'><br/></div><div class='line' id='LC36'><span class="kn">import</span> <span class="nn">nose</span></div><div class='line' id='LC37'><span class="kn">from</span> <span class="nn">nose.plugins.base</span> <span class="kn">import</span> <span class="n">Plugin</span></div><div class='line' id='LC38'><br/></div><div class='line' id='LC39'><br/></div><div class='line' id='LC40'><span class="k">class</span> <span class="nc">TestTimer</span><span class="p">(</span><span class="n">Plugin</span><span class="p">):</span></div><div class='line' id='LC41'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;This plugin provides test timings</span></div><div class='line' id='LC42'><br/></div><div class='line' id='LC43'><span class="sd">    &quot;&quot;&quot;</span></div><div class='line' id='LC44'><br/></div><div class='line' id='LC45'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">name</span> <span class="o">=</span> <span class="s">&#39;test-timer&#39;</span></div><div class='line' id='LC46'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">score</span> <span class="o">=</span> <span class="mi">1</span></div><div class='line' id='LC47'><br/></div><div class='line' id='LC48'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">_timeTaken</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div><div class='line' id='LC49'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&#39;_timer&#39;</span><span class="p">):</span></div><div class='line' id='LC50'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">taken</span> <span class="o">=</span> <span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">_timer</span></div><div class='line' id='LC51'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span><span class="p">:</span></div><div class='line' id='LC52'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># test died before it ran (probably error in setup())</span></div><div class='line' id='LC53'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># or success/failure added before test started probably</span></div><div class='line' id='LC54'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># due to custom TestResult munging</span></div><div class='line' id='LC55'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">taken</span> <span class="o">=</span> <span class="mf">0.0</span></div><div class='line' id='LC56'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="n">taken</span></div><div class='line' id='LC57'><br/></div><div class='line' id='LC58'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">options</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">env</span><span class="p">):</span></div><div class='line' id='LC59'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;Sets additional command line options.&quot;&quot;&quot;</span></div><div class='line' id='LC60'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">super</span><span class="p">(</span><span class="n">TestTimer</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">options</span><span class="p">(</span><span class="n">parser</span><span class="p">,</span> <span class="n">env</span><span class="p">)</span></div><div class='line' id='LC61'><br/></div><div class='line' id='LC62'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">configure</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">options</span><span class="p">,</span> <span class="n">config</span><span class="p">):</span></div><div class='line' id='LC63'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;Configures the test timer plugin.&quot;&quot;&quot;</span></div><div class='line' id='LC64'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">super</span><span class="p">(</span><span class="n">TestTimer</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">configure</span><span class="p">(</span><span class="n">options</span><span class="p">,</span> <span class="n">config</span><span class="p">)</span></div><div class='line' id='LC65'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">config</span> <span class="o">=</span> <span class="n">config</span></div><div class='line' id='LC66'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">_timed_tests</span> <span class="o">=</span> <span class="p">{}</span></div><div class='line' id='LC67'><br/></div><div class='line' id='LC68'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">startTest</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">test</span><span class="p">):</span></div><div class='line' id='LC69'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;Initializes a timer before starting a test.&quot;&quot;&quot;</span></div><div class='line' id='LC70'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">_timer</span> <span class="o">=</span> <span class="n">time</span><span class="p">()</span></div><div class='line' id='LC71'><br/></div><div class='line' id='LC72'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">report</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">stream</span><span class="p">):</span></div><div class='line' id='LC73'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="sd">&quot;&quot;&quot;Report the test times&quot;&quot;&quot;</span></div><div class='line' id='LC74'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enabled</span><span class="p">:</span></div><div class='line' id='LC75'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span></div><div class='line' id='LC76'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">d</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_timed_tests</span><span class="o">.</span><span class="n">iteritems</span><span class="p">(),</span> <span class="n">key</span><span class="o">=</span><span class="n">operator</span><span class="o">.</span><span class="n">itemgetter</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span></div><div class='line' id='LC77'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="n">test</span><span class="p">,</span> <span class="n">time_taken</span> <span class="ow">in</span> <span class="n">d</span><span class="p">:</span></div><div class='line' id='LC78'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">stream</span><span class="o">.</span><span class="n">writeln</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">: </span><span class="si">%0.4f</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">test</span><span class="p">,</span> <span class="n">time_taken</span><span class="p">))</span></div><div class='line' id='LC79'><br/></div><div class='line' id='LC80'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">_register_time</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">test</span><span class="p">):</span></div><div class='line' id='LC81'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">_timed_tests</span><span class="p">[</span><span class="n">test</span><span class="o">.</span><span class="n">id</span><span class="p">()]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_timeTaken</span><span class="p">()</span></div><div class='line' id='LC82'><br/></div><div class='line' id='LC83'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">addError</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">test</span><span class="p">,</span> <span class="n">err</span><span class="p">,</span> <span class="n">capt</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div><div class='line' id='LC84'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">_register_time</span><span class="p">(</span><span class="n">test</span><span class="p">)</span></div><div class='line' id='LC85'><br/></div><div class='line' id='LC86'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">addFailure</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">test</span><span class="p">,</span> <span class="n">err</span><span class="p">,</span> <span class="n">capt</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">tb_info</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div><div class='line' id='LC87'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">_register_time</span><span class="p">(</span><span class="n">test</span><span class="p">)</span></div><div class='line' id='LC88'><br/></div><div class='line' id='LC89'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">addSuccess</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">test</span><span class="p">,</span> <span class="n">capt</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div><div class='line' id='LC90'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="bp">self</span><span class="o">.</span><span class="n">_register_time</span><span class="p">(</span><span class="n">test</span><span class="p">)</span></div><div class='line' id='LC91'><br/></div><div class='line' id='LC92'><br/></div><div class='line' id='LC93'><span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span></div><div class='line' id='LC94'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">nose</span><span class="o">.</span><span class="n">main</span><span class="p">(</span><span class="n">addplugins</span><span class="o">=</span><span class="p">[</span><span class="n">TestTimer</span><span class="p">()])</span></div><div class='line' id='LC95'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/848183/560eb4c58b658e65b31aae1dc19e91b56d3abd59/nose-timetests.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/848183#file_nose_timetests.py" style="float:right;margin-right:10px;color:#666">nose-timetests.py</a>
            <a href="https://gist.github.com/848183">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Something cool about nose was that you don&#8217;t have to install a plugin package-wide using setuptools, but you can actually <a href="http://somethingaboutorange.com/mrl/projects/nose/0.11.2/plugins/writing.html#registering-a-plugin-without-setuptools">just dynamically add it during run-time</a>. All you have to do is:</p>
<pre class="brush: python; title: ;">
import nose
from yourplugin import YourPlugin

if __name__ == '__main__':
    nose.main(addplugins=[YourPlugin()])
</pre>
<p>This way, you can just execute your tests as normal, like so:</p>
<pre class="brush: plain; title: ;">
python nose-testtimers.py --with-test-timer -sv --debug=sqlalchemy.engine
</pre>
<p>and you get a nice little output of test times <img src='http://blog.mahmoudimus.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2011/02/developing-a-nose-test-plugin-to-time-python-tests/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Arbitrary Stack Trace in Python</title>
		<link>http://blog.mahmoudimus.com/2011/02/arbitrary-stack-trace-in-python/</link>
		<comments>http://blog.mahmoudimus.com/2011/02/arbitrary-stack-trace-in-python/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 23:52:35 +0000</pubDate>
		<dc:creator>Mahmoud</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.mahmoudimus.com/?p=203</guid>
		<description><![CDATA[I had a need to trace a function&#8217;s call stack to identify call chain paths in some difficult-to-follow Python code that was laced with lots of magic and abstractions. I tried stepping through ipdb, but it took forever. So, I thought to myself, why can&#8217;t I just take a stack trace and I&#8217;ll be able [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I had a need to trace a function&#8217;s call stack to identify call chain paths in some difficult-to-follow Python code that was laced with lots of magic and abstractions.</p>
<p>I tried stepping through ipdb, but it took forever. So, I thought to myself, why can&#8217;t I just take a stack trace and I&#8217;ll be able to get the call stack. It didn&#8217;t help that this function was apparently called multiple times from different places so when I tried raising an unhandled exception, it only helped display the stack trace for the first call to the function, not the successive ones. I also tried throwing and catching the exception, assuming that a stack trace can share some information about its call chain. That didn&#8217;t work too well because the exception masked the stack[1].</p>
<p>So I wrote some simple code that will do exactly that, take a stack trace and format it as if it looked like an exception traceback. Without further ado, here is, as far as I know, the only way to get an arbitrary stack trace in Python from any line of code.</p>
<pre class="brush: python; title: ;">
    import inspect
    import traceback

    # get the currently frames' stack
    # this returns the frameobject, the filename,
    # the line number of the current line, the
    # function name, a list of lines of context from
    # the source code, and the index of the current
    # line within that list.
    stack = inspect.stack()
    # reverse the stack trace so the most recent is at the bottom of the stack
    stack.reverse()
    try:
        stack_list = []
        for s in stack:
            _, filename, line_no, func_name, code_list, index_in_code_list = s
            stack_list.append(
                (filename, line_no, func_name, code_list[index_in_code_list]))
        print ''.join(traceback.format_list(stack_list))
    finally:
        # avoid memory leak issues
        del stack
</pre>
<p>Hope this helps in your debugging adventures.</p>
<p>I&#8217;d love to hear if there are any other ways of doing the same thing.</p>
<p>[1] I should probably revisit this later to see why it didn&#8217;t work. In theory it should do what the stack trace snippet above does.</p>
<p>EDIT:</p>
<p>My original assumption was right. Using a stack trace to get the call chain is one way of doing it. </p>
<p>Turns out Python already does this in the <a href="http://docs.python.org/library/traceback.html?#traceback.print_stack">traceback.print_stack</a> function.</p>
<p>Thanks to <a href="http://twitter.com/teepark/">@teepark</a> for the comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2011/02/arbitrary-stack-trace-in-python/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Reading and Writing Null-Terminated CSV Files in Python</title>
		<link>http://blog.mahmoudimus.com/2010/09/reading-and-writing-null-terminated-csv-files-in-python/</link>
		<comments>http://blog.mahmoudimus.com/2010/09/reading-and-writing-null-terminated-csv-files-in-python/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 01:42:03 +0000</pubDate>
		<dc:creator>Mahmoud</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.mahmoudimus.com/?p=132</guid>
		<description><![CDATA[I&#8217;ve recently had to do some work that required sorting a very large CSV file, containing fields with embedded newlines, quickly. As it turns out, Linux comes with a sort implementation that has a &#8220;&#8211;zero-terminated&#8221; option, which sorts on null-terminated delimited strings instead of the default newline separator. Writing null-terminated CSV files Since I was [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;ve recently had to do some work that required sorting a very large CSV file, containing fields with embedded newlines, quickly. As it turns out, Linux comes with a sort implementation that has a <a href="http://linux.die.net/man/1/sort" target="_blank">&#8220;&#8211;zero-terminated&#8221;</a> option, which sorts on null-terminated delimited strings instead of the default newline separator.</p>
<p><strong><span style="text-decoration: underline;">Writing null-terminated CSV files</span></strong></p>
<p>Since I was writing a process to generate these CSV files, I figured I can just use Python&#8217;s <a href="http://docs.python.org/library/csv.html" target="_blank">CSV module</a>, which has support for different types of dialects. Inheriting from <a href="http://docs.python.org/library/csv.html#csv.Dialect" target="_blank">csv.Dialect</a>, we can write a simple dialect that will allow us to terminate all lines with a null byte.</p>
<pre class="brush: python; gutter: false; title: ;">
import csv
import struct

class null_terminated(csv.excel):
    lineterminator = struct.pack('B', 0)

csv.register_dialect(&quot;null-terminated&quot;, null_terminated)
</pre>
<p>Essentially, we&#8217;ve registered a global csv dialect called <code>"null-terminated"</code> that inherits from the <a href="http://docs.python.org/library/csv.html#csv.excel" target="_blank">excel</a> dialect, which has sensible standard defaults.</p>
<p>Here&#8217;s a simple snippet that shows the usage of the new <code>"null-terminated"</code> dialect that I created above.</p>
<pre class="brush: python; gutter: false; title: ;">
from csv import DictWriter

with open(&quot;/tmp/file.csv&quot;, &quot;w&quot;) as f:
	dwriter = DictWriter(f, fieldnames=[&quot;id&quot;,&quot;field&quot;], dialect=&quot;null-terminated&quot;)

	for i, field in enumerate((&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;, &quot;bif&quot;)):
    		dwriter.writerow({&quot;id&quot;: i, &quot;field&quot;: field})
</pre>
<p>Now, <em>/tmp/file.csv</em> will contain a file with four rows that are separated by a null-terminator. As you can see, it&#8217;s pretty easy to write a null-terminated CSV file, but unfortunately, it&#8217;s a bit tricky to <em>read</em> a null-terminated csv file due to some inflexible hardcoded defaults.</p>
<p><strong><span style="text-decoration: underline;">Reading null-terminated CSV files</span></strong></p>
<p>The CSV module&#8217;s unintuitive restriction for <a href="http://docs.python.org/library/csv.html#csv.Dialect.lineterminator" target="_blank">Dialect.lineterminator</a> is hard-coded to recognize <code>'\r'</code> or <code>'\n'</code> as the end of line terminator, which unfortunately, means we will need to handle null-termination and implement reading ourselves.</p>
<p>There are many ways of writing a procedure to read null-terminated strings, but I figured the simplest algorithm is to read character-by-character, concatenating everything into a string until we reach a null byte, then we can just return the string. I&#8217;d figure an implementation might go something like this:</p>
<pre class="brush: python; gutter: false; title: ;">
def read(fobj):
    current_string = &quot;&quot;
    while True:
        char = fobj.read(1)
        if char and char != nullbyte:
            current_string += char
        elif char == nullbyte:
            yield current_string
            current_string = &quot;&quot;
        elif not char:
            if current_string:
                yield current_string
            raise StopIteration
</pre>
<p>Looks awesome, but, how can we integrate this into the CSV module? We would want to just plug and play with the existing CSV module. A simple solution is to wrap the function above to iterate over each line, like so:</p>
<pre class="brush: python; gutter: false; title: ;">
 # we use StringIO since cStringIO has poor unicode support
from StringIO import StringIO
from csv import reader

class NullTerminatedDelimiterReader(object):
    &quot;&quot;&quot;
    A CSV reader which will iterate over lines in the CSV file 'f',
    which are line terminated by a null byte

    &quot;&quot;&quot;

    def __init__(self, f,  dialect, *args, **kwds):
        # satisfying DictReader instance
        self._line_num = 0
        self.fobj = f
        self.dialect = dialect
        self.reader = self._read()
        self.string_io = StringIO()

    def _properly_parse_row(self, current_string):
        self.string_io.write(current_string)
        # seek to the first byte
        self.string_io.seek(0)
        # we instantiate a reader here to properly parse the row
        # taking into account escaping, and various edge cases
        return next(reader(self.string_io, dialect=self.dialect))

    def _read(self):
        current_string = &quot;&quot;
        while True:
            char = self.fobj.read(1)  # read one byte
            if char and char != null_byte:
                # keep appending to the current string
                current_string += char
            elif char == null_byte:
                yield self._properly_parse_row(current_string)
                # increment instrumentation
                self._line_num += 1
                # clear internal reading buffer
                self.string_io.seek(0)
                self.string_io.truncate()
                # clear row
                current_string = &quot;&quot;
            elif not char:
                if current_string:
                    yield self._properly_parse_row(current_string)
                raise StopIteration

    @property
    def line_num(self):
        return self._line_num

    def next(self):
        return next(self.reader)

    def __iter__(self):
        return self
</pre>
<p>To use the DictReader class, we&#8217;ll inherit from the <a href="http://svn.python.org/projects/python/trunk/Lib/csv.py" target="_blank">DictReader</a> class and override the reader object. It&#8217;s the cleanest and simplest way of doing it.</p>
<pre class="brush: python; gutter: false; title: ;">
class NullByteDictReader(csv.DictReader):
    def __init__(self, f, *args, **kwds):
        csv.DictReader.__init__(self, f, *args, **kwds)
        self.reader = NullTerminatedDelimiterReader(f, *args, **kwds)

with open(&quot;/tmp/file.csv&quot;, &quot;r&quot;) as f:
    for line in NullByteDictReader(f, dialect=&quot;null-terminated&quot;):
        print line[&quot;id&quot;], line[&quot;field&quot;]
</pre>
<p>Voila <img src='http://blog.mahmoudimus.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Conclusions and Future Work</strong></p>
<p>Something that might be interesting to pursue further is the possibility of writing, or wrapping a python interface around, a <a href="http://www.kilabit.org/" target="_blank">C library</a> as a substitute for the current CSV module. It should be able to support different line terminators, multi-byte delimiters, and have unicode detection outside the box, which happen to be my main three gripes with the CSV module.</p>
<p>You can find working source code and implementation of this <a href="http://gist.github.com/576675" target="_blank">here</a> and you should follow me on twitter <a href="http://twitter.com/mahmoudimus">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2010/09/reading-and-writing-null-terminated-csv-files-in-python/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>A pythonic n-wise iterator for any iterable</title>
		<link>http://blog.mahmoudimus.com/2010/06/a-pythonic-n-wise-iterator-for-any-iterable/</link>
		<comments>http://blog.mahmoudimus.com/2010/06/a-pythonic-n-wise-iterator-for-any-iterable/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 07:48:08 +0000</pubDate>
		<dc:creator>Mahmoud</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.mahmoudimus.com/?p=99</guid>
		<description><![CDATA[Over the weekend, I was working on upgrading python-ngrams because I had discovered a bug where the tokenization was incorrect. I was reading a research paper that was describing q-grams and while following their examples, I realized I was getting incorrect results for a fundamental n-gram result. The tokenization that&#8217;s required here is quite simple, [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Over the weekend, I was working on upgrading <a href="http://github.com/mahmoudimus/python-ngrams">python-ngrams</a> because I had discovered a bug where the tokenization was incorrect. I was reading a research paper that was describing q-grams and while following their examples, I realized I was getting incorrect results for a fundamental n-gram result.</p>
<p>The tokenization that&#8217;s required here is quite simple, given some iterable consisting of values <code>[x<sub>0</sub>, x<sub>1</sub>, x<sub>2</sub>, x<sub>3</sub>...,x<sub>i</sub>]</code>, produce an exhaustive iterator of n-tuples such that it satisfies (<code>x<sub>0</sub>,...x<sub>n</sub>), (x<sub>1</sub>,...x<sub>n+1</sub>), (x<sub>m</sub>,...x<sub>i</sub></code>).</p>
<p>To make this easier to understand, if given a list of <code>[0, 1, 2, 3, 4, 5, 6]</code>, I want to be able to return an iterator such that:</p>
<pre class="brush: python; gutter: false; title: ;">
for first, second, third in n_wise([0, 1, 2, 3, 4, 5, 6], 3):
    print first, second, third
</pre>
<p>Will have a result of:<br />
<code><br />
0, 1, 2<br />
1, 2, 3<br />
2, 3, 4<br />
3, 4, 5<br />
4, 5, 6</code></p>
<p>Fortunately, this wasn&#8217;t too difficult as the trivial implementation of this is already done in <a href="http://docs.python.org/library/itertools.html">itertools</a>, under pairwise. Below I&#8217;ve implemented a n-wise iterator implementation that can take any iterator and return n-iterators where each iterator is advanced by a step ahead of the other.</p>
<pre class="brush: python; gutter: false; title: ;">
from itertools import tee, izip

def n_wise(iterable, n):
    &quot;&quot;&quot;Returns n iterators for an iterable that are sequentially
    n-wise

    &quot;&quot;&quot;
    n_iterators = tee(iterable, n)
    zippables = [n_iterators[0]]

    for advance, iteratee in enumerate(n_iterators[1:]):
        advance += 1  # since enumerate is 0 indexed.
        while advance &gt; 0:
            # we advance the iterator `advance+1` steps
            next(iteratee, None)
            advance -= 1
        # append everything to the zippables
        zippables.append(iteratee)
    # return the izip expansion of each iterator
    return izip(*zippables)
</pre>
<p>I find that I sometimes need to open an iterator for a file and I need to read n-wise lines each step, this iterator will do just that. For sake of completeness, look at how concise, powerful, and easy to use this combination is:</p>
<pre class="brush: python; gutter: false; title: ;">
# assuming that n_wise is imported into this namespace
from functools import partial

triple_wise_line_reader = partial(n_wise, n=3)
for line1, line2, line3 in triple_wise_line_reader(open(&quot;some_file.log&quot;, &quot;r&quot;)):
    # do some computation with line1, line2 and line3
    do_something(line1, line2, line3)
    # next step:
    # line1 &lt;- line2
    # line2 &lt;- line3
    # line3 &lt;- line4
</pre>
<p>Imagine doing this in C <img src='http://blog.mahmoudimus.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  It will be just ugly! </p>
<p>Please let me know if you find this useful or you have a better implementation to the problem!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2010/06/a-pythonic-n-wise-iterator-for-any-iterable/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Python 2.6.4 and Twisted 9 on OS X 10.6 Snow Leopard</title>
		<link>http://blog.mahmoudimus.com/2009/12/python-2-6-4-and-twisted-9-on-os-x-10-6-snow-leopard/</link>
		<comments>http://blog.mahmoudimus.com/2009/12/python-2-6-4-and-twisted-9-on-os-x-10-6-snow-leopard/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 07:06:33 +0000</pubDate>
		<dc:creator>Mahmoud</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[snow-leopard]]></category>
		<category><![CDATA[twisted]]></category>

		<guid isPermaLink="false">http://blog.mahmoudimus.com/?p=73</guid>
		<description><![CDATA[I just recently purchased a MacBook Pro, which comes with Snow Leopard installed, and I noticed that it comes with python 2.6.1 installed. I wanted to upgrade to the latest python release of 2.6.4, so I tried installing the official python Mac OS distribution from python.org. After installation, I wanted to install Twisted and I [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I just recently purchased a MacBook Pro, which comes with Snow Leopard installed, and I noticed that it comes with python 2.6.1 installed. I wanted to upgrade to the latest python release of 2.6.4, so I tried installing the official python Mac OS distribution from python.org. After installation, I wanted to install <a title="Twisted, the most popular async I/O library for python" href="http://twistedmatrix.com/trac/" target="_blank">Twisted</a> and I kept getting this error below:</p>
<pre class="brush: plain; gutter: false; title: ;">
creating build/temp.macosx-10.3-fat-2.6
creating build/temp.macosx-10.3-fat-2.6/twisted
creating build/temp.macosx-10.3-fat-2.6/twisted/runner
gcc-4.0 -arch ppc -arch i386 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c twisted/runner/portmap.c -o build/temp.macosx-10.3-fat-2.6/twisted/runner/portmap.o
In file included from /usr/include/architecture/i386/math.h:626,
 from /usr/include/math.h:28,
 from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyport.h:235,
 from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:58,
 from twisted/runner/portmap.c:10:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target &lt; 10.4 is invalid.
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.4u.sdk
Please check your Xcode installation
gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.6/twisted/runner/portmap.o -o build/lib.macosx-10.3-fat-2.6/twisted/runner/portmap.so
ld: library not found for -lbundle1.o
ld: library not found for -lbundle1.o
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/T6/T6diKRiFGJSwsabKP4864E+++TI/-Tmp-//ccIK1c3K.out (No such file or directory)
error: command 'gcc-4.0' failed with exit status 1
</pre>
<p>Something&#8217;s not right &#8212; setuptools is detecting that I&#8217;m using macosx-10.3, but I&#8217;m using Mac OS X 10.6.  Why is it that setuptools also wants to use /Developer/SDKs/MacOS10.4u.sdk to build python extensions? I&#8217;m currently using the SDK for Mac OS X 10.6, and I don&#8217;t want to install another SDK.</p>
<p>Well, I did a little bit of research and I learned that PSF&#8217;s 2.6.4 python package for a Mac is built with an option called &#8211;enable-universalsdk which, according to the <a title="PSF Mac Readme" href="http://svn.python.org/projects/python/trunk/Mac/README" target="_blank">readme</a>, defaults to /Developer/SDKs/MacOSX.10.4u.sdk. This is why building third-party extensions tries to reference the 10.4 SDK.</p>
<p>I was able to build python successfully using the following:</p>
<pre class="brush: bash; gutter: false; title: ;">
./configure --enable-framework --enable-universalsdk=/Developer/SDKs/MacOSX10.6.sdk/ --with-universal-archs=intel
make &amp;&amp; make test
sudo make install
</pre>
<p>You&#8217;ll notice that the following 3 tests failed when attempting to run the unit tests:</p>
<ul>
<li>asyncore</li>
<li>test_platform</li>
<li>test_macostools</li>
</ul>
<p>The test that should really put you on alert is asyncore. After doing some <a title="research on why the asyncore test fails on mac os x" href="http://bugs.python.org/issue5798" target="_blank">research</a>, it turns out the asyncore module is using some variant of select.poll(), which isn&#8217;t supported by the FreeBSD kernel. FreeBSD uses something called kqueue, which is what the test doesn&#8217;t take into account. To fix this, I pulled the <a title="asyncore module r73184" href="http://svn.python.org/view/*checkout*/python/trunk/Lib/asyncore.py?revision=73184&amp;content-type=text%2Fplain" target="_blank">asyncore.py</a> module from the trunk and overwrote /Lib/asyncore.py. The tests passed then.</p>
<p>You don&#8217;t need to fix the other two, as they only pertain to fixing the actual tests themselves instead of having to actually change a module. If you&#8217;re interested though, fixing &#8220;test_platform&#8221; follows the same pattern as asyncore. <a title="Brett Cannon" href="http://sayspy.blogspot.com/" target="_blank">Brett Cannon</a> actually <a href="http://bugs.python.org/issue6806" target="_blank">filed a bug</a> for this test and <a title="patch to fix test_platform by Brett Cannon" href="http://svn.python.org/view/python/trunk/Lib/test/test_platform.py?r1=73714&amp;r2=74640&amp;pathrev=74640" target="_blank">submitted a patch</a>, but you will still need to replace the entire test_platform.py module to get it working. Apparently, this patch is for python v2.7, v3.1, and v3.2. To fix it, download the patched <a title="patched test_platform.py" href="http://svn.python.org/view/*checkout*/python/trunk/Lib/test/test_platform.py?revision=74640&amp;content-type=text%2Fplain" target="_blank">test_platform.py</a> module and replace it with the one in /Lib/test/test_platform.py. Make sure you also delete /Lib/test/test_platform.pyc.</p>
<p>The last test, test_macostools, is actually quite interesting. Apparently, <a title="reason for why this test is failing" href="http://bugs.python.org/issue7041" target="_blank">Apple does not supply 64-bit versions of the Carbon frameworks used by these modules</a>. This is why this test is failing. Looks like there might not be a way to fix this test until Apple upgrades the Carbon frameworks to 64-bit usage.</p>
<p>After fixing these bugs, make sure you run the following command:</p>
<pre class="brush: bash; gutter: false; title: ;">
sudo make install
</pre>
<p>Needless to say, after I installed python with the options above, and after I fixed all these modules, the Twisted 9.0 installation was successful.</p>
<p>I hope this helps some of you in case you run into this problem!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2009/12/python-2-6-4-and-twisted-9-on-os-x-10-6-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Verifying Python64 builds</title>
		<link>http://blog.mahmoudimus.com/2009/07/verifying-python64-builds/</link>
		<comments>http://blog.mahmoudimus.com/2009/07/verifying-python64-builds/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 15:24:01 +0000</pubDate>
		<dc:creator>mahmoud</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[32bit]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[verification]]></category>

		<guid isPermaLink="false">http://blog.mahmoudimus.com/?p=10</guid>
		<description><![CDATA[At work, I&#8217;m migrating over python to our 64bit machines and one thing that I&#8217;ve noticed was that there really was no standard python 64bit verification method to ensure the build was really 64bit or not. I&#8217;ve read somewhere previously, especially for the Mac OS X crowd, that the LDFLAGS=&#8221;-arch x86_64&#8243; flag had to be [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>At work, I&#8217;m migrating over <a title="Python" href="http://www.python.org/" target="_blank">python </a>to our 64bit machines and one thing that I&#8217;ve noticed was that there really was no standard python 64bit verification method to ensure the build was really 64bit or not. I&#8217;ve read <a title="somewhere" href="http://www.corepy.org/wiki/index.php?title=How_To_Build_a_64-bit_Python_and_use_Corepy/x86_64_on_OSX" target="_blank">somewhere</a> previously, especially for the Mac OS X crowd, that the LDFLAGS=&#8221;-arch x86_64&#8243; flag had to be passed in before building on a 64bit machine.</p>
<p>It looks like python2.6 changed the way it was required to build respective 64bit binaries. To build on standard linux x86_64 architecture, the following standard steps to installing on a 64bit machine worked for me:</p>
<pre class="brush: bash; title: ;">
./configure
make &amp;&amp; make test
make install
</pre>
<p>Surprisingly, I received a segmentation fault when building as well as testing. I&#8217;ve never seen this before, but for those of you who are interested, the error message was:</p>
<pre class="brush: bash; title: ;">
Parser/pgen ./Grammar/Grammar ./Include/graminit.h ./Python/graminit.c
make: *** [Include/graminit.h] Segmentation fault
Parser/pgen ./Grammar/Grammar ./Include/graminit.h ./Python/graminit.c
make: *** [Python/graminit.c] Segmentation fault
</pre>
<p>The verification step is actually pretty intuitive. An easy test to verify that you&#8217;re on a 64bit machine is to find the size of the MAX_INT. Luckily for us, python makes this a very easy verification.</p>
<p>To verify the build, I went on a regular python 32bit machine and I did:</p>
<pre class="brush: python; title: ;">
h[1] &gt;&gt;&gt; import sys
h[1] &gt;&gt;&gt; sys.maxint
2147483647
</pre>
<p>On a 64bit machine, I did:</p>
<pre class="brush: python; title: ;">
h[2] &gt;&gt;&gt; import sys
h[2] &gt;&gt;&gt; sys.maxint
9223372036854775807
</pre>
<p>Clearly, my 64bit installation worked:)</p>
<p>Hope this helps some of you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2009/07/verifying-python64-builds/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>python -c &#8216;print &#8220;hello world!&#8221; &#8216;</title>
		<link>http://blog.mahmoudimus.com/2009/07/hello-world/</link>
		<comments>http://blog.mahmoudimus.com/2009/07/hello-world/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 20:19:19 +0000</pubDate>
		<dc:creator>mahmoud</dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[canonical]]></category>
		<category><![CDATA[hello]]></category>
		<category><![CDATA[jVI]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[musings]]></category>
		<category><![CDATA[natural language processing]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[nlp]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[vocabulary]]></category>
		<category><![CDATA[world]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://mahmoudimus.com/blog/?p=1</guid>
		<description><![CDATA[And so, we meet again, world. I&#8217;ve finally gotten around to registering a home online, installing WordPress, and ready to share my ideas with the world. I&#8217;ve given a lot of topics some thought, and I think I might be able to influence and/or help others with my various migrations. First, I&#8217;d like to thank [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>And so, we meet again, world. I&#8217;ve finally gotten around to registering a home online, installing WordPress, and ready to share my ideas with the world. I&#8217;ve given a lot of topics some thought, and I think I might be able to influence and/or help others with my various migrations.</p>
<p>First, I&#8217;d like to thank Canonical for Ubuntu and making my migration from Windows to Linux desktop. Some kinks here, and there, but overall I think that it was pretty flawless. I&#8217;ve also started a large push towards using vim as my primary editor, instead of constantly switching between IDEs. I believe Netbeans 6.7 came out, I haven&#8217;t had the opportunity to play around with it, but if it was anything like Netbeans 6.5, then hey, that&#8217;s +1 for them! What a great IDE, especially with the fantastic jVI extension.</p>
<p>I&#8217;ll update various posts here and there with some musings about python (what a language), some software releases, mathematical musings, natural language processing tidbits (including really cool algorithms to generate domain names), and various interesting ideas that I&#8217;ve had some time to play around with.</p>
<p>A primary reason for starting up this blog is to share with the world some of my thoughts, improve my writing, and try to contribute to the open source world. I think there&#8217;s a lot of work to do and I can NOT wait to start. Well world, I&#8217;ll hope to speak to you soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2009/07/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

