1. Computing & Technology

Discuss in my forum

Michael Morin

Ruby

By , About.com Guide

Follow me on:

What is Ruby on Rails?

Tuesday May 22, 2012

Ruby on Rails.  It was a huge buzzword just a few years ago.  It's launched many careers and is the preferred web development environment for many web developers.  But what exactly is it?

Worked Example: Tabular Data

Thursday May 10, 2012

So much is made of the base data structures in Ruby.  It's either an Array or a Hash or it isn't anything.  But it's quite easy to make other related data structures out of these base data structures, such as a two dimensional array.  Making an array of arrays in Ruby is not hard at all.

Worked Example: Number Guessing Game

Monday April 30, 2012

If you were like me, your eyes would just glaze over when reading programming books.  "OK," you'd say, "but how is that useful?"  This article is the first in a series of "worked examples," articles that feature working example programs and explain the Ruby features that make it tick.  It starts off simple, with a number guessing game (that I'm sure many if you have already written if you've learned other programming languages).

Weak References

Tuesday April 24, 2012

Imagine you want to keep tabs on an object, but that object takes a lot of memory.  If you were to save a reference to that object, the garbage collector cannot deallocate that memory.  The WeakRef class allows you to use weak references to watch objects without actually keeping references to them.  This is not without caveats though.

What is Ruby?

Friday April 20, 2012

Are you new to Ruby?  Or even new to programming in general?  This article tries to answer this question as simply as possible, in plain english and without buzzwords.

Getting Information About a File in Ruby Using File::Stat

Thursday April 12, 2012

How large is a file?  When was it last modified?  These are types of things that can't be (or are difficult to be) answered by querying a File object.  However, the File::Stat class can be used to gather such information, as well as a variety of other statistics.

References to Methods in Ruby

Thursday March 29, 2012

Trick question: How do you take a reference to a method in Ruby?  It's a trick question because a method cannot exist on its on in Ruby.  Ruby doesn't have "function pointers."  You might guess that you can simply store the object and a symbol with the method name, and you'd be right.  Or a proc object that calls the method on the object, and again you'd be right.  But Ruby provides a better and more expressive solution.

Generating Random Numbers in Ruby

Tuesday March 27, 2012

While no computer program can generate truly random numbers (at least without the aid of an external source of entropy), Ruby does provide easy access to a pseudorandom number generated (PRNG).  With this, you can generate a sequence of numbers (typically integers) that will seem random to any human being.  This can be particularly useful in simulations and games, and occasionally useful in unit tests.

Cryptographic Hashes in Ruby

Tuesday March 27, 2012

Cryptographic hashes (not to be confused with key/value pair hashes) can be useful for checking the integrity of a file and to store passwords for authentication purposes.  While Ruby does provide native support for a few algorithms natively, a much more useful and complete set of algorithms are provided via the OpenSSL library.

Where's _why?

Thursday March 15, 2012

It's been a long time since Why the lucky stiff (AKA _why) left us in 2009, without a peep from him leaving the entire Ruby community to scramble and wonder why someone so great and who gave us so much great stuff (Hpricot, Hackety Hack, Shoes, Camping, Why's Poignant Guide to Ruby, Try Ruby, and the list goes on) would leave so suddenly.  If you weren't part of the community pre-2009, it's just so hard to imagine how much of a character this guy really way.  Long story short, he was great and now he's gone.

But this has gone relatively unknown outside the Ruby community.  What's big news to us is hardly a whisper to even other programmers.  There haven't been many articles about it in the press at large, until now.  Slate has just published a rather extensive article on the whole situation, and even if you remember it all first hand, it's a good read.

©2012 About.com. All rights reserved.

A part of The New York Times Company.