Wednesday, November 25, 2009

maven, fedora.

I've been tipped that Maven is worth the learning curve.

I had a go, on Fedora 11. I can't wait for Fedora 12.

My first tip, is download and install locally: maven 2.2.1.
Install this into /usr/local/maven...

Use that in your Eclipse/NetBeans.

I'm on holiday for a few days... but I will post on how to get Eclipse and NetBeans building a distributable (all dependencies included) jar from the IDE when I return.

In conclusion: Maven is worth the learning curve.

UPDATE: After reflecting on actual use of Maven, I can add the following:

  1. Because it manages the build process, the IDE does not manage the build process. This means that you reduce your dependence on a given IDE. The project I'm working on is now developed by NetBeans and Eclipse folks. At the same time.
  2. Because it manages the build process, you are not dependent on IDE specific tools to build your distribution Jar. I like One-Jar but it is an extra dependency.
  3. By allowing you to collect all dependent code in your own repository, Maven enables a new level of technical management to be applied across a project, group, division etc.

Thursday, November 19, 2009

vlc, jackd no audio

I've been playing with Jack.

I'm feeling like I should always have it running since it works pretty well on the machine i'm using (xubuntu 9.10) and I'm going to want to use some audio production applications in future.

But, today I wanted to play a movie in VLC.

The sound didn't work and patchage didn't show 'vlc'. A brief search and I discovered that there is a jack plugin for vlc.

apt-get install vlc-plugin-jack

fixes that... Then within VLC, you need to switch to jack output:

tools->preferences->audio output label 'jack audio output'

then, I had to switch to 'show settings' all.
Open the audio->output modules->jack tree
and check the 'automatically connect to writable clients'

This made it work. I expect I'm going to experience some problems when I have more than one 'writable client', but I'll burn that bridge when I get to it.

Wednesday, November 4, 2009

basic http auth with Shiro in Grails

A quick note:

I found a blog nice simple recipe for basic http auth using Shiro in Grails. However, since this was published, JSecurity has been renamed Apache Shiro and so some minor changes need to be made at the end of the blog.

I posted them as a comment to that page but will repeat them here for good measure:

the last additions to Config.groovy when using Shiro should be:
security.shiro.filter.config = """
authcBasic = org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter
authcBasic.applicationName = Demo app name
/rest/** = authcBasic

Monday, November 2, 2009

Grails, Shiro, addToPermissions() error

I've been playing with Grails with an eye to using it on a new project.

Apache Shiro looks like a suitable security framework for me so I thought I'd use it right from the off. There is even a plugin for Grails to simplify installation.

I discovered that you still have to create your own shiro.jar from the shiro source - but that was relatively straight forward....

[... once I had downloaded a new version of Maven (Fedora 11 packaged version wasn't recent enough)....]

So, once I had installed shiro.jar, and the plugin, I decided to run:
'grails create-db-realm' and
'grails create-authcontroller'
and added bootstrap code according to the plugin advice

ASIDE: for the purposes of just playing around. A better choice for 'playing around' is to do:
'grails quick-start'

If you followed the same route as me, you may have experienced:

Caused by: groovy.lang.MissingMethodException: No signature of method: static groovy.lang.MissingMethodException.addToPermissions() is applicable for argument types: (java.lang.String) values: [*:*]

The fix I arrived at is to add the line:
static hasMany = [ roles: ShiroRole, permissions: String ]
to ShiroUser.groovy so it becomes:

class ShiroUser {
String username
String passwordHash

static hasMany = [ roles: ShiroRole, permissions: String ]

static constraints = {
username(nullable: false, blank: false)

This got me past this error, however since I feel that I still don't properly 'get it', I expect more issues (and possibably blog posts) in the future!