Tag: development

Making a staging database with sed

Quick one – thought was was cute and useful.  I take a copy of live databases once in a while for use in the staging environments, but some apps have references to the live url in the there (WordPress does this and makes all its redirects using it, making it particularly difficult to test in staging).

This is a simple little way to change all the urls in the db as you clone it:

mysqldump -h live_db_host -u user -pmypass live_db | sed -e '{s/www.example.com/staging.example.com/g}' | mysql -h staging_db_host -u user -pmypass staging_db

Though depending on your MySQL table type you might want to dump to disk first, then pipe it through sed as your live tables might be locked (I’m not actually sure if mysqldump will block waiting for the other processes to catch up)

Eclipse IDE

Eclipse logo I’ve just tried out the Eclipse Integrated Development Environment. It appears to be named Eclipse due to how it consumes all your CPU and RAM, overshadowing anything else you might want to do.

I tried the RadRails addon thing out for developing Rails. It has some nice features but is rather a big jump from vim, which I’ve been using up until now. And to the best of my memory, vim has never crashed once. Whereas Eclipse has already crashed about 10 times in 24 hours.

UPDATE: I used Eclipse for all my Ruby on Rails development for almost two weeks but I’ve now given up.  Even with leaky old Firefox and the monolith that is OpenOffice running concurrently I would rarely notice swapping, but Eclipse has decimated my swap partition.  It’s resource requirements (mostly RAM) have turned my brand new laptop into a 486 DX66 with 4MB RAM and a broken CPU fan.  It would regularly crash too.  Any time saving it’s features might have offered were well cancelled out by all the lost work.

I am using the Aptana Ruby on Rails Eclipse addons, so maybe you can blame that, though the Haskell addons were misbehaving too. Ridiculous stuff.

I’m just going to learn how to use some of the more advanced features of VIM.  I’m giving GVIM a go too.  Oh VIM, how I missed you so.