TemplateError: wrong number of arguments in default_url_options()
During an app upgrade to Rails 2.2.2, I came across this error that baffled me for a few minutes:
ActionView::TemplateError
(wrong number of arguments (0 for 1)) on line #34
of app/views/account/_dashboard_header.rhtml:
34: <%= link_to 'My Dashboard', my_dashboard_url >
Checking out the backtrace:
(eval):3:in `default_url_options' (eval):3:in `my_dashboard_url' app/views/account/_dashboard_header.rhtml:34
Confusing. Why would this named route suddenly stop working? I did a search for default_url_options and found that I had overridden that function:
if production_mode?
def default_url_options()
{ :protocol => 'https://' }
end
end
Aha! Back in the day, default_url_options didn’t have any default options, so I wasn’t bothering to merge my desired options with the options parameter. I fixed it with a reverse_merge so any passed-in options would still exist.
XP password reset
Someone asked me to fix their computer, but they didn’t know any of the passwords for it. Short of formatting it, I didn’t really know what to do.
After some searching, I found the Offline NT Password & Registry Editor, Bootdisk / CD which worked perfectly.
- Download the CD image
- Burn to a CD
- Boot to the CD
- A small linux program runs
- Answer a few questions about what partition and the user(s) you need to clear and/or reset the password for
- Write your changes to the disk
You can also edit the registry if you need to hack some bad keys out of there, like spyware startup entries.
Super handy tool!
Changing the mysql root password
I never can remember how to do this from the command line and the docs are just hazy enough to be a pain:
> mysqladmin -u root -p password <ENTER_NEW_PASSWORD>
And yes, that is “space-p-a-s-s-w-o-r-d” after the -p. Sending that tells mysql that you want to change the password to whatever is next. You’ll be prompted for the existing/old password:
Enter password: ********
Installing SFTP on Windows 2003 Server
I needed to set up a quick FTP server on a Windows server. I don’t like opening FTP ports if I can help it, so I wanted to find a easy SFTP server. This one is great and super easy to set up:
http://www.coreftp.com/server/
You give it a username and password and a directory where the user should end up. Simple, but effective.

CoreFTP setup
Restore IMAP mail from local cache via Time Machine
I had a real scary moment last night. I was cleaning off my server and deleted the home directory for my databasically email account. I don’t host the website on that server, so I thought removing the home directory would be fine. However, I do host the mail on that server and it’s stored in the home directory.
I had Apple Mail.app running and connected to that mailbox. I didn’t really notice it until a few minutes later when a message came in on another account.
My work account was blank. Empty. Also, I had a nice exclamation point saying the account couldn’t be found.
Whoops. Oh hell.
I have my computer hooked to an external hard drive which I’m using as my Time Machine (the built-in Mac backup software) drive. I poked through the folders from an hour ago and found all my mail.
The mail is stored in ~/Library/Mail/, where each IMAP account has a folder called IMAP-user@host. This folder contains many folders with the .imapmbox extension.
Here’s how I restored my mailbox:
- Recreated my home directory and made sure that the email address still worked. You may want to set up a new account if you’re moving hosts or whatever. Get a working IMAP account up and running.
- Put the IMAP-user@host folder to my Desktop. Actually, I restored it from Time Machine and then copied it to the Desktop. I selected “Keep both” when doing the Time Machine restore which renamed my existing folder to end in “(original)”. I moved the restored folder to my Desktop and removed the “(original)”.
- Renamed each folders’ extension from .imapmbox to .mbox . Make sure you get any subfolders as well.
- Import the file: File > Import Mailboxes > Mail for Mac OS X
- Select the parent folder (IMAP-user@host) containing all your .mbox files.
- Your mail will be imported to a folder named Import inside the On My Mac folder.
- Drag your mail to your new/restored IMAP mailbox. I copied 5000 messages at a time without an issue.
Hopefully you never need this information.
If it helped you out or if you have any other information, please let me know in the comments.

Posted by Wes in