<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tail Recursion</title>
	<atom:link href="http://tailrecursion.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tailrecursion.wordpress.com</link>
	<description>Adventures in Erlang</description>
	<lastBuildDate>Tue, 02 Aug 2011 21:53:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='tailrecursion.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Tail Recursion</title>
		<link>http://tailrecursion.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://tailrecursion.wordpress.com/osd.xml" title="Tail Recursion" />
	<atom:link rel='hub' href='http://tailrecursion.wordpress.com/?pushpress=hub'/>
		<item>
		<title>boot args</title>
		<link>http://tailrecursion.wordpress.com/2011/07/19/boot-args/</link>
		<comments>http://tailrecursion.wordpress.com/2011/07/19/boot-args/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 23:24:20 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=175</guid>
		<description><![CDATA[Have you ever wanted your code to behave differently when in production and development? An easy way to handle this is to add a meaningful boot argument like so: $ erl -production Now you can use init to check for the existence of the production argument. In this example, I&#8217;ll use this to select my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=175&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted your code to behave differently when in production and development? An easy way to handle this is to add a meaningful boot argument like so:<br />
<code><br />
$ erl -production<br />
</code><br />
Now you can use <code>init</code> to check for the existence of the production argument. In this example, I&#8217;ll use this to select my redirect target domain:</p>
<pre>
Domain =
    case init:get_argument(production) of
        {ok, _} -&gt; “www.example.org”;
        error -&gt; "localhost:8000"
    end
</pre>
<p>You can also pass in values with your arguments like so:<br />
<code><br />
$ erl -dictionary_size 500<br />
</code><br />
And you can read the value back out with:<br />
<code><br />
&gt; init:get_argument(dictionary_size).<br />
{ok,[["500"]]}<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/175/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=175&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2011/07/19/boot-args/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
		<item>
		<title>spell correction</title>
		<link>http://tailrecursion.wordpress.com/2011/07/18/spell-correction/</link>
		<comments>http://tailrecursion.wordpress.com/2011/07/18/spell-correction/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 05:46:33 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=158</guid>
		<description><![CDATA[Over the past couple of years I&#8217;ve done some NLP work in erlang including LSA, text segmentation and automatic spell correction. If you&#8217;ve ever thought about creating a spell checker, I&#8217;d recommend reading this article. Much can be improved in the implementation presented &#8211; chiefly, the brute force search of all conceivable variations of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=158&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Over the past couple of years I&#8217;ve done some NLP work in erlang including LSA, text segmentation and automatic spell correction. If you&#8217;ve ever thought about creating a spell checker, I&#8217;d recommend reading <a href="http://norvig.com/spell-correct.html" target="_blank">this</a> article. Much can be improved in the implementation presented &#8211; chiefly, the brute force search of all conceivable variations of the input text. My own application required automatic correction on the order of a few milliseconds, so that approach was clearly not going to work.</p>
<p>I then found <a href="http://blog.afterthedeadline.com/2010/01/29/how-i-trie-to-make-spelling-suggestions/" target="_blank">this</a> article, which explains a terrific solution. In summary, if you keep your dictionary in a trie you can narrow your search to only variations which exist in the dictionary. This greatly improves the speed of the algorithm. I implemented the same idea in erlang, and ever since I&#8217;ve been doing ~1ms corrections with a dictionary of tens of thousands of words.</p>
<p>While most of my work is application-specific, the trie structure and search algorithm are generic so I decided to open source them <a href="https://github.com/dweldon/etrie" target="_blank">here</a>. Like all of my projects, please feel free to send suggestions and pull requests.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/158/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=158&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2011/07/18/spell-correction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
		<item>
		<title>utf-8</title>
		<link>http://tailrecursion.wordpress.com/2011/05/31/utf-8/</link>
		<comments>http://tailrecursion.wordpress.com/2011/05/31/utf-8/#comments</comments>
		<pubDate>Tue, 31 May 2011 20:08:51 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=149</guid>
		<description><![CDATA[I recently had a problem where I was rendering an ErlyDTL template and symbols like © and ® were not displaying right. After a little trial and error I realised that the character encoding in my HTML template was set to UTF-8, but erlang&#8217;s default encoding is ISO-latin-1 (ISO8859-1). Fortunately the unicode  module provides an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=149&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently had a problem where I was rendering an <a href="https://github.com/evanmiller/erlydtl" target="_blank">ErlyDTL</a> template and symbols like © and ® were not displaying right. After a little trial and error I realised that the character encoding in my HTML template was set to UTF-8, but erlang&#8217;s default encoding is ISO-latin-1 (ISO8859-1). Fortunately the unicode  module provides an easy fix for this:<br />
<code><br />
{ok, Html} = my_template_dtl:render(Data),<br />
unicode:characters_to_binary(Html).<br />
</code><br />
And voilà, we have a UTF-8 binary.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/149/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=149&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2011/05/31/utf-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
		<item>
		<title>block expressions</title>
		<link>http://tailrecursion.wordpress.com/2011/01/16/block-expressions/</link>
		<comments>http://tailrecursion.wordpress.com/2011/01/16/block-expressions/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 00:25:54 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=137</guid>
		<description><![CDATA[I&#8217;ve long been annoyed that list comprehensions can only accept a single expression. What if I want to print and perform some computation on each value? What I didn&#8217;t know was that expressions can be grouped together as blocks: &#62; [begin erlang:display(N), N*10 end &#124;&#124; N &#60;- lists:seq(1,3)]. 1 2 3 [10,20,30] For more details [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=137&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve long been annoyed that list comprehensions can only accept a single expression. What if I want to print <em>and</em> perform some computation on each value? What I didn&#8217;t know was that expressions can be grouped together as blocks:</p>
<p>&gt; [begin erlang:display(N), N*10 end || N &lt;- lists:seq(1,3)].<br />
1<br />
2<br />
3<br />
[10,20,30]<br />
</code><br />
For more details see <a href="http://www.erlang.org/doc/reference_manual/expressions.html">this</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/137/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=137&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2011/01/16/block-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
		<item>
		<title>where is my priv_dir?</title>
		<link>http://tailrecursion.wordpress.com/2011/01/08/where-is-my-priv_dir/</link>
		<comments>http://tailrecursion.wordpress.com/2011/01/08/where-is-my-priv_dir/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 00:13:46 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=115</guid>
		<description><![CDATA[Let&#8217;s say you&#8217;re writing an application that needs to load a file from its priv directory, so you need know its path. You just call code:priv_dir/1 with the name of your application right? Maybe. The catch is that this function only succeeds if your application is in the code path. As far as I&#8217;m able [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=115&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you&#8217;re writing an application that needs to load a file from its priv directory, so you need know its path. You just call <code>code:priv_dir/1</code> with the name of your application right? Maybe. The catch is that this function only succeeds if your application is in the code path. As far as I&#8217;m able to tell that leaves us with three choices:</p>
<p>1) Make sure your application is installed to somewhere under a directory in <code>$ERL_LIBS</code>. This makes sense for a shared library, but may not make sense for your web server. Furthermore, when working on the code it&#8217;s annoying to have to add your development directory to <code>$ERL_LIBS</code>.<br />
2) Just write code like <code>file:read_file("./priv/dictionary")</code>. Unfortunately that will only work if you run it from the application directory. Fail.<br />
3) Use the following code:<br />
<code><br />
{ModPath, _} = filename:find_src(?MODULE),<br />
AppPath = filename:dirname(filename:dirname(ModPath)),<br />
filename:join(AppPath, "priv").<br />
</code></p>
<p>So far that seems to be the winning solution for me. If you have a better solution or you can think of a reason why this doesn&#8217;t work please let me know.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=115&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2011/01/08/where-is-my-priv_dir/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
		<item>
		<title>edate</title>
		<link>http://tailrecursion.wordpress.com/2010/07/03/edate/</link>
		<comments>http://tailrecursion.wordpress.com/2010/07/03/edate/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 23:22:55 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=106</guid>
		<description><![CDATA[Date manipulation in erlang isn&#8217;t very pleasant. The calendar module provides a lot of the raw tools but none of the convenience of something like the Date class in ruby, or the time calculation extensions in rails. I borrowed ideas from both and created edate. Check it out and let me know if I&#8217;m missing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=106&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Date manipulation in erlang isn&#8217;t very pleasant. The calendar module provides a lot of the raw tools but none of the convenience of something like the Date class in <a href="http://ruby-doc.org/core/" target="_blank">ruby</a>, or the time calculation extensions in <a href="http://rails.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/Calculations.html" target="_blank">rails</a>. I borrowed ideas from both and created <a href="http://github.com/dweldon/edate" target="_blank">edate</a>. Check it out and let me know if I&#8217;m missing anything that would be helpful. Examples:<br />
<code><br />
&gt; Date = edate:string_to_date("7/15/2010").<br />
{2010,7,15}<br />
&gt; edate:end_of_month(Date).<br />
{2010,7,31}<br />
&gt; edate:shift(Date, 52, weeks).<br />
{2011,7,14}<br />
&gt; edate:day_of_week(Date).<br />
"thursday"<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=106&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2010/07/03/edate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
		<item>
		<title>matching with append</title>
		<link>http://tailrecursion.wordpress.com/2010/07/03/matching-with-append/</link>
		<comments>http://tailrecursion.wordpress.com/2010/07/03/matching-with-append/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 22:35:20 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=98</guid>
		<description><![CDATA[I was recently reading this example, and I was totally surprised by the syntax in the is_authorized example. Apparently you can use the ++ operator to to pattern match. For example: &#62; "pajamas:" ++ Color = "pajamas:blue". Color now has the value “blue”. Be aware that this trick has it&#8217;s limitations – as far as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=98&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was recently reading <a href="http://bitbucket.org/justin/webmachine/wiki/ExampleResources" target="_blank">this</a> example, and I was totally surprised by the syntax in the is_authorized example. Apparently you can use the ++ operator to to pattern match. For example:<br />
<code><br />
&gt; "pajamas:" ++ Color = "pajamas:blue".<br />
</code><br />
Color now has the value “blue”. Be aware that this trick has it&#8217;s limitations – as far as I can tell it only works with a single variable and a single constant in the order given above.</p>
<p>It pays to read other people&#8217;s code &#8211; you&#8217;ll never know what interesting tidbits you may find.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=98&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2010/07/03/matching-with-append/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
		<item>
		<title>erlang library manager</title>
		<link>http://tailrecursion.wordpress.com/2010/02/25/erlang-library-manager/</link>
		<comments>http://tailrecursion.wordpress.com/2010/02/25/erlang-library-manager/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 01:55:00 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=90</guid>
		<description><![CDATA[If you&#8217;ve ever wanted to install and update all your favorite erlang libraries with a single command, you should check out elm. I&#8217;ve grown tired of manually checking for updates and writing verbose install scripts for my servers. All you have to do is store your repository urls in a single file, and elm can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=90&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever wanted to install and update all your favorite erlang libraries with a single command, you should check out <a href="http://github.com/dweldon/elm" target="_blank">elm</a>.</p>
<p>I&#8217;ve grown tired of manually checking for updates and writing verbose install scripts for my servers. All you have to do is store your repository urls in a single file, and elm can figure out how to pull the source and build it. Check out the readme for complete instructions and a full list of examples.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/90/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=90&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2010/02/25/erlang-library-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
		<item>
		<title>erlsom easy install</title>
		<link>http://tailrecursion.wordpress.com/2010/02/23/erlsom-easy-install/</link>
		<comments>http://tailrecursion.wordpress.com/2010/02/23/erlsom-easy-install/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 17:45:39 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=87</guid>
		<description><![CDATA[I&#8217;ve been using erlsom on my production servers for almost a year now &#8211; it&#8217;s parsed billions of xml documents in that time without an issue. My only problem with the library is how unpleasant it is to install. The build system is overly complex, the files are all dos formatted, it compiles with warnings, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=87&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->I&#8217;ve been using erlsom on my production servers for almost a year now &#8211; it&#8217;s parsed billions of xml documents in that time without an issue. My only problem with the library is how unpleasant it is to install. The build system is overly complex, the files are all dos formatted, it compiles with warnings, it&#8217;s hosted on sourceforge, etc. I cleaned up all of these issues and added the code to <a href="http://github.com/dweldon/erlsom" target="_blank">github</a>. Please see the readme for more information about what I changed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=87&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2010/02/23/erlsom-easy-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
		<item>
		<title>node communication and automatic discovery on ec2</title>
		<link>http://tailrecursion.wordpress.com/2010/02/20/node-communication-and-automatic-discovery-on-ec2/</link>
		<comments>http://tailrecursion.wordpress.com/2010/02/20/node-communication-and-automatic-discovery-on-ec2/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 17:55:41 +0000</pubDate>
		<dc:creator>David Weldon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tailrecursion.wordpress.com/?p=70</guid>
		<description><![CDATA[So you&#8217;ve signed up for ec2 and figured out how to create instances with erlang installed. Sweet. I&#8217;m going to show you how to get your erlang nodes to communicate &#8211; first if we know the IP addresses of both machines, and second if we want the nodes to automatically discover each other. I&#8217;m assuming [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=70&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;ve signed up for ec2 and figured out how to create instances with erlang installed. Sweet. I&#8217;m going to show you how to get your erlang nodes to communicate &#8211; first if we know the IP addresses of both machines, and second if we want the nodes to automatically discover each other.</p>
<p>I&#8217;m assuming at this point that you have two instances: I1 and I2, which are both members of the security group S. The first thing you need to do is edit the security group settings to allow full port access between all members of S. If you are using the management console, just add a new entry, leave everything blank but add S as the source and hit save. After a refresh it will show that icmp, tcp, and udp are all open for all members of S.</p>
<p>Open ssh connections to I1 and I2 in two terminals. Note the private DNS names of both instances &#8211; it&#8217;s the hostname followed by &#8220;.ec2.internal&#8221; (on us-east). For example: ip-10-200-100-50.ec2.internal</p>
<p>On both instances:<br />
<code><br />
$ erl -name test@`hostname`.ec2.internal -setcookie test<br />
</code><br />
If you don&#8217;t know what these parameters do, see the distributed programming section from this <a href="http://erlang.org/doc/getting_started/conc_prog.html" target="_blank">doc</a>.</p>
<p>Assuming the private DNS name of I2 is ip-10-200-100-50.ec2.internal, on I1 we can do this:<br />
<code><br />
&gt; net_adm:ping('test@ip-10-200-100-50.ec2.internal').<br />
</code><br />
If you received a pong message, congratulations &#8211; your nodes know about each other and can now communicate! Try running nodes() on each.</p>
<p>Next let&#8217;s have a look at doing this in a more automated way. Leave I2 running, but quit out of the erl shell on I1 and install Eric Cestari&#8217;s <a href="http://github.com/cstar/ec2nodefinder" target="_blank">ec2nodefinder</a>. As his README points out, you will need to either set the environment variables AMAZON_ACCESS_KEY_ID and AMAZON_SECRET_ACCESS_KEY, or you will need to edit the ec2nodefinder.app file in the ebin directory. Be careful of the commas in the app file if you go that route &#8211; if the file isn&#8217;t syntactically correct, the app won&#8217;t start. I like Eric&#8217;s version of ec2nodefinder better than the original version from the <a href="http://dukesoferl.blogspot.com/2008/02/automatic-node-discovery.html" target="_blank">dukes</a>, because it&#8217;s easier to install and it doesn&#8217;t rely on ec2-describe-instances.</p>
<p>Start your node on I1 again:<br />
<code><br />
erl -name test@`hostname`.ec2.internal -setcookie test<br />
</code><br />
You can now do:<br />
<code><br />
&gt; ec2nodefinder:start().</p>
<p>&gt; ec2nodefinder:discover().<br />
</code><br />
Which, if successful, will return something like:<br />
<code><br />
{ok,[{'test@ip-10-200-100-50.ec2.internal',pong}]}<br />
</code><br />
Calling nodes() on either node should again show they are connected. Awesome. Now you can do all kinds of crazy stuff like have nodes which automatically become part of an mnesia cluster when they start.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tailrecursion.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tailrecursion.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tailrecursion.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tailrecursion.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tailrecursion.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tailrecursion.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tailrecursion.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tailrecursion.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tailrecursion.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tailrecursion.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tailrecursion.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tailrecursion.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tailrecursion.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tailrecursion.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tailrecursion.wordpress.com&amp;blog=6756371&amp;post=70&amp;subd=tailrecursion&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tailrecursion.wordpress.com/2010/02/20/node-communication-and-automatic-discovery-on-ec2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/51763ff4e4c531c68326064bc13b84a6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">5hundy</media:title>
		</media:content>
	</item>
	</channel>
</rss>
