April 2008
1 post
Help! The price of video content has fallen, and... →
Apr 18th
March 2008
1 post
Case insensitive regexes for Ruby on Rails routes,... →
Mar 12th
February 2008
2 posts
List all undeliverable messages in your exim queue
sudo script/exipick -bpru -show-vars=recipients | grep recipients | cut -d “’” -f 2 | sort | uniq
Feb 12th
Suppress Ruby warnings at runtime, without...
def without_warnings   ov = $VERBOSE   $VERBOSE = nil   ret = yield   $VERBOSE = ov   ret end
Feb 12th
September 2007
3 posts
Rendering from script/console
It turns out Rails has a nice little undocumented trick for rendering things from script/console or script/runner:  app.get(“/path/to/render”)  my_response_body = app.response.body  If you want to render something you don’t have an action for, just define it on the controller right there: class MyController   def  my_render      render :partial => “shared/foo”  ...
Sep 30th
Setting file descriptor limits →
Sep 26th
To install the postgres gem on debian
sudo apt-get install ruby1.8-dev sudo apt-get install postgresql-dev libpq-dev cd /var/lib/gems/1.8/gems/postgres-0.7.1 sudo ruby extconf.rb —with-pgsql-lib-dir=/usr/lib/postgresql/8.1/lib/ —with-pgsql-include-dir=/usr/include/postgresql/ sudo make sudo make install
Sep 15th
July 2007
2 posts
Ruby on Rails HTTP based authorization:    def get_auth_data     user, pass, authdata = ”, ”, nil     # mod rewrite, normal, apache     [‘X-HTTP_AUTHORIZATION’, ‘HTTP_AUTHORIZATION’, ‘Authorization’].each do |key|       # extract authorisation credentials       if request.env.has_key? key         authdata = @request.env[key].to_s.split       end    ...
Jul 19th
Development coordination through chat →
Jul 3rd
June 2007
5 posts
Getting NetConnection.Connect.Failed every time you try to connect from a NetConnection? Make sure you can run telnet serveraddress 1935 first, so that you know that the server is actually listening. Make sure you have the security settings to allow the NetConnection to work. Run nc -l -p 1935 to listen on 1935 and try connecting to localhost. If you see a bunch of binary crap, it’s...
Jun 23rd
Detecting microphone activity levels in flash requires a few magic incantations to get it to work: mic = Microphone.get(); mic.onActivity = function(){} _root.attachAudio(mic);  // now you can read the activityLevel trace(mic.activityLevel); 
Jun 21st
The ActiveRecord documentation for date_select contains the cryptic statement:  "The selects are prepared for multi-parameter assignment to an Active Record object."10 minutes googling later... "Besides that, it's now possible to do multi-parameter assigns that can even be type-casted. This is extremely helpful to do something like this for date attributes: post.attributes = { ...
Jun 21st
In Lua 5.0, you can get the arguments to a script with:  argv = arg In Lua 5.1, this will fail horribly. This bug is present in luaunit, which works only with Lua 5.0. 
Jun 17th
Yet another serialization of my life
I wonder if any of these will ever stick.
Jun 17th