Find and replace domain name on the fly?

I use these two defines in my wp-config.php file:

define('WP_HOME', 'http://dev.mysite.com');
define('WP_SITEURL', 'http://dev.mysite.com');

Mind the trailing slash (or rather, the lack thereof), else you’ll get permalink bugs.

Also note that they’ll actually get used as is if you insert images and so forth when adding content.