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.
Basically run_later takes a block, turns it into a Proc, and sends it to a worker threads for later execution. That way the request processing is not [...]
Filed under: Uncategorized
|
If you are running accross this error
[BUG] cross-thread violation of rb_gc()
ruby 1.8.6 (2008-08-11) [universal-darwin9.0]
- say you are are installing the latest so-called “stable” typo version on your OSX machine – then you might see the above error. Here is the solution: *remove the bundled json gem!*: It is version 1.1.3, which is way old, and [...]
Filed under: Uncategorized
|
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:
rcov code coverage only checks whether or not a line was executed, meaning any code from that source line. And this usually trips on
do_something if some_condition?
because what [...]
Filed under: Uncategorized
|
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 [...]
Filed under: Uncategorized
|
Just found out that mongrel_rails restart does NOT work, when the original mongrel was started with the -c option. Yuk!
Well, this is not entirely true. It works if the -c parameter contains an absolute path, or refers “to itself”:
-c ../current works like a charm, and in fact updates the current directory to whereever current [...]
Filed under: Uncategorized
|
Well, that is of course total bullshit. With that title I will conduct a small experiment.
I found that the least informative of my blog posts attract the most readers. So if this stays true with that post (and a title like that should attract at least some attention) I will add more noise here. Promise!
Filed under: Uncategorized
|
It is not chrismas, hence no quiz, but this was strangely surprising:
class A
@@t = "A::@@t"
T="A::T"
def self.s1; @@t; end
def self.s2; T; end
end
class B < A
def self.s1; @@t; end
def self.s2; T; end
end
class C < A
@@t = "C::@@t"
T="C::T"
def self.s1; @@t; [...]
Filed under: Uncategorized
|
Tags: class variable, constant, ruby, scope
class Array
def to_proc
proc do |obj|
self.map { |sym| obj.send(sym) }
end
end
end
gives you
Account.all.map(&%w(id email))
Filed under: Uncategorized
|
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.
Data
one table with 200k entries with 5k of text (avg) in one column
one table with 500k entries with 7k of text (avg) in 6 columns
one table with 500k entries [...]
Filed under: Uncategorized
|
Tags: acts_as_xapian, fulltext, performance, rails, ruby, search, Sphinx, thinking_sphinx, Xapian
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.
Congratulations, Couchies.
Filed under: Uncategorized
|