groovy

Open Source Java/Groovy library for picture file format conversion?

I need to convert tons of pictures, coming from all kinds of sources, in all kind of file formats. I want to store them all in the PNG file format (even if it means losing e.g. layer data from ESP's). I'm looking for a library that is preferably open source and has a Java or Groovy API (on top of JNI/JNA, if necessary). ...

What is the purpose of the NullObject class in Groovy?

I've been using Groovy for all of five hours and just came across the Groovy NullObject. I read the Groovy explanation of the Null Object Pattern, but it doesn't touch on the NullObject class directly; is NullObject merely intended to be a base class for things like NullTree and NullJob? I'm getting a NullObject back in some code that ...

What is the correct syntax for using HTML builder with mixed content in Groovy 1.7?

On the Groovy example page there is an example of how to use Groovy HTML builder with mixed content: p [ "This is some", b"mixed", "text. For more see the", ahref:'http://groovy.codehaus.org' ["Groovy"], "project" ] This is however not working for me, I get an error message like: expecting ']...

Catching typos in scripting languages

If your scripting language of choice doesn't have something like Perl's strict mode, how are you catching typos? Are you unit testing everything? Every constructor, every method? Is this the only way to go about it? ...

Conversion of bytes into a type without changing the application (ie storing the conversion method in DB) with Spring 3.0

Is there a way to store a conversion strategy (for converting some bytes) into a database and then execute it on the run time. If one were to store a complete java file, you would need to compile it, store the class and some how inject into the already running system. I am not sure how this would be possible. But using some kind of dyn...

Groovy Mixin on Instance (Dynamic Mixin)

I'm trying to achieve following: class A { def foo() { "foo" } } class B { def bar() { "bar" } } A.mixin B def a = new A() a.foo() + a.bar() with one significant difference - I would like to do the mixin on the instance: a.mixin B but this results in groovy.lang.MissingMethodException: No signature of method: A.mixin() is ...

how to add static methods using groovy mixin

hi, I want to use the mixin feature of groovy to import methods as "class(static) methods" instead of instance methods. When i use mixin even though i have a static method in my mixin class it gets converted into a instance method in the destination class.I want the imported method to be a class(static) method.Is there a good way to do...

How can I generate a TAGS file for Groovy classes for use in VIM/Emacs

Exuberant cTags doesn't support Groovy. ...

Jodatime groovy/grails daterange search with TimeZone conversion

I am currently storing Joda DateTime (Datetime+TimeZone) values into a database. What I want to do grab 24 hours of records based on the timezone of the user, rather than UTC time. I.E. I want to grab the records between 00:00GMT-24:00GMT for people whose timezone is GMT, and 00:00PST-24:00PST for people whose timezone is PST. Now I do...

HTML parsing - fetch and update data from the .html file

I have a form in a .html files where input/select box looks like this <input type="text" id="txtName" name="txtName" value="##myName##" /> <select id="cbGender" name="cbGender"> <option>Select</option> <option selected="selected">Male</option> <option>Female</option> </select> I would need to remove '##' value textbox and also up...

Grails Navigation with Dynamic Values

I'm using the grails navigation plugin and one of the things i want to do is have the menu item have a dynamic number in it for example static navigation = [ group:'tabs', order:7, title:'Mail', action:'index', subItems: [ [action:'pending', order:1, title:"Pending"], [action:'active', order:1...

Is it possible to override List accessors in Grails domain classes?

If I have a List in a Grails domain class, is there a way to override the addX() and removeX() accessors to it? In the following example, I'd expect MyObject.addThing(String) to be called twice. In fact, the output is: Adding thing: thing 2 class MyObject { static hasMany = [things: String] List things = [] void addT...

Maintaining both sides of self-referential many-to-many relationship in Grails domain object

I'm having some problems getting a many-to-many relationship working in grails. Is there anything obviously wrong with the following: class Person { static hasMany = [friends: Person] static mappedBy = [friends: 'friends'] String name List friends = [] String toString() { return this.name } } class Bo...

Is there a Groovy XML parser that doesn't ignore the comment node?

I'm using the XmlParser to insert nodes into an existing XML. Unfortunately this parser ignores the comment nodes which I would like to keep in place. Is there another parser I can use? Thanks. ...

Why don't Domain class static methods work from inside a grails "service"?

I want a grails service to be able to access Domain static methods, for queries, etc. For example, in a controller, I can call IncomingCall.count() to get the number of records in table "IncomingCall" but if I try to do this from inside a service, I get the error: org.springframework.beans.factory.BeanCreationException: Error creat...

Best practice for assigning A/B test variation based on IP address

I am starting to write some code for A/B testing in a Grails web application. I want to ensure that requests from the same IP address always see the same variation. Rather than store a map of IP->variant, is it OK to simply turn the IP address into an integer by removing the dots, then use that as the seed for a random number generator...

Is it possible for a java.lang.Process to inherit the environement variables from another java.lang.Process?

I am trying to use groovy to do shell scripting on unix, but I am not having any luck having one process retain the environment variables changed by another process. For example, def p1 = ["bash", "-c", "source /some/setEnv.sh"].execute() Now, I would like a second process, p2, to inherit the environment variables that was set in...

Standardizing a Release/Tools group on a specific language

I'm part of a six-member build and release team for an embedded software company. We also support a lot of developer tools, such as Atlassian's Fisheye, Jira, etc., Perforce, Bugzilla, AnthillPro, and a couple of homebrew tools (like my Django release notes generator). Most of the time, our team just writes little plugins for larger app...

Groovy / Scala / Java under the hood

I used Java for like 6-7 years, then some months ago I discovered Groovy and started to save a lot of typing.. then I wondered how certain things worked under the hood (because groovy performance is really poor) and understood that to give you dynamic typing every Groovy object is a MetaClass object that handles all the things that the J...

Grails or Play! for an ex-RoR developer ?

Hello, I plan to begin learning a Java web framework (I love the Java API), I already used Rails and Django. I want something close to Java, but without all the complexity of J2EE. I've found 2 framework that could be good for me : Grails : Grails looks great, it use Groovy that is better than Java for web application (I think..), but...