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.

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

Quicksort in 5 minutes

Some time ago, I conducted a short presentation about Ruby. And to impress the audience, I did some live coding and implemented the quicksort algorithm in 5 minutes. They were impressed :)

…read

Troubleshooting an aegis-permission problem

In my current Rails project, I use the aegis gem for rights management. And I almost got mad, wondering, why it wouldn’t work..

…read

PlasmaRails.org

plasmarails.org

PlasmaRails.org is an online RDoc for Edge Rails, which is regenerated every day. It is based on sdoc with some custom css.

Update 06.06.2010: Relaunched with better stylesheets!

…read

Playing with Dijkstra

About a year ago, some students at my university announced a little programming competition for students beginning studying IT, like me. The language could be chosen freely.

At this time, I had already done some C and PHP programming.. but I also had heard of Ruby and that Ruby is sooo cool. So I decided to learn the basics of Ruby by taking part… and it’s been the right decision! I fell in love with Ruby ;).

I publish my solution here. It is a good “try to understand what it does”-exercise for people new to Ruby or programming in general (or people doing Rails only all the time).

…read

Create an offline version of the Ruby docs

When I began programming Ruby/Rails, I quickly found the online Ruby documentation at ruby-doc.org and the Rails API, which are both very useful. But unfortunately, one cannot be always online. In this blog post, I’ll demonstrate some ways to generate or get the docs offline and some hints on using them.

…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