<?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>Zein's place on the net &#187; mybooklist</title>
	<atom:link href="http://www.azein.com/blog/category/mybooklist/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.azein.com/blog</link>
	<description>my views on Australia, Egypt, Linux and other stuff</description>
	<lastBuildDate>Fri, 23 Apr 2010 08:54:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Book Collection Managment for Linux</title>
		<link>http://www.azein.com/blog/2008/09/26/book-collection-managment-for-linux/</link>
		<comments>http://www.azein.com/blog/2008/09/26/book-collection-managment-for-linux/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 07:56:43 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[mybooklist]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=133</guid>
		<description><![CDATA[Once upon a time, the options available to Linux users interested in managing their book collections were limited. The situation was so bleak that I attempted to create my own web-based application. That app was fine until I tried to host it on my 64MB VPS and failed (RoR had a footprint of 60MB all [...]]]></description>
			<content:encoded><![CDATA[<p>Once upon a time, the options available to Linux users interested in managing their book collections were limited. The situation was so bleak that I attempted to create <a href="http://mybooklist.sourceforge.net/">my own web-based application</a>. That app was fine until I tried to host it on my <a href="http://www.azein.com/blog/2007/10/06/stretching-64mb-as-much-as-you-can/">64MB VPS</a> and failed (RoR had a footprint of 60MB all by itself)! </p>
<p>Lately, I have been missing the ability to browse through my books. I started thinking about having another attempt at a book collection manger. Maybe this time I would try and write a desktop application. I could use python or even try out mono. So today I did a bit of googling and stumbled upon <a href="http://alexandria.rubyforge.org/">Alexandria</a>, a book collection manager for GNOME.</p>
<p>This application is brilliant! It is almost the perfect application. All I needed to do was get a list of books in my old app:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;select isbn from books;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> sqlite3 mybooklist_production.sqlite <span style="color: #000000; font-weight: bold;">&gt;</span> import-list.txt</pre></div></div>

<p>I was then able to import all my old books into Alexandria using the import ISBN list feature. I would like to recommend this app to anyone who is looking for a book collection manger for Linux. The site also has deb packages for those who use Debian or Ubuntu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2008/09/26/book-collection-managment-for-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Caching the book cover images</title>
		<link>http://www.azein.com/blog/2006/12/02/caching-the-book-cover-images/</link>
		<comments>http://www.azein.com/blog/2006/12/02/caching-the-book-cover-images/#comments</comments>
		<pubDate>Sat, 02 Dec 2006 18:31:24 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[RoR]]></category>
		<category><![CDATA[mybooklist]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=42</guid>
		<description><![CDATA[In my &#8220;mybooklist&#8221; application I deal with lots of images! My current method has been to store the uploaded book covers in public/images/bookcovers/isbnnumber.png&#8221; and creating thumbnails on the fly in the list and grid views!
Of course this is a very bad thing to do! The load on my server was going crazy with all the [...]]]></description>
			<content:encoded><![CDATA[<p>In my &#8220;mybooklist&#8221; application I deal with lots of images! My current method has been to store the uploaded book covers in public/images/bookcovers/isbnnumber.png&#8221; and creating thumbnails on the fly in the list and grid views!</p>
<p>Of course this is a very bad thing to do! The load on my server was going crazy with all the CPU intensive image manipulation going on! I had to do something.</p>
<p>The task required to different solutions. The first was client side caching to prevent the browser downloading the image multiple times! to achieve this I modified the show browser function like so:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># 2. we see if we need to send the file or not</span>
        lastmod = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">stat</span><span style="color:#006600; font-weight:bold;">&#40;</span>filepath<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">mtime</span>
        minTime = <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">rfc2822</span><span style="color:#006600; font-weight:bold;">&#40;</span>@request.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;HTTP_IF_MODIFIED_SINCE&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#0000FF; font-weight:bold;">nil</span>
        <span style="color:#9966CC; font-weight:bold;">if</span> minTime <span style="color:#9966CC; font-weight:bold;">and</span> lastmod <span style="color:#006600; font-weight:bold;">&lt;</span> = minTime
            <span style="color:#008000; font-style:italic;"># use cached version</span>
            render_text <span style="color:#996600;">''</span>, <span style="color:#996600;">'304 Not Modified'</span>
        <span style="color:#9966CC; font-weight:bold;">else</span>
            <span style="color:#008000; font-style:italic;"># send image</span></pre></div></div>

<p>now I only send the image to the client only in I need to!</p>
<p>The second area of improvement was the thumbnail creation on the fly! I first tried the rails</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">caches_page <span style="color:#ff3333; font-weight:bold;">:show_cover</span></pre></div></div>

<p> but I found myself in a situation where I was sending the image to the client every time because rails was sending the cached image without ever running the show_cover function (and my browser cache code)!</p>
<p>I guess I am just going to generate the thumbnails in the create and update functions. The app should feel a lot different and the load on the server should stay low!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/12/02/caching-the-book-cover-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
