<?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>python &#8211; Accidents Happen</title>
	<atom:link href="https://ah.thameera.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>https://ah.thameera.com</link>
	<description>In the dark</description>
	<lastBuildDate>Fri, 18 Oct 2013 07:06:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">56521109</site>	<item>
		<title>C++ as a scripting language</title>
		<link>https://ah.thameera.com/c-as-a-scripting-language/</link>
					<comments>https://ah.thameera.com/c-as-a-scripting-language/#respond</comments>
		
		<dc:creator><![CDATA[thameera]]></dc:creator>
		<pubDate>Fri, 18 Oct 2013 07:06:54 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[script]]></category>
		<guid isPermaLink="false">http://ah.thameera.com/?p=457</guid>

					<description><![CDATA[Jussi Pakkanen of Canonical writes: With the release of C++11 something quite extraordinary has happened. Its focus on usable libraries, value types and other niceties has turned C++, conceptually, into a scripting language. I don&#8217;t necessarily agree with everything on that post, but one thing&#8217;s clear: C++ isn&#8217;t what it used to be. With C++11 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Jussi Pakkanen of Canonical <a href="http://voices.canonical.com/jussi.pakkanen/2013/10/15/c-has-become-a-scripting-language">writes</a>:</p>
<blockquote><p>With the release of C++11 something quite extraordinary has happened. Its focus on usable libraries, value types and other niceties has turned C++, conceptually, into a scripting language.</p></blockquote>
<p>I don&#8217;t necessarily agree with everything on that post, but one thing&#8217;s clear: C++ isn&#8217;t what it used to be. With C++11 things have changed, a lot. </p>
<p>If I was to write a script it&#8217;d be python or a shell script, I wouldn&#8217;t even consider C++. But then again, if that is some script you need to run every once in a while or one that has to be run over and over again within a short period of time, why not just write it in C++ and compile to native code? It would run faster than any other scripting language would, without waiting for some runtime or VM to load up. </p>
<p>And now you don&#8217;t need to learn the ins and outs of pointer arithmetic to do this.  <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://ah.thameera.com/c-as-a-scripting-language/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">457</post-id>	</item>
		<item>
		<title>Python import and easter eggs</title>
		<link>https://ah.thameera.com/python-import-and-easter-eggs/</link>
					<comments>https://ah.thameera.com/python-import-and-easter-eggs/#respond</comments>
		
		<dc:creator><![CDATA[thameera]]></dc:creator>
		<pubDate>Wed, 16 Oct 2013 16:01:57 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[easter-eggs]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://ah.thameera.com/?p=455</guid>

					<description><![CDATA[Amir Rachum has a good primer on python&#8217;s import. If you&#8217;re new to python you should definitely give it a go. The post ends up with some cool import easter eggs. import antigravity import this from __future__ import braces import __hello__ from __future__ import barry_as_FLUFL Try them yourself in a REPL 🙂]]></description>
										<content:encoded><![CDATA[<p>Amir Rachum has <a href="http://blog.amir.rachum.com/post/63666832095/python-importing">a good primer</a> on python&#8217;s <code>import</code>. If you&#8217;re new to python you should definitely give it a go.</p>
<p>The post ends up with some cool <code>import</code> easter eggs.</p>
<blockquote><p><code>import antigravity<br />
import this<br />
from __future__ import braces<br />
import __hello__<br />
from __future__ import barry_as_FLUFL<br />
</code></p></blockquote>
<p>Try them yourself in a REPL <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://ah.thameera.com/python-import-and-easter-eggs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">455</post-id>	</item>
		<item>
		<title>print statement for C++</title>
		<link>https://ah.thameera.com/print-statement-for-c/</link>
					<comments>https://ah.thameera.com/print-statement-for-c/#respond</comments>
		
		<dc:creator><![CDATA[thameera]]></dc:creator>
		<pubDate>Sun, 13 Oct 2013 14:19:54 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://ah.thameera.com/?p=415</guid>

					<description><![CDATA[print-stmt is a Python-like print statement for C++. It&#8217;s damn easy to add it to the project: The easiest way to use this is to clone this repo and copy the file print.h into your project. Then simply #include "print.h" at the top of the file, but after the system #includes. This is pretty handy. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="https://github.com/adob/print-stmt">print-stmt</a> is a Python-like <em>print</em> statement for C++. It&#8217;s damn easy to add it to the project:</p>
<blockquote><p>The easiest way to use this is to clone this repo and copy the file <code>print.h</code> into your project. Then simply</p>
<p><code>#include "print.h"</code></p>
<p>at the top of the file, but after the system <code>#include</code>s.
</p></blockquote>
<p>This is pretty handy. Some example features:</p>
<blockquote>
<ul>
<li>bool prints &#8216;true&#8217; or &#8216;false&#8217;</li>
<li>A type that defines a member function called c_str() is converted to a string by calling this function.</li>
<li>A type that has a begin() member function that returns in iterator but does not have a c_str() member function is printed like a list, e.g. [&#8220;one&#8221;, &#8220;two&#8221;].</li>
</ul>
</blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://ah.thameera.com/print-statement-for-c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">415</post-id>	</item>
		<item>
		<title>Processing music tags with Python</title>
		<link>https://ah.thameera.com/processing-music-tags-with-python/</link>
					<comments>https://ah.thameera.com/processing-music-tags-with-python/#respond</comments>
		
		<dc:creator><![CDATA[thameera]]></dc:creator>
		<pubDate>Sun, 11 Nov 2012 17:19:45 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[directory tree]]></category>
		<category><![CDATA[id3reader]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://noisythameera.wordpress.com/?p=236</guid>

					<description><![CDATA[I was looking for the optimal way to traverse the directory tree with Python and found out that os.walk is the answer. To put this into practice, I wrote the following script which traverses the music library and finds out which MP3s haven&#8217;t been properly tagged. In other words, it will print the full paths [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I was looking for the optimal way to traverse the directory tree with Python and <a href="http://pythoncentral.org/how-to-traverse-a-directory-tree/" target="_blank">found out</a> that <code>os.walk</code> is the answer. To put this into practice, I wrote the following script which traverses the music library and finds out which MP3s haven&#8217;t been properly tagged. In other words, it will print the full paths of all MP3s that have any of the artist, album or title tracks missing. In my case, 502 of the 10466 songs had bad tags.</p>
<p>[sourcecode language=&#8221;python&#8221;]<br />
#!/usr/bin/python</p>
<p>import os<br />
import id3reader</p>
<p>rootdir = &quot;/home/thameera/Music&quot;<br />
processed = 0<br />
bad = 0</p>
<p>for thisDir, subdirList, fileList in os.walk(rootdir):<br />
	for fname in fileList:<br />
		if fname[-3:] == &#039;mp3&#039;:<br />
			processed += 1<br />
			fullPath = os.path.join(thisDir, fname)</p>
<p>			try:<br />
				id3r = id3reader.Reader(fullPath)<br />
			except:<br />
				bad += 1<br />
				print &quot;Error extracting id3 info from %s&quot; % fullPath<br />
				continue</p>
<p>			if None in (id3r.getValue(&#039;performer&#039;), id3r.getValue(&#039;album&#039;), id3r.getValue(&#039;title&#039;)):<br />
				bad += 1<br />
				print fullPath</p>
<p>print &quot;%d MP3s processed. Found bad tags in %d of them&quot; % (processed, bad)<br />
[/sourcecode]</p>
<p>It uses the <code><a href="http://nedbatchelder.com/code/modules/id3reader.html" target="_blank">id3reader</a></code> library to parse the tags. I don&#8217;t think it&#8217;ll work if you have files with other formats, like wma or flac. </p>
<p>This script can be further expanded to ignore certain directories, output only one entry per each directory that has bad tags, check for other tags as well, check if the artist tag does not match the name of the parent directory, etc, etc. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://ah.thameera.com/processing-music-tags-with-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">236</post-id>	</item>
		<item>
		<title>Most popular twitter clients</title>
		<link>https://ah.thameera.com/most-popular-twitter-clients/</link>
					<comments>https://ah.thameera.com/most-popular-twitter-clients/#respond</comments>
		
		<dc:creator><![CDATA[thameera]]></dc:creator>
		<pubDate>Wed, 07 Nov 2012 17:07:08 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[twitter]]></category>
		<guid isPermaLink="false">http://noisythameera.wordpress.com/?p=223</guid>

					<description><![CDATA[I was playing with Twitter&#8217;s streaming API and thought of finding out what the most popular twitter clients are. So I listened to Twitter&#8217;s stream of public tweets for half an hour and sorted the list of tweet sources. The sample contained 100,000 random public tweets. The top ten clients were: web &#8211; 24697 Twitter [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I was playing with Twitter&#8217;s streaming API and thought of finding out what the most popular twitter clients are. So I listened to Twitter&#8217;s <a href="https://dev.twitter.com/docs/api/1.1/get/statuses/sample" target="_blank">stream of public tweets</a> for half an hour and sorted the list of tweet sources. The sample contained 100,000 random public tweets. The top ten clients were:</p>
<ol>
<li>web &#8211; 24697</li>
<li>Twitter for iPhone &#8211; 17564</li>
<li>Twitter for Android &#8211; 13007</li>
<li>Twitter for BlackBerry® &#8211; 10592</li>
<li>Mobile Web &#8211; 3521</li>
<li>UberSocial for BlackBerry &#8211; 1849</li>
<li>TweetDeck &#8211; 1776</li>
<li>Twitter for iPad &#8211; 1411</li>
<li>Facebook &#8211; 1322</li>
<li>Echofon &#8211; 1320</li>
</ol>
<p>As expected, the Twitter web is the source of almost a quarter of the tweets, while the official clients for iPhone, Android and Blackberry take the next slots. And then comes the Mobile Web. Twitter for iPad sits in the 8th place. In other words, more than 70% of the world&#8217;s tweets are posted from official clients. </p>
<p> The complete list of results is <a href="https://dl.dropbox.com/u/3901152/2012_11_07.out.txt" target="_blank">here</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://ah.thameera.com/most-popular-twitter-clients/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">223</post-id>	</item>
		<item>
		<title>Kivy &#8211; Python framework for Android and more</title>
		<link>https://ah.thameera.com/kivy-python-framework-for-android-and-more/</link>
					<comments>https://ah.thameera.com/kivy-python-framework-for-android-and-more/#respond</comments>
		
		<dc:creator><![CDATA[thameera]]></dc:creator>
		<pubDate>Sun, 21 Oct 2012 03:32:05 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[kivy]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://noisythameera.wordpress.com/?p=155</guid>

					<description><![CDATA[Came across this article on Kivy for Android on Hacker News. According to kivy.org, Kivy is an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. The widgets look pretty and the samples seem to have sophisticated and rich interfaces. The graphics are in [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Came across <a href="http://archlinux.me/dusty/2012/10/16/python-on-android-first-impressions-of-kivy/" target="_blank">this article</a> on Kivy for Android on Hacker News. According to <a href="http://kivy.org" target="_blank">kivy.org</a>, Kivy is </p>
<blockquote><p>an open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps.</p></blockquote>
<p>The widgets look pretty and <a href="http://kivy.org/#gallery" target="_blank">the samples</a> seem to have sophisticated and rich interfaces. The graphics are in fact drawn by hardware-accelerated OpenGL commands. The widgets are written in C to improve performance. I went through some of the <a href="http://kivy.org/docs/guide-index.html" target="_blank">Docs</a> and the learning curve seems to be surprisingly short. I&#8217;m yet to build a package for Android, it&#8217;d work without much fuss hopefully. Will keep you updated.</p>
<p>And the best thing is, it&#8217;s Python; not the ugly Java. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://ah.thameera.com/kivy-python-framework-for-android-and-more/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">155</post-id>	</item>
	</channel>
</rss>
