<?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>Full of BS &#187; Programming</title>
	<atom:link href="http://fullof.bs/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://fullof.bs</link>
	<description>He just never stops talking</description>
	<lastBuildDate>Mon, 19 Oct 2009 15:08:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Erlang jokes are too rare</title>
		<link>http://fullof.bs/erlang-jokes-are-too-rare/</link>
		<comments>http://fullof.bs/erlang-jokes-are-too-rare/#comments</comments>
		<pubDate>Fri, 08 May 2009 22:23:04 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[General Interest]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[munctional]]></category>
		<category><![CDATA[parallelism]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=500</guid>
		<description><![CDATA[But this one&#8217;s funny.
Munctional
]]></description>
			<content:encoded><![CDATA[<p>But this one&#8217;s funny.</p>
<p><a href="http://www.youtube.com/watch?v=1yH_j8-VVLo">Munctional</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/erlang-jokes-are-too-rare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reminders are nice</title>
		<link>http://fullof.bs/reminders-are-nice/</link>
		<comments>http://fullof.bs/reminders-are-nice/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 01:49:35 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=493</guid>
		<description><![CDATA[Always nice when someone lets you know, y&#8217;know?
[19:43] &#60;apples&#62; by the way StoneCypher, if you're curious, the level
          of functionality provided by my SMTP server in C, which is
          ~1000 lines, i trimmed down to less than [...]]]></description>
			<content:encoded><![CDATA[<p>Always nice when someone lets you know, y&#8217;know?</p>
<pre>[19:43] &lt;apples&gt; by the way StoneCypher, if you're curious, the level
          of functionality provided by my SMTP server in C, which is
          ~1000 lines, i trimmed down to less than 100 in erlang :p
[19:45] &lt;StoneCypher&gt; lel
[19:45] &lt;StoneCypher&gt; and i bet it's less buggy now too
[19:45] &lt;apples&gt; quite
[19:46] &lt;apples&gt; oh, and i wrote it in an hour
[19:46] &lt;StoneCypher&gt; awesome
[19:46] &lt;StoneCypher&gt; can i post that quote on my blog?
[19:46] &lt;apples&gt; sure thing</pre>
<p>Helps one remember one&#8217;s doing the right thing to push people to learn new things.</p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/reminders-are-nice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Link: Programmer Competency Matrix</title>
		<link>http://fullof.bs/programmer-competency-matrix/</link>
		<comments>http://fullof.bs/programmer-competency-matrix/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 16:46:06 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[competency]]></category>
		<category><![CDATA[evaluate]]></category>
		<category><![CDATA[evaluate hire]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[measure programmer]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[Programmer Competency Matrix]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[skill]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=481</guid>
		<description><![CDATA[I originally found the PCM through Starling Software&#8217;s copy, but it turns out to originally be by Sijin Joseph.  As both sites have lots of other interesting content, I&#8217;m linking both.
The Programmer Competency Matrix is a surprisingly realistic grid of capabilities sorted by topic, which gives an extremely rough but in my opinion basically valid [...]]]></description>
			<content:encoded><![CDATA[<p>I originally found the PCM through <a title="Programming Competency Matrix" href="http://www.starling-software.com/employment/programmer-competency-matrix.html" target="_blank">Starling Software</a>&#8217;s copy, but it turns out to originally be by <a title="Programming Competency Matrix" href="http://www.indiangeek.net/programmer-competency-matrix/" target="_blank">Sijin Joseph</a>.  As both sites have lots of other interesting content, I&#8217;m linking both.</p>
<p>The Programmer Competency Matrix is a surprisingly realistic grid of capabilities sorted by topic, which gives an extremely rough but in my opinion basically valid idea of an engineer&#8217;s gumption.  Starling republished it as part of their standard set of tools to be used during a hire.</p>
<p>Regardless of whether you agree with the grid or its data, it&#8217;s fun.  Have a look, and try scoring yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/programmer-competency-matrix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adware Scumbag Self Justification</title>
		<link>http://fullof.bs/adware-scumbag-self-justification/</link>
		<comments>http://fullof.bs/adware-scumbag-self-justification/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 16:39:41 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[General Interest]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[adware]]></category>
		<category><![CDATA[dishonest]]></category>
		<category><![CDATA[excuses]]></category>
		<category><![CDATA[liar]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[Matt Knox]]></category>
		<category><![CDATA[millgram experiment]]></category>
		<category><![CDATA[obvious shithead]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scumbag]]></category>
		<category><![CDATA[self justification]]></category>
		<category><![CDATA[virus]]></category>
		<category><![CDATA[warez]]></category>
		<category><![CDATA[warezer]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=475</guid>
		<description><![CDATA[One of the most amazing things to me about the typical adware scumbag is their desperation to justify their own behavior.  An interview with such a person just went onto slashdot, in which in the site afterword, he attempts to compare his choices to the Millgram Experiment.
Of course, anyone with half a clue will remember [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most amazing things to me about the typical adware scumbag is their desperation to justify their own behavior.  An interview with such a person just went onto slashdot, in which in the site afterword, he attempts to compare his choices to the Millgram Experiment.</p>
<p>Of course, anyone with half a clue will remember three things:</p>
<ol>
<li>He was not being instructed by an authority figure that adware was in the victim&#8217;s best interest</li>
<li>His goal was making money</li>
<li>He had months, including time away from the authority figure, in which to think it over</li>
</ol>
<p>The dirtbag goes on to talk about how difficult it was to ignore a challenging occupation when one doesn&#8217;t have many other options.  Thing is, I could be making tons of money as a pirate, or writing malware, and I manage to get through my day without doing it.  I&#8217;m also willing to bet that Drew Peters wasn&#8217;t actually looking for other jobs at the time.</p>
<blockquote><p>&#8220;It&#8217;s even harder if the bad starts out small and slowly gets bigger.&#8221;</p></blockquote>
<p>Horseshit.  The second you do something bad, you object, and if they try to force you, you walk away.  That&#8217;s why when I found out my old boss Russell was triple- or more billing his clients in my name, I told him that he stopped tomorrow, or I walked.  Did I get fired?  Sure, but I told the client what happened, so so did Russell, and I ended up getting the job back with a different boss and a much larger hourly billable.</p>
<p><em><strong>Oh, and I had my honesty and decency intact.</strong></em></p>
<p>Go to hell, <a title="Matt Knox, Dirtbag" href="http://philosecurity.org/2009/01/12/interview-with-an-adware-author" target="_blank">Matt Knox</a>.  It&#8217;s not that hard to not write malware.  It&#8217;s just hard for people like you.  I hope that eventually you find yourself the victim of the things you&#8217;ve done to others; you&#8217;ve almost certainly caused far more damage than you&#8217;ll ever understand, during a time where it was extremely easy to get other work.</p>
<p>Disgusting.</p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/adware-scumbag-self-justification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebKit overflow:hidden and clear:none clipping failure</title>
		<link>http://fullof.bs/webkit-overflowhidden-and-clearnone-clipping-failure/</link>
		<comments>http://fullof.bs/webkit-overflowhidden-and-clearnone-clipping-failure/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 01:30:35 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web and Web Standards]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[apple safari]]></category>
		<category><![CDATA[apple webkit]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[clear none]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[defect]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[hidden]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[none]]></category>
		<category><![CDATA[overflow]]></category>
		<category><![CDATA[overflow hidden]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=473</guid>
		<description><![CDATA[There is a failure in WebKit to honor overflow:hidden with clear:none on child elements.  This prevents several cheesy no-table space filling strategies which have worked portably since IE3 from working in WebKit derived browsers (safari, chrome, etc.)
Test case with screen shots and examples.
I have submitted this as Bug 23221.
]]></description>
			<content:encoded><![CDATA[<p>There is a failure in WebKit to honor overflow:hidden with clear:none on child elements.  This prevents several cheesy no-table space filling strategies which have worked portably since IE3 from working in WebKit derived browsers (safari, chrome, etc.)</p>
<p><a title="WebKit clipping failure" href="http://fullof.bs/outgoing/clipfail.html" target="_blank">Test case with screen shots and examples</a>.</p>
<p>I have submitted this as <a title="WebKit Bug 23221" href="https://bugs.webkit.org/show_bug.cgi?id=23221" target="_blank">Bug 23221</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/webkit-overflowhidden-and-clearnone-clipping-failure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Better Erlang TCP listening pattern: addressing the fast packet loss problem</title>
		<link>http://fullof.bs/a-better-erlang-tcp-listening-pattern-addressingthe-fast-packet-loss-problem/</link>
		<comments>http://fullof.bs/a-better-erlang-tcp-listening-pattern-addressingthe-fast-packet-loss-problem/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 03:04:59 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools and Libraries]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[accept]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[defect]]></category>
		<category><![CDATA[erlang server]]></category>
		<category><![CDATA[fast packet loss problem]]></category>
		<category><![CDATA[fast packet problem]]></category>
		<category><![CDATA[gen_tcp]]></category>
		<category><![CDATA[idiom]]></category>
		<category><![CDATA[idiomatic]]></category>
		<category><![CDATA[listen]]></category>
		<category><![CDATA[listen loop]]></category>
		<category><![CDATA[listener]]></category>
		<category><![CDATA[listener loop]]></category>
		<category><![CDATA[listener pattern]]></category>
		<category><![CDATA[network server]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[scutil]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[server listen]]></category>
		<category><![CDATA[server listener]]></category>
		<category><![CDATA[tcp server]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=466</guid>
		<description><![CDATA[[digg-reddit-me]I&#8217;ve had mixed reactions to this when I&#8217;ve discussed it with people on IRC.  This may be well known to oldbear Erlang programmers.  I suppose it&#8217;s also possible that I&#8217;m wrong, though I&#8217;ve talked to several people I respect, and more than one of them have suggested that they were already aware of this problem.  [...]]]></description>
			<content:encoded><![CDATA[<p>[digg-reddit-me]I&#8217;ve had mixed reactions to this when I&#8217;ve discussed it with people on IRC.  This may be well known to oldbear Erlang programmers.  I suppose it&#8217;s also possible that I&#8217;m wrong, though I&#8217;ve talked to several people I respect, and more than one of them have suggested that they were already aware of this problem.  If I&#8217;m wrong, please let me know; I&#8217;m open to the possibility that there&#8217;s a better answer that I just don&#8217;t know about.  <span style="text-decoration: line-through">I&#8217;ve never seen it discussed on the web, at least.</span> <span style="color: #ff9900">Update: Serge Aleynikov points out that</span> <a title="TCP Server, OTP Principles" href="http://trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles" target="_blank">this TrapExit tutorial</a> <span style="color: #ff9900">documents this approach.</span></p>
<p>I think this is probably real.</p>
<p>I believe there is a significant defect in the idiomatic listener pattern as discussed by most Erlang websites and as provided by most Erlang example code, and which is found in many Erlang applications.  This defect is relatively easily repaired once noticed without significant impact on surrounding code, and I have added functionality to my <a title="The ScUtil Library" href="http://scutil.com/" target="_blank">ScUtil Library</a> to handle this automatically under the name <tt><a title="standard_listener documentation" href="http://scutil.com/docs/#standard_listener-3" target="_blank">standard_listener</a></tt>.</p>
<p>The fundamental problem is essentially a form of race condition.  The idiomatic listener is, roughly:</p>
<blockquote>
<pre><span style="color: #008000"><strong>do_listen(Port, Opts, Handler) -&gt;

    case gen_tcp:listen(Port, Opts) of

        { ok, ListeningSocket } -&gt;
            listen_loop(ListeningSocket, Handler);

        { error, E } -&gt;
            { error, E }

    end.

listen_loop(ListeningSocket, Handler) -&gt;

    case gen_tcp:accept(ListeningSocket) of

        { ok, ConnectedSocket } -&gt;
            spawn(node(), Handler, [ConnectedSocket]),
            listen_loop(ListeningSocket);

        { error, E } -&gt;
            { error, E }

    end.
</strong></span></pre>
</blockquote>
<p>Now consider the case of a server under very heavy load.  Further, consider that the listening socket is opened either <span style="color: #008000"><tt>{active,true}</tt></span> or <span style="color: #008000"><tt>{active,once}</tt></span>, which is true in the vast bulk of Erlang network applications, meaning that packets are delivered automatically to the socket owner.  The general pattern is that the listening socket accepts a connection, spawns a handling process, passes the connected socket to that handling process, and the handling process takes ownership of the socket.</p>
<p>The problem is that it takes time for that all to happen, and Erlang doesn&#8217;t specify or allow you to control its timeslicing behavior (as well it should not).  As active sockets are managed by a standalone process, this means that if the connecting client is fast and the network is fast, the first packet (even the first several under extreme circumstances) could be delivered before the socket has been taken over by the handling PID, meaning that its contents would be dispatched to the wrong process, with no indication of where they were meant to go.  This invalidates connections and fills a non-discarding mailbox, which is a potentially serious memory leak (especially given that erlang&#8217;s response to out of memory conditions is to abort an entire VM.)</p>
<p>Obviously, this is intolerable.  There are better answers, though, than to switch to <span style="color: #008000"><tt>{active,false}</tt></span>.  One suggestion I heard was to pre-spawn handlers in order to reduce the gap time, but that doesn&#8217;t solve the problem, it just makes it less likely.</p>
<p>The approach that I took is to lie.  <span style="color: #008000"><tt>standard_listener </tt></span>takes the following steps to resolve the problem:</p>
<ol>
<li>Add the default <span style="color: #008000"><tt>{active,true}</tt></span> to the inet options list, if it isn&#8217;t already present.</li>
<li>Strip out the <span style="color: #008000"><tt>{active,Foo}</tt></span> from the inet options list, and store it as <span style="color: #008000"><tt>ActiveStatus</tt></span>.</li>
<li>Add <span style="color: #008000"><tt>{active,false}</tt></span> to the inet options list, and use that options list to open the listener.</li>
<li>When spawning handler processes, pass a shunt as the starting function, taking the real handling function and the real <span style="color: #008000"><tt>ActiveStatus</tt></span> as arguments</li>
<li>The shunt sets the real <span style="color: #008000"><tt>ActiveStatus</tt></span> from inside the handler process, at which point the socket begins delivering messages</li>
</ol>
<p>This neatly closes the problem.  A free, MIT license implementation can be found in <a title="The ScUtil Library" href="http://scutil.com/" target="_blank">ScUtil</a> beginning in version 96.  A simplified, corrected example follows for immediate reference; the thing in ScUtil is more feature complete.</p>
<blockquote>
<pre><span><strong><span style="color: #008000"><strong>do_listen(Port, Opts) -&gt;

    ActiveStatus = case proplists:get_value(active, SocketOptions) of
        undefined -&gt; true;
        Other     -&gt; Other
    end,

    FixedOpts = proplists:delete(active, SocketOptions)
             ++ [{active, false}],

    case gen_tcp:listen(Port, FixedOpts) of

        { ok, ListeningSocket } -&gt;
            listen_loop(ActiveStatus, ListeningSocket);

        { error, E } -&gt;
            { error, E }

    end.

listen_loop(</strong></span></strong></span><span><strong><span><strong><span><strong><span style="color: #008000"><strong>ActiveStatus, </strong></span></strong></span></strong></span></strong></span><span><strong><span style="color: #008000"><strong>ListeningSocket, Handler) -&gt;

    case gen_tcp:accept(ListeningSocket) of

        { ok, ConnectedSocket } -&gt;
            spawn(?MODULE, shunt, [ActiveStatus,ConnectedSocket,</strong></span></strong></span><span><strong><span><strong><span><strong><span style="color: #008000"><strong>Handler</strong></span></strong></span></strong></span></strong></span><span><strong><span style="color: #008000"><strong>]),
            listen_loop(</strong></span></strong></span><span><strong><span><strong><span><strong><span style="color: #008000"><strong>ActiveStatus, </strong></span></strong></span></strong></span></strong></span><span><strong><span style="color: #008000"><strong>ListeningSocket, Handler</strong></span></strong></span><span><strong><span style="color: #008000"><strong>);

        { error, E } -&gt;
            { error, E }

    end.

shunt(ActiveStatus, ConnectedSocket, Handler) -&gt;

</strong></span></strong></span><span><strong><span style="color: #008000"><strong>    controlling_process(ConnectedSocket, self()),
    inet:setopts(ConnectedSocket, [{active, ActiveStatus}]),
    Handler(ConnectedSocket).</strong></span></strong></span></pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/a-better-erlang-tcp-listening-pattern-addressingthe-fast-packet-loss-problem/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Making significant strides towards documenting ScUtil</title>
		<link>http://fullof.bs/making-significant-strides-towards-documenting-scutil/</link>
		<comments>http://fullof.bs/making-significant-strides-towards-documenting-scutil/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 19:37:37 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools and Libraries]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[erlang example code]]></category>
		<category><![CDATA[example code]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[mit license]]></category>
		<category><![CDATA[scutil]]></category>
		<category><![CDATA[scutil documentation]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=448</guid>
		<description><![CDATA[[digg-reddit-me]My erlang library ScUtil has been public at the ScUtil page for some time now.  Recently, I&#8217;ve been working on documenting it.  It&#8217;s about half documented in its current state.
Here&#8217;s the prototype ScUtil documentation.  I&#8217;m open to commentary.
]]></description>
			<content:encoded><![CDATA[<p>[digg-reddit-me]My erlang library ScUtil has been public at <a title="StoneCypher's Utility Library" href="http://scutil.com/" target="_blank">the ScUtil page</a> for some time now.  Recently, I&#8217;ve been working on documenting it.  It&#8217;s about half documented in its current state.</p>
<p>Here&#8217;s the <a title="Prototype ScUtil Documentation" href="http://sc.tri-bit.com/outgoing/scutil.html" target="_blank">prototype ScUtil documentation</a>.  I&#8217;m open to commentary.</p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/making-significant-strides-towards-documenting-scutil/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Prototype: EEP18 Considered Harmful: The problems with Erlang to JSON term translation</title>
		<link>http://fullof.bs/prototype-eep-18-considered-harmful-the-problems-with-erlang-to-json-term-translation/</link>
		<comments>http://fullof.bs/prototype-eep-18-considered-harmful-the-problems-with-erlang-to-json-term-translation/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 20:40:26 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[ECMA / Javascript]]></category>
		<category><![CDATA[ECMAScript]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[General Interest]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Tools and Libraries]]></category>
		<category><![CDATA[Web and Web Standards]]></category>
		<category><![CDATA[bif]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[eep]]></category>
		<category><![CDATA[eep 18]]></category>
		<category><![CDATA[eep18]]></category>
		<category><![CDATA[eeps]]></category>
		<category><![CDATA[erlang enhancement proposal 18]]></category>
		<category><![CDATA[javascript object notation]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[json bif]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=402</guid>
		<description><![CDATA[THIS IS ONLY HALF WRITTEN.  I have been sitting on this post, waiting for the mood to finish it, for months; because EEP18 is now being treated as a likely implement, I am immediately publishing the half-written version, because it exposes many (though not all) of the serious, irreconcilable problems with EEP18.
On the mailing list, [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000"><em><strong>THIS IS ONLY HALF WRITTEN.  I have been sitting on this post, waiting for the mood to finish it, for months; because EEP18 is now being treated as a likely implement, I am immediately publishing the half-written version, because it exposes many (though not all) of the serious, irreconcilable problems with EEP18.</strong></em></span></p>
<p>On the mailing list, people are actively trying to bring Erlang up to snuff with regards to web standards.  One of the more unfortunate choices being discussed is JSON as a data notation.  JSON, unfortunately, does not actually map to Erlang in a useful way.  Joe Armstrong has gone as far as to suggest BIFs, which are decidedly unrealistic as well as unnecessary.  My goal is to create a JSON handling library.  However, the mailing list is beginning to put momentum behind an alternative proposal which is currently presented in BIF form.</p>
<p>This post explains why my approach is different.  Many of the issues herein are discussed by <a title="Richard O'Keefe's EEP18, JSON BIFs" href="http://www.erlang.org/eeps/eep-0018.html" target="_blank">the tabled EEP</a> (EEP 18, &#8220;JSON BIFs&#8221; by Rickard O&#8217;Keefe), but some are not, and some of these issues are accepted when I believe they should not be.  <span style="text-decoration: underline"><strong>It is my position that EEP 18 is unacceptably dangerous</strong></span>.  I will explain why.</p>
<p><span id="more-402"></span></p>
<p>This paper assumes you are familiar with Erlang and with fundamental containers (the list, the array and the key/value map).  It is very helpful, but not required, to be familiar with JSON, or JavaScript or any ECMA derived language such as ActionScript.</p>
<h1>Premise</h1>
<p>There&#8217;s a movement starting to use Erlang for web work.  There are several stumbling blocks to that end.  Among them are a simple primary webserver, a simple primary unicode system and a simple primary JSON manager.</p>
<p>The webserver problem is mostly solved: there&#8217;s the httpd module, there&#8217;s yaws, there&#8217;s mochiweb, there&#8217;s the currently unavailable work at Tobbe&#8217;s Red Hot Erlang Blog, there&#8217;s even Joe&#8217;s HTTPD tutorial.  YAWS and MochiWeb in particular get a lot of action these days.  The situation isn&#8217;t amazingly straightforward, but it&#8217;s fairly straightforward; we&#8217;re in &#8220;Good Enough&#8221; territory.  (I&#8217;m building another webserver that behaves like factor&#8217;s drop-and-go server, based on Joe&#8217;s tutorial, but that&#8217;s not for here.)</p>
<p>The unicode problem, however, as well as the JSON problem, are not solved.  Unfortunately, whereas the Erlang community has had the foresight to deal with complex problems in modules first then to move them to syntax later, this process seems to be failing with both JSON and Unicode.  It can be argued that some of the choices made in each process are dangerous.  This community will, by and on the whole, remember the re: module, which is being replaced now with a partially incompatible successor that takes account of limitations and problems in the prior attempt, as well as moves to a stronger RE dialect.  It is important that this ability be retained for JSON and Unicode, both of which are subtly strikingly difficult problems, and both of which are unlikely to be Gotten Right™ on their respective first attempts.</p>
<h1>The Principle of Least Surprise</h1>
<p>One of the most important parts of writing libraries is to not write nasty shocks into place for users.  In transcoding libraries, there is one rule that defines least surprise more powerfully than any other: <em><strong>round-trip translations must not lose data</strong></em>.  No configuration of EEP 18 can achieve this.  Indeed, it is my position that a one to one translation of JSON to Erlang terms cannot exist, and that any attempt to present a not-1:1 translation as a translation is unacceptable, in that people will expect <span style="color: #0000ff"><code>j2e(e2j(X)) == X</code></span>, and that cannot be true.  This is especially important given that the suggestion that these translations become BIFs seems to be being taken seriously; <span style="color: #0000ff"><code>foo_to_bar(X)</code></span> bifs are currently never lossy, and this would create a worrying change in the meaning of several basic naming practices.</p>
<p>It is of critical importance, in my opinion, that we do not provide libraries which fail round-trip conversion in either direction.  At this time, EEP 18 attempts to satisfy this clause with creation-time configurability; I will explain my stance that this is inadequate below.</p>
<h1>Why Translation is Unclear</h1>
<p>There are, in fact, quite a few problems that prevent 1:1 translation.  We&#8217;ll go over them one by one.</p>
<ol>
<li>The notations offer different fundamental containers
<ol>
<li>Erlang offers dense sequence (&#8220;tuple&#8221;, <span style="color: #0000ff"><code>{}</code></span>) and singly linked list (&#8220;list&#8221;, <span style="color: #0000ff"><code>[]</code></span>) containers.  The erlang standard library offers other containers; I discuss later in this document why I&#8217;m not using them.</li>
<li>JSON offers dense sequence (&#8220;array&#8221;, <span style="color: #0000ff"><code>[]</code></span>) and key-value map (&#8220;object&#8221;, <span style="color: #0000ff"><code>{}</code></span>) containers.  That&#8217;s it.</li>
</ol>
</li>
<li>The notations offer different fundamental datatypes
<ol>
<li>JSON has a fundamental string type; erlang doesn&#8217;t.</li>
<li>Erlang has atoms; JSON doesn&#8217;t.</li>
<li>JSON has booleans and &#8220;null&#8221;; Erlang doesn&#8217;t.  For transcoding, pretending they&#8217;re atoms creates ambiguity, and is therefore unacceptable.</li>
<li>JSON has explicit support for unicode characters in strings.  Erlang doesn&#8217;t have strings at all, but rather lists of characters (in the way that C has arrays of characters).  Those lists are context and usage defined; C++ programmers may think of this as parallel to array strings vs std::string.  Erlang currently has no concept of Unicode (<span style="color: #999999"><em>though that&#8217;s another issue I&#8217;m working on as divergent from the current mailing list / EEP approach</em>.</span>)</li>
<li>JSON and Erlang have very different lists of quoted terms for strings.
<ol>
<li>Erlang supports embedded octal with shortening, and a bunch of semi-defunct control characters like form feed (<span style="color: #0000ff"><code>"\f"</code></span>) and escape (<span style="color: #0000ff"><code>"\e"</code></span>).</li>
<li>JSON supports 16-bit Unicode character embedding.</li>
<li>Problematically, JSON does not define whether that embedding is UTF16, UCS2 or something else.  Most software implementations assume UTF16.  This document will carefully avoid the issue, which is a serious defect in this document, and a serious defect in JSON.</li>
</ol>
</li>
<li>Erlang terms are byte-available, meaning Erlang programmers may be aware of endianness; JSON objects are not.  This suggests that the handling library needs to either make a choice about internal endianness, or needs to provide control to the user.</li>
</ol>
</li>
<li>The notation for similar containers is dissimilar</li>
<li>Similar notations are similar, not identical</li>
<li>Dangerous string ambiguities</li>
</ol>
<p>Working from http://sc.tri-bit.com/outgoing/scjson%20parser%20halp.html</p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/prototype-eep-18-considered-harmful-the-problems-with-erlang-to-json-term-translation/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Holy crap, an Objective C text that doesn&#8217;t assume you&#8217;re retarded</title>
		<link>http://fullof.bs/holy-crap-an-objective-c-text-that-doesnt-assume-youre-retarded/</link>
		<comments>http://fullof.bs/holy-crap-an-objective-c-text-that-doesnt-assume-youre-retarded/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 03:38:35 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[General Interest]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[Not Awful]]></category>
		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=442</guid>
		<description><![CDATA[[digg-reddit-me]My good friend Jeff happened to mention offhand his knowledge of a document I&#8217;ve been looking for for quite some time now.  I&#8217;m sharing it with my readers in case they&#8217;re looking for something similar.
Let me be forward: I cannot stand the various Objective C books I&#8217;ve tried.  They all want to teach me to [...]]]></description>
			<content:encoded><![CDATA[<p>[digg-reddit-me]My good friend <a title="Jeff Katz" href="http://www.kraln.com/" target="_blank">Jeff</a> happened to mention offhand his knowledge of a document I&#8217;ve been looking for for quite some time now.  I&#8217;m sharing it with my readers in case they&#8217;re looking for something similar.</p>
<p>Let me be forward: I cannot <strong><em><span style="text-decoration: underline">stand</span></em></strong> the various Objective C books I&#8217;ve tried.  They all want to teach me to be a programmer.  I&#8217;m already there.  I just want a book like <a title="The C++ Programming Language" href="http://sc.tri-bit.com/tcpppl" target="_blank">Stroustrup</a>.  The PragProg book is awful: the first several chapters are about Mac development tools, like I give a damn.  Everything&#8217;s through interface wizards.  It&#8217;s nauseating.</p>
<p>Jeff heard mein painz0rz, and turned me on to <a title="Objective C for C++ Developers" href="http://ktd.club.fr/programmation/fichiers/cpp-objc-en.pdf" target="_blank">From C++ to Objective-C</a>.  It isn&#8217;t perfect: it&#8217;s not super comprehensive, and it&#8217;s translated from a different native language (French), which leaves a few passages cumbersome.  However, as one can tell from reading the intro, the author of the document, much like me, found little to love in the state of Objective C documentation, and wanted to write something for people who were already well established.</p>
<p>Kudos to Pierre Chatelier for writing the book that Apple and Alan Kay could not.</p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/holy-crap-an-objective-c-text-that-doesnt-assume-youre-retarded/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Yay for Varun!  Open Source Inbound</title>
		<link>http://fullof.bs/yay-for-varun-open-source-inbound/</link>
		<comments>http://fullof.bs/yay-for-varun-open-source-inbound/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 02:26:58 +0000</pubDate>
		<dc:creator>John Haugeland</dc:creator>
				<category><![CDATA[ECMA / Javascript]]></category>
		<category><![CDATA[ECMAScript]]></category>
		<category><![CDATA[General Interest]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools and Libraries]]></category>
		<category><![CDATA[8601]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[gpl-free]]></category>
		<category><![CDATA[iso8601]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Kayako]]></category>
		<category><![CDATA[libraries]]></category>
		<category><![CDATA[mit license]]></category>
		<category><![CDATA[Open source]]></category>

		<guid isPermaLink="false">http://fullof.bs/?p=427</guid>
		<description><![CDATA[My boss&#8217; boss, Varun, is letting me open source some of the work I&#8217;m doing at Kayako.  I&#8217;m not supposed to talk about the interesting three until they&#8217;re ready for release, but I can tell you that a JavaScript ISO8601 implementation is among them, and that they&#8217;re all going to be MIT licensed, no GPL [...]]]></description>
			<content:encoded><![CDATA[<p>My boss&#8217; boss, Varun, is letting me open source some of the work I&#8217;m doing at <a title="Kayako" href="http://kayako.com/" target="_blank">Kayako</a>.  I&#8217;m not supposed to talk about the interesting three until they&#8217;re ready for release, but I can tell you that a JavaScript ISO8601 implementation is among them, and that they&#8217;re all going to be MIT licensed, no GPL contamination.</p>
<p>More news as I get my butt in gear and finish the libraries in question.  But, yay Varun!</p>
]]></content:encoded>
			<wfw:commentRss>http://fullof.bs/yay-for-varun-open-source-inbound/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
