OS X 10.6.5+ apachectl line 82

I was trying to play around with passenger under OS X Snow Leopard. After following the instructions on how to install passenger for apache I tried to restart it which resulted in the following error:

/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument

After searching the net for the error a solution was quickly found. Apple seems to have updated the Apache and thereby broke the apachectl script.

The following workaround worked for me; The referenced variable ULIMIT_MAX_FILES which is referenced a bit above, is defined as follows:

ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"

redefining it as follows, solved my problem:


Question remaining: What does ULIMIT_MAX_FILES stand for?

Compare lists/arrays in Ruby

Ever stumbled over the problem, that you have two lists (for clarities sake, list A and B) and want to know what elements are missing from list B that are in list A?

With Ruby this problem can solved in a rather elegant way, by using set algebra. Let me show you how with a few examples. For the remainder of this blogpost I will assume the following values for our two lists:

list_a = [ :a, :b, :c ]

list_b = [ :b, :c, :d ]

Now lets assume you only want to have the items that are missing in list A. You can get the elements like this:

list_a - ( list_a & list_b ) # => :d:a

The analog is true for B. And if you want to find the elements that are either only in A or B you can do just as easily:

( list_a | list_b ) - ( list_a & list_b ) # => :a, :d