Import from Movable Type to Drupal

It seems like they’re been some problems along the way with the Import Typepad / MoveableType module and Drupal 6. I had no problems with it though. I followed some, but not all of Andrew Benkard’s suggestions. Removing PRIMARY CATEGORY wasn’t necessary. I loved how the user names don’t need to match from Movable Type to Drupal–there’s a great gui for matching up the user names in Movable Type to the user names in Drupal. This module is a huge help to me.

Theme Developer toasts drag-n-drop in Manage Fields

My Manage Fields page within Drupal Content Management lost drag and drop-ability, which turned out to because of this javascript error:

‘$(‘.indentation’, testCell).get(1)’ [undefined] is not an object.

Turning off the Theme Developer module fixed it!

Viewing multiple domains hosted via vhost on other computers

I followed this excellent screencast on setting up Phusion Passenger and all was running well. I can now develop multiple Rails apps simultaneously without starting/stopping my WebBrick server, which I love. But how to view these apps from my networked PC’s? All it took was an entry in the hosts file, which is here by default on both XP and Vista:

%SystemRoot%\system32\drivers\etc\

Thanks, Wikipedia! Now, on both my development machine and my others, I can use addresses like app.local to see work in progress.

One additional point: in your Rails apps, puts will write to your Apache error log, which may be located here: /var/log/apache2/error_log.

Open prototip on page load

I needed a prototip to open automatically on page load.  $(<id>).prototip.show() should do that, but it just wasn’t working.  Nick Stankenburg over on his Prototip forum gave me some ideas, but nothing worked until I set the prototip to open on a very short delay:
if(window.location.hash == '#vote-now') {
document.observe('dom:loaded', function() {
setTimeout("$('left-vote-button').prototip.show()",100);
});
}

Privacy, caching and making Safari behave

One of the sites I’m working on has health related information, which is very important to keep private. In particular, after the user logs out, we have to make its pages unavailable via the Back button. it took some work to convince all browsers we meant it, but here’s what works for Safari 3, Firefox 2 & 3 (Mac OS 10.4 Intel), IE 7, Firefox 2 & 3 (Win XP and Vista), IE 6 (Win 2K):

Set the response headers in an after_filter:

def set_header
#Date in the past
headers["Expires"] = “Mon, 26 Jul 1997 05:00:00 GMT”
#always modified
headers["Last-Modified"] = “Mon, 26 Jul 1997 05:00:00 GMT”
headers["Cache-Control"] = “no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0″
#HTTP/1.0
headers["Pragma"] = “no-cache”
 end

To make Safari behave, add this to all pages:

<iframe style=”height:0px;width:0px;visibility:hidden” src=”about:blank”>
This frame prevents back forward cache in Safari.
</iframe>