Saturday, 18 April 2009

Redirecting javathinking.com to www.javathinking.com

I thought it would be a good idea to redirect requests to http://javathinking.com to http://www.javathinking.com and I found out how to do that easily here.

Basically I just needed to add the apache directives:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^javathinking.com
RewriteRule ^(.*)$ http://www.javathinking.com$1 [R=permanent,L]

In ISPConfig this can be done easily through the administration console rather than editing the apache config files.

Firebug shows me that I am now getting a 301 redirect when accessing http://javathinking.com.

Tuesday, 14 April 2009

cp with force overwrite

I was recently trying to copy a directory over an existing one and kept getting prompted - asking if I wanted to overwrite existing files - even though I was using the force option:
cp -Rf dir1 dir2
I found the answer here - it was caused by an alias forcing the interactive mode.

Quick solution is to bypass the alias by an absolute reference to cp:
/bin/cp -Rf dir1 dir2



Wednesday, 1 April 2009

Error executing script War: No such property: stagingDir for class:_Events

While trying out my new Morph Grails hosting account, I installed the morph-deploy plugin and then promptly discovered that 'grails war' failed with

Error executing script War: No such property: stagingDir for class: _Events


It turns out this is a known problem with Grails 1.1 and the solution is to delete the _Events.groovy file in

[your home dir]/.grails/1.1/projects/[your application]/plugins/morph-deploy-0.1/scripts

Modifying web.xml in Grails

I'm trying out Grails application hosting at Mor.ph with a free developer account. To put up a sample application, I wanted to be able to protect the site with basic authentication so that it won't be accidentally found and played with. So, following the Mor.ph instructions, I needed to modify web.xml to add security constraints and a login mechanism.

As with most things Grails, the solution was easy - simply install the templates and modify the web.xml template.

But, at the moment I have to uncomment it in order to get it running locally - what I really need is a way to only put this modification in when the environment is production...