Jochen Theodorou | 1 Jun 2008 11:54
Picon
Gravatar

Re: [groovy-user] Re: groovy-1.5.6.deb not for ubuntu?

Ulli Horlacher schrieb:
> 
> framstag <at> fex:~: JAVA_OPTS="-Djava.awt.headless=true" groovysh
[...]
> 
> Great, that's it! Thanks!
> 
> Why cannot groovy give a more comprehensive error message in this case?

it is a NoClassDefFound Error thrown by the AWT in Java. On top of that 
it is a sun.* class. I personally think that error should be not like 
that in the first place, but that is an issue for Java. We can not fix 
Java, just try to find some workarounds. There is already a bug report 
for this, that's why I did know the solution already... It is just... I 
feel bad for catching a NoClassDefFoundError somehow. But I guess there 
is no real other way... Well.. we could let groovysh do a check.. maybe 
that would be more interesting.

So how do I test if I can display something or not?

bye blackdrag

--

-- 
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:
(Continue reading)

Ulli Horlacher | 2 Jun 2008 00:38
Picon
Favicon

[groovy-user] Re: groovy-1.5.6.deb not for ubuntu?

On Sun 2008-06-01 (11:54), Jochen Theodorou wrote:

> > framstag <at> fex:~: JAVA_OPTS="-Djava.awt.headless=true" groovysh
> > 
> > Why cannot groovy give a more comprehensive error message in this case?
> 
> So how do I test if I can display something or not?

Sorry, there was a misunderstanding on my side. I thought the error gets
triggered by a missing DISPLAY environment variable, but I had a wrong
DISPLAY (result of a re-attached screen session)! 

Detecting a wrong DISPLAY environment variable is somewhat difficult,
indeed.

--

-- 
Ullrich Horlacher              Server- und Arbeitsplatzsysteme
Rechenzentrum                  E-Mail: horlacher@...
Universitaet Stuttgart         Tel:    ++49-711-685-65868
Allmandring 30                 Fax:    ++49-711-682357
70550 Stuttgart (Germany)      WWW:    http://www.rus.uni-stuttgart.de/

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

    http://xircles.codehaus.org/manage_email

Fred Janon | 2 Jun 2008 04:37
Picon

[groovy-user] Groovy In Action errata gone and Scriptom error?

The link for the errata <http://groovy.canoo.com/errata/erratum> is broken at <http://www.manning.com/koenig/>. Is there a page for the errata somewhere?

I am trying the very first Scriptom example p548 with the GroovyConsole with Groovy 1.5.1 and I get:

import org.codehaus.groovy.scriptom.ActiveXProxy

def wshell = new ActiveXProxy('Wscript.Shell')
wshell.popup("Scriptom is Groovy")

====================================
org.codehaus.groovy.scriptom.ActiveXProxy
  <at> line 1, column 1.
1 error

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script0: 1: unable to resolve class org.codehaus.groovy.scriptom.ActiveXProxy
  <at> line 1, column 1.
1 error
 
Did the jar for Scriptom change since 1.0?

Thanks

Fred


Fred Janon | 2 Jun 2008 05:01
Picon

[groovy-user] Re: Groovy In Action errata gone and Scriptom error?

I found the answer to the Scriptom issue on the Groovy web page <http://groovy.codehaus.org/COM+Scripting>, ActiveXProxy has been changed to ActiveXObject:

import org.codehaus.groovy.scriptom.ActiveXObject

def wshell = new ActiveXObject('Wscript.Shell')
wshell.popup("Scriptom is Groovy")

works now with Groovy Console 1.5.1

Fred

On Mon, Jun 2, 2008 at 10:37 AM, Fred Janon <fjanon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
The link for the errata <http://groovy.canoo.com/errata/erratum> is broken at <http://www.manning.com/koenig/>. Is there a page for the errata somewhere?

I am trying the very first Scriptom example p548 with the GroovyConsole with Groovy 1.5.1 and I get:

import org.codehaus.groovy.scriptom.ActiveXProxy

def wshell = new ActiveXProxy('Wscript.Shell')
wshell.popup("Scriptom is Groovy")

====================================
org.codehaus.groovy.scriptom.ActiveXProxy
  <at> line 1, column 1.
1 error

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script0: 1: unable to resolve class org.codehaus.groovy.scriptom.ActiveXProxy
  <at> line 1, column 1.
1 error
 
Did the jar for Scriptom change since 1.0?

Thanks

Fred



Fred Janon | 2 Jun 2008 05:32
Picon

[groovy-user] Groovy in Action forum down?


<http://www.manning-sandbox.com/forum.jspa?forumID=247>

Does anyone know if it will be up ever again?

Thanks

Fred Janon | 2 Jun 2008 05:33
Picon

[groovy-user] Groovy in Action code download missing chapter 15 code?

Is there a place where I can download the code for chapter 15 Scriptom?

Thanks

Fred

Martin Stephan | 2 Jun 2008 08:09
Picon

Re: [groovy-user] Groovy in Action forum down?

It seems the whole server www.manning-sandbox.com is down, not only this specific forum. So I guess it's only temporarily.

Martin

On Mon, Jun 2, 2008 at 5:32 AM, Fred Janon <fjanon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

<http://www.manning-sandbox.com/forum.jspa?forumID=247>

Does anyone know if it will be up ever again?

Thanks


Saager Mhatre | 2 Jun 2008 08:58
Picon
Gravatar

[groovy-user] Binding 'unbound' MethodClosures

I was trying out a rather obscure implementation of a Builder to simulate a fluent DSL and landed a somewhat odd problem. (that was a mouthful! :P)

Here's what I'm trying to do.

def method = List.&get
def first = method.curry(0)

def list = []
first.delegate = list

list << 'foo'
first() //=> 'foo'

It obviously works with...

def method = list.&get //NOTE the lowercase 'l'

... but as part of the DSL, I don't get to create an instance of the target object until after the method to be invoked has been determined.
The DSL looks somehing like this,

Will.add(item).to(cart).if(condition1, condition2, ...)
Will.remove(item).from(cart).if(condition1, condition2, ...)

I realize that I could just cache the method (as a string) and the 'item' and simply...

cart."$method"(item)

... but I thought it'd be really groovy if I could cache them as a curried MethodClosure (Cart.&add.curry(item)). Except MethodClosures with Class owners (List.&get), as opposed to instance owners (list.&get) don't seem to have a valid owner to target calls to. Plus, closures don't allow modiifcation of their owner or thisObject properties.

On a more general note, I think it's Groovy's cool, approachable syntax that allows us to create edge cases like this that really push the envelope. Keep that funky Groove goin' brotha's!

--
Saager Mhatre
tugwilson | 2 Jun 2008 09:23
Picon

Re: [groovy-user] Binding 'unbound' MethodClosures


Saager Mhatre wrote:
> 
> I was trying out a rather obscure implementation of a Builder to simulate
> a
> fluent DSL and landed a somewhat odd problem. (that was a mouthful! :P)
> 
> Here's what I'm trying to do.
> 
> *def method = List.&get*
> *def first = method.curry(0)*
> 
> *def list = []*
> *first.delegate = list*
> 
> *list << 'foo'*
> *first() //=> 'foo'*
> 
> 

This works

def method = {get it}
def first = method.curry(0)

def list = []
first.delegate = list

list << 'foo'
println first() //=> 'foo'

John Wilson
--

-- 
View this message in context: http://www.nabble.com/Binding-%27unbound%27-MethodClosures-tp17595128p17595436.html
Sent from the groovy - user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email

Saager Mhatre | 2 Jun 2008 10:36
Picon
Gravatar

Re: [groovy-user] Binding 'unbound' MethodClosures

Aww... man! That's a closure wrapping a method call!! Just a little more indirection than I'm happy with, esp since we have the Groovy Class.&method syntax!!! :(

Also, it doesn't ensure that there is actually a get method in List that takes just one parameter. In my application, the method name will be injected dynamically via BuilderSupport hooks and I want to ensure that the called method exists on the target class without having to code separate branches for cart.add and cart.remove. Just, cache curried method closure if cart.xxxx exists, else throw MissingMethodException.

On Mon, Jun 2, 2008 at 12:53 PM, tugwilson <tug-GwqJ/HqVibzQXOPxS62xeg@public.gmane.org> wrote:



Saager Mhatre wrote:
>
> I was trying out a rather obscure implementation of a Builder to simulate
> a
> fluent DSL and landed a somewhat odd problem. (that was a mouthful! :P)
>
> Here's what I'm trying to do.
>
> *def method = List.&get*
> *def first = method.curry(0)*
>
> *def list = []*
> *first.delegate = list*
>
> *list << 'foo'*
> *first() //=> 'foo'*
>
>


This works

def method = {get it}
def first = method.curry(0)

def list = []
first.delegate = list

list << 'foo'
println first() //=> 'foo'


John Wilson
--
View this message in context: http://www.nabble.com/Binding-%27unbound%27-MethodClosures-tp17595128p17595436.html
Sent from the groovy - user mailing list archive at Nabble.com.


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

   http://xircles.codehaus.org/manage_email





--
Saager Mhatre

Gmane