Archive

Posts Tagged ‘Code’

code swarm, now with avatars!

January 28th, 2009

I have been a contributor to code swarm since it has become open source. Mainly I have been involved in making the OpenGL part of it work nicely. Today I ran into a nice code_swarm video from the Rails project in which I noticed some really nice avatars in the visualisation, please see the video below.


Ruby on Rails from Ilya Grigorik on Vimeo.

This is actually an enhanced implementation of code_swarm by rictic! I added his project to my github watch list, perhaps the feature is a nice one to merge back into the main code_swarm project.

Code , , ,

2008 in review

January 9th, 2009

The year 2008 is well behind us and as many bloggers I guess a nice little review of the year is in place.

For me personally it was a year not to forget in a long time. After holding back 12 years I was convinced that a drivers license would be a “good thing” to have. I went through a 10 day program, driving each single day for hours at end, just to fail the examn on a small technicality. This was a not so nice experience, but I bought some more lessons and the 2nd time around I passed without any form of criticism! Since then I made a lot of trips with my girlfriends car and 2009 might even see a car of my own :).

In July my divorce was finalized! And to celebrate a great Iron Maiden concert!

At the end of the year I received an email from an old friend who pointed me to an interesting job opening at the company she works for. I went in for an exploratory meeting and after a couple of days of going by them and meeting different people I was convinced to switch jobs. This means that from February 2009 I will no longer be working for eBuddy, but for a local company called InfoMedics.

My girlfriend surprised me with a Playstation 3 during the December month and after a setup change and a lot of re-wiring I actually boxed up my Xbox 360 in favor of it. I completely love the PS3 system, it nicely fits into my home entertainment system, has great games, is not so noisy as the big white thing and has some great integration points.

The games for this year were Gears of War 2 (360), FarCry 2 (360), Little Big Planet (PS3) and Call of Duty: world at war (PS3).

As for books this year it has generally been light reading with a few computer related ones: iPhone SDK development, Programming Erlang, Mastering the Requirements Process, Requirements Analysis and Systems Design.

The most interesting light reading I found to be And the Hippos were boiled in their tanks by William S. Burroughs and Jack Kerouac and Mort a Terry Pratchett novel.

I didn’t do a lot of programming on the side, except for code swarm and color theme zenburn for GNU Emacs. Photography was also in a slum in 2008, hopefully to be revived in 2009.

As you might have noticed from the books this year was focused on learning new things; Erlang and iPhone development in particular, as well as extending my knowledge on the requirements process.

I hope to do some nice Erlang programming this year and perhaps learn some other new technologies as well.

All in all a great year with another one already started!

Life , , , , , , , ,

2008 in review

January 9th, 2009

The year 2008 is well behind us and as many bloggers I guess a nice little review of the year is in place.

For me personally it was a year not to forget in a long time. After holding back 12 years I was convinced that a drivers license would be a “good thing” to have. I went through a 10 day program, driving each single day for hours at end, just to fail the examn on a small technicality. This was a not so nice experience, but I bought some more lessons and the 2nd time around I passed without any form of criticism! Since then I made a lot of trips with my girlfriends car and 2009 might even see a car of my own :).

In July my divorce was finalized! And to celebrate a great Iron Maiden concert!

At the end of the year I received an email from an old friend who pointed me to an interesting job opening at the company she works for. I went in for an exploratory meeting and after a couple of days of going by them and meeting different people I was convinced to switch jobs. This means that from February 2009 I will no longer be working for eBuddy, but for a local company called InfoMedics.

My girlfriend surprised me with a Playstation 3 during the December month and after a setup change and a lot of re-wiring I actually boxed up my Xbox 360 in favor of it. I completely love the PS3 system, it nicely fits into my home entertainment system, has great games, is not so noisy as the big white thing and has some great integration points.

The games for this year were Gears of War 2 (360), FarCry 2 (360), Little Big Planet (PS3) and Call of Duty: world at war (PS3).

As for books this year it has generally been light reading with a few computer related ones: iPhone SDK development, Programming Erlang, Mastering the Requirements Process, Requirements Analysis and Systems Design.

The most interesting light reading I found to be And the Hippos were boiled in their tanks by William S. Burroughs and Jack Kerouac and Mort a Terry Pratchett novel.

I didn’t do a lot of programming on the side, except for code swarm and color theme zenburn for GNU Emacs. Photography was also in a slum in 2008, hopefully to be revived in 2009.

As you might have noticed from the books this year was focused on learning new things; Erlang and iPhone development in particular, as well as extending my knowledge on the requirements process.

I hope to do some nice Erlang programming this year and perhaps learn some other new technologies as well.

All in all a great year with another one already started!

Life , , , , , , , ,

Kings of Code, a Bunny and a Drivers license

May 31st, 2008

It’s been a while since I posted on my blog and there have been some interesting happenings in my life.

First, last week I finally passed my drivers examn. Almost 12 years later then anyone else, but still sooner then some other people :). To actually get a drivers license in The Netherlands now you first pass the examn, then the CBR (the goverment branch that arranges driver tests) sends your result electronically to the city databases. The next day you can go and request a drivers license at city hall, at this point you are still not allowed to drive however. I now have to way 5 days before actually getting my drivers license, but then a new danger will be on the road! :)
I drove with a very nice organisation called ANWB which I can wholeheartedly recommend. I failed miserably on my first examn; nothing is ever easy ;)
Next up is Kings of Code. eBuddy actually sponsered the event, so pretty much every developer of eBuddy was there listening to the various talks. There were numerous interesting talks:

Peter Paul Koch
I missed out on most of this talk, but PPK had much to say about event handlers. He is quite a natural in giving presentations and everybody I talked to found it very informative (slides)
Folke Lemaitre (Netlog)
netlog.com is one of those sites you hear very little about but then you realise that half the world uses it. A community site much like Hyves or myspace, only not as ugly as those. Folke showed us how they handle scalability of databases and HTML caching. The most interesting part of the discussion was about how they utilized memcached to provide content caching and MySQL read offloading. A two thumbs up presentation from my part.
Mark Birbeck (W3C)
As a representative from the W3C Mark gave an insight into RDFa. I had a long discussion with him afterwards about the feasability of the semantic web.
Nate Abele (CakePHP)
This guy didn’t make a lot of friends during the conference. Apparently the current way to win souls for you PHP project is by telling people how messed up the project lead is for the other project. This talk also spurred a Rails vs PHP ditchotomy (as john resig so aptly called it). Not very productive I think.
Nate Koechley (Yahoo!)
The second Nate was awesome however. He talked about the performance of websites; many things were not new to me but the presentation was awesome nevertheless. I think a lot of the attendees went home with a lot to think about and hopefully it will lead to some better designs on the web.
Open Source Pitches
I didn’t attend most of the OSS pitches, so I have very little to say about this.
Menno van Slooten (eBuddy)
Menno gave a smooth overview on the history of web development and the need to give future web developers education in order to bring the skill level up to the next level.
John Resig (Mozilla)
I spent a fair amount of time talking to John before his talk about processing and some other projects. His talk was about choosing a Javascrip library by comparing 4 different ones. I didn’t find it very usefull, since I have very little to do with Javascript libraries, however a lot of people that I talked to who do have to choose found if very informative. John also showed a project called Sizzle, which he will release soon hopefully.

On a very happy note the Blender Foundation has released it’s second open movie project: Big Buck Bunny. Their website is quite overloaded at the moment, but they also put the movie on Youtube. Very funny and well worth the 10 minutes of my time :). Great job guys!

Blog, Code , ,

Playing games

April 5th, 2008

I like playing games, from board games to computer games to logic puzzles. However, the type of puzzles that intrigue me most are the logic puzzles that really need a computer to be solved (or perhaps I am too lazy to think them through all the way and a computer is a really useful tool for anyone too lazy to think puzzles through for themselves?).

Luckily for me, one of my colleagues and friends, Menno also likes these types of puzzles and we have been playing the game of ’solve this problem with a computer program’ for some time now. The interesting part of it is that Menno programs in JavaScript while I program in C++, Java or Emacs Lisp.

Some of the puzzles we have tackled up to now include ‘17 square’ and ‘The N Queen‘ problem. With 2 people looking at a problem individually of course yields 2 completely different solutions, especially when the solutions are programmed in 2 totally different languages.

Since these type of puzzles take up a lot of my spare programming time I figured it would make good blog posts and might inspire Menno to post his solutions as well.

The first puzzles I would like to pose is the Eight Queen problem, also known as N Queen, since you can pose it with an arbitrary number really.

The problem states that you have a board of N by N squares on which you want to place N Queens (with the movement restrictions of the chess game, just to be clear) in such a manner that none of the Queens are attacked. This problem has 92 possible solutions of which 12 are unique, the rest are reflections or rotations of the board.

Many approaches will lead to a solution of this problem but I chose to use recursion to solve it and implement it in Java, although I have a partially working Emacs Lisp version as well, but am having some weirdness with the recursion not ending up the way I expected it…

Without further lingering, here is my solution:

package credmp.games;
 
public class EightQueens {
    private int SIZE = 8;
    private int board[];
    private int solutions = 0;
 
    public EightQueens() {
	board = new int[SIZE];
    }
 
    public EightQueens(int size) {
        this.SIZE = size;
	board = new int[SIZE];
    }
 
    public int getSolutions() {
        return solutions;
    }
 
    public void solve(int row) {
        for (int column = 0; column < SIZE; column++) {
            if (is_safe(board[row - 1] = column, row - 1)) {
                if (row < SIZE) solve(row + 1); else print_board();
            }
        }
    }
 
    private boolean is_safe(int column, int row) {
        for (int i = 1; i <= row; i++) {
            int current = board[row - i];
            if (current == column ||
                current == column - i ||
                current == column + i)
                return false;
        }
        return true;
    }
 
    private void print_board() {
        ++solutions;
        for (int i = 0; i < (SIZE * 4 + 1); ++i)
            System.out.print("-");
        System.out.println();
        for (int row = 0; row < SIZE; row++) {
            for (int column = 0; column < SIZE; column++ ) {
                System.out.print(column == board[row] ? "| X " : "|   ");
            }
            System.out.print("|\n");
            for (int i = 0; i < (SIZE * 4 + 1); ++i)
                System.out.print("-");
            System.out.print("\n");
        }
    }
 
    public static void main(String args[]) {
        long start = System.currentTimeMillis();
        EightQueens eq = new EightQueens(8);
        eq.solve(1);
        long end = System.currentTimeMillis();
        System.out.println("Time spent: " +
                           (end - start) + "ms for solutions:" +
                           eq.getSolutions() );
    }
}

Code , ,