How to align text on the whitespace after the first word character in vim.

Today I decided to make my factory_girl factory definitions look a little bit more pretty. My tool of choice for alignment in Vim is the famous Align plugin. It turned out the task at hand is not as trivial as one might think at the first glance. By additionally harnessing the power of the mighty vim regexp the solution is so damn simple that I almost cried because I wasted 10 minutes on this, so here is my solution.

Continue reading How to align text on the whitespace after the first word character in vim. →

How to start your RSpec / Cucumber / Spork / Watchr test environment with a single command

My Rails 3 test environment consists of RSpec, Cucumber, Spork and Watchr. Additonally I am running rails console and rails server. This means I have to spawn six terminals or on terminal with six tabs. My preferences lean towards the tab solution. I am setting this up just once or maybe twice a day, but in my humble opinion it is pretty annoying to do this by hand. Continue reading How to start your RSpec / Cucumber / Spork / Watchr test environment with a single command →

Genetic Algorithm vs. 0-1-KNAPSACK

DNAThe Genetic Algorithm is the most widely known Evolutionary Algorithm and can be applied to a wide range of problems. After explaining the basic principles, I will show how to apply the Genetic Algorithm to the so-called 0-1-KNAPSACK problem and come up with an implementation of a suggested configuration [1] for the algorithm in Ruby. Finally there will be a short investigation of the behaviour and performance of the algorithm. Continue reading Genetic Algorithm vs. 0-1-KNAPSACK →

The tale of why I chose Vim over Emacs and any IDE.

Some month ago I watched someone hacking pretty impressive with Emacs . It was so fast I did not even get what he actually was doing. That day I decided to master Emacs to become as productive as he was. Some weeks passed and it started to feel really good. Until some friends at university told me they prefer vim. At first I thought something like “What’s this with the crazy mode stuff? Where is my C-x M-c M-butterfly?”. But once you get used to vim you will never miss it again. I made the switch and I am very happy. In this blog post I will clarify the reasons for my decision and introduce some resources that helped me getting up to speed.  Continue reading The tale of why I chose Vim over Emacs and any IDE. →

How to ignore changes in git submodules

Recently while setting up my vimfiles for version control I encountered a problem with git submodules. The plugins are included as git submodules and loaded up with pathogen. For those interested in details on how this works, there is a Vimcast available on this topic. Some of the plugins need to generate helptags or other files that will mark the working tree dirty. There is a very simple way to prevent this, but it is a little tricky to find out what is needed to make it work, that’s why I decided to write a blog post about how to do this.

Continue reading How to ignore changes in git submodules →

How to apply Naive Bayes Classifiers to document classification problems.

Within the last decades it turned out that it is often much easier to tell a computer how to learn to do a specific task rather then telling it exactly how to do it. One of the generic terms for this could be Machine Learning, which is basically summarized by Wikipedia as:

Machine learning, a branch of artificial intelligence, is a scientific discipline concerned with the design and development of algorithms that allow computers to evolve behaviors based on empirical data, such as from sensor data or databases.

In this blog post I will introduce a simple theory-meets-practice example showing how to classify documents using a Naive Bayes Classifier together with a supervised learning strategy.

Continue reading How to apply Naive Bayes Classifiers to document classification problems. →

How to extract plain text from HTML with Nokogiri

While working at an upcoming blogpost, I encountered the problem of extracting some plain text from HTML. If I was interested the whole plain text, I could just run html2text in bash and feed it with the HTML, but what I needed was just a specific part of the plain text between two certain comments. As it was hard to google a simple solution for this I decided to share mine.

Continue reading How to extract plain text from HTML with Nokogiri →

Understanding parameter passing in Java: Call By Value

Some of the first semester students participating in the lecture Algorithms and Datastructures where I am working as tutor seem to have problems understanding how parameter passing works in Java, so I decided to do a little writeup on this.

The most confusing part seems to be the passing of object references to methods, so I will mainly put the focus on this. But let us start with primitive parameters first.

Continue reading Understanding parameter passing in Java: Call By Value →

How to embed actions within every match of a one-or-more ( rule+ ) or zero-or-more ( rule* ) rule in ANTLR?

Yeah, well, the particular task is very simple if you know the solution. But when you are just getting started with ANTLR it is not that obvious what kind of things you can do within a grammar, and what you can not. I looked around the web for a while, but it was difficult for me to find a solution, so I will share it here.

Continue reading How to embed actions within every match of a one-or-more ( rule+ ) or zero-or-more ( rule* ) rule in ANTLR? →

New website

As you can see I have reworked my website. I thought it was time to become a little bit more serious and get rid of the senseless rubbish. For the future I will write 95% on programming or Computer Science in general. Hopefully there will be some more valuable posts and a higher rate of posts per month.

You may also have recognized that I write in English now. In my opinion it is necessary to have good English skills, especially as a programmer. Most of high quality literature is only availaible in English, open source projects communicate in English, API’s and manuals are in English and so on. So, I hope to improve my writing skills in English and I hope to reach more people than before.

But wait, what about the category German ? In my humble opinion some of my old articles are worth keeping them. At least some people discovered them through google, so they seem to be valuable somehow.

I’m looking forward to get some comments on what I have done so far, and especially on the future posts!