2008

2007

2006

2005

2004

IM ON UR DESK, MAKIN SUR U CODE PROPAH

▁ dec 20 2007

IMG00051

. o .

The Current Pros and Cons List for SimpleDB

▁ dec 18 2007
. o .

Undo commit in subversion (svn)

▁ dec 11 2007

A quick google search will turn up a few blogposts and forumthreads on how to undo a commit in Subversion. This is the easy way to do it, and also serves as a note for myself.

Example: You were working on rev 1707 and you committed some donkeycode that you have to remove. The donkey revision is 1708. You want to roll back.

user@host% svn merge -r 1708:1707 .
U    media/shared/css/admin.css
D    media/shared/js/ajax.js
U    settings.py
U    urls.py

OK, so some files were “updated”, meaning that the code you wrote is taken out, and some files are deleted, which are files that you added in your revision. Now check that it only made the changes you wanted it to:

user@host% svn diff

If it all looks OK, go ahead and commit your “rollback.” It’ll get a new revision number, but that’s how SVN works.

Hope this helps someone.

. o .

Battling Fibonacci

▁ dec 08 2007

There’s been some buzz lately over at programming.reddit.com where they’re comparing the speed of various languages, in calculating the fibonacci sequence.

So today, Vetle (who also has a birthday today, congrats!), posted an example in Simula.

Lets beat it! In D, that is.

import std.stdio;
void main() {
  for(int i = 0; i <= 36; i++) {
    writefln(fib(i));
  }
}
template fib(T) {
  T fib(T n) {
    if (n ==  0 || n == 1) {
      return n;
    } else {
      return cast(T)( fib(n - 1) + fib(n - 2) );
    }
  }
}

Runtime? A mere 0.863 0.742s ;) (with -O)

I can’t be bothered to post other benchmarks. Suffice to say, it’s fast.

UPDATE: Mads beat us with a C version that ran in 0.362s. He cheated by using -O3.

powered by