Working with Ruby
Occasional blog posts about Ruby updates, tools, editor tweaks, and random snippets. You might also be interested in my newer project that docuements lesser-known features in Ruby: Idiosyncratic Ruby.

Connect to an oracle database using jdbc on JRuby in a jar file

This is how you can use JRuby to connect to an oracle database without requiring Ruby to be installed on the system, but only Java.


Things I learned while implementing version 1.0 of pws

After releasing version 0.9 of my cli password manager, I received friendly feedback and suggestions, which encouraged me to further improve it. Here are some of my experiences implementing pws 1.0:


Access the system clipboard with JRuby

This is my first jruby code (written for the clipboard gem) and I was quite surprised that you only need one-liners ;)


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]