<?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>Harsh J &#187; Computing Issues</title>
	<atom:link href="http://www.harshj.com/tags/personal/computing-issues/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.harshj.com</link>
	<description>Memoirs of a QWERTY Keyboard</description>
	<lastBuildDate>Sun, 15 Jan 2012 19:52:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://www.harshj.com/?pushpress=hub'/>
		<item>
		<title>Network on ArchLinux under VMWare Fusion</title>
		<link>http://www.harshj.com/2011/05/01/network-on-archlinux-under-vmware-fusion/</link>
		<comments>http://www.harshj.com/2011/05/01/network-on-archlinux-under-vmware-fusion/#comments</comments>
		<pubDate>Sat, 30 Apr 2011 20:51:48 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Computing Issues]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=2786</guid>
		<description><![CDATA[If you were trying to boot up and install (netinstall) ArchLinux under VMWare Fusion, you might run into network problems at the installation stage since the base setup doesn&#8217;t seem to configure the DHCP right. The fix is to do the following to setup the DHCP config manually: nano /etc/rc.conf Append these contents at the [...]]]></description>
			<content:encoded><![CDATA[<p>If you were trying to boot up and install (netinstall) ArchLinux under VMWare Fusion, you might run into network problems at the installation stage since the base setup doesn&#8217;t seem to configure the DHCP right.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-6470447295952949";
//Big-Posts-Journalist
google_ad_slot = "1391165574";
google_ad_width = 336;
google_ad_height = 280;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
The fix is to do the following to setup the DHCP config manually:</p>
<ol>
<li>
<pre>nano /etc/rc.conf</pre>
</li>
<li>Append these contents at the end: <a href="https://gist.github.com/949987">https://gist.github.com/949987</a></li>
<li>
<pre>/etc/rc.d/network restart</pre>
</li>
<li>Done! You should have proper network connectivity now.</li>
</ol>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6470447295952949";
//Big-Posts-Journalist
google_ad_slot = "1391165574";
google_ad_width = 336;
google_ad_height = 280;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Notes notes notes. Moar Notes!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2011/05/01/network-on-archlinux-under-vmware-fusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email&#8217;s Reply-To Header and Mailing Lists</title>
		<link>http://www.harshj.com/2011/04/06/emails-reply-to-header-and-mailing-lists/</link>
		<comments>http://www.harshj.com/2011/04/06/emails-reply-to-header-and-mailing-lists/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 18:19:23 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Computing Issues]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=2705</guid>
		<description><![CDATA[It is very irritating to have to hit &#8220;Reply to all&#8221; in an email on a mailing list in order to make your message post back to the list and not the original author of the mail you are replying to. I never really understand why public mailing lists never implement the reply-to munging feature [...]]]></description>
			<content:encoded><![CDATA[<p>It is very irritating to have to hit &#8220;<em>Reply to all</em>&#8221; in an email on a mailing list in order to make your message post back to the list and not the original author of the mail you are replying to.</p>
<p>I never really understand why public mailing lists never implement the reply-to munging feature to always overwrite the Reply-To fields back to the mailing list address instead of the user address. Erlang&#8217;s <a title="Erlang.org's questions mailing list." href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">questions list</a> is one such example.</p>
<p><!--adsense--></p>
<p>The mailman software&#8217;s <a title="Reply-To munging - a feature and some &quot;guidelines&quot;" href="http://www.gnu.org/software/mailman/mailman-admin/node11.html" target="_blank">doc page on the topic</a> of munging &#8220;reply-to&#8221; mentions that this is a pretty sensitive issue but I fail to see why. When I get onto a mailing list with a question, I would like to have the best responses &#8211; even if that meant it had to come from multiple people. If everyone posted to the list itself, the ensuing email &#8220;conversation&#8221; can be more effective than if everyone were to reply to only the author. In the former case, people who&#8217;ve offered solutions or suggestions can still have their answers improved upon by other people who&#8217;ve read it &#8211; thereby proving more helpful than the latter case.</p>
<p>There is <a title="&quot;Reply-To munging is harmful&quot; - NOT on public mailing lists." href="http://woozle.org/~neale/papers/reply-to-still-harmful.html" target="_blank">this page</a> which asserts the RFC&#8217;s statements on what the Reply-To really stands for, and I disagree to its views since a user getting on a mailing list <strong>does not</strong> know what they want their Reply-To to be. They are posting to a public mailing list and it would be very disappointing if the mailing list does not serve the public&#8217;s interest in sharing and improving knowledge. Following standards is a good thing when it is constructive, not destructive.</p>
<p><!--adsense--></p>
<p>Let us get a little off-track here. Have a look at <a href="http://stackoverflow.com" target="_blank">Stack Overflow</a>, or even the newer <a href="http://quora.com" target="_blank">Quora</a> &#8211; They never hide any answers from the public when a question is replied to. The answers do not privately go to the author, nor do the comments upon it. Everything is pretty much public. As a result, people have enjoyed very good answers with edits and comments; and using web search has proven to be more effective in problem-solving at work or else ever since these sites got popular. Why can&#8217;t the same ideals, then, be applied to the archaic-yet-effective mailing lists?</p>
<p>I&#8217;d like to state my opinions only here (in personal spaces). I do not wish to engage in &#8220;flame wars&#8221;, which is claimed to happen in discussions on these topics and thereby refuse to bring up this topic on the mailing lists that follow no reply-to overriding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2011/04/06/emails-reply-to-header-and-mailing-lists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A simple email search trick</title>
		<link>http://www.harshj.com/2011/01/17/a-simple-email-search-trick/</link>
		<comments>http://www.harshj.com/2011/01/17/a-simple-email-search-trick/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 17:33:27 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Computing Issues]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Helpful]]></category>
		<category><![CDATA[Trick]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=1542</guid>
		<description><![CDATA[Oh boy, I love standards. When I was wondering how do I search for mails sent by me, where I&#8217;m also the thread originator, I looked at what GMail had to offer as it search fields and other such advanced options. In the end my search was simply: Now am wondering why it didn&#8217;t strike [...]]]></description>
			<content:encoded><![CDATA[<p>Oh boy, I love standards.<br />
<!--adsense--><br />
When I was wondering how do I search for mails sent by me, where I&#8217;m <strong><em>also</em> the thread originator</strong>, I looked at what GMail had to offer as it search fields and other such advanced options. In the end my search was simply:</p>
<pre class="brush: plain; title: ; notranslate">in:sent from:me term -Re</pre>
<p><!--adsense--></p>
<p>Now am wondering why it didn&#8217;t strike me immediately to look for the &#8220;<strong>Re</strong>&#8221; keyword that makes a mail a reply de-facto. Of course, there&#8217;s a much more neater, more RFC-5322 compliant way of searching such mails, but I&#8217;m unsure if <em>GMail</em> supports such querying.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2011/01/17/a-simple-email-search-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arkham Spider-Man</title>
		<link>http://www.harshj.com/2010/12/26/arkham-spider-man/</link>
		<comments>http://www.harshj.com/2010/12/26/arkham-spider-man/#comments</comments>
		<pubDate>Sat, 25 Dec 2010 19:46:07 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Spider-Man]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=1407</guid>
		<description><![CDATA[I have to play every Spider-Man game produced, somehow. So I went ahead and got my hands on the most recent one of them, &#8220;Spider-Man: Shattered Dimensions&#8220;, and oh boy. I&#8217;m blown away! After playing Batman: Arkham Asylum, my bar that sets the definition of a good RPG action game just took a shot towards [...]]]></description>
			<content:encoded><![CDATA[<p>I <strong>have</strong> to play every Spider-Man game produced, <em>somehow</em>. So I went ahead and got my hands on the most recent one of them, &#8220;<strong>Spider-Man: Shattered Dimensions</strong>&#8220;, and oh boy. I&#8217;m blown away!</p>
<div class="wp-caption aligncenter" style="width: 258px"><img title="Spider-Man: Shattered Dimensions" src="http://img267.imageshack.us/img267/1531/spidermanshattereddimene.jpg" alt="Spider-Man: Shattered Dimensions" width="248" height="350" /><p class="wp-caption-text">Spider-Man: Shattered Dimensions Box Cover showing all four playable Spider-Men -- 2099, Amazing, Noir and Ultimate (The Ultimate character comes with a Venom suit)</p></div>
<p><!--adsense--><br />
After playing <strong>Batman: Arkham Asylum</strong>, my bar that sets the definition of a <em>good</em> RPG action game just took a shot towards the sky. The game-play in it was the most involving for a comic character based RPG, based on a comic character who&#8217;s at human heights. The fights were great, the moving around the area fluid and just like how the character would do, etc.. I&#8217;m sure you&#8217;ll appreciate the game if you play it, cause the story doesn&#8217;t disappoint you either.</p>
<p>Along came the Spider-Man game, and brought in perhaps for the first time ever, the Spider-Man 2099 and the Spider-Man Noir characters into video games! I think they&#8217;re great characterizations. The former imposing the role upon himself to get rid of a drug addiction, and the latter just facing a twisted history with his timeless humor. Their comics are great too.</p>
<div class="wp-caption aligncenter" style="width: 610px"><img title="Spider-Man Noir" src="http://img140.imageshack.us/img140/8548/spidermanshattereddimenu.jpg" alt="Spider-Man Noir" width="600" height="339" /><p class="wp-caption-text">Spider-Man Noir -- Incapacitating a henchman. All in total silence. Way cool.</p></div>
<p>Now case-in-point: <strong>Spider-Man Noir</strong>. The Noir Spider-Man levels in Shattered Dimensions is very similar to what much of Arkham Asylum had to offer. Only, it has <em>much more pace</em>. Any Spider-Man game worth its salt would offer deadly combos and faster-than-eye-can-follow agility during battles, and Shattered Dimensions <em>doesn&#8217;t</em> disappoint. The way you could incapacitate a henchman in Arkham Asylum, you can do it with Spider-Man Noir using webbing. Sneak up on them in the darkness, and web yank them to blackouts. Its Arkham Asylum all over, <strong>but with webs and sticking on walls</strong>! I&#8217;m not getting enough of this, so am going and playing more of it now. What&#8217;s more is that it offers a great bunch of classic rogues from Spider-Man gallery, across different timelines; yet you don&#8217;t get lost!<br />
<!--adsense--><br />
You should try this game out, its good fun with not too repetitive themes. For Spider-Man fans, it is an imperative. Stan Lee has himself voiced over a few narrations. This one is surely a timeless classic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2010/12/26/arkham-spider-man/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the Google Chrome&#8217;s User Agent String</title>
		<link>http://www.harshj.com/2010/12/22/changing-the-google-chromes-user-agent-string/</link>
		<comments>http://www.harshj.com/2010/12/22/changing-the-google-chromes-user-agent-string/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 19:48:49 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Computing Issues]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=1416</guid>
		<description><![CDATA[A simple google for changing the Google Chrome web-browser&#8217;s UA (user-agent) string would lead you to a horribly old, yet popular result that would ask you to basically hex-hack the chrome binary [Winks at labnol.org]. Ugh, ugh, ugly for 2010! For those who don&#8217;t know yet, you can start a fresh chrome window with a [...]]]></description>
			<content:encoded><![CDATA[<p>A simple google for changing the Google Chrome web-browser&#8217;s UA (user-agent) string would lead you to a horribly old, yet popular result that would ask you to basically hex-hack the chrome binary [Winks at labnol.org]. Ugh, ugh, ugly for 2010!</p>
<p><!--adsense--></p>
<p>For those who don&#8217;t know yet, you can start a fresh chrome window with a custom UA using the <strong>&#8211;user-agent</strong> command-line parameter while launching it:</p>
<pre class="brush: bash; title: ; notranslate">
# Using chrome, or chromium -- as you like it.
chrome --user-agent=&quot;My User Agent String. Bow to it, statisticians. Kidding.&quot;
</pre>
<p>You can then visit <a href="http://whatsmyuseragent.com/">http://whatsmyuseragent.com/</a> to verify the results of the user-agent property change in Chrome/Chromium.</p>
<p>The command-line parameter, <strong>&#8211;user-agent</strong>, is (not very) surprisingly not documented under the supplied manual page.</p>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2010/12/22/changing-the-google-chromes-user-agent-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Swype Beta APK [Zeitgeist]</title>
		<link>http://www.harshj.com/2010/12/22/swype-beta-apk-zeitgeist/</link>
		<comments>http://www.harshj.com/2010/12/22/swype-beta-apk-zeitgeist/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 19:26:54 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=1413</guid>
		<description><![CDATA[[This is a December 2010 Post -- mind it] Here&#8217;s a quick way to download the now-available beta swype.apk if you don&#8217;t really want to download right onto your phone via their given link: There, nice and easy? Sorry Swype, to make you count a N1 download instead of an SGS.]]></description>
			<content:encoded><![CDATA[<p>[This is a December 2010 Post -- mind it]<br />
<!--adsense--><br />
Here&#8217;s a quick way to download the now-available beta swype.apk if you don&#8217;t really want to download right onto your phone via their given link:</p>
<pre class="brush: bash; title: ; notranslate">wget https://beta.swype.com/android/get/?download_NOW=androidBeta -U &quot;Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1&quot; -O Swype.apk</pre>
<p>There, nice and easy?</p>
<p>Sorry Swype, to make you count a N1 download instead of an SGS.<br />
<!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2010/12/22/swype-beta-apk-zeitgeist/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Modals and the spinning void</title>
		<link>http://www.harshj.com/2010/09/25/modals-and-the-spinning-void/</link>
		<comments>http://www.harshj.com/2010/09/25/modals-and-the-spinning-void/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 18:38:55 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Computing Issues]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=1155</guid>
		<description><![CDATA[If you like modal dialogs, you love being annoyed and probably don&#8217;t care if you murder someone out there due to the rage that you didn&#8217;t know popped up cause of some piece of software pushing a neat looking, variable sized box with aligned text and a helper image onto your face. Never has a [...]]]></description>
			<content:encoded><![CDATA[<p>If you like modal dialogs, you love being annoyed and probably don&#8217;t care if you murder someone out there due to the rage that you didn&#8217;t know popped up cause of some piece of software pushing a neat looking, variable sized box with aligned text and a <em>helper</em> image onto your face.</p>
<p>Never has a modal dialog made you read itself to understand. It has always been about pressing the right button, to get back to whatever it was you wanted to do. As far as intentions of the developers, and to some extent the libraries go, they only want you to do whatever it is you wanted to do in the software&#8217;s right way. Press the right button, and maybe the software will do good to you. Press the wrong button and you&#8217;re probably doomed. Press the only button and you know you&#8217;re back to square one. If there are no buttons, then thank god for the display manager. If there is no display manager, you&#8217;re free of all annoyances.<br />
<!--adsense--><br />
There have been enough criticisms of modal dialogs that the Wikipedia page for the same has a section discussing it. But one hardly finds an application that does not throw a modal dialog on your face for whatever it is you did wrong or it did wrong (oh the horror).</p>
<p>Then there came the web, claiming to do away with most modal stuff as the web GUI programming model is hardly similar to the desktop model. Designers had a great chance to rid all the flaws of ancient desktop models and implement the best usability ways there could ever be, with support of some very powerful languages and associated libraries. What got popular instead, are things similar to Lightbox.</p>
<p>Such elegant are the looks of a lightbox implementation (an example of modal-ness), that it makes you feel all warm inside when you see it working on your own website, the feeling you get about never having to, or having your visitors to, leave the page they are on in order to see content associated to it; and to certain extent, browse horizontally across all other associated content than just one. It began okay first, click a media and it begins a modal environment that looks like Apple&#8217;s keynote events with a spinner. People could also open the link in a new tab to view the image in their browser&#8217;s image viewer (or other). Then, people couldn&#8217;t. Someone exclaimed with great delight that their JavaScript Kung-Fu was better than others.</p>
<p>Its one thing to pop a modal window and darken out all other content to let it have <em>focus</em>. It is another thing to add a spinning animation with absolutely no information, percentage wise or other, to indicate progress. Nobody cared if the spinner were enough to let the user know content&#8217;s actually loading or not because hey, they developed it in environments where the network was blazing fast and you hardly ever saw it. Progress. They just don&#8217;t get its meaning right. Space and time are measurable quantities and with content, progress is finite and must be calculated to be called as a progress animation. Fancy circular spinning darkness is anything but fancy. Even the Flash developers of the past, present <em>and the future</em> understood this mostly. But not the web developers, never ever.<br />
<!--adsense--><br />
Has no one ever noticed how a browser or image viewers worth their salt render images? Has nobody seen the progressive rendering of image data on the screen as it gets downloaded? It might make your network feel slow, but it never lets it feel non-functional.</p>
<p>Plague like the Lightbox (and associated <em>beautiful</em> modals) must be scrubbed out of the WWW. Let my clicks pass me to another page, I don&#8217;t mind. Nobody ever minded it until someone suspected they did.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2010/09/25/modals-and-the-spinning-void/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Justice enough</title>
		<link>http://www.harshj.com/2010/08/07/justice-enough/</link>
		<comments>http://www.harshj.com/2010/08/07/justice-enough/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 17:38:00 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Computing Issues]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=1092</guid>
		<description><![CDATA[About the immutability of variables once bounded in Erlang: Single assignment is like algebra. When I went to school, my math teacher said, “If there’s an X in several different parts in the same equation, then all the Xs mean the same thing.” That’s how we can solve equations: if we know that X+Y=10 and [...]]]></description>
			<content:encoded><![CDATA[<p>About the immutability of variables once bounded in Erlang:<br />
<!--adsense--></p>
<blockquote><p><strong>Single assignment is like algebra.</strong></p>
<p>When I went to school, my math teacher said, “If there’s an X in several different parts in the same equation, then all the Xs mean the same thing.” That’s how we can solve equations: if we know that X+Y=10 and X-Y=2, then X will be 6 and Y will be 4 in both equations.</p>
<p>But when I learned my first programming language, we were shown stuff like this:<br />
X = X + 1</p>
<p>Everyone protested, saying “you can’t do that!”. But the teacher said we were wrong, and we had to unlearn what we learned in math class. X isn’t a math variable: it’s like a pigeon hole/little box…</p>
<p>In Erlang, variables are just like they are in math. When you associate a value with a variable, you’re making an assertion &#8211; a statement of fact. This variable has that value. And that’s that.</p>
<p>&#8211; <strong>Joe Armstrong</strong>, in his book <strong>Programming Erlang</strong>.</p></blockquote>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2010/08/07/justice-enough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sieve of Euler in Erlang</title>
		<link>http://www.harshj.com/2010/06/06/sieve-of-euler-in-erlang/</link>
		<comments>http://www.harshj.com/2010/06/06/sieve-of-euler-in-erlang/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 17:45:28 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Computing Issues]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Euler]]></category>
		<category><![CDATA[Prime Numbers]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sieve]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=942</guid>
		<description><![CDATA[Learning Erlang is a fun task. Solving PE problems with it even more. You can never really beat PE problems unless you have your own fast implementations of primality tests, prime generation sieves and so on. A quick way to generate primes, as many would tell you, would be to implement and use the Sieve [...]]]></description>
			<content:encoded><![CDATA[<p>Learning Erlang is a fun task. Solving <a title="Project Euler - Learn and write programs to compute mathematical solutions." href="http://projecteuler.net" target="_blank">PE problems</a> with it even more. You can never really beat PE problems unless you have your own fast implementations of primality tests, prime generation sieves and so on.</p>
<p>A quick way to generate primes, as many would tell you, would be to implement and use the <strong>Sieve of Eratosthenes</strong>. Its a simple sieve that works by striking off all multiples of primes thus observed in sequence. <a title="Eratosthenes' sieve illustrated at Wikipedia" href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" target="_blank">Wikipedia</a> has an illustration on its working technique.</p>
<p>There is another simple sieve derived from the same idea, known as the <strong>Sieve of Euler</strong>, which uses a filtering technique based on products of an encountered prime across the remaining elements. This sort of a sieve, again explained in a good manner at <a title="Euler's Sieve Illustrated at Wikipedia" href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Euler.27s_Sieve" target="_blank">Wikipedia</a>, is shorter and easier to implement in Erlang than the traditional Eratosthenes (and I mean <a title="Melissa E. O’Neill's paper on how the one-liner Haskell sieve solution is not the real Eratosthenes, and what it should be." href="http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf" target="_blank">proper Eratosthenes</a>, mind you).<br />
<!--adsense--><br />
The following is the solution I came up with, a couple of days into learning Erlang for <a title="Learn You Some Erlang For Great Good" href="http://learnyousomeerlang.com/" target="_blank">great good</a>:</p>
<pre class="brush: erlang; title: ; notranslate">
-module(primes).
-export([generatePrimes/1]).

% Sieve of Euler %

generatePrimes (N) when is_integer(N) and (N &gt; 1) -&gt;
    Numbers = lists:seq(2,N),
    BeginIndex = 1,
    generatePrimes(Numbers, [], BeginIndex).

generatePrimes (Numbers, Numbers, _Index) -&gt;
    Numbers;

generatePrimes (Numbers, _PreviousNumbers, Index) -&gt;
    FilteredNumbers = ordsets:subtract(Numbers, multiples(lists:nth(Index, Numbers), Numbers)),
    generatePrimes(FilteredNumbers, Numbers, Index + 1).

multiples (Prime, Numbers) -&gt;
    lists:map(fun(Num) -&gt; Prime * Num end, Numbers).

% Compile as c(primes). %
</pre>
<p><!--adsense--><br />
The function <strong><em>primes</em></strong><em>:</em><strong><em>generatePrimes</em>(</strong><em>N</em><strong>)</strong> will generate all primes until N. On my <strong>2.93 GHz</strong> machine it takes about <strong>2.1s</strong> to generate all primes under a million (<strong>78498 primes</strong>).</p>
<p>As a bonus, you can go ahead and compute single-line inelegant solutions #3 and #10 of Project Euler as:</p>
<pre class="brush: erlang; title: ; notranslate">
% Solution to problem 3 %
lists:nth(1, lists:dropwhile(fun(X) -&gt; not(600851475143 rem X == 0) end, lists:reverse(primes:generatePrimes(trunc(math:sqrt(600851475143)))))).

% Solution to problem 10 %
lists:sum(primes:generatePrimes(2000000)).
</pre>
<p><strong>Notes</strong>: There is some redundant multiple calculation involved but I noticed that if I perform a sublist operation to remove that it slows the generation down, so I let it be. The sieving operation also terminates when it notices that no number was filtered in one of its call, as this marks the proper end of it. For instance, to generate all primes under 100, it only sieves through the first five primes.</p>
<p><strong>Update</strong>:</p>
<p>Kind commenter <strong>Angel</strong> (<strong>angel</strong> at <strong>uah</strong> dot <strong>es</strong>) posted a solution (and a multi-process one!) to a <em>proper</em> <strong>Eratosthenes&#8217; Sieve</strong> (based on the O&#8217;Neill&#8217;s paper I referenced above), which goes below:</p>
<pre class="brush: erlang; highlight: [3,26]; title: ; notranslate">
% &quot;Genuine&quot; Erathostenes sieve in erlang
% based on www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
% 2009 Angel Alvarez
%
% Process  1     2     3     4     5     6     7 ....
%
%         02    03    05    07    11    13    17
% P 02 -&gt; 04
% P 03    04 -&gt; 09
% C 04 == 04    09
% P 05    06    09 -&gt; 25
% C 06 == 06    09    25
% P 07    08    09    25 -&gt; 49
% C 08 == 08    09    25    49
% C 09    10 == 09    25    49
% C 10 == 10    12    25    49
% P 11    12    12    25    49 -&gt; 121
% C 12 == 12    12    25    49    121
% P 13    14    15    25    49    121 -&gt; 169
% C 14 == 14    15    25    49    121    169
% C 15    16 == 15    25    49    121    169
% C 16 == 16    18    25    49    121    169
% P 17    18    18    25    49    121    169 -&gt; 289

-module(multi_erathostenes).
-author(&quot;angel at uah dot es&quot;).
-compile(export_all).

compare(X,Y) when X &gt; Y -&gt; greater;
compare(X,Y) when X &lt; Y -&gt; smaller;
compare(_,_) -&gt; equal.

worker(Prime,UpperBound)-&gt;
	receive
		{test,Number,ParentPID} -&gt;
			ParentPID ! ok,
			case compare(Number,UpperBound) of
				equal -&gt;
%					io:format(&quot;[Worker of prime: ~w (~w)] Found composite: ~w~n&quot;,[Prime,UpperBound,Number]),
					worker(Prime,UpperBound + Prime);
				smaller -&gt;
					io:format(&quot;[Worker of prime: ~w (~w)] Spawn new worker for Prime: ~w~n&quot;,[Prime,UpperBound,Number]),
					NextPID =spawn(?MODULE,worker,[Number,Number*Number]),
					worker(Prime,UpperBound,NextPID)
			end;
		stop -&gt;
		    noop
	end.

worker(Prime,UpperBound,NextPID) -&gt;
	receive
		{test,Number,ParentPID} -&gt;
			ParentPID ! ok,
			case compare(Number,UpperBound) of
				equal -&gt;
%					io:format(&quot;[Worker of prime: ~w (~w)] Found composite: ~w~n&quot;,[Prime,UpperBound,Number]),
					worker(Prime,UpperBound + Prime,NextPID);
				smaller -&gt;
% 					io:format(&quot;[Worker of prime: ~w (~w)] passing along: ~w~n&quot;,[Prime,UpperBound,Number]),
					NextPID ! {test,Number,self()},
					receive
					    ok -&gt; ok
					end,
					worker(Prime,UpperBound,NextPID);
				greater -&gt;
% 					io:format(&quot;[Worker of prime: ~w (~w)] passing along: ~w~n&quot;,[Prime,UpperBound,Number]),
					NextPID ! {test,Number,self()},
					receive
					    ok -&gt; ok
					end,
 					worker(Prime,UpperBound+Prime,NextPID)
			end;
		stop -&gt;
		    NextPID ! stop,
		    noop
	end.

start(N) -&gt;
    OnePID=spawn(?MODULE,worker,[2,4]),
    cicle(3,N,OnePID).

cicle(Last,Last,Worker) -&gt;
    Worker ! stop;
cicle(Current,Last,Worker) -&gt;
    Worker ! {test,Current,self()},
    receive
	ok -&gt; ok
    end,
    cicle(Current+1,Last,Worker).
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2010/06/06/sieve-of-euler-in-erlang/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Pomodoro and KDE</title>
		<link>http://www.harshj.com/2010/05/05/pomodoro-and-kde/</link>
		<comments>http://www.harshj.com/2010/05/05/pomodoro-and-kde/#comments</comments>
		<pubDate>Wed, 05 May 2010 09:52:54 +0000</pubDate>
		<dc:creator>Harsh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[Pomodoro]]></category>
		<category><![CDATA[RSIBreak]]></category>
		<category><![CDATA[Timer]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://www.harshj.com/?p=876</guid>
		<description><![CDATA[Am no follower of the Pomodoro technique nor do I know its specifics but before you go ahead and try out those multiple Adobe AIR applications or use the GNOME-oriented Workrave, please try out this software called RSIBreak which was built for KDE specifically. It isn&#8217;t a full fledged timer feature but I think it [...]]]></description>
			<content:encoded><![CDATA[<p>Am no follower of the Pomodoro technique nor do I know its specifics but before you go ahead and try out those multiple Adobe AIR applications or use the GNOME-oriented <a title="Workrave - RSI software for GNOME" href="http://workrave.com" target="_blank">Workrave</a>, please try out this software called <strong><a title="RSIBreak - RSI Software for KDE" href="http://rsibreak.org" target="_blank">RSIBreak</a></strong> which was built for <strong>KDE</strong> specifically.<br />
<!--adsense--></p>
<div class="wp-caption aligncenter" style="width: 255px"><a href="http://rsibreak.org"><img class="  " title="RSIBreak - Repetitive Strain Injury prevention software for KDE" src="http://img263.imageshack.us/img263/2506/popup.png" alt="RSIBreak - Repetitive Strain Injury prevention software for KDE" width="245" height="73" /></a><p class="wp-caption-text">RSIBreak - Repetitive Strain Injury prevention software for KDE</p></div>
<p><!--adsense--><br />
It isn&#8217;t a full fledged timer feature but I think it will get your needs covered with its offerings easily enough. One of the amazing utilities I&#8217;ve used, built with KDE Libraries. It should be available in your Linux distribution&#8217;s software repository too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.harshj.com/2010/05/05/pomodoro-and-kde/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

