Posts

Showing posts from October, 2007

No SilverLight for Linux?

I've just been to the MLB video site , and it tells me that I'll need to install SilverLight to view the videos! Following the links to install it takes you to the Microsoft site where I find out its only available for Windows and OS X. Searching Google it looks as though the Linux version is still in progress. Guess I'll have to skip the baseball until next year .

Upgrading to Ubuntu 7.10

I've been running Ubuntu on my laptop for a while now - I think I started with 6.10 and then reinstalled when 7.04 came out, and just now I've done a clean install of 7.10. It hasn't gone totally smoothly though. I've had problems with wireless, suspend and hibernate. I was hoping 7.10 would resolve most of these problems, and I got quite excited when wireless worked straight out of the box. I set the laptop to suspend when the lid was closed, and when I closed the lid, it tried to suspend and failed- when I tried to use it again, it seemed to wake up but then immediately hibernated and powered off. After resuming the machine, no surprise that the wireless no longer worked. It was the same problem as always, /var/log/dmesg revealing: [ 17.004000] ipw2200: Radio Frequency Kill Switch is On: [ 17.004000] Kill switch must be turned off for wireless networking to work. (My laptop has a kill switch on the left hand side - this turns the wireless off hardware style) I fin

What to do when your domain class won't save

When developing with Grails and GORM , if a domain class fails validation when calling the save() method, you won't get an exception - save() just returns false! This is mentioned in the Gotchas page and to find out what went wrong, it suggests looking in the errors.allErrors property of your domain class. To do this, would go something like this: if(book.save()) { log.info("Book saved : ${book.title}") } else { log.info("FAILED: book save failed") book.errors.allErrors.each { error -> println error } } If your book class had a constraint such as: class Book { String title static constraints = { title(maxSize:50) } } and you set the title to be more than 50 characters, you'd see an error message: <the value of title> exceeds the maximum size of [50] So, remember to check the boolean returned from save(). You can find out how to enforce constaints on your domain objects in the validation documentation - notice that some of the

Tomcat with Apache2 Virtual Hosts

Using Apache2 with named virtual hosts is standard, but what do you do when you want to put an application on Tomcat behind these hosts? Thats simple too... Lets say you have configured two virtual hosts in Apache: host1.javathinking.com host2.javathinking.com and you have two java applications you want running in Tomcat behind these virtual hosts. To configure Tomcat-5.5.20 with named virtual hosts, update <CATALINA_BASE>/conf/server.xml to look something like this: <Server port="9281"> < Service name="Catalina"> < Connector port="9282" proxyPort="80" proxyName="host1.javathinking.com"/> <Connector port="9283" proxyPort="80" proxyName="host2.javathinking.com"/> < Engine name="Catalina" defaultHost="localhost"> < Host name="host1.javathinking.com" appBase="webapps/host1"> <Context path

Developing with Grails and Apache2

In production I use Apache2 in front of Tomcat. The configuration for this is quite simple and standard. However, while developing Grails applications I wanted to run the same configuration, so that there are very few differences between my development and production environments. In Apache, I use named virtual hosts to forward to Tomcat, and Tomcat is configured with web applications corresponding to the virtual host name, with just '/' as the context path. Grails uses Jetty, and when running 'grails run-app' a Jetty container is configured and started. This is fine for me, I don't think I really need to switch to Tomcat in development, but running Apache2 in front of it would be very nice. This way I don't need to worry about differences in URLs. I'm not familiar with Jetty at all, so the simplest and fastest way to get this working was to make a copy of the RunApp.groovy script that comes with Grails and change it so that it looks for the context path def