Debian rc.local howto

If you’re using a flavor of *nix that has an rc.local file, and then you start using Debian GNU/Linux, you might be wondering where your rc.local file is. Quite simply, it’s not there. Here’s how to add it.

Create a new file named /etc/init.d/local like this:

#!/bin/sh
# put startup stuff here

Make the file executable:

chmod 755 /etc/init.d/local

Add it to startup:

update-rc.d local defaults 80

You should be seeing something like this:

Adding system startup for /etc/init.d/local ...
/etc/rc0.d/K80local -> ../init.d/local
/etc/rc1.d/K80local -> ../init.d/local
/etc/rc6.d/K80local -> ../init.d/local
/etc/rc2.d/S80local -> ../init.d/local
/etc/rc3.d/S80local -> ../init.d/local
/etc/rc4.d/S80local -> ../init.d/local
/etc/rc5.d/S80local -> ../init.d/local
Be Sociable, Share!

MacOS X updatedb

A new MacOS X install has no locate database. If you don’t want to wait for the weekly cron to run, do this:

ln -s /usr/libexec/locate.updatedb /usr/bin/updatedb

updatedb

Now the ‘locate’ command will actually return something!

Be Sociable, Share!

Ruby on Rails form_tag

Consider the api definition for form_tag:

form_tag( url_for_options = {},
          options = {},
          *parameters_for_url,
          &proc)

This form_tag:

<%= form_tag( :action => 'upload',
              :multipart => true ) %>

Produces this:

<form action="/home/upload?multipart=true" method="post">

which is probably not what you want.

Try this instead:

<%= form_tag( { :action => 'upload' },
                :multipart => true ) %>

and you’ll get this:

<form action="/home/upload" enctype="multipart/form-data" method="post">

You have to establish when your first hash of parameters ends, otherwise form_tag will assume your :action and your :multipart option are a single hash, when :multipart really needs to go in the second hash.

Be Sociable, Share!