<?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>Code-itch &#187; Python</title>
	<atom:link href="http://www.code-itch.com/blog/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.code-itch.com/blog</link>
	<description>A non-coders attempts at writing useful code</description>
	<lastBuildDate>Sat, 20 Mar 2010 20:13:04 +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>Ahh ! for argparse</title>
		<link>http://www.code-itch.com/blog/2009/07/ahh-for-argparse/</link>
		<comments>http://www.code-itch.com/blog/2009/07/ahh-for-argparse/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 15:17:29 +0000</pubDate>
		<dc:creator>harijay</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[argparse python]]></category>

		<guid isPermaLink="false">http://www.code-itch.com/blog/?p=123</guid>
		<description><![CDATA[Its been a while since I blogged . Just a lot happening on the crystallography side of things to allow me the time to blog. I have also been coding a lot lately and have gotten started with some GUI writing in wxpython. This post is about trying to get back into the groove by [...]]]></description>
			<content:encoded><![CDATA[<p>Its been a while since I blogged . Just a lot happening on the crystallography side of things to allow me the time to blog.</p>
<p>I have also been coding a lot lately and have gotten started with some GUI writing in wxpython.</p>
<p>This post is about trying to get back into the groove by telling you about argparse .<a href="http://www.code-itch.com/blog/2009/04/command-line-handling-in-python-with-optparse/"> Having talked about optparse</a> and command line parsing , I heard about argparse thanks to a talk that I caught  by clicking a link on  the<a href="http://us.pycon.org/2009/conference/schedule/"> Pycon2009 master schedule</a> .  This link has all the Pycon 2009 slides and video links in one place &#8211; a great resource.</p>
<p>For those interested in <a href="http://code.google.com/p/argparse/">argparse</a> check out the &#8220;Plenary Evening session &#8221; on Sunday Mar 29th 1.20 pm at PyCon2009 where<a href="http://us.pycon.org/2009/conference/schedule/event/97/"> Steven Bethard talks about argparse.</a><br />
<object width="720" height="510" data="http://blip.tv/play/AfiLMZWmLQ" type="application/x-shockwave-flash"><param name="src" value="http://blip.tv/play/AfiLMZWmLQ" /><param name="allowfullscreen" value="true" /></object></p>
<p>The most important difference between <a href="http://code.google.com/p/argparse/">argparse </a>and optparse is that argparse provides better handling for positional <a href="http://argparse.googlecode.com/svn/trunk/doc/argparse-vs-optparse.html">arguments in addition to optional arguments</a> . Argparse also provides automatically generated useage information and   takes care of handling cases like when the user forgets to provide any arguments and prints the help information by default.</p>
<p>The key differences are summarized in the <a href="http://argparse.googlecode.com/svn/trunk/doc/argparse-vs-optparse.html">excellent documentation at this URL</a> , so I will not rehash it . But I have happily switched over to argparse from optparse and hope argparse becomes part of the python standard libraries soon.</p>
<p>For <a href="http://github.com/harijay/xtaltools/tree/master">some code examples check out my github repository</a> especially the script <a href="http://github.com/harijay/xtaltools/blob/e683fcef6a5ad7394b87382e58d4dce32a85585b/maskconvert.py">maskconvert.py</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.code-itch.com/blog/2009/07/ahh-for-argparse/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>XML parsing &#8211; python</title>
		<link>http://www.code-itch.com/blog/2007/04/xml-parsing-python/</link>
		<comments>http://www.code-itch.com/blog/2007/04/xml-parsing-python/#comments</comments>
		<pubDate>Thu, 12 Apr 2007 17:17:29 +0000</pubDate>
		<dc:creator>harijay</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[TinySeqXML]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[UnicodeEncodeError]]></category>
		<category><![CDATA[diveintopython]]></category>

		<guid isPermaLink="false">http://codeitch.wordpress.com/2007/04/12/xml-parsing-python/</guid>
		<description><![CDATA[[youtube=http://www.youtube.com/watch?v=L-_6tiTR8v0] XML is a great way to organize information. I first learnt of the power of XML to systematize information when I used it to output a whole bunch of search results from NCBI in the Tinyseq XML format. Once I had this XML document , I could read it into Excel and then very [...]]]></description>
			<content:encoded><![CDATA[<p>[youtube=http://www.youtube.com/watch?v=L-_6tiTR8v0]</p>
<p>XML is a great way to organize information. I first learnt of the power of XML to systematize information when I used it to output a whole bunch of search results from NCBI in the<a href="http://xml.coverpages.org/NCBI-XML-Toolbox.txt"> Tinyseq XML format</a>. Once I had this XML document , I could read it into Excel and then very easily analyze the information since it was nicely laid out as an Excel sheet.</p>
<p><a href="http://harijay.wordpress.com/2006/09/28/moving-elns-offsite/">Backpackit a service I use to take notes detailing my experimental research  results</a><br />
outputs all of the account data in XML format. Before I can move this data elsewhere , it helps for me to understand the data structure. So the first task I  set out to do was to parse the XML output.</p>
<p>I decided to use Python for this , because I felt using Java here would be like using an elephant to crush a fly ( or whatever the expression is ). Also a lot of the data is text , and I always used perl previously to handle text.  So a general basis for my codeitch will be What I did in Perl before I wold like to do in Python now. Java will be used once for more heavyweight tasks.</p>
<p>What I needed my program to do was :</p>
<ol>
<li> Read the XML output</li>
<li>Create objects for each element or node in the output</li>
</ol>
<p>I can then imagine that once I have these objects I can ask questions like how many objects have embedded images , how many objects have outgoing links etc etc..</p>
<p>The <a href="http://www.diveintopython.org/">&#8220;Dive into python &#8220;</a> book gave me a quick introduction into the <a href="http://www.diveintopython.org/xml_processing/parsing_xml.html">xml.dom package</a>. I then ran into some encoding or codec issues and learnt all about <a href="http://www.reportlab.com/i18n/python_unicode_tutorial.html">&#8220;utf8&#8243; and &#8220;iso8859&#8243; character encoding</a>. Once I learnt <a href="http://wiki.wxpython.org/index.cgi/UnicodeEncodeError">how to handle the UnicodeEncodeError</a> , I had a full fledged three line program that parsed my input file , created the document object and as proof of successful parsing and printed my XML file back out.</p>
<p>The screencast above documents my travails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.code-itch.com/blog/2007/04/xml-parsing-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Codeitch- or the desire to codeify and systematize everything I do</title>
		<link>http://www.code-itch.com/blog/2007/04/codeitch-or-the-desire-to-codeify-and-systematize-everything-i-do/</link>
		<comments>http://www.code-itch.com/blog/2007/04/codeitch-or-the-desire-to-codeify-and-systematize-everything-i-do/#comments</comments>
		<pubDate>Wed, 11 Apr 2007 08:52:18 +0000</pubDate>
		<dc:creator>harijay</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Matlab]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://codeitch.wordpress.com/2007/04/11/codeitch-or-the-desire-to-codeify-and-systematize-everything-i-do/</guid>
		<description><![CDATA[This blog is roughly about my attempts to codify , algorithmize and systematize everything I do. In it I will hopefully detail my march to coding and getting proficient in a bunch of computer languages. After a long process of looking around , I have narrowed my focus to the following 3 languages in no [...]]]></description>
			<content:encoded><![CDATA[<p>This blog is roughly about my attempts to codify , algorithmize and systematize everything I do. In it I will hopefully detail my march to coding and getting proficient in a bunch of computer languages. After a long process of looking around , I have narrowed my focus to the following 3 languages in no particular order.<br />
Java , Python and Javascript.</p>
<p>The reasons for these will hopefully emerge as I begin posting. But I will try and spell them out here</p>
<p>Java :I like java for two reasons , its one of the most widely used languages in the enterprise space and the second and very important reason are the Java IDEs. Both java IDEs I use namely Eclipse and Netbeans are Free and amazingly featured. Code prompting available in both IDEs make mastering an API a lot easier than learning the same functionality using other languages or platforms. Also, I love Javadoc !. It really makes picking up new APIs a little easier</p>
<p>Python : My first crack at automating anything came with Perl scripting. I will not lie if I say that If I have to do anything today I will first use Perl. But after several year of Perl use I found I was re-using very little code. I have to get more object oriented in the way I code, and since I never quite got a hang of Perl objects , and its namespace conventions!. Python which is at its heart a purely object oriented scripting language with libraries that easily rival Java was a natural scripting alternative.Learning Python I hope will teach me how to script smart objects that will beg to be reused.</p>
<p>Javascript : This is a surprising bedfellow to my codeitch. I want to learn javascript simply because it is becoming very fashionable. Google Maps and gmail have AJAX at their core and Javascript is the J in AJAX. Plus I have always fancied having a web frontend to everything I do and I am sure Javascript will beg to be used when that happens.</p>
<p>The above are the three languages I want to master.</p>
<p>Apart from these there are two platforms that I want to get comfortable with and they are</p>
<p>Excel : Everyone in the business world uses Excel. Spreadsheets were the PCs killer App and Excel is in my mind microsofts great product. I have seen the amazing things ou can do in Excel without writing a single line of code, and I want to learn to use its power.</p>
<p>Matlab: This platform from Mathworks is the bread and butter of engineering computation. I am anything but an engineer but have seen matlabs power when it comes to simulations. A lot of the very academic questions that I have in my research can really benefit from learning the Matlab platform and no I am not fully convinced on why exactly I need to use Matlab, maybe I will find a more concrete reason.</p>
<p>refs: <a href="http://harijay.tumblr.com/post/773433" title="Tumblr post summary for codeitch">My tumblr feed</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.code-itch.com/blog/2007/04/codeitch-or-the-desire-to-codeify-and-systematize-everything-i-do/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
