Wednesday, March 18, 2009

IBM buying Sun?



Some news sites (1, 2) today are reporting that IBM is in talks to buy Sun in a deal for at least $6.5 billion.

Off course this is some interesting news and might have some impact on Java and Java related products from Sun (GlassFish, NetBeans, ...). The future will tell us.

The reason I'm blogging about this that I'm believing for years that Oracle's Larry Ellison would step up one day and buy Sun. It would make a lot of sense in my opionion. Oracle is really attached to Java and they are involved in many JSR's. With buying Sun and thus Java they would have real strong voice in which Java would be heading. They would also have their own operating system which is one the less things they don't have at the moment. You can then have a stack like Oracle Solaris, Oracle Database, Oracle WebLogic Application Server and Oracle Applications. And there is a lot more, think about MySQL!

For once and all I want to write down this prediction, so if it would happen once (and this seems not the case right now) I can tell I had predicted it ;-).

PS: If I had a chrystal ball I was bying a lotery ticket right now.

Thursday, March 12, 2009

Grails Tip of the Day: Always use packages



First of all I must say I'm lazy and I don't like overhead... That's also the reason why I don't use packages for Grails domain classes. Most Grails applications I've build so far consist of no more then 20 domain classes, so I had never the need to separate them in packages. In fact I like to have them in the top folder; no overhead of subfolders.

As Grails 1.1 was released I decided to restart Grails on Sakila. I recreated the domain classes including a "Category" domain class. I generated the default Controller and Views without problems and started the application. When browsing to the list page of the Category domain class I got (GRAILS-4233):


Welcome to Grails 1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: D:\Grails\grails-1.1

Base Directory: D:\Grails\projects\grails-on-sakila
Running script D:\Grails\grails-1.1\scripts\RunApp.groovy
Environment set to development
[groovyc] Compiling 2 source files to D:\Users\moverdijk\.grails\1.1\projects\grails-on-sakila\classes
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, D:\Grails\projects\grails-on-sakila\grails-app\controllers\CategoryController.groovy: 40: You cannot create an instance from the abstract interface 'groovy.lang.Category'.
[groovyc] @ line 40, column 32.
[groovyc] def categoryInstance = new Category()
[groovyc] ^
[groovyc] D:\Grails\projects\grails-on-sakila\grails-app\controllers\CategoryController.groovy: 46: You cannot create an instance from the abstract interface 'groovy.lang.Category'.
[groovyc] @ line 46, column 32.
[groovyc] def categoryInstance = new Category(params)
[groovyc] ^
[groovyc] D:\Grails\projects\grails-on-sakila\grails-app\controllers\CategoryController.groovy: 40: You cannot create an instance from the abstract interface 'groovy.lang.Category'.
[groovyc] @ line 40, column 32.
[groovyc] def categoryInstance = new Category()
[groovyc] ^
[groovyc] D:\Grails\projects\grails-on-sakila\grails-app\controllers\CategoryController.groovy: 46: You cannot create an instance from the abstract interface 'groovy.lang.Category'.
[groovyc] @ line 46, column 32.
[groovyc] def categoryInstance = new Category(params)
[groovyc] ^
[groovyc] D:\Grails\projects\grails-on-sakila\grails-app\controllers\CategoryController.groovy: 40: You cannot create an instance from the abstract interface 'groovy.lang.Category'.
[groovyc] @ line 40, column 32.
[groovyc] def categoryInstance = new Category()
[groovyc] ^
[groovyc] D:\Grails\projects\grails-on-sakila\grails-app\controllers\CategoryController.groovy: 46: You cannot create an instance from the abstract interface 'groovy.lang.Category'.
[groovyc] @ line 46, column 32.
[groovyc] def categoryInstance = new Category(params)
[groovyc] ^
[groovyc]
[groovyc] 6 errors
Compilation error: Compilation Failed


First thing I thought I made some mistake but this wasn't the case. The problem is that Groovy resolves the Category class to groovy.lang.Category and not to my Grails domain class. This means if you have domain classes with the same name as a class in groovy.lang and don't use packages you will get into troubles.

So from now on I will create/put my Grails artifacts in a package, which is a good practice anyway. When running the Grails command line scripts to create artifacts you can specify the package so Grails automatically creates the package structure: e.g.:
grails create-domain-class org.company.Book


PS: I you want to read more about Groovy Categories have a look at the Groovy User Guide.

Tuesday, March 10, 2009

Grails 1.1 I18n Templates and Message Digest Plugin Released



Grails 1.1 was released just a couple of hours ago but I like to announce the availability of the updated I18n Templates Plugin already. Check out the link for more details.

Besides the I18n Templates Plugin I also released another new Message Digest Plugin this evening. This simple plugin provides message digest codecs (currently SHA1 and SHA1Hex) to encode strings easily:


"some string".encodeAsSHA1Hex()


To be honest I think I've "stolen" these codecs from Marc Palmer some time ago... I was working on some home project in which I needed them again so it was time to make a plugin out of it, so everyone can benefit from it. The plugin currently only supports SHA1 and SHA1Hex codecs but I might extend it in the future with MD5 codecs and some other convienient message digesting stuff. Feature requests or patches can be raised at the Grails Plugins JIRA issue tracker.

Thursday, February 26, 2009

NetBeans 6.7 M2 released with advanced Grails code completion



Last wednesday the NetBeans team released NetBeans 6.7 M2. For Grails developers this is great as it now supports code completion for dynamic methods and dynamic finders. Just great! And even better: debugging support is next on their priority list!



Check Petr Hejl's Blog for more information.

Saturday, January 31, 2009

Grails, NetBeans and Microsoft Team Foundation Server

At our internal development factory at Valid we use Microsoft Team Foundation Server (TFS) as the central versioning system. As we recently started a new Grails project we had to use TFS for versioning. We also use NetBeans 6.5 as it's has some nice Grails support.

When we started I had a little bit of caution against using TFS... And we faced some really annoying problem immediatly. You have to check out each file manually before you can edit it as the files are read-only. So for example when regenerating the controller and views for a domain class you have to check them out first... For Microsoft developers this is no problem as they are using Microsoft Visual Studio and the IDE is checking out the automatically when the change the file within their IDE.

For Eclipse users Teamprise ($$$) is available, but for NetBeans there is no plugin yet to work against TFS.

After searching for a solution I bumped at SvnBridge. SvnBridge allows you to use TortoiseSVN and other Subversion clients with Team Foundation Server. It converts the calls made by your Subversion client to the API supported by TFS. As NetBeans supports Subversion I gave it try, and my first experience is really good (just tried it out 30 minutes ago). I can connect with TFS as it was a Subversion server, and it automatically checks out the files when I edit them in NetBeans. Just great!

Here some steps to setup the SvnBridge:


  1. Download SvnBridge from http://www.codeplex.com/SvnBridge.

  2. Unpack the downloaded file and start SvnBridge.exe.

  3. A new icon will appear in your taskbar to indicate SvnBridge is running, you can right click it to change settings. I changed the Bridge Port to 8085 as my Grails application is running on the default 8080 port.




  4. In NetBeans go to Versioning -> Subversion -> Checkout as you would normally check out a Subversion project. You have to enter the bridged TFS/SVN path like: http://localhost:8085/[tfs.server.name]/[projectname] (e.g. http://localhost:8085/tfs.mycompany.com/myproject). Enter your TFS crendentials and you can check out your Grails project from TFS.






That's just it! You can now use NetBeans to enjoy working with a TFS versioning system. Don't forget all creadits go to SvnBridge.

Thursday, November 20, 2008

RestoreState Plugin Released



After some posts (1, 2, 3) about remembering/restoring the state of list pages I decided to finally put this functionality in a tiny plugin.

The plugin provides convenient methods to controller classes for remembering state. With the default Grails scaffolding each time you navigate away from a list page (e.g. going to the show page) the state of the list is lost when you return. This can be annoying when you paged to a certain page within the list. A typical use case for this plugin is restoring the pagination state (like offset and sorting) of list pages

Have a look at the plugin page for more information.

Wednesday, November 19, 2008

Grails on NetBeans



Today NetBeans 6.5 was released. The Groovy and Grails support is really nice. I'm using it for a couple of months now since M1 and I'm really satified. If you haven't tried it and working on Grails projects you really should give NetBeans a go!

Can't wait though on better Groovy and Grails support in Eclipse. Let's see what SpringSource will bring us.