<?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>Hrishikesh Barua &#124; code@deepinspace &#187; ruby</title>
	<atom:link href="http://code.deepinspace.net/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.deepinspace.net</link>
	<description></description>
	<lastBuildDate>Mon, 24 May 2010 06:50:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>A Ruby script to search bookstores online</title>
		<link>http://code.deepinspace.net/2009/12/26/a-ruby-script-to-search-bookstores-online/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=a-ruby-script-to-search-bookstores-online</link>
		<comments>http://code.deepinspace.net/2009/12/26/a-ruby-script-to-search-bookstores-online/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 12:11:09 +0000</pubDate>
		<dc:creator>hrish</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://code.deepinspace.net/?p=72</guid>
		<description><![CDATA[I started dabbling in Ruby some weeks back. The initial interest was sparked after reading &#8220;Treating Code as an Essay&#8221; (Yukihiro Matsumoto) &#8211; one of the chapters in Beautiful Code. So I started doing these bootstrapping exercises in Ruby. Some of the exercises are good &#8211; but nothing beats doing a small project to learn [...]]]></description>
			<content:encoded><![CDATA[<p>I started dabbling in Ruby some weeks back. The initial interest was sparked after reading &#8220;Treating Code as an Essay&#8221; (Yukihiro Matsumoto) &#8211; one of the chapters in <a title="Beautiful Code" href="http://www.amazon.com/Beautiful-Code-Leading-Programmers-Practice/dp/0596510047" target="_blank">Beautiful Code</a>. So I started doing these <a id="tgx1" title="www.knowing.net" href="http://www.knowing.net/index.php/2006/06/16/15-exercises-to-know-a-programming-language-part-1/" target="_blank">bootstrapping</a> exercises in Ruby. Some of the exercises are good &#8211; but nothing beats doing a small project to learn a new language.</p>
<p>I buy a lot of books, mostly online. There are a few good online bookstores in India, notably Flipkart.com, Infibeam.com and Indiaplaza.in (Sadly, Amazon does not have full-fledged shipping to India yet). The way I usually search for a book in online bookstores is (was, till now)</p>
<ol>
<li>Go to books.google.com and enter the book title</li>
<li>Click on the best match</li>
<li>Click on &#8216;All Sellers&#8217; on the left of the page</li>
<li>The Indian bookstores are usually listed towards the bottom. It does not include all stores, and sometimes the prices are not listed. I have to go to each individual site and check them out.</li>
</ol>
<p>I wanted to collapse these steps into one &#8211; a simple script that would accept the name of the book and show results from all these bookstores, with comparative pricing. And the result was this</p>
<p><a id="cb6." title="http://github.com/talonx/book-search" href="http://github.com/talonx/book-search" target="_blank">http://github.com/talonx/book-search</a></p>
<p>It&#8217;s in Ruby, runs from the command line and writes the output to an HTML in the same directory called &#8216;search.html&#8217;. Much needs to be done, like</p>
<ul>
<li>Price based listing with the lowest on top</li>
<li>A web interface for the search</li>
<li>Add more bookstores &#8211; it&#8217;s only Flipkart.com, Infibeam.com, Indiaplaza and Bookadda.com right now.</li>
</ul>
<p>To run the script, type this (you need Ruby 1.8.x, available from <a title="http://www.ruby-lang.org/en/downloads/" href="http://www.ruby-lang.org/en/downloads/" target="_blank">http://www.ruby-lang.org/en/downloads/</a> and the Hpricot HTML parser library, available from <a title="http://github.com/whymirror/hpricot" href="http://github.com/whymirror/hpricot" target="_blank">http://github.com/whymirror/hpricot</a>)</p>
<blockquote><p>ruby lib\book-search.rb &#8220;&lt;book title (in quotes if it has spaces)&gt;&#8221;</p></blockquote>
<script type="text/javascript" src="http://cdn.socialtwist.com/2008071112-2/script.js"></script><a class="st-taf" href="http://tellafriend.socialtwist.com" onclick="return false;" style="border:0;padding:0;margin:0;"><img alt="SocialTwist Tell-a-Friend" style="border:0;padding:0;margin:0;" src="http://images.socialtwist.com/2008071112-2/button.png"onmouseout="STTAFFUNC.hideHoverMap(this)" onmouseover="STTAFFUNC.showHoverMap(this, '2008071112-2', 'http%3A%2F%2Fcode.deepinspace.net%2F2009%2F12%2F26%2Fa-ruby-script-to-search-bookstores-online%2F', 'A+Ruby+script+to+search+bookstores+online')" onclick="STTAFFUNC.cw(this, {id:'2008071112-2', link: 'http%3A%2F%2Fcode.deepinspace.net%2F2009%2F12%2F26%2Fa-ruby-script-to-search-bookstores-online%2F', title: 'A+Ruby+script+to+search+bookstores+online' });"/></a>]]></content:encoded>
			<wfw:commentRss>http://code.deepinspace.net/2009/12/26/a-ruby-script-to-search-bookstores-online/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
