Strangely enough enabling custom locale fallbacks is harder than it should be. Here’s what you need to enable custom locale fallbacks with i18n gem.
First, you need to set config.i18n.fallbacks = true for all environments in a Rails application (config/environments/*.rb).
The above will enable custom fallbacks from at and ch locales to the German language and from gb locale to English. The enforce_available_locales bit is optional.
Doesn’t it look just beautiful?
Here is my take on VI mode indicator in zsh’s prompt. This is useful only for people who use the vi mode (bindkey -v) in ZSH.
Other examples on the web use zle reset-prompt in the zle-line-init, which has a very nasty side effect of deleting last couple of lines on mode change (when going from ins to cmd mode) when using multi-line prompt. Using zle-line-finish works around that.
Also see my current ~/.zshrc, which includes those tweaks (and many others!).
You know, so that your muscle memory can rest in peace. Also see the commit adding the above emacs style keybindings to my dotfiles.
Ever wanted to test your CSRF protection in a Rails app? For example, in a situation when you have a custom “remember me” cookie set and you need to overwrite Rails’ handle_unverified_request to clear it so it does not open a big security hole in your app? I know I did and it took me a while to find out how to do that, so I figured it would be good to write about it.
Adding the above will make it so that the authenticity_token is added to each generated <form> element and will be required to be sent with each non GET request.
When I was migrating a suite of Exvo apps to Heroku‘s Cedar stack I’ve noticed a very strange behaviour. For two apps during first “run” the main process spun out of control, trying to consume way too much memory. After doing a manual restart everything went back to normal and the problem was basically gone (we haven’t seen it reoccuring).
This is just a worker, but I’ve observed the same for web processes as well. Be aware that as soon as your application starts serving R14/R15 errors it stops processing any new requests (they simply time out).
Previously: Introduction to Heroku H12 timeouts.
If you run into this problem, which by the way usually happens after upgrading the rubygems package (in my case it was to version 1.8.21), your best bet is to upgrade the gem from the backtrace of this error. In my case it was the old passenger version 3.0.9, which was causing this problem. Upgrading to 3.0.11 solved it.
This blog has been. But no more! Now restored from the dead (i.e. fresh installation and customization of the Kubrick template).
It seems that running and outdated WordPress installation is not a very bright idea. Who would have thought?
how much I loathe thee!
At Exvo we were experiencing problems while trying to send an email to all of our 150K+ users. This lead to a careful investigation of what is exactly happening during this process. So we setup our loggers (heroku logs -t | tee output.log), run heroku consoles, increased to 20 dynos and 10 workers and begun the sending process.
or similar log entry later on, just silence.
This is Heroku’s killing machine in action. It silently kills every process, which runs for longer than 30 seconds (we’re using the Bamboo stack). This is more or less how Heroku deals with long running requests. I don’t blame them for this behavior, even though I very much dislike it. But I digress.
When Heroku kills such process it does so in a very nice way, i.e. it lets it finish its business first. In other words the process will continue in the background and after finishing it will just die/stop/restart. Our email collecting job (selecting 150K users from the database…) run uninterrupted for over 40 minutes. So this is the good part.
Also notice the 503 error code (Unavailable), which is returned by the Heroku router.
So this is really bad as all sorts of different/random web requests will just keep failing without you knowing what’s going on.
So while I greatly appreciate that Heroku lets such processes still run in the background, I really don’t like that it still keeps sending traffic their way.
PS: Yes, sending emails should be done as a background action by the Heroku workers. I know. But it’s not. Yet.
Aka the “mandatory” 11/11/11 post.
Nothing else here, move along.