Shlrm.org Blag

Ruby

Ruby: Fibrous Content Ahead

by David Kowis on Jul.28, 2008, under Ruby

Fibers, threads, and processes! Oh, my! Fibers are probably the most interesting part of this, and ruby’s slightly broken threading model. Processes are interesting from the aspect of being able to communicate with external programs. (continue reading…)

Leave a Comment :, more...

Ruby Input and Output

by David Kowis on Jul.27, 2008, under Ruby

The next chapter is one on basic input and output. This one is also kinda short. Or maybe it feels short, as there’s not a whole lot of new stuff to digest… EDIT: heh, well I started out saying it was short, but turns out I had more to say about it than I thought. Maybe I’m getting better at this blagging stuff. (continue reading…)

Leave a Comment : more...

Programming Ruby: First Edition

by David Kowis on Jul.27, 2008, under Ruby

Is available online! How about that? There’s a second edition out, and the third edition is soon to head to the presses. I have the third edition PDF, and that’s what I’ve been blagging about. But, if you’re broke (or cheap) and want to learn ruby, I highly reccomend the book.

Leave a Comment : more...

Quickie on Ruby Exceptions

by David Kowis on Jul.27, 2008, under Ruby

I’m feeling kinda tired, so the chapter on exceptions is gonna be a short one.

Turns out I was getting sick. Bleh. Yay for day-quil! Anyway, the chapter in the book on Exceptions is kinda small. Exceptions work just about exactly the same as they do in Java. Throw and catch aren’t quite the same, however. In ruby you “fail” or “raise” an exception. “throw” and “catch” work for bailing out of loops.

In ruby, exceptions are caught by using “rescue” and behave just like catch in Java. There is also a “finally” type clause, called “ensure”; behaves the exact same way it does in Java. Ruby has the concept of a “retry” which is kinda neat. There is great potential for infinite loops, however, so take care. “raise” in ruby behaves the same way as “throw” in java.

“catch” and “throw” are different. You use it to bail from a loop. Ruby will crawl up the stack when you throw something, looking for the location to catch it. Then it’ll jump outside that loop and finish. I personally think that’s pretty spagetti code inducing, but I can see where it might have its usefulness.

And that’s it. This blag post is really almost as long as the actual chapter. Next up is I/O.

Leave a Comment :, , more...

Ruby: Friday Facets

by David Kowis on Jul.25, 2008, under Ruby

How about that: “Facets” of ruby. I’m so witty, it hurts. I’ll quickly go over methods and a sentence or two on expressions. Parallel assignments get a few more words, since it’s new. A bit on boolean logic, and case statements, because they’re cool. Finishing up with loops and a few words on scoping. (continue reading…)

Leave a Comment : more...

Archives

Hacker’s Diet

The Hacker's Diet Online