Cygwin

Posted by John
on Sunday, 30 March 2008

Cygwin is a Linux-like environment for Windows. It consists of two parts:

  • A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.
  • A collection of tools which provide Linux look and feel.

If you're a Rails developer on Windows you may need this little tool, so install it from...

More Info here...

Change .rhtml => .erb

Posted by John
on Tuesday, 18 December 2007

In a bout of syntactical changes, Rails 2.0 harks the end of the .rhtml file extension; to be replaced with .erb

To change all your existing .rhtml files to .html.erb, run:

for f in $(find . -name '*.rhtml') ; do c=$(dirname $f)/$(basename $f .rhtml).html.erb ; hg mv $f $c ; done

The .html is to help with working out what contents are in the file, as it could in theory have both.

  • .html.erb = html
  • .css.erb = css

p.s. the script above doesn't do .css.erb, that's something you'll have to decide whether to use.

Thanks to Duncan Ponting for this.

MySQL dumps with DateStamp's

Posted by John
on Tuesday, 30 October 2007

Quickie here, below is a simple command to backup your MySQL database to a fully datestamped file...

mysqldump -u user mydbname > "backup_`date +%Y%m%d_%H%M`.sql"

Replace 'user' with your MySQL username and mydbname with the name of the database your making a dump of.

The > pipes the output to the file.

The 'date' part uses Linux's date function to append date digits inside the filename. The ' embeds it inside the filename.

So in the end you should end up with a file something like...

backup_20071030_1700.sql

Neat!