I managed to compile ruby-mysql

I’m using MySQL Ver 14.12 Distrib 5.0.21 for Win32 (ia32), mysql-ruby 2.7.6, msys 1.0, gcc 3.4.5.

It took a bit of googling before I stumbled across this link.http://rubyforge.org/pipermail/instantrails-developers/2006-January/000027.html

This link prompted me to peek at extconf.rb. I quickly realized that the script was unable to recognize my platform. It was expecting windows to be mswin32, whereas my compiler was reporting i386-mingw32. That’s on line 3, which says:
if /mswin32/ =~ RUBY_PLATFORM

I modified it to:
if /i386-mingw32/ =~ RUBY_PLATFORM

I invoked the script using:
ruby extconf.rb –with-mysql-lib=”C:\Program Files\MySQL\MySQL Server 5.0\lib\opt” –with-mysql-include=”C:\Program Files\MySQL\MySQL Server 5.0\include”
make
make install

All went well, and a mysql database script on my machine worked!

Conversational Ruby

I often use Ruby to open conversations:
* It’s easy to write short, quick Ruby code that works,
* It’s readable enough even for new people,
* It’s easy enough to pick up that new people can take my code and run with it,
* It’s expressive,
* It’s fun to write code in.

Eggshell of idioms

It is hard, but rewarding, to shine light on idioms. This has been my experience.

When I introduce someone to Ruby, I usually show off Ruby’s more flashy aspects, and compare it with the equivalent in Java, C# or C. Ruby’s approach to iteration never fails to evoke a response. I also show how Ruby’s various list-friendly methods can be chained together, with powerful results. People respond well to this demo. And why not. Ruby is cool!

Then I get into classes and methods. The brevity is refreshing, of course. But Ruby doesn’t have interfaces. And much popular object oriented thought today took root in statically typed languages such as C++, C# and Java. So when I’m done showing off Ruby’s classes, my subject takes the next logical step, and asks for Ruby’s take on interfaces.

But interfaces do not have to be in every language that has classes. This is the part where I can get quite verbose. It takes me time to explain dynamic dispatch, and the absence of interfaces. Why a duck can be a bird without implementing IBird, and indeed why IBird doesn’t have to exist.

The idiom here is the way that method dispatch works in well known statically typed languages.

There is an eggshell of static typing idioms that surrounds static typing languages. It includes approaches to inheritance, interfaces, iteration. Understanding Ruby forces the enquirer to question the eggshell of idioms, and break out of it.

Emacs is unfamiliar

Getting of of “mark text” mode is difficult – Ctrl + G or 3 escapes. The Windows editor merely requires one to move the cursor without Shift pressed, and all marked text is unmarked.

Saving is harder – Ctrl + X + S as opposed to Ctrl + S in the Windows world.

Selecting text from “here” to “end” is harder:
Ctrl + Space, End, as opposed to (Ctrl + Shift) + End in the Windows world.

These are my favourite editing keys. So over a few hours it all adds up.

Other irritants: Alt + Shift + X to maximize a typical Window. But this familiar key phrase is not for Emacs.

To select all text and copy it to a new empty window so that I can edit the copy while keeping the original pristine, I wish I had: Ctrl + A, Ctrl + C, Ctrl + N, Ctrl + V.

This is all a lot of learning to do. Of coures, I expected it.

Can I condense the effort? Is there something I’m missing? Can I get back the keyboard phrases that I am used to?

Note that in these flailing efforts, I am:

  1. trying to see if there are easy ways to adapt to Emacs, and
  2. trying to see whether I can adapt Emacs

…without fighting it.

Software that helps

Some software are essential. Windows, Linux, other operating systems. I live with them, coz I can’t live without them. I’ve spent most of my onscreen life in Windows. I’m comfortable with it because I am familiar with it.

From the rest, I like the ones that just work without getting in the way. They will stay hidden until I need them. Their features are understated. But I like when a software seems to read my mind and respond to my thoughts. I specially appreciate the moment when I realize how much less I have to work to get something done, through the use of this tool.

Emacs and Lisp

I enjoyed reading this report on Lisp | Emacs: Advanced Codemunging: A Report from the Trenches

Why Ruby is my favourite platform and language

First, read about yellow, red and green code.

Ruby is the only language that I’ve encountered so far that

  • helps me separate the green code from the yellow,
  • provides enough library and community support to help me “get the job done”.

I’ve found that the elder lisps are good at keeping green and yellow apart, but I have not found library support to be very strong.

Maybe Clojure has something to contribute here.