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

July 24th, 2008
Script.aculo.us should have Effect.Emerge

Script.aculo.us includes a nice effect called Effect.DropOut, which let’s the element fall in an “invisible trap” underneath. Surprisingly there isn’t an opposite effect. Calling Effect.DropOut with Effect.Transitions.reverse as transition, doesn’t work either. So what to do? Effect.Emerge to the rescue!

   1  
   2  Effect.Emerge = function(element) {
   3    element = $(element);
   4    var oldStyle = {
   5      top: element.getStyle('top'),
   6      left: element.getStyle('left') };
   7    var position = element.positionedOffset();
   8    return new Effect.Parallel(
   9      [ new Effect.Move(element, {x: 0, y: -100, sync: true }), 
  10        new Effect.Opacity(element, { sync: true, from: 0.0, to: 1.0 }) ],
  11      Object.extend(
  12        { duration: 0.5,
  13          beforeSetup: function(effect) {
  14            effect.effects[0].element.show().makePositioned().setStyle( { top: (position.top + 100) + 'px' }); 
  15          },
  16          afterFinishInternal: function(effect) {
  17            effect.effects[0].element.undoPositioned().setStyle(oldStyle);
  18          } 
  19        }, arguments[1] || { }));
  20  };

Basically it’s just a modified version of Effect.DropOut to reverse the effect. Try it in compination with Effect.multiple ... :-)

Posted by benediktFiled in Javascript

July 2nd, 2008
So I gave a talk ...

... and messed it up.

Last week I’ve been giving a talk (in german) about the project I did during my internship at the Human Computer Interaction Research Center at the university of applied sciences Fulda. This was the first talk I gave (not counting those I had to do in school and for university) and of course it ended up a little awkward. I didn’t intend to do a live demo at the end but somehow I changed my mind during the presentation. Of course nothing worked like expected … ;-) Lessons learned for next time. If you’d like to see the disaster yourself there is a video available.

Posted by benediktFiled in Other

May 19th, 2008
I love TeX

I got my thesis’ topic last week and will start to write it within the next few days. I decided to write it using TeX as all my attempts to write large documents in OpenOffice.org caused very bad headaches. The TeX approach fits my needs much better and I can use GIT much more effectively to manage the changes to the documents. With TeX I could even apply patches to the document … how cool is that? :-) Just imagine sending the document to someone else for proofreading and getting back a patch that can be instantly applied without having to search every passage that had misspelled words in it. Maybe I’ll post some links that helped me getting into all the TeX stuff in the near future.

Posted by benediktFiled in Other

April 15th, 2008
Redesigned

During the last week I built a new design for both the blog and the website. The website isn’t finished yet but today I decided to update the blog’s design. I hope you like it as much as I do.

Additionally I updated the underlaying Mephisto Blog and added Sven Fuchs’ Paged Article Lists Plugin.

Posted by benediktFiled in Other

April 10th, 2008
Using RSpactor with Linux

Andreas Wolff recently released RSpactor, a (up to now) command line tool similar to autotest. Nevertheless it differs from autotest in two points. First it’s focused on RSpec and secondly it’s using Mac OS’ FSEvents to monitor file changes. According to this it only runs on Mac OS. To get it running on Linux you’ll have to change RSpactor’s Listener class to use Linux’ equivalent to FSEvents called inotify. Luckily there’s a gem called RInotify which introduces a simple class to access the inotify events within ruby. I rewrote the Listeners class yesterday to get it running on my Linux notebook:

   1  # inotify_listener.rb
   2  
   3  class Listener
   4  
   5    def initialize(&block)
   6      require 'rinotify'
   7      begin
   8        @spec_run_time = Time.now
   9        @watching      = {}
  10  
  11        notify = RInotify.new
  12        Dir.glob(File.join(Dir.pwd, '**')).each do |dir|
  13          watch_desc = notify.add_watch(dir, RInotify::MODIFY | RInotify::CREATE | RInotify::DELETE)
  14          @watching[watch_desc] = dir
  15        end
  16  
  17        while true do
  18          changed_files = []
  19          notify.each_event do |event|
  20            changed_files << build_path_from_event(event)
  21          end
  22          changed_files.uniq!
  23          unless changed_files.empty?
  24            @spec_run_time = Time.now
  25            yield changed_files
  26          end
  27          sleep(5)
  28        end
  29      rescue Interrupt
  30        @watching.each_key { |key| notify.rm_watch(key) }
  31      end
  32    end
  33  
  34    def build_path_from_event(event)
  35      File.join(@watching[event.watch_descriptor], event.name || '')
  36    end
  37  
  38  end

To get it running you simply have to install the RInotify gem and change one line in bin/rspactor:

   1  # from
   2  require File.join(File.dirname(__FILE__), '..', 'lib', 'listener')
   3  # to
   4  require File.join(File.dirname(__FILE__), '..', 'lib', 'inotify_listener')

That’s it! RSpactor should be running on Linux now and consuming much less CPU than autotest.

(You might also want to change the system()-call in lib/resulting.rb as it’s currently using growl to notify you about the test results.)

Posted by benediktFiled in Agile Development, Articles, Linux, Ruby, Ruby on Rails