I buid a factory in groovy, this code works, but I think, this code can be improved (or reduced) :
abstract class Processing {
abstract getDirName();
abstract getFileType();
abstract moveFile();
abstract processFile();
abstract openFile();
abstract closeFile();
}
class ProcessingBuilder {
def process...
Hello,
I am trying to use recursion in groovy to traverse a tree relationship. The below code runs one cycle, upto childNodes && recurClosure(childNodes ) , but doesn't call the closure recurClosure again. At that instant childNodes had two objects (array list) same type as root.
In the code, recurClosure is defined and calls with ...
I need to remove "" from the both ends of the line
"/home/srinath/junk/backup"
and to display like this /home/srinath/junk/backup
How can we achieve this in groovy ?
thanks in advance,
sri..
...
How to run this command in groovy :
/home/srinath/junk/sync.sh > /home/srinath/junk/copy.log
This is working when tried on terminal . but fails when used execute in groovy
Could any one please help me on this .
thanks in advance
sri..
...
That is basically my question. It is showing me today's date and not a blank or null or '' date, even if I put null or '' it runs perfectly but keeps showing me today's date, not a blank dropdown box. So I want to change the default to being blank when the gsp loads, not with today's date.
Thanks
-Fernando
...
Hi,
I created an extra column and added icons at the end of the list for editing and deleting an event.
Here is what I have
<g:form value="${it.id}">
<g:hiddenField name="id" value="${it.id}" />
<span class="simple"><g:actionSubmit class="editar" action="edit" value="${message(c...
I'm blocked on this GORM inheritance problem I have and id appreciate some fresh eyes to have a look over this problem. (Im using Grails 1.3.2)
I have a base abstract class...
abstract class MaintenanceSchedule {
static belongsTo = [ maintenanceTask:MaintenanceTask ]
}
and I want to extend it like so...
class OneOffSchedule exte...
Hi,
This 3rd party script keeps causing heap memory exceptions:
byte[] forwardMessage(byte[] content) {
s = new Socket("172.17.0.30", 10001);
s.withStreams {InputStream input, OutputStream output ->
output.write content
return readRtsData(input)
}
}
byte[] readRtsData(input) {
def vplEndByte = 0xff
...
I am trying to design my own custom set of tags using grails and i am having problems converting my date text into a Date object using the grails taglib. I have only succeeded in rendering already existing dates into a chosen format, but when i try to change the date and save it again, i run into problems
...
Is there any way to automatically load user classes in the groovy interpreter, the way System.out is automatically loaded (so you don't have to import System.out to use println)? I want to be able to write scripts that employ custom classes and run the scripts in the groovy interpreter without having to import all the classes all the ti...
How can I keep track of the line number I'm on when using eachLine to read a BufferedInputStream?
def input = new GZIPInputStream(new FileInputStream(f))
def reader = new BufferedReader(new InputStreamReader(input))
reader.eachLine {
line ->if(line.contains(searchString)){
println "${f} - ${line}"
}
}
...
I'm wondering how the development of this plugin is going? I've tried to build the plugin from source (https://svn.codehaus.org/sonar-plugins/trunk/groovyGMNarc) but get get it running within my project. I can install the plugin on Sonar but it fails to run against my Maven project.
I get the following error
[INFO] [sonar-core:internal...
I would like to have a snippet html loaded in the action method of a controller. Is there a way to do this?
What I want to accomplish is actually have the Controller action use json as the format to return my response (with error codes and other information) and include a snippet of html loaded from a template file as one part of the js...
I have a many-to-many relationship between two objects with a join table. I need to be able to select 5 random children based on Parent and date, excluding some children records. I am stuck. Any ideas?
Parent {
static hasMany = [children: Child]
}
Child {
Date dob
static belongsTo = [Parent]
static ha...
An update-statement seems to work only with one or three byte long UTF-8 characters.
My test code
def sql = sql.newInstance('jdbc:mysql://.../...?useUnicode=true&characterEncoding=UTF-8',
'...', '...', 'com.mysql.jdbc.Driver')
String value = 'β'
sql.execute('UPDATE Kldb_SynonymVersion SET synonyms=? WHERE id=11940', [value]...
Hi!
I'm still working on my first Grails application. This time, my problem is to limit access to some actions for particular users.
Assume users add some object, e.g. books. I would like to give access to edit a book only to admin and the user that added the book. I'm currently using Acegi plugin. I know there is newer version of that...
I have an array containing an unknown number of items that I would like to split into separate arrays so that each separate array contains no more than 4 items. What is the best way to do this in Groovy? Thanks!
...
On index.gsp I have this to redirect it to list.gsp so I'm imagining is should be something like this:
${response.sendRedirect("entry/list")}
My filter is just one textField and two datePickers with drop down boxes (DD-MMM-YYYY)
and they should be by default filtered from today's date to infinity. So it should show me only the events ...
I need to consume a file that is being generated on an Oracle server and I have been told to get it using the UTL_FILE package. I intend on consuming the file in a groovy script and have a connection to the database. It is a simple text file and I'd like to pull it down to the server and consume it as I would any other text file but I ...
Hi all,
I've encountered a strange issue with Groovy's (1.7.3) XmlUtil.serialize( GPathResult ) method. It throws a 'Content is not allowed in prolog' error when I call it with a GPathResult, but groovy.util.Node is serializing just fine. Here is the very simple Groovy Script I am trying:
import groovy.xml.XmlUtil
import groovy.xml....