Graeme Rocher | 12 Jun 2006 08:31
Picon
Favicon

Re: Using GSP from grails.jar

On 6/11/06, G.Schoepp <gus-groovy@...> wrote:
> Graeme Rocher schrieb:
> > If you raise an issue on the Grails JIRA list for this I will get it
> > working. There are some recent additions to the Grails codebase that
> > have tied the implementation to Grails, this can be rectified.
>
> Thanks for your answer.
>
> I've just discovered TemplateServlet which meets my requirements up to now.
>
> Andrew Glover talks in his "Practically" article about GSPs that are
> implemented by TemplateServlet. Otherwise the author of the GSP article
> at http://groovy.codehaus.org/GSP uses the GroovyPages servlet.
>
> What are the different use cases for GroovyPages and TemplateServlet?
GSP supports imports, page directives, syntax shortcuts for access the
request etc. and in Grails custom tag libraries

Graeme

>
>    Guido
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

(Continue reading)

Marc Guillemot | 12 Jun 2006 09:35
Picon
Favicon

Re: groovy scriptom resource leak problem?


Hi,

as said by Guillaume the ActiveXProxy now contains a release() method to
explicitely release the COM related resources. This was previously done only
in ActiveXProxy.finalize() which is not necessarily called at JVM shutdown,
for instance at the end of a script execution.

Marc.
--
View this message in context: http://www.nabble.com/groovy-scriptom-resource-leak-problem--t1768558.html#a4824445
Sent from the groovy - user forum at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Antti Karanta | 12 Jun 2006 12:22
Picon
Favicon

RE: randomizing a list


> Apologies but... yee gods. Simply adding more and more iterations to a
> poor algorithms is not the answer, choosing a better algorithm in the
> first place always has to be the right answer.  In this situation,
> Collections.shuffle is not a bad algorithm, not great but far better
> that doing things like the above.
> 
> Moral of story:  Just because a language has a neat programming trick
> doesn't mean using bad algorithms instead of good ones.  In this case,
> 
> 	list.sort { Math.random() }
> 
> may look neat but it is almost certainly not doing what you 
> think it is
> doing.  I suspect adding:
> 
> 	list.shuffle()
> 
> would be far more sensible.

  I believe what the original author was after was something like this
(expressed in Ruby):

irb(main):001:0> a = (1..10).to_a
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
irb(main):002:0> a.sort_by { rand }
=> [1, 5, 8, 10, 4, 3, 6, 2, 9, 7]

  To see what sort_by does, see

(Continue reading)

John Wilson | 12 Jun 2006 12:46
Picon

Re: randomizing a list


On 12 Jun 2006, at 11:22, Antti Karanta wrote:

>
>   I believe what the original author was after was something like this
> (expressed in Ruby):
>
> irb(main):001:0> a = (1..10).to_a
> => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
> irb(main):002:0> a.sort_by { rand }
> => [1, 5, 8, 10, 4, 3, 6, 2, 9, 7]
>
>   To see what sort_by does, see
>
> http://whytheluckystiff.net/articles/rubyOneEightOh.html
>
>   (search for "sort_by" to find the appropriate place).
>
>
>   I fully agree that list.sort { Math.random() } (in Ruby: a.sort  
> { rand
> }) is quite inappropriate.
>
>
>   I think adding a similar method to groovy Collection (sortBy ?)  
> might
> be handy, too.

Actually Groovy already has something very like sort_by.

(Continue reading)

Dierk Koenig | 12 Jun 2006 13:13
Favicon
Gravatar

RE: randomizing a list

Using the sort for shuffling is at least interesting
since one has to understand:

- why it 'works' at all 
 (GDK sort handling)
- why it leads to a 'special' distribution 
 (JDK sort strategy leads to higher probability of 
  shuffling into the 'neighborhood')
- why it is not guaranteed to work at all 
 (sort impl. dependent)
- why working on the JDK is one of the unique 
  advantages of Groovy
 (because someone already implemented a 
  Collections.shuffle() that distributes evenly)

Overall, an excellent text-book example ;-)

cheers
Mittie

P.S. the 'special' distribution is interesting in
itself because one could speculate that it better
models the result of shuffling a deck of cards
manually ;-)

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

(Continue reading)

Kartik Vaddadi | 12 Jun 2006 13:18
Picon

string substitution

I noticed that string substitution doesn't work in single-quoted
strings. But the docs page for strings doesn't mention this. Is this a
bug or are the docs inaccurate? Thanks.

-Kartik

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Alex Shneyderman | 12 Jun 2006 13:27
Picon
Gravatar

Re: string substitution

"" - means GString
'' - means String

I believe it is in the docs ... hmm no, I am quite sure it is,
otherwise I would not know about it.

Alex.

On 6/12/06, Kartik Vaddadi <kartik.vad@...> wrote:
> I noticed that string substitution doesn't work in single-quoted
> strings. But the docs page for strings doesn't mention this. Is this a
> bug or are the docs inaccurate? Thanks.
>
> -Kartik

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Dierk Koenig | 12 Jun 2006 13:50
Favicon
Gravatar

RE: string substitution

> "" - means GString

... only if it contains placeholders like 
 $reference 
or
 ${expression}
otherwise, it is a conventional java.lang.String. 

> '' - means String

> > I noticed that string substitution doesn't work in single-quoted
> > strings. But the docs page for strings doesn't mention this. Is this a
> > bug or are the docs inaccurate? Thanks.

Which page are you referring to?

cheers
Mittie

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Peter Ledbrook | 12 Jun 2006 14:08
Picon
Gravatar

Re: string substitution

> Which page are you referring to?
>
> cheers
> Mittie

The User Guide section on strings does not appear to make the
distinction between "" and '' string literals:

  http://docs.codehaus.org/display/GROOVY/Strings

Cheers,

Peter

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Dierk Koenig | 12 Jun 2006 14:36
Favicon
Gravatar

RE: string substitution

ok, thanks. I updated the page.

The documentation is still not complete.
The book will contain a more thorough description.
As soon as the work on the book is finished, I will
work over documentation as well.

cheers
Mittie

> -----Original Message-----
> From: p.ledbrook@...
[mailto:p.ledbrook@...]On Behalf Of
> Peter Ledbrook
> Sent: Montag, 12. Juni 2006 14:09
> To: user@...
> Subject: Re: [groovy-user] string substitution
> 
> 
> > Which page are you referring to?
> >
> > cheers
> > Mittie
> 
> The User Guide section on strings does not appear to make the
> distinction between "" and '' string literals:
> 
>   http://docs.codehaus.org/display/GROOVY/Strings
> 
> Cheers,
(Continue reading)


Gmane