Uncategorized November 25, 2013 @ 01:14

Docstring-based Type Inference

Some python coders enjoy torturing themselves by using glorified notepads of which the most advanced feature appears to be syntax coloring. Conveniences such as debugging, code hinting and syntax error reporting would be redundant. After all, you can get all that by using the console and running your program, right?

I guess I’m just a slight bit too lazy for that. I’d like to have my potential coding flaws reveal themselves as quickly as possible. The first few lines I probably typed in Nano, because Python is so much nicer than shell scripting, but while writing more, I went for good ol’ Eclipse ‘n’ PyDev. Awesome stuff, it even has rudimentary refactoring capabilities; SHIFT+CTRL+R has become an comfortable hand pose for me.

After the sprint to deliver our last project, down time set in and that means trying out new stuff. PyCharm! It does most (if not all) that PyDev delivers and then some! Refactoring nearly looks as if it actually works, it looks nice (very important) and it is able to infer function argument types from a well-formatted docstring!

It’s almost like using a strongly-typed language again. Well, not really, but at least you don’t have to look up every little type in an api doc in order to see what is available and how to use it.

Consider this:

class Action():
    def jump():

def run():

def walk(v):
    @type v: Action


After that dot is typed in, PyCharm will obediently list jump() in a popup list.

It does in fact not warn you about passing unwanted types into that function, but that would defeat the purpose of using Python, wouldn’t it?

Anyhow, I enjoy working with this language more every day, especially when I’m having my collection of braces and crutches to lean on while digging through unexplored territory (read: libraries).

Code / Development / My Own Stuff / Unity September 25, 2013 @ 12:01

Clamped Bezier Spline for Unity

There are probably a many more of these BSpline implementstions to be found on the interwebs, so here’s another one:

using UnityEngine;

public class BSpline {
    private BSpline() { }
    public static Vector3 GetPoint(Vector3[] cvs, float t) {
        int segCount = cvs.Length - 1;
        float u = t * segCount;
        float v = u % 1;
        int seg = Mathf.FloorToInt(u);
        if (seg >= segCount) {
            v = 1;
            seg = segCount - 1;
        } else if (seg < 0) {
            v = 0;
            seg = 0;
        Vector3 a, b, c ,d;
        if (seg == 0) {
            a = cvs[seg];
            b = cvs[seg];
            c = cvs[seg+1];
            d = cvs[seg+2];
        } else if (seg == segCount - 1) {
            a = cvs[seg-1];
            b = cvs[seg];
            c = cvs[seg+1];
            d = cvs[seg+1];
        } else {
            a = cvs[seg-1];
            b = cvs[seg];
            c = cvs[seg+1];
            d = cvs[seg+2];
        return curveFunction(a, b, c, d, v);
    private static Vector3 curveFunction(Vector3 a, Vector3 b,
            Vector3 c, Vector3 d, float t) {
        float it = 1 - t;
        float t2 = t * t;
        float t3 = t2 * t;
        float b0 = it * it * it / 6;
        float b1 = (3 * t3 - 6 * t2 + 4) / 6;
        float b2 = (-3 * t3 + 3 * t2 + 3 * t + 1) / 6;
        float b3 = t3 / 6;
        return b0 * a + b1 * b + b2 * c + b3 * d;
Music May 2, 2012 @ 14:57

Mesmerizing 8-Bit Music

Just in case you’ve landed here (ah, there you are!), you’re interested in games and you haven’t heard about Fez yet. Play this game and while you’re doing that, stop to listen to its music every now and then. I couldn’t help myself and bought the soundtrack almost immediately when it became available.

The album is composed to sound like it came directly out of an old NES box, adding to the pixelated retro-experience Fez is. Every sound is carefully constructed from simple oscillators and noise generators. But if you listen closely, you’ll hear that almost every sound is imperfect and slightly out of tune to contribute to the effect of nostalgia. The whole thing carries that feeling of ‘back then’, just wonderful!

Listen and/or buy here


Code / Development / My Own Stuff April 11, 2012 @ 13:13

Python in French

# Pour Rudy, qui ne comprends pas un mot de Python quand c'est en Anglais.
import sys
dites = sys.stdout.write
ouvrez = open
lire = 'r'
ecrire = 'w'
fichier = 'd:/temp.txt'
texte_a_ecrire = u'Bonjour beau monde!'

dites('Je vais ouvrir un fichier qui s\'appelle %s\n' % fichier)
objet_fichier = ouvrez(fichier, ecrire)

# Traduire quelques fonctions
ecrivez = objet_fichier.write
fermez = objet_fichier.close

dites('Et maintenant, je vais ecrire cette texte dans le ficher: "%s"\n' % texte_a_ecrire)

dites('J\'ai ecrit et ferme le fichier, maintenant je vais ouvrir le meme ficher et dire ce qui se trouve de dedans.\n')

objet_fichier = ouvrez(fichier, lire)

# Encore plus des traductions
lisez = objet_fichier.read
fermez = objet_fichier.close

la_texte_dans_le_fichier = lisez()
dites('La texte dans le fichier: %s' % la_texte_dans_le_fichier)

dites('Et voila, je disais tout que je vourdrais dire, merci!\n')
Music by me / My Own Stuff March 13, 2012 @ 00:53

Mountain Cast

For about 5 hours of fiddling and twisting, I was quite enchanted by what I’d be able to come up with. To be honest, I’ve been tweaking this one already a bit further than what you’re about to hear, but that’s for later. Maybe.

Music by me / My Own Stuff March 13, 2012 @ 00:48

Vintage: Red Dot Soundtrack

Here’s an oldie I just decided to put up here. Kinda liked it back then and it still sort of sticks with me.

Little story attached: We were at a nerdy computer party and beside the regular demo contests, they had an animation contest going on.

Pieter, Harm and I had fiddled around with 3D modelling/animation software for some time and I’d decided to put some work in mixing a couple of experiments together into what seemed to have become some sort of video-clip. Sound was needed, so I spent many hours in FastTracker (de-facto pc-music creation software for geeks back then) and this tune rolled out of it.

Anyhow, we entered the competition at the party and we got second place. But we got a lot of appreciation, which was really nice. So maybe it’s this that made me still remember the track and put it up here.

So, if you like it, cool! If not, well, you decided to come here! ;)

Development / On the Web / Tips March 2, 2012 @ 09:20

WordPress Non-FTP Upgrades

Annoyed by having to enter FTP credentials every time you update WordPress or any of it’s plugins? Put this in your wp-config.php:

define('FS_METHOD', 'direct');

Might not work for you, but you could try, it did for me. Thanks to this post.

By the way, if you still have problems updating, make sure you set the correct access rights for your directories in wp-content.

Pictures January 14, 2012 @ 17:47

Les Ardennes 2011

Almost a year late, but I have to post these anyway. About 80 pictures, so watch the full album here.

On the Web June 22, 2011 @ 12:26

Talk About the Future

Let’s another link of this very good video on another website:

If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get Flash Player from Adobe.

Inspirations and Copies / On the Web June 22, 2011 @ 10:19

Seatbelts – Reich

I was listening to the Cowboy Bebop (Movie) soundtrack, Powder:

If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get Flash Player from Adobe.

And discovered it was heavily inspired by Steve Reich’s Desert Music (Movement 1):

If you can see this, then you might need a Flash Player upgrade or you need to install Flash Player if it's missing. Get Flash Player from Adobe.