0x2e - Transformation rules

Finally I wrote together some ideas about how rendering could be organized in a better way. I might give a talk on that script on this thursday's rug-b meeting.

Jan 04, 2010 ; Tags: (development, rails, merb, render, transformation rules)

Read more…

0x2d - Thank you, 2009!

2009 had been an exciting year! I discovered tons of new projects to help me improve productivity. The following is just a (incomplete) list. If you feel left out: just drop a comment below.

Dec 26, 2009 ; Tags: (development, tools, ruby, CouchDB)

Read more…

0x2c - Web site localization the easy way

There are many ways to add multiple languages to your web site. You will certainly know how you do it. But still... I came up with a new alternative, which I see as a light weight alternative, suitable especially for small web sites.

Nov 24, 2009 ; Tags: javascript, localization, l10n, i18n, internationalization, jquery, jquery.ez

Read more…

0x2b - (I) don't use Google assets

Recently people are moving to google hosted Javascript APIs. Which sounds good, at the first sight, because

Nov 14, 2009 ; Tags: ajax, performance, google assets, google hosted assets

Read more…

0x2a - Smoothly installing the "charguess" gem

One of the solutions to guessing a text's encoding in rails is the charguess gem. Sadly, though, this isn't well prepared to a "gem install charguess" session. The following commands will gladly download, compile and install the charguess gem on your machine:

Nov 14, 2009 ; Tags: encoding, guess, charguess, installing, ruby

Read more…

0x29 - nginx: Adding expiration headers

Today I was confronted with the tas of setting a proper expiration header to asset files. As a reminder: this is the aim:

Nov 13, 2009 ; Tags: rails, nginx, assets

Read more…

0x28 - Rails thread threats, and run_later

We all know that rails has a rocky history regarding threads. Sadly, that seems also include the Rails port of one of my favourite Merb features: run_later.

Oct 18, 2009

Read more…

0x27 - [BUG] cross-thread violation of rb_gc()...

If you are running accross this error

Sep 06, 2009

Read more…

0x26 - Where 100% C0 code coverage is just not good enough

I guess you are using rcov too to check that all your code was active in your tests at least once. Well, then, here are some bad news:

Aug 28, 2009

Read more…

0x25 - Add support for greylisted users to your site

In the ever ongoing fight against spam there is one really wonderful weapon: greylisting. For those that don't know how it works: whenever an email server sends an email for the first time, the receiving mail server rejects the email with a temporary error. The idea being that a legimitate server resends the email after a certain period of time, and then the email gets through, but a spam sender is likely not to resend the mail again.

Aug 26, 2009

Read more…

0x24 - mongrel_rails restart: It might not work well.

Just found out that mongrel_rails restart does NOT work, when the original mongrel was started with the -c option. Yuk!

Aug 10, 2009

Read more…

0x23 - Study: ruby coders are more attractive than PHP coders.

Well, that is of course total bullshit. With that title I will conduct a small experiment.

Jul 22, 2009

Read more…

0x22 - Your daily class variables and constants surprise

It is not chrismas, hence no quiz, but this was strangely surprising:

Jul 20, 2009 ; Tags: class variable, constant, ruby, scope

Read more…

0x21 - Array#to_proc

gives you

Jul 17, 2009

0x20 - Sphinx/ThinkingSphinx vs Xapian/ActsAsXapian shootout

This benchmark compares thinking_sphinx with acts_as_xapian. We need a search engine that gives us the IDs of matching documents from a fulltext index, basic text search only.

Jul 10, 2009 ; Tags: acts_as_xapian, fulltext, performance, rails, ruby, search, Sphinx, thinking_sphinx, Xapian

Read more…

CouchDB is here to stay!

While some of my 5 readers on average (per day) might already know, for everyone else: CouchDB will be part of the next Ubuntu release. And that one comes with long time support.

Jul 08, 2009

Read more…

F# - not on german keyboards

Whoever designed F# did certainly not have a german programmer in mind. Or how would you explain this

Jun 07, 2009

Read more…

0x1f - There are no nested functions in ruby!

Long time no read, I know. Well, I have been away.

May 31, 2009

Read more…

0x1e - Components, revisited

Lately I started looking into components again. What appealed me is that they could provide a uniform interface to parts of an application, rendering and all included. And the way they are were built into Rails they even spoke HTTP right out of the box.

Apr 23, 2009 ; Tags: 1rad, components, distribute, performance, rails, xc2

Read more…

hot, hot, hot!

While it is rapidly becoming summer these days we are working on a really really fabtastic idea. Having said that: it is not the idea we are working on, the idea is already 90% feature complete. It is the prototype which is slowly growing.

Apr 16, 2009 ; Tags: rails, veezle.com

Read more…

0x1d: Bummer! git-svn is not named so

For all of you that are trying to install git-svn on your machine: Quite a while ago the git folks reorganized the command line interface, and what used to be called "git-" is now called "git " . Note the subtle difference here? So if you are looking for the git-svn binary on your machine: there is none.

Apr 06, 2009 ; Tags: Bummer, git, git-svn, OSX

Read more…

Skype? A nazi company?

Or how would you explain the skinhead with a pitbull doing a nazi salute, when entering

Apr 03, 2009

Read more…

Server problems

Mar 31, 2009

0x1c: Bummer! Rails dynamic streaming doesn't work

Rails dynamic streaming doesn't work. At least sometimes. While the Rails documentation, and all the euphoric comments in the community feature code examples along the lines of

Mar 31, 2009 ; Tags: Bummer, rails, streaming

Read more…

0x1b - This is how Erlang makes sense, pt. 3

This is the third and final part of a series about Erlang.

Mar 30, 2009 ; Tags: Erlang

Read more…

Bummer

Mar 18, 2009 ; Tags: Bummer

0x1a - This is how Erlang makes sense, pt. 2

This is part 2 of a series about Erlang. The final part 3 will be published next week here.

Mar 16, 2009 ; Tags: Erlang

Read more…

0x19 - This is how Erlang makes sense, pt 1

This is part 1 of a series about Erlang. Parts 2 and 3 will be published in the next weeks here.

Mar 09, 2009 ; Tags: Erlang

Read more…

0x18 - More magic symbols

With just that small addition:

Mar 02, 2009 ; Tags: improvement, rails, ruby, symbol

Read more…

0x17 - Atomic science, revisited

I lamented earlier about the absence of a racecondition-free find_or_create implementation and somewhat promised to check back with a working implementation. YES, WE CAN: NOW is the time, folks!

Feb 23, 2009 ; Tags: activerecord, atomic, find_or_update, race condition, rails, ruby

Read more…

0x16 - It's a Bird…It's a Plane…It's Ruby!

Ever done Erlang? Now I wondered how flexible ruby would be and if an erlang style pattern matcher can be done in ruby. As it turns out, I came pretty close:

Feb 11, 2009 ; Tags: Erlang, pattern matching, ruby

Read more…

0x15 - public privacy protection: ruby privacy flags explained

...or: There is a difference between methodname(args) and self.methodname(args)!

Feb 09, 2009 ; Tags: private, protected, public, ruby

Read more…

0x14 - Riding to Erlang

Hi guys, I just want to tell you that I am off that blog, for now. The reason is this cute sidekick. And this being a somewhat non-Railsy project there is not much of a point in writing about it here. In the meantime this blog might get somewhat quiet, but I expect to be back in Railsland in two weeks or so. Stay tuned.

Jan 19, 2009 ; Tags: C, eep0018, Erlang, JSON

Read more…

0x13 - Happy birthday, Rails 2.3

It is a bit early, but still. Rails is going to turn 4! Candles, Fireworks, and everything!

Jan 13, 2009

Read more…

0x12 - Wissenswertes über Erlangen

Now what does a Berlin based ruby coder does between Christmas and New Years? You might bet on a short trip to "Nothing to Hide (25C3)", but this time you are dead wrong.

Jan 05, 2009 ; Tags: Erlang

Read more…

0x11 - ...and a Happy New Year

for all of you. Before you enter the New Years Day frenzy, here are the results of last week's puzzler. (Haven't been a big secret anyways: every one with a Ruby interpreter could know in the meantime. Yes, that means you!)

Dec 29, 2008 ; Tags: ruby

Read more…

0x10 - Merry Christmas and Happy Contemplating...

...some piece of ruby code that might not behave as you think (depending on your thinking, of course.). Do you know the results?

Dec 22, 2008 ; Tags: ruby

Read more…

0x0f: url_for speed "issues"

Everyone seems to know that building an URL from a hash has some speed issues. The reason for that is quite clear: it looks up the shortest route using routes.rb, no wonder that this would take some time.

Dec 15, 2008 ; Tags: performance, rails, ruby, url_for

Read more…

0x0e: You will know me by the trail of the dead

Say you are running a bookstore. (Didn't you know that Rails is all about selling books?). Like everybody else you moved over to an IT infrastructure for managing sales during the last years, and now you have 5000 customers in the database and know about all the books these guys bought at your store - on average a swooping 15 books per person.

Dec 08, 2008 ; Tags: performance, rails, ruby

Read more…

0x0d: 10+1 things I hate about rails

These are somewhat random rants, proceed with utmost care!

Dec 01, 2008 ; Tags: rails, ruby

Read more…

0x0c: These shoes are made for walking

Wanna go for a stroll? It is getting winter again, at least in this part of the world, so strolling outside might be a bit, err, cold. Instead I suggest you just walk some ruby objects this time instead?

Nov 24, 2008 ; Tags: object walking, ruby

Read more…

0x0b: Saving is a virtue, avarice is a vice

In functional tests a controller instance should not be reused: usually controller instances hold some state, that gets discarded in the normal Rails life cycle, and our tests must reflect that. Otherwise, tests can fail even if they shouldn't, but even worse tests could succeed when they shouldn't.

Nov 17, 2008 ; Tags: 1rad, Functional Test, rails, ruby, Testing

Read more…

0x0a: Some optimization hacks...

We are working on a somewhat larger Rails application, and one of the actions renders a table with up to 9.000 table elements. Now, somewhere when rendering that table we use a line like

Nov 10, 2008 ; Tags: performance, rails, ruby

Read more…

0x09: Atoms and their packages

Every now and then I come across someone that doesn't really know about Ruby symbols. That comes as no surprise, because most programming languages don't have something like that as a built-in type. And Rails' HashWithIndifferentAccess (this is the class of the params hash that you deal with during actions) certainly doesn't improve the situation: novices might think that whether or not to use a symbol is a random decision.

Nov 03, 2008 ; Tags: rails, ruby

Read more…

Interlude

One thing about having a blog hosted at wordpress.com (or on any other 3rd party website, for that matter) is that you shouldn't have to deal with updates and the likes.

Oct 27, 2008 ; Tags: wordpress

Read more…

0x08: 10, 9, 8, ... zero in on <what> ?

Rails - or to be more precise - ActiveRecord scopes can be a huge time saver. That is, unless you have a number of multiple conditions that stack onto each other. But if you are in need of an "advanced search" feature you will likely end up with something like the following:

Oct 27, 2008

Read more…

0x07: More bodywork

Now, last monday I promised to rework the bodywork code into a plugin, "tested and all". Some clashes with git later I finally managed to push it to github, you'll find it at github. It even comes with a nice and cute README file, so head over and check it out.

Oct 20, 2008 ; Tags: 1rad, controller, rails, ruby

Read more…

0x06: Body works

One cool Rails feature - however undervalued - are after-filters. You might ask: What is the point of doing things after I am already done doing all things? Well, to prevent micromanagement: Sometimes you just want to do things all the time, or regardless of the specific request: say, embedding some SQL stats on the bottom of all of your pages. This is just one example where you could should look into after_filters first thing in the morning.

Oct 13, 2008

Read more…

0x05: SQL instruments

There are times, when you build a really complicated web page. Take a page like http://www.sportme.de: this page has more than eight parts that are to be taken straight from the database (assuming you are not logged in and get the front page of that website). You see blocks showing professional members, newest members, random members, a news ticker, a "who is online list", etc. Each entry in these boxes usually pulls more than one row from one table from the database; the most obvious case when showing user teasers, where the user's image itself would not come from the table holding the users, but from "somewhere else".

Oct 06, 2008

Read more…

0x04: Atomic science

The usually recommended way to create an item if it doesn't exist already is by using find_or_create_by... This, however, comes with a race condition built in. Which doesn't always race, so think twice when and how you use it.

Sep 29, 2008 ; Tags: 1rad, ruby

Read more…

0x03: Advisory Locking

Strangely RoR doesn't come with support for Advisory Locking. However, a typical rails application usually not only needs to synchronize access to the data in the database but needs to synchronize external data as well. Given that a typical rails application has more than one parallel thread of execution, a programmer might need some tools to synchronize access to shared resources.

Sep 22, 2008 ; Tags: 1rad, ruby

Read more…

0x02: Don't go Hamlet on me!

When something's rotten in the State of Denmark - I prefer to know! If you feel the same, and you have some C/C++-background: chances are that you know about assertions.

Sep 15, 2008 ; Tags: Debugging, ruby

Read more…

0x01: The times they are achanging...

...well, sometimes you just have to know how much time your application spends in a certain area.

Sep 08, 2008 ; Tags: Debugging Tools, ruby

Read more…

0x00: Hello world!

Hey, welcome at 1rad!

Aug 29, 2008

Read more…