4:50 pm Sunday May 20 2012

About.com Ruby: Most Popular Articles

Command-line Arguments

Use command-line arguments to pass parameters to your Ruby scripts from the command line.



Hashes

This article explains and teaches how to use a associative arrays (hashes) as a way to store multiple variables in one data structure.



Using the Command Line

Learn how to use the command line interface on Windows, Linux and OS X to run rb files and use the interactive Ruby program.



Comments

Use comments to annotate your Ruby code.



The 'require' Method

The 'require' method is the reusable code mechanism in Ruby. It allows you to import other source files into your programs.



Installing RVM on Linux

Installing the Ruby Version Manager (RVM) on Linux



Environment Variables

Using environment variables in Ruby.



String Substitution in Ruby

Splitting a string is only one way to manipulate string data. You can also make substitutions to replace



Using RVM Gemsets

One of the most powerful, useful and often overlooked features of RVM is the gemset. A gemset is a separate gem directory, so the gems in one gemset don't conflict with the gems in another gemset.



Parse Command Line Options

Ruby comes equipped with a powerful and flexible tool to parse command-line options, OptionParser. The class is an alternative to GetoptLong for analyzing command line options.



Install Ruby on OS X

How to install Ruby on Apple OS X



Arrays

This article explains and teaches how to use a arrays as a way to store multiple variables in one data structure.



Using the 'split' Method

String manipulation using the split method in Ruby. Split strings into a list of substrings.



While, Until, Each and Time

Loops, including while and include loops, are one of the most commonly used constructs in computer programs.



Install Ruby on Linux

How to install Ruby on the Linux operating system.



Aliasing

Aliasing is a powerful Ruby feature that allows more than one method to be referred to by multiple names. This can be used to give a programmer more expressive options or to create copies of a method, allowing you to change the behavior of a class.



Installing Ruby

How to install the Ruby interpreter on Windows, Linux and OS X.



What is Ruby?

What type of language is the Ruby programming language?



Using JSON: The JSON Gem

It's easy to jump into parsing and generating JSON in Ruby with the json gem. It provides an API for parsing JSON from text as well as generating JSON text from arbitrary Ruby objects. It's easily the most used JSON library in Ruby.



NameError: uninitialized constant Object::Something

Problem: You encounter an error reading NameError: uninitialized constant Something or NameError: uninitialized constant Object::Something (with various class names in place of Something).



Adding Files to a Repository

How to add files to a Git repository.



OptionParser

Using OptionParser to parse command line options is a preferable alternative to GetoptLong or looking through ARGV manually. But how do you use it?



Install Ruby on Windows

How to install the Ruby interpreter on the Windows operating system.



Using Glob with Directories

In the previous article in this series, we discussed the basics of the Dir class. Particularly useful was the Dir.foreach method for iterating over all files in a directory. However, this only goes so far. What if you want to iterate over only some files (for example, just XML files) in a directory?



Installing Git on Windows

Installing command line tools such a Git on Windows is often difficult. Not only do you have to find a Windows port or attempt to compile the tool yourself from C source code, you also have to deal with the Windows command line. The Windows command line is, to say the least, a little lacking. Windows users are in luck here though, the MSysGit project solves both these problems.



Strings

Using and manipulating strings and substrings in Ruby.



The logger Library

How to use the logger library to create and write to log files in Ruby.



Making Deep Copies in Ruby

It's often necessary to make a copy of a value in Ruby. While this may seem simple, and it is for simple objects, as soon as you have to make a copy of a data structure with multiple array or hashes on the same object, you will quickly find there are many pitfalls.



Interact with SSH in Ruby

Net::SSH is a way for Ruby to interact with SSH (Secure Shell) protocol. It relies on the OpenSSL library for encryption.



Installing Gems from Git

How to install gems from git repositories.



Riding Shotgun with Sinatra

Now that you can write controller logic and views and Haml, you can start putting together some more complex application. There's one very annoying thing though: Sinatra does not reload its code whenever you make a change. If you make a change, you have to stop and restart the server. This is just an extra step and generally an annoyance. This where shotgun comes in.



Installing Git on Linux

There are multiple ways of installing Git on Linux. Depending on which Linux distribution you're using and whether it provides binary packages for Git, you can either install a binary package or install from source.



Installing Ruby on Snow Leopard

So, you've gotten your shiny new Mac and you want to get right into Ruby programming , where how do you



Debugging Ruby

Debugging Ruby programs using the Ruby debugger.



How to Use the Gem Command

The gem command is one of the most used Ruby-related commands. This article shows 25 Gem Commands and their functions.



NameError: undefined local variable or method `a'

Problem: You encounter an error reading NameError: undefined local variable or method `a' for # or NameError: undefined local variable or method `a' for main:Object (with various identifiers in place of 'a').



What is Rack?

There’s a lot of talk about Rack , but unless you’re a framework author yourself, you rarely see it. So what is Rack? And why, as an application developer, should you care about it?



Using Rack

In the previous article, you learned what Rack is. Now, it’s time to start using Rack and serve up some pages.



10 Ways to Learn Ruby for Free

Sometimes the old adage rings true: the best things in life are free. If you've wanted to learn a little Ruby, but haven't been able to fit a programming course into your budget, don't worry. There are a number of places on the Web to begin your learning, without sacrificing money or quality.



Tk

Directions of how to install the Tk GUI and its Ruby bindings on Windows, Linux and Mac OS X.



Using Haml with Sinatra

How to use Haml to create Sinatra views and layouts.



Getting Started With Ruby

How to use the command line interface on Windows, Linux and OS X to run Ruby scripts and use the interactive Ruby program.



Hello, Sinatra!

How to get started in Sinatra, including how to use actions, parameters, ERB and views.



Blocks

How to use blocks in Ruby.



Exceptions

Exceptions are used to handle things the unexpected things that might go wrong with your Ruby code. This article addresses what Exceptions are and how they can be used.



Named Regexp Groups

Ruby 1.9 introduces the concept of a named capture group. These named groups can be defined at the beginning of a regexp statement using a trick that tells for the regexp engine to look for exactly 0 instances of the group. Later, the group can be recalled using the \g element, followed by the name of the group. You can think of named capture groups as subroutines inside of a regular expression.



Ruby Gems

Learn to search the Ruby Gems repository to find gems to add and install to your library.



protect_from_forgery

A feature in Rails that protects against Cross-Site Request Forgery (CSRF) attacks.



The Twitter RubyGem

Using the Twitter RubyGem, making API requests to Twitter is even easier than using the twitter method.



What is Ruby on Rails?

For about 6 years now, there's been a lot of talk about this thing called "Ruby on Rails." They're saying



CSV Example: Parsing CSV

A crash course on what CSV is, what it is used for and how it is parsed. A method for parsing CSV files using only Ruby's built-in string methods is presented and discussed.



RVM and 'sudo'

RVM is great. However, there may be times where you must run Ruby scripts with RVM as root (or another user) via sudo.



Blocks in Ruby 1.9.1

The release of Ruby 1.9.1 brings new features to be learned,among them are the changes in block variable scope. Learn the new syntax for block variable scope introduced in Ruby 1.9.1.



no such file to load -- mkmf

Problem: You're trying to install a gem and you encounter an error reading no such file to load -- mkmf. This doesn't always occur, only when you're trying to install gems with native C code that must be compiled.



DataMapper Introduction

DataMapper is a "Object/Relational Mapper" or ORM. In other words, it maps Ruby objects to database records



Starting the Blog

Generating a Rails project from which to build an application.



Defining Cloud Computing

What is cloud computing? Interviews with industry experts help us define cloud computing, software as service, platform as service and more.



Input and Output

Input and output methods are often overlooked by many Ruby programmers. How often have you used the <b>gets</b> and <b>puts</b> methods without giving them a second glance? Learn all the features of these methods to better put them to use in your code.



The ‘exec’ Method

There are several ways to run other programs in Ruby. There is the system> method, backticks, etc. However, they all spawn new processes. If there is nothing left for your Ruby program to do, it has to sit there wasting memory until the launched program finishes. The exec> method fixes this.



NoSQL Databases

Chances are, you've spent your entire database life with relational databases. Data gets organized into columns, and stored in rows. You manipulate data with SQL (Structured Query Language) and there's really no other way to do it. There are competing SQL servers out there (MySQL, SQLite, etc), but they all more or less operate in the same way. But there's much more out there than SQL databases, especially with all the new software in the past few years.



Can Git Add Empty Directories?

Can I add empty directories to Git repositories?



Special Characters

Aside from the basic regular expression operators such as groupings and quantifiers, there are some other special characters and escape sequences (backslash followed by a character) that can help you out when you're working with Ruby.



exec and exec!

Running programs with Net::SSH is simple enough. The Session object gives you two convenient methods with which to accomplish this task.



Lookahead and Back-references

Using lookahead and back-references to refer to other parts of the regular expression text.



Web Interface for Gems

So far, we've discussed how to use Sinatra in general, how to handle and route requests, and how to build views using Haml. Before we take the plunge into using data storage with Sinatra, let's put what we've discussed so far into practice. This article explains how to use Sinatra to provide a web interface for a gem.



A Benchmarking Experiment

Benchmarking measures the time it takes to execute code and compares it to other code that accomplishes the same task. This is useful to see which is faster, and gives you the opportunity to use the faster code in your program.



Serialization in Ruby: Marshal

Serializing an object is to convert an object to a byte stream and either store that object for future loading, or sending to another program to be loaded there. There are several common ways to serialize objects in Ruby. The Marshal module is used less often than the other methods, but it's included in the standard library.



Builder RubyGem

The Builder library is a Ruby Gem that uses a meta-language to generate HTML, XML or CSS markup.



undefined method `to_sym' for nil:NilClass

Problem: Seemlingly at random, you've encountered the error undefined method `to_sym' for nil:NilClass, or a similar error message for any method name other than to_sym.



Option Hashes

Using hashes to simulate optional named parameters in methods.



The Twitter API

The Twitter API (Application Programming Interface) in Ruby on Rails is about as simple as you can get. Twitter is a RESTful Rails application.



What is RVM?

RVM is the Ruby Version Manager. It allows you to install and manage several different versions and implementations of Ruby on one computer, including the ability to manage different sets of RubyGems one each.



4Ways

A comparison of Ruby to other programming languages, including Perl, Java, Python and PHP.



nokogiri

Up until now, Hpricot HTML parser for Ruby has been the fast an easy standard. The Nokogiri Ruby gem can parse not only HTML, but also works with XML, CSS and XPath selectors.



5 Must Know Features of Ruby

If you're going to program in the Ruby language, there are some basic features you absolutely must know. Here are the Top 5.



Serialization in Ruby: YAML

YAML (YAML Ain't Markup Language) is perhaps the most common form of serialization in Ruby applications. It's used for configuration files in Rails and other projects, and is nearly ubiquitous. It also has distinct advantages over marshal, and is usually preferred.



Using rails.vim

Editing Rails projects in Vim effectively.



Installing Rubygame on Windows

A visual tutorial with screenshots showing how to install the Rubygame library on Windows, including installing all needed DLL files.



Cloud Computing

What is cloud computing? We asked Dave Vandervort of Xerox Innovation Group to help us answer that question and more.



Working with Directories

Learning how to work with files is one of the first things new Ruby programmers learn. However, how to work with directories of files is something that's often skipped or only lightly touched upon. Ruby does have some powerful mechanisms for working with directories though.



Running the Ruby Profiler

Running the Ruby profiler to determine which methods are most expensive and which need to be optimized.



Distributed Ruby

Distributed Ruby, or DRb, is a library that allows you to communicate with remote Ruby objects and programs, using TCP/IP network protocols.



A Practical Twitter Script

Since the Twitter API makes it easy to do anything you can do on the website, writing a Ruby script to automatically follow followers is very simple.



Regular Expression Options

Using options to change the behavior of regular expressions.



What is Sinatra?

Sinatra is a web framework. Simply put, it's a library that allows you to write web applications with a minimum of red tape.



The Ternary (or "Conditional") Operator

The ternary (or "conditional") operator will evaluate an expression and return one value if it's true,



Transfer Files with Net::SCP

SSH is not just for running commands, it's a general conduit for encrypted communications between two hosts. One common use for SSH is to transfer files using the SCP protocol over SSH. You can use SCP in your Ruby programs with the Net::SCP library, which is a supplement to Net::SSH.



Using POP3 Libraries

Learn to use Ruby's pre-installed POP3 libraries to check your email.



Ruby vs. Python

How do Ruby and Python compare in terms of features, form and function?



Mixin Modules

Mixins are one of Ruby's defining features, but often one of the most difficult to understand for those new to Ruby. They're not difficult to understand, but they're not something most programmers have encountered before as most languages don't have mixins.



Shoes' 5 Dialog Methods

We've all had to respond to that ubiquitous question: Are You Sure You Want to Exit? Ever wondered what was behind creating them? Shoes gives you 5 different dialog methods to choose from.



Making Nameless Methods in Rub

Among the new features in release of Ruby 1.9.1 is the Lambda operator, a shortcut used to make nameless methods. Learn how to use this feature introduced in Ruby 1.9.1.



Rapid Game Prototyping in Ruby

Myth: Ruby is unsuitable for game development. It's much too slow, there are no good libraries and it's too hard to deploy your games written in Ruby.



Making a Text Adventure Game in Ruby

Text adventure games were a very popular game genre on minicomputers and microcomputers from the 1970's through the 1990's. This article series will take you through each step of making a text adventure game in Ruby.



Instance Variables

Instance variables are some of the most common and important variables types in Ruby. They begin with the at sign (@) and allow objects to track their internal state.



Twittering in Ruby

Twitter provides programmers with an excellent API, which is why so many Twitter interfaces exist for tweeting, following updates, following friends and thread-sorting. Writing Twitter clients in Ruby is a breeze!



Syntax

The syntax of a language is the grammatical rules a program must follow in order to be understood by the interpreter or compiler.



Regex: Grouping

The grouping operators, including the parentheses operator, are some of the most powerful and frequently used operators in the Ruby regex syntax.



Package Manager

A package manager is software on a Linux system that manages the other software installed on the system.



External Return Value

Ruby makes it easy to run external programs and capture their output. Using the built-in "backtick" operator



Comments on the Ruby Blog

Part four of the Ruby on Rails blog tutorial shows you how to create a comments table to allow users to comment on your blog posts.



Ruby on Rails 3 Tutorial: Learn Rails by Example

Ruby on Rails 3 Tutorial: Learn Rails by Example by Michael Hartl is a hands on introduction to not only Ruby on Rails but all the related software and services many Rails developers use such as Git, Github, Heroku and RSpec. There are no long-winded discussions on theory or REST or MVC, each and every part of every chapter is a hands on exercise in building a Rails application. This book is recommended for anyone who prefers a hands on approach to learning.



Ruby vs. Java

What features do Ruby and the Java programming language share? How are they alike and how are they different?



List of Rack Middleware

The following is a list of Rack middleware applications that come with the Rack gem. A brief description of each middleware is given.



String Literals

The basics of strings, string interpolation, single and double quotes, escape sequences and alternate string literal syntaxes.



Interfacing with the Arduino

How to interface with the Arduino's serial port on Linux.



Eval: Running Code on the Fly

Most non-compiled languages have some kind of eval function, which will take a string and execute it as code.



Send Email with Ruby

How to send email with Ruby on Rails using SMTP.



Splitting Strings

Unless user input is a single word or number, that input will need to be split, or turned into a list of strings or numbers.



The Case Statement

The case statement is a control structure that is usually quite limited in other programming langauges. However, it's quite powerful and flexible in Ruby.



Creating a New Repository

A Git repository is not like a repository in most other version control systems. Normally, you'll have something like a CVS or Subversion server where the repository lives. From that, you'll check out a working copy, make your changes to that and commit them. Git is different though, there is no centralized server.



Simple RSS

The Simple-RSS RubyGem provides a simplified interface for reading RSS and Atom documents.



Creating and Distributing Gems with Bundler

Creating Ruby gems has always been a bit of a pain. When you get right down to it, it's not a hard thing to do, but it's easy to forget how if you don't do it often enough. There are quite a few gems to help you write other gems, but if you're using Rails 3, there's already a gem on your system that does this: Bundler.



Constants in Ruby

Like just about every programming language every conceived, Ruby supports constants. A constant is a variable whose value cannot be changed. However, in Ruby, this has some caveats.



Sinatra URL Matching

How do do various types of URL matching in Sinatra.



The Mechanize Agent

Mechanize can be configured to use HTTP proxies. Some network configurations require you to use HTTP



Using Buttons in Shoes

In a Shoes application, the button is one of the simplest elements. This tutorial will teach you how to make the most of the your GUI toolkit in Ruby.



Unit Tests

Learn the basics of writing and running unit tests for test driven development in Rails.



Cloud Computing and Ruby

Why are cloud computing and Ruby on Rails a good match? Let's hear what Hampton Catlin, author of HAML and Wikipedia's head Ruby/mobile architect has to say!



Database-driven Apps

This article will create a rolodex application that can be used to keep track of contact information. The total line count is about 130 lines, split about half and half with code and views.



The Page Class

Most likely, you'll be wanting to find links and click on them. There are three methods that help you



Using Structs and OpenStructs

Storing key/value pairs in Ruby doesn't always need to be accomplished by using a hash. You can also use the Struct and OpenStruct classes.



Adding RESTful Authentication

Part three of the Ruby on Rails blog tutorial uses the RESTful authentication plugin to make sure only authorized users can make posts to your blog.



Vim

A review of the Vim text editor for writing Ruby code.



Email Addresses

Using regular expression to tell if an email address is valid or not.



Worked Example: Tabular Data

Much is made of the two base data structures in Ruby: the Array and the Hash. However, it's also quite easy to use two dimensional arrays in Ruby.



Ruby vs. PHP

What are the similarities and dissimilarities between Ruby and PHP?



Checking Your Email with Ruby

How to check POP3 email accounts in Ruby.



Using Temporary Files

There are many hidden pitfalls when using temporary files. Ruby's Tempfile class solves many of these.



Installation Instructions

Instructions for installing Ruby on Windows, Mac OS X and Linux as well as instructions for installing a few Ruby-related extras.



Installing Ruby 1.9.1 on Linux

Install Ruby 1.9.1 on your Linux machine alongside your current Ruby 1.8.x distribution to upgrade it. You'll have to compile the code from source, as shown in this tutorial.



Upgrading to 1.9.2 Using RVM

If you already have a Ruby like 1.9.2-rc2 installed with a number of gems and want to upgrade to 1.9.2-p0, the following steps will get you there. As expected,RVM makes this quite easy.



Test Suites

Grouping your test cases into test suites.



Forms

Buttons primarily exist to submit forms. They may be there for different reasons, however, that will



Displaying Images With Shoes

Displaying images using the Shoes GUI toolkit is as simple as using the image method. This tutorial walks you through adding images in Shoes.



What Did I Change?

Getting a list of changes is useful, but what about getting a diff of what exactly was changed? A diff is a listing of all parts of a file that differ. So, for example, it'll tell you that you removed three lines and added 4 new lines. It's a way of both seeing what was changed and sending those changes to other developers without having to send them the entire file.



The First Test

Learn to start writing Ruby code using Test-Driven Development.



Using the Enumerable Module

By using the Enumerable module, you can make any of your classes act like Ruby standard collections. All you need to do is implement the 'each' method.



Listing Known Rubies

In RVM-speak, a "Ruby" is a version of Ruby either installed or it knows has to install. Before you can



Learn to Use Regex in Ruby

What is a regular expression and how do you use them in Ruby?



TDD

You may have heard of Test-Driven Development, but what does it really mean? Learn the reasons for using TDD and the features of it.



Exception Classes

Knowing how to make quick exceptions to catch and tell the difference between several conditions is a Ruby best practice you can't afford not to know.



Structure of a JSON Document

JSON is a data serialization format for communicating between applications. It's a text format that features a lightweight syntax and closely mirrors the common data structures in modern programming languages.



Base64 in Ruby

Base64 is a way to represent any data as ASCII data. Ruby provides a few handy functions to encode and decode Base64.



Dynamic Method Calls

If you're coming from a compiled language, it's easy to think that method calls are like native function calls. This is simply not the case in Ruby.



Ruby vs. Perl

How do Ruby and Perl compare in function and form?



Command Line Options

There are two forms of command-line options: long form and short form. Both long and short form options take arguments, each a little differently.



Global Variables

Global variables are not often used in Ruby, however, you should at least understand their usage should you ever encounter them.



On 'case' and 'class'

While dynamic programming and duck typing often make it a bad idea to do so, it's sometimes useful to do different things based on the type of a given variable.



GeoIP

Using GeoIP databases to correlate IP addresses and physical locations using the GeoIP gem.



Ruby on Rails 3 Tutorial Live Lessons

The Ruby on Rails 3 Tutorial by Michael Hartl is the antithesis of the rapid screencast approach. In the tutorial, the reader is walked through how to use Rails slowly and now with the live lesson video instructions Hartl has applied this philosophy to screencasts. They slow things down and show how to do things visually, and over the 18+ hours of video included they will show you how to use Rails from the ground up.



Creating the "Blog Look"

Part two of the Ruby on Rails blog tutorial focuses on using the Yahoo! UI library to help make your blog look like a blog.



Generating Random Numbers in Ruby

It's often useful in games, simulation and unit testing to generate random numbers, Ruby provides easy access to a pseudo-random number generator.



The Zen of Learning Ruby

Learning Ruby isn't often thought of as a Zen exercise, but that's exactly how the guys at EdgeCase saw it. Thus RubyKoans was born.



Spotlight on RubyGems: Cheat

Using the RubyGem 'cheat' for access to wiki-like cheat sheets.



What's New in Rails 2.2?

The release of Ruby on Rails 2.2 bring a new set of features to the table. While release 2.2 is only an incremental release and there are no major architectural changes, there are still some important thing you should know about.



CSRF With XSS

CSRF attacks on your site can also occur in conjunction with XSS breaches. The severity of the CSRF attack is dependent on the severity of the XSS vulnerability.



CSV Example: Complete Code

The following is the complete code for the "CSV Parsing" articles you can find here . As noted in the



The Four Quantifiers

Quantifiers tell how many times an element should be matched. Below is a list of all quantifiers supported by the Ruby regular expression engine, how to use them and examples of their use. Though you can get by with the common quantifiers such as + or ?, there are a few more you should know about.



POST Request

A POST request is used to submit forms or upload files.



Beginning Ruby

A review of the book Beginning Ruby: From Novice to Professional by Peter Cooper from Apress.



An Introduction to Shoes

This tutorial is a introductory look at the Shoes GUI toolkit for Ruby. You'll find it is easy to learn, making it a good option for beginning programmers to make Shoes online applications.



Using the Test::Unit Library

The Test::Unit library comes with a variety of assertions to make writing tests much easier. Learn what the assertions are for Test-Driven Development and when to use them.



Local Variables and Bindings

Ruby has a no-surprise take on local variables, they're handled similarly in most programming languages. However, Ruby implements them differently than stack-based languages.



Installing NetBeans

The NetBeans IDE created by Sun Microsystems is often associated with Java development. However, in the past few years, Sun has slowly been adding support for more languages to NetBeans. Ruby (and more specifically, JRuby) is one of those languages.



Making Digraphs in Ruby

Digraphs are extremely useful for hierarchical data visualization. However, they're not very easy to generate yourself. This is where Graphviz and the Graph gem come in.



Check HTTP Referrers

By checking if the server from which the request originates is the same as the server your application runs on, you can determine if the request was generated from your site or not. If an HTTP request lacks a Referer header you can also tell it was generated by hand or from a location where Refererwould make no sense (such as an email client).



Installing wxRuby

wxRuby, a GUI toolkit for Ruby which interfaces with wxWidgets, can be installed on Ubuntu Linux with relative ease.



Twitter With Ruby

Now that you have a handle on the Twitter API and parsing the data returned by Twitter, it's time to start tweeting!



Regular Expression Syntax

The basic syntactical elements of regular expressions in Ruby.



3 Ruby Scripts for Twitter

Exploring and knowing the Twitter API is fine, but what do you do from there? Here are 3 practical scripts to help you follow followers on Twitter, update your Twitter account via an RSS feed and to be notified of your friend's new Tweets as they come in.



Conditionals

How to use conditional statements in Ruby



Class Variables

Class variables in Ruby are more or less as you'd expect form an object oriented language. However, Ruby throws you a curveball you can use to your advantage.



Creating a Window in Gosu

First step to any game: create a window for drawing. This will also initialize the Gosu library, so it'll be ready to poll for input, play sound, etc. This article will also introduce the basic framework for games that will be used in all further articles.



Mouse and Keyboard Input in Gosu

Games are, by definition, interactive. Gosu makes this interaction straightforward with a simple interface for detecting and reacting to key and mouse button presses.



Loops

Ruby has a the usual and expect loops, as well as a number of loops specific to Ruby. It even has a way to define you own types of loops.



Spotlight on Gems: ShortURL

Shortening URLs for Twitter is much easier with the one-line interface provided by ShortURL.



One Tree to Rule Them All

Some problems seem difficult, there are just too many things to consider and it's going to become a mess. However, if you analyze it, there's often a single data structure that will make the whole thing easier.



CSV Example: Format Strings and Printing the ASCII Table

Now that all the data has been parsed from the CSV and sorted, it's time to print out the ASCII table. Format strings are used to print the data while staying in the lines, and a few tricks are used to make the ASCII table a bit more pretty.



Loading and Displaying Images

To oversimplify a rather complex topic, a game is a program that loads images and displays them at the screen. So vital to game programming, loading and displaying images is one of the first things you should learn. Gosu does a pretty good job of making this easy, to a certain degree.



CSRF Without XSS

CSRF attacks are similar in nature to Cross-Site Scripting (XSS) attacks and can occur in conjunction with an XSS attacks, but they don't always go hand-in-hand and differ in nature. While XSS attacks rely on HTML code injected into the target site, a CSRF attack may also be initiated from a second site.



Ruby Version in Your Bash Prompt

With RVM installed on your system, it's easy to have many versions of Ruby installed. And, especially if you switch between them often, it's easy to forget which Bash command prompt is using which Ruby version. You can solve this by putting your Ruby version in your Bash prompt.



Everything You Need to Know About Variables

Variables are named references to objects in memory. Their several variants (local, instance, class, constant, etc) each have their own subtleties.



Named Character Classes

A listing of the named character classes available to you in regular expressions in Ruby.



Deploying Applications with Bundler

This article was written for Bundler version 1.0. If you are using a later version of Bundler, the commands



Cryptographic Hashes in Ruby

Generating cryptographic hashes in Ruby is quite easy. Ruby provides both a built in method and gives access to OpenSSL's hashing algorithms in most installations.



Using Attributes

There are two basic things you can do with an object: call a method on it and access an attribute. Ruby doesn't make a distinction between these things, but it does give you some tools to make some methods act like attributes.



assert_equal

The base assertion in the Test::Unit library. assert_equal will not fail as long as its two arguments are equal.



Key/Value Pairs

Any value associated with a key identifying it.



Using Rack Middleware

One of Rack’s greatest features is the ability to easily plug in middleware applications.



Installing Ruby on Windows

A visual walkthrough on installing Ruby on Windows.



Garbage Collection

Garbage collection is the process of freeing unused objects. It's a hallmark of many high level languages, including Ruby.



Array

An ordered collection of values, often assigned to a variable. In Ruby, the array takes the place of all ordered collections. They act as arrays, lists, stacks, queues, etc.



Try Ruby!

You can learn Ruby for free with this online tutorial, Try Ruby! A quick profile of why the lucky stiff's in-your-browser Ruby lessons for beginners.



Ruby's Bignum Library

Computers are quite good at math or, more precisely, at arithmetic. In fact, technically, that's all a computer can do. However, the numbers computers typically work with are quite limited. On a typical computer, an integer number is represented by a 32-bit binary number. A 32-bit integer can only represent the numbers from about negative 2 billion to positive 2 billion.



CSRF

Exploitation of a website utilizing the trust the site has for a certain user.



Colors

Adding foreground and background colors to your Shoes applications is easy. Shoes has a number of built-in color names that mirror the X11 Color Names used on Linux systems. You can also use HTML-style RGB hex values. Here's how to do it.



Tk Widgets

How to use some of the most basic Tk widgets.