Bad bad Firefox

[ Posted by Urban Hafner Thu, 12 Jun 2008 13:39:00 GMT ]

A few days ago I bought a new DSLR (a Nikon D40) and started to upload more pictures to flickr (see http://flickr.com/photos/ujh for my photo stream). I also started looking at much more pictures on flickr from other people. And in one of those the photographer was complaining how bad the pictures looked on flickr. In a comment someone else explained that the problem is not flickr but Firefox! And true enough. The difference between Firefox and for example Safari is so big even I could see it! So if you like to look at pictures don’t use Firefox.

Tags , ,  | no comments | no trackbacks

For all the bass players out there ...

[ Posted by Urban Hafner Fri, 28 Dec 2007 18:03:53 GMT ]

I just happened to run across a guy recording himself playing bass on youtube. Here’s a sample:

It makes we want to start playing again. Maybe I can get somewhere close (well maybe not).

Tags ,  | no comments | no trackbacks

CGOS "rotation" script II

[ Posted by Urban Hafner Sat, 01 Dec 2007 14:29:26 GMT ]

Here’s the updated cgos.rb script. The main change is that the bots are chosen at random (instead of in the order specified).

#!/usr/bin/env ruby
#
# Run bots one after the other on CGOS. The BOTS variable is an array
# if directories of the bots. In each of these directory there has to
# be an executable file called 'cgos.sh' that connects the bot to CGOS.
# This executable is also required to set the sentinel file name to the
# one given in the TERM variable below.

require 'optparse'

# :bot    :: The directory containing you cgos connection script
# :script :: The name of the script (defaults to cgos.sh)
# :games  :: The number of games the bot should play in a row
BOTS = [
  {:bot => "libEGO-AMAF-3"},
  {:bot => "libEGO-AMAF-2"},
  {:bot => "erlygo"},
  {:bot => "libEGO-AMAF-2", :script => "cgos19.sh"},
  {:bot => "libEGO-AMAF-3", :script => "cgos19.sh"},
  {:bot => "erlygo",        :script => "cgos19.sh"}
]
# Sentinel filename to be used by CGOS
TERM     = "stop.txt"
$verbose = false

round       = 0
total_games = 0
games       = Hash.new {|h,k| h[k] = 0}

opts = OptionParser.new
opts.on("-v", "--verbose") { $verbose = true }
opts.on("-s", "--stop") do
  File.new(TERM, "w")
  exit
end

opts.parse(ARGV)

def time
  Time.now.strftime("%H:%M:%S")
end

# Clean up (if script wasn't terminated correctly)
(BOTS+[{:bot => "."}]).each do |bot|
  bot[:games]  = 1         unless bot[:games]
  bot[:script] = "cgos.sh" unless bot[:script]
  Dir.chdir(bot[:bot]) do
    File.delete(TERM) if File.exists?(TERM)
  end
end

until(File.exists?(TERM))
  round += 1
  if (round % 5).zero?
    games.each do |k,v|
      puts "#{sprintf("%03d", v)} games for '#{k}'"
    end
  end
  bot = BOTS[rand(BOTS.length)]
  puts "[#{time}] Running '#{bot[:bot]}' (#{bot[:script]}) for #{bot[:games]} games"
  last_was_print = false
  Dir.chdir(bot[:bot]) do
    IO.popen("./#{bot[:script]} 2>/dev/null") do |pipe|
      until(pipe.eof?)
        line = pipe.gets
        if $verbose
          puts line
          STDOUT.flush
        end
        case line
        when /gameover/
          line =~ /gameover\s+\d\d\d\d-\d\d-\d\d\s+(\S+)/
          print "\n" if last_was_print
          puts "[#{time}] #{$1}"
          last_was_print = false
        when /setup/
          File.new(TERM, "w") if games[bot[:bot]] >= (bot[:games]-1)
          games[bot[:bot]] += 1
          total_games      += 1
          line =~ /setup\s+.*?(\S+\(.*\)\s+\S+\(.*\))/
          print "\n" if last_was_print
          stats = "(game #{games[bot[:bot]]} of #{bot[:games]}, #{total_games} games in total)"
          puts "[#{time}] #{$1} #{stats}"
          last_was_print = false
        when /info/
          unless $verbose
            print "."
            STDOUT.flush
            last_was_print = true
          end
        end
      end
    end
    File.delete(TERM) if File.exists?(TERM)
  end
  round += 1
end
File.delete(TERM)

Tags , , , , , , , , ,  | no comments | no trackbacks

CGOS "rotation" script

[ Posted by Urban Hafner Wed, 10 Oct 2007 14:18:38 GMT ]

While playing around with libEGO and trying to see how far I can get with a simple “all-moves-as-first” Monte Carlo bot. I wrote many (well, three) different versions of the same bot and tested them against each other. Of course for a real test I had to use CGOS. But as I only have one computer that I also use for work I had to run the different bots one after the other. To automate that I wrote a small script that lets you run any number of bots in rotation on CGOS.

It’s a very simple script written in Ruby, so you’ll need to have that installed. For the rest see the comments at the beginning of the file.

#!/usr/bin/env ruby
#
# Run bots one after the other on CGOS. The BOTS variable is an array
# if directories of the bots. In each of these directory there has to
# be an executable file called 'cgos.sh' that connects the bot to CGOS.
# This executable is also required to set the sentinel file name to the
# one given in the TERM variable below.

# Number of games for each bot
GAMES = 1
# The bots that should play
BOTS = ["libEGO-AMAF", "libEGO-AMAF-2", "libEGO-AMAF-3"]
# Sentinel filename to be used by CGOS
TERM  = "stop.txt"

round = 0

if ARGV.length > 0 and ARGV.first == "stop"
  File.new(TERM, "w")
  exit
end

# Clean up (if script wasn't terminated correctly)
(BOTS+["."]).each do |dir|
  Dir.chdir do
    File.delete(TERM) if File.exists?(TERM)
  end
end

until(File.exists?(TERM))
  dir = BOTS[round % BOTS.length]
  puts "[#{Time.now}] Round #{round+1}"
  puts "[#{Time.now}] Running '#{dir}' for #{GAMES} games"
  last_was_print = false
  Dir.chdir(dir) do
    games = 0
    IO.popen('./cgos.sh 2>/dev/null') do |pipe|
      until(pipe.eof?)
        line = pipe.gets
        if line =~ /setup/
          games += 1
          File.new(TERM, "w") if games >= (GAMES-1)
        end
        case line
        when /gameover/
          line =~ /gameover\s+\d\d\d\d-\d\d-\d\d\s+(\S+)/
          print "\n" if last_was_print
          puts "[#{Time.now}] #{$1}"
          last_was_print = false
        when /setup/
          line =~ /setup\s+.*?(\S+\(.*\)\s+\S+\(.*\))/
          print "\n" if last_was_print
          puts "[#{Time.now}] #{$1}"
          last_was_print = false
        when /info/
          print "."
          STDOUT.flush
          last_was_print = true
        end
      end
    end
    File.delete(TERM)
  end
  round += 1
end
File.delete(TERM)

Tags , , , , , ,  | no comments | no trackbacks

Euruko 2007

[ Posted by Urban Hafner Tue, 18 Sep 2007 08:46:38 GMT ]

As Stephan Kämper already announced on his blog the European Ruby Konferenz will be held in Vienna, Austria on Saturday & Sunday 10th and 11th November 2007.

If you want to attend just add yourself to the wiki!

Hope to see many of you there!

Tags , , , ,  | no comments | no trackbacks

How To Give A Great Man To Man Hug

[ Posted by Urban Hafner Fri, 31 Aug 2007 19:23:57 GMT ]


VideoJug: How To Give A Great Man To Man Hug

Tags ,  | no comments | no trackbacks

The end of a mountain

[ Posted by Urban Hafner Sat, 25 Aug 2007 17:29:46 GMT ]


The end of a mountain, originally uploaded by AntonisP.

That’s what’s happening all over Greece right now :(

Tags , , , ,  | no comments

Ein Grundgesetz für Schäuble

[ Posted by Urban Hafner Tue, 14 Aug 2007 17:43:33 GMT ]

Ein Grundgesetz für Schäuble (klein)

Vielleicht etwas spät, aber besser als nie. Ich bin gerade auf ein Blog Post von Frank Wettert gestoßen, der dazu auffordert ein Exemplar des Grundgesetzes an Wolfgang Schäuble zu schicken. Recht hat er. Meine Exemplare (3 Exemplare kostenlos vom Deutschen Bundestag zu erhalten) sind schon unterwegs. Sobald eure Exemplare bei euch angekommen sind bitte eines der Exemplare (vielleicht mit einem erklärenden Brief dazu) an folgende Adresse schicken:

Herr Dr. Wolfgang Schäuble
Bundesministerium des Innern
Alt-Moabit 101
D-10559 Berlin

Vielleicht hilft es ja seinen Überwachungswahn zu stoppen. Einen Versuch ist es zumindest wert.

Tags , ,  | no comments

Lighttpd gotchas

[ Posted by Urban Hafner Wed, 06 Jun 2007 15:38:07 GMT ]

I just tried to setup lighttpd (1.4.13) to run several sites side by side and run one of them on a different port. The following things should be noted:

server.prot

You can’t just set server.port. It’s a global variable a overwrites the previous ones.

$SERVER[“socket”] and $HTTP[“host”]

Using $SERVER["socket"] and $HTTP["host"] together doesn’t work. I tried to do the following:

$SERVER["socket"] == "0.0.0.0:5005" {
  $HTTP["host"] == "example.com" {
    server.errorlog    = "/error.log"
    accesslog.filename = "/access.log"
    proxy.balance = "fair"
    proxy.server = ( "/" =>
                     (("host" => "127.0.0.1", "port" => 5001))
                   )
  }
}

But that doesn’t work! I ended up removing the $HTTP["host"] part. Which is not that nice as you can now access the site on port 5005 using all the other URLs defined in the config file!

Are there any solutions to this problem?

Tags , ,  | no comments

Better recommendations for IT Conversations

[ Posted by Urban Hafner Thu, 10 May 2007 09:43:23 GMT ]

I’m a regular listener of IT Conversations. But of course I don’t have the time to listen to all podcasts. And anyway there are many that I don’t even want to listen to. So, IT Conversations has a rating system and can give you recommendations. But for that to work you have to remember to go to their website to rate the shows you have listened to. Very cumbersome if you listen to the shows on your iPod somewhere in the wild. But it seems things might change as Phil Windley is asking if You Would Let IT Conversations See Your Podcast Ratings in iTunes?. Seems like a great idea to get some more out of the recommendation system.

Tags , ,  | no comments

Older posts: 1 2 3 ... 9