22 May 2008

Grails is only Java EE with Spring

Grails is defintivly a cool framework for developing nice Java EE web apps. you can do a lot of tasks with just one step and the rest ist automatically done by Grails.
But using your existing Java code in a Grails application is no problem. Grails is based on Spring and Groovy and thus there are some easy ways to embbed Java code to your app.
  1. You can create a normal Grails controller or service and import your Java classes the normal way. This works pretty easy, if you're developing your app mainly with Groovy.
  2. If your app is allready based on Spring and thus provides allready Spring services, you can embbed'em directly and reference them in your Grails controller or services.
The second way can easyly be done, using some XML for configuration, but there is also the Groovy way to do, by using Grails' Spring Bean Builder.
To use it, you can put some Groovy code to the PROJECT_HOME/grails-app/conf/spring/resources.groovy file.
The following code shows you an example resources.groovy file:
import com.duckmaps.server.imagerendering.services.ImageServiceImpl

beans = {

imageService(ImageServiceImpl) {bean ->
bean.scope = "session"
}

}
Here you're seeing, that a bean with name imageService and the class ImageServiceImpl is defined. By setting the property scope to session, Spring instantiates this class for each session. It is important to put the import statement to the top. If you forget it, your code won't work.
Referencing this bean is the same as XML declared beans. Just put a
def imageService
to your controller and Grails will inject it like a normal Grails controller.

Notes Conversation View

One of the many innovations, brought to me by Gmail, is the conversation view, what means, that mails with the same subject will be shown as a conversation and thus you will get all your mails for a conversation just by scrolling your window down.
With Lotus Notes 8 IBM brought this idea into Notes. It requires at least a Lotus Domino 8 Server and an update of your mail database to the Notes 8 template. Than you can activate it by selecting conversation from the show menu at the top right corner of your mail view.
After opening a mail, you can select conversation from the display menu on top of your mail. This brings a list of all mails, which belong to the same conversation, to the top of your mail and you can open them by double clicking it. This is not as comfortable and cool like in Gmail, but you'll get a quick way to open other mails from the conversation.
But one thing I don't understand is this conversation list. It has a fixed size. If you've got just one mail in your conversation, you'll have a big free area on top of your screen. That's not very efficient.
On my MacBook with this small wide screen it takes a lot space, like you can see:

19 May 2008

Firebug and Firefox 3 Beta 5

After installing Firefox 3 beta 5 I had a lot of trouble with the Google Toolbar. After disabling the check for Extensions, Firefox didn't start anymore.
Now I fixed the problem by removing Google Toolbar, but an Add-on I really need is Firebug. For web development, there is no better tool for debugging your page.
Unfortunately the current version of Firebug doesn't support Firefox 3. But instead of the Google Toolbar it works after disabling compatibility check.
Or better it works pretty fine on my Mac and on a Windows XP machine, but it fails on my Ubuntu Hardy Heron machine, where Firefox 3 is the default browser.


Firebug on Firefox 3 RC1 (Mac OS X)


But thanks to Ubuntu team there is a great solution. You can install Firebug as a package from the Ubuntu repositories. This version of Firebug works great in Firefox 3 beta 5 in Ubuntu.