Wrongly used randomness can be the source of hard-to-detect bugs and security holes. This is relevant every time you use randomness, for example, when implementing an existing protocol/interface that requires random values or generating tokens for your next raffle. This article describes when to use which of Ruby’s randomness methods.
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:
pws: The ruby-powered command-line password manager
- stores your passwords in a file on your disk
- encrypts the file with a master password
- is designed for every-day-use
- is written in
234lines of understandable Ruby code… Read it! - is tested with 222 Cucumber steps
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 ;)
Project Euler 19, 20, 21, 22, 23, 24, 25 (Ruby)
The next pack of Project Euler solutions.
Do you know the official Ruby interpreter "goruby"?
## ## ## ## ## ## #### ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ######### #### ## ## ######### #### ## #### ## ## ## ## ## ## ## ## ## #### #### ## ## ## #### ## ## ##
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'
Introducing Ruby Zucker - a new syntactical sugar gem
Zucker is a collection of lightweight scripts (cubes) that make Ruby even more beautiful: rubyzucker.info
Project Euler 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 (Ruby)
More solutions for the projecteuler.net problems. Some of them are solved using 1.9.2 features.
New Array and Enumerable methods in Ruby 1.9.2: keep_if, chunk...
In Ruby, dealing with Arrays and similar objects is pretty fun. And we have gotten more possibilities with Ruby 1.9.2 :)
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…
RubyBuntu -1- Installing Ruby (and Rails) on ubuntu
Installing Ruby/Rails on ubuntu is not hard, but some little obstacles might be confusing.
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.
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.
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).
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:
- using built-in to_i-magic
- calculating it by hand
- using sprintf
It stops the time each method needs to get the fastest. The result might be surprising. [Update: improved the custom methods]
Storing an array of indices in an integer
Sometimes you have an array of indices. These might, for example, act as flags, whether some specific options are set or not. A nice way to store this list is, to store it in one single number.