<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Raphael Pereira</title>
	
	<link>http://blog.rmontanaro.com</link>
	<description />
	<lastBuildDate>Sun, 04 Dec 2011 15:03:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RaphaelPereira" /><feedburner:info uri="raphaelpereira" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>RaphaelPereira</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>TweetMute is available from Chrome Web Store</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/fr6ybiXziZ4/</link>
		<comments>http://blog.rmontanaro.com/2011/05/15/tweetmute-is-available-from-chrome-web-store/#comments</comments>
		<pubDate>Mon, 16 May 2011 00:00:11 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=616</guid>
		<description><![CDATA[To let you know, now you can grab TweetMute from the Chrome Web Store too. Enjoy! Shop at Amazon and support this blog!]]></description>
			<content:encoded><![CDATA[<p></p><p>To let you know, now you can grab TweetMute from the <a title="TweetMute - Chrome Web Store" href="https://chrome.google.com/webstore/detail/noegfbafclfncaobonopecllphbidcjp">Chrome Web Store</a> too. Enjoy!</p>
<p><a target="_blank" href="http://www.amazon.com/?_encoding=UTF8&#038;tag=rmontanaro-20&#038;linkCode=ur2&#038;camp=1789&#038;creative=390957">Shop at Amazon and support this blog!</a><img src="https://www.assoc-amazon.com/e/ir?t=rmontanaro-20&#038;l=ur2&#038;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/fr6ybiXziZ4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2011/05/15/tweetmute-is-available-from-chrome-web-store/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2011/05/15/tweetmute-is-available-from-chrome-web-store/</feedburner:origLink></item>
		<item>
		<title>Muting Twitter users without unfollowing them</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/Sxe3X8aOfWw/</link>
		<comments>http://blog.rmontanaro.com/2011/05/14/muting-twitter-users-without-unfollowing-them/#comments</comments>
		<pubDate>Sat, 14 May 2011 11:00:46 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[chrome-extension]]></category>
		<category><![CDATA[mute-twitter]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=587</guid>
		<description><![CDATA[We&#8217;ve all been there. Do you have a friend that tweets once or twice a week, but as the playoffs gets closer, he gets a little bit talky? Maybe he gets into a flame war that doesn&#8217;t concern you (&#8220;I hate {C, PHP, Java}&#8221;); or, of course, you recorded last night&#8217;s season finale of your [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>We&#8217;ve all been there. Do you have a friend that tweets once or twice a week, but as the playoffs gets closer, he gets a little bit talky? Maybe he gets into a flame war that doesn&#8217;t concern you (&#8220;I hate {C, PHP, Java}&#8221;); or, of course, you recorded last night&#8217;s season finale of your favorite show, and your friend can&#8217;t wait to make you nervous by stating that precise spoiler (I did that once. It <em>feels so good</em> when you hit the spot!).</p>
<p>Although I searched over and over again, I didn&#8217;t find any easy way to mute someone on <a title="@rmontanaro" href="http://www.twitter.com/rmontanaro">Twitter</a>, or at least find a tool that did <em>just that</em> the way <em>I wanted</em>. I normally use TweetDeck, and it&#8217;s the coolest kid on the block, but sometimes we just want to browse and read the latest news on our timeline. And as a developer, if there&#8217;s a piece of code that you really want to use, but hasn&#8217;t been written yet, <strong>you</strong> must write it. That&#8217;s what I did in the form of a Chrome Extension. Oh, and I gave it the suggestive name of <strong>TweetMute</strong>.</p>
<p style="text-align: center;"><a href="https://chrome.google.com/webstore/detail/noegfbafclfncaobonopecllphbidcjp"><img class="size-full wp-image-590 aligncenter" title="TweetMuteLogo" src="http://blog.rmontanaro.com/wp-content/uploads/2011/05/TweetMuteLogo.png" alt="" width="163" height="54" /></a></p>
<p>The usage is very simple. You open the options page, and type whatever Twitter usernames you want to mute. If you want to include their retweets too, you can. And if the time to unmute your peer has come, you can do that by just clicking on their username on the list. That&#8217;s it.</p>
<p><del datetime="2011-06-01T14:08:24+00:00">How it works? Every 1 second, it goes through your timeline and checks if there are new tweets. If there are, it verifies which of those tweets are from the annoying users you are muting, and removes them. This automatically exposes the worst case scenario: you might have to wait 1 second before the unwanted tweets disappear. Not to mention that if you mute 20, 30 users you can end up with an empty timeline. But the overall UX should be the same.</del> It&#8217;s much better now.</p>
<p>I hope you&#8217;ll find it useful too. You can get the extension <a title="TweetMute" href="https://chrome.google.com/webstore/detail/noegfbafclfncaobonopecllphbidcjp">here</a>.</p>
<h2>Developer Notes:</h2>
<ol>
<li>Hashbangs suck.</li>
<li>You can get it or fork it from GitHub <a title="rmontanaro/TweetMute - GitHub" href="https://github.com/rmontanaro/TweetMute">too</a>.</li>
</ol>
<p><a target="_blank" href="http://www.amazon.com/?_encoding=UTF8&#038;tag=rmontanaro-20&#038;linkCode=ur2&#038;camp=1789&#038;creative=390957">Shop at Amazon and support this extension!</a><img src="https://www.assoc-amazon.com/e/ir?t=rmontanaro-20&#038;l=ur2&#038;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/Sxe3X8aOfWw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2011/05/14/muting-twitter-users-without-unfollowing-them/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2011/05/14/muting-twitter-users-without-unfollowing-them/</feedburner:origLink></item>
		<item>
		<title>The FizzBuzz Kata</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/ojkhI08OxLE/</link>
		<comments>http://blog.rmontanaro.com/2011/04/09/the-fizzbuzz-kata/#comments</comments>
		<pubDate>Sat, 09 Apr 2011 11:00:07 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Katas]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=569</guid>
		<description><![CDATA[Time for a little fun. Here&#8217;s a video of me performing the FizzBuzz Kata a few days ago (make sure you check it out on a big screen). Hope you don&#8217;t mind the soundtrack. And of course I&#8217;ve saved some functional juice for the end]]></description>
			<content:encoded><![CDATA[<p></p><p>Time for a little fun. Here&#8217;s a video of me performing the FizzBuzz Kata a few days ago (make sure you check it out on a big screen).</p>
<p><iframe src="http://player.vimeo.com/video/22109653" width="500" height="272" frameborder="0"></iframe></p>
<p>Hope you don&#8217;t mind the soundtrack. And of course I&#8217;ve saved some functional juice for the end <img src='http://blog.rmontanaro.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/ojkhI08OxLE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2011/04/09/the-fizzbuzz-kata/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2011/04/09/the-fizzbuzz-kata/</feedburner:origLink></item>
		<item>
		<title>Should source-code be translated? – Part II</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/oKOHo8fhNK0/</link>
		<comments>http://blog.rmontanaro.com/2011/01/15/should-source-code-be-translated-%e2%80%93-part-ii/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 22:02:44 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=334</guid>
		<description><![CDATA[Based on the readers of this blog, the answer is absolutely not (I also endorse this opinion). Too bad there isn&#8217;t a universal translator for code out there. With the help of a few friends, it can surely be said that it&#8217;s no common practice to translate code to Portuguese, Russian, German or French. I managed to [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Based on the readers of this blog, the answer is <strong>absolutely not </strong>(I also endorse this opinion). Too bad there isn&#8217;t a <a title="Universal Translator" href="http://en.wikipedia.org/wiki/Universal_translator" target="_blank">universal translator</a> for code out there.<span id="more-334"></span></p>
<p>With the help of a few friends, it can surely be said that it&#8217;s no common practice to translate code to Portuguese, Russian, German or French. I managed to put my hands on the Brazilian version of <a title="Code Complete" href="http://cc2e.com/" target="_blank">Code Complete</a> a long time ago, and only the comments were in Portuguese, for example (same thing for the French version of Crockford&#8217;s <a title="JavaScript: The Good Parts" href="http://oreilly.com/catalog/9780596517748" target="_blank">The Good Parts</a>). I guess <a href="http://blog.rmontanaro.com/2010/10/22/should-source-code-be-translated-–-part-i/">my professor</a> is the only who&#8217;s translating code nowadays.</p>
<p>I can imagine a few reasons why code shouldn&#8217;t be translated:</p>
<ul>
<li><strong>Character support.</strong> Not every programming language support the countless characters of your idiom. What to do if you intend to translate to Japanese, Korean or even Russian? Unless it&#8217;s Perl or Java, you are doomed.</li>
<li><strong>Untranslatable slang and lingo</strong>. I have a hard time translating &#8216;hot-swap&#8217; and &#8216;pretty-printing&#8217;. Sometimes <em>we just know</em> what it means in one idiom, but fail to find a corresponding jargon that is still relevant and significant in another. Of course I felt better when I found out that <a title="We all face translation problems" href="http://www.mormontimes.com/article/375/We-all-face-translation-problems" target="_blank">Orson Scott Card</a> ran into a similar problem:
<p></p>
<blockquote><p>I once tried my hand at translating a story by one of the best Brazilian writers, Braulio Tavares. I got to the first sentence and was stopped cold. It was a bit of dialogue in which the main character&#8217;s father used a Brazilian idiom that simply had no translation.</p></blockquote>
<p>Hopefully we will always give identifiers meaningful (and perhaps lingo-free) names.</li>
<li><strong>Translation is a field on its own</strong>, and we can spoil the meaning of the code completely if we are not sure of what we are doing.</li>
</ul>
<p>And if it&#8217;s not a standard practice, why do it anyway? Well,</p>
<ul>
<li>Eventually we stumble upon a <strong>code-base that is already in other language</strong>, so we ensure consistency by coding in it;</li>
<li><strong>Code that we are translating is very basic</strong>. For example, every effort to teach kids would fall into this category. (I can see a completely* localized version of <a title="Hello World! Computer Programming for Kids and Other Beginners" href="http://www.manning.com/sande/" target="_blank">Hello World!</a>); and</li>
<li><strong>We are coding for ourselves</strong>.</li>
</ul>
<p>But again, just because you can doesn&#8217;t mean you should actually translate code. Are you sure you want to wrap it in a black box like this? Remember that we are all forced (for the common good) to be <a href="http://www.codinghorror.com/blog/2009/03/the-ugly-american-programmer.html">ugly american programmers</a>.</p>
<p><span>Oh, well&#8230; time to send an e-mail to the uninformed professor.</span></p>
<p><em>*except for identifiers and predefined stuff.</em></p>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/oKOHo8fhNK0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2011/01/15/should-source-code-be-translated-%e2%80%93-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2011/01/15/should-source-code-be-translated-%e2%80%93-part-ii/</feedburner:origLink></item>
		<item>
		<title>Selected questions from Quora and Stack Overflow regarding JavaScript</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/h2nhKG8KFfM/</link>
		<comments>http://blog.rmontanaro.com/2011/01/02/selected-questions-from-quora-and-stack-overflow-regarding-javascript/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 06:19:13 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=541</guid>
		<description><![CDATA[Yesterday I was searching through my bookmarks for a Stack Overflow question I saw a long time ago, about JavaScript being the only option for browser scripting, and realized that, along with the many, many articles sitting there, there were some really nice JS questions, not to mention their well thought-out answers, so I&#8217;d like [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Yesterday I was searching through my bookmarks for a Stack Overflow question I saw a long time ago, about JavaScript being the only option for browser scripting, and realized that, along with the many, many articles sitting there, there were some really nice JS questions, not to mention their well thought-out answers, so I&#8217;d like to share them. It is worth mentioning that they are not exclusively 2010&#8242;s.</p>
<p>By far, the most interesting question I saw was &#8220;<a title="How could YUI3 improve its image compared to jQuery, MooTools, etc.?" href="http://www.quora.com/How-could-YUI3-improve-its-image-compared-to-jQuery-MooTools-etc" target="_blank">How could YUI3 improve its image compared to jQuery, MooTools, etc.?</a>&#8220;, and the respective answer from John Resig, pointing out that the lack of community commits, leaving YUI completely under the umbrella of Yahoo!, along with a few other issues, is what makes YUI lag behind its competitors. Given the controversy the answer generated, Nicholas C. Zakas posted a nice follow-up on <a title="Response to John Resig’s comments about YUI" href="http://www.nczonline.net/blog/2010/11/03/response-to-john-resigs-comments-about-yui/" target="_blank">his blog</a>.</p>
<h2>Other questions from Quora:</h2>
<ul>
<li><a title="What are the main weaknesses of jQuery as a framework?" href="http://www.quora.com/What-are-the-main-weaknesses-of-jQuery-as-a-framework" target="_blank">What are the main weaknesses of jQuery as a framework?</a></li>
<li><a title="What is the appeal of server-side JavaScript?" href="http://www.quora.com/What-is-the-appeal-of-server-side-JavaScript" target="_blank">What is the appeal of server-side JavaScript?</a></li>
</ul>
<h2>From Stack Overflow:</h2>
<ul>
<li><a title="Why require JavaScript rather than supporting a standard browser virtual machine?" href="http://stackoverflow.com/questions/86426/why-require-javascript-rather-than-supporting-a-standard-browser-virtual-machine" target="_blank">Why require JavaScript rather than supporting a standard browser virtual machine?</a></li>
<li><a title="Javascript/CSS rollover menus are patented and subject to licensing?" href="http://stackoverflow.com/questions/2609936/javascript-css-rollover-menus-are-patented-and-subject-to-licensing" target="_blank">Javascript/CSS rollover menus are patented and subject to licensing?</a></li>
<li><a title="Why move your Javascript files to a different main domain that you also own?" href="http://stackoverflow.com/questions/160376/why-move-your-javascript-files-to-a-different-main-domain-that-you-also-own" target="_blank">Why move your Javascript files to a different main domain that you also own?</a></li>
<li><a title="Can somebody explain this Javascript method?" href="http://stackoverflow.com/questions/2261342/can-somebody-explain-this-javascript-method" target="_blank">Can somebody explain this Javascript method?</a></li>
<li><a title="Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail" href="http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-goo" target="_blank">Best way to use Google&#8217;s hosted jQuery, but fall back to my hosted library on Google fail</a></li>
</ul>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/h2nhKG8KFfM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2011/01/02/selected-questions-from-quora-and-stack-overflow-regarding-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2011/01/02/selected-questions-from-quora-and-stack-overflow-regarding-javascript/</feedburner:origLink></item>
		<item>
		<title>Quicksort is the new Hello World!</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/va4D8BlWWhU/</link>
		<comments>http://blog.rmontanaro.com/2010/12/11/quicksort-is-the-new-hello-world/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 09:04:56 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=454</guid>
		<description><![CDATA[Wikipedia states on its article about &#8220;Hello, World!&#8220;: It is often considered to be tradition among programmers for people attempting to learn a new programming language to write a &#8220;Hello World!&#8221; program as one of the first steps of learning that particular language. Really? Does any serious programmer willing to learn a new language tries to [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Wikipedia states on its article about &#8220;<a href="http://en.wikipedia.org/wiki/Hello_world_program">Hello, World!</a>&#8220;:</p>
<blockquote><p>It is often considered to be tradition among programmers for people attempting to learn a new programming language to write a &#8220;Hello World!&#8221; program as one of the first steps of learning that particular language.</p></blockquote>
<p>Really? Does any <em>serious</em> programmer willing to learn a new language tries to <em>craft </em>&#8220;Hello, World!&#8221; before he progresses in his findings?<span id="more-454"></span></p>
<p>We don&#8217;t do &#8220;Hello, World!&#8221; anymore. In fact, we skip one or two pages of the book, or we promptly scroll down the webpage, knowing the good stuff comes later. There was a time when where excited to see characters popping out of our screen, but no more.</p>
<p>Rather, we are interested in the <strong>strengths</strong> of the language. So how about an example that doesn&#8217;t abandon simplicity, and yet reveals some language secrets and endorses its syntax? We already have a winner. It&#8217;s the <a href="http://en.wikipedia.org/wiki/Quicksort" target="_blank">quicksort</a> algorithm:</p>
<blockquote><p>Quicksort sorts by employing a divide and conquer strategy to divide a list into two sub-lists.</p>
<p>The steps are:</p>
<ol>
<li>
<p>Pick an element, called a pivot, from the list.</p>
</li>
<li>
<p>Reorder the list so that all elements with values less than the pivot come before the pivot, while all elements with values greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot is in its final position. This is called the partition operation.</p>
</li>
<li>
<p>Recursively sort the sub-list of lesser elements and the sub-list of greater elements</p>
</li>
</ol>
</blockquote>
<p>I&#8217;m huge fan of the quicksort algorithm since I first heard about it at college. Computer Science is full of brilliant and simple ideas, and this is one of them (sure it has some caveats, like pivot selection, but the idea is still bright, and quicksort is blazingly fast for the vast majority of cases). Why not use it to introduce someone to your language? If I were to present you Haskell, I would definitely start with it:</p>
<pre lang="haskell">qsort :: Ord a => [a] -> [a]
qsort []     = []
qsort (p:xs) = qsort lesser ++ [p] ++ qsort greater
    where
            lesser = filter (< p) xs
            greater = filter (>= p) xs</pre>
<p>&#8220;At first, we can apply quicksort to pretty much everything that can be ordered. If we can compare two things in the sense that one &#8217;comes later&#8217; or &#8216;is bigger&#8217; than the other, we can apply that philosophy to a bunch of those things. That&#8217;s what the first line says: We can apply our little and awesome function to a list of unordered elements and get a brand new list of these elements in the right order.</p>
<p>Did I say <strong>lists</strong>? In Haskell, they are kind of arrays filled (or not) with homogeneous types. In fact, they are the building blocks of a Haskell program, since we don&#8217;t have loops of any kind, but recursion.</p>
<p>Did I say <strong>recursion</strong>? Haskell allows it (believe it or not, there were languages that <a title="What imperative programming languages do not support recursion?" href="http://programmers.stackexchange.com/questions/21300/what-imperative-programming-languages-do-not-support-recursion" target="_blank">didn&#8217;t</a>). So we can implement the quicksort in it. Let&#8217;s do it.</p>
<p>First out function defines what happens when we try to sort an empty list, and we can say that an empty list is already sorted. If it&#8217;s not empty we&#8217;ll take the head of that list, say p (for pivot), and put it in a special place called the &#8216;middle&#8217;. We filter all elements of the remaining list (xs) that are smaller than the pivot, and put them on the left of  &#8217;middle&#8217;. The same goes with greater elements of xs on the right side. And finally, we quicksort both sides.  Eventually, we&#8217;ll call qsort for an empty list for the left, and the same for the right. This is where our recursion stops, and we have a shiny new list of ordered elements. We used <strong>pattern</strong> <strong>matching</strong> all the time. If Haskell doesn&#8217;t succeed to match a function using its first definition (in our example, empty list), it&#8217;ll try until it matches or run out of patterns (not a problem in this example).&#8221;</p>
<p>Man, look at the size of this code. It&#8217;s not a &#8216;main&#8217;, and you still have to call it from somewhere. But if we can exchange one routine for another,<strong> quicksort unquestionably has a much higher brightness per character</strong> than &#8220;Hello, World!&#8221;. Not only that, there is much more you can talk about with only this snippet, like higher-order functions and sections.</p>
<p>I had a class of functional programming using Haskell this semester, and before it started, I chatted with the professor about the language. He didn&#8217;t welcomed to Haskell with hello, world. Instead, he opened his editor and typed the quicksort I just presented.  I don&#8217;t remember if he was excited or not, but after I left his room, I just <em>had</em> to start learning Haskell. And it&#8217;s been a delightful journey so far.</p>
<p>You can use the same tactics to attract people to your language, too. For example, I gave a presentation with a colleague about Erlang a couple of weeks ago and surely quicksort was there! Of course, this not applies to <a title="quicksort in C" href="http://en.literateprograms.org/Quicksort_(C)" target="_blank">every language</a>, but if yours happens to have lists or eases the pain of writing plenty of code, why not <strong>replace &#8220;Hello, World!&#8221; with &#8220;Quicksort!&#8221;</strong>?</p>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/va4D8BlWWhU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2010/12/11/quicksort-is-the-new-hello-world/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2010/12/11/quicksort-is-the-new-hello-world/</feedburner:origLink></item>
		<item>
		<title>HTML5 For Web Designers – Book-review</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/Scbs7DROCfo/</link>
		<comments>http://blog.rmontanaro.com/2010/11/20/html5-for-web-designers-book-review/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 03:02:44 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[Book-review]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=340</guid>
		<description><![CDATA[A little time ago I was pleased to know that Jeremy Keith, responsible for the awesome DOM Scripting, wrote a little book talking about HTML5. He&#8217;s such a wonderful writer that I had to read it, and I&#8217;m not disappointed. What&#8217;s covered by the book, anyway? Chapter 1 - It&#8217;s about HTML history until now [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>A little time ago I was pleased to know that <a title="Twitter of Jeremy Keith" href="http://twitter.com/adactio" target="_blank">Jeremy Keith</a>, responsible for the awesome <a title="DOM Scripting" href="http://www.amazon.com/gp/product/1590595335?ie=UTF8&amp;tag=rmontanaro-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1590595335" target="_blank">DOM Scripting</a>, wrote a little book talking about HTML5. He&#8217;s such a wonderful writer that I had to read it, and I&#8217;m not disappointed.</p>
<p style="text-align: center;"><img class="  aligncenter" title="HTML5 For Web Designers" src="http://cdn.shopify.com/s/files/1/0051/7692/products/aba-html5fwd-stack.jpg?1288293879" alt="HTML5 For Web Designers" width="480" height="360" /></p>
<p><span id="more-340"></span><br />
What&#8217;s covered by the book, anyway?</p>
<p><strong>Chapter 1 </strong>- It&#8217;s about <a title="HTML on Wikipedia" href=" http://en.wikipedia.org/wiki/HTML" target="_blank">HTML history</a> until now (2010). If you are a developer for some time, you&#8217;ll already know keywords like HTML 4.01, XHTML, Tim Bernes-Lee and the like. The most important thing you get from this chapter is that, while HTML5 will become a proposed recommendation by 2022, it&#8217;s ok to use it nowadays, because every major browser is already adding support for its features (if you want, you can see how is your browser doing going <a title="HTML5 test" href="http://html5test.com/" target="_blank">here</a>). A short and enjoyable chapter.</p>
<p><strong>Chapter 2</strong> &#8211; This chapter also starts with a little bit of history, and explains what changes at the top level of the webpages. One would expect a big doctype, for example, like it used to be in HTML 4:</p>
<pre lang="html4strict"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd"></pre>
<p>Instead, in HTML5 it&#8217;s just:</p>
<pre lang="html4strict"><!DOCTYPE HTML></pre>
<p>That&#8217;s a good thing. Not only it&#8217;s much simpler, it&#8217;s a wise choice. HTML5 was designed to provide backwards compatibility, so existing code won&#8217;t break in any browser. This happens because the doctype is strictly related to validation &#8211; and nothing else. In other words, you can easily send HTML 4.01 or XHTML inside a document declared to be HTML5, so adding numbers to the doctype would be a waste of time. It&#8217;s the way of HTML5 to say &#8220;Memorize my tiny doctype, you won&#8217;t have to search for it every time you&#8217;re creating a webpage.&#8221; Sweet!</p>
<p>Finally, this chapter explains how HTML5 handles white spaces, self-closing tags, deprecated versus obsolete elements, and other goodies.</p>
<p><strong>Chapter 3</strong> &#8211; In here you&#8217;ll get to know the <a title="Canvas element" href="http://en.wikipedia.org/wiki/Canvas_element" target="_blank"><code>canvas</code></a> element, for drawing and rendering shapes on the fly; and the <code>audio</code> and <code>video</code> <a title="Audio &amp; Video elements" href="https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox" target="_blank">elements</a>, so you can use them as alternatives to a Flash or Silverlight content.</p>
<p>You can see what can be done with only JavaScript and the canvas element reading my post <a title="Roundup of best js1k contest apps - What can you build with with 1kB of JavaScript?" href="http://blog.rmontanaro.com/2010/10/09/roundup-of-best-js1k-contest-apps-what-can-you-build-with-1kb-of-javascript/" target="_blank">What can be built with 1kB of JavaScript</a>?</p>
<p><strong>Chapter 4</strong> is all about Web Forms 2.0. Jeremy talks about what are HTML5 enhancements to existing elements, like required and autofocus fields, as well as new elements, e.g., date pickers, color choosers and more. In fact, you can see <a title="Web Forms 2.0 demo page" href="http://miketaylr.com/pres/html5/forms2.html" target="_blank">right now</a> how does you browser render these new elements. If you see a bunch of text-fields, support for WF2.0 is yet to be added to your browser (are you using one of <strong>The Great Five</strong>*?)</p>
<p><strong>Chapter 5</strong>, &#8220;Semantics&#8221;, shows what does it take to create semantically enriched webpages. It starts talking about <a title="Microformats" href="http://microformats.org/" target="_blank">microformats</a>, an atempt to provide useful information inside class attributes. After that the chapter goes down to the nitty-gritty we expect: more HTML5 elements! You&#8217;ll learn what changes to the inline elements (now called &#8220;text-level semantics&#8221;), and are introduced to new structural elements, like <code>nav</code>, <code>footer </code>and  <code>header</code>, intended to replace <code>id="header"</code>, for example.</p>
<p>This is what a HTML5 document looks like:<br />
<img class="aligncenter" title="HTML5 new elements for structure" src="http://html5tutorial.net/wp-content/uploads/2009/09/html5-structure-div1.gif" alt="HTML5 new elements for structure" width="540" height="270" /><br />
<strong>Chapter 6</strong>, &#8220;Using HTML5 Today&#8221;, ends the book telling about the styling of the new elements, and provides additional resources aimed to help newcomers, and tools like <a title="Modernizr" href="http://www.modernizr.com/" target="_blank">Mordenizr</a>, a JavaScript library used to detect support for HTML5 features.</p>
<p>In the end, you&#8217;ll get the feel that <strong>it will be extremely easy to create bad sites</strong>, since HTML5 is <em><strong>huge</strong></em>. But that&#8217;s a good thing: if you pretend to learn its inner guts and are willing to work hard on that, you&#8217;ll probably have no problems. In other words, HTML5 will separate the wheat from the chaff.<br />
Finally, don&#8217;t be frightened by the book&#8217;s title. I&#8217;m by no means a designer, and I really enjoyed reading this book on the last saturday afternoon. It&#8217;s really short (~ 100 pages), and also a superb introduction to this much talked and poorly understood topic. It&#8217;s also really cheap, and I highly recommend it if you wanna dive into shallow waters by now, so in the future you can go really deep.</p>
<p>You can buy yours <a title="HTML5 For Web Designers" href="http://books.alistapart.com/products/html5-for-web-designers" target="_blank">here</a>.<br />
[xrr rating=4.5/5]
<p>*Chrome, Firefox, Internet Explorer, Opera, Safari.</p>
<p><em>Additional resources:</em></p>
<p><em>One of the additional resources is <a title="DIVE INTO HTML5" href="http://diveintohtml5.org/" target="_blank">Dive Into HTML5</a>, which is going to be my next stop on this topic. Also, you can read it as a book (buy it <a title="HTML5: Up and Running" href="http://www.amazon.com/gp/product/0596806027?ie=UTF8&amp;tag=rmontanaro-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596806027" target="_blank">here</a>).</em></p>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/Scbs7DROCfo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2010/11/20/html5-for-web-designers-book-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2010/11/20/html5-for-web-designers-book-review/</feedburner:origLink></item>
		<item>
		<title>Should source-code be translated? – Part I</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/SO3v4hX-O3c/</link>
		<comments>http://blog.rmontanaro.com/2010/10/22/should-source-code-be-translated-%e2%80%93-part-i/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 03:00:42 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=282</guid>
		<description><![CDATA[A couple of days ago I asked a really simple question on Programmers &#8211; Stack Exchange. Here&#8217;s the question reproduced in its entirety: A few weeks ago, my class was assigned to translate to Portuguese the book Real World Haskell. As I did the translation of the text and comments, I started to wonder if [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>A couple of days ago I asked a really simple question on <a title="Should source-code in textbooks and the like be translated?" href="http://programmers.stackexchange.com/questions/13443/should-source-code-in-textbooks-and-the-like-be-translated" target="_blank">Programmers &#8211; Stack Exchange</a>. Here&#8217;s the question reproduced in its entirety:<br />
<span id="more-282"></span></p>
<blockquote><p>A few weeks ago, my class was assigned to translate to Portuguese the book Real World Haskell. As I did the translation of the text and comments, I started to wonder if I should translate the code as well, as the instructor suggested. For example:</p>
<pre lang="haskell">data BookInfo = Book Int String [String]
              deriving Show</pre>
<p>would become</p>
<pre lang="haskell">data InfoLivro = Livro Int String [String]
              deriving Show</pre>
<p>Since I haven&#8217;t read any software-related books in Portuguese, I don&#8217;t know if that&#8217;s a common practice, neither if it should be done this way. In the end, the code is a language mix (perhaps the example in Haskell is not a good one, since you can create synonyms quickly like <code>type CadeiaDeCaracteres = String</code>, but you get the point). So it doesn&#8217;t really matter how hard you try, you&#8217;ll have to rely on the reader previous experience with some sort of basic English words.</p>
<p>Knowing this, I really don&#8217;t see the point in translating code, since we learn in the early days of our coding life it should be written in the universal language. Nevertheless, if the surrounding text (comments, for example, and text itself in a book) needs to be translated, what is possible and feasible in this matter? Can you provide me with some guidance of what to do?</p></blockquote>
<p>I&#8217;d like to ask the same question to the readers of my blog, since I can reach a much broader range of developers here. So, what you think about this problem? I don&#8217;t think there&#8217;s a final and unquestionable answer to that, but your opinions will help me write an essay that I&#8217;ll present in Part II. You can leave your ideas on the comments or send me an e-mail: raphaelpfmontanaro[at]gmail.com. And if you are a native English speaker, feel free to post your thoughts, too.</p>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/SO3v4hX-O3c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2010/10/22/should-source-code-be-translated-%e2%80%93-part-i/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2010/10/22/should-source-code-be-translated-%e2%80%93-part-i/</feedburner:origLink></item>
		<item>
		<title>Roundup of best js1k contest apps – What can you build with 1kB of JavaScript?</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/n2doPqSsuwc/</link>
		<comments>http://blog.rmontanaro.com/2010/10/09/roundup-of-best-js1k-contest-apps-what-can-you-build-with-1kb-of-javascript/#comments</comments>
		<pubDate>Sat, 09 Oct 2010 11:00:23 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[js1k]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=148</guid>
		<description><![CDATA[Two weeks ago the winners of the js1k contest were announced at JSConf.eu. And besides them, there are 800+ submissions, splitted into three categories: not working, outdated, and up-to-date (the latter stands for enhanced versions of the outdated ones). So if you are not in the mood to face all possible entries (and waves of apps [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img class="aligncenter" title="js1k" src="http://i51.tinypic.com/sdcso9.png" alt="js1k Contest" width="404" height="166" /></p>
<p>Two weeks ago the winners of the <a title="JS1k, 1k JavaScript demo contest" href="http://js1k.com/home" target="_blank">js1k</a> contest were announced at <a title="JSConf.eu 2010" href="http://jsconf.eu/2010/" target="_self">JSConf.eu</a>. And besides them, there are 800+ submissions, splitted into three categories: not working, outdated, and up-to-date (the latter stands for enhanced versions of the outdated ones). So if you are not in the mood to face all possible entries (and waves of apps that don&#8217;t work), I&#8217;d like present a list of my personal favorites.<span id="more-148"></span> If you haven&#8217;t heard about the contest yet, it&#8217;s a great chance to get to know what can be accomplished with so little (and acknowledge the power of minification).</p>
<p>To see the demos running, make sure that you are using one of these browsers:</p>
<ul style="padding-left: 100px;">
<li>Firefox (&gt;= 3.6.8)</li>
<li>Safari (&gt;= 5.0.1)</li>
<li>Chrome (&gt;= 5.0.375.99)</li>
<li>Opera (&gt;= 10.60)</li>
</ul>
<h2>Fractals</h2>
<p>
<a title="Fractal - Wikipedia" href="http://en.wikipedia.org/wiki/Fractal" target="_blank">Fractals</a> are everybody&#8217;s favorite because they are easy to implement, and still they look great.</p>
<h4>Pythagoras tree</h4>
<div class="wp-caption aligncenter" style="width: 262px">
	<a href="http://js1k.com/demo/16" target="_blank"><img class=" " title="Pythagoras tree" src="http://img89.imageshack.us/img89/562/js1kfractal1.png" alt="Pythagoras tree" width="262" height="175" /></a>
	<p class="wp-caption-text">Pythagoras tree</p>
</div>
<h4>Fern fractal</h4>
<div class="wp-caption aligncenter" style="width: 299px">
	<a href="http://js1k.com/demo/178" target="_blank"><img title="Fractal Fern" src="http://img840.imageshack.us/img840/1558/js1kfractal3.png" alt="Fractal Fern" width="299" height="147" /></a>
	<p class="wp-caption-text">Fractal Fern</p>
</div>
<h4>Mandelbrot Set</h4>
<p>The most famous fractal, the Mandelbrot set was implemented in numerous ways and colors. Fractals are infinitely-dense, but our eyes are not sharp enough to see them completely, so the last 3 examples also provide the zoom effect.</p>
<div class="wp-caption aligncenter" style="width: 293px">
	<a href="http://js1k.com/demo/29" target="_blank"><img title="Mandelbrot Set 1" src="http://img201.imageshack.us/img201/4569/js1kfractal2.png" alt="Mandelbrot Set 1" width="293" height="297" /></a>
	<p class="wp-caption-text">573 bytes</p>
</div>
<div class="wp-caption aligncenter" style="width: 293px">
	<a href="http://js1k.com/demo/569" target="_blank"><img title="Mandelbrot Set 2" src="http://img2.imageshack.us/img2/761/js1kfractal4.png" alt="Mandelbrot Set 2" width="293" height="297" /></a>
	<p class="wp-caption-text">1024 bytes, zoom allowed</p>
</div>
<div class="wp-caption aligncenter" style="width: 293px">
	<a href="http://js1k.com/demo/604" target="_blank"><img title="Mandelbrot Set 3" src="http://img580.imageshack.us/img580/6200/js1kfractal5.png" alt="Mandelbrot Set 3" width="293" height="297" /></a>
	<p class="wp-caption-text">Same 1024 bytes, with zoom</p>
</div>
<div class="wp-caption aligncenter" style="width: 293px">
	<a href="http://js1k.com/demo/644" target="_blank"><img title="Mandelbrot Set 4" src="http://img243.imageshack.us/img243/6250/js1kfractal6.png" alt="Mandelbrot Set 4" width="293" height="240" /></a>
	<p class="wp-caption-text">1022 bytes and zoom</p>
</div><br />
</p>
<h2>3D &amp; Visual Effects</h2>
<p><div class="wp-caption aligncenter" style="width: 410px">
	<a href="http://js1k.com/demo/213" target="_blank"><img class=" " title="Elastic twister effect" src="http://img714.imageshack.us/img714/9896/js1kvisualeffects1.png" alt="Elastic twister effect" width="410" height="182" /></a>
	<p class="wp-caption-text">Elastic twister effect</p>
</div>
<div class="wp-caption aligncenter" style="width: 401px">
	<a href="http://js1k.com/demo/450" target="_blank"><img class=" " title="Organ1k" src="http://img148.imageshack.us/img148/2803/js1kvisualeffects2.png" alt="Organ1k" width="401" height="215" /></a>
	<p class="wp-caption-text">Organ1k</p>
</div>
<div class="wp-caption aligncenter" style="width: 398px">
	<a href="http://js1k.com/demo/760" target="_blank"><img title="Shiny discs" src="http://img707.imageshack.us/img707/3184/shinydiscs.png" alt="Shiny discs" width="398" height="216" /></a>
	<p class="wp-caption-text">Shiny discs</p>
</div>
<div class="wp-caption aligncenter" style="width: 301px">
	<a href="http://js1k.com/demo/224" target="_blank"><img title="Snow man" src="http://img169.imageshack.us/img169/8665/js1k3d1.png" alt="Snow man" width="301" height="266" /></a>
	<p class="wp-caption-text">Snow man</p>
</div>
<div class="wp-caption aligncenter" style="width: 432px">
	<a href="http://js1k.com/demo/174" target="_blank"><img title="Menger sponge" src="http://img299.imageshack.us/img299/9703/js1k3d3.png" alt="Menger sponge" width="432" height="459" /></a>
	<p class="wp-caption-text">Menger sponge (also a fractal)</p>
</div><br />
</p>
<h2>Games</h2>
<p>Some classic games implemented purely on JS<br />
<div class="wp-caption aligncenter" style="width: 444px">
	<a href="http://js1k.com/demo/373" target="_blank"><img title="3D Chess" src="http://img100.imageshack.us/img100/1792/js1kgames3.png" alt="3D Chess" width="444" height="227" /></a>
	<p class="wp-caption-text">3D Chess</p>
</div>
<div class="wp-caption aligncenter" style="width: 246px">
	<a href="http://js1k.com/demo/134" target="_blank"><img title="Bubble Trouble" src="http://img836.imageshack.us/img836/2180/js1kgames1.png" alt="Bubble Trouble" width="246" height="252" /></a>
	<p class="wp-caption-text">Bubble Trouble</p>
</div>
<div class="wp-caption aligncenter" style="width: 357px">
	<a href="http://js1k.com/demo/229" target="_blank"><img title="Tower of Hanoi" src="http://img832.imageshack.us/img832/244/js1kgames2.png" alt="Tower of Hanoi" width="357" height="176" /></a>
	<p class="wp-caption-text">Tower of Hanoi</p>
</div>
<div class="wp-caption aligncenter" style="width: 416px">
	<a href="http://js1k.com/demo/562" target="_blank"><img title="SameGame" src="http://img526.imageshack.us/img526/7497/js1kgames4.png" alt="SameGame" width="416" height="215" /></a>
	<p class="wp-caption-text">SameGame</p>
</div><br />
<br />
<h2>Miscellanea</h2>
<p><div class="wp-caption aligncenter" style="width: 353px">
	<a href="http://js1k.com/demo/258" target="_blank"><img title="Binary clock" src="http://img543.imageshack.us/img543/7527/js1kmiscellanea2.png" alt="Binary clock" width="353" height="142" /></a>
	<p class="wp-caption-text">Binary clock</p>
</div>
<div class="wp-caption aligncenter" style="width: 339px">
	<a href="http://js1k.com/demo/457" target="_blank"><img title="Langton's Ant" src="http://img508.imageshack.us/img508/941/js1kmiscellanea3.png" alt="Langton's Ant" width="339" height="201" /></a>
	<p class="wp-caption-text">Langton&#39;s Ant</p>
</div>
<div class="wp-caption aligncenter" style="width: 400px">
	<a href="http://js1k.com/demo/552" target="_blank"><img title="Bubble sort in action" src="http://img580.imageshack.us/img580/6325/js1kmiscellanea4.png" alt="Bubble sort in action" width="400" height="400" /></a>
	<p class="wp-caption-text">Bubble sort in action</p>
</div>
<div class="wp-caption aligncenter" style="width: 137px">
	<a href="http://js1k.com/demo/727" target="_blank"><img title="Reddit logo" src="http://img708.imageshack.us/img708/5559/js1kreddit.png" alt="Reddit logo" width="137" height="224" /></a>
	<p class="wp-caption-text">Hey, look! The Reddit logo is also there</p>
</div>
<p>You should definitely check the <a title="Winners" href="http://js1k.com/home" target="_blank">winners</a>, too. Did I miss something interesting, or do you have a different list? Feel free to share what you think on the comments.</p>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/n2doPqSsuwc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2010/10/09/roundup-of-best-js1k-contest-apps-what-can-you-build-with-1kb-of-javascript/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2010/10/09/roundup-of-best-js1k-contest-apps-what-can-you-build-with-1kb-of-javascript/</feedburner:origLink></item>
		<item>
		<title>Beware of the plugins blending in WordPress</title>
		<link>http://feedproxy.google.com/~r/RaphaelPereira/~3/qou3C3-6VQs/</link>
		<comments>http://blog.rmontanaro.com/2010/10/07/beware-of-the-plugins-blending-in-wordpress/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 21:34:49 +0000</pubDate>
		<dc:creator>rmontanaro</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Meta]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.rmontanaro.com/?p=154</guid>
		<description><![CDATA[First of all, thank you very much for the great acceptance of my first post. I wasn&#8217;t expecting so many visitors, and I&#8217;m grateful to you all for the outstanding feedback and suggestions. Indeed one reader sent me an e-mail yesterday, telling me she couldn&#8217;t subscribe to the blog&#8217;s feed. Shame on you, mister. How did you [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img id="il_fi" class="alignright" title="WordPress logo" src="http://www.bdibbs.com.br/wp-content/uploads/2010/08/Wordpress.png" alt="WordPress logo" width="192" height="192" /></p>
<p>First of all, thank you very much for the great acceptance of my first post. I wasn&#8217;t expecting so many visitors, and I&#8217;m grateful to you all for the outstanding feedback and suggestions.</p>
<p>Indeed one reader sent me an e-mail yesterday, telling me she couldn&#8217;t subscribe to the blog&#8217;s feed. <span id="more-154"></span><strong>Shame on you, mister. </strong><strong>How did you let something like that happen to your blog? Shame on you.</strong></p>
<p>As a matter of fact, the user was right. I tried without success to subscribe to the feed using <a title="Netvibes" href="http://www.netvibes.com" target="_blank">Netvibes</a> (the best reader, IMHO), my abandoned Google Reader account, and finally FeedDemon. Perhaps the user was using Bloglines, and something went wrong with their services. But hey, since <a title="Bloglines Execution Delayed by One Month" href="http://www.pcworld.com/article/206503/" target="_blank">Bloglines execution was delayed by one month</a>&#8230; kudos, the problem was definitely on the site itself.</p>
<h2>The problem</h2>
<p>The feed on this blog is managed by FeedBurner, so I can track how many users are accessing the blog through the feed on a daily basis. The thing about FeedBurner is that you get a nice page before the subscription, showing you the options of readers you can use. Not this time, though:</p>
<div id="attachment_155" class="wp-caption aligncenter" style="width: 387px">
	<a rel="lightbox[mystatproblem]" href="http://blog.rmontanaro.com/wp-content/uploads/2010/10/feedProblem.png"><img class="size-full wp-image-155    " title="How Chrome has shown the problem" src="http://blog.rmontanaro.com/wp-content/uploads/2010/10/feedProblem.png" alt="How Chrome has shown the problem" width="387" height="131" /></a>
	<p class="wp-caption-text">How Chrome has shown the problem</p>
</div>
<p>Well, that&#8217;s embarrassing. If you&#8217;re like me, you hate when you reach a web page that is not supposed to be that way,<em> especially </em>error pages showing software-related messages, something  that&#8217;s useless to the user. To me, there&#8217;s no excuse for that behavior, be it unpredictably or not (even worse if not), and that&#8217;s why I&#8217;m sorry about it.</p>
<p>What could possibly be wrong? A plethora of things, I suppose, but an error on RSS is ultimately an error on XML. That&#8217;s a start. And I looked at the code of the RSS, focusing on line 87, of course. Whatever went wrong happened before (or in) that line. And exactly there, there was this HTML piece:</p>
<pre lang="html"><img style="margin: 0; padding: 0; border: 0;" src="http://blog.rmontanaro.com/wp-content/plugins/mystat/ mystat.php?act=time_load&amp;id=4682&amp;rnd=1451689987" alt="" width="1px" height="1px" /></pre>
<p>Problem solved. Why?</p>
<p>To track the blog visitors, I&#8217;ve been using both <a title="StatSurfer" href="http://wordpress.org/extend/plugins/statsurfer/" target="_blank">StatSurfer</a> and <a title="mySTAT" href="http://wordpress.org/extend/plugins/mystat/" target="_blank">mySTAT</a>, as they keep record of different data. And as we can see, mySTAT was the source of the problem, since it somehow added HTML code to XML code, although <a href="http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML">ampersands in XML have to be encoded</a>. That&#8217;s what the <code>EntityRef: expecting ';'</code> is about: it expects to read <code>&amp;amp;</code>, not just <code>&amp;</code>.</p>
<p>mySTAT works pretty much like <a title="SpyPig" href="http://www.spypig.com/" target="_blank">SpyPig</a>, but for web pages. The plugin adds an image to the bottom of every page in the blog, so when it&#8217;s requested, the tracker receives and keeps every possibly information, for example what page was requested, by who, which browser was she using, and the like.</p>
<p>But why on earth would mySTAT add HTML to XML? Maybe someone ran into the same problem, so it&#8217;s time to Google for it. And <a title="RSS not working after i installed mystat" href="http://wordpress.org/support/topic/rss-not-working-after-i-installed-mystat" target="_blank">what I have found</a> is that the plugin doesn&#8217;t distinguish between a RSS feed and a HTML page. Since mySTAT was useful, but not essential, everything would return to normality by uninstalling the plugin. Two clicks and there I was. Time to reload the feed and check if it was OK.</p>
<p>Sadly, the error continued.</p>
<h2>The solution</h2>
<p>Uninstalling mySTAT didn&#8217;t  solve the problem immediately, something that was worrisome. What could I do next? This is a simple blog, running on PHP. The next easiest solution was to <a title="Grep - Wikipedia" href="http://pt.wikipedia.org/wiki/Grep" target="_blank">grep</a> through the blog files, searching for that line, even though the plugin was dead and buried. So I started to download the blog files backup through cPanel, while I started to check via FTP if the mySTAT directory was really deleted.</p>
<div class="wp-caption alignleft" style="width: 160px">
	<img title="&quot;Will it blend?&quot; - Plugins version" src="http://online.wsj.com/public/resources/images/OB-AM306_SBL_Bl_20070627173551.jpg" alt="&quot;Will it blend?&quot; - Plugins version" width="160" height="204" />
	<p class="wp-caption-text">&quot;Will it blend?&quot; - Plugins version</p>
</div>
<p>Suddenly, I realized that a few days ago I installed <a title="Hyper Cache" href="http://wordpress.org/extend/plugins/hyper-cache/" target="_blank">Hyper Cache</a> to improve the blog&#8217;s performance and download times (one of the many, many things you can do in this matter, by the way). It works by adding pages to the cache&#8230; but what if it works with the feeds too?</p>
<p>The troublesome feed was in fact cached. Before the backup download finished, I cleared the cache, and this time, the problem was really solved.</p>
<p>That was it. No clue, just an insight of what could be wrong. That idea just popped up, and it saved me a little time of grepping.</p>
<p>Definitely my mistake, but I learned that <strong>even if you are dealing with a robust platform like WordPress, things can go wrong</strong>. The problem found in mySTAT was just <em><strong>maximized</strong></em> by Hyper Cache, so it&#8217;s our job to create software well-done, including plugins or components, since we don&#8217;t know how they are going to be used. No one likes to dive into compatibility issues. Besides that, we should fix bugs as quickly as we can, as long as they add value to our software, and prevent our users to solve the problems by themselves (and in this case, one bug was sufficient for me to remove mySTAT). That&#8217;s something the guys behind mySTAT should have learned, since this problem is well-known for a long, long time. I hope that you understand this advice before frustrating and scaring away your users, too.</p>
<p><span style="font-size: x-large;"><span><strong><span style="font-size: small;"><span style="font-weight: normal;"></p>
<p></span></span></strong></span></span></p>
<img src="http://feeds.feedburner.com/~r/RaphaelPereira/~4/qou3C3-6VQs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.rmontanaro.com/2010/10/07/beware-of-the-plugins-blending-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rmontanaro.com/2010/10/07/beware-of-the-plugins-blending-in-wordpress/</feedburner:origLink></item>
	</channel>
</rss>

