Re: What is the best replacement for running scripts using groovy-all?

2018-12-19 Thread Søren Berg Glasius
Hi Paul,

This is where The @Grab anotation comes in handy:
http://docs.groovy-lang.org/latest/html/documentation/grape.html

It wil automatically download your dependencies and it works in Groovy
scripts too.

Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


On Wed, 19 Dec 2018 at 20:27, Paul Moore  wrote:

> On Wed, 19 Dec 2018 at 08:56, Paul Moore  wrote:
> >
> > On Wed, 19 Dec 2018 at 00:03, Keith Suderman  wrote:
> > >
> > > Option 4) Use the Maven Assembly plugin or the Shade plugin to build
> your own groovy-all Jar file.  Or just use
> https://github.com/gradle/gradle-groovy-all
> >
> > Thanks. Are there any "beginner guide" style instructions on how to
> > use the Maven Assembly plugin or Shade plugin that you can point me
> > to? As I say, I don't use Maven, so the instructions for the plugins
> > use a lot of terms and ideas I'm not familiar with. I can (and
> > probably will!) use the gradle-groovy-all but I'd like to learn a bit
> > more about the Java ecosystem (I'm mostly a Python programmer, but I
> > use Groovy as an alternative for environments where JVM-based tools
> > are a better fit than Python-based ones). I find that starting Groovy
> > *without* a Java/JVM background, there's a lot of assumed knowledge
> > it's quite hard to pick up (unless you're willing to learn Java at the
> > same time ;-))
>
> I've been digging around with this some more, and I've come to the
> conclusion that it's not that important to me in fact to have a single
> groovy-all jar for my deployment. But what I *do* need is a simple way
> to collect together everything I need to run my script(s) and ship
> them to the target machine(s). So my starting point is one or more
> .groovy files. I do *not* want to compile these - I want to ship the
> source script to the server, so that minor changes can be made in
> place using just a text editor. And with them, I want a directory full
> of supporting jar files.
>
> Having created and tested the scripts, I need to collect together all
> of the jar files I used to run them. Obviously, the first thing I need
> is the Groovy jars. Ideally I'd try to strip out unneeded jars (my
> code is to be run on a server with no GUI, so I suspect the
> groovy-swing jar could be skipped, for example). But that's probably
> way more trouble than it's worth, so I'm OK with skipping that step.
> Other dependencies, I've tended to collect from various places (for
> development, I can use @Grab annotations in the source, but my server
> doesn't have Internet access, so that won't work for the deployed
> version).
>
> From what I gather with Java projects, dependencies get managed by a
> tool like Maven or Gradle or by the IDE. But it's very hard for me to
> understand the documentation for these tools, as they are typically
> looking at the problem from the point of view of "compile and build a
> binary from the sources" rather than "collect dependencies into one
> place, but don't compile anything". One problem I'm struggling with is
> that with my background, what I'm trying to do is "obviously" the
> right approach, but I get the feeling that it's very different from
> the Java/Groovy way of doing things, so I keep missing the point of
> people's explanations.
>
> Essentially, what I want is a project structure like this:
>
> MyProject
> script1.groovy
> script2.groovy
> script3.groovy
> script4.groovy
> dependencies.txt
> target
> lib
>
> dependencies.txt can be anything but what it contains should be a list
> of dependencies - something like
>
> org.codehaus.groovy:groovy-all:pom:2.5.4
> javax.mail:mail:jar:1.4.4
> org.apache.commons:commons-csv:jar:1.6
>
> Running "some command" should then copy all the jars needed (based on
> those dependencies) to target/lib. Ideally, copy *.groovy to target as
> well, so I can just zip up the target directory, ship it to the
> destination machine, where I can unzip it and run it with whatever JVM
> is present there.
>
> Am I missing something fundamental which makes this impossible to
> achieve with Java, or is it just that my Google skills have failed me?
> Or is it that Java projects simply aren't normally of this form?
>
> Paul
>


Re: [DISCUSS] Groovy 2.6 potential retirement to focus on Groovy 3.0

2018-06-13 Thread Søren Berg Glasius
While the project I'm on is still on JDK 7, but due to Grails 2.x I think
that option 3 is the best way to move forward (and nudge projects on to a
higher version of Grails as well).

/Søren

On Wed, 13 Jun 2018, 09.42 ,  wrote:

> I agree on option 3 (abandon 2.6 immediately).
>
>
>
> JDK 6 or 7 is not in use anywhere that I have project visibility.
>
>
>
> Full support for JKD9+ is becoming a pressing issue. Users are concerned
> about the ability of Groovy to run on future JDK releases (including
> GraalVM), more than legacy support.
>
>
>
> Best Regards
>
>
>
> *From:* Paolo Di Tommaso [mailto:paolo.ditomm...@gmail.com]
> *Sent:* Wednesday, June 13, 2018 3:18 AM
> *To:* users@groovy.apache.org
> *Subject:* Re: [DISCUSS] Groovy 2.6 potential retirement to focus on
> Groovy 3.0
>
>
>
> I agree on option 3 (abandon 2.6 immediately).
>
>
>
> Full support for JKD9+ is becoming a pressing issue. Users are concerned
> about the ability of Groovy to run on future JDK releases (including
> GraalVM), more than legacy support.
>
>
>
>
>
> Cheers,
>
> p
>
>
>
> On Wed, Jun 13, 2018 at 9:11 AM, David Dawson <
> david.daw...@simplicityitself.com> wrote:
>
> I would vote 2.
>
>
>
> Actually, i would vote 3) abandon 2.6 immediately.
>
>
>
> No projects I have any knowledge of still use jdk 7.
>
>
>
> *From:* pa...@asert.com.au
>
> *Sent:* 13 June 2018 08:06
>
> *To:* users@groovy.apache.org
>
> *Reply to:* users@groovy.apache.org
>
> *Subject:* [DISCUSS] Groovy 2.6 potential retirement to focus on Groovy
> 3.0
>
>
>
>
>
> Hi everyone,
>
>
>
> There was some discussion at gr8conf about how to speed up delivery of
> Groovy 3.0. Some of that discussion was around the scope of what we want to
> include and have yet to complete in 3.0 but I won't discuss that right now.
>
>
>
> One of the other discussion points was Groovy around 2.6. As many of you
> know, we have released alpha versions of Groovy 2.6. That version is a
> backport of most but not all of Groovy 3.0 to JDK7 including the Parrot
> parser (though it isn't enabled by default). The purpose of this version
> has always been to assist people/projects wanting to use the Parrot parser
> but who might be stuck on JDK7. So in some sense it is an intermediate
> version to assist with porting towards Groovy 3.0. While that is still a
> noble goal in theory, in practice, many of our users are already on JDK8
> and we have limited resources to work on many potential areas.
>
>
>
> With that in mind, we'd like to understand the preferences in our user
> base for the following two options:
>
>
>
> Option 1: please continue releasing the best possible 2.6 even if that
> slows down the final release of Groovy 3.0 and delays further work on
> better support for JDK9+.
>
>
>
> Option 2: please release one more alpha of 2.6 over the next month or so
> which will become the best version to use to assist porting for users stuck
> on JDK7 and then focus on 3.0. The 2.6 branch will essentially be retired
> though we will consider PRs from the community for critical fixes.
>
>
>
> Feedback welcome.
>
>
>
> Cheers, Paul.
>
>
>
>
>
>
>
-- 

Best regards / Med venlig hilsen,

Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: Groovy Champions proposal feedback

2018-02-25 Thread Søren Berg Glasius
@Mario

Very good thoughts, I really like the idea that an award is permanent, I
believe that goes for Java Champs as well.

Naming wise, Groovyssimo is fun, but not naming material for an award :-)
But we need to narrow down the name-space to something realistic that can
be voted on.



On Mon, 26 Feb 2018 at 08:50 Mario Garcia <mario.g...@gmail.com> wrote:

> +1 to what Guillaume said :) Common guys! Lets focus on what we think is a
> great language and let others think what they want!
>
> Regarding the duration of the award. I've though about it, trying not to
> think in terms of annually or permanent, but trying to see what's out there
> outside the CS world, and I ended up thinking on the Nobel prize. I'd like
> some ideas of Nobel prize:
>
>- Takes place every year
>- A given prize could be vacant a given year.
>- It's so important that it's really noticeable to be awarded
>- Makes people very proud of some achievement they did a given year
>- Once you're a Nobel you will always be a Nobel.
>- Of  course there's been awarded people that even rejected the prize
>but that never really underrated the prize overtime
>- New members are chosen by previous members and some other relevant
>people (members of the parliament among others). Here I'd add the idea
>of letting anybody to propose a nominee, but leaving the final decision to
>the prize committee (whatever we decide who is in)
>
> Despite the difference of content between the Nobel prize and the Groovy
> awards, after reviewing these points I think they seem to fit better in the
> Groovy Champions/Stars idea. There is also something I haven't heard yet. I
> guess this will require a kind of permanent organization, e.g. to contact
> members, nominees, organize the awards, a web to show the winners...etc
>
> BTW: Here you have another naming for the awards: Groovisimo Awards. Can
> you imaging a "Groovisimo" statue like the Oscars ? It would be a blast
> X
>
> My two cents
> Mario
>
> 2018-02-25 10:53 GMT+01:00 Guillaume Laforge <glafo...@gmail.com>:
>
>> James Stachan's quote has really been taken out of context, and
>> over-exagerated bu the Scala-fanboys.
>> If Scala had been what it is now, James would probably not have initiated
>> Groovy *then*. But Scala was nascent just like Groovy *then*.
>> It's like if Gavin King had said that he wouldn't have invented Hibernate
>> if JPA had existed... but JPA came ten years later.
>>
>> This quote was really harmful, but as the saying goes, lots of water's
>> gone through the bridges since then.
>>
>> There's still the myth of slowliness, which we all know is not true
>> anymore, even in pure dynamic mode (without even mentioning static
>> compilation)
>> Usually, you spend way more time in network latency (access to remote
>> resources, access to database, etc) than waiting for the CPU spent by just
>> the pure language execution time.
>>
>> Also back on James Strachan: he went to play with Scala, then with
>> Kotlin, and has come back to using Groovy.
>> He's using Groovy on a regular basis through his work with Jenkins, its
>> pipelines, etc.
>> So he's back at his old love!
>>
>> So let's turn the page on those stories, please.
>>
>> Guillaume
>>
>>
>> On Sun, Feb 25, 2018 at 10:26 AM, Daniel Sun <realblue...@hotmail.com>
>> wrote:
>>
>>> The creator of Groovy said "I can honestly say if someone had shown me
>>> the
>>> Programming in Scala book...". I think he compared Scala with the old
>>> version of Groovy he created in about 2003. As we all know, Groovy has
>>> evolved a lot, so I never care about others' out-dated opinions on
>>> Groovy :)
>>>
>>> Cheers,
>>> Daniel.Sun
>>>
>>>
>>>
>>> --
>>> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>>>
>>
>>
>>
>> --
>> Guillaume Laforge
>> Apache Groovy committer & PMC Vice-President
>> Developer Advocate @ Google Cloud Platform
>>
>> Blog: http://glaforge.appspot.com/
>> Social: @glaforge <http://twitter.com/glaforge> / Google+
>> <https://plus.google.com/u/0/114130972232398734985/posts>
>>
>
> --
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: Groovy Champions proposal feedback - Groovy MVPs ?

2018-02-20 Thread Søren Berg Glasius
Are we at a point where there should be put out a vote for which name to
use? There are several good ones, and a few not so good... not judging
however :D

On Tue, 20 Feb 2018 at 11:07 Guillaume Laforge <glafo...@gmail.com> wrote:

> Or even GrooVIP :-D
>
> On Tue, Feb 20, 2018 at 9:20 AM, Cédric Champeau <
> cedric.champ...@gmail.com> wrote:
>
>> I agree with Guillaume: MVP sounds "Minimal Viable Product" in my head :)
>> Anoter option: VIP ;)
>>
>> 2018-02-20 <20%2018%2002%2020> 8:32 GMT+01:00 Jennifer Strater <
>> jenn.stra...@gmail.com>:
>>
>>> Although there seems to be a lot of disagreement about the name,
>>> everyone seems to be in favor of the idea. What is the next step, Paul?
>>>
>>>
>>> On 20. Feb 2018, at 07:56, Peter McNeil <pe...@mcneils.net> wrote:
>>>
>>> You're all missing the obvious "Groovy GR8" :-)
>>>
>>> On 20/02/18 11:35, Paul King wrote:
>>>
>>> Supreme Thanks Award Recognising contributions? :-)
>>>
>>> On Tue, Feb 20, 2018 at 7:08 AM, Kostas Saidis <sai...@gmail.com> wrote:
>>>
>>>> My own few cents, too:
>>>>
>>>> Groovy Star, Groovy Champion, Groovy MVP all have their pros and cons.
>>>> I would suggest something along the lines of Groovy Exceptional Community
>>>> Member (Groovy ECM) or Groovy Distinguished Community Member (Groovy DCM).
>>>> New acronym, professional enough, focusing on the overall community and not
>>>> only the language per se.
>>>>
>>>> Kostas
>>>>
>>>>
>>>> On 19/2/2018 10:26 μμ, MG wrote:
>>>>
>>>> I have never heard "MVP" =  "Minimum Viable Product", so I doubt this
>>>> would pose a problem. Also do you suggest that people would actually read
>>>> "Groovy has announced its Minimum Viable Products of 2018" ?
>>>> STAR has 129 meanings as an acronym, btw, according to
>>>> https://acronyms.thefreedictionary.com/STAR
>>>>
>>>> On 19.02.2018 20:39, Guillaume Laforge wrote:
>>>>
>>>> For me, MVP sounds too much like Minimum Viable Product :
>>>> https://en.wikipedia.org/wiki/Minimum_viable_product
>>>>
>>>> On Mon, Feb 19, 2018 at 8:32 PM, MG <mg...@arscreat.com> wrote:
>>>>
>>>>> Following the sports analogy, what about
>>>>>
>>>>> "Groovy MVPs"
>>>>>
>>>>> ?
>>>>>
>>>>> Any game can have Most Valuable Players (even if only one is typically
>>>>> crowned in the US), and I think "Groovy announced its 2018 MVPs" has a 
>>>>> nice
>>>>> ring to it.
>>>>>
>>>>> Cheers,
>>>>> mg
>>>>>
>>>>>
>>>>>
>>>>> On 19.02.2018 12:03, Søren Berg Glasius wrote:
>>>>>
>>>>> I disagree with MG.
>>>>>
>>>>> A star is an object that shines, and in this case shines light on the
>>>>> Groovy language and ecosystem. Hence I think the name is both 
>>>>> professional,
>>>>> and since it can be directly linked to the star in the Groovy logo I think
>>>>> it makes perfect sense. In sports you also have star players and in music
>>>>> (and Java) you have rock stars. That you can find examples that relates to
>>>>> games on Nintendo does not make a valid point IMO. The "All Stars" just
>>>>> makes it so much better - as that's what Paul, Jochen and others are .
>>>>>
>>>>> My few cents worth.
>>>>>
>>>>> /Søren
>>>>>
>>>>> On Sun, 18 Feb 2018 at 17:02 MG <mg...@arscreat.com> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On 18.02.2018 13:38, Eric Kinsella wrote:
>>>>>>
>>>>>> +1up on Groovy Stars.
>>>>>>
>>>>>>
>>>>>> "Get a life" ;-)
>>>>>>
>>>>>> But seriously, all the people one-upping "Groovy Stars" - consider
>>>>>> whether that name really sends the right professional message with 
>>>>>> regards
>>>>>> to Groovy ? I am convinced it does not.
>>>>>> Managers who might decide whether Groovy can be us

Re: Groovy Champions proposal feedback

2018-02-19 Thread Søren Berg Glasius
I disagree with MG.

A star is an object that shines, and in this case shines light on the
Groovy language and ecosystem. Hence I think the name is both professional,
and since it can be directly linked to the star in the Groovy logo I think
it makes perfect sense. In sports you also have star players and in music
(and Java) you have rock stars. That you can find examples that relates to
games on Nintendo does not make a valid point IMO. The "All Stars" just
makes it so much better - as that's what Paul, Jochen and others are .

My few cents worth.

/Søren

On Sun, 18 Feb 2018 at 17:02 MG <mg...@arscreat.com> wrote:

>
>
> On 18.02.2018 13:38, Eric Kinsella wrote:
>
> +1up on Groovy Stars.
>
>
> "Get a life" ;-)
>
> But seriously, all the people one-upping "Groovy Stars" - consider whether
> that name really sends the right professional message with regards to
> Groovy ? I am convinced it does not.
> Managers who might decide whether Groovy can be used in a project are
> typically conservative and sensitive to those things, and they do not
> normally follow nerd humor... (next suggestion I see coming along the
> Stars-crossed-line, is to call Paul and Jochen "Groovy All Stars")
>
> As another example, it looks like "Pokemon Stars" on the Nintendo Switch
> might become a reality:
>
> http://www.techradar.com/news/pokemon-stars-all-the-latest-leaks-from-the-rumored-nintendo-switch-game
>
>
>
>
> On Sun, Feb 18, 2018 at 6:13 AM, Daniel Sun <realblue...@hotmail.com>
> wrote:
>
>> Hi Paul,
>>
>>  “Groovy Champions” make people associate it with "Java Champions"
>> easily. As for "Groovy Stars", it is interesting but let me associate
>> "Song
>> Stars" and "Kungfu Stars" easily... I wish other people would not
>> associate
>> as I do...
>>
>>   Similarly, many years ago some one suggested to name current "Grape"
>> as "Groovy Baby", the latter is interesting but not formal...
>>
>>   To sum up, +1 to “Groovy Champions”.
>>
>> Cheers,
>> Daniel.Sun
>>
>>
>>
>> --
>> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>>
>
>
> --
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: Groovy Champions proposal feedback

2018-02-13 Thread Søren Berg Glasius
+1 on the name!

I think it's cool to differentiate the Groovy award from other awards like
Java Rock-stars and Java Champions, Grails Rock-stars, and more!


On Tue, 13 Feb 2018 at 14:09 Guillaume Laforge <glafo...@gmail.com> wrote:

> It's funny, I think we didn't think about "stars" in our previous
> conversations, and I must say I quite like it, and it makes sense
> considering our logo :-D
>
> On Tue, Feb 13, 2018 at 1:58 PM, Jennifer Strater <jenn.stra...@gmail.com>
> wrote:
>
>> +1 for the proposal and +1 for "Groovy Stars"
>>
>> On Tue, Feb 13, 2018 at 1:54 PM, Paul King <pa...@asert.com.au> wrote:
>>
>>> I don't mind "Groovy Stars" as a name!
>>>
>>> Of course it begs the question "Star trek" or "Star Wars" - the long
>>> journey
>>> of programming language design vs the language wars! :-)
>>>
>>>
>>> On Tue, Feb 13, 2018 at 9:46 PM, Dierk König <dierk.koe...@canoo.com>
>>> wrote:
>>>
>>>> I’m all for honoring contributions to the language/ecosystem/community.
>>>> Given our logo, „Groovy Star“ comes to mind :-)
>>>>
>>>> Cheers
>>>> Dierk
>>>>
>>>> sent from:mobile
>>>>
>>>> Am 13.02.2018 um 12:29 schrieb Paolo Di Tommaso <
>>>> paolo.ditomm...@gmail.com>:
>>>>
>>>> It sound a nice idea also to promote the visibility of the groovy
>>>> community.
>>>>
>>>>
>>>> p
>>>>
>>>> On Tue, Feb 13, 2018 at 12:18 PM, Søren Berg Glasius <soe...@glasius.dk
>>>> > wrote:
>>>>
>>>>> I'm definitely +1
>>>>>
>>>>> It is always important to recognize and encourage the ones making a
>>>>> difference to the community.
>>>>>
>>>>> On Tue, 13 Feb 2018 at 11:32 Schalk Cronjé <ysb...@gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> That's a +1 from me for the concep.
>>>>>>
>>>>>>
>>>>>> On 13/02/2018 10:58, Paul King wrote:
>>>>>> >
>>>>>> > Hi everyone,
>>>>>> >
>>>>>> > A few of us have had various discussions (in fact over many years)
>>>>>> > about having a recognition scheme similar to Java Champions,
>>>>>> > perhaps called "Groovy Champions" or "Apache Groovy Champions"
>>>>>> > or something else entirely if we think of a better name.
>>>>>> >
>>>>>> > I think the idea has always been to recognize contribution within
>>>>>> the
>>>>>> > whole Groovy ecosystem not just the Apache Groovy project. The many
>>>>>> > tens of projects within the ecosystem are often where many ideas
>>>>>> come
>>>>>> > from for the project's future evolution and also where future
>>>>>> contributors
>>>>>> > may arise. And in any case, Groovy has always been about making
>>>>>> > coding productive and fun and we should celebrate that widely!
>>>>>> >
>>>>>> > There are various questions to ask like should such a scheme
>>>>>> > be formally coordinated by the project/by Apache or should it be
>>>>>> run as a
>>>>>> > community-driven unsanctioned activity and if so what guidelines
>>>>>> should
>>>>>> > be in place. Also, there are many details like how will the scheme
>>>>>> > operate?
>>>>>> > How are new members elected? Is it a lifetime recognition or is
>>>>>> there
>>>>>> > an "emeritus" status? And so forth. Java Champions vote themselves
>>>>>> > on new champions and the recognition has a lifetime status for
>>>>>> instance.
>>>>>> > if we progress this idea, we'd need to make that all clear but that
>>>>>> isn't
>>>>>> > the purpose of this email - we need to first decide if we like the
>>>>>> idea.
>>>>>> >
>>>>>> > Even if we like the idea, there are still some hurdles to step
>>>>>> through.
>>>>>> > We've already sought some informal feedback from other parts of
>>>>>> > Apache and other projects within the Groovy Ecosystem and we'll
>>>>>> > likely need further discussions. We want something that embraces
>>>>>> > the whole community but fits in with Apache project governance
>>>>>> > around trademarks/branding.
>>>>>> >
>>>>>> > So, the first question is: are we as a project in favor of such a
>>>>>> scheme?
>>>>>> >
>>>>>> > Cheers, Paul.
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Schalk W. Cronjé
>>>>>> Twitter / Ello / Toeter : @ysb33r
>>>>>>
>>>>>> --
>>>>> Best regards / Med venlig hilsen,
>>>>> Søren Berg Glasius
>>>>>
>>>>> Hedevej 1, Gl. Rye, 8680 Ry, Denmark
>>>>> Mobile: +45 40 44 91 88 <+45%2040%2044%2091%2088>, Skype: sbglasius
>>>>> --- Press ESC once to quit - twice to save the changes.
>>>>>
>>>>
>>>>
>>>
>>
>
>
> --
> Guillaume Laforge
> Apache Groovy committer & PMC Vice-President
> Developer Advocate @ Google Cloud Platform
>
> Blog: http://glaforge.appspot.com/
> Social: @glaforge <http://twitter.com/glaforge> / Google+
> <https://plus.google.com/u/0/114130972232398734985/posts>
>
-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: Groovy Champions proposal feedback

2018-02-13 Thread Søren Berg Glasius
I'm definitely +1

It is always important to recognize and encourage the ones making a
difference to the community.

On Tue, 13 Feb 2018 at 11:32 Schalk Cronjé <ysb...@gmail.com> wrote:

>
> That's a +1 from me for the concep.
>
>
> On 13/02/2018 10:58, Paul King wrote:
> >
> > Hi everyone,
> >
> > A few of us have had various discussions (in fact over many years)
> > about having a recognition scheme similar to Java Champions,
> > perhaps called "Groovy Champions" or "Apache Groovy Champions"
> > or something else entirely if we think of a better name.
> >
> > I think the idea has always been to recognize contribution within the
> > whole Groovy ecosystem not just the Apache Groovy project. The many
> > tens of projects within the ecosystem are often where many ideas come
> > from for the project's future evolution and also where future
> contributors
> > may arise. And in any case, Groovy has always been about making
> > coding productive and fun and we should celebrate that widely!
> >
> > There are various questions to ask like should such a scheme
> > be formally coordinated by the project/by Apache or should it be run as a
> > community-driven unsanctioned activity and if so what guidelines should
> > be in place. Also, there are many details like how will the scheme
> > operate?
> > How are new members elected? Is it a lifetime recognition or is there
> > an "emeritus" status? And so forth. Java Champions vote themselves
> > on new champions and the recognition has a lifetime status for instance.
> > if we progress this idea, we'd need to make that all clear but that isn't
> > the purpose of this email - we need to first decide if we like the idea.
> >
> > Even if we like the idea, there are still some hurdles to step through.
> > We've already sought some informal feedback from other parts of
> > Apache and other projects within the Groovy Ecosystem and we'll
> > likely need further discussions. We want something that embraces
> > the whole community but fits in with Apache project governance
> > around trademarks/branding.
> >
> > So, the first question is: are we as a project in favor of such a scheme?
> >
> > Cheers, Paul.
>
>
> --
> Schalk W. Cronjé
> Twitter / Ello / Toeter : @ysb33r
>
> --
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Last day to submit talks to GR8Conf EU 10th anniversary

2018-01-31 Thread Søren Berg Glasius
Hi,

Just want to let you know that today is the last day to propose talks for
GR8Conf Europe 2018 - the 10th anniversary edition.

Talks that evolves around the Groovy Ecosystem are welcomed, both
beginners, intermediate and advanced talks. If you have topics that leans
towards DevOps, then submit those too!

You can submit at this link: http://cfp.gr8conf.org - and if you have any
questions, please let me know!

Best regards,
Søren Berg Glasius
GR8Conf Europe Organizer
-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


GR8Conf EU Call For Paper

2018-01-18 Thread Søren Berg Glasius
Dear community,

GR8Conf Europe 2018 Call For Paper is open and I would like to encourage
you to submit talks to the conference. Subjects could be anything with
relation to the Groovy Ecosystem, or subjects related to DevOps.

You can submit your content here: http://cfp.gr8conf.org - this is your
chance to shine in the Groovy community!

Have a great weekend,



-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: Apache Groovy and language influences

2017-10-04 Thread Søren Berg Glasius
Hi G-man!

Nice slidedeck. Thank you for sharing!


/Søren

On Thu, 5 Oct 2017 at 02:44 Guillaume Laforge <glafo...@gmail.com> wrote:

> Hi all,
>
> Earlier today at the JavaOne conference in San Francisco, I did a
> presentation on the cross influences between languages, where I'm showing
> some of the languages that we were inspired from when we created Groovy,
> and also how Groovy influenced other languages as well.
>
> Thought you might be interested in some of the background and history :-)
>
>
> https://speakerdeck.com/glaforge/how-languages-influence-each-other-reflections-on-14-years-of-apache-groovy
>
> Guillaume
>
> --
> Guillaume Laforge
> Apache Groovy committer & PMC Vice-President
> Developer Advocate @ Google Cloud Platform
>
> Blog: http://glaforge.appspot.com/
> Social: @glaforge <http://twitter.com/glaforge> / Google+
> <https://plus.google.com/u/0/114130972232398734985/posts>
>
-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: Java 8 Date/Time API Extension Methods

2017-06-07 Thread Søren Berg Glasius
I think it makes perfect sense that you can do the same calculations with
java.time.* as you can with java.util.Date

/Søren

On Wed, 7 Jun 2017 at 16:08 Guillaume Laforge <glafo...@gmail.com> wrote:

> I'm coming back on this idea of having it directly integrated in Groovy
> core.
>
> Any more thoughts on this from anyone?
>
> On Tue, May 9, 2017 at 3:32 AM, Joe Wolf <joew...@gmail.com> wrote:
>
>> Thanks Søren and Guillaume. I'm glad to finally contribute something to
>> the Groovy community!
>>
>> On Sun, May 7, 2017 at 4:14 PM, Guillaume Laforge <glafo...@gmail.com>
>> wrote:
>>
>>> This is indeed cool, and I'm wondering if it shouldn't be part of Groovy
>>> itself directly :-)
>>>
>>> On Sun, May 7, 2017 at 10:09 PM, Søren Berg Glasius <soe...@glasius.dk>
>>> wrote:
>>>
>>>> Well done! Thank you for sharing!
>>>>
>>>> /Søren
>>>>
>>>>
>>>> On Sat, 6 May 2017 at 22:30 Joe Wolf <joew...@gmail.com> wrote:
>>>>
>>>>> Hi, I want to announce the 1.0 release of an OSS project I've been
>>>>> working on called goodtimes.
>>>>>
>>>>> The Groovy JDK has always been one of my favorite parts of Groovy, but
>>>>> it currently lacks support for newer Java 8 classes. Goodtimes fills some
>>>>> of this gap until the GDK is updated by providing extension methods for 
>>>>> the
>>>>> Java 8 Date/Time API akin to those available for java.util.Date and
>>>>> Calendar.
>>>>>
>>>>> Source and documentation are hosted on GitHub:
>>>>> https://github.com/bdkosher/goodtimes
>>>>>
>>>>> Just add the dependency to your classpath to give it a try (assuming
>>>>> you're on Java 8, of course).
>>>>>
>>>>> @Grab('com.github.bdkosher:goodtimes:1.0')
>>>>>
>>>>> compile 'com.github.bdkosher:goodtimes:1.0'
>>>>>
>>>>> -Joe
>>>>> @bdkosher
>>>>>
>>>> --
>>>> Best regards / Med venlig hilsen,
>>>> Søren Berg Glasius
>>>>
>>>> Hedevej 1, Gl. Rye, 8680 Ry, Denmark
>>>> Mobile: +45 40 44 91 88 <+45%2040%2044%2091%2088>, Skype: sbglasius
>>>> --- Press ESC once to quit - twice to save the changes.
>>>>
>>>
>>>
>>>
>>> --
>>> Guillaume Laforge
>>> Apache Groovy committer & PMC Vice-President
>>> Developer Advocate @ Google Cloud Platform
>>>
>>> Blog: http://glaforge.appspot.com/
>>> Social: @glaforge <http://twitter.com/glaforge> / Google+
>>> <https://plus.google.com/u/0/114130972232398734985/posts>
>>>
>>
>>
>
>
> --
> Guillaume Laforge
> Apache Groovy committer & PMC Vice-President
> Developer Advocate @ Google Cloud Platform
>
> Blog: http://glaforge.appspot.com/
> Social: @glaforge <http://twitter.com/glaforge> / Google+
> <https://plus.google.com/u/0/114130972232398734985/posts>
>
-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: Java 8 Date/Time API Extension Methods

2017-05-07 Thread Søren Berg Glasius
Well done! Thank you for sharing!

/Søren

On Sat, 6 May 2017 at 22:30 Joe Wolf <joew...@gmail.com> wrote:

> Hi, I want to announce the 1.0 release of an OSS project I've been working
> on called goodtimes.
>
> The Groovy JDK has always been one of my favorite parts of Groovy, but it
> currently lacks support for newer Java 8 classes. Goodtimes fills some of
> this gap until the GDK is updated by providing extension methods for the
> Java 8 Date/Time API akin to those available for java.util.Date and
> Calendar.
>
> Source and documentation are hosted on GitHub:
> https://github.com/bdkosher/goodtimes
>
> Just add the dependency to your classpath to give it a try (assuming
> you're on Java 8, of course).
>
> @Grab('com.github.bdkosher:goodtimes:1.0')
>
> compile 'com.github.bdkosher:goodtimes:1.0'
>
> -Joe
> @bdkosher
>
-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: [ANNOUNCE] Apache Groovy 2.4.11 released

2017-04-28 Thread Søren Berg Glasius
Congratulations on the latest release. It is awesome to see Groovy move
forward at a steady pace!

Have a gr8 weekend!

/Søren

On Fri, 28 Apr 2017 at 04:08 Paul King <pa...@apache.org> wrote:

> Dear community,
>
> The Apache Groovy team is pleased to announce version 2.4.11 of Apache
> Groovy.
> Apache Groovy is a multi-facet programming language for the JVM.
> Further details can be found at the http://groovy.apache.org website.
>
> This release is a maintenance release of the GROOVY_2_4_X branch.
> It is strongly encouraged that all users using prior
> versions on this branch upgrade to this version.
>
> This release includes 15 bug fixes/improvements as outlined in the
> changelog:
>
> https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12318123=12340047
>
> Sources can be downloaded from: http://www.groovy-lang.org/download.html
> Convenience binaries, SDK and documentation can be found at:
> http://www.groovy-lang.org/download.html
> Jars are also available within the major binary repositories.
> We would like to thank all people who contributed to this release.
>
> We welcome your help and feedback. For more information on how to
> report problems, and to get involved, visit the project website at
> https://groovy.apache.org/
>
> Best regards,
>
> The Apache Groovy team.
>
-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: float/double calculation bug ?

2017-03-19 Thread Søren Berg Glasius
You are running into Floating point rounding in the JVM, which is not a
Groovy bug.

Your code can be salvaged by using BigDecimal:

def calc = { amount, ttl ->
BigDecimal rtn
if (amount[-1] != '%') rtn = amount.toBigDecimal()
else rtn = ttl / 100.0 * amount.replaceAll(/%\Z/, '').toBigDecimal()

rtn
}


On Sun, 19 Mar 2017 at 17:16 Søren Berg Glasius <soe...@glasius.dk> wrote:

Hi,

This discussion does not belong on the dev mailing list, but the user
mailing list (*users@groovy.apache.org <users@groovy.apache.org>)*. Please
continue your very interesting discussion there :-) Thanks.

/Søren

On Sun, 19 Mar 2017 at 16:47 James Bond <sbyrne...@gmail.com> wrote:

What happens if you use .toDouble() instead of .toFloat, and an explicitly
double 100.0 literal?  Right now, your computation is taking an integer,
dividing by a float, then multiplying by another float.  I suspect that
going double precision won't fix this in all cases (floating point math is,
after all, just an approximation), but at least you're processing the
values as precisely as you can.

On Sun, Mar 19, 2017 at 8:28 AM, Derek Visch <derek.vi...@gmail.com> wrote:

Looks like floating point to me, what are you expecting?

On Mar 19, 2017 10:04 AM, "Tx. T" <txt8...@yahoo.com> wrote:

Any idea why the follow code "calc" returns the "70%" of the 33 incorrectly?

testing on: Groovy Version: 2.4.9 JVM: 1.8.0_112 Vendor: Oracle
Corporation OS: Mac OS X

Mac OS X 10.12.3



groovy:000> def calc = { amount, ttl ->
groovy:001> double rtn
groovy:002> if (amount[-1] != '%') rtn = amount.toDouble()
groovy:003> else rtn = ttl / 100.0 * amount.replaceAll(/%\Z/,
'').toFloat()
groovy:004>
groovy:004> rtn
groovy:005> }
===> groovysh_evaluate$_run_closure1@39fcbef6*groovy:000> calc("70%", 33)
===> 230999.997*
groovy:000> calc("10%", 33)
===> 33000.0
groovy:000> calc("20%", 33)
===> 66000.0
groovy:000> calc("30%", 33)
===> 99000.0
groovy:000> calc("40%", 33)
===> 132000.0
groovy:000> calc("50%", 33)
===> 165000.0
groovy:000> calc("60%", 33)
===> 198000.0*groovy:000> calc("70%", 330000)
===> 230999.997*
groovy:000> calc("80%", 33)
===> 264000.0
groovy:000> calc("90%", 33)
===> 297000.0
groovy:000> calc("100%", 33)
===> 330000.0


-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88 <40%2044%2091%2088>, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.

-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88 <40%2044%2091%2088>, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Re: float/double calculation bug ?

2017-03-19 Thread Søren Berg Glasius
Hi,

This discussion does not belong on the dev mailing list, but the user
mailing list (*users@groovy.apache.org <users@groovy.apache.org>)*. Please
continue your very interesting discussion there :-) Thanks.

/Søren
On Sun, 19 Mar 2017 at 16:47 James Bond <sbyrne...@gmail.com> wrote:

What happens if you use .toDouble() instead of .toFloat, and an explicitly
double 100.0 literal?  Right now, your computation is taking an integer,
dividing by a float, then multiplying by another float.  I suspect that
going double precision won't fix this in all cases (floating point math is,
after all, just an approximation), but at least you're processing the
values as precisely as you can.

On Sun, Mar 19, 2017 at 8:28 AM, Derek Visch <derek.vi...@gmail.com> wrote:

Looks like floating point to me, what are you expecting?

On Mar 19, 2017 10:04 AM, "Tx. T" <txt8...@yahoo.com> wrote:

Any idea why the follow code "calc" returns the "70%" of the 33 incorrectly?

testing on: Groovy Version: 2.4.9 JVM: 1.8.0_112 Vendor: Oracle
Corporation OS: Mac OS X

Mac OS X 10.12.3



groovy:000> def calc = { amount, ttl ->
groovy:001> double rtn
groovy:002> if (amount[-1] != '%') rtn = amount.toDouble()
groovy:003> else rtn = ttl / 100.0 * amount.replaceAll(/%\Z/,
'').toFloat()
groovy:004>
groovy:004> rtn
groovy:005> }
===> groovysh_evaluate$_run_closure1@39fcbef6*groovy:000> calc("70%", 33)
===> 230999.997*
groovy:000> calc("10%", 33)
===> 33000.0
groovy:000> calc("20%", 33)
===> 66000.0
groovy:000> calc("30%", 33)
===> 99000.0
groovy:000> calc("40%", 33)
===> 132000.0
groovy:000> calc("50%", 33)
===> 165000.0
groovy:000> calc("60%", 33)
===> 198000.0*groovy:000> calc("70%", 33)
===> 230999.997*
groovy:000> calc("80%", 33)
===> 264000.0
groovy:000> calc("90%", 33)
===> 297000.0
groovy:000> calc("100%", 33)
===> 33.0


-- 
Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


GR8Conf EU Registration ends soon!

2016-05-17 Thread Søren Berg Glasius (GR8Conf EU)
Hi,

Registrations for GR8Conf EU ends one week from now, Monday May 23rd. 

You do not want to miss this year's event! Here you can learn all about Groovy, 
Grails and Gradle from the project founders and core developers!  

From the Groovy core team you can meet: Guillaume Laforge, Cedric Champeau and 
Jochen Theodorou. From the Grails core team you can meet: Jeff Brown and Graeme 
Rocher. Cedric also represents Gradle. 

The opening keynote is delivered by Ken Kousen.  

One University day with workshops, Two conference days, Three conference 
tracks, 24 speakers from all over the world. Not to mention our home brewed 
beer for Meet & Greet.

For more information, please visit gr8conf.eu now!
 

Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem

Re: re-using a comparison closure

2016-05-16 Thread Søren Berg Glasius (GR8Conf EU)
Hi 

You can define it in a class as a static closure


class Sorters {
     static compareVersions =  { a,b ->
         return getVersion(a).toInteger() <=> getVersion(b).toInteger()
     }
}

and use it like:

list.sort(Sorters.compareVersions)

Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem

From: Guy Matz <guym...@gmail.com>
Reply: users@groovy.apache.org <users@groovy.apache.org>
Date: May 16, 2016 at 17:42:21
To: users@groovy.apache.org <users@groovy.apache.org>
Subject:  Re: re-using a comparison closure  

Thanks!  Now, I have a number of methods that need access to that closure . . . 
 Can I make the closure global?  Is there a better way?

Thanks again,
Guy

On Mon, May 16, 2016 at 11:30 AM, Søren Berg Glasius (GR8Conf EU) 
<sbglas...@gr8conf.org> wrote:
Hi Guy

Just assign the variable 

def comapreVersions = { a,b ->
return getVersion(a).toInteger() <=> getVersion(b).toInteger()
}

and then use it in your sort:


list.sort(compareVersions)



Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem

From: Guy Matz <guym...@gmail.com>
Reply: users@groovy.apache.org <users@groovy.apache.org>
Date: May 16, 2016 at 17:28:34
To: users@groovy.apache.org <users@groovy.apache.org>
Subject:  re-using a comparison closure

Hi!
I have to sort a list of strings based on a number within the string . . .  I 
am able to sort using something like:
list.sort( { a,b -> getVersion(a) <=> getVersion(b)})

I need to use this in a bunch of places in my code and was hoping to replace it 
with a method, like:
list.sort( compareVersions)

with compareVersions:
def compareVersions(a, b) {
  return getVersion(a).toInteger() <=> getVersion(b).toInteger()
}

putting the method (compoareVersions) into the sort as a param doesn't work.  
Anyone know what I'm missing?

Thanks!!
Guy



Re: re-using a comparison closure

2016-05-16 Thread Søren Berg Glasius (GR8Conf EU)
Hi Guy

Just assign the variable 

def comapreVersions = { a,b ->
return getVersion(a).toInteger() <=> getVersion(b).toInteger()
}

and then use it in your sort:


list.sort(compareVersions)



Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem

From: Guy Matz <guym...@gmail.com>
Reply: users@groovy.apache.org <users@groovy.apache.org>
Date: May 16, 2016 at 17:28:34
To: users@groovy.apache.org <users@groovy.apache.org>
Subject:  re-using a comparison closure  

Hi!
I have to sort a list of strings based on a number within the string . . .  I 
am able to sort using something like:
list.sort( { a,b -> getVersion(a) <=> getVersion(b)})

I need to use this in a bunch of places in my code and was hoping to replace it 
with a method, like:
list.sort( compareVersions)

with compareVersions:
def compareVersions(a, b) {
  return getVersion(a).toInteger() <=> getVersion(b).toInteger()
}

putting the method (compoareVersions) into the sort as a param doesn't work.  
Anyone know what I'm missing?

Thanks!!
Guy

Re: Groovy Running Slower With More Memory

2016-05-09 Thread Søren Berg Glasius (GR8Conf EU)
Hi Daniel,

Without knowing for sure, I would think that setting the minimum heap size to 
20G would take some time to allocate. What about just setting the maximum heap 
size, and let the JVM handle the minimum size, or start lower, like 2G.



Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem

From: Daniel Price <danprice...@gmail.com>
Reply: users@groovy.apache.org <users@groovy.apache.org>
Date: May 9, 2016 at 18:28:38
To: users@groovy.apache.org <users@groovy.apache.org>
Subject:  Groovy Running Slower With More Memory  

Good Afternoon.  I've been running some Groovy 2.4.2 scripts on a Windows 7 
64-bit PC with 16GB of RAM.  My scripts are memory intensive SQL Server DB 
manipulators, and I have modified startGroovy.bat to:

%JAVA_OPTS% -Xms8192M -Xmx8192M

I recently gained access to a new server running Windows Server 2012 that has 
32GB RAM and lots of flash disk, so I thought giving Groovy more RAM might 
allow the scripts to run faster.  So I installed Groovy on the server and 
modified startGroovy.bat to:

%JAVA_OPTS% -Xms20480M -Xmx20480M

But the new server runs my scripts about twice as slow as my PC.  This is true 
even with the exact same RAM settings in startGroovy.bat.

I don't know if I should expect to see a large decrease in run time based on 
additional RAM, but an increase seems odd to me.

Could this be due to OS differences?

Thanks!

Re: Check if List is of specific size and elements of specific type

2016-03-29 Thread Søren Berg Glasius (GR8Conf EU)
@dinko yeah, that's why I choose to do my example with listVariable*.getClass() 

Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem

From: Dinko Srkoč <dinko.sr...@gmail.com>
Reply: users@groovy.apache.org <users@groovy.apache.org>
Date: March 29, 2016 at 14:04:50
To: users@groovy.apache.org <users@groovy.apache.org>
Subject:  Re: Check if List is of specific size and elements of specific type  

On 29 March 2016 at 12:29, Marcos Carceles <marcos.carce...@gmail.com> wrote:  
> Would this work?  
>  
> listVariable*.class == [Integer, Integer]  

It would in this particular example, but this may be dangerous for  
some other cases. Try e.g. this:  

[1, [:], [class: 1]]*.class  

Cheers,  
Dinko  

>  
> On 29 March 2016 at 12:25, Maarten Boekhold <boekh...@gmx.com> wrote:  
>>  
>> Hi,  
>>  
>> Is there a quick and easy way to do something like:  
>>  
>> assert listVariable == [int, int]  
>>  
>> eg, the list is of size 2 and each element is an int?  
>>  
>> Maarten  
>  
>  


Re: Check if List is of specific size and elements of specific type

2016-03-29 Thread Søren Berg Glasius (GR8Conf EU)
Hi Maarten,

You could be close with this.

def listVariable = [1,2]
assert listVariable*.getClass() == [int, int]

but your assert will have to be

assert listVariable*.getClass() == [Integer, Integer]

since ints are actually the object type Integer

Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem

From: Maarten Boekhold <boekh...@gmx.com>
Reply: users@groovy.apache.org <users@groovy.apache.org>
Date: March 29, 2016 at 12:25:42
To: us...@groovy.incubator.apache.org <us...@groovy.incubator.apache.org>
Subject:  Check if List is of specific size and elements of specific type  

Hi,  

Is there a quick and easy way to do something like:  

assert listVariable == [int, int]  

eg, the list is of size 2 and each element is an int?  

Maarten  


Re: not sure about Collection.intersect

2016-02-08 Thread Søren Berg Glasius (GR8Conf EU)
Hi Paul,

c1 contains one instance of TestClass, c2 contains another. Those two are not 
equals, because they probably do not implement the equals method, and thus 
comparison is done between object references in memory, and they are different, 
being two different objects.

if you equals was implemented to compare the name of TestClass I'm pretty sure 
it would work.

Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem

From: Strachan, Paul <paul.strac...@det.nsw.edu.au>
Reply: users@groovy.apache.org <users@groovy.apache.org>
Date: February 8, 2016 at 15:12:06
To: users@groovy.apache.org <users@groovy.apache.org>
Subject:  not sure about Collection.intersect  

Groovy 2.4.4 / 2.4.5

 

Hi – I’d like to get a list of objects from collection A that exist in 
collection B using intersect() but I’m getting no results:

 

def c1 = []// as Set
def c2 = []// as Set
c1 << new TestClass(name: 'mike')
c2 << new TestClass(name: 'mike')
println c1.contains(c2[0])
assert c1.intersect(c2).size() == 1
  
  
Output:

 

true

Assertion failed:

 

assert c1.intersect(c2).size() == 1

   |  | |   |  |

   |  []    |   0  false

   |    [sample.TestClass@57]

   [sample.TestClass@57]

 

 

TestClass.groovy

 

package sample
import groovy.transform.EqualsAndHashCode
@EqualsAndHashCode(includes = 'name')
class TestClass {
    String name
}

 

 

Is intersect only for simple types?

 

 


**
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**

Re: not sure about Collection.intersect

2016-02-08 Thread Søren Berg Glasius (GR8Conf EU)
And by the way,

the easy way to implement equals and haschode is this:

import groovy.transform.EqualsAndHashCode

@EqualsAndHashCode
class TestClass {
    String name
}

Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem

From: Edinson E. Padrón Urdaneta <edinson.padron.urdan...@gmail.com>
Reply: users@groovy.apache.org <users@groovy.apache.org>
Date: February 8, 2016 at 15:29:00
To: users@groovy.apache.org <users@groovy.apache.org>
Subject:  Re: not sure about Collection.intersect  

I have to look at the implementation of the `intersect` method to be sure but 
does your TestClass class overwrite `hashcode` and `equal`? There should be a 
way to compare the instances of said class.