Skyline puzzle

One of my colleagues brought the following puzzle to work:

Skyline puzzle

The puzzle is called Skyline and it’s a packing puzzle. The objective is to place the metal rod in one of the holes in the base and place the nine wooden pieces around it. It was designed by Jean Claude Constantin. When solved, the puzzle looks something like this:

Skyline solution

Sometimes with these kinds of puzzles it’s quicker to write a program that finds a solution than trying to solve it by hand. Check out this github repository for a Prolog program that finds solutions for a given rod location.

To use this program open the file skyline.pl in your favorite Prolog interpreter (e.g. SWI-Prolog) and execute the following:

You can press ; to find alternative solutions. The pos(X,Y) part refers to the location of the metal rod.

MLP in C++11

In this post I present my Christmas gift to the world: A multilayer perceptron written in C++11.

I mainly wrote this to get some practice with some of the new C++11 features such as variadic templates and lambda functions. It uses template metaprogramming to construct (but not train) the neural network at compile time. You can download the code from its github repository. It’s lacking proper documentation, but I’ve included two examples that should get you started: the xor problem and Fisher’s Iris data set.

Happy Holidays.

Statisticians are evil

I’ve made it my life’s goal to replace all statisticians with cute little robot bunnies. Watch the following video for a demo of my first prototype.

I developed a server in Prolog for the Nabaztag:tag bunny and hooked it up with a dialogue system I created during my masters. It uses an unofficial Google API for speech recognition and generation. It’s quite slow sometimes because of the poor Wi-Fi connection, the inefficient polling of the Nabaztag and the speech recognition. I have some ideas though for improving its speed. Read on for a transcript of the dialogue with comments.

Continue reading

WhatStat

I’m teaching some courses on SPSS and statistics at the University of Groningen and one thing I notice over and over again is how difficult it is for both students and researchers to find an appropriate statistical technique for the kind of analysis they’d like to perform. There are so many to choose from!

I often point them to some decision tree they can use. For example, there is a nice and simple one on the last page of Andy Field’s Discovering Statistics using SPSS, a (by the way, awesome) book that many students already have.

There is however another book that is in itself one big (and I mean big) decision tree. You use it by starting on page three where it asks you: “How many variables does the problem involve?” Depending on your answer you are asked other questions and are eventually led to a statistical measure and/or test. The first two editions were published (in 1971 and 1974) under the title “A Guide for Selecting Statistical Techniques for Analyzing Social Science Data”. In 1998 a revised version came out under the title “Selecting Statistical Techniques for Social Science Data: A Guide for SAS Users”.

I thought it would be nice to incorporate that decision tree into a computer program or website. I wasn’t the first one who had that idea, see for example here and here. What to my knowledge hasn’t been done before is turn it into an app. There should be an app for everything, right?

The app I made is a web app. It’s called WhatStat and can’t be installed from an app store. You access it by pointing your mobile browser (e.g. safari) to whatstat.aswinvanwoudenberg.com. If you want you can add it to your home screen so that it behaves like a native app. It should work on most smartphones, new and old. It is based on the second edition of the book I mentioned above.

apple-touch-icon-114x114-precomposed

Vipassana

Vipassana is a meditation timer I wrote in an attempt to get some experience with the jQuery Mobile framework and web app development in general.

The timer uses the Web Audio API to produce the sounds and LocalStorage so it will only run on modern browsers with support for html5. I tested it on Google Chrome 31.0.1650.63 for Linux and iOS 7.0.4 Safari on the iPad and in both browsers the timer runs fine.

The meditation timer is Apple mobile web app capable, which means you can add it to the home screen of your iPad to make it run full screen. I haven’t tested it on an iPhone, but let me know in the comments if you did and if it works well or not.

You can check it out by pointing your (mobile) browser to http://vipassana.aswinvanwoudenberg.com.

 

VBA IBAN Validator

From February 2014 onwards, IBAN will be the new European standard for bank account numbers. This standardization is part of the SEPA initiative to improve the efficiency of cross-border euro payments. I wrote an IBAN validator in VBA for an MS Access database I’m maintaining, but you can also use it in Excel or any other application that supports VBA.

The function ValidateIban takes an IBAN bank account number and returns True if the number is valid and False otherwise. It checks if the length is correct as per country and if, after rearranging and converting the IBAN code to an integer, the remainder of the modulo 97 operation equals 1. See wikipedia for a description of how to validate an IBAN number.

countdown.sh

Sinterklaas kapoentje

Het is weer bijna Sinterklaasavond, dus tijd voor cadeaus, surprises en gedichten!

Een originele manier om je gedicht te presenteren is door middel van een Word document waarbij het gedicht woord voor woord verschijnt zodra je het document opent. Dit is vrij simpel te bewerkstelligen. Je schrijft eerst de tekst van het gedicht in een nieuw en leeg Word document. Vervolgens selecteer je alle tekst en maak je de kleur van de tekst wit zodat je niet meer kunt zien dat er wat staat. Door middel van de volgende VBA macro code maak je dan woord voor woord het gedicht zichtbaar:

Verder moet je dan nog wat code toevoegen om bovenstaande subroutine aan te roepen zodra het document geopend wordt.

Zie hier voor een voorbeeld. Denk er wel om dat je het uitvoeren van macro’s moet toestaan.