Ruby 2.0 coming soon
This is a translation of Ruby 2.0 in Sicht According to blade.nagaokaut.ac.jp Ruby 2.0 is almost finished. The new features are already known and a release 2.0.0-p0 is planned for Q1 2013.
View ArticleResidue Class Rounding
Deutsch If you do not know what residue classes are, just read on, it will be explained to the extent needed later on. The concept of rounding seems familiar, but let us try to grab it a little bit...
View ArticleMonads in Ruby
Monads? Easy! A Monad over X simply is a Monoid in the Category of Endofunctors of X. Monads? Really! Monads are a concept in mathematics Algebra is an area of mathematics Category theory is an...
View ArticleWhy I still like Ruby
Some years ago Ruby in conjunction with rails was an absolute hype. In the Rails User Group in Zürich we had meetups with 30 people every two weeks. The meetings every two weeks have been retained, but...
View ArticleTesting Java- and C-programs with Ruby and Perl
It is very important to write good unit tests for software that is non-trivial and that is relied on by other pieces of software. Often the logic of the software can easily be covered by the native...
View ArticleFind the next entry in a sequence
In Facebook, Xing, Google+, Vk.com, Linkedin and other of these social media networks we are often encountered with a trivial question like this: 1->2 2->8 3->18 4->32 5->50 6->72...
View ArticleConversion of ASCII-graphics to PNG or JPG
Images are usually some obscure binary files. Their most common formats, PNG, SVG, JPEG and GIF are well documented and supported by many software tools. Libraries and APIs exist for accessing these...
View ArticleWhat do +, – and * with Integer do?
When using integers in C, Java or Scala, we often use what is called int. It is presented to us as the default. And it is extremely fast. Ruby uses by default arbitrary length integers. But what do +,...
View ArticleHow to create ISO Date String
It is a more and more common task that we need to have a date or maybe date with time as String. There are two reasonable ways to do this: * We may want the date formatted in the users Locale, whatever...
View ArticleLazy Collections, Strings or Numbers
The idea is, that we have data that is obtained or calculated to give us on demand as much of it as we request. But it is not necessarily initially present. This concept is quite common in the...
View ArticleWhen to use Scala and Ruby
There are many interesting languages that have their sweet spots and of course a larger set of languages than just two should be considered for new projects. But Ruby and Scala are both very...
View ArticleLoops with unknown nesting depth
We often encounter nested loops, like for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { doSomething(i, j); } } This can be nested to a few more levels without too much pain, as long as we...
View ArticleMeaningless Whitespace in Textfiles
We use different file formats that are more or less tolerant to certain changes. Most well known is white space in text files. In some programming languages white space (space, newline, carriage...
View ArticleLogging
Deutsch Software often contains a logging functionality. Usually entries one or sometimes multiple lines are appended to a file, written to syslog or to stdout, from where they are redirected into a...
View ArticleTruffleRuby
The language Ruby is one of the most beautiful languages. A lot of things can be done, it has a good level of abstraction, it has chosen some very good defaults, has provided some great ideas that I...
View ArticleLongDecimal
Disclaimer: This article is an occasion, where you might need some of the presumably useless mathematics that you might have learned in school and university. If this bothers you, maybe you should wait...
View ArticleFlashsort in Ruby
Deutsch There is a simple implementation of Flashsort in Ruby, after having already provided an implementation in C. The C-implementation is typically faster than the libc-function qsort, but this...
View ArticleHow to calculate Square Roots and Cubic Roots
The functions sqrt and sometimes even cbrt are commonly available, but it is nice to see how they can be calculated. There are several approaches, but the most popular ones are Newton’s method and an...
View ArticleObject Creation: Builder vs. Constructor vs. Setter
When we create new objects, we are basically confronted with the need to provide at least one construction pattern. Of course depending on the language we have more or less three ways to go that are...
View Article