<?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>porges &#187; tips</title>
	<atom:link href="http://porg.es/blog/category/tips/feed" rel="self" type="application/rss+xml" />
	<link>http://porg.es/blog</link>
	<description></description>
	<lastBuildDate>Sun, 06 May 2012 22:13:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Pearls Before Piglets</title>
		<link>http://porg.es/blog/pearls-before-piglets</link>
		<comments>http://porg.es/blog/pearls-before-piglets#comments</comments>
		<pubDate>Wed, 27 May 2009 10:40:31 +0000</pubDate>
		<dc:creator>Porges</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Odd]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[silly]]></category>
		<category><![CDATA[umberto eco]]></category>

		<guid isPermaLink="false">http://porg.es/blog/?p=346</guid>
		<description><![CDATA[While Googling my way through the interwebs, I came across the 2008 Western Australian Certificate of Education sample examination for Stage 2 Biological Sciences. It contains this diagram: If you&#8217;re wondering, the entire hierarchy is drawn from Umberto Eco&#8216;s novel Baudolino.]]></description>
			<content:encoded><![CDATA[<p>While Googling my way through the interwebs, I came across the <a href="http://www.curriculum.wa.edu.au/internet/_Documents/Course_Exams/APRIL+2008+WEB+VERSION+ONLY+Biological+Sciences+Stage+2+Sample+exam+pdf.pdf">2008 Western Australian Certificate of Education sample examination for Stage 2 Biological Sciences</a>. It contains this diagram:</p>
<p><img src="http://porg.es/blog/wp-content/uploads/2009/05/image-0.png" alt="Diagram" title="Diagram" width="454" height="300" class="aligncenter size-full wp-image-347" /></p>
<p>If you&#8217;re wondering, the entire hierarchy is drawn from <a href="http://en.wikipedia.org/wiki/Umberto_Eco">Umberto Eco</a>&#8216;s novel <i><a href="http://en.wikipedia.org/wiki/Baudolino">Baudolino</a></i>. <img src="http://porg.es/blog/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_smile.gif" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://porg.es/blog/pearls-before-piglets/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refactoring in Haskell: Adding an Argument</title>
		<link>http://porg.es/blog/refactoring-in-haskell-adding-an-argument</link>
		<comments>http://porg.es/blog/refactoring-in-haskell-adding-an-argument#comments</comments>
		<pubDate>Wed, 10 Dec 2008 03:44:47 +0000</pubDate>
		<dc:creator>Porges</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[Functional programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[refactoring]]></category>
		<category><![CDATA[short]]></category>

		<guid isPermaLink="false">http://porg.es/blog/?p=258</guid>
		<description><![CDATA[Just a small tip on this: When you add an argument to a function that already exists you should check the existing usage of the function. Say you have this: f x y z = ... &#8230; and you want: f x y z w = ... First of all you should check the contexts [...]]]></description>
			<content:encoded><![CDATA[<p>Just a small tip on this: When you add an argument to a function that already exists you should check the existing usage of the function. Say you have this:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">f x y z <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #339933; font-weight: bold;">...</span></pre></div></div>

<p>&#8230; and you want:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">f x y z w <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #339933; font-weight: bold;">...</span></pre></div></div>

<p>First of all you should check the contexts where <code>f</code> is used. For example, if <code>f</code> is quite often used as an argument to <code>map</code> (<code>fmap</code>, <code>&lt;$&gt;</code>):</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">elsewhere xs <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">map</span> <span style="color: green;">&#40;</span>f a b<span style="color: green;">&#41;</span> xs</pre></div></div>

<p>If you naïvely add <code>w</code> to the end of the argument list you&#8217;ll end up with this instead:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">elsewhere xs <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">map</span> <span style="color: green;">&#40;</span>\x<span style="color: #339933; font-weight: bold;">-&gt;</span> f a b x c<span style="color: green;">&#41;</span> xs</pre></div></div>

<p>On the other hand, if you take a look at the usage of <code>f</code> you can decide that because <code>f</code> is often used to <code>map</code> over things, you can insert the additional parameter <em>before</em> the last, and end up with nicer code:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">elsewhere xs <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">map</span> <span style="color: green;">&#40;</span>f a b c<span style="color: green;">&#41;</span> xs</pre></div></div>

<p>You may even discover that the existing <code>f</code> is used in a lot of lambdas that could be avoided by rearranging its arguments!</p>
]]></content:encoded>
			<wfw:commentRss>http://porg.es/blog/refactoring-in-haskell-adding-an-argument/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vacuuming Firefox&#8217;s sqlite3 databases</title>
		<link>http://porg.es/blog/vacuuming-firefoxs-sqlite3-databases</link>
		<comments>http://porg.es/blog/vacuuming-firefoxs-sqlite3-databases#comments</comments>
		<pubDate>Sun, 16 Nov 2008 23:56:39 +0000</pubDate>
		<dc:creator>Porges</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://porg.es/blog/?p=239</guid>
		<description><![CDATA[Firefox 3 was running very slow for me, so I desperately tried this, thinking that it wouldn&#8217;t make much difference. I was wrong; there was a noticeable speed improvement. From a bash shell: find ~/.mozilla -iname '*.sqlite' -execdir sqlite3 &#123;&#125; 'vacuum;' \;]]></description>
			<content:encoded><![CDATA[<p>Firefox 3 was running very slow for me, so I desperately tried this, thinking that it wouldn&#8217;t make much difference. I was wrong; there was a noticeable speed improvement. From a bash shell:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> ~<span style="color: #000000; font-weight: bold;">/</span>.mozilla <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">'*.sqlite'</span> <span style="color: #660033;">-execdir</span> sqlite3 <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #ff0000;">'vacuum;'</span> \;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://porg.es/blog/vacuuming-firefoxs-sqlite3-databases/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A useful gedit macro for LaTeX</title>
		<link>http://porg.es/blog/a-useful-gedit-macro-for-latex</link>
		<comments>http://porg.es/blog/a-useful-gedit-macro-for-latex#comments</comments>
		<pubDate>Wed, 30 Apr 2008 06:28:41 +0000</pubDate>
		<dc:creator>Porges</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gedit]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[useful]]></category>

		<guid isPermaLink="false">http://porg.es/blog/?p=127</guid>
		<description><![CDATA[Builds and displays your current LaTeX document, and removes all the temporary file spam. #!/bin/bash TMPDIR=$&#40;mktemp -td&#41; &#160; rubber -d --into &#34;$TMPDIR&#34; &#34;$GEDIT_CURRENT_DOCUMENT_NAME&#34; &#38;&#38; mv &#34;$TMPDIR/${GEDIT_CURRENT_DOCUMENT_NAME%tex}pdf&#34; &#34;$GEDIT_CURRENT_DOCUMENT_DIR&#34; &#160; if &#91; $? -eq 0 &#93; then evince &#34;${GEDIT_CURRENT_DOCUMENT_NAME%tex}pdf&#34; &#38; fi &#160; rm -rf &#34;$TMPDIR&#34;]]></description>
			<content:encoded><![CDATA[<p>Builds and displays your current LaTeX document, and removes all the temporary file spam.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">TMPDIR</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">mktemp</span> -td<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
rubber <span style="color: #660033;">-d</span> <span style="color: #660033;">--into</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TMPDIR</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$GEDIT_CURRENT_DOCUMENT_NAME</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TMPDIR</span>/<span style="color: #007800;">${GEDIT_CURRENT_DOCUMENT_NAME%tex}</span>pdf&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$GEDIT_CURRENT_DOCUMENT_DIR</span>&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
	<span style="color: #000000; font-weight: bold;">then</span> evince <span style="color: #ff0000;">&quot;<span style="color: #007800;">${GEDIT_CURRENT_DOCUMENT_NAME%tex}</span>pdf&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TMPDIR</span>&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://porg.es/blog/a-useful-gedit-macro-for-latex/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

