REST in Place now with Multiline Editor

Yesterday I pushed the changes introducing the Multiline editor to REST in Place I announced last week.

The definition of forms for editing inline-content is now separated from the Code that deals with Ajax and editing state. This makes it very easy to extend REST in Place with your own Editors.

I also decided to keep the jQuery backwards compatibility for a bit longer.

Check out the changes at http://github.com/janv/rest_in_place.git

Rails 3 and Mongrel

Today, the Rails team finally released the first beta of Rails 3. Trying to play around with it, I experienced a very annoying problem with mongrel:

Per default, Rails seems to only work with the gems listed in its Gemfile, which means that it starts using webrick. I wanted it to use mongrel, like Rails 2 does and added gem "mongrel" to my gemfile which resulted in rails server just freezing. The cuplrit was some of the weirdest piece of code I’ve ever seen, mongrel’s Mongrel::Gems.require function:


def require(library, version = nil)
  begin
    Kernel.require library
  rescue LoadError, RuntimeError => e
    begin
      # ActiveSupport breaks ‘require’ by making it always return a true value
      Kernel.require ‘rubygems’
      version ? gem(library, version) : gem(library)
      retry
    rescue Gem::LoadError, LoadError, RuntimeError
      # puts "** #{library.inspect} could not be loaded" unless library == "mongrel_experimental"
    end
  end  
end
 

An infinite loop with the only way out being an exception that never got thrown!

This madness was called from mongrel.rb:


$LOAD_PATH.unshift ‘projects/mongrel_experimental/lib/’
Mongrel::Gems.require ‘mongrel_experimental’, ">=#{Mongrel::Const::MONGREL_VERSION}"
 

Removing these two lines solved the issue. That would have meant patching my gems however, and that smells like something you should not do. The final solution was simple and posted in the comments of the Rails 3 Beta announcement by Juanma Cervera. I just needed to add 3 more lines to my Gemfile:


gem "mongrel"
gem "cgi_multipart_eof_fix"
gem "fastthread"
gem "mongrel_experimental"
 

REST in Place: Major update ahead

This week, I’ll roll out a major update to REST in Place. I have completely restructured the code and made the Plugin much more object-oriented, modular and maintainable. Existing installations should be able to upgrade without a hitch. The most important change for users will be the jQuery 1.4 support and support for different editors (such as textarea, checkbox, etc.).

In November I got some pull requests for REST in Place which I didn’t get to really have a look at until last week. I haven’t really touched REST in Place in ages and wasn’t really aware that it was that popular. It has 72 followers and 11 forks on github and who knows how many other people are just silently using it! So, I merged in the contributions and dealt with some issues in the tracker and thought about how to go on.

REST in Place originally was a mere proof of concept and one of my first projects in JavaScript and jQuery. I have since written a lot more complicated applications and even a diploma thesis on JavaScript and the old code just isn’t up to my standards anymore. Additionally I have received several pull requests for textarea support which all couldn’t be merged because they were just copypasted and modified a little from the input-tag version. The only solution was a complete rewrite and that’s what I did. While the plugin still works the same way, the code is properly split up and more modular now. This enables easy extension and maintenance from now on and hopefully quicker development from me and better patches from all users.

This new development has some drawbacks too, unfortunately. This massive improvement will only go to the jQuery version of REST in Place. Since I don’t know much about Prototype or mootools, I can’t support both versions anymore. If someone is willing to work with me on this, I’ll happily accept their contributions but I can’t do this on my own. If anyone is willing to do so, please reply in the comments, so we can work out a plan. I want to keep all three versions as similar as possible, this means the Prototype and mootools versions should follow the same object-oriented structure as the jQuery version.

One last thing: I will support jQuery < 1.4 until 1.4.1 comes out. 1.4 introduced some very nice changes which I’d like to make use of but since 1.4 seems a little buggy still, I’ll continue to support the older versions for a little while.

Folien Ruby Metaprogramming

Hier die Folien zu meinem Ruby Metaprogramming Talk vom RailsCamp 3

OS X Layout for German Umlauts on US Keyboard

I’m using a US-keyboard since the German layout hides the important characters needed by programmers all the time behind impossible three-finger gestures.

To be able to quickly enter umlauts on the US keyboard, I’ve been using the USGerman layout found here. In Snow Leopard, this layout bundle causes a horrible bug in the keychain, essentially preventing you from doing anything that requires your password.

To work around that, I created a new layout bundle from scratch using Ukelele. It works just as well and doesn’t crash the keychain.

You can find it on my github page: http://github.com/janv/usgerman/

Berlin

dsc_0712

dsc_4745

dsc_0769

Berlin always fascinates me. I’ve wanted to live and work there since I was a child.
My parents got to know each other and still have friends in Moabit.
Because of that I’ve been visiting the city almost every year of my life.
This year was the first time I brought my D90 and D40 with me.

The city has a different vibe, depending on the season and the places you see.
These three images capture how the city felt last week.

Site changes

Earlier today I uploaded some changes to this Wordpress installation. The first is a small layout update, introducing the sidebar on the right, the second is the installation of the Nextgen Gallery plugin.

With Nextgen I want to present my photos in a way different from flickr. This also marks the beginning of broadening this weblog’s topics. I won’t restrict it to programming and software development any longer. My interests are much more diverse, so why not present all these ideas here. The 12€ Camera Strap post was the first into the topic of photography and it certainly won’t be the last, since this has become one of my most important hobbies over the last year.

dscf2463

HTML5 Canvas Experiment

html5-canvas-particles2

9elements, who are totally awesome btw., released an impressive HTML5 Canvas demo yesterday:

HTML5 is getting a lot of love lately. With the arrival of FireFox 3.5, Safari 4 and the new 3.0 beta of Google Chrome, browsers support some great new features including canvas and the new audio/video tags. Most interesting: modern mobile devices like the iPhone or Android-based phones also support new standards in favor of Flash. The future looks bright for HTML5.

Take a look at http://9elements.com/io/?p=153

12€ Camera Strap

A certain type of camera straps has become popular recently. These straps are worn diagonally over your chest and allow the camera to slide freely on the strap. If you’re not shooting, the camera rests on your hip, doesn’t strain your neck and leaves both your hands free. If you need it, you can grab the camera quickly, without strangling yourself with the strap.

Two products are build after this principle: the R-Strap and the Sun Sniper. Both have two big disadvantages though.

First, they attach to the tripod mount of your camera using a special screw. The tripod mount is not build for stress like this! Having the camera dangle and bounce from a strap attached there might very well destroy it. Further, the screw can come loose if the camera twists around. Both products take measures against this, but a certain risk remains. Second, both straps are pretty expensive at around 50€

In this post I’ll give instructions on how to build such a strap by yourself with material for 12€. This strap not only works similarly to its 50€ brothers but is of very high quality as well and can be trusted with heavy equipment.

more…

Ruby on Rails Extremcrashkurs

(Sorry, content in german only for this post)

Ende 2007 habe ich bei 9elements einen Crashkurs zu Ruby on Rails gegeben. Da mich inzwischen schon mehrere Leute gefragt haben ob ich die Folien nicht mal rausgeben möchte, tue ich das jetzt. Die Folien sind absichtlich so gestaltet, dass sie auch ausserhalb des Vortrags als Nachschlagewerk für Ruby dienen können. Der Rails-Teil ist ein wenig arg knapp gehalten und kann vor allem einen groben Überblick in den Aufbau des Frameworks geben.

Ruby & Rails Extremcrashkurs (PDF-Link) v1.0 27.03.09