Ruby on Rails
JavaScript, XHTML, CSS
Java, Distributed Systems
<you_name_it>
ruby
Ruby's "each" for JavaScript
Submitted by Steffen on Mon, 12/22/2008 - 19:32Wow! 30 new subscribers due to my last blog posting about JavaScript inheritance: Welcome dear new readers :-) Due to this fact I've decided to try out something new. No fancy new technologies for showing-off but a tutorial-like introduction to some neat and often unknown JavaScript functions that can make your life easier.
Sine I really love Ruby, I thought: Why not take a use-case from the oh-so-beautiful Ruby world and transfer it to JavaScript. Well, here it is. Nothing new but still pretty cool: Ruby's "each" for JavaScript.
So, this is an experiment I'll really appreciate your feedback - is it too trivial or do you like it? Anyway, let's just start ...
May I Cite Myself?
Submitted by Steffen on Tue, 10/21/2008 - 00:17Well I'll just do it.
Maybe it's because I'm motivated by my new blog theme. Or maybe because my blog is now running on Drupal instead of Wordpress - well what the heck? ;-)
Anyway, I tought it's time to cite myself: Developers are Musicians - Wait was that by myself or by Ryan McMinn? Well ... does that really matter? Guess it's just a fact :-)
timed_fragment_cache on Rails 2.1
Submitted by Steffen on Sat, 07/26/2008 - 04:58With Rails 2.1 cache_erb_fragment has been replaced by write_fragment. This breaks a plugin I really enjoy to use: timed_fragment_cache by Richard Livsey.
It basically allows you to specify an expiry for the fragments you cache, e.g. inside memcache, by adding a "meta" fragment for the fragment you store containing the expiry time.
Some usage examples - pretty self-explaining:
In your view:
<%- cache 'my_key', 1.hour.from_now do -%> ... <%- end -%>
With extensive queries - your view ...:
<%- cache 'some_posts' -%>
Memory Leaks in GetText for Ruby on Rails
Submitted by Steffen on Sat, 03/22/2008 - 09:30Version 1.90.0 of GetText for Ruby has quite some memory leaks in its Rails support files. In my case, the memory Mongrel used increased by 1 MB with each request it served... Quite amazing that you don't really find someone else having the problem... Well there's at least a bug report on rubyforge...
Monkey-patching gettext.rb with the following code made things quite more relaxed:
def bound_target(klass = self) # :nodoc:
ret = nil
Ruby on Rails: gettext + memcache = trouble
Submitted by Steffen on Sat, 09/29/2007 - 06:25The latest Ruby gettext 1.10.0 gem broke the memcache based fragment caching of the current project I'm working on. I figured out what the problem was. gettext 1.10.0 tries to localize caching of fragments by kind of appending the Locale.current to the fragment cache key, e.g. "items/show/1" becomes "items/show/1_en", "items/show/1_de", ...
This by itself isn't a problem but gettext also overwrites the default Rails implementation for expiring fragments. The gettext mechanism expires each localized cache fragment for a given key, e.g. "items/show/1_*" (where * is a wildcard). The current memcache-client gem (1.5.0) however doesn't support wildcard based key access and a "delete_if method not defined" exception gets thrown.
