The Dark Balloon

A weblog by Hao Lian.
A terrible secret guarded by golems.
A note that thanks you for being born, all those years ago.

§
Writing an English sonnet in ten steps or seven euro steps

Step one. You stare at the blank sheet of paper. Possibilities run anew through your head. Anything can happen. Art is in the making, and history pauses with baited breath anticipating your words as they shape the very foundation.

Step two. You look up “English sonnet” on Wikipedia. It sounds challenging but it’s nothing you haven’t vaguely done before.

Step three. You find a good introduction line. You write it out. Boom! Iambic pentameter on the first try!

Step four. You move to the fourth line. Uh-oh. You can’t seem to write your thought in the proper form. You go back to the first line for inspiration. Eleven syllables? You hastily recount. You try to rework the first line, but it turns to rubble.

Step five. You start marking unstressed and stressed syllables in a desperate attempt to salvage the first line before it’s two late. You give up and start doing the same to the second line, compromising your previously pristine grammar for rhythm and rhyme.

Step six. Third line. It has to rhyme with the first line, you think to yourself. Nothing works. Even more accent marks. You look up “sonnet generator” on Google; alas, no fruition.

Step seven. Soon, accent marks fill the page. You Google that phrase again.

Step eight. The entire paper after the third line is black, black with dots and prime mark, with failed rhymes, with thoughts unhatched. The paper drips and oozes with ink, squirm uncomfortably away from your now-revoked poetic license. You stare at the page, and it stares back. After a few minutes, it blinks and licks its lips in defeat.

Step nine. Satisfied, you go to bed.

Step ten. When you wake up, you can’t find your sister, but there are ink stains on the bedsheets, on the walls.

[(2008 April 12) .]

§
How to install ParseTree and RubyInline on Windows and, gasp, get them to work

ParseTree converts Ruby code to a sex expression. RubyInline is magic.

First, gem install rubyinline and gem install parsetree.

Install Visual C++ Express and the newest Microsoft Platform SDK, which is Vista SDK currently. If you wait for 2008 edition, VC++ Express will automatically install Platform SDK for you. This takes a while to download, so kidnap and chloroform a friend with spare bandwidth.

Modify C:\Ruby\lib\ruby\1.8\i386-mswin32\rbconfig.rb, which will vary depending on where you installed Ruby. If your platform is not i386-mswin32, navigate to the correct directory. Change the CONFIG["CFLAGS"] line to CONFIG["CFLAGS"] = "-MD -Zi -O2b2x".

Open up a Windows 32-bit debugging console from Platform SDK’s many Start Menu subdirectories. In addition, drag the file Microsoft Visual Studio 8\VC\vcvarsall.bat in your Program File to the console, which will paste the full file path. Press Enter. Now you have the necessary bin, include, and lib variables.

Navigate to the highly redundant C:\Ruby\lib\ruby\gems\1.8\gems path. Go into RubyInline’s folder and edit lib\inline.rb. Around line 379 and 392, manually patch the file per my poorly generated diff using a text editor or SNOBOL, which will fix quotation marks, a method call, a compiler flag, and manifest molestation.

In Inline#generate, change the file, line = line per my poorly described bug.

Now, in your console, cd to ...\gems\RubyInline-version\demo and type ruby hello.rb. You should see Hello World. If not, search Google. Common problems include missing bin/include variables, in which case use set var=%var%;c:\new\directory for the path or include variables. If the C++ compiler screws up, Google and try modifying rbconfig.rb.

OK, you have RubyInline working now. ParseTree is much simpler now that the hard part is finished. Simply wrap every builder.add_compile_flag call around line 258 of ...gems\ParseTree-version\lib\parse_tree.rb with an if /win32/ !~ RUBY_PLATFORM ... end except the -Wall since that’s the only one that works with VC++. Now run ruby ...\demo\printer.rb to make sure it works.

Congratulations. You have conquered the dragon that is compiling on Windows.

[(2007 August 8, 4!) .]