Working with Ruby
Hi, I am Jan. This is my old Ruby blog. I still post about Ruby, but I now do it on idiosyncratic-ruby.com. You should also install Irbtools to improve your IRB.

Why you should switch to 1.9: Three Ruby 1.8 bugs

Ruby 1.8 dies in June 2012. This post shows some small examples, why this is good ;)

…read

New features of Ruby Zucker version 2 and 3

The Zucker gem has gotten some new features. Installation is as easy as
 gem install zucker
and
 require 'zucker/all'

…read

Introducing Ruby Zucker - a new syntactical sugar gem

Zucker is a collection of lightweight scripts (cubes) that make Ruby even more beautiful: rubyzucker.info

…read

RubyBuntu -2- Troubleshooting common Ruby ubuntu problems

A common Ruby experience on ubuntu: You get some stupid error, saying something would be missing – and you don’t know what to do…

…read

RubyBuntu -1- Installing Ruby (and Rails) on ubuntu

Installing Ruby/Rails on ubuntu is not hard, but some little obstacles might be confusing.

…read

Project Euler 1-5 (Ruby)

projecteuler.net tries to get you thinking about how to solve mathematical problems by programming. Here are the first five problems, solved in Ruby, including comments.

…read

Oh, this sweet and tasty syntactic sugar!

This article is written for people with experience in programming in general, but who are new to Ruby.
A German version is published in the offline magazine #2, a magazine by some students of TU Dresden.

The intention is to demonstrate some features of Ruby and show, what is so great about Ruby:

A clean syntax combined with the possibility to adapt the language to given requirements flexibly.

…read

Ruby Brainfuck golf [Update]

Some days ago, I discovered a website – which is the most addicting one I know :) – codegolf.com. The goal is, to solve programming problems with as short code as possible.

As I said, it is addicting. You do not write better ruby code by golfing. But you can really improve the knowledge of the language. And it is fun :)

Brainfuck

After doing some of the other challenges I tried the brainfuck challenge.
Brainfuck is a Turing-complete esoteric programming language consisting only of 8 letters, operating on a 30000 cells-array. This is the hello world program:

>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

The goal is to build a interpreter.

…read

Converting decimal to binary integers: custom methods vs. to_i [Update]

At my last entry, a question arose about what is the most efficient way to convert integers between the bases 2 and 10: either using built-in ruby methods (and even do lightweight string-operations) or calculating it manually. I had to find out ;). So I have written a little benchmark program, which does the conversion in three different ways:

  1. using built-in to_i-magic
  2. calculating it by hand
  3. using sprintf

It stops the time each method needs to get the fastest. The result might be surprising. [Update: improved the custom methods]

…read