<?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>Grantovich.net &#187; ruby</title>
	<atom:link href="http://grantovich.net/posts/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://grantovich.net</link>
	<description>Updated with astounding infrequency</description>
	<lastBuildDate>Tue, 29 Jun 2010 01:38:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>_why?</title>
		<link>http://grantovich.net/posts/2009/09/_why/</link>
		<comments>http://grantovich.net/posts/2009/09/_why/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 19:08:17 +0000</pubDate>
		<dc:creator>Grantovich</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[chunky bacon]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[unsolved mysteries]]></category>

		<guid isPermaLink="false">http://grantovich.net/?p=502</guid>
		<description><![CDATA[Since my introduction to Ruby by way of talking foxes and chunky bacon, I&#8217;ve been fascinated with the works of the enigmatic &#8220;why the lucky stiff&#8221;, also known as _why. He became famous throughout the Ruby community for his eccentric demeanor and numerous quirky projects, all of which excellently demonstrated the power and beauty of the language in a [...]]]></description>
			<content:encoded><![CDATA[<p>Since my introduction to Ruby by way of talking foxes and chunky bacon, I&#8217;ve been fascinated with the works of the enigmatic <a href="http://en.wikipedia.org/wiki/Why_the_lucky_stiff">&#8220;why the lucky stiff&#8221;</a>, also known as _why. He became famous throughout the Ruby community for his eccentric demeanor and numerous quirky projects, all of which excellently demonstrated the power and beauty of the language in a way few others could duplicate. And despite the fact that he has appeared and spoken in public, very little is known about his true identity.</p>
<p>I recently thought of using Shoes, _why&#8217;s minimalistic GUI toolkit, for a project, and found that the domain wouldn&#8217;t resolve. At the time, I thought it was nothing more than a glitch in the Matrix. Had I searched around, I would have discovered much earlier the surprising truth: On August 19th, &#8220;why the lucky stiff&#8221; <a href="http://www.h-online.com/open/why-the-lucky-stiff-Vanishes--/news/114042">winked out of existence</a>, taking everything he&#8217;d ever created with him. All of his web sites, his projects, his github account&#8230; gone, with no explanation.</p>
<p>Given that the man himself is unavailable for comment, theories abound as to why (or rather, _why) he departed so suddenly, and with so many of his projects left half-finished. Personally, I think it&#8217;s possible that _why planned to do this right from the start, as an exercise in &#8220;lifting up&#8221; the Ruby community and bringing it closer together; <a href="http://whymirror.github.com/">observe how quickly</a> his many projects have been picked up by others, who have started developing them at a remarkable pace. _why&#8217;s departure created a tremendous vacuum of talent, one that dozens of Ruby hackers are now eager to fill. Was this the intended effect? It certainly seems to be a Good Thing&#8230; though I don&#8217;t think the sheer <em>personality</em> that _why gave Ruby will ever be duplicated.</p>
]]></content:encoded>
			<wfw:commentRss>http://grantovich.net/posts/2009/09/_why/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Write-up: Twittjr</title>
		<link>http://grantovich.net/posts/2009/05/project-write-up-twittjr/</link>
		<comments>http://grantovich.net/posts/2009/05/project-write-up-twittjr/#comments</comments>
		<pubDate>Wed, 13 May 2009 01:44:27 +0000</pubDate>
		<dc:creator>Grantovich</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BASIC]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[project write-ups]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twittjr]]></category>

		<guid isPermaLink="false">http://grantovich.net/?page_id=87</guid>
		<description><![CDATA[Twittjr is a system that allows an IBM PCjr to search the public timeline on Twitter. In case you weren&#8217;t aware, Twitter is a social micro-blogging service introduced in 2006 and has over five million active users. The IBM PCjr is a personal computer introduced in 1984 and has a 4.77MHz processor, 128KB of RAM, and uses 360KB floppy disks [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://grantovich.net/wp-uploads/twittjr-running.jpg"><img class="size-thumbnail wp-image-166  alignright"  src="http://grantovich.net/wp-uploads/twittjr-running-150x112.jpg" alt="Twittjr running in the CSH server room" width="150" height="112" /></a></p>
<p>Twittjr is a system that allows an <a href="http://en.wikipedia.org/wiki/IBM_PCjr">IBM PCjr</a> to search the public timeline on <a href="http://twitter.com">Twitter</a>. In case you weren&#8217;t aware, Twitter is a social micro-blogging service introduced in 2006 and has over five million active users. The IBM PCjr is a personal computer introduced in 1984 and has a 4.77MHz processor, 128KB of RAM, and uses 360KB floppy disks for storage.</p>
<p>It seemed like a good idea at the time.</p>
<p><a href="http://grantovich.net/wp-uploads/twittjr-closeup.jpg"><img class="size-thumbnail wp-image-164 alignright"  src="http://grantovich.net/wp-uploads/twittjr-closeup-150x112.jpg" alt="A close-up of the PCjr monitor while Twittjr is running" width="150" height="112" /></a></p>
<h3>How does that even work?</h3>
<p>Let&#8217;s say you have a PCjr hooked up to an external dial-up modem, which is connected to a phone line. Elsewhere, you have a modern internet-connected computer (call it the &#8220;server&#8221;) with another dial-up modem, connected to another phone line. The PCjr calls the server and establishes a modem connection, which it uses to send a request for whatever search term the user enters. The server uses the <a href="http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search">Twitter Search API</a> to download the three most recent posts on the public timeline that match the search, and shoves them back over the phone line to the PCjr, which displays them on the screen in glorious 16-color ASCII-vision. In the absence of user interaction, the PCjr refreshes the search results every minute or so, providing a sort-of-live feed. </p>
<p>Note that while a modern PC is involved, the PCjr is far from being a &#8220;dumb terminal&#8221; in this setup: I intentionally put as much work as I could on the PCjr side, and the server software is tiny in comparison to the pile of BASIC code that runs the client. The only things that aren&#8217;t done on the PCjr are the actual download from the internet (good luck cramming all those protocol stacks into 128KB of RAM!) and the XML parsing (which is possible, but <em>not</em> very fun, in BASIC). The two machines exchange data using a super-simple &#8221;protocol&#8221; I made up on the spot.</p>
<div id="attachment_165" class="wp-caption alignright" style="width: 160px"><a href="http://grantovich.net/wp-uploads/twittjr-dev.jpg"><img class="size-thumbnail wp-image-165"  src="http://grantovich.net/wp-uploads/twittjr-dev-150x112.jpg" alt="The 5.25-inch floppy drive I installed in my desktop to transfer code for Twittjr" width="150" height="112" /></a><p class="wp-caption-text">The 5.25-inch floppy drive I installed in my desktop to transfer code for Twittjr</p></div>
<h3>What&#8217;s the code written in?</h3>
<p>The PCjr software is in Cartridge BASIC, which is essentially <a href="http://en.wikipedia.org/wiki/BASICA">BASICA</a> with some extra bits. Cartridge BASIC is the best of the three forms of BASIC that can be used on the PCjr (the others are Disk BASIC and Cassette BASIC), because the interpreter doesn&#8217;t take up system memory, it runs almost as fast as compiled code, and you can save your programs to disk. It does, however, require that you have A) the actual Cartridge BASIC cartridge, and B) a DOS disk to boot from.</p>
<p>The &#8220;server&#8221; software is a small Ruby script that uses only built-in libraries. It <em>should</em> work on any platform that can run Ruby, but I&#8217;ve only tested it on Linux.</p>
<div id="attachment_160" class="wp-caption alignright" style="width: 122px"><a href="http://grantovich.net/wp-uploads/twittjr-imaginerit.jpg"><img class="size-thumbnail wp-image-160 "  src="http://grantovich.net/wp-uploads/twittjr-imaginerit-112x150.jpg" alt="A picture someone took of Twittjr at ImagineRIT 2009" width="112" height="150" /></a><p class="wp-caption-text">Twittjr at ImagineRIT 2009</p></div>
<h3>How did Twittjr get started?</h3>
<p>As it happens, I&#8217;m a member of <a href="http://www.csh.rit.edu/">Computer Science House</a> at RIT, and one day I discovered a fully-functional PCjr gathering dust on a shelf in one of our common rooms. Noticing that it used BASIC, which I was familiar with from my high school days, I figured I could write some eye-catching application that would attract people to our tables at the <a href="http://www.rit.edu/imagine/">ImagineRIT</a> innovation fair. Lots of CSHers had been joining Twitter recently, including myself, and someone who saw me fiddling with the PCjr suggested putting Twitter on it. Several weeks later, the first version of Twittjr was serving up tweets to curious open-house visitors.</p>
<h3>Can I set this up on my own PCjr? </h3>
<p>Absolutely, as long as you have the following things:</p>
<ul>
<li>One IBM PCjr with DOS boot disk and Cartridge BASIC cartridge</li>
<li>One of the following:
<ul>
<li>Internal PCjr modem installed (limited to 300 baud)</li>
<li>External serial modem with PCjr serial adapter to attach it</li>
</ul>
</li>
<li>A 5.25-inch floppy drive in your own computer, to copy the program</li>
<li>A spare 5.25-inch disk (or use your boot disk if it&#8217;s writable)</li>
<li>Any modern-ish PC to use as a server</li>
<li>A modem for said PC that appears to your OS as a serial device</li>
<li>A working installation of Ruby on said PC</li>
<li>Two phone lines (at least one must be capable of calling the other)</li>
</ul>
<p>And last but not least, you&#8217;ll need the <a href="http://grantovich.net/wp-uploads/twittjr.zip"><strong>Twittjr code package</strong></a>! It includes a README with basic setup instructions, so make sure you look that over before you start.</p>
]]></content:encoded>
			<wfw:commentRss>http://grantovich.net/posts/2009/05/project-write-up-twittjr/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Quoted Argument Parsing in Ruby</title>
		<link>http://grantovich.net/posts/2009/05/quoted-argument-parsing-in-ruby/</link>
		<comments>http://grantovich.net/posts/2009/05/quoted-argument-parsing-in-ruby/#comments</comments>
		<pubDate>Mon, 04 May 2009 23:58:48 +0000</pubDate>
		<dc:creator>Grantovich</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[monday]]></category>
		<category><![CDATA[one-liners]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://grantovich.net/?p=148</guid>
		<description><![CDATA[I had a post half-written for today, but decided it wasn&#8217;t going anywhere interesting and scrapped it. I still wanted to post something, so in the spirit of half-finished things, here&#8217;s a nice Ruby one-liner from a half-finished project of mine: gets.chomp.strip.scan(/[^ "]+&#124;"[^"]+"/).map{ &#124;s&#124; s.delete('"') } This takes a line from standard input and splits [...]]]></description>
			<content:encoded><![CDATA[<p>I had a post half-written for today, but decided it wasn&#8217;t going anywhere interesting and scrapped it. I still wanted to post <em>something</em>, so in the spirit of half-finished things, here&#8217;s a nice Ruby one-liner from a half-finished project of mine:</p>
<pre>gets.chomp.strip.scan(/[^ "]+|"[^"]+"/).map{ |s| s.delete('"') }</pre>
<p>This takes a line from standard input and splits it into a space-delimited argument list, with support for quoted arguments that have spaces in them. If you enter <code>'command with "some parameters"'</code>, you&#8217;ll get the array <code>["command", "with", "some parameters"]</code>. Not particularly advanced, but maybe useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://grantovich.net/posts/2009/05/quoted-argument-parsing-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Everybody Loves Python</title>
		<link>http://grantovich.net/posts/2009/04/everybody-loves-python/</link>
		<comments>http://grantovich.net/posts/2009/04/everybody-loves-python/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 23:52:53 +0000</pubDate>
		<dc:creator>Grantovich</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[unpopular opinions]]></category>

		<guid isPermaLink="false">http://grantovich.net/?p=114</guid>
		<description><![CDATA[These days, it seems like Python is the darling of high-level programming. People build MMOG servers with it, big companies build web app frameworks with it and start research projects to make it go faster, popular webcomic writers extol its virtues, major Linux distributions include it in their base package set, and its geek-tacular Monty Python references charm the pants [...]]]></description>
			<content:encoded><![CDATA[<p>These days, it seems like Python is the darling of high-level programming. People <a href="http://en.wikipedia.org/wiki/EVE_Online#Development">build MMOG servers with it</a>, big companies <a href="http://arstechnica.com/old/content/2008/04/analysis-google-app-engine-alluring-will-be-hard-to-escape.ars">build web app frameworks with it</a> and <a href="http://arstechnica.com/open-source/news/2009/03/google-launches-project-to-boost-python-performance-by-5x.ars">start research projects to make it go faster</a>, popular webcomic writers <a href="http://xkcd.com/353/">extol its virtues</a>, major Linux distributions <a href="http://www.debian.org/doc/packaging-manuals/python-policy/">include it in their base package set</a>, and its geek-tacular <a href="http://en.wikipedia.org/wiki/Monty_Python">Monty Python</a> references charm the pants off of every former Perl scripter on the interbutts.</p>
<p>If you perceive a slight edge to my voice at this point, it&#8217;s not your imagination. Though I recognize Python&#8217;s wild popularity, I respectfully disagree with certain aspects of its implementation. As such, when I started looking around for a new and hopefully useful language to learn, I chose Ruby instead. Most of my friends have indicated to me, in no uncertain terms, that they think I have made a terrible mistake. After working with Ruby for some time, although I&#8217;m certainly not ready to move away from it, I begin to see where they&#8217;re coming from.</p>
<p>Ruby, for better or worse (actually just worse), is something of a second-class citizen in relation to Python. There are a number of logical and well-established explanations for this: Ruby&#8217;s development lags Python by a few years due to its later introduction date; Ruby&#8217;s documentation is often difficult to locate and navigate; Ruby is just plain slower than Python for many non-trivial tasks (though 1.9 improves on this); compiling native extensions for Ruby on Windows is practically guaranteed <em>not</em> to work; and until very recently, Ruby didn&#8217;t have built-in support for Unicode strings, which is kind of important if you&#8217;re pushing for a global user base. Even in those areas where Ruby is improving, it&#8217;s turning out that Python is too entrenched already for those improvements to make a difference. Python came first, and there ain&#8217;t room in this town for another language that has basically the same features.</p>
<p>At this point you might be asking what&#8217;s so bad about Python that I would instead voluntarily use a language I just described a minute ago as a &#8220;second-class citizen&#8221;. One reason is my personal belief that, conceptually, Ruby is a better (albeit less mature) language than Python. Another reason is the syntax, and I will defend to the death my opinion that Python&#8217;s use of the <a href="http://en.wikipedia.org/wiki/Off-side_rule">Off-Side Rule</a> is unbelievably boneheaded and makes code ten times harder to scan due to the complete lack of block terminators (not to mention the ease with which Python code can be irretrievably mangled if anything so much as sneezes on all your leading spaces). The really annoying thing about this is that the Off-Side Rule is <em>not a required language feature</em> to accomplish any of the cool stuff that Python can do. It&#8217;s just an arbitrary limitation with no solid rationale behind it.</p>
<p>Of course, at the end of the day, no matter how much I personally dislike the way Python does things, it&#8217;s still the more popular language. And given Ruby&#8217;s various failings, I&#8217;m not exactly surprised. For now, I guess I&#8217;ll just keep tinkering around with my little second-class language, and hope it eventually develops some of that secret sauce that makes everybody love Python.</p>
]]></content:encoded>
			<wfw:commentRss>http://grantovich.net/posts/2009/04/everybody-loves-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
