Posts

Ubuntu mysql update

I recently tried a system update (Ubuntu 7.10), and everything but mysql get updated. Every time I tried, Update Manager reported that the mysql update failed. I found this post , which essentially says that you need to stop mysql before trying the update. I've successfully done this, and now my update has been applied successfully.

BrowserShots - browser testing

Testing websites in all of the different browsers across all of the different platforms is no easy feat, and not always possible. I stumbled across BrowserShots which, given a web address, will produce screen shots of your website as they appear in different browsers on different platforms. This easily lets you see how your site is rendered. Although there are still other aspects you might want to test, having access to these screen shots is fantastic.

404 with Grails

Grails allows you to specify a custom 404 page simply using the UrlMappings.groovy class: class UrlMappings { static mappings = { "500"(controller:"errors", action:"serverError") "404"(controller:"errors", action:"notFound") } } This allows you to direct to a controller where you can then forward to a view: class ErrorsController { def serverError = { render(view:'/error') } def notFound = { render(view:'/notFound') } } I started off with a simple view using the 'main' layout: <html> <head> <meta name="layout" content="main" /> </head> <body> Page not found! </body> </html> But for some reason, the layout does not get applied. I haven't dug to the bottom of this yet, but I have found a work-around: <g:applyLayout name="main"> <body> Page not found! </body> </g:applyLayout> Now the layout is applied and th...

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...