<?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; Programming</title>
	<atom:link href="http://www.azein.com/blog/category/code/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>Getting bash syntax hilighting to work with ig hiliter</title>
		<link>http://www.azein.com/blog/2006/12/25/getting-bash-syntax-hilighting-to-work-with-ig-hiliter/</link>
		<comments>http://www.azein.com/blog/2006/12/25/getting-bash-syntax-hilighting-to-work-with-ig-hiliter/#comments</comments>
		<pubDate>Mon, 25 Dec 2006 09:58:54 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/2006/12/25/getting-bash-syntax-hilighting-to-work-with-ig-hiliter/</guid>
		<description><![CDATA[As the bash language file doesn&#8217;t com with the plugin, I had to download it from the geshi site! but even then, the code box was not displaying the code correctly! To make it work I had to comment out the 3rd and 4th element in the REGEXPS array in the language file!

'REGEXPS' =&#62; array&#40;
 [...]]]></description>
			<content:encoded><![CDATA[<p>As the bash language file doesn&#8217;t com with the plugin, I had to download it from the <a href="http://qbnz.com/highlighter/">geshi</a> site! but even then, the code box was not displaying the code correctly! To make it work I had to comment out the 3rd and 4th element in the REGEXPS array in the language file!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #0000ff;">'REGEXPS'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>$<span style="color: #000099; font-weight: bold;">\\</span>{[a-zA-Z_][a-zA-Z0-9_]*?<span style="color: #000099; font-weight: bold;">\\</span>}&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>$[a-zA-Z_][a-zA-Z0-9_]*&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;([a-zA-Z_][a-zA-Z0-9_]*)=&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #666666; font-style: italic;">//3 =&gt; &quot;(?&lt; !\\$)#.*\n&quot;,</span>
        <span style="color: #666666; font-style: italic;">//4 =&gt; &quot;\\$#&quot;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/12/25/getting-bash-syntax-hilighting-to-work-with-ig-hiliter/feed/</wfw:commentRss>
		<slash:comments>0</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>
		<item>
		<title>Linux 2.6.18 and VMWare</title>
		<link>http://www.azein.com/blog/2006/11/29/linux-2618-and-vmware/</link>
		<comments>http://www.azein.com/blog/2006/11/29/linux-2618-and-vmware/#comments</comments>
		<pubDate>Wed, 29 Nov 2006 17:48:33 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=39</guid>
		<description><![CDATA[I upgrade the kernel in one of my linux guests to 2.6.18.3 and when i tried to run vmware-config-tool.pl to recompile the vmxnet module I got an error that looks like:

The directory of kernel headers &#40;version @@VMWARE@@ UTS_RELEASE&#41; does not match your running kernel &#40;version 2.6.18.3&#41;

It seems that 2.6.18 defines the UTS_RELEASE somewhere else so [...]]]></description>
			<content:encoded><![CDATA[<p>I upgrade the kernel in one of my linux guests to 2.6.18.3 and when i tried to run vmware-config-tool.pl to recompile the vmxnet module I got an error that looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">The directory of kernel headers <span style="color: #7a0874; font-weight: bold;">&#40;</span>version <span style="color: #000000; font-weight: bold;">@@</span>VMWARE<span style="color: #000000; font-weight: bold;">@@</span> UTS_RELEASE<span style="color: #7a0874; font-weight: bold;">&#41;</span> does not match your running kernel <span style="color: #7a0874; font-weight: bold;">&#40;</span>version 2.6.18.3<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>It seems that 2.6.18 defines the <code>UTS_RELEASE</code> somewhere else so I had to add it manualy to the version.h file in my linux headers directory</p>
<p>This will work too <img src='http://www.azein.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </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;#define UTS_RELEASE <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #780078;">`uname -r`</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>linux<span style="color: #000000; font-weight: bold;">/</span>version.h</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/11/29/linux-2618-and-vmware/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My first open source project</title>
		<link>http://www.azein.com/blog/2006/11/26/my-first-open-source-project/</link>
		<comments>http://www.azein.com/blog/2006/11/26/my-first-open-source-project/#comments</comments>
		<pubDate>Sun, 26 Nov 2006 05:06:26 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[RoR]]></category>
		<category><![CDATA[books]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=34</guid>
		<description><![CDATA[After looking for a simple clean application to hold my book collection and coming up empty, I decided to write one myself!
The application is written in Ruby on Rails (ROR) and will have the following features!

admin user to update and edit
book grabber from amazon (enter the ISBN and all the data is entered automagicly -including [...]]]></description>
			<content:encoded><![CDATA[<p>After looking for a simple clean application to hold my book collection and coming up empty, I decided to write one myself!</p>
<p>The application is written in Ruby on Rails (ROR) and will have the following features!</p>
<ul>
<li>admin user to update and edit</li>
<li>book grabber from amazon (enter the ISBN and all the data is entered automagicly -including the image of the front cover-)</li>
<li>search by author, category ,book title or publisher</li>
<li>list or grid view</li>
<li>sexy smart looking with a very clean interface!</li>
<li>rate books</li>
<li>wish list</li>
<li>mark as borrowed with the borrowers name</li>
</ul>
<p>I have registered a project at sourceforge.com and will upload the source as soon as the project is approved!</p>
<p>here are a couple of screen shots:</p>
<p><a class="imagelink" title="books grid view" href="http://www.azein.com/blog/wp-content/uploads/2006/11/books-grid.png"><img width="328" height="206" id="image35" alt="books grid view" src="http://www.azein.com/blog/wp-content/uploads/2006/11/books-grid.png" /></a></p>
<p><a class="imagelink" title="books list view" href="http://www.azein.com/blog/wp-content/uploads/2006/11/books-list.png"><img width="331" height="210" id="image36" alt="books list view" src="http://www.azein.com/blog/wp-content/uploads/2006/11/books-list.png" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/11/26/my-first-open-source-project/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A keyboard to die for</title>
		<link>http://www.azein.com/blog/2006/11/20/a-keyboard-o-die-for/</link>
		<comments>http://www.azein.com/blog/2006/11/20/a-keyboard-o-die-for/#comments</comments>
		<pubDate>Mon, 20 Nov 2006 01:33:55 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=33</guid>
		<description><![CDATA[I have seen many keyboards in my life. I even coveted some of them.. But never have I seen anything as spectacular as the Optimus Keyboard.
]]></description>
			<content:encoded><![CDATA[<p>I have seen many keyboards in my life. I even coveted some of them.. But never have I seen anything as spectacular as the <a target="_blank" href="http://www.artlebedev.com/everything/optimus/">Optimus Keyboard</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/11/20/a-keyboard-o-die-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgraded to Wordpress 2.0</title>
		<link>http://www.azein.com/blog/2006/11/14/upgraded-to-wordpress-20/</link>
		<comments>http://www.azein.com/blog/2006/11/14/upgraded-to-wordpress-20/#comments</comments>
		<pubDate>Tue, 14 Nov 2006 12:40:39 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=32</guid>
		<description><![CDATA[I just upgraded the site to Wordpress 2.0.5. Alhamulillah it was smooth! I really upgraded to make sure I didn&#8217;t have any security issues. I will let you know if I find any features that were worth the upgrade!
]]></description>
			<content:encoded><![CDATA[<p>I just upgraded the site to Wordpress 2.0.5. Alhamulillah it was smooth! I really upgraded to make sure I didn&#8217;t have any security issues. I will let you know if I find any features that were worth the upgrade!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/11/14/upgraded-to-wordpress-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>At last I am re-connected to the world</title>
		<link>http://www.azein.com/blog/2006/11/14/at-last-i-am-re-connected-to-the-world/</link>
		<comments>http://www.azein.com/blog/2006/11/14/at-last-i-am-re-connected-to-the-world/#comments</comments>
		<pubDate>Tue, 14 Nov 2006 12:35:27 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=31</guid>
		<description><![CDATA[About a  month a go I moved into my new apartment! We had not yet installed the telephone line but I imagined that this was a simple operation&#8230; I was wrong! I now expect to get a phone line in approximately 1 month. But even when I do get it, Egypt Telecom will install [...]]]></description>
			<content:encoded><![CDATA[<p>About a  month a go I moved into my new apartment! We had not yet installed the telephone line but I imagined that this was a simple operation&#8230; I was wrong! I now expect to get a phone line in approximately 1 month. But even when I do get it, Egypt Telecom will install a wireless carrier which translates to no DSL for me&#8230;.</p>
<p>But I was lucky enough to find a &#8220;wasla&#8221; company called Friends that had networked a building about 60 meters away, so we ran a cat5e cable from their building to ours!</p>
<p>At fist the case seamed hopeless as we had about 18% packet loss and the result speed was about 3kBps but after adding an extra switch just at the edge of the other building the losses went way!<br />
I am now connected to the Internet, sure the speed is not stable (10-50)kBs but at least I am connect and I am very thankful for that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/11/14/at-last-i-am-re-connected-to-the-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>vmware server</title>
		<link>http://www.azein.com/blog/2006/08/18/vmware-server/</link>
		<comments>http://www.azein.com/blog/2006/08/18/vmware-server/#comments</comments>
		<pubDate>Fri, 18 Aug 2006 17:22:15 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=29</guid>
		<description><![CDATA[I have installed vmware server and have moved my server to a virtual machine! it is all going quite well actually! will post more later!
]]></description>
			<content:encoded><![CDATA[<p>I have installed vmware server and have moved my server to a virtual machine! it is all going quite well actually! will post more later!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/08/18/vmware-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A daemon in bash?</title>
		<link>http://www.azein.com/blog/2006/05/10/a-daemon-in-bash/</link>
		<comments>http://www.azein.com/blog/2006/05/10/a-daemon-in-bash/#comments</comments>
		<pubDate>Wed, 10 May 2006 15:26:39 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=28</guid>
		<description><![CDATA[I found a nice article explaining how to write a small bash daemon! very nice  
]]></description>
			<content:encoded><![CDATA[<p>I found a <a href="http://www.linuxboxadmin.com/content/view/7018/37/">nice article</a> explaining how to write a small bash daemon! very nice <img src='http://www.azein.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/05/10/a-daemon-in-bash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>a gift for my eyes</title>
		<link>http://www.azein.com/blog/2006/03/17/a-gift-for-my-eyes/</link>
		<comments>http://www.azein.com/blog/2006/03/17/a-gift-for-my-eyes/#comments</comments>
		<pubDate>Fri, 17 Mar 2006 20:38:41 +0000</pubDate>
		<dc:creator>Ahmed</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.azein.com/blog/?p=27</guid>
		<description><![CDATA[I have been spending a few extra hours at work and my eyes are getting real dry   which made me start thinking that starting at a 17&#8243; CRT is not the best way to keep my eyes in good shape.
My friend and fellow gawaberian, Mahmoud got me thinking about getting an LCD. And [...]]]></description>
			<content:encoded><![CDATA[<p>I have been spending a few extra hours at work and my eyes are getting real dry <img src='http://www.azein.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  which made me start thinking that starting at a 17&#8243; CRT is not the best way to keep my eyes in good shape.</p>
<p>My friend and fellow gawaberian, <a href="http://blog.gammal.org/">Mahmoud</a> got me thinking about getting an LCD. And guess what? I did <img src='http://www.azein.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  a beautiful <a href="http://www.nec-display-solutions.co.uk/coremedia/generator/index,realm=Products__Details__Main,spec=x__uk__en,docId=87306,type=LCD">19&#8243; NEC LCD</a>.</p>
<p>I am not thinking of getting one for when I am at home <img src='http://www.azein.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I am thinking of a Samsung. Mahmoud got a  <a href="http://www.samsung.com/au/products/monitors/archivedmonitors/910n.asp">Samsung 190N</a> I am hoping to get something like it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azein.com/blog/2006/03/17/a-gift-for-my-eyes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
