Automatic editing

For changing file contents, we often use editors. But sometimes it is a good idea to do this from a script and do a change to many files at once or do the same kind of changes often. The classic approach to this is using sed, which is made exactly for this purpose. But most …

Share Button

Git for Linux System Engineering

Now that git has become the standard version control software, which is used by software developers. Now for system engineering and system administration purposes it used to be an approach to just login and do something and remember it or even note it somewhere. Some people tried to just use RCS or SCCS on the …

Share Button

Getters and Setters

Deutsch When programming in Java, it is kind of part of the language to write classes with attributes and equip these attributes with „getters“ and „setters“. You could do otherwise, but you just don’t. But some criticism is of course allowed. Even if it only applies to the design of future languages or to minor …

Share Button

Object 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 commonly available. Traditionally in OO it was mandatory to write setters and getters. In C++ or Java they really …

Share Button

How 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 algorithmic formulation of how roots are taken manually, for those old enough to still have learned it in school. Earlier …

Share Button

Flashsort 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 depends always on the data and on how well the metric-function has been written, that is needed on top of the comparison function for Flashsort. You …

Share Button

LongDecimal

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 for the next article in about two weeks time. LongDecimal is a library that I have provided for Ruby. It is available …

Share Button

TruffleRuby

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 have not discovered in any other language that I know well and provides a lot of flexibility. …

Share Button

Logging

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 file. They are telling us something about what the software is doing. Usually we can ignore all of it, but as soon as …

Share Button

Meaningless 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 return, form feed, tabulator, vertical tab) has no meaning, as long as any whitespace is present. Examples for this are Java, Perl, Lisp …

Share Button