You are viewing a read-only archive of the Blogs.Harvard network. Learn more.

~ Archive for Ruby ~

Small is small despite all we do and say


info = {|h, k| h[k] = [] }
Find.find(*paths) { |f| info[File.size(f)] lessthan lessthan f }

What is it I am facing?

Almost a year ago, I was comfronted with a similar situation. Some code I could not understand in Objective C. Only I dropped Objective C, while eventually I get it with Ruby. It helps that Ruby is so easy to run, so easy to print things out to see what is happening, or run irb. And it helps that folks are writing about Ruby:

For the top line, I found
which explains hash initialization.

for the second line, I realized that lessthan lessthan was a string method, not a hash method. And on an inspiration, I figured out how to use ri:
ri String#length
ri String#\lessthan\lessthan
I am brilliant.

I don’t think I am facing Ruby. I think I am facing whatever shortcuts folks have been using. And I don’t know those short cuts, and those short cuts are hard to read. There are whole books written on a type of short-cut called regexp. I have used them. They work. You can write very powerful code which looks very snazy, one liners even. But they are difficult to read.

I think these brilliant short cuts probably have a long history. Maybe I am facing Human’s synthetic mind. The mind that invented writing. But I suspect I am also facing men’s minds. The competitive mind. The mind that enjoys looking down on the uninitiated. Whatever it is, I think it is worth my time finding a long-hand way which is easier to understand. It is not enough to get a ruby book. It is not enough to understand the code. At the end of the day, I need to take one more step, the imagine I want others to understand this easily ruby way.

“The problem is not desire, it is that our desires are too small”


A new webserver. I only lost half a blog page because it contained a lessthan sign which apparently tells the blog it is the end of the text! I have no idea how to find help and learn to escape characters, so for now I put text instead of the symbol and I will move on. Formating is better, with lines of code following each other line by line, instead of bunched in an unreadable paragraph.

These last couple weeks, I have made progress with Ruby and the web. It is a sweet feeling to finally get a “hello world” example to work. I spend so much of my time trying to get installs to work, that I wonder if I will move on to actually writing code! Maybe I am getting addicted to this, “install and how do you get to this to work” pattern of tension and delight in the release from tension.

“The buddha evoked the unrest, instability and uncertainty that color our lives …desire is a natural response to the reality of suffering. We feel incomplete and desire completeness; we feel unrest and desire ease; we feel insecurity and desire comfort; we feel alone and desire connection.” Mark Epstein. So I am endlessly flying on the wheel of suffering. But at least in this case, thanks to the generosity of folks on the web, there are short moments of release from suffering.

For now, I am following some of the beginner’s assignments posted by MIT professor philip Greenspun on this older course website
Most of the implementation is left for me to discover, but in a sense, that makes it easier to learn: I don’t have to skip over perl or java code to get to the main ideas. And hopefully the text will guide me to some web application mastery. For now, I have written my first CGI code entering data in a form and sending it to a ruby code to process and generate a web page with the answer. Cool!

I have also learned one way of setting up eruby and erb on tiger. First I set up erb with the help from this weblog
and then I did the same with eruby, except I copied eruby to eruby.cgi.

A key part of learning, is finding an object of desire. How many come to the ruby site and say, I have read the book, now what, what problem should I try to solve? And on the other hand, how many come to 3D like I do with an overwhelming desire, I want to represent my cousin’s head, a boy jumping in the air, etc, dreams of perfection so far beyond anything the most skilled person can attain. With such richness of perception from daily life around us, how can we look at a dreary cube with the least bit of lust? I sat under a tree in bloom yesterday. Each branch was heavy with hundreds of tiny perfect white flowers sparkling in the sun by the river.

I found a Ruby class on the internet!


Ruby is an object oriented programming language which can post on the web with Ruby on rails. There are books on Ruby and on ruby on rails, so it is not very new, but still new enough that some people want to learn it.

there is an announcement on

You have to sign in with courses
and then the threads are found here

It is really excelent. Everybody I talked to had a positive impression of Ruby. This course will give me the push I need to really look into Ruby instead of just talking about it. My own post hasn’t shown up on the thread yet, but hopefully it will eventually, and I look forward to having other people to ask questions from, and see what they are learning.

On the install, my main difficulty was how to install ruby from source
Luckily, I found a blog that saved me,
I went into the directory in the terminal window,
ls …
than I think I ran
sudo make install
rubycocoa had an installation package which made it easy to install.

I am working myself through
and although the cocoa part, Nib, connecting outlets etc is very similar to what I did with objective C, the code does not have any reference to memory so far, which was the part that really ennoyed me.

With Ruby, I can learn cocoa and object oriented programming, so it is not such a big detour.

Log in