And if anyone is interested to print the cliBuilder usage in the order that you
added them, try
def cli = new CliBuilder(usage:'Blaa')
cli.x(..)
cli.a(..)
cli.formatter.setOptionComparator({a,b -> 1})
cli.usage() will now print in the order added (x then a).
Merlin Beedell
From: M
=
$fileMatch")
cli.'?'(longOpt:'help', 'help')
def opts = cli.parse(['-i','b','-o','c', 'plus', 'more'])
if (!opts) { //if invalid opts then it prints usage by default
return
}
cli.options.options.each {println "-$it.option(${it.longOpt}) =
${opts[(it.option)]}"}
if (opts.arguments()) {println opts.arguments()}
prints (note - args are in the same order as defined):
-i(input) = b
-o(output) = c
-d(depth) = 1
-m(max) = 5
-t(threads) = 4
-w(wrapped) = false
-x(filefilter) = .*
-?(help) = false
[Plus, more]
Merlin Beedell
.filter(p -> (Files.isRegularFile(p) && p.toString().matches(fileMatch) ) )
//skip files that do not match a regex pattern
.collect(Collectors.toList())
.parallelStream()
.map(Path::toFile)
.forEach( msgFile -> {
processedCount++
} )
return processedCount
}
then use
the withPool { filesArray.eachParallel { ... - but this does not seem like an
efficient solution - especially if there are several hundred thousand files in
a directory.
What design pattern(s) might be better to consider using?
Merlin Beedell
ers first
// but do not delete a folder if it is not empty
emptyDirs.reverseEach { it.delete() }
}
Merlin Beedell
This line should have been like this:
new
File(getClass().protectionDomain.codeSource.location.path).name.toLowerCase().replace('.groovy',
'')
Merlin Beedell
From: Merlin Beedell
Sent: 26 January 2021 3:33 PM
To: users@groovy.apache.org
Subject: Self logging s
gs -> logOutput <<
args[-1]; logOutput.flush(); true } )
myLoger.start()
if (args) {
print "Parameters provided:"
args.each {print " " + it}
println ""
}
println "this is printed to the console window and to the log file - like a
'tee' feature
a variable
void func()
{
println(test)
}
test = 'hello'
func()
//===
Or just
//===
void func()
{
println(test)
}
test = 'hello'
func()
//===
Merlin Beedell
-Original Message-
From: MG
Sent: 15 Octob
shifting to newer APIs and web services (like OAuth and ‘Graph’). So
if there was a simple way to download and install Jacob/scriptom as a separate
thing, that might help for the few that still use it!
Merlin Beedell
From: Keegan Witt
Sent: 29 September 2020 7:33 AM
To: users@groovy.apache.org
k to 2.0.4) would all work.
PS – Why call groovy using “execute” rather than GroovyScriptEngine? Well some
of these called scripts use System.exit (error-number) and if I use the
ScriptEngine or similar, it causes my script to exit as well!
Merlin Beedell
0800 280 0525 / +44 (0)207 045 0520
DDI:
DirectoryStream(dir).each {i++}
} catch (e) {
println (e)
}
return i
}
Merlin Beedell
nearest I have found to a useful template on this topic is
https://stackoverflow.com/questions/35702351/concurrent-parallel-database-queries-using-groovy
But I just cannot see how or why the db connection pool interacts with the
GPARs so that the same connection is not grabbed by each concurrent process.
Yours, hopefully,
Merlin Beedell
that a multi-platform Java based installer could not be
used (if such a thing exists).
Merlin Beedell
From: Keegan Witt
Sent: 11 February 2019 2:24 AM
To: users@groovy.apache.org
Subject: New Groovy Windows installer
I'm working on a new installer<https://github.com/keeganwitt/groovy-wix
in services.ExecQuery("Associators of
{Win32_Service.Name='" + process.Name() + "'} Where
AssocClass=Win32_DependentService Role=Antecedent")) {
println "\tAsc: ${depServ.DisplayName} state: ${depServ.State}"
}
}
is using JavaScript and Python, as
these are taught at school.
Merlin Beedell
I see a monthly release of the 2.5x product – but nothing similar for version
3. What might be happening in the V3 world? Given the license terms change
under JDK 11, will the main target be OpenJDK?
Merlin Beedell
From: Paul King
Sent: 23 June 2018 2:53 AM
To: users@groovy.apache.org
ld Groovy move to support this syntax in the same way (support 'var' only
for Type Safe inferred declarations) or as a general alias to the "def" keyword?
JDK 10 also has support for "docker" containers. The ecosystem has certainly
shifted!
Merlin Beedell
"Hi there"
OutMail.Send()
OutMail = null
OutApp = null
}
Merlin Beedell
0800 280 0525 / +44 (0)207 045 0520
DDI: +44 (0)207 045 0528
Mob: +44 (0)7876 226865
Cryoserver: A focused, flexible email archive delivered by experts
-Original Message-
From: vlkodlak [
jacob.com.Dispatch.invokev(Dispatch.java:858)
at com.jacob.com.Dispatch.get(Dispatch.java:1258)
at
com.jacob.activeX.ActiveXComponent.getProperty(ActiveXComponent.java:171)
at scanMailbox.listMnP(scanMailbox.groovy:61)
at scanMailbox$_run_closure2.doCall(scanMailbox.groovy:45)
at scanMailbox$_run_closure2.doCall(scanMailbox.groovy)
at scanMailbox.run(scanMailbox.groovy:37)
Merlin Beedell
I note that the very handy groovyConsole will:
* close if the code hits a System.exit() call. (without saving the app).
* become un-closable / unresponsive with a silly-loop piece of code
* a swing app may continue to run (typically without any UI) - even after the
console Closes
* cannot run a co
as somewhat internal when we made that change.
You could use:
myLogger = new SystemOutputInterceptor({
Object... args -> logOutput << args[-1]; logOutput.flush(); true
})
Cheers, Paul.
On Fri, Nov 10, 2017 at 4:15 AM, Merlin Beedell
mailto:mbeed...@cryoserver.com>> wrote:
I
I also noted that the following code would work just fine in recent Groovy
version, but not in older. The idea is to intercept the stdout (System.out) so
any output can be logged to a text file as well as to the console [really
rather handy!].
import groovy.ui.SystemOutputInterceptor
dateStr
t1.groovy")
def myScript = new File(scriptDir, "Script1.groovy")
It saves getting the System.properties['file.separator'] – and you can even
ignore the drive letter (if it is on the current disk).
def myScript = new File("/Folder1/My Scripts", "Script
re found
(the sum of each being performed in parallel).
Actually - my interest is more in seeing a useful(?) example of gpars!
Merlin Beedell
[https://www.cryoserver.com/wp-content/uploads/2017/03/ISO-logo-signature.jpg]
[https://www.cryoserver.com/wp-content/uploads/2017/03/softech-signature.
which was easier to use, for
publishing your documentation both on the web and as a pdf / html page set
included in each release?
I ask because both services are really very good, and just the sort of thing
that we could use!
Merlin Beedell
[https://www.cryoserver.com/wp-content/uploads/2017/0
a trait?
Got your binding way too late?
Seen Elvis looking like ?:
Or lost your way in recursion
I had better leave it there before you die of something horrible.
Merry Christmas one and all,
Merlin Beedell
FCS - The Cryoserver People
26 matches
Mail list logo