<?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>writing &#124; ben fry &#187; code</title>
	<atom:link href="http://benfry.com/writing/archives/category/code/feed" rel="self" type="application/rss+xml" />
	<link>http://benfry.com/writing</link>
	<description>Visualizing Data</description>
	<lastBuildDate>Sat, 05 Nov 2011 18:57:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tiny Sketch, Big Funny</title>
		<link>http://benfry.com/writing/archives/506</link>
		<comments>http://benfry.com/writing/archives/506#comments</comments>
		<pubDate>Fri, 14 Aug 2009 14:36:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[opportunities]]></category>
		<category><![CDATA[processing]]></category>

		<guid isPermaLink="false">http://benfry.com/writing/?p=506</guid>
		<description><![CDATA[Just heard about this from Casey yesterday:
Tiny Sketch is an open challenge to artists and programmers to create the most compelling creative work possible with the programming language Processing using 200 characters or less.
&#8230;building on the proud traditions of obfuscated code contests and the demo scene. The contest runs through September 13 and is sponsored [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openprocessing.org/collections/rhizome.php"><img class="alignright size-full wp-image-507" style="margin: 8px 13px;" title="not all sketches are 6x6 pixels in size" src="http://benfry.com/wp/wp-content/uploads/2009/08/thumbnails-small.png" alt="not all sketches are 6x6 pixels in size" width="96" height="300" /></a>Just heard about this from <a href="http://reas.com">Casey</a> yesterday:</p>
<blockquote><p><a href="http://www.openprocessing.org/collections/rhizome.php"><em>Tiny Sketch</em></a> is an open challenge to artists and programmers to create the most compelling creative work possible with the programming language <a href="http://www.processing.org/" target="_parent">Processing</a> using 200 characters or less.</p></blockquote>
<p>&#8230;building on the proud traditions of obfuscated code contests and the demo scene. The contest runs through September 13 and is sponsored by <a href="http://rhizome.org/" target="newW">Rhizome</a> and <a href="http://openprocessing.org/">OpenProcessing</a>.</p>
<p>Having designed Processing to do one thing or another, several of the submissions made me laugh out loud for ways their authors managed to introduce new quirks. For instance, consider the <a href="http://processing.org/reference/createFont_.html"><code>createFont()</code></a> function. Usually it looks something like this:</p>
<blockquote><p><code>PFont f = createFont("Helvetica", 12);</code></p></blockquote>
<p>If the “Helvetica” font is not installed, it silently winds up using a default font. So somebody clever figured out that if you just leave the font name blank, it&#8217;s an easy way to get a default font, and not burn several characters of the limit:</p>
<blockquote><p><code>PFont f = createFont("", 12);</code></p></blockquote>
<p><a href="http://www.openprocessing.org/visuals/?visualID=3508">Another</a>, by Kyle McDonald, throws an exception as a way to produce text to plot on screen. (It&#8217;s also a bit of an inside joke—on us, perhaps—because it&#8217;s a ubiquitous error message resulting from a <a href="http://processing.org/reference/loadPixels_.html">change</a> that was made since earlier releases of Processing.)</p>
<p>One of the most interesting bits is seeing how these ideas propagate into later sketches that are produced. Since the font hack appeared (not sure who did it first, let me know if you do), everyone else is now using that method for producing text. Obviously art/design/coding projects are always the result of other influences, but it&#8217;s rare that you get to see ideas exchanged in such a direct fashion.</p>
<p>And judging from some of the jagged edges in the submissions, I&#8217;m gonna change the <a href="http://processing.org/reference/smooth_.html"><code>smooth()</code></a> to just <code>s()</code> for the next release of Processing, so that more people will use it in the next competition.</p>
]]></content:encoded>
			<wfw:commentRss>http://benfry.com/writing/archives/506/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Li&#8217;l Endian</title>
		<link>http://benfry.com/writing/archives/32</link>
		<comments>http://benfry.com/writing/archives/32#comments</comments>
		<pubDate>Sat, 08 Mar 2008 03:52:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[updates]]></category>
		<category><![CDATA[vida]]></category>

		<guid isPermaLink="false">http://benfry.com/writing/archives/32</guid>
		<description><![CDATA[Chapters 9 and 10 (acquire and parse) are secretly my favorite parts of Visualizing Data. They&#8217;re a grab bag of useful bits based on many years of working with information (previous headaches)&#8230; the sort of things that come up all the time.
Page 327 (Chapter 10) has some discussion about little endian versus big endian, the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://benfry.com/wp/wp-content/uploads/2008/03/01.jpg" title="01.jpg"><img src="http://benfry.com/wp/wp-content/uploads/2008/03/01.thumbnail.jpg" alt="Gulliver" align="right" vspace="7" /></a>Chapters 9 and 10 (acquire and parse) are secretly my favorite parts of <em>Visualizing Data</em>. They&#8217;re a grab bag of useful bits based on many years of working with information (previous headaches)&#8230; the sort of things that come up all the time.</p>
<p>Page 327 (Chapter 10) has some discussion about little endian versus big endian, the way in which different computer architectures (Intel vs. the rest of the world, respectively) handle multi-byte binary data. I won&#8217;t repeat the whole section here, though I have two minor errata for that page.</p>
<p>First, an error in formatting which lists <em>network byte</em> order, rather than <em>network</em> byte order. The other problem is that I mention that little endian versions of Java&#8217;s  DataInputStream class can be found on the web for little more than a search for DataInputStreamLE. As it turns out, that was a big fat lie, though you <em>can</em> find a handful if you search for LEDataInputStream (even though that&#8217;s a goofier name).</p>
<p>To make it up to you, I&#8217;m posting proper DataInputStreamLE (and DataOutputStreamLE) which are a minor adaptation of code from the <a href="http://www.gnu.org/software/classpath/">GNU Classpath</a> project. They work just like DataInputStream and DataOutputStream, but just swap the bytes around for the Intel-minded. Have fun!</p>
<p><a href="/writing/parse/DataInputStreamLE.java">DataInputStreamLE.java</a></p>
<p><a href="/writing/parse/DataOutputStreamLE.java">DataOutputStreamLE.java</a></p>
<p>I&#8217;ve been using these for a project and they seem to be working, but let me know if you find errors. In particular, I&#8217;ve not looked closely at the UTF encoding/decoding methods to see if there&#8217;s anything endian-oriented in there. I tried to clean it up a bit, but the javadoc may also be a bit hokey.</p>
<p>(Update) Household historian <a href="http://shannonhunt.com">Shannon</a> on the origin of the terms:</p>
<blockquote><p>The terms &#8220;big-endian&#8221; and &#8220;little-endian&#8221; come from Gulliver&#8217;s Travels by Jonathan Swift, published in England in 1726. Swift&#8217;s hero Gulliver finds himself in the midst of a war between the empire of Lilliput, where people break their eggs on the smaller end per a royal decree (Protestant England) and the empire of Blefuscu, which follows tradition and breaks their eggs on the larger end (Catholic France).  Swift was satirizing Henry VIII&#8217;s 1534 decision to break with the Roman Catholic Church and create the Church of England, which threw England into centuries of both religious and political turmoil despite the fact that there was little doctrinal difference between the two religions.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://benfry.com/writing/archives/32/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

