<?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>i R pranav &#187; Uncategorized</title>
	<atom:link href="http://pranavashok.com/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://pranavashok.com/blog</link>
	<description>Randomly timed doeses of boringness</description>
	<lastBuildDate>Fri, 07 May 2010 18:28:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Script to Download Fonts in Bulk From dafont.com</title>
		<link>http://pranavashok.com/blog/2010/05/script-to-download-fonts-in-bulk-from-dafont-com/</link>
		<comments>http://pranavashok.com/blog/2010/05/script-to-download-fonts-in-bulk-from-dafont-com/#comments</comments>
		<pubDate>Fri, 07 May 2010 17:59:47 +0000</pubDate>
		<dc:creator>Pranav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dafont]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://pranavashok.com/blog/?p=101</guid>
		<description><![CDATA[Being into design related stuff since joining college, I&#8217;ve found it a necessity to maintain a decent font collection. In this post, I will share and explain the script which helped me to create my collection. What my script does is download fonts directly off a top 20 list of fonts from dafont.com, for each [...]]]></description>
			<content:encoded><![CDATA[<p>Being into design related stuff since joining college, I&#8217;ve found it a necessity to maintain a decent font collection. In this post, I will share and explain the script which helped me to create my collection. </p>
<p>What my script does is download fonts directly off a top 20 list of fonts from <a href="http://www.dafont.com/">dafont.com</a>, for each sub-category available there.</p>
<p>The website has a very organized way to let users download fonts. First, there are categories like <strong>Fancy, Foreign Look, Techno, Gothic</strong> etc. Under each of these categories, there are sub-categories. Each subcategory has an ID which will help our purpose.</p>
<p>You can just change the ID range in the script to download fonts of different category.</p>
<p><strong>The Script</strong></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#! /usr/bin/python</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Name: dafont.com Bulk Download Tool</span>
<span style="color: #808080; font-style: italic;"># Version: 0.3</span>
<span style="color: #808080; font-style: italic;"># Summary: A tool for downloading top 20 fonts of each sub-category of dafont.com</span>
<span style="color: #808080; font-style: italic;"># License: BSD</span>
<span style="color: #808080; font-style: italic;"># Author: Pranav Ashok</span>
<span style="color: #808080; font-style: italic;"># Author-email: iam@pranavashok.com</span>
<span style="color: #808080; font-style: italic;"># Author-homepage: http://pranavashok.com/blog</span>
<span style="color: #808080; font-style: italic;"># Support: http://pranavashok.com/blog/2010/05/script-to-download-fonts-in-bulk-from-dafont-com</span>
<span style="color: #808080; font-style: italic;"># Support: Twitter (@pranavashok)</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> BeautifulSoup <span style="color: #ff7700;font-weight:bold;">import</span> BeautifulSoup
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">commands</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">string</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> cat <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">101</span>, <span style="color: #ff4500;">119</span><span style="color: black;">&#41;</span>: <span style="color: #808080; font-style: italic;">#ID Range 101-119</span>
	url = <span style="color: #483d8b;">'http://www.dafont.com/theme.php?cat=%d&amp;nb_ppp=20'</span> <span style="color: #66cc66;">%</span> cat
	contents = <span style="color: #dc143c;">commands</span>.<span style="color: black;">getoutput</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;curl -s '&quot;</span>+url+<span style="color: #483d8b;">&quot;'&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
	w = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'downloader.sh'</span>, <span style="color: #483d8b;">'a'</span><span style="color: black;">&#41;</span>
&nbsp;
	soup = BeautifulSoup<span style="color: black;">&#40;</span>contents<span style="color: black;">&#41;</span>
	directory = soup.<span style="color: black;">find</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'title'</span><span style="color: black;">&#41;</span>.<span style="color: black;">contents</span>
	wholeTag = soup.<span style="color: black;">findAll</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'a'</span>, <span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;class&quot;</span> : <span style="color: #483d8b;">&quot;dl&quot;</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
	directory<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> = <span style="color: #dc143c;">string</span>.<span style="color: black;">rstrip</span><span style="color: black;">&#40;</span>directory<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">&quot; | dafont.com&lt;/title&gt;&quot;</span><span style="color: black;">&#41;</span>
	fontCat, useless, subCat = directory<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">partition</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot; &amp;gt; &quot;</span><span style="color: black;">&#41;</span>
&nbsp;
	w.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'mkdir <span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #66cc66;">%</span> fontCat<span style="color: black;">&#41;</span>
	w.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'cd <span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #66cc66;">%</span> fontCat<span style="color: black;">&#41;</span>
&nbsp;
	w.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'mkdir <span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #66cc66;">%</span> subCat<span style="color: black;">&#41;</span>
	w.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'cd <span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #66cc66;">%</span> subCat<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> link <span style="color: #ff7700;font-weight:bold;">in</span> wholeTag:
		name = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">basename</span><span style="color: black;">&#40;</span>link<span style="color: black;">&#91;</span><span style="color: #483d8b;">'href'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
		fileName, fileExt = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">splitext</span><span style="color: black;">&#40;</span>name<span style="color: black;">&#41;</span>
		fileName = <span style="color: #dc143c;">string</span>.<span style="color: black;">lstrip</span><span style="color: black;">&#40;</span>fileName, <span style="color: #483d8b;">&quot;?f=&quot;</span><span style="color: black;">&#41;</span>
		w.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'wget -c -O <span style="color: #000099; font-weight: bold;">\&quot;</span>%s.zip<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>fileName, link<span style="color: black;">&#91;</span><span style="color: #483d8b;">'href'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	w.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'cd ..<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
	w.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'cd ..<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
	w.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p><span id="more-101"></span></p>
<p><strong>Dependencies</strong></p>
<p>This script has used python library called <a href="http://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a> for parsing HTML. If you are a developer, I&#8217;d recommend you to try BeautifulSoup. It&#8217;s got a nice documentation and it&#8217;s easy to use.</p>
<p><strong>Usage</strong></p>
<p>1. Download <a href='http://pranavashok.com/blog/wp-content/uploads/2010/05/DaFontDownloader.tar.gz'>dafont.com Bulk Downloader Tool</a><br />
2. Extract the files<br />
3. Open terminal and navigate to the folder where <strong>final.py</strong> is located.<br />
4. Execute the command</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ python final.py</pre></div></div>

<p>5. A file called <strong>downloader.sh</strong> would have been generated in the folder.<br />
6. Copy it to the place where you want the fonts to be downloaded.<br />
7. Navigate to that folder in terminal and run the command</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sh</span> downloader.sh</pre></div></div>

<p>8. You&#8217;ll have a neatly organized collection of fonts. All you gotta do now is extract them from their archives.</p>
<p>Enjoy! And please post your <em>suggestions</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://pranavashok.com/blog/2010/05/script-to-download-fonts-in-bulk-from-dafont-com/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Script to Download TED Videos in Bulk</title>
		<link>http://pranavashok.com/blog/2009/12/script-to-download-ted-videos-in-bulk/</link>
		<comments>http://pranavashok.com/blog/2009/12/script-to-download-ted-videos-in-bulk/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 20:39:36 +0000</pubDate>
		<dc:creator>Pranav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[TED]]></category>
		<category><![CDATA[Videos]]></category>

		<guid isPermaLink="false">http://pranavashok.com/blog/?p=86</guid>
		<description><![CDATA[I recently became addicted to TED Videos. This inspired me to create a simple python script which helps one download TED Talks in bulk. Here is the main part of the script. Scroll down for download link and usage instructions. #! /usr/bin/python &#160; # Name: TED Video Downloader # Version: 0.4 # Summary: A bulk [...]]]></description>
			<content:encoded><![CDATA[<p>I recently became addicted to <a href="http://www.ted.com/">TED Videos</a>. This inspired me to create a simple python script which helps one download <a href="http://www.ted.com/talks">TED Talks</a> in bulk. Here is the main part of the script. <em>Scroll down for download link and usage instructions.</em></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#! /usr/bin/python</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Name: TED Video Downloader</span>
<span style="color: #808080; font-style: italic;"># Version: 0.4</span>
<span style="color: #808080; font-style: italic;"># Summary: A bulk TED Talks download tool</span>
<span style="color: #808080; font-style: italic;"># License: BSD</span>
<span style="color: #808080; font-style: italic;"># Author: Pranav Ashok</span>
<span style="color: #808080; font-style: italic;"># Author-email: iam@pranavashok.com</span>
<span style="color: #808080; font-style: italic;"># Author-homepage: http://pranavashok.com/blog</span>
<span style="color: #808080; font-style: italic;"># Support: http://pranavashok.com/blog/2009/12/script-to-download-ted-videos-in-bulk/</span>
<span style="color: #808080; font-style: italic;"># Support: Twitter (@pranavashok)</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> BeautifulSoup <span style="color: #ff7700;font-weight:bold;">import</span> BeautifulSoup
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">urllib2</span> <span style="color: #ff7700;font-weight:bold;">import</span> urlopen
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> link <span style="color: #ff7700;font-weight:bold;">in</span> f:
	web = urlopen<span style="color: black;">&#40;</span>link<span style="color: black;">&#41;</span>
	soup = BeautifulSoup<span style="color: black;">&#40;</span>web.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	wholeTag = soup.<span style="color: black;">find</span><span style="color: black;">&#40;</span>href=<span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;/talks/download/video/.+&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
	name = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">basename</span><span style="color: black;">&#40;</span>link<span style="color: black;">&#41;</span>
	fileName, fileExt = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">splitext</span><span style="color: black;">&#40;</span>name<span style="color: black;">&#41;</span>
	outputFile = fileName+<span style="color: #483d8b;">&quot;.mp4&quot;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;"># wholeTag['href'] gives the value of the href attribute</span>
	downloadUrl = <span style="color: #483d8b;">&quot;http://www.ted.com&quot;</span>+wholeTag<span style="color: black;">&#91;</span><span style="color: #483d8b;">'href'</span><span style="color: black;">&#93;</span>
&nbsp;
	w = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'downloader.sh'</span>, <span style="color: #483d8b;">'a'</span><span style="color: black;">&#41;</span>
	w.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'wget -c -O <span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>outputFile, downloadUrl<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	w.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
exit<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p><span id="more-86"></span><br />
<strong>Dependencies</strong><br />
This script has used python library called <a href="http://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a> for parsing HTML. If you are a developer, I&#8217;d recommend you to try BeautifulSoup. It&#8217;s got a nice documentation and it&#8217;s easy to use.<br />
(<em>Note: You don&#8217;t need to download this, I&#8217;ve included it along with my script</em>)</p>
<p><strong>Instructions</strong><br />
1. Download the <a href="http://pranavashok.com/blog/wp-content/uploads/2009/12/TED-Downloader.tar.bz2">TED Video Downloader</a><br />
2. Extract the files to the directory where you want the videos to be downloaded.<br />
3. Edit the <strong>toDownload.txt</strong> file and add the links of each <a href="http://www.ted.com/talks">TED Video</a> in a new line (example links are already present).<br />
4. Open a terminal and change to the directory where you extracted the files.<br />
5. Execute &#8216;<strong>sh run-first.sh</strong>&#8216;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sh</span> run-first.sh</pre></div></div>

<p>6. The python script will be executed automatically and download will start soon (depending on the length of your list)<br />
7. If you want to stop the downloads, press Ctrl+C.<br />
8. To resume a stopped/interrupted download, execute the following command in terminal &#8211; &#8216;<strong>sh downloader.sh</strong>&#8216;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sh</span> downloader.sh</pre></div></div>

<p>9. Enjoy the videos!<br />
<strong></strong></p>
<p><strong>Limitations</strong><br />
I haven&#8217;t implemented any sort of error handling. If the <a href="http://www.ted.com/">TED.com</a> decides to change the format of their video page, this script might stop working. In that case, please drop a comment here and I&#8217;ll fix it as soon as possible.</p>
<p>Hope you liked this script. Suggestions on optimization of the script are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://pranavashok.com/blog/2009/12/script-to-download-ted-videos-in-bulk/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Start Using Linux &#8211; Basic Terminal Commands</title>
		<link>http://pranavashok.com/blog/2009/12/start-using-linux-basic-terminal-commands/</link>
		<comments>http://pranavashok.com/blog/2009/12/start-using-linux-basic-terminal-commands/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 04:43:39 +0000</pubDate>
		<dc:creator>Pranav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://pranavashok.com/blog/?p=66</guid>
		<description><![CDATA[This is a compilation of some terminal commands I&#8217;ve found useful. Before starting, I&#8217;d like to emphasize on a few things: - You might want to understand the filesystem hierarchy in linux before you start. - When you start terminal, your default working directory is /home/user-name - If you want to get more info on [...]]]></description>
			<content:encoded><![CDATA[<p>This is a compilation of some terminal commands I&#8217;ve found useful.</p>
<p>Before starting, I&#8217;d like to emphasize on a few things:<br />
<em>- You might want to understand the filesystem hierarchy in linux before you start.<br />
- When you start terminal, your default working directory is /home/user-name<br />
- If you want to get more info on any command, just type &#8216;</em>command-name &#8211;help<em>&#8216; without the quotes in terminal.<br />
- In this post, when I say &#8216;type&#8217; something in terminal, it means &#8216;execute it&#8217; by typing it and pressing enter.<br />
- Whenever you want to end a looping command, for example, ping in terminal &#8211; press Ctrl + C.<br />
</em><br />
<span id="more-66"></span></p>
<p>These are the list of commands explained in this post:</p>
<ul>
<li><a href="#cat"> cat &#8211; view contents of a file</a></li>
<li><a href="#cd"> cd &#8211; change directory</a></li>
<li><a href="#clear"> clear &#8211; clear the terminal windows</a></li>
<li><a href="#cp"> cp &#8211; copy</a></li>
<li><a href="#df"> df &#8211; view free space in disks</a></li>
<li><a href="#exit"> exit &#8211; exit terminal</a></li>
<li><a href="#ls"> ls &#8211; list contents of current folder</a></li>
<li><a href="#mkdir"> mkdir &#8211; create a new folder</a></li>
<li><a href="#mv"> mv &#8211; move</a></li>
<li><a href="#ping"> ping &#8211; ping a remote server</a></li>
<li><a href="#rm"> rm &#8211; remove files/folders</a></li>
<li><a href="#rmdir"> rmdir &#8211; remove empty folders</a></li>
<li><a href="#sudo"> sudo &#8211; access as another user</a></li>
<li><a href="#tar"> tar &#8211; operations with compressed archives</a></li>
</ul>
<p><strong><a name="cat">cat</a></strong> &#8211; Used to display contents of a file</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> cat Desktop/Hello.ext<br />
Hello, World!<br />
This is a file with a random extension.<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span><br />
</code></p>
<p><em>Tip: Try executing the following command</em><br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> cat --help</code></p>
<p><strong><a name="cd">cd</a></strong> &#8211; Used to change the working directory</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> cd Desktop/<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/Desktop $</span> cd ..<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> cd /<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">/ $</span> cd ~<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span><br />
</code></p>
<p>Explanation of the above code: Change directory to Desktop (<strong>cd Desktop/</strong>) -&gt; Go back one level (<strong>cd ..</strong>) -&gt; Change directory to the root directory (<strong>cd /</strong>) -&gt; Change directory to the home directory (<strong>cd ~</strong>)</p>
<p><strong><a name="clear">clear</a></strong> &#8211; Used to clear the terminal screen</p>
<p>Basically, what it does is shift everything above the viewable area. Just scroll up to see the history.</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> clear</code></p>
<p><strong><a name="cp">cp</a></strong> &#8211; Used to copy files/folders</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/Desktop $</span> cp [options] source destination</code><br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/Desktop $</span> cp -dpR twython/ /home/pranav/twython<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/Desktop $</span><br />
</code></p>
<p>The option <strong>-dpR</strong> is used to create a replica of the twython folder (located in the /home/pranav/desktop) in /home/pranav.</p>
<p>Here is a small list of options for the cp command:</p>
<blockquote><p>-a, &#8211;archive                same as -dpR<br />
-d, &#8211;no-dereference         preserve links<br />
-f, &#8211;force                  remove existing destinations, never prompt<br />
-i, &#8211;interactive            prompt before overwrite<br />
-p, &#8211;preserve               preserve file attributes if possible<br />
-r                           copy recursively, non-directories as files<br />
-R, &#8211;recursive              copy directories recursively<br />
-u, &#8211;update                 copy only when the SOURCE file is newer than the destination file or when the destination file is missing<br />
-v, &#8211;verbose                explain what is being done</p></blockquote>
<p><em>For the full list, run <strong>cp &#8211;help</strong> in terminal.</em></p>
<p><strong><a name="df">df</a></strong> &#8211; Used to check the free space on your disks</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> df<br />
Filesystem           1K-blocks      Used Available Use% Mounted on<br />
/dev/sda1             34677256   4375624  28540108  14% /<br />
udev                    383740       256    383484   1% /dev<br />
none                    383740       524    383216   1% /dev/shm<br />
none                    383740       292    383448   1% /var/run<br />
none                    383740         0    383740   0% /var/lock<br />
none                    383740         0    383740   0% /lib/init/rw<br />
/dev/sda10            80883520  74598944   6284576  93% /media/9465-C776<br />
/dev/sda5             47182872  44720900   2461972  95% /media/Local Disk<br />
/dev/sda6             80895272  59800852  21094420  74% /media/22B86022B85FF2B1<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> </code></p>
<p><em>Tip: Use the <strong>-h</strong> switch to make it human readable.</em></p>
<p><strong><a name="exit">exit</a></strong> &#8211; Used to exit the terminal</p>
<p><strong><a name="ls">ls</a></strong> (with a lowercase L, not and uppercase i) &#8211; Used to list files/folders in the current directory</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> ls<br />
bin      Documents     Music     Projects  Videos<br />
Desktop  hplip-3.9.10  Pictures  twython   works<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span><br />
</code></p>
<p><strong><a name="mkdir">mkdir</a></strong> &#8211; Used to create new folders</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/works $</span> ls<br />
app.yaml  index.py  index.yaml<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/works $</span> mkdir py-projects<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/works $</span> ls<br />
app.yaml  index.py  index.yaml  py-projects<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/works $</span><br />
</code></p>
<p><strong><a name="mv">mv</a></strong> &#8211; Used to move files/folders</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> mv hplip-3.9.10/ works/py-projects/<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> ls works/py-projects/<br />
hplip-3.9.10<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span><br />
</code></p>
<p><strong><a name="ping">ping</a></strong> &#8211; Used to test a network connection</p>
<p>Usage: (<em>To stop the pinging, press <strong>Ctrl + C</strong></em>)<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> ping google.com<br />
PING google.com (209.85.231.104) 56(84) bytes of data.<br />
64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=1 ttl=53 time=121 ms<br />
64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=2 ttl=53 time=121 ms<br />
64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=3 ttl=53 time=121 ms<br />
^C64 bytes from maa03s01-in-f104.1e100.net (209.85.231.104): icmp_seq=4 ttl=53 time=121 ms<br />
--- google.com ping statistics ---<br />
4 packets transmitted, 4 received, 0% packet loss, time 3003ms<br />
rtt min/avg/max/mdev = 121.100/121.298/121.685/0.483 ms<br />
</code></p>
<p><strong><a name="rm">rm</a></strong> &#8211; Used to remove/delete files</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/works/py-projects/hplip-3.9.10 $</span> rm *.*<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/works/py-projects/hplip-3.9.10 $</span></code></p>
<p>The above command removes all files with an extension from the working directory, hplip-3.9.10 in this case. <em>Please note that it doesn&#8217;t delete files without an extension</em>.</p>
<p>To delete everything inside a directory, the option <strong>-r</strong> can be used.<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/works/py-projects/hplip-3.9.10 $</span> rm -r *<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/works/py-projects/hplip-3.9.10 $</span> </code></p>
<p><strong><a name="rmdir">rmdir</a></strong> &#8211; Used to remove empty directories</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span><span style="color: #99ccff;"> ~/works/py-projects $</span> rmdir hplip-3.9.10/<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/works/py-projects $</span> </code></p>
<p><strong><a name="sudo">sudo</a></strong> &#8211; Used to execute commands as other users</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> sudo su pranav<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $ </span></code></p>
<p><code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~ $</span> sudo su<br />
[sudo] password for pranav:</code></p>
<p><code><span style="color: #800000;">pranav-desktop <span style="color: #99ccff;">pranav</span></span><span style="color: #99ccff;">#</span> </code></p>
<p>Here, the user is changed to <strong>root</strong>.</p>
<p><em>Note: When no argument is given to the su command, the default argument, root, is used.</em></p>
<p><strong><a name="tar">tar</a></strong> &#8211; Used to do operations like store, list or extract files in an archive.</p>
<p>Usage:<br />
<code><span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/Desktop $</span> tar -xvzf wordpress-2.8.6.tar.gz<br />
.<br />
.<br />
.<br />
wordpress/wp-content/themes/default/archives.php<br />
wordpress/wp-content/themes/default/search.php<br />
wordpress/wp-content/themes/default/screenshot.png<br />
wordpress/wp-content/themes/default/archive.php<br />
wordpress/wp-content/themes/default/comments-popup.php<br />
wordpress/wp-content/themes/default/footer.php<br />
wordpress/wp-content/themes/default/page.php<br />
wordpress/wp-content/themes/default/sidebar.php<br />
wordpress/wp-content/themes/default/style.css<br />
wordpress/wp-content/themes/default/functions.php<br />
wordpress/wp-content/themes/default/links.php<br />
wordpress/wp-content/themes/default/rtl.css<br />
wordpress/wp-cron.php<br />
wordpress/wp-load.php<br />
wordpress/wp-feed.php<br />
wordpress/wp-mail.php<br />
<span style="color: #339966;">pranav@pranav-desktop</span> <span style="color: #99ccff;">~/Desktop $</span> </code></p>
<p>For more information on any of the commands or to get the full list of commands, visit <a href="http://ss64.com/bash/">bash commands</a>. Alternatively, you can use <em>&#8211;help</em> <img src='http://pranavashok.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Have fun with terminal!</p>
<p><em>Edited on 17 Dec 2009</em><br />
<strong>I came across <a href="http://lindesk.com/2009/04/customizing-the-terminal-6-command-line-tips-and-tricks/">this post (at lindesk.com)</a> today. It contains some really cool tips! Check it out.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://pranavashok.com/blog/2009/12/start-using-linux-basic-terminal-commands/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating a WordPress Sandbox &#8211; Installing WordPress Locally</title>
		<link>http://pranavashok.com/blog/2009/12/creating-a-wordpress-sandbox-installing-wordpress-locally/</link>
		<comments>http://pranavashok.com/blog/2009/12/creating-a-wordpress-sandbox-installing-wordpress-locally/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 20:32:23 +0000</pubDate>
		<dc:creator>Pranav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[WAMP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://pranavashok.com/blog/?p=64</guid>
		<description><![CDATA[Here&#8217;s a video I created an hour ago. Basically, it guides you in creating a wordpress sandbox to test your themes/plugins and other features of wordpress. You&#8217;ll need to download: 1. WAMPServer 2 from http://www.wampserver.com/dl.php) and; 2. WordPress from http://wordpress.org/latest.zip) I&#8217;m planning to create more tutorial videos. Please give your suggestions, if any.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a video I created an hour ago. Basically, it guides you in creating a wordpress sandbox to test your themes/plugins and other features of wordpress.</p>
<p>You&#8217;ll need to download:<br />
1. <strong>WAMPServer 2</strong> from <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; color: #0033cc; text-decoration: none; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" title="http://www.wampserver.com/dl.php)" dir="ltr" rel="nofollow" href="http://www.wampserver.com/dl.php)" target="_blank">http://www.wampserver.com/dl.php)</a> and;<br />
2. <strong>WordPress</strong> from <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; color: #0033cc; text-decoration: none; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" title="http://wordpress.org/latest.zip)" dir="ltr" rel="nofollow" href="http://wordpress.org/latest.zip)" target="_blank">http://wordpress.org/latest.zip)</a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/RIEBEvzjblI" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/RIEBEvzjblI"></embed></object></p>
<p>I&#8217;m planning to create more tutorial videos. Please give your suggestions, if any.</p>
]]></content:encoded>
			<wfw:commentRss>http://pranavashok.com/blog/2009/12/creating-a-wordpress-sandbox-installing-wordpress-locally/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Batch Script to Generate File/Folder Listing</title>
		<link>http://pranavashok.com/blog/2009/07/batch-script-to-generate-file-folder-listing/</link>
		<comments>http://pranavashok.com/blog/2009/07/batch-script-to-generate-file-folder-listing/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 15:00:10 +0000</pubDate>
		<dc:creator>Pranav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Batch]]></category>
		<category><![CDATA[Indexing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://pranavashok.com/blog/?p=59</guid>
		<description><![CDATA[I was chatting with a friend who had a huge music collection and I wanted to know what all he had. This provoked me to make a batch script which would do the job. I did some research online and found out some basics of batch scripts. This is the final thing which I ended [...]]]></description>
			<content:encoded><![CDATA[<p>I was chatting with a friend who had a huge music collection and I wanted to know what all he had. This provoked me to make a batch script which would do the job. I did some research online and found out some basics of batch scripts. This is the final thing which I ended up with.</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> Directory listing will be created at c:\dirList.txt
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">dir</span> <span style="color: #33cc33;">%</span><span style="color: #448888;">1</span> /S &amp;gt; c:\dirList.txt
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> Opening c:\dirList.txt <span style="color: #00b100; font-weight: bold;">in</span> Notepad
<span style="color: #33cc33;">@</span>notepad c:\dirList.txt
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">pause</span></pre></div></div>

<p>I think it’s self explanatory. But still, I’ll go ahead and explain.</p>
<p>1. Prints “Directory listing will be created at c:\dirList.txt”</p>
<p>2. <strong>dir</strong> is a command which will print the list of directories and files. <strong>%1</strong> is a variable which will contain the location from where you run this script. <strong>/s</strong> is a switch for<span id="more-59"></span> showing all sub-directories. <strong>&gt; c:\dirList.txt</strong> will save the output of the operation <strong>dir %1 /s</strong> to a text file called <em>dirList.txt</em> in C Drive.</p>
<p>In short, the second line means this:<br />
Run the directory listing command for the location <strong>%1</strong> and store it’s output in <strong>c:\dirList.txt</strong>.</p>
<p>3. Prints “Opening c:\dirList.txt in Notepad”</p>
<p>4. Opens c:\dirList.txt in notepad.</p>
<p>5. Wait for the user to respond by pressing any key before terminating the program.</p>
<p>Now I’ll tell you how to make the whole thing work. <em>Create</em> a <strong>New Text Document</strong> on your desktop and <em>rename</em> it to <strong>Create DirList.bat</strong>. Right-click on it and press <em>Edit</em>. Copy the following code segment into it and save.</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> Directory listing will be created at c:\dirList.txt
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">dir</span> <span style="color: #33cc33;">%</span><span style="color: #448888;">1</span> /S &amp;gt; c:\dirList.txt
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> Opening c:\dirList.txt <span style="color: #00b100; font-weight: bold;">in</span> Notepad
<span style="color: #33cc33;">@</span>notepad c:\dirList.txt
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">pause</span></pre></div></div>

<p>Now move it to <strong>C:\Documents and Settings\{username}\SendTo</strong></p>
<p>Since you&#8217;d be giving this to your friends and some of them will have difficulty doing this, to make things simpler, I created another script to perform this move.</p>
<p>Create a <strong>New Text Document</strong> again and this time, call it <strong>install.bat</strong>.</p>
<p>Copy the following into it and save it.</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">move</span> &quot;Create DirList.bat&quot; &quot;C:\Documents and Settings\<span style="color: #33cc33;">%</span><span style="color: #448888;">username</span><span style="color: #33cc33;">%</span>\SendTo\Create DirList.bat&quot;
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> <span style="color: #b1b100; font-weight: bold;">Move</span> Complete
<span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">pause</span></pre></div></div>

<p>Remember that both <strong>install.bat</strong> and <strong>Create DirList.bat</strong> must be located in the same place.</p>
<p>Now, run <strong>install.bat</strong> to move <strong>Create DirList.bat</strong> to the SendTo folder. The reason why we do this is simple. Whenever we right-click on a folder and Send To -&gt; <strong>Create DirList.bat</strong>, it will send the location of the folder we right-clicked as <strong>%1</strong>.</p>
<p>Therefore, if you right-click on a folder called <em>Songs</em> in F Drive, <strong>%1</strong> will contain the location <strong>F:\Songs</strong>. Therefore, the main command executed will be this:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #b1b100; font-weight: bold;">dir</span> F:\Songs /s &amp;gt; c:\dirList.txt</pre></div></div>

<p>Now whenever you want the listing of a directory, just <strong>Right-click -&gt; Send To -&gt; Create DirList.txt</strong>.</p>
<p>Simple isn’t it?</p>
<p>Please keep all the suggestions pouring in.</p>
]]></content:encoded>
			<wfw:commentRss>http://pranavashok.com/blog/2009/07/batch-script-to-generate-file-folder-listing/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Story of a Demand Draft</title>
		<link>http://pranavashok.com/blog/2009/07/the-story-of-a-demand-draft/</link>
		<comments>http://pranavashok.com/blog/2009/07/the-story-of-a-demand-draft/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 21:50:20 +0000</pubDate>
		<dc:creator>Pranav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bank]]></category>
		<category><![CDATA[Cochin]]></category>
		<category><![CDATA[College]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[NITC]]></category>
		<category><![CDATA[Nokia 5130]]></category>
		<category><![CDATA[SBI]]></category>

		<guid isPermaLink="false">http://pranavashok.com/blog/?p=19</guid>
		<description><![CDATA[The Situation The first round seat allotment of CCB 2009 (AIEEE) comes out. I find that I&#8217;m getting my first choice, Computer Science and Engineering at National Institute of Technology, Calicut We&#8217;re supposed to report at the college for admission any day between the 1st and 5th of July with some documents and 2 demand [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The Situation</strong></p>
<p>The first round seat allotment of CCB 2009 (AIEEE) comes out. I find that I&#8217;m getting my first choice, Computer Science and Engineering at <a href="http://www.nitc.ac.in/">National Institute of Technology, Calicut</a> <img src='http://pranavashok.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>We&#8217;re supposed to report at the college for admission any day between the 1st and 5th of July with some documents and 2 demand drafts. One of Rs. 24,000 and other of Rs. 1,000 both drawn in favor of Chairman CCB &#8211; 2009 payable at <a href="http://maps.google.com/maps?hl=en&amp;q=warangal&amp;ie=UTF8&amp;split=0&amp;ei=roRKSreFKIK6MP7uiLgC&amp;ll=18.106698,79.587708&amp;spn=1.208665,2.117615&amp;t=h&amp;z=9&amp;iwloc=A">Warangal</a>.</p>
<p>I&#8217;m planning to leave home for Calicut on 1st morning and report there on 2nd.</p>
<p>The time is around 1PM. Dad is busy; leaving no one other than me to draw the DD. I&#8217;ve never drawn a demand draft. Honestly, I&#8217;ve never <span id="more-19"></span>gone to a bank alone. And I&#8217;m now forced without any option. Banks have a funny system of timing. So it&#8217;s practically impossible for us to draw the draft later if not now.</p>
<p>Somewhat hesitantly, after a 4-5 minute persuasion by dad over phone, I leaving home.</p>
<p><em>Just a stupid fact: The weather is really humid, it&#8217;s raining moderately.</em> <img src='http://pranavashok.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><strong>The Journey</strong></p>
<p>I left home with a bag and an umbrella. The bag had a school notebook with a cheque book inside. I started walking towards the bus-stop, still excited about the allotment news and texting friends from my new <a href="http://www.gsmarena.com/nokia_5130_xpressmusic-2569.php">Nokia 5130 XpressMusic</a>, enquiring their results. I caught a cranky and slow bus before reaching the bus-stop. (Maybe they stopped because it was raining or something. Even bus drivers become considerate when the climate turns rough!)</p>
<p>Anyway, I started repeatedly playing &#8220;<a href="http://www.radioreloaded.com/tracks/?23832">Khabar Nahi &#8211; Dostana.mp3</a>&#8221; the moment I got into the bus till I got the feeling that my destination is near &#8211; <a href="http://www.statebankofindia.com">State Bank of India</a>, Panayapally. The last time I went there was a week ago with dad in car, so it was pretty hard knowing I was almost there while traveling in the bus. This area of Cochin is not familiar to me as I rarely travel by bus to it. All I knew was there is a place called Chullikal in close proximity to my destination (thanks to location updates by my friend, Nitheesh who stays at Panayapally).</p>
<p>As I was saying, the moment I stopped the song, I started worrying about getting down at the right stop. Asking fellow passengers was an option, but I didn&#8217;t feel like doing it. And hence, I got the idea of using Google Maps on mobile. I must admit that even though it sucks out your balance, it&#8217;s a pretty handy app.</p>
<p>I zoomed in to some location where I hoped I was in real-time. I was looking for cross roads as they&#8217;re easy to identify from maps. I noted a cross road called &#8220;Rameshwaram Canal Road&#8221; and voila! within 5 seconds, I saw a Cochin Corporation signboard outside with the name &#8220;Rameshwaram Canal Road&#8221;! Next location on the map was Chullikal. The bus halted for a few seconds and moved on. I went to the door expecting to see the SBI branch anytime now. I spotted it and got down at the next stop.<br />
<br />
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=106476608544287547105.00046d97a6e2e10bc8b00&amp;ll=9.947822,76.255846&amp;spn=0.007397,0.00912&amp;z=16&amp;output=embed"></iframe><br /><small>View <a href="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=106476608544287547105.00046d97a6e2e10bc8b00&amp;ll=9.947822,76.255846&amp;spn=0.007397,0.00912&amp;z=16&amp;source=embed" style="color:#0000FF;text-align:left">State Bank of India, Panayapally</a> in a larger map</small><br />
<br />
<strong>The Bank</strong></p>
<p>I entered the bank. It&#8217;s got 4 counters in the front plus a cash counter. Counters 1 and 3 were manned when I reached there. I approached counter 3 and asked the lady sitting there for two draft slips. It was handed over after around 20 seconds of searching. Seriously, these bank people lack enthusiasm! I went to a seat in front of counter 2, filled up the &#8220;Drawn in favor of&#8221;, &#8220;Payable at&#8221; and the &#8220;Date&#8221; fields. After that, as instructed earlier, I called up dad to ask what to fill in the other fields which looked totally weird to me. A six minute find-this-write-here session helped me to fill up the whole thing. I copied the same stuff to the second slip and thankfully didn&#8217;t make the mistake of copying the amount.</p>
<p>After filling it up, I asked the lady at counter 1 what to write on the cheques. Filled up both the cheques and gave over everything to the lady at counter 1. She started typing using only her index finger in the computer in front of her. You can imagine how slow it&#8217;d be to enter stuff like C-C-B C-h-a-i-r-m-a-n &#8211; 2-0-0-9 etc using a single finger. After she finished that part, she didn&#8217;t know what branch to choose at Warangal. She started consulting with all some of her colleagues. The one at counter 3 ran some search and came up with 4 branches at Warangal after around 5 minutes. Still these people weren&#8217;t satisfied. They didn&#8217;t know which one to choose.</p>
<p>As I got bored waiting, I started thinking of how to finish this faster. I opened Opera Mini on my phone and googled for &#8220;<a href="http://www.google.com/search?q=sbi+branch+locator">sbi branch locator</a>&#8220;. The first result took me the a search page where I searched by city and located 8 branches. I randomly choose one of the branches having most of the features mentioned on that page and told them to check whether that branch was available. I also gave them the branch code which was also mentioned by the branch locator. They were truly impressed by the capabilities of my phone <img src='http://pranavashok.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>After this, the stuff was handed over to a guy who had just arrived in counter 2. He entered some stuff into his computer, made the deputy manager and manager sign on the the slips and printed the draft. I had entered the bank at 1:30PM. It was now 2:30PM!</p>
<p>After another use of Google Maps to find a road which connected to a parallel bus route, I headed back home and reached 3PM. It was only after mom told me to come for lunch quickly that I realized that I had skipped breakfast!!</p>
<p>This is my first real-world bank experience. Because of this, I&#8217;ll never be shy to deal with bank people anymore.</p>
<p>Hope I&#8217;ve bored you enough. The comments section is waiting for you to flame at me <img src='http://pranavashok.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Thanks for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://pranavashok.com/blog/2009/07/the-story-of-a-demand-draft/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Last.fm Top Tracks Playlist Generator Using Python</title>
		<link>http://pranavashok.com/blog/2009/06/last-fm-top-tracks-playlist-generator-using-python/</link>
		<comments>http://pranavashok.com/blog/2009/06/last-fm-top-tracks-playlist-generator-using-python/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 18:41:36 +0000</pubDate>
		<dc:creator>Pranav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Lastfm]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[Playlist]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Ventures]]></category>

		<guid isPermaLink="false">http://pranavashok.com/blog/?p=6</guid>
		<description><![CDATA[This is mine and Clive&#8217;s(@cliveverghese) latest venture. Allow me to explain this project. A little bit of history&#8230; I&#8217;ve been a last.fm user for more than a year. Recently, I started discovering new music. My busy schedule (okay, laziness) made it impossible for me to check out every song one by one and I wanted [...]]]></description>
			<content:encoded><![CDATA[<p>This is mine and Clive&#8217;s(<a href="http://twitter.com/cliveverghese">@cliveverghese</a>) latest venture. Allow me to explain this project.</p>
<p><strong>A little bit of history&#8230;</strong><br />
I&#8217;ve been a <a href="http://www.last.fm/">last.fm</a> <a href="http://www.last.fm/user/pranavashok">user</a> for more than a year. Recently, I started discovering new music. My busy schedule (okay, laziness) made it impossible for me to check out every song one by one and I wanted a quick way of listening to the good songs. Relying on public opinion seemed a good idea. I discussed about this with Clive and he said he was &#8220;in&#8221;. And hence kicked off, this project.</p>
<p>This project, being our first real-world problem tackling was given the place it deserved in our schedules. After putting in much of thought, we thought we&#8217;d make it in C++. But after vainly trying to use the last.fm API, we had an urge to choose python. This would be the first time we used python in our lives. So the task was a bit more difficult. We thought we&#8217;d divide the project into two -<br />
<span id="more-6"></span><br />
The first one would index all the mp3s present in the computer and store the <a href="http://en.wikipedia.org/wiki/ID3">ID3</a> details in a database.</p>
<p>The second part would fetch the top tracks list of the required artist from last.fm, search for it in the database and make an <a href="http://en.wikipedia.org/wiki/M3U">m3u</a> playlist out of it.</p>
<p>Clive got to do the former and I got to do the latter due to his interests in core programming and my interests in web development.</p>
<p><strong>The code</strong></p>
<p><strong>Indexing mp3s and storing them into an SQLite DB</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">os</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #ff7700;font-weight:bold;">import</span> id3reader
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">glob</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> sqlite3
&nbsp;
theList = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
theTitle = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
theArtist = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
theAlbum = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isfile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;dump.db&quot;</span><span style="color: black;">&#41;</span>:
        con = sqlite3.<span style="color: black;">connect</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'dump.db'</span><span style="color: black;">&#41;</span>
        cur = con.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        cur.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'CREATE TABLE lastfm (artist VARCHAR(40), album VARCHAR(40), title VARCHAR(40), path VARCHAR(150) PRIMARY KEY)'</span><span style="color: black;">&#41;</span>
        con.<span style="color: black;">commit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">else</span>:
        con = sqlite3.<span style="color: black;">connect</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'dump.db'</span><span style="color: black;">&#41;</span>
        cur = con.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        cur.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'DROP TABLE IF EXISTS lastfm'</span><span style="color: black;">&#41;</span>
        con.<span style="color: black;">commit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> recurse_dir<span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>:
        path = i+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span>
        path2 = i+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>*.mp3&quot;</span>
&nbsp;
        t = <span style="color: #ff4500;">1</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">try</span>:
                	directories = <span style="color: #dc143c;">os</span>.<span style="color: black;">listdir</span><span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">WindowsError</span> :
                	t = <span style="color: #ff4500;">0</span>
        <span style="color: #ff7700;font-weight:bold;">try</span>:
                	songs  = <span style="color: #dc143c;">glob</span>.<span style="color: #dc143c;">glob</span><span style="color: black;">&#40;</span>path2<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">WindowsError</span> :
                	t = <span style="color: #ff4500;">0</span>	
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">if</span> t == <span style="color: #ff4500;">1</span>:
                <span style="color: #ff7700;font-weight:bold;">for</span> song <span style="color: #ff7700;font-weight:bold;">in</span> songs:
                                id3r = id3reader.<span style="color: black;">Reader</span><span style="color: black;">&#40;</span>song<span style="color: black;">&#41;</span>
                                theTitle.<span style="color: black;">append</span><span style="color: black;">&#40;</span>id3r.<span style="color: black;">getValue</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'title'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
                                theArtist.<span style="color: black;">append</span><span style="color: black;">&#40;</span>id3r.<span style="color: black;">getValue</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'performer'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
                                theAlbum.<span style="color: black;">append</span><span style="color: black;">&#40;</span>id3r.<span style="color: black;">getValue</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'album'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
                                theList.<span style="color: black;">append</span><span style="color: black;">&#40;</span>song<span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">for</span> directory <span style="color: #ff7700;font-weight:bold;">in</span> directories:
                                temppath = path+directory
                                <span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isdir</span><span style="color: black;">&#40;</span>temppath<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
                                        	recurse_dir<span style="color: black;">&#40;</span>temppath<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> listing<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        L=<span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">ord</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'a'</span><span style="color: black;">&#41;</span>,<span style="color: #008000;">ord</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'z'</span><span style="color: black;">&#41;</span>+<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>:
                drive=<span style="color: #008000;">chr</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>exists<span style="color: black;">&#40;</span>drive+<span style="color: #483d8b;">&quot;:<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
                   L.<span style="color: black;">append</span><span style="color: black;">&#40;</span>drive<span style="color: black;">&#41;</span>
        <span style="color: #808080; font-style: italic;">#print &quot;Drive Found&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> l <span style="color: #ff7700;font-weight:bold;">in</span> L:
                l = l+<span style="color: #483d8b;">&quot;:&quot;</span>
                recurse_dir<span style="color: black;">&#40;</span>l<span style="color: black;">&#41;</span>
&nbsp;
listing<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
l=<span style="color: #008000;">len</span><span style="color: black;">&#40;</span>theList<span style="color: black;">&#41;</span>-<span style="color: #ff4500;">1</span>
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>l<span style="color: black;">&#41;</span>:
                artist = theArtist<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>
                album = theAlbum<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>
                title = theTitle<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>
                llist = theList<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>
                cur.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'INSERT INTO lastfm (artist, album, title, path) VALUES(?,?,?,?)'</span>, <span style="color: black;">&#40;</span>artist, album, title, llist<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
con.<span style="color: black;">commit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> con.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;SELECT artist, album, title FROM lastfm&quot;</span><span style="color: black;">&#41;</span>:
				<span style="color: #ff7700;font-weight:bold;">print</span> row</pre></td></tr></table></div>

<p><em><strong>Download code in .py format: <a href="http://pranavashok.com/blog/wp-content/uploads/2009/06/index-mp3-windows.py">Indexing</a></strong></em></p>
<p><strong>Checking whether the DB has been created</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> sqlite3
&nbsp;
con = sqlite3.<span style="color: black;">connect</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'dump.db'</span><span style="color: black;">&#41;</span>
cur = con.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> con.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;select artist, album, title from lastfm&quot;</span><span style="color: black;">&#41;</span>:
				<span style="color: #ff7700;font-weight:bold;">print</span> row</pre></td></tr></table></div>

<p><strong><em>Download code in .py format: <a href="http://pranavashok.com/blog/wp-content/uploads/2009/06/display-db.py">Display Database (Optional)</a></em></strong></p>
<p><strong>Fetching information from last.fm and generating the playlist</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span>
<span style="color: #ff7700;font-weight:bold;">import</span> pylast
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">import</span> sqlite3
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">getpass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">md5</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">md5</span>
&nbsp;
con = sqlite3.<span style="color: black;">connect</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'dump.db'</span><span style="color: black;">&#41;</span>
cur = con.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
user_name = <span style="color: #008000;">raw_input</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Enter last.fm username: &quot;</span><span style="color: black;">&#41;</span>
user_password = <span style="color: #008000;">raw_input</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Enter last.fm password: &quot;</span><span style="color: black;">&#41;</span>
api_key = <span style="color: #483d8b;">'d90a0d87f51434863f97038a24c7f859'</span>
api_secret = <span style="color: #483d8b;">'ffd90592c48c8f9e232af22e0e43def9'</span>
&nbsp;
name = <span style="color: #008000;">raw_input</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Enter artist to generate playlist of top tracks: &quot;</span><span style="color: black;">&#41;</span>
&nbsp;
top_tracks_file = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>+name+<span style="color: #483d8b;">'+'</span><span style="color: #483d8b;">&quot;toptracks&quot;</span><span style="color: #483d8b;">'.m3u'</span>, <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># time_periods = ['PERIOD_12MONTHS'] OR ['PERIOD_6MONTHS'] OR ['PERIOD_3MONTHS'] OR ['PERIOD_OVERALL']</span>
time_periods = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'PERIOD_3MONTHS'</span><span style="color: black;">&#93;</span>
&nbsp;
md5_user_password = <span style="color: #dc143c;">md5</span><span style="color: black;">&#40;</span>user_password<span style="color: black;">&#41;</span>.<span style="color: black;">hexdigest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
sg = pylast.<span style="color: black;">SessionKeyGenerator</span><span style="color: black;">&#40;</span>api_key, api_secret<span style="color: black;">&#41;</span>
session_key = sg.<span style="color: black;">get_session_key</span><span style="color: black;">&#40;</span>user_name, md5_user_password<span style="color: black;">&#41;</span>
&nbsp;
artist = pylast.<span style="color: black;">Artist</span><span style="color: black;">&#40;</span>name, api_key, api_secret, session_key<span style="color: black;">&#41;</span>
&nbsp;
top_tracks = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> time_period <span style="color: #ff7700;font-weight:bold;">in</span> time_periods:
    tracks = artist.<span style="color: black;">get_top_tracks</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    p = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.*[<span style="color: #000099; font-weight: bold;">\s</span>]-[<span style="color: #000099; font-weight: bold;">\s</span>](.*), Weight: [<span style="color: #000099; font-weight: bold;">\d</span>]+'</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>:
        m = p.<span style="color: black;">match</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span><span style="color: black;">&#40;</span>tracks<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        track = m.<span style="color: black;">groups</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> result <span style="color: #ff7700;font-weight:bold;">in</span> con.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'SELECT path FROM lastfm WHERE artist=? AND title=?'</span>,<span style="color: black;">&#40;</span>name, track<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
            	result = <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>result<span style="color: black;">&#41;</span>
            	top_tracks_file.<span style="color: black;">write</span><span style="color: black;">&#40;</span>result+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
    top_tracks_file.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #dc143c;">time</span>.<span style="color: black;">sleep</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p><em><strong>Download code in .py format: <a href="http://pranavashok.com/blog/wp-content/uploads/2009/06/create-playlist.py">Generate Playlist</a></strong></em></p>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://pranavashok.com/blog/2009/06/last-fm-top-tracks-playlist-generator-using-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://pranavashok.com/blog/2009/06/hello-world/</link>
		<comments>http://pranavashok.com/blog/2009/06/hello-world/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 10:17:41 +0000</pubDate>
		<dc:creator>Pranav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Ventures]]></category>

		<guid isPermaLink="false">http://pranavashok.byteact.com/blog//?p=1</guid>
		<description><![CDATA[Welcome to WordPress. This is your first post. Edit or delete it, then start blogging! Hello guys, nice hour of the day to create my first blog post in this blog eh? Well, that&#8217;s how life runs for me. This is the story of this blog&#8230; Day before yesterday night, I was just thinking about [...]]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: line-through;">Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</span></p>
<p>Hello guys, nice hour of the day to create my first blog post in this blog eh? Well, that&#8217;s how life runs for me. This is the story of this blog&#8230;</p>
<p>Day before yesterday night, I was just thinking about the money in my paypal account when I got the idea about getting a new domain name. <a href="http://www.godaddy.com/">GoDaddy</a> refuses to accept payment from unverified <a href="http://www.paypal.com">paypal</a> users, so I asked <a href="http://www.santoshgs.com/">Santosh</a> if he knew an alternate way to get a domain. That&#8217;s when he <span style="text-decoration: line-through;">persuaded</span> suggested that I can buy domains from his and <a href="http://www.techbangalore.com/">Prashanth&#8217;s</a> new webhost &#8211; &#8220;<a href="http://hostme.co.in">Host Me</a>&#8220;. For no particular reason, I decided to go with a myname.com domain. Finally, yesterday (23th) at 8:52PM, I register this domain through <a href="http://domains.hostme.co.in/">Host Me</a>.</p>
<p>To my surprise, the domain was activated within 25 minutes and I got the page put up by my current <a href="http://www.byteact.com/">host</a> as index.htm.</p>
<div class="wp-caption aligncenter" style="width: 490px"><img title="My hosts default index page" src="http://img40.imageshack.us/img40/4561/pranavashokcom.png" alt="My hosts default index page" width="480" height="255" /><p class="wp-caption-text">My host&#39;s default index page</p></div>
<p>So I sat wondering for some time, what was the intention of buying &#8216;<a href="http://pranavashok.com/">pranavashok.com</a>&#8216;? Since I didn&#8217;t get an answer to that question, I thought I&#8217;d make a blog out of it. After quite some time of theme searching, I ended up on this <a href="http://vikiworks.com/2008/05/09/wp-theme-vikiworks-v5-theme/">Vikiworks v5</a> theme which I found quite appealing. Especially because of the twitter bird in the sidebar <img src='http://pranavashok.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now I&#8217;m here typing out this post for the past 10 to 15 minutes.</p>
<p>This is the story of this new found blog.</p>
<p>Good-bye, till next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://pranavashok.com/blog/2009/06/hello-world/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
