<?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>Notes (beta)</title>
	<atom:link href="http://notes.ericjiang.com/feed" rel="self" type="application/rss+xml" />
	<link>http://notes.ericjiang.com</link>
	<description>Eric Jiang</description>
	<lastBuildDate>Sun, 29 Apr 2012 20:03:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Fixing Minecraft on Ubuntu with OpenJDK</title>
		<link>http://notes.ericjiang.com/posts/583</link>
		<comments>http://notes.ericjiang.com/posts/583#comments</comments>
		<pubDate>Mon, 16 Apr 2012 17:58:44 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=583</guid>
		<description><![CDATA[Minecraft! On Ubuntu! It actually runs great, once you actually get it to run, but there were two little things mere mortals can&#8217;t be reasonably expected to debug. Can&#8217;t connect to minecraft.net My Internet connection worked, minecraft.net was up, friends were able to connect just fine, but I couldn&#8217;t. Running it from the terminal via [...]]]></description>
			<content:encoded><![CDATA[<p>Minecraft! On Ubuntu!  It actually runs great, once you actually get it to run, but there were two little things mere mortals can&#8217;t be reasonably expected to debug.</p>
<h3>Can&#8217;t connect to minecraft.net</h3>
<p>My Internet connection worked, minecraft.net was up, friends were able to connect just fine, but I couldn&#8217;t. Running it from the terminal via <code>java -jar minecraft.jar</code> showed the error message <code>java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty</code>.</p>
<p>Basically, Minecraft uses SSL to protect your login, but Java didn&#8217;t have the certificates needed to verify. The Minecraft launcher really should give a better error message, but this was really Ubuntu&#8217;s fault. You need the ca-certificates-java package installed, but on my Ubuntu install, it was broken. Try doing <code>ls /etc/ssl/certs/java/cacerts</code>. If it comes up missing, then you need copy it from a friend or a different Unix machine. You don&#8217;t want to copy security files from strangers…</p>
<h3>Black screen</h3>
<p>Looking in the terminal showed the error <code>java.lang.UnsatisfiedLinkError: ...: libjawt.so: cannot open shared object file: No such file or directory</code>. There&#8217;s no good reason why an OpenJDK install can&#8217;t find its own damn libraries, but you can manually set your LD_LIBRARY_PATH variable to contain it.</p>
<p>Try doing <code>locate libjawt.so</code>. You&#8217;ll want to set your LD_LIBRARY_PATH to include one of the directories it gives you (just the directory, not included the file). Depending on whether you have OpenJDK 6 or 7, you&#8217;ll do something like:</p>
<p><code>LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/ java -jar minecraft.jar</code></p>
<p>Again, check the results of locate versus your OpenJDK version (if you&#8217;re not sure, run <code>java -version</code>).</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/583/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the Sparkfun EL Escudo to work</title>
		<link>http://notes.ericjiang.com/posts/570</link>
		<comments>http://notes.ericjiang.com/posts/570#comments</comments>
		<pubDate>Sun, 15 Apr 2012 04:54:33 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Embedded Development]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=570</guid>
		<description><![CDATA[I&#8217;m really disappointed in Sparkfun. I recently purchased the EL Escudo shield for driving EL wire with a microcontroller, and woe be upon anybody who doesn&#8217;t do hours and hours of Internet research before plugging the thing in. There were 3 years of questions from poor customers with only a few answers, and the few [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m really disappointed in Sparkfun. I recently purchased the EL Escudo shield for driving EL wire with a microcontroller, and woe be upon anybody who doesn&#8217;t do hours and hours of Internet research before plugging the thing in. There were 3 years of questions from poor customers with only a few answers, and the few answers that were there were often contradictory. Here are my conclusions from my Internet research, and the amazing Will Byrd helped me finally get it to work. Long story short, Sparkfun sets you up to fail and hasn&#8217;t fixed things in 3 years.</p>
<p><a href="http://notes.ericjiang.com/wp-content/uploads/2012/04/elescudo_inverter_sm.jpg"><img src="http://notes.ericjiang.com/wp-content/uploads/2012/04/elescudo_inverter_sm.jpg" alt="" title="3V inverter connected to an EL Escudo on an Arduino Mega" width="540" height="304" class="alignleft size-full wp-image-579" /></a><br />
<span id="more-570"></span></p>
<h2>Buy everything you need</h2>
<p>You&#8217;ll want stackable headers for Arduino: two 8-pin headers and one 6-pin header. You also need an inverter to provide high-voltage AC current. I ordered the 3v inverter that Sparkfun sells (COM-10201).<br />
<a href="http://notes.ericjiang.com/wp-content/uploads/2012/04/inverter.jpg"><img src="http://notes.ericjiang.com/wp-content/uploads/2012/04/inverter.jpg" alt="" title="3V inverter" width="540" height="261" class="alignleft size-full wp-image-575" /></a></p>
<h2>Don&#8217;t fry your inverter</h2>
<p>Vin on the EL Escudo feeds straight into your inverter. If you got a 3v Inverter, and power it from your Arduino&#8217;s 9v barrel jack, you&#8217;ll fry your inverter. Do what I did, and clip the Vin pin and instead wire a jumper between +3.3V and Vin.</p>
<p><a href="http://notes.ericjiang.com/wp-content/uploads/2012/04/elescudo_pins_sm1.jpg"><img src="http://notes.ericjiang.com/wp-content/uploads/2012/04/elescudo_pins_sm1.jpg" alt="" title="The Vin pin clipped from the EL Escudo" width="540" height="173" class="alignleft size-full wp-image-577" /></a></p>
<h2>Fix the provided code</h2>
<p>If you&#8217;re using Arduino, the provided code is not only too old for Arduino 1.0 to open, but it&#8217;s wrong. The original author uses <code>digitalWrite(channel, LOW)</code> to turn on a wire, which not only doesn&#8217;t make sense, but doesn&#8217;t work (at least for me). I think HIGH and LOW might depend on how you&#8217;ve grounded your inverter output.</p>
<p>Luckily for us, somebody has embraced the Github way and updated the code for Arduino 1.0: <a href="https://github.com/pkrakow/EL-Escudo">https://github.com/pkrakow/EL-Escudo</a>. Using that code, the provided blink program works, although I am still having trouble getting <code>all_on()</code> and <code>all_off()</code> to work.</p>
<h2>Ground your inverter&#8217;s output if needed</h2>
<p>If you&#8217;re using an inverter that has its own power, you might need to wire a lead from HVGND (the right Inverter Output pin) to GND. This is hearsay from the EL Escudo page, but you can simply check with a multimeter whether you need to do this or not.</p>
<p><a href="http://notes.ericjiang.com/wp-content/uploads/2012/04/elescudo_3v_sm.jpg"><img src="http://notes.ericjiang.com/wp-content/uploads/2012/04/elescudo_3v_sm.jpg" alt="" title="EL Escudo with manually grounded inverter" width="540" height="367" class="alignleft size-full wp-image-578" /></a></p>
<h2>Check that your inverter&#8217;s output pins are correct.</h2>
<p>The two black wires in mine were swapped. Plugging in a strand of EL wire directly into my inverter would work, but I was getting something like 5V or 15V on EL wire jacks A through H instead of the 180V I should have been getting. Somebody else figured this out for the EL sequencer, but it wasn&#8217;t anywhere on the EL Escudo page.</p>
<p>Pull out the two black wires from the jack of your inverter and swap them if you&#8217;re getting the symptoms above.</p>
<p>Hopefully this helps somebody out there. If you still can&#8217;t get it to work, my advice would be to get a degree in Electrical Engineering.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/570/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu works great with the MSP430 Launchpad</title>
		<link>http://notes.ericjiang.com/posts/562</link>
		<comments>http://notes.ericjiang.com/posts/562#comments</comments>
		<pubDate>Tue, 10 Apr 2012 15:59:54 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Embedded Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=562</guid>
		<description><![CDATA[I got my MSP430 TI Launchpad more than a year ago simply because of the price. It was (and still is) $4.30 (with free shipping!) for a development board, two MSP430 microcontrollers, external crystal, and USB cable. Unfortunately, Windows was the only supported OS at launch time with a couple proprietary bundled IDEs. It still [...]]]></description>
			<content:encoded><![CDATA[<p>I got my <a href="https://estore.ti.com/MSP-EXP430G2-MSP430-LaunchPad-Value-Line-Development-kit-P2031.aspx">MSP430 TI Launchpad</a> more than a year ago simply because of the price. It was (and still is) $4.30 (with free shipping!) for a development board, two MSP430 microcontrollers, external crystal, and USB cable. Unfortunately, Windows was the only supported OS at launch time with a couple proprietary bundled IDEs. It still is the only officially supported OS, but setting up Ubuntu 11.10 and newer for the msp430 has become trivial:</p>
<p><code>sudo apt-get install gcc-msp430 gdb-msp430 mspdebug</code></p>
<p>To test your Launchpad, try compiling &#8220;blink&#8221; from <a href="https://github.com/mrothe/ti-launchpad">https://github.com/mrothe/ti-launchpad</a>.</p>
<p>The build process goes something like:</p>
<p><code>msp430-gcc -Os -mmcu=msp430x2012 -o main.elf main.c<br />
msp430-objcopy -O ihex main.elf main.hex # generate hex file<br />
mspdebug rf2500 "prog main.hex" # download to the launchpad</code></p>
<p>Do mind your O, o, and 0.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/562/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why are you bankrupting yourself for college?</title>
		<link>http://notes.ericjiang.com/posts/537</link>
		<comments>http://notes.ericjiang.com/posts/537#comments</comments>
		<pubDate>Thu, 15 Mar 2012 02:51:48 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Education]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=537</guid>
		<description><![CDATA[What do universities want? The same as what everybody else wants, really. Power. Fame. Money. Well, the money&#8217;s actually a means to the first two, because you obviously don&#8217;t become powerful and famous (sorry, &#8220;prestigious&#8221;) without money. How do universities rise up? They hire and sponsor press-worthy research and researchers, and save up money to [...]]]></description>
			<content:encoded><![CDATA[<p>What do universities want? The same as what everybody else wants, really. Power. Fame. Money. Well, the money&#8217;s actually a means to the first two, because you obviously don&#8217;t become powerful and famous (sorry, &#8220;prestigious&#8221;) without money.</p>
<p>How do universities rise up? They hire and sponsor press-worthy research and researchers, and save up money to build shiny new buildings every so often. That takes a lot of cash, so they have to keep the dough rolling in.</p>
<p>Universities generally rely on four or five sources of funding:<span id="more-537"></span></p>
<ul>
<li>endowment investments—if the stock market and economy do poorly, this drops</li>
<li>public funding—this is subject to politics (haha, we&#8217;re screwed) and the state budget, and applies to public universities</li>
<li>private giving—students are paid to call alumni and beg for money. In a bad year, this could drop as well.</li>
<li>research grants—research funding is hugely taxpayer sponsored, but private corporations also invest in university research.</li>
<li>tuition—sorry undergrads</li>
</ul>
<p>Guess which one of those the school has the most control over?<br />
So schools crank up tuition to <a href="http://www.finaid.org/calculators/tuitionanalysis.pdf">make up for shortages</a> in their other income sources.</p>
<p>Public schools can&#8217;t always extort their in-state students (University of California aside) so they&#8217;ve looked overseas. There are plenty of wealthy families in China, Korea, India, and elsewhere that don&#8217;t mind paying some cash for their kid to get an American diploma. Besides, the schools in their native country are often awful or hard to get into. Have you been seeing a lot more international students around campus?</p>
<p>&#8220;But wait,&#8221; you say, &#8220;I learned in econ that the free market keeps prices under control!&#8221;</p>
<p>Haha, except the undergrad diploma market is so ****ed up that it&#8217;s not much of a free market anymore. With every employer expecting a 4-year college degree and the college-education Kool-aid we&#8217;ve all drunk, universities have realized that they can just keep raising prices. Parents don&#8217;t want to tell their only-average kids that they can&#8217;t go to NYU because it&#8217;s very (very) expensive, even though they were ecstatic about getting in. Kids don&#8217;t have a clue about money anyways (nor about college, for that matter). And the best part is, the government has made sure you can borrow as much money as you need to attend. It&#8217;s almost as if the banks make <em>more</em> money if you take out <em>more</em> loans.</p>
<p>It&#8217;s criminal. The supply of Cool Universities is constrained and demand for Cool Universities is higher than ever, while the money issue is &#8220;solved&#8221; by student loans. &#8220;Johnny is going to <em>Cool University</em>&#8220;, the parent says before Johnny will be forever haunted by debt collectors about a debt he didn&#8217;t understand when he signed up and that he can&#8217;t pay back because his Literature and French double-major isn&#8217;t helping him a whole lot in the job hunt. The only other ways out of student debt are death and debilitating injury. (Actually, marrying rich doesn&#8217;t sound like a bad idea either.)</p>
<p>And let&#8217;s get that bullshit that expensive schools feed you out of the way.</p>
<p>When you took a tour of Cool University, what did they show you? Student traditions, the interesting architecture of the new CyberBioTech School, and the fancy new computer labs/lounges/beanbag chairs&#8230; why were we going to college again?</p>
<p>Oh, right. You&#8217;re going for the world-class faculty and education. Let me tell you something. Schools like to keep around celebrity professors for that &#8220;fame&#8221; thing we discussed earlier. Half of those Nobel laureates probably have already retired after a long career of teaching undergrads. Oh wait, I mixed up the Nobel Prize with the Not-A-Prize for teaching excellence. The Nobel Prize is for research, and at any school that has &#8220;research&#8221; somewhere on its Wikipedia page, research is the main priority. Or rather, it&#8217;s a means to fame, like when your Facebook friends all reshare some HuffPo blarticle about the new Nano AI Laser Quadcopter Cancer Cure from the research labs of Cool University.</p>
<p>So you&#8217;ll probably never have a class with that Nobel laureate. They&#8217;ll probably never even acknowledge your existence, much less discuss the effects of colonialism in Africa with you. And even if you do get a class with Professor Cool, you&#8217;ll probably find out that fame is not at all correlated with the ability to teach. Prof Cool has grad students to manage and grants to write, and that doesn&#8217;t leave a lot of time for preparing lesson plans or practicing public speaking for the N classes he or she is teaching that semester (N ≤ 1). Just let the grad student teach, nevermind the poor English.</p>
<p>Is there a difference between the rigor and depth of curricula between different schools? Absolutely. Is one school&#8217;s EE program $200,000 better or even $70,000 better than another&#8217;s? That&#8217;s much harder to decide. (Oooh, I know! Do <em>both</em> programs and let us know!) But if you were worried about finding a job with an Uncool degree, consider the idea that what you do outside of the classroom matters a lot more than what you do inside the classroom. Ironic, isn&#8217;t it, that the greatest parts of college usually aren&#8217;t the classes you take.</p>
<p>Lead a philanthropic organization! Do research! Start a company!</p>
<p>Wait a sec, aren&#8217;t the people who did those things in high school the ones that got into Harvard, Yale, Princeton, Stanford, and MIT? Could ambition and motivation be the actual keys to success? Could it be that the admissions officers were only looking for duckies who were already going to be successful? Could colleges rank highly simply because top students go there because the college ranks highly? Could I get a Conspiracy Keanu up in here?</p>
<p>College is 70% what you put into it, and I&#8217;m not talking about money. A big school, no matter where it is, will have more than enough to keep you entertained for four years, after which, you&#8217;ll be sick of your school anyways and will want to get a job or go to grad school somewhere else.</p>
<p>Some people have colored this as a public/private issue, but it&#8217;s really about making sane decisions with your money. Public schools usually are cheaper, but if you get a good deal to Harvard/Yale/Princeton/Stanford, then why not? Ultimately, it&#8217;s <em>your</em> desires and <em>your</em> finances, but the idea that high schoolers with barely a clue about the real world or even about college are making a hundred-thousand dollar decision is frightening.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/537/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dreamhost is so 2004</title>
		<link>http://notes.ericjiang.com/posts/521</link>
		<comments>http://notes.ericjiang.com/posts/521#comments</comments>
		<pubDate>Tue, 13 Mar 2012 21:15:48 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Internets]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=521</guid>
		<description><![CDATA[Today marks my final move from uncool, mainstream shared hosting to the fantastic world of pay-what-you-need technology mash-ups. Shared hosting&#8230; I used to have shared hosting at Site5. They were OK. I really can&#8217;t complain much except that their dashboard functionality for hosting multiple domains on one account seemed archaic. I signed up almost exactly [...]]]></description>
			<content:encoded><![CDATA[<p>Today marks my final move from uncool, mainstream shared hosting to the fantastic world of pay-what-you-need technology mash-ups.</p>
<h2>Shared hosting&#8230;</h2>
<p>I used to have shared hosting at Site5. They were OK. I really can&#8217;t complain much except that their dashboard functionality for hosting multiple domains on one account seemed archaic. I signed up almost exactly 5 years ago on their <q><a href="http://web.archive.org/web/20070314020255/http://www.site5.com/">The Five Dollar Web Hosting Deal</a></q>, which offered seemingly huge allocations of 55GB of disk space and 5TB of bandwidth. The plan has long been discontinued and Site5 followed the rest of the industry towards &#8220;unlimited&#8221; shared hosting, but I never &#8220;upgraded&#8221; because I never hit those limits and the newer $5 plans couldn&#8217;t host multiple sites. Site5&#8242;s interface got slicker and their servers got stabler, but I eventually wanted to go beyond ordinary shared hosting.</p>
<p>Shared hosting has been such a smoke-and-mirrors industry designed to lure in inexperienced webbies with promises of &#8220;Unlimited!&#8221; and &#8220;One-click blogs!&#8221;. Sure, for many people, it&#8217;s perfectly fine for putting up some information about the local Habitat for Humanity or chess club, but even then, wouldn&#8217;t a free Tumblr or Google Sites account be just fine? Regardless, I decided to get more hands-on with my new setup.</p>
<p><span id="more-521"></span></p>
<h2>Perhaps a VPS</h2>
<p>I bought a VPS from ThrustVPS. That&#8217;s not the end of the story, because while I still have that VPS, it&#8217;s gone mostly unused. It hosts one domain that was never launched, and that&#8217;s about it. I got the VPS to play around with Ubuntu Server and try out some different ways of using nginx in a constrained-memory environment, and those experiments never turned into deployments. ThrustVPS was so-so. I don&#8217;t think I ran into any real performance issues, but many times they didn&#8217;t even meet 99% uptime even though many shared hosts promises three-nines uptime. I wouldn&#8217;t have known either, if it weren&#8217;t for <a title="Pingdom website monitoring" href="http://pingdom.com">Pingdom</a>, but that&#8217;s what I get for $5/month, I suppose.</p>
<p>On an unrelated note, I found out that AlienVPS offers a <a href="http://alienvps.com/vps-hosting/">$20/year VPS</a>. With the right setup, that thing could serve thousands of hits per hour. I&#8217;ve yet to try them, but I probably will once my ThrustVPS plan expires. Also, you can run an Amazon EC2 micro instance free for a year with a new AWS account, and one of those is much more powerful than the smallest AlienVPS instance.</p>
<h2>Cooler shared hosting</h2>
<p>While I&#8217;ll probably keep around a VPS for new deployments (<a href="http://wingolog.org/archives/2012/03/08/an-in-depth-look-at-the-performance-of-guiles-web-server">Scheme</a>/<a href="http://docs.racket-lang.org/web-server/index.html">Racket</a>/<a href="http://www.haskell.org/haskellwiki/Practical_web_programming_in_Haskell">Haskell</a> web apps anyone?), I didn&#8217;t actually want the hassle of setting up PHP for my legacy sites. After all, PHP is the devil, and the fewer deals that I had to make with the devil, the better. But how to keep my Internet hipster cred?</p>
<p><a href="https://www.nearlyfreespeech.net/">NearlyFreeSpeech.NET</a> offers minimalist shared hosting at pay-as-you-go rates. Unlike normal shared-hosting companies that profit on you not using what you &#8220;get&#8221;, at NFSN you only pay for your actual usage. That means that if you have a small, static site that gets low traffic, your bill will be measured in cents per month. If you have a 10 MB website, that&#8217;s $0.10/month plus bandwidth (as of writing). Domain registration, DNS, email forwarding, and databases are all priced separately as add-ons.</p>
<p>So that was all well and good. I ended up putting a static site and two PHP sites on there, and converted a third PHP site to a static site. They&#8217;ve been stable, with a no-nonsense interface and sensible settings, so I&#8217;ve been pretty happy.</p>
<h2>Static files</h2>
<p>As cool as NFSN is, $0.01/MB-month is not trivial when you&#8217;re hosting large files. I had accumulated a stash of videos, images, 3d models, and other miscellaneous data on a &#8220;files&#8221; subdomain that various websites have linked to for no good reason. I didn&#8217;t want to break all links that went there, so I decided to give those files the same pay-as-you-go treatment. I chose Amazon&#8217;s S3 as a data store, and the only hard part was transferring all of my files there. Since S3 bills for all actions, including transfers, I spun up a free EC2 micro instance to rsync files to Amazon and then send them to my S3 bucket (EC2 to S3 transfers are free). S3 buckets aren&#8217;t regular filesystems, but it&#8217;s one click to set up any bucket to serve files via HTTP. With proper redirects, you could serve your entire static website from S3 and cut your hosting costs to virtually nothing, but latency might be an issue.</p>
<p>At $0.125/GB-month, I estimate my storage costs to be less than two quarters each month. Better yet, <a href="http://aws.amazon.com/free/">AWS offers generous free usage</a> for your first year, so I&#8217;m paying nothing right now.</p>
<h2>DNS</h2>
<p>Some of my domains have DNS hosted with <a href="http://goo.gl/C9vwi">1&amp;1</a>, but in most cases I wanted more control over DNS settings. ThrustVPS&#8217;s &#8220;DinkyDNS&#8221; is just a CPanel account on some server, so it&#8217;s pretty awful, and for a while I used <a href="http://xname.org/">xname.org</a>, a free DNS host. While the interface looked archaic, it worked, but it was annoying to keep all of my DNS settings on some other website that&#8217;s powered by generosity, and I did encounter a few hiccups along the way. I eventually ditched xname for&#8230;</p>
<h2>CloudFlare</h2>
<p>I&#8217;m somewhat shocked that <a href="http://cloudflare.com">CloudFlare</a> is free, because it&#8217;s amazing. Maybe they&#8217;re in the early-revenue stage and will collapse or jack up the prices someday. Either way, CloudFlare measurably saves me time and money.</p>
<p>CloudFlare acts as a caching layer between your website and your visitors—on one of my websites, it cut down my ping from home to 15 ms from 45 ms. CloudFlare also protects against malicious hits (although I&#8217;ve never really had problems from this) and downtime from DoS and servers errors. Of course, to do all this, it needs to handle the DNS, again, for free. So now I get free DNS service, free caching on their CDN, and free protection, but more importantly, it cuts down the actual number of hits to the servers by more than half, in some cases.</p>
<p>Pay-as-you-go has the risk of unpredicted surges in usage. If a million people hit my site, then the bandwidth costs at NFSN will drain all $7 in my account and get my websites disabled and Amazon AWS will charge me a hefty sum. (Of course, a traffic spike on your shared host would probably get you suspended too.) But with CloudFlare, I&#8217;m paying for half as much bandwidth as I normally would, which cuts costs even further.</p>
<h2>Cost breakdown</h2>
<p>Web hosting at NearlyFreeSpeech.NET: $2.40 / month<br />
Static file hosting at Amazon: $0.40 / month (currently free)<br />
CloudFlare: $0.00 / month<br />
Domains: $3.33 / month</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/521/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cd &amp;&amp; ls</title>
		<link>http://notes.ericjiang.com/posts/515</link>
		<comments>http://notes.ericjiang.com/posts/515#comments</comments>
		<pubDate>Thu, 08 Mar 2012 19:16:31 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=515</guid>
		<description><![CDATA[I&#8217;ve noticed that I have a habit of changing to a directory and then immediately listing it&#8217;s contents. Wouldn&#8217;t it be nice if I could do it in one command? My goto for shell automation is usually shell scripting. Shell scripting is nice because I can use any language I want, and I don&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve noticed that I have a habit of changing to a directory and then immediately listing it&#8217;s contents. Wouldn&#8217;t it be nice if I could do it in one command?</p>
<p>My goto for shell automation is usually shell scripting. Shell scripting is nice because I can use any language I want, and I don&#8217;t have to worry about losing everything if I switch shells or something.  Shell scripting isn&#8217;t suitable for this, however, because writing cd in a shell script will just change the script&#8217;s working directory.</p>
<p>I notice that a lot of people like to use aliases for various little things like command abbreviations, but aliases can&#8217;t interpolate arguments. Without control over arguments, I can&#8217;t give cd the argument and then ls after that.</p>
<p>The final solution I wrote is a bash function in my .bashrc, and while it&#8217;s bash-specific, I doubt I&#8217;ll ever need to port it to another shell (and it shouldn&#8217;t be difficult to do either). </p>
<p><code>cl () { cd \$1 &#038;& ls; }</code></p>
<p>Now I just need to train my fingers to type &#8220;cl&#8221; instead. </p>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/515/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Chez Scheme debugger</title>
		<link>http://notes.ericjiang.com/posts/363</link>
		<comments>http://notes.ericjiang.com/posts/363#comments</comments>
		<pubDate>Sun, 29 Jan 2012 19:09:13 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=363</guid>
		<description><![CDATA[Achtung! Chez Scheme and Petite Chez Scheme do not give the same debugging information. Petite Chez Scheme is often much less helpful than Chez Scheme, and is probably half the reason why nobody actually tries debugging programs in Chez Scheme. I don&#8217;t have a good explanation for why, but that&#8217;s the awful reality. Here&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Achtung!</strong> Chez Scheme and Petite Chez Scheme do <strong>not</strong> give the same debugging information. Petite Chez Scheme is often much less helpful than Chez Scheme, and is probably half the reason why nobody actually tries debugging programs in Chez Scheme. I don&#8217;t have a good explanation for why, but that&#8217;s the awful reality.</p>
<p>Here&#8217;s a sample, buggy program:</p>
<pre class="brush: scheme; title: ; notranslate">(define myreverse
  (lambda (ls)
    (if (null? ls)
      '()
      (append (myreverse (cdr ls)) (cons (car ls) '())))))

(define mylist (cons 1 (cons 2  (cons 3 (cons 4 5)))))

(display (myreverse mylist))</pre>
<p>Let&#8217;s try loading it in Chez Scheme.</p>
<pre class="terminal">$ scheme
Chez Scheme Version 8.0
Copyright (c) 1985-2010 Cadence Research Systems

&gt; (load "example.ss")
Exception in car: 5 is not a pair
Type (debug) to enter the debugger.
&gt;
</pre>
<p>Obviously, <code>(debug)</code> invokes the debugger. Once we get in there, however, it&#8217;s fairly cryptic.</p>
<pre class="terminal">debug&gt; ?
Type i  to inspect the raise continuation (if available)
     s  to display the condition
     c  to inspect the condition
     e  or eof to exit the debugger, retaining error continuation
     q  to exit the debugger, discarding error continuation
debug&gt;</pre>
<p>Usually, <strong>i</strong>nspecting the continuation is the most helpful thing to do, because once we&#8217;re in there, we can get a stack trace to find out <em>where</em> the error occurred. The command to print out the stack frames is <strong>sf</strong>.</p>
<pre class="terminal">debug&gt; i
#&lt;continuation in myreverse&gt;                                      : sf
  0: #&lt;continuation in myreverse&gt;
  1: #&lt;continuation in myreverse&gt;
  2: #&lt;continuation in myreverse&gt;
  3: #&lt;continuation in myreverse&gt;
  4: #&lt;continuation in myreverse&gt;
  5: #&lt;system continuation in map&gt;
  6: #&lt;system continuation in compile&gt;
  7: #&lt;system continuation&gt;
  8: #&lt;system continuation&gt;
  9: #&lt;system continuation in dynamic-wind&gt;
  10: #&lt;system continuation in dynamic-wind&gt;
  11: #&lt;system continuation in $reset-protect&gt;
  12: #&lt;system continuation in new-cafe&gt;
#&lt;continuation in myreverse&gt;                                      : </pre>
<p>Knowing the stack trace, we can move down the stack frames using <strong>d</strong>own, which is important if the debugger drops you in an error handler under the actual source of the problem. This information is often enough to debug your program. From here, we know that the error occurred when we were five instances deep in <code>myreverse</code>, so the problem was with the end of the list. But if you wanted more specifics, you can type <strong>s</strong> for <strong>s</strong>how:</p>
<pre class="terminal">#&lt;continuation in myreverse&gt;                                      : s
  continuation:          #&lt;continuation in myreverse&gt;
  procedure code:        (lambda (ls) (if (null? ls) (quote ()) ...))
  call code:             (cdr ls)
  free variables:
  0. ls:                 5</pre>
<p>Now we know for certain that we <em>attempted</em> <code>(cdr ls)</code> but <code>ls</code> was actually 5, and <code>(cdr 5)</code> is wrong.</p>
<p>Let&#8217;s try example2.ss:</p>
<pre class="brush: scheme; title: ; notranslate">(define pass-me-a-closure
  (lambda (thunk)
    (break)
    (thunk)))

(pass-me-a-closure
  (lambda ()
    (let loop ((x 5)
               (a 1))
      (if (zero? x)
        a
        (loop (sub1 x) (* a x))))))</pre>
<p>Notice that we&#8217;ve set a breakpoint in the code using <code>(break)</code>. This triggers the debugger, but only if we&#8217;re running Scheme interactively. If you try running <code>scheme example2.ss</code> directly, it will exit when it hits the breakpoint.</p>
<p>At the break point, we do the usual <strong>i</strong>nspect and <strong>sf</strong>ow frames.</p>
<pre class="terminal">[erjiang@silo ~]$ scheme
Chez Scheme Version 8.4
Copyright (c) 1985-2011 Cadence Research Systems

&gt; (load "example2.ss")
break&gt; i
#&lt;continuation in pass-me-a-closure&gt;                              : sf
  0: #&lt;continuation in pass-me-a-closure&gt;
  1: #&lt;system continuation&gt;
  2: #&lt;system continuation&gt;
  3: #&lt;system continuation in dynamic-wind&gt;
  4: #&lt;system continuation in dynamic-wind&gt;
  5: #&lt;system continuation in $reset-protect&gt;
  6: #&lt;system continuation in new-cafe&gt;
#&lt;continuation in pass-me-a-closure&gt;                              : s
  continuation:          #&lt;system continuation&gt;
  procedure code:        (lambda (thunk) (break) (display (thunk)))
  call code:             (break)
  free variables:
  0. thunk:              #&lt;procedure&gt;
#&lt;continuation in pass-me-a-closure&gt;                              :
</pre>
<p>Right now, it doesn&#8217;t actually tell us what <code>thunk</code> is besides just <span style="white-space:nowrap;">#&lt;procedure&gt;</span>. We need to <strong>r</strong>nspect that particular free variable by its number or name by issuing <code>r 0</code> or <code>r thunk</code> and then printing the <strong>c</strong>ode.</p>
<pre class="terminal">#&lt;continuation in pass-me-a-closure&gt;                              : r 0
#&lt;procedure&gt;                                                      : c
(lambda () ((letrec ((loop (lambda (...) (...)))) loop) 5 1))     :</pre>
<p>Notice that the let-loop form has been expanded (remember, the macro expander has already run) and on top of that, the part we actually care about has been elided. Also, the current object is now the code, instead of <span style="white-space:nowrap;">#&lt;procedure&gt;</span>. Because of that, we can <strong>p</strong>retty-print the current object, and it will pretty-print the entire object.</p>
<pre class="terminal">(lambda () ((letrec ((loop (lambda (...) (...)))) loop) 5 1))     : p

(lambda ()
  ((letrec ([loop (lambda (x a)
                    (if (zero? x) a (loop (sub1 x) (* a x))))])
     loop)
    5
    1))</pre>
<p>You can always go back <strong>up</strong> to the parent object from here.</p>
<p>In Chez Scheme, <strong>inspect</strong> is also available as a procedure that will launch the debugger and inspect whatever is passed to it. For example, writing <code>(inspect thunk)</code> into the above code would immediately launch the debugger on <code>thunk</code>. Likewise, doing <code>(call/cc inspect)</code> will launch the debugger and inspect the current continuation (which you can then trace).</p>
<p>Now you should know how to enter the debugger, inspect the stack frames, and inspect variables inside the stack frames, including the procedure code and call code. When in doubt, randomly hit keys or ask for help<strong>?</strong> Expect a pop quiz over this.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/363/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arrow Endianness: How GNOME got sorting backwards</title>
		<link>http://notes.ericjiang.com/posts/456</link>
		<comments>http://notes.ericjiang.com/posts/456#comments</comments>
		<pubDate>Sat, 21 Jan 2012 22:38:40 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=456</guid>
		<description><![CDATA[Conventions are important, even when it seems like it doesn&#8217;t matter one way or the other. Just look at all the people who complain about the nerve of Steve Jobs to place the close-window button on the left. There&#8217;s no reason why the left side is better than the right side. Convention, however, says that [...]]]></description>
			<content:encoded><![CDATA[<p>Conventions are important, even when it seems like it doesn&#8217;t matter one way or the other. Just look at all the people who complain about <em>the nerve</em> of Steve Jobs to place the <a href="http://en.wikipedia.org/wiki/File:Windows_3.11_workspace.png">close-window button on the <em>left</em></a>.</p>
<p>There&#8217;s no reason why the left side is better than the right side. Convention, however, says that you must choose one way and live with it, or else you&#8217;ll be forever forced to constantly convert between left-handed and right-handed traditions. Just ask anyone who&#8217;s ever had to write low-level networking code. When sending an integer, it doesn&#8217;t matter whether the big end or little end goes first, but if you don&#8217;t agree with the other party, your message will come out garbled.</p>
<p>So imagine my discomfort when I have to sort files in Nautilus or sort processes in System Monitor.</p>
<p><span id="more-456"></span></p>
<p><a href="http://notes.ericjiang.com/wp-content/uploads/2012/01/nautilus.png"><img src="http://notes.ericjiang.com/wp-content/uploads/2012/01/nautilus.png" alt="" title="GNOME" width="338" height="230" class="aligncenter size-full wp-image-457" /></a></p>
<p>For comparison:</p>
<p><a href="http://notes.ericjiang.com/wp-content/uploads/2012/01/explorer_sort1.png"><img src="http://notes.ericjiang.com/wp-content/uploads/2012/01/explorer_sort1.png" alt="" title="Windows Explorer" width="283" height="243" class="aligncenter size-full wp-image-470" /></a><br />
<a href="http://notes.ericjiang.com/wp-content/uploads/2012/01/explorer_sort2.png"><img src="http://notes.ericjiang.com/wp-content/uploads/2012/01/explorer_sort2.png" alt="" title="Windows Explorer" width="291" height="254" class="aligncenter size-full wp-image-471" /></a></p>
<p>and Wikipedia:</p>
<p><a href="http://notes.ericjiang.com/wp-content/uploads/2012/01/wikipedia_sort.png"><img src="http://notes.ericjiang.com/wp-content/uploads/2012/01/wikipedia_sort.png" alt="" title="Wikipedia" width="305" height="172" class="aligncenter size-full wp-image-467" /></a></p>
<p>Why don&#8217;t I just look at the files to see if they&#8217;re the way I want them? Because the whole point of having that little arrow there is to quickly indicate to me which way things are sorted. I&#8217;d rather have no indicator than a confusing indicator, and besides, if you had to look at your window&#8217;s title bar every time you wanted to close a window, you would be frustrated too.</p>
<p>If you had files sorted by name is ascending order, you would get the first one first.</p>
<p>Alpha.txt<br />
Beta.txt<br />
Gamma.txt</p>
<p>Everybody else uses △ up arrow, but GNOME represents this sort with a ▽ down arrow. If you&#8217;ve ever written SQL, you&#8217;ll know that this alphabetical sort is what you&#8217;d get if you said <q>ORDER BY filename ASC</q>. Ascending is △ upwards. Like an elevator.</p>
<p>There are more ways to look at it. If you&#8217;re sorting numbers in ascending order, you would get</p>
<p>1<br />
2<br />
3<br />
⋮</p>
<p>The <strong>biggest</strong> number is at the bottom. With the △ up arrow, the <strong>biggest</strong> end is at the bottom. This is like when you learned about the numerical comparison operators in preschool: 1 < 3, 9 > 7, or 5 ▷ 3 and 2 ◁ 4.</p>
<p>Score 0 for GNOME, score 2 for everybody else?</p>
<p>Some GNOME defenders point out that using a ▽ down arrow for ascending sort can make sense if you interpret it as an arrow pointing in the direction in which things are ascending. (e.g. in &#8220;1, 2, 3, 4,&#8221; the numbers are &#8220;going&#8221; ▷ right). The <a href="http://developer.gnome.org/hig-book/stable/controls-lists.html.en#controls-lists-sortable">GNOME Human Interface Guidelines</a>, however, don&#8217;t even justify their decision. They simply say that the &#8220;Natural&#8221; order is ▽ down arrow and the &#8220;Reverse&#8221; order is △ up arrow. There&#8217;s nothing supporting the connection between &#8220;Natural&#8221; and ▽ down arrow.</p>
<p><strong>We&#8217;re not doomed forever though.</strong> This was raised as an <a href="https://bugzilla.gnome.org/show_bug.cgi?id=305277">issue in the GNOME bug tracker</a>, and people generally support changing the guidelines to follow the general convention. Just give them another year or two or six and they&#8217;ll bring GNOME in-line with our expectations for how sorting should be indicated.</p>
<p><strong>The real lesson</strong> here is that, when the choice between two things is essentially arbitrary, do some research and consider how everybody else does it. <a href="http://www.ietf.org/rfc/ien/ien137.txt" title="ON HOLY WARS AND A PLEA FOR PEACE">As Danny Cohen wrote (about network endianess)</a>,</p>
<blockquote><p>It may be interesting to notice that  the  point  which  Jonathan  Swift<br />
tried  to  convey  in  Gulliver&#8217;s Travels in exactly the opposite of the<br />
point of this note.</p>
<p>Swift&#8217;s point is that the difference between breaking  the  egg  at  the<br />
little-end  and  breaking  it  at the big-end is trivial.  Therefore, he<br />
suggests, that everyone does it in his own preferred way.</p>
<p>We agree that the difference between sending eggs with  the  little-  or<br />
the  big-end first is trivial, but we insist that everyone must do it in<br />
the same way, to avoid anarchy.  Since the difference is trivial we  may<br />
choose either way, but a decision must be made.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/456/feed</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Venturer HPS9308 GPS navigation system</title>
		<link>http://notes.ericjiang.com/posts/445</link>
		<comments>http://notes.ericjiang.com/posts/445#comments</comments>
		<pubDate>Thu, 19 Jan 2012 04:11:32 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Personal notes]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=445</guid>
		<description><![CDATA[If you ever want to modify or upgrade your Venturer HPS9308 GPS navigation system, you can easily do so by modifying or replacing the software on the SD Card. However, there are some settings that aren&#8217;t obvious and aren&#8217;t directly modifiable, so you have to follow a couple things. It seems like the default Venturer [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever want to modify or upgrade your Venturer HPS9308 GPS navigation system, you can easily do so by modifying or replacing the software on the SD Card. However, there are some settings that aren&#8217;t obvious and aren&#8217;t directly modifiable, so you have to follow a couple things.</p>
<p>It seems like the default Venturer shell, when you choose &#8220;Navigation&#8221;, looks for SDCard\MobileNavigator\MobileNavigator.exe and runs it. Thus, if you want to replace the software that gets run, you should place the executable at that path. In addition, the GPS device is on port 1 with a baud rate of 4800, at least according to a working config file I found. For reference, that was in SDCard\MobileNavigator\sys.txt with the section<br />
<code>[gps]<br />
port="1"<br />
baud="4800"</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/445/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gaming hasn&#8217;t changed</title>
		<link>http://notes.ericjiang.com/posts/435</link>
		<comments>http://notes.ericjiang.com/posts/435#comments</comments>
		<pubDate>Thu, 05 Jan 2012 20:16:38 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Gaming]]></category>

		<guid isPermaLink="false">http://notes.ericjiang.com/?p=435</guid>
		<description><![CDATA[This is about an essay I wrote a couple years back about gaming, under the theme of work and play, and it&#8217;s about how video games are just a subset of gaming, and how they conceptually fit within philosophical frameworks established in the mid-20th century. Among other things, it goes into why World of Warcraft [...]]]></description>
			<content:encoded><![CDATA[<p>This is about an essay I wrote a couple years back about gaming, under the theme of <q>work and play,</q> and it&#8217;s about how video games are just a subset of gaming, and how they conceptually fit within philosophical frameworks established in the mid-20th century. Among other things, it goes into why <em>World of Warcraft</em> directly maps onto the four categories of games set forth by Roger Caillois in 1958: <em>Agôn</em>, <em>alea</em>, <em>mimicry</em>, and <em>ilinx</em>, which could be described as competition, chance, role-playing, and thrill.</p>
<p>It&#8217;s not a perfect paper and gamers might roll their eyes at reading a description of what an MMO is. There are surely some things that I would revise if I had the chance, but the version presented here is untouched from my original, save for formatting. It&#8217;s not a journal paper nor is it a book review, but I hope that some find it interesting. There is a lot that has been written on this subject, and there is much more that could be written. This is just a piece towards the theory that the core components of a <q>fun</q> game are readily identifiable and, with that knowledge, anybody can assemble a fun game.</p>
<p>Some quotes from the paper<br />
<a href='http://notes.ericjiang.com/wp-content/uploads/2012/01/mmo.pdf'>Profit Versus Play: Business and Gaming in MMOs</a> (application/pdf, 87 KB):</p>
<p>On whether MMOs qualify as <q>games</q> in a traditional sense:</p>
<blockquote><p>David Golumbia, who is incidentally among such de-<br />
tractors, could not examine this issue without first defin-<br />
ing the French word jeu in the context of Jacques Der-<br />
rida’s deconstruction of “play.” Fundamentally, Golumbia<br />
establishes jeu as both “play” and “games” (and not con-<br />
trivances like “freeplay”) and this paper will assume the<br />
same: that “games” and “play” are merely different parts<br />
of speech referring to the same concept without carry-<br />
ing any intrinsic differences. And, as we’ll see, MMOs<br />
like Ultima Online and EverQuest are certainly games in<br />
the traditional sense as they fit like clockwork into Roger<br />
Caillois’ categorization of games.</p></blockquote>
<p>On the never-perfect divide between game and real:</p>
<blockquote><p>This “contagion of reality” that plagues MMOs has<br />
been and will continue to be money. “The minute you<br />
hardwire constraints into a virtual world, an economy<br />
emerges,” explained Castronova to Wired. “One-trillionth<br />
of a second later, that economy starts interacting with<br />
ours.”</p></blockquote>
<p>And on harnessing Nietzschean behaviors:</p>
<blockquote><p>It’s this type of accumulating points system that<br />
Golumbia described as an exploitation of Machtelgust, or<br />
the “lust for power” from Nietzsche’s writings. Golumbia<br />
colored computer games in general as being deceptively<br />
simplistic and degenerate. A single-player first-person<br />
shooter (FPS) like the classic sci-fi game Half-life, while<br />
appearing to offer freedom and a story to the player, is re-<br />
ally a very rigid, pre-scripted experience of just shooting<br />
anything that moves with a superficial and shallow plot<br />
tacked on. Likewise, he wrote, MMORPGs are mostly<br />
single-player experiences, despite the name, filled with<br />
repetitive quests in a “surprisingly rigid, uncompromis-<br />
ing, and even authoritarian” world.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://notes.ericjiang.com/posts/435/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

