Hi, I'm Benedikt Deicke. I'm a web and software developer at flinc. I'm mainly building user focused web applications using Ruby on Rails and JavaScript. Additionally I'm currently finishing my studies for my master's degree and enjoying photography in my spare time. Feel free to get in touch with me!

July 11th, 2007
New KDE Theme

Posted by benediktFiled in Linux

July 10th, 2007
Getting a class' subclasses

I needed a way to get a list of the subclasses that inherit a specific. Unfortunately there is no method like Class.subclasses (there is Class.superclass, though) so I had to look for another way to achieve this. Let’s say, we want to have an array containing all subclasses as a class variable of our superclass Strategy. In order to fill the array we’ll overwrite the inherited class method of Class. (Already confused by all the classes? ;-))

   1  class Strategy
   2    @@subclasses = Array.new
   3    class << self
   4      def inherited(klass)
   5         @@subclasses << klass
   6      end
   7  
   8      def subclasses
   9        @@subclasses.join(', ')
  10      end
  11    end
  12  end

Now, every time a class extends Strategy our new inherited method is called and adds the class to our array.

   1  class StrategyA < Strategy; end
   2  class StrategyB < Strategy; end
   3  class StrategyC < Strategy; end
   4  
   5  # Let's get the current list of subclasses
   6  puts Strategy.subclasses # will output StrategyA, StrategyB, StrategyC

What happens if a class inherits any of our subclasses? Well, as long as you don’t overwrite the inherited method again it’s also added to the array.

Posted by benediktFiled in Articles, Ruby

July 4th, 2007
Getting Things Done

Yes, I know. I didn’t blog for some time now. Sorry!

I stumbled across Getting Things Done today. It’s a self-management method invented by David Allen. As I’m currently having my term’s exams (again ;-)), I didn’t have the time to take a closer look. Although what I read about it looked quite promising.

Posted by benediktFiled in Other

June 2nd, 2007
30th ... err ... 24th of may

It was planned to be the 30th, but in the end everything was a week earlier. The great rush of many fans to nightwish.com in order to see the band’s new voice. It all started on 23th with the leaking of Nightwish’s new single “Eva” on some online music stores. The desicion to release all information the next day was made only a few hours later. There was only one problem: the server wasn’t already prepared for this. Thanks to the fast responses of Nebula and Hetzner we could set up three more servers and mirror the page on them. I was using pound to load balance the three servers at Hetzner. Nebula’s server was added via Round Robin DNS. Everything worked fine until we released the news … pound simply crashed and blocked port 80 completly. It might have been my own fault but well … it was impossible to use it. After one hour of investigations it simply shut pound down. And simply started lighttpd … surprisingly (or maybe, not really?) it handled all the requests without any problem! We had up to 600 requests per second. On Nebula’s we even had up to 2400 rq/s during my investigations on the load balancer. After this one I’m officially a fan of lighttpd! :-)

Posted by benediktFiled in Linux

May 24th, 2007
Prinzenrolle

I’d love to have some right now :-)

Posted by benediktFiled in Other