<?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>Brain on Fire</title>
	<atom:link href="http://www.brainonfire.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brainonfire.net</link>
	<description>Tim McCormack, distilled</description>
	<lastBuildDate>Fri, 04 Dec 2009 02:51:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>LoadForCompile: Help for in-browser compilers</title>
		<link>http://www.brainonfire.net/blog/load-for-compile/</link>
		<comments>http://www.brainonfire.net/blog/load-for-compile/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 21:30:51 +0000</pubDate>
		<dc:creator>Tim McCormack</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[announce]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.brainonfire.net/?p=671</guid>
		<description><![CDATA[As javascript engines increase in speed and efficiency, it is becoming feasible to write compilers and interpreters in javascript to allow webpages to run alternative programming languages not normally supported by browsers. See processing.js, for instance: A graphics library that runs a Java-like language in the browser.

An initial hurdle facing developers of these toolkits is [...]]]></description>
			<content:encoded><![CDATA[<p>As javascript engines increase in speed and efficiency, it is becoming feasible to write compilers and interpreters in javascript to allow webpages to run alternative programming languages not normally supported by browsers. See <a href="http://processingjs.org/">processing.js</a>, for instance: A graphics library that runs a Java-like language in the browser.</p>

<p>An initial hurdle facing developers of these toolkits is the problem of loading source code. Javascript is loaded and executed natively in the browser environment, and it would be nice to load alternative language sources in a similar manner. So, today I wrote a library to do that.</p>

<p>The library, called <a href="http://lab.brainonfire.net/lib/load-for-compile.js">LoadForCompile</a>, is invoked with a MIME type and a callback.  It searches the DOM for script elements with the given MIME type, loads their sources, and passes them to the callback. There is a <a href="http://lab.brainonfire.net/lib/demo/load-for-compile.html">very simple demo page</a> with a "compiler" that displays whatever source code it is provided. Following is the documentation for the library.</p>

<h3 id="heading-description">Description</h3>

<p>LoadForCompile will retrieve alternate-language source code and pass it (in order) to <code>onLoad</code>. Any sources that cannot be retrieved will be ignored by default.</p>

<p>If the <code>onFinish</code> argument is provided, it will be called when all sources have been loaded and passed.</p>

<p>If the <code>onError</code> argument is provided, it will be called with <code>(src, k)</code>, where <code>src</code> is the offending URL and <code>k</code> is a continuation of the loading process, so the relying client may continue or entirely halt the loading process by calling <code>k</code> or not calling it, respectively.</p>

<h3 id="heading-usage">Usage</h3>

<ol>
	<li>Place script elements in your HTML document with desired MIME type.</li>
	<li>Each script element may have a <code>src</code> attribute, an inline body between the opening and closing tags, or both. The body is guaranteed to be called immediately after the associated remote source, or not at all.</li>
	<li>Finally, call LoadForCompile with the MIME type and callbacks.</li>
</ol>

<h3 id="heading-specification">Specification</h3>

<p>LoadForCompile searches the DOM for any script nodes bearing the target MIME type. For each one, it records the src attribute and the contents of the text node, if any. It is an error to have non-text elements as children of the script node, and in such a situation the behavior of this library is unspecified.</p>

<p>The library uses asynchronous requests to load any remote resources specified by <code>src</code> attributes. This loading occurs in an unspecified order. If any remote source fails to load, the library will mark that source (and any associated inline body) as invalid. If <code>onError</code> is provided, it will be called with a continuation function that will resume progress. (If the continuation is not called, no additional callbacks will be made.)</p>

<p>Note that if <code>onError</code> is provided and does not call the continuation, <code>onFinish</code> will not be called.</p>

<h3 id="heading-metadata">Metadata</h3>

<p>The library is in version 0.2 and is licensed under the LGPL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brainonfire.net/blog/load-for-compile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tone down your system beep</title>
		<link>http://www.brainonfire.net/blog/tone-down-your-system-beep/</link>
		<comments>http://www.brainonfire.net/blog/tone-down-your-system-beep/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 22:10:46 +0000</pubDate>
		<dc:creator>Tim McCormack</dc:creator>
				<category><![CDATA[Solutions]]></category>

		<guid isPermaLink="false">http://www.brainonfire.net/?p=664</guid>
		<description><![CDATA[The "system beep" (or "system bell") can be quite annoying. Instead of disabling it altogether, you may be able to change it to something a little less irritating. Some operating systems will allow you to change it to a visual alert or a sound file of your choice. Today, I'll show you how to change [...]]]></description>
			<content:encoded><![CDATA[<p>The "system beep" (or "system bell") can be quite annoying. Instead of disabling it altogether, you may be able to change it to something a little less irritating. Some operating systems will allow you to change it to a visual alert or a sound file of your choice. Today, I'll show you how to change the duration, pitch, and volume to something less grating if you're using X.Org (applies to just about all Unix or GNU/Linux systems.) [<a href="http://ubuntuforums.org/showpost.php?p=4075006&#038;postcount=3">via</a>]</p>

<p>I use <code>xset</code>, a command that can set various preferences in the current X display. One of the parameter sets is <code>b</code>, the properties of the system bell. It can be used to set the relative volume, pitch, and duration. Here's an example:</p>

<pre class="commandline">xset b 50 700 5</pre>

<p>That example sets the system bell to 50% volume, a pitch of 700 hertz, and a duration of 5 milliseconds.</p>

<p>Experiment by entering that command, then pressing [Backspace] on the next line of your terminal (to generate a system bell.) Your hardware may not support certain combinations, in which the bell is silent.</p>

<p>To have this setting take effect every time you log in, add it to your session startup commands. In Ubuntu, that's System :: Preferences :: Sessions.</p>]]></content:encoded>
			<wfw:commentRss>http://www.brainonfire.net/blog/tone-down-your-system-beep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GWT, standard library, and IncompatibleRemoteServiceException</title>
		<link>http://www.brainonfire.net/blog/gwt-standard-lib-incompatibleremoteserviceexception/</link>
		<comments>http://www.brainonfire.net/blog/gwt-standard-lib-incompatibleremoteserviceexception/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 19:00:31 +0000</pubDate>
		<dc:creator>Tim McCormack</dc:creator>
				<category><![CDATA[Solutions]]></category>
		<category><![CDATA[compilation]]></category>
		<category><![CDATA[generics]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[programming language design]]></category>
		<category><![CDATA[serialization]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://www.brainonfire.net/?p=658</guid>
		<description><![CDATA[The GWT is a set of programs that allows developers to write Java code and compile it down into Javascript to be run on browsers. This requires you to use the subset of Java that the toolkit can emulate, but the compile-time and runtime error messages it displays are often not very useful.

I was developing [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://code.google.com/webtoolkit/" title="Google Web Toolkit homepage">GWT</a> is a set of programs that allows developers to write Java code and compile it down into Javascript to be run on browsers. This requires you to use the subset of Java that the toolkit can emulate, but the compile-time and runtime error messages it displays are often not very useful.</p>

<p>I was developing a GWT application with Eclipse and ran into a client-server communication issue that manifested at runtime. The client would request an object from the server, the object would properly serialize and deserialize (verified by JS debugger), and then GWT's glue code would throw <code>IncompatibleRemoteServiceException</code> (saying "This application is out of date, please click the refresh button on your browser.")</p>



<p>Ultimately, I believe this exception was occurring because either</p>

<ol type="A">
	<li>the class in question extended <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/EnumMap.html"><code>java.util.EnumMap</code></a>, a standard Java library class that GWT reimplements in JS, or</li>
	<li>accessing <code>Whatever.class</code> is disallowed in GWT, but is required for generic code that deals with enumeration types.</li>
</ol>

<p> When I rewrote the class to itself reimplement <code>EnumMap</code> (but specialized to a specific <code>Enum</code>), the exception disappeared. Read on for gory Java details:</p>

<p><code>EnumMap</code> maps values of an <code>Enum</code> to values of some other type. In my case, I was mapping to <code>Boolean</code> values, creating a selection of the <code>Enum</code>. Ordinarily I would just use <code>EnumMap&lt;MyEnum, Boolean&gt;</code>, but unfortunately, <code>EnumMap</code> is not <code>Serializable</code>, since it has no nullary constructors. And why is this? Well, its constructors need to retrieve the list of enumeration values, and  not only do Java generics erase the type information that would otherwise allow access to this info, but one also cannot call <code>T.values()</code> where <code>T</code> is a parameter type extending Enum. Basically, it's a whole pile of language-design fail.</p>

<p>I tried to get around all these issues by subclassing <code>EnumMap</code> and calling <code>super(MyEnum.class)</code> in the constructor, allowing it to be nullary (and therefore supporting serialization.) Ultimately, however, this code was rejected by GWT, and I found it easier to just write a specific reimplementation of the library code.</p>

<p>(Eclipse 3.4 x64 on Ubuntu Intrepid Ibex x64, GWT 1.6.4 plugin, ia32
Sun Java 5 libs.)</p>]]></content:encoded>
			<wfw:commentRss>http://www.brainonfire.net/blog/gwt-standard-lib-incompatibleremoteserviceexception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bahamas trip: Day 11</title>
		<link>http://www.brainonfire.net/blog/bahamas-trip-day-11/</link>
		<comments>http://www.brainonfire.net/blog/bahamas-trip-day-11/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 03:05:47 +0000</pubDate>
		<dc:creator>Tim McCormack</dc:creator>
				<category><![CDATA[-no category-]]></category>
		<category><![CDATA[Bahamas]]></category>
		<category><![CDATA[home]]></category>
		<category><![CDATA[return]]></category>
		<category><![CDATA[San Salvador]]></category>
		<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://www.brainonfire.net/?p=653</guid>
		<description><![CDATA[It is my last day in the Bahamas, for now. After breakfast I have just enough time to walk out to the North Point, where I hear tell there might be some San Salvador rock iguanas, a critically endangered subspecies. It seems that some of them may have swum across the harbor from the cay [...]]]></description>
			<content:encoded><![CDATA[<p>It is my last day in the Bahamas, for now. After breakfast I have just enough time to walk out to the North Point, where I hear tell there might be some San Salvador rock iguanas, a critically endangered subspecies. It seems that some of them may have swum across the harbor from the cay where the main local population lives. (I express an interest in taking closeup photos, and am warned that they may attempt to eat my camera...)</p>



<p>Alas, iguanas are not in the cards today. The Point is beautiful as always, though, with both smooth and jagged rock formations lining the sides. On the walk back to GRC I see a mangrove I hadn't noticed before, what might be a Bahama Mockingbird, and a yellow-flowered Wild Unction Vine.</p>

<a href="http://gallery.brainonfire.net/view/5ebf0b34f9c50c6ffb864680c1161663" class="thumblink" title="See photo page"><img src="http://cdn.gallery.brainonfire.net/5ebf0b34f9c50c6ffb864680c1161663.thumb.jpg" alt="Thumbnail image"><span class="caption">Crab hiding under overhang</span></a>

<p>I packed the night before, so the only thing left to do before getting on the truck is to go down to the seashore and say goodbye to the island. I throw back the shells I had collected, but keep the smooth sea glass. A mid-sized crab scuttles under an overhang of the boat launch ramp I am standing on, and I nearly dip my camera into the surf to take a closeup photo. It comes out beautifully.</p>

<p>----</p>

<p>The return trip is a breeze, except for the Nassau airport, where we have to go through Bahamian airport security, followed immediately by grumpy, power-tripping US Customs agents, and then through US airport security. Hey, handle that laptop gently, or at least don't slam it on the table! The San Sal airport was delightfully insecure, which made me feel relaxed. This harrying makes me anxious.</p>

<p>Finally, we are home. My mom picks us all up from the airport, and we watch the Tina James' Magic evening primroses open, exotic flowers in our own yard.</p>]]></content:encoded>
			<wfw:commentRss>http://www.brainonfire.net/blog/bahamas-trip-day-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bahamas trip: Day 10</title>
		<link>http://www.brainonfire.net/blog/bahamas-trip-day-10/</link>
		<comments>http://www.brainonfire.net/blog/bahamas-trip-day-10/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 03:14:24 +0000</pubDate>
		<dc:creator>Tim McCormack</dc:creator>
				<category><![CDATA[-no category-]]></category>
		<category><![CDATA[Bahamas]]></category>
		<category><![CDATA[cactus]]></category>
		<category><![CDATA[ethnobotany]]></category>
		<category><![CDATA[reef]]></category>
		<category><![CDATA[San Salvador]]></category>
		<category><![CDATA[snorkeling]]></category>
		<category><![CDATA[sting]]></category>
		<category><![CDATA[wasp]]></category>

		<guid isPermaLink="false">http://www.brainonfire.net/?p=651</guid>
		<description><![CDATA[In the morning, my dad picks up Mr. Forbes from his house and drives him back to GRC. Just as they arrive, the power cuts out, so Mr. Forbes can't sharpen his machete. Too bad, 'cause we're gonna be in the bush again today.

 

We walk down past the water tanks and through the catchment. [...]]]></description>
			<content:encoded><![CDATA[<p>In the morning, my dad picks up Mr. Forbes from his house and drives him back to GRC. Just as they arrive, the power cuts out, so Mr. Forbes can't sharpen his machete. Too bad, 'cause we're gonna be in the bush again today.</p>

 

<p>We walk down past the water tanks and through the catchment. Mr. Forbes points out a <a href="http://en.wikipedia.org/wiki/Metopium_toxiferum">poisonwood tree</a> for me. It's related to poison ivy and has the same toxin, urushiol, but he claims that the surface of the leaves is not toxic, only the sap. Either way, I'm glad to finally know one of the several plants to avoid touching. (Haulback and Manchineel are the others.) Our walk takes us down past one of the brackish inland lakes, where I have the misfortune of being the third person to brush past a wasp nest, and thus I am the one who is stung. Luckily, I have <a href="http://en.wikipedia.org/wiki/Mometasone">a steroidal cream</a> in my backpack, which quickly cuts the inflammation and pain. However, we don't actually know where the nest is located, just that it's somewhere near or on the path.</p>

<p>As we head back, I am again the third person in the group, and my companions make it past the nest before I spot it. There it is, attached to a calf-height branch sticking out into the path. I try to ease past it, but at the last second half the nest launches. Only one gets a sting in (on the same leg) before they turn back. Again, the cream provides quick relief. (When we later see a similar nest near the path, I choose a wiser but more difficult route through the dense bush, circumnavigating the agitated wasps.)</p>

<p>The power cuts on again minutes after we arrive back at Gerace.</p>

<p>----</p>

<p>The rest of the day is unscheduled, so my dad and Kathleen and I hop in the van and explore the island a little bit more. The lighthouse is our first stop. It is one of the last of its kind, and is open to the public. I take a series of photos of the island's landscape from the circular deck, which I hope to stitch into a panorama at a later date.</p>

<p>We have time for one last snorkel, and we choose Rocky Point. It has patches of real coral reef, more impressive than the occasional small coral anchored on a random bit of underwater debris. The water is 20 feet deep, so I get to dive down, roll onto my back, and watch the silvery waves billow overhead. I see giant sea fans, cleaner wrasse, and schools of tiny, translucent fish just below the surface. Kathleen spots a flounder hugging the sand. The current farther out is quite strong, so we struggle back to shore and call it a day.</p>

<p>We'll be leaving tomorrow morning, so after dinner I take a walk down the road to check out the flowering agaves. Once I've explored those as well as the dense roadside bush will permit, I walk further east. There are occasional overgrown driveways into equally overgrown abandoned lots, and in one of these I find a prickly pear cactus, a car's chassis that is nearly covered in vines, and various rusting discarded appliances. It seems to be the wrong time of year for prickly pear fruit, and I have no inclination to clean and cook a pad.</p>]]></content:encoded>
			<wfw:commentRss>http://www.brainonfire.net/blog/bahamas-trip-day-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bahamas trip: Day 9</title>
		<link>http://www.brainonfire.net/blog/bahamas-trip-day-9/</link>
		<comments>http://www.brainonfire.net/blog/bahamas-trip-day-9/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 01:53:08 +0000</pubDate>
		<dc:creator>Tim McCormack</dc:creator>
				<category><![CDATA[-no category-]]></category>
		<category><![CDATA[Bahamas]]></category>
		<category><![CDATA[ethnobotany]]></category>
		<category><![CDATA[hermit crab]]></category>
		<category><![CDATA[San Salvador]]></category>
		<category><![CDATA[snorkeling]]></category>

		<guid isPermaLink="false">http://www.brainonfire.net/?p=647</guid>
		<description><![CDATA[My companions go off to interview Erma Pratt after breakfast, but I'm too tired from the previous night, so I stay in and catch up on photos, blogging, and communication with the outside world. It's a hard decision: Erma's grandmother Sophia was one of the last midwives on the island, and an amazing woman... but [...]]]></description>
			<content:encoded><![CDATA[<p>My companions go off to interview Erma Pratt after breakfast, but I'm too tired from the previous night, so I stay in and catch up on photos, blogging, and communication with the outside world. It's a hard decision: Erma's grandmother Sophia was one of the last midwives on the island, and an amazing woman... but I'm <em>exhausted</em>.</p>



<p>On the way back from breakfast I find a hermit crab that is far too small for its shell. I play with it a little bit (and get a tiny pinch), then set it down and go about my business. An hour later, I come across the shell... upside-down, with no crab! A faint set of tracks in the sand lead me to a rock, behind which is the naked hermit crab. (I've never seen this before.) The crab is super aggressive, but I get some okay pictures of it.</p>

<p>I know that hermit crabs whose scavenged shells are too small are less protected, but I had never considered what danger a crab with a too-large shell would face. It seems that when an oversized shell flips over, the crab has no choice but to exit the shell and search out a new one. I test this idea by allowing the naked crab to get back in its shell and then placing it upside-down. Although the crab never exits, it also doesn't succeed in flipping; it really would have no choice in the long run. (I right the crab and search for a more appropriately sized shell, but I can find none.)</p>

<p>After lunch, we interview Myrtis Jones at her house and learn of even more plants (such as Sweetwood) and new uses for others. (I believe she mentioned avocado leaf for pain, but I can't be sure.) Kathleen tastes a Noni fruit, and after sputtering a bit declares that it tastes just like it smells. (Specifically, horrible.)</p>

<p>We help Mr. Forbes run a few errands and arrange to meet him tomorrow. I hope I can get another tamarind pod!</p>

<p>More snorkeling after dinner, this time to the <em>east</em> of the sewage pipe. (We are informed that the currents carry the water west, where we were snorkeling the other day.) There is a sting-ray! We keep a respectful distance as it futzes around in the sand.</p>]]></content:encoded>
			<wfw:commentRss>http://www.brainonfire.net/blog/bahamas-trip-day-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
