java.lang.NumberFormatException from java.io.Writer.write()

classic Classic list List threaded Threaded
82 messages Options
12345
Reply | Threaded
Open this post in threaded view
|

Casting to type String (was: Re: [Ibm-netrexx] Hijacking, Part 1 ... (Re: Some thoughts about the real problems at hand)

Rony G. Flatscher (wu-wien)
Alan,

On 17.10.2011 19:06, Alan Sampson wrote:
Rony,

At this point I take issue with you.  
 
But the NetRexx programmer did not request the "write(String)" method, he requested a "write(Rexx)" method!

I did indeed (via casting) request "write(String)" but the current NetRexx implementation silently ignored that demand and internally coerced my String back to a Rexx then invoked write(int).  In my opinion this is more of a surprise than the results given by the change suggested by Kermit.

Original attempt:

filebuff.write(String rec)

eventual resolution:

(Writer filebuff).write(rec)

If I know (by reading the documentation of the class I'm using) that a method in the class hierarchy exists which matches 100% what I want then it is a surprise to find that the compiler/translator jumps through hoops to use something else regardless of how much I insist via casting.  This is particularly egregious as it only shows up as a runtime error so may not be caught in testing and make its way out onto a customer's system.

from your initial e-mail, entitled "java.lang.NumberFormatException from java.io.Writer.write()", from 2011-10-01:
I'm not sure if this is a bug or if I'm just doing something wrong.

The following program fails with a java.lang.NumberFormatException when attempting to write strings to a file (compiled with NetRexx 3.00 and NetRexx 3.01RC2, build 1-20110925-2337):

/* NetRexx */
options replace format comments java crossref savelog symbols binary

players = [String -
    'Stephen Harper:Goal' -
  , 'Fabricio Coloccini:Def' -
]


filename = 'TxFileIO001N.txt'
fileobj  = File(filename)
filebuff = BufferedWriter(FileWriter(fileobj))

loop r_ = 0 to players.length - 1
  rec = String(players[r_])
  say rec
  filebuff.write(rec)
  filebuff.newLine
  end r_
filebuff.close

return
You created a String from the players[r_] entry and assigned it to a Rexx variable. So that's the version I had memorized. (Sorry, if I overlooked a clarification w.r.t. casting the method's argument explicitly to String in the discussion!)

Trying to cast the method invocation ["filebuff.write(String rec)"] or making sure that "rec" is of type String ["rec=String" before the loop] does treat the String like a Rexx value and therefore is not able to resolve the write(String) method in the superclass. A Rexx and a String value in this case are treated interchangeably/identically.

This behaviour is surely questionable. Especially, if one explicitly casts an argument, clearly indicating the desire to use a method that possesses that strict type (eventually forcing method resolution in the superclass).

Also, if one strictly types a value, then while carrying out the method resolution the strict types (clear information given by the NetRexx programmer) should prevail the cost-based picking of a method for that particular argument.

---

The following variation using also the stractassign option works (but note the cast needed for creating the filebuff value); changes bolded:
/* NetRexx */
options replace format comments java keepasjava crossref savelog symbols binary strictassign

players = [String -
    'Stephen Harper:Goal' -
  , 'Fabricio Coloccini:Def' -
]


filename = 'TxFileIO001N.txt'
fileobj  = File(filename)
filebuff = BufferedWriter(Writer FileWriter(fileobj))
rec=String
loop r_ = 0 to players.length - 1
  rec = String(players[r_])
  say rec
  filebuff.write(rec)
  filebuff.newLine
  end r_
filebuff.close

return
---rony



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Hijacking, Part 1 ... (Re: Some thoughts about the real problems at hand)

Kermit Kiser
In reply to this post by Rony G. Flatscher (wu-wien)
Rony -

Thanks again for bringing to the surface any assumptions or speculations that need to be discussed openly.

I admit that I am a little puzzled about why you keep insisting that the costing algorithms NetRexx uses are somehow secret or hidden. NetRexx has been open source for several months now so anyone can read the code.  But Thomas has asked for a zip version of the latest "after3.01" source, so I am going to assume that some people might not be able to access the SVN repository. I have just posted a zip file with the latest version of the after3.01 branch (revision 159), including source, in the NetRexx Plus download area for anyone who wants to download it:

http://kenai.com/projects/netrexx-plus/downloads/download/Experimental%20NetRexx%20Build/after3.01.zip

Mike did a great job of isolating all of the tables and logic for cost calculations and conversion in one module: RxConverter

Here are his comments from the costing method in that module:

/** --------------------------------------------------------------------
    ASSIGNCOST -- return cost of assigning one type to another
    Arg1 is context cursor [only needed for subclass resolution]
    Arg2 is LHS type  (LHS <= RHS)
    Arg3 is RHS type

    Costs are as follows [range 0-100]:

       0 -- exact match, or null assigned to reference
     1-5 -- free conversion (widening primitive)
      10 -- safe conversion or superclass cast
            These conversions can only fail if out of space
            11-12: boolean -> primitive, etc.
            14: String/Rexx -> char[]
            15: char and char[]->String/Rexx/char[] widening conversions
                with cost (except char->char[])
            17: Other Rexx/String/char[] conversions
      20 -- safe conversion (new object) required, risk of space error, or
            string out of bounds (iff String -> char) (A safe conversion
            will raise runtime exception if loss of information)
            This includes primitive -> boolean
      25 <= boundary for automatic conversions
      30 -- primitive cast required
      40 -- class cast required (e.g., to subclass), risk involved
         -- conversion (new object) required, risk of space or conversion
            error, or potential loss of information, i.e., toString
      50 <= boundary for explicit conversions
     100 -- conversion impossible (e.g., dissimilar types, or dimensions
            mismatch)

    If returns <100 then ASSIGNPROC is set to indicate the procedure
      (algorithm) to be used for effecting the conversion (defined and
      for use by CONVERTCODE).
    If returns 100 then ASSIGNPROC is undefined.

    Note that method assign and true assign are treated the same at the
    moment, but in fact they may differ slightly (e.g., byte<->int); we
    may want to expose or hide this later.
 -------------------------------------------------------------------- */

Perhaps that will help explain why I selected cost 17 for the String<=>CharSequence<=>Rexx conversions in 3.01. But that decision can be revised if needed, as I mentioned before.

I have added a few comments to your note using underscore italic this time.

-- Kermit


On 10/17/2011 9:23 AM, Rony G. Flatscher wrote:
Hi Kermit,

just a few (almost last :) ) remarks:

On 17.10.2011 01:13, Kermit Kiser wrote:

... cut ...

Imagine that a NetRexx program obtains an object "o" of type X either through inheritance or instance creation, etc., and calls a method XYZ using that object with some argument string: o.XYZ(...).  NR3 or NR4 might find that method in class X, class Y, or class Z.
Search for a matching method always starts at the class from which the object got created from. If a matching method can be found there, then superclasses are not searched for anymore.

To completely compare behaviors, we have to consider each location separately and also whether the method selected is an "exact" match vs NetRexx performing automatic argument conversion to match it ("inexact match") since each case is handled differently.
Currently, if a method can be found in the class of which an object is an instance from, then that method is used, irrespectably whether matching methods can be found in superclasses.

That gives us 6 basic cases to look at which should cover any more complex chains as well. Keep in mind that we are looking primarily at what happens when recompiling the NetRexx program with NR3 or NR4 even though some of these changes may affect a non-recompiled program also.

1) method XYZ is a member of class X with exact match to the calling arguments:  No changes to classes X, Y, or Z can affect method selection by NR3 or NR4 except for removing method XYZ entirely from class X, of course. Both NR3 and NR4 behave like Java in this case.

2) method XYZ is a member of class X with inexact match to the calling arguments: No changes to classes Y or Z can affect NR3 method selection, but adding a new matchable XYZ method with different signature to class X could alter the NR3 selection. Since NR4 looks at X, Y, and Z in the case of inexact matches, adding a new XYZ method to any of those classes could alter the method selected if it is a better match (lower cost).
Ad "better match (lower cost)": this is one of the basic assumptions that I have been trying to challenge.

It cannot be said whether a method with lower costs in superclasses is a "better match" as a found method in the class the object got created from! This assumption can only turn true, if the expectations of the NetRexx programmer *by coincidence* meet exactly the assumptions underlying the cost-based method-picking algorithm. As no one knows the cost-based algorithm or is aware of the costs, an exact match of the NetRexx programmer expectation with the NetRexx method picking cost-algorithms is pure luck.
:)

See Mike's comments from the costing algorithm in RxConverter that I pasted above.

There is another interesting point here IMHO: in Alan's example, everyone who reads the code is inclined to conclude, that indeed the method in the superclass (expecting a String) is better than the one in the class the object got created from (expecting an int). The reason probably being that the program's Rexx variable, which serves as an argument, does not contain a number. So the conclusion is even stronger: it is only the String-version of the method that in this very particular case is the right method to pick!

As NetRexx has to guess at translation/compile time which method is "best", its assumptions are of paramount importance. Consider Alan's example and his Rexx value having an integer value like "17", which could be a String, but it could also be expected to be used as a number, perfectly fitting a conversion to int!

So, if the NR4-behaviour picks Alan's "correct method", then this happens by pure luck only! Had Alan's example Rexx variable contained the string "17", then it would  not be clear, that picking the supercalss method would be the "correct" method to be picked. And actually, if Alan intended to use the int-version with that Rexx value "17", then picking the superclass' String method would be an error with NR4!

@Java: Java is very different here (and cannot be compared to NetRexx) as in Java the datatypes are strictly given, and the Java compiler will always pick an exactly matching method. This is also the reason why constant casting is so important (and cumbersome sometimes) in Java programs. (Or: NetRexx ain't Java! The NetRexx cost algorithm is a surrogate which asserts that NetRexx will always pick the same method, because all of the conversion costs are known, short of having a better alternative for picking a method.)

... cut ...

As Alan has pointed out, when trying to fix the error, he did indeed try an exact match call to write(String) just as a Java programmer would use and NetRexx still did not allow it! But even when he used the signature write(Rexx), Mike's costing algorithm returned cost 20 to convert Rexx to int and only cost 17 to convert Rexx to String. Oops! The costing algorithm had no effect in this case! If both methods were in the same class, the NetRexx costing algorithm would have picked the desired write(String) method, but the current NetRexx does not allow that method to even be seen! There is no problem with Mike's costing algorithm - it is definitely safer to convert Rexx to String than to int. The problem is simply caused by not allowing NetRexx to "see" the methods available so it can make a better choice.
The above summary shows that the proposed method selection behavior is much closer to the way that Java behaves
The warning here: this is purely by co-incidence and can be even wrong (like in the case, where "17" was indeed meant to be an integer number by the programmer in Alan's example).

and has less exposure to dangerous changes in method selection such as changing exact signature matches to inexact matches. 
There is a trap here, I think: taking a Rexx value to be always a String value.

If "options binary strictassign" was in effect, then these arguments may be understandable, but not if Rexx values serve as wildcards for the primitive types (and their wrapper classes) and String (and CharSequence for that matter).

Since NetRexx uses Java to compile programs to binary code, it converts all method calls to exact matches before passing them to Java.
Well, NetRexx *translates* NetRexx code to Java code, which then is compiled with a Java compiler.

The ongoing discussion is about how the NetRexx code should translate to Java code.

That means that the exposure to changing methods at runtime through changes to superclasses is identical to that of Java so I don't think we need to consider it here.
Could you explain this a little bit more?

I simply meant to point out that if a superclass adds or deletes a method which has been picked by NetRexx (or Java) at compile time, it can change the method being used at runtime.

I have added some comments in italics to Rony's note below.
... cut ...

The "Alan-issue" is not an issue/bug of NetRexx IMHO, as NetRexx behaves according to its specifications: it picks a matching method in the current class.
The current NetRexx specifications are not Java compatible. A Java programmer requesting a write(String) method would get that method, not a probably incompatible write(int) method.
But the NetRexx programmer did not request the "write(String)" method, he requested a "write(Rexx)" method!

Therefore the current NetRexx translation, finding a "write(int)" method picked that method, as it is known that a Rexx datatype can be converted to an int, so this is a safe conversion. If at runtime the Rexx value does not allow for translating to an int, a runtime error is thrown (which is the case in Alan's example).

See my comment above.

Correct, BufferedWriter defines a method 'write(int)', but not a method 'write(String)', which is defined in its superclass Writer.
It would sure be nice if this stuff just worked correctly like it does in Java without needing all of those special casts!
Yes, I agree, that it would be nice. But this is a sort of asking for a(n impossible) "squared circle".

Odd. It works perfectly in my proposed "after3.01" translator version.


P.S.: W.r.t. to the CharSequence interface: it would be a meaningful enhancement to extend the NetRexx conversion rules to cover CharSequence explicitly as well. Probably its costs should be different to String conversions to not get have the same minimum costs as the String-argument versions (which would lead to an error message of NetRexx to have the NetRexx programmer decide which method it should pick).

Actually the String<=>CharSequence<=>Rexx conversions were added to NetRexx 3.01 although the cost setting of 17 is the same as Rexx<=>String. That cost setting can be revisited if it causes method selection problems, however NetRexx 3.00 produces the same error messages so I don't think those conversion costs are relevant here.
Ah, very interesting!

Please allow me a few questions then:
  • Are there then the constructors Rexx(CharSequence) and Rexx(CharSequence[]) available as well?
  • Ad weight/cost being the same between converting Rexx to String and CharSequence: that would be o.k. (as would be different costs, as long as they are close and just being used to favor one method version over the other, i.e. biasing a String over CharSequence or vice versa), however, it would be interesting to learn the reasons for the same weights/costs in order to make them available to discussion.
The first constructor is present in 3.01. I am not sure the second would be useful, but it could be added if needed. As for the cost item, see my comments above.
A last remark: probably all has been said, discussed in the context of the original problem Alan put forward, and the information that was given since then (including CharSequence and an erorneous behaviour w.r.t. constructors if extending a concrete class that implements interfaces, which methods are reported to be missing in the implementation of the extended class). With this e-mail I hope to have pin-pointed at (sometimes maybe hidden) assumptions, that might be challengable (which does not mean, that the assumptions are bad, just that they have not been explicitly discussed in this context and in the necessary depth, at least IMHO) and may not have been that clear from the conversation so far.

---rony

_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Hijacking, Part 1 ... (Re: Some thoughts about the real problems at hand)

ThSITC
In reply to this post by alansam
Hello all,
   from my point of view, it's simply WRONG that any Rexx string *can be converted* to an INTEGER, at all.
   Thus, it's now a matter of COST!
   It is simply an ERROR that any Rexx String can be converted to an INTEGER.

  Thus, Alan's example of the usage of WRITE should produce an ERROR message (Cannon convert given method 'write(Rexx)' to any available method' and NOT implicietyl TRY to convert a Rexx String to an INT!

Full Stop.
Thomas Schneider.
=========================================================
 
Am 17.10.2011 19:06, schrieb Alan Sampson:
Rony,

At this point I take issue with you.  
 
But the NetRexx programmer did not request the "write(String)" method, he requested a "write(Rexx)" method!

I did indeed (via casting) request "write(String)" but the current NetRexx implementation silently ignored that demand and internally coerced my String back to a Rexx then invoked write(int).  In my opinion this is more of a surprise than the results given by the change suggested by Kermit.

Original attempt:

filebuff.write(String rec)

eventual resolution:

(Writer filebuff).write(rec)

If I know (by reading the documentation of the class I'm using) that a method in the class hierarchy exists which matches 100% what I want then it is a surprise to find that the compiler/translator jumps through hoops to use something else regardless of how much I insist via casting.  This is particularly egregious as it only shows up as a runtime error so may not be caught in testing and make its way out onto a customer's system.

Alan.

--
Can't tweet, won't tweet!


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Hijacking, Part 1 ... (Re: Some thoughts about the real problems at hand)

ThSITC
Misspelled in typing, ahain, I'm sorry...

it's now a matter of COST should read: it's *not* a matter of COST!

I will try to type slower and make less errors (or re-read my messages
before I press the send button) ...

Promised, and I do apologize, but a Rexx STRING cannot be COERCED
to an INTEGER in all cases, and thus the obviously WRONG method
is selected bvy the current costing algorithm!

Thomas.
========================================================
Am 18.10.2011 15:56, schrieb Thomas Schneider:
Hello all,
   from my point of view, it's simply WRONG that any Rexx string *can be converted* to an INTEGER, at all.
   Thus, it's now a matter of COST!
   It is simply an ERROR that any Rexx String can be converted to an INTEGER.

  Thus, Alan's example of the usage of WRITE should produce an ERROR message (Cannon convert given method 'write(Rexx)' to any available method' and NOT implicietyl TRY to convert a Rexx String to an INT!

Full Stop.
Thomas Schneider.
=========================================================
 
Am 17.10.2011 19:06, schrieb Alan Sampson:
Rony,

At this point I take issue with you.  
 
But the NetRexx programmer did not request the "write(String)" method, he requested a "write(Rexx)" method!

I did indeed (via casting) request "write(String)" but the current NetRexx implementation silently ignored that demand and internally coerced my String back to a Rexx then invoked write(int).  In my opinion this is more of a surprise than the results given by the change suggested by Kermit.

Original attempt:

filebuff.write(String rec)

eventual resolution:

(Writer filebuff).write(rec)

If I know (by reading the documentation of the class I'm using) that a method in the class hierarchy exists which matches 100% what I want then it is a surprise to find that the compiler/translator jumps through hoops to use something else regardless of how much I insist via casting.  This is particularly egregious as it only shows up as a runtime error so may not be caught in testing and make its way out onto a customer's system.

Alan.

--
Can't tweet, won't tweet!


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)


--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Hijacking, Part 1 ... (Re: Some thoughts about the real problems at hand)

Robert L Hamilton
'Every thing' in a computer is coded in binary integers!

Bob Hamilton, Engineer

On Tue, Oct 18, 2011 at 9:00 AM, Thomas Schneider <[hidden email]> wrote:
Misspelled in typing, ahain, I'm sorry...

it's now a matter of COST should read: it's *not* a matter of COST!

I will try to type slower and make less errors (or re-read my messages
before I press the send button) ...

Promised, and I do apologize, but a Rexx STRING cannot be COERCED
to an INTEGER in all cases, and thus the obviously WRONG method
is selected bvy the current costing algorithm!

Thomas.
========================================================
Am 18.10.2011 15:56, schrieb Thomas Schneider:
Hello all,
   from my point of view, it's simply WRONG that any Rexx string *can be converted* to an INTEGER, at all.
   Thus, it's now a matter of COST!
   It is simply an ERROR that any Rexx String can be converted to an INTEGER.

  Thus, Alan's example of the usage of WRITE should produce an ERROR message (Cannon convert given method 'write(Rexx)' to any available method' and NOT implicietyl TRY to convert a Rexx String to an INT!

Full Stop.
Thomas Schneider.
=========================================================
 
Am 17.10.2011 19:06, schrieb Alan Sampson:
Rony,

At this point I take issue with you.  
 
But the NetRexx programmer did not request the "write(String)" method, he requested a "write(Rexx)" method!

I did indeed (via casting) request "write(String)" but the current NetRexx implementation silently ignored that demand and internally coerced my String back to a Rexx then invoked write(int).  In my opinion this is more of a surprise than the results given by the change suggested by Kermit.

Original attempt:

filebuff.write(String rec)

eventual resolution:

(Writer filebuff).write(rec)

If I know (by reading the documentation of the class I'm using) that a method in the class hierarchy exists which matches 100% what I want then it is a surprise to find that the compiler/translator jumps through hoops to use something else regardless of how much I insist via casting.  This is particularly egregious as it only shows up as a runtime error so may not be caught in testing and make its way out onto a customer's system.

Alan.

--
Can't tweet, won't tweet!


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)


--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/




_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Hijacking, Part 1 ... (Re: Some thoughts about the real problems at hand)

ThSITC
Hello Robert,
   *BUT NOT* everything coded in binary integers IS a NUMBER! Sorry!
And a STRING might REPRESENT a NUMBER, *or* a TEXT!

   Thus, my feeling is:

1.2 *is NOT* equal to '1.2' (semantically)
(as '...' might also contain: 'Robert Hamilton'), thus:

rec='Robert Hamilton'
rec.wite

*might NOT be automatically coerced to:*
rec.write.toInt()
 
Thomas.
==================================================
Am 18.10.2011 16:39, schrieb Robert Hamilton:
'Every thing' in a computer is coded in binary integers!

Bob Hamilton, Engineer

On Tue, Oct 18, 2011 at 9:00 AM, Thomas Schneider <[hidden email]> wrote:
Misspelled in typing, ahain, I'm sorry...

it's now a matter of COST should read: it's *not* a matter of COST!

I will try to type slower and make less errors (or re-read my messages
before I press the send button) ...

Promised, and I do apologize, but a Rexx STRING cannot be COERCED
to an INTEGER in all cases, and thus the obviously WRONG method
is selected bvy the current costing algorithm!

Thomas.
========================================================
Am 18.10.2011 15:56, schrieb Thomas Schneider:
Hello all,
   from my point of view, it's simply WRONG that any Rexx string *can be converted* to an INTEGER, at all.
   Thus, it's now a matter of COST!
   It is simply an ERROR that any Rexx String can be converted to an INTEGER.

  Thus, Alan's example of the usage of WRITE should produce an ERROR message (Cannon convert given method 'write(Rexx)' to any available method' and NOT implicietyl TRY to convert a Rexx String to an INT!

Full Stop.
Thomas Schneider.
=========================================================
 
Am 17.10.2011 19:06, schrieb Alan Sampson:
Rony,

At this point I take issue with you.  
 
But the NetRexx programmer did not request the "write(String)" method, he requested a "write(Rexx)" method!

I did indeed (via casting) request "write(String)" but the current NetRexx implementation silently ignored that demand and internally coerced my String back to a Rexx then invoked write(int).  In my opinion this is more of a surprise than the results given by the change suggested by Kermit.

Original attempt:

filebuff.write(String rec)

eventual resolution:

(Writer filebuff).write(rec)

If I know (by reading the documentation of the class I'm using) that a method in the class hierarchy exists which matches 100% what I want then it is a surprise to find that the compiler/translator jumps through hoops to use something else regardless of how much I insist via casting.  This is particularly egregious as it only shows up as a runtime error so may not be caught in testing and make its way out onto a customer's system.

Alan.

--
Can't tweet, won't tweet!


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)


--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/





_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

A Rexx value is not a number ? (Re: [Ibm-netrexx] Hijacking, Part 1 ... (Re: Some thoughts about the real problems at hand)

Rony G. Flatscher (wu-wien)
Thomas,

Consider this Rexx program:
say "enter a number"
parse pull number
call process number, "17.71"
exit

process: procedure
     parse arg number, divisor
     say number"/"divisor"="number/divisor
     return
Then run the above program and enter "1" on the first run and look at the output. Then re-run it entering something like "abc".

How would you (or your package) translate that Rexx program to NetRexx?

What results does the NetRexx version give, if you feed it the above two values?
(And what is the meaning of "options binary", according to the NetRexx language specification, in this context, what would it do?)

---rony


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

OO programmer wannabee

kenner
In reply to this post by Robert L Hamilton

I have been teaching myself netrexx and OO coding for over a year now with the help of this list and the resources it points me to. My progress has been quite good, building on the examples I gleened from the net. Thanks to all of you who have prepared the tutorials and documentation. Now I wonder if anyone would have the time and inclination to look at some of my code and tell me if I am on the right track. My biggest confusion is with encapsulation. I _want_ to pass some values around and have them computed and displayed in different frames.

/*NetRexx */

options replace comments java crossref savelog symbols verbose4 trace1 logo

--import java.awt.List
import java.io.Reader
import java.text.                                 -- Needed for the SimpleDateFormat class
import java.util.                                 -- Needed for integer math
import netrexx.lang.Rexx

-- this is our main class
class qandagui

Properties inheritable static -- some vars for the whole class
                question1 = Rexx[99]
                answerX = Rexx[99,5]
                RorW = Rexx[99,5]
                ans_done = int[99]
                rightones = int 0
                try_cnt = 0
                sub_k = int
                Random_Int = int
                My_Int = rexx
                response1 = Rexx
                 
method main(s=String[]) static
        say 'Executing the latest code on' date() source
/*        t1=time('R') */
/* Open and check the files       */
        do
                inhandle=BufferedReader(InputStreamReader(FileInputStream('C:\\Documents and Settings\\keklein\\My Documents\\REXX\\NetRexx\\bin\\QandA.txt')))
                say 'Processing infile'
                catch Z=IOException
                        say '# error opening file' Z.getMessage
        end
/* The processing loop to load our table from the txt file.               ***/
        loop sub_k = 0 by 1
                line = inhandle.readLine -- get next line as Rexx string
                if line=null then leave sub_k  -- normal end of file
                parse line 'Q1 ' question_in
                question1[sub_k] = question_in
                line = inhandle.readLine -- get next line as Rexx string
                if line=null then leave sub_k  -- normal end of file
                parse line -
                        A1 answer_in1 ',' -
                        A2 answer_in2 ',' -
                        A3 answer_in3 ',' -
                        A4 answer_in4 ',' -
                        A5 answer_in5 ',' . ;
                answerX[sub_k,0] = answer_in1
                answerX[sub_k,1] = answer_in2
                answerX[sub_k,2] = answer_in3
                answerX[sub_k,3] = answer_in4
                answerX[sub_k,4] = answer_in5
                RorW[sub_k,0] = A1
                RorW[sub_k,1] = A2
                RorW[sub_k,2] = A3
                RorW[sub_k,3] = A4
                RorW[sub_k,4] = A5
        end sub_k
        loop label checkarray sub_i = 0 to (sub_k - 1)
                say
                say sub_i question1[sub_i]
                loop label innerloop sub_j = 0 to 4
                        say sub_i sub_j "-->" answerX[sub_i,sub_j] RorW[sub_i,sub_j]
                end innerloop
                say
        end checkarray
        say 'Total questions to be asked =' sub_k "Press enter to continue..."
        response1=ask
        if response1.upper ==  "Q" | response1 == "X" then exit
loop label clrscn for 99; say; end clrscn;
-- loop label Rep_Screen_thru_table until frm.Possible_Answer[ix] = 'Right.'
trace results
    RepeatScreen(sub_k)
-- end Rep_Screen_thru_table ;        


method RepeatScreen(total_lines = int) static
                try_cnt = try_cnt + 1
                rightones = rightones + 1
                Random_Int = GetRand(sub_k)
            loop label findundone while ans_done[Random_Int] == 1
                        if Random_Int < sub_k then Random_Int = Random_Int + 1
                        if Random_Int >= sub_k then Random_Int = 0
                end findundone
                ans_done[Random_Int] = 1
                this_question='Question' Random_Int || ')' question1[Random_Int]
        abf=AboutFrame(this_question,answerX[Random_Int,0],RorW[Random_Int,0],answerX[Random_Int,1],RorW[Random_Int,1],answerX[Random_Int,2],RorW[Random_Int,2],answerX[Random_Int,3],RorW[Random_Int,3],answerX[Random_Int,4],RorW[Random_Int,4],try_cnt)
         
         abf.SetTitle('BJCP Training')          /* Set a title */
                  abf.Set_Question(this_question)
                  abf.Set_Pos_Answer(answerX[Random_Int,0],RorW[Random_Int,0])
                  abf.Set_Pos_Answer(answerX[Random_Int,1],RorW[Random_Int,1])
                  abf.Set_Pos_Answer(answerX[Random_Int,2],RorW[Random_Int,2])
                  abf.Set_Pos_Answer(answerX[Random_Int,3],RorW[Random_Int,3])
                  abf.Set_Pos_Answer(answerX[Random_Int,4],RorW[Random_Int,4])
                  abf.SelectQuestion(0) /* Select first Question */
                  abf.ShowAbout() /* Show it */

                say try_cnt "attempts. " rightones "correct. " try_cnt - rightones "wrong." try_cnt / rightones || "%"

/*        t2=time('E') */
/*  t=rexx(t2-t1).format(7,5).strip('L').strip('T','O')  */
/*  say "Percent:" rightones/(rightones)*100"%  Elapsed time in seconds:" t */

method GetRand(total_lines = int) returns rexx static
        My_int = (total_lines*Math.random()) % 1 -- %1 make result to integer
        RETURN My_Int
       
class AboutFrame extends Frame
Properties inheritable
                  NbrFrames = 0
                  TxtWho = TextArea(' ',400,999,TextArea.SCROLLBARS_NONE)
                  List_Question = java.awt.List(5)         -- define a List Box
                  TxtAppl = Label                                         -- declare read-only text
                  PbtCncl = Button('Exit the quiz')         -- define a push button
                  dispScore = TextField(12)                         -- define a push button
                  myint = int 1                                                 -- declare number of questions
                  questions = int                                         -- declare number of questions
                  Possible_Answer = String[]                 -- declare this array
                  Possible_AnswerL = String[]
Method AboutFrame(Here_Question = String, -
                                 Here_answer1 = String, -
                                 Here_RW1 = String, -
                                 Here_answer2 = String, -
                                 Here_RW2 = String, -
                                 Here_answer3 = String, -
                                 Here_RW3 = String, -
                                 Here_answer4 = String, -
                                 Here_RW4 = String, -
                                 Here_answer5 = String, -
                                 Here_RW5 = String, -
                                 Total_trys = int) -
                                 public

        myint = Total_trys
        say myint "=" Total_trys
         dispScore = TextField(myint)         -- define a place to put the score
         nbrFrames = nbrFrames+1
         if nbrFrames > 10 then exit
-- As our class is a frame extension, we should not call Frame()
-- else we'd create yet another frame
   win = Frame("About")                                         -- should not be coded
         win = this                                                         -- "win" is nicer than "this"
-- We can call the parent class to set a frame title.
         super.SetTitle(Here_Question)                         -- define default frame title

         Possible_Answer = String[5]                        -- create this array
         Possible_AnswerL = String[5]                        -- create this array
         questions = -1 -- no questions defined yet

         -- To close the window from the system menu work with WindowListener
         anObject = AboutFrameController() -- Create this object

-- Because "we"        are a frame, no need to write "win.add"
-- but it may be clearer for some readers.
         win.addWindowListener(anObject)
-- To be able to react to end-user frame events
         pbtCncl.addActionListener(AboutActionClass(this,'pbtCncl') )
         List_Question.addActionListener(AboutActionClass(this,'List_Question') )
         List_Question.addItemListener(AboutActionClass(this,'List_Question') )

-- add the visible objects to the frame
         TxtAppl = Label('The application has been written by')

         TxtWho.setEditable(0)                         -- make this area read only
         win.add("North" , TxtAppl)         -- add these objects to the frame
         win.add("West" , List_Question)
         win.add("Center" , TxtWho)
         p = Panel()                                         -- Host the button in a "panel"        to keep it small
         win.add("South" , p)                         -- add the "panel"         to the frame
         p.add(PbtCncl)                                 -- place the button in the "panel"
         q = Panel()                                         -- Host the button in a "panel"        to keep it small
         win.add("East" , q)                         -- add the "panel"         to the frame
         q.add(dispScore)                                 -- place the button in the "panel"
               
-- use some colors
         hYell = color(255,255,128) -- define a color object
         TxtAppl.setBackground(color.white) -- color of application text
         setBackground(color.white) -- color of our frame
         pbtCncl.setBackground(color.lightGray) -- color of our button
         List_Question.setBackground(hYell) -- color of our LISTBOX
         TxtWho.setBackground(hYell) -- color of our text area

----- calculate a good place for our frame ---------------
         setSize(1100,200) -- define size of window.
         offset = (NbrFrames-1) *10 -- don't place all at same place

         d = getToolkit().getScreenSize() -- get size of the screen
         s = getSize() -- get size of our frame
         SetLocation( (d.width - s.width) %6 + offset, -
                                                                       (d.height - s.height)%6 + offset )

Method SetTitle(t = String) -- Define title of the window
         super.setTitle(t) -- Must be preceeded by "super"         else we
                                                       -- call ourselves

Method Set_Question(t = String) -- Define the title of the window
         TxtAppl.setText(t)

Method Set_Pos_Answer(My_Answer = String,Descript = String)
         questions = questions+1                                 -- add an element to the questions list box
         List_Question.add(My_Answer)
         Possible_Answer[questions] = Descript         -- add his description to array
--         say questions My_Answer Descript

Method Set_Pos_Answer(My_Answer = String,Descript = String,DescLong = String)
         questions = questions+1
         List_Question.add(My_Answer)
         Possible_Answer[questions] = Descript
         Possible_AnswerL[questions] = DescLong

Method SelectQuestion(ix = int)
         if ix<= questions then List_Question.select(ix)

Method ShowAbout()
         -- As "we" the object are in fact a frame, no need to code
        this.setVisible(1)
        -- setVisible(1)

--------- This class handles events on the frame itself         ----------
class AboutFrameController extends WindowAdapter
         method windowClosing(e = WindowEvent)
                  Say 'Closed by system menu'
                  exit

--------- This class handles Action Events with objects in the frame
class AboutActionClass implements ActionListener,ItemListener
         Properties inheritable
                  frm = AboutFrame                         -- frm is an object of class AboutFrame
                  myEventName = String                -- a string is passed and available in the class
                int_I = int 0
                rightones = 0

         -- Constructor
         method AboutActionClass(x = AboutFrame, anEvent = String)
                  frm = x
                  myEventName = String anEvent

         method actionPerformed(e = ActionEvent)
                  Say 'Event happened for:' myEventName
                  Select
                           when myEventName = 'pbtCncl' then do
                                    Say 'Closed by Cancel button'
                                    frm.dispose()
                                    return
                                    end
                           when myEventName = 'List_Question' then do -- double click in List Box
                 -- Beware: testing if ..[] = '' is dangerous, it may yield a
                 -- null pointer exception. So test for "null"
                                    ix = frm.List_Question.getSelectedIndex() -- Get the selected line
                                    t = ''
                                    if frm.Possible_AnswerL[ix] <> null then
                                             if frm.Possible_AnswerL[ix] <> '' then
                                                      t = frm.Possible_AnswerL[ix]
                                    if t<>'' then do
                                             frm.TxtWho.setForeground(color.black)
                                             frm.TxtWho.setText(t)
                                             end
                                    else do
                                             frm.TxtWho.setForeground(color.red)
                                             frm.TxtWho.setText('More information about' -
                                                                                         frm.List_Question.getSelectedItem()-
                                                                                         'is not available')
                                             end
                                    end
                           Otherwise
                                    Say 'Problem:' myEventName 'is unknown'
                           end

         method itemStateChanged(e = ItemEvent)
         -- Apparently we warp to this point when the answer item is clicked.
                  Select
                           when myEventName = 'List_Question' then do
                                    ix = frm.List_Question.getSelectedIndex() -- Get the selected line -if any
--                                    Say 'Select event in Listbox, item:' ix
                                   if frm.Possible_Answer[ix] = 'Right.' then do
                                        rightones = rightones + 1
                                        say "Great! you found the right answer." rightones
                                            frm.dispose()
                                           qandagui.RepeatScreen(75)
                                    end
                                   if frm.Possible_Answer[ix] = 'Wrong.' then do
                                        -- increment the counter up in the qandagui class
                                         say frm.dispScore.getText()
                                        if frm.dispScore.getText() > 0 then do
                                                 int_I = frm.dispScore.getText()
                                                 int_I = int_I + 1
                                                say int_I " <-- gettext #"
                                                end
                                        else do                                -- if the field is null grab the try_cnt
                                                 int_I  = qandagui.try_cnt + 1
                                                say int_I " <-- gettext #"
                                                end
                                    end
                                    frm.TxtWho.setForeground(color.black)
                                    if ix >= 0 then frm.TxtWho.setText(frm.Possible_Answer[ix])
                                                                                         else frm.TxtWho.setText(' ')
                                    end
                           Otherwise
                                    Say 'Problem:' myEventName 'is unknown'
                   end
                  Say 'This is the Possible_answer:' frm.Possible_Answer[ix]
                GuiApp(int_I)
                frm.dispScore.setText(int_I)

-- display the number of correctly answered questions
-- display the number of incorrect answers
-- display the percent of correct answers
class GuiApp
Properties inheritable
window = Frame

method GuiApp(The_Score)
-- Create a frame window
        window = Frame('Multiple choice quiz score.')
-- Set the size of the window
        window.setSize(210,100)
-- Set the window position to the middle of the screen
        d = window.getToolkit().getScreenSize()
        s = window.getSize()
        window.setLocation((d.width - s.width) % 2,(d.height - s.height)%2)
-- Add a label to the window. The label text is centered
        f = SimpleDateFormat("H:mm:ss" ) -- Formats hours:minutes:seconds
        text1 = Label("Started at:"  f.format(Date()) ,Label.CENTER)
        text2 = Label("Total running score of attempts." The_Score,Label.CENTER)
        window.add("North" , text1) -- Add the label to the window
        window.add("Center" , text2) -- Add the label to the window
-- add the window event listener to the window for close window events
        window.addWindowListener( CloseWindowAdapter() )
-- show the window
        window.setVisible(1)
/*-------------------------------------------------------------------------------
The CloseWindowAdapter exits the application when the window is closed.
WindowAdapter is an abstract class which implements a WindowListener interface.
The windowClosing() method is called when the window is closed.
-----------------------------------------------------------------------------*/
class CloseWindowAdapter extends WindowAdapter
        method windowClosing( e=WindowEvent )
exit 0


The above program uses the following input file:

 Q1 Name a commercial example of a brown porter.
 Right. Sam Smith Taddy Porter, Wrong. Sleeman Cream Ale, Wrong. Anchor Porter, Wrong. Baltika porter, Wrong. Leffe Blonde,
 Q1 Name a commercial example of a robust porter.
 Wrong. Samual Smith Taddy Porter, Wrong. Brooklyn Brown Ale, Wrong. Lost Coast Downtown Brown, Wrong. Baltika porter, Right. Great Lakes Edmund Fitgerald,
 Q1 Name a commercial example of a (5B) traditional Bock.
 Right. Einbecker Ur-bock, Wrong. Sleeman Cream Ale, Wrong. Zum Uerige, Wrong. Avery Salvation, Wrong. Rochefort 8,
 Q1 Name a commercial example of a (11C) Northern English Brown Ale.
 Right. Newcastle, Wrong. Sleeman Cream Ale, Wrong. Brooklyn Brown Ale, Wrong. Bell's Best Brown, Wrong. Lost Coast Downtown Brown, W% Lost Coast Downtown Brown,
 Q1 Which action will help avoid DMS in the finished beer?
 Wrong. Boil the wort with the cover on, Right. Cool the wort quickly, Wrong. Prevent evaporization of boiling wort, Wrong. add cinnamon, Wrong. stir wort often,
 Q1 Hop bitterness in beer comes primarily from what?
 Wrong. tannins, Wrong. essential oils, Right. hop resins, Wrong. scorching the wort, Wrong. myrcene
 Q1 Boiling Fuggle hops for 10 minutes will do which of the following:
 Wrong. drive off essential oils, Wrong. isomerize Cohumulone, Wrong. give a herbal aroma, Right. all of the above,
 Q1 Sniff the entry immediately after pouring to ensure proper evaluation of volatile aromatics.
 Right. True, Wrong. False,
 Q1 Which of the following is NOT a purpose of the BJCP?
 Right. standardize beer styles,  Wrong. promote the appreciation of real beer, Wrong. promote beer literacy, Wrong. recognize beer tasting and evaluation skills,
 Q1 To acheive a judge designation of Apprentice, what score on the test is required?
 Wrong. 90-100, Wrong. 80-89, Wrong. 70-79, Wrong. 60-69, Right. <60,
 Q1 To acheive a judge designation of Recognized, what score on the test is required?
 Wrong. 90-100, Wrong. 80-89, Wrong. 70-79, Right. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of Certified, what score on the test is required?
 Wrong. 90-100, Wrong. 80-89, Right. 70-79, Wrong. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of National, what score on the test is required?
 Wrong. 90-100, Right. 80-89, Wrong. 70-79, Wrong. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of Master or above, what score on the test is required?
 Right. 90-100, Wrong. 80-89, Wrong. 70-79, Wrong. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of Apprentice, how many experience points are required?
 Wrong. 50, Wrong. 40, Wrong. 20, Wrong. 5, Right. none,
 Q1 To acheive a judge designation of Recognized, how many experience points are required?
 Wrong. 50, Wrong. 40, Wrong. 20, Wrong. 5, Right. none,
 Q1 To acheive a judge designation of Certified, how many experience points are required?
 Wrong. 100, Wrong. 50, Wrong. 40, Wrong. 20, Right. 5,
 Q1 To acheive a judge designation of National, how many experience points are required?
 Wrong. 100, Wrong. 50, Wrong. 40, Right. 20, Wrong. 5,

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

RE: OO programmer wannabee

measel

Put the variables you want to pass around in the main class.

 

class qandagui

    NbrFrames = Rexx

    TomString = 1

 

Start by getting a new instance of yourself (main class)

 

method main(s=String[]) static
       

    qandagui(s)

 

method qandagui(s)

say 'Executing the latest code on' date() source

say this.NbrFrames

 

        

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Tuesday, October 18, 2011 11:56 AM
To: IBM Netrexx
Subject: [Ibm-netrexx] OO programmer wannabee

 


I have been teaching myself netrexx and OO coding for over a year now with the help of this list and the resources it points me to. My progress has been quite good, building on the examples I gleened from the net. Thanks to all of you who have prepared the tutorials and documentation. Now I wonder if anyone would have the time and inclination to look at some of my code and tell me if I am on the right track. My biggest confusion is with encapsulation. I _want_ to pass some values around and have them computed and displayed in different frames.

/*NetRexx */

options replace comments java crossref savelog symbols verbose4 trace1 logo

--import java.awt.List
import java.io.Reader
import java.text.                                 -- Needed for the SimpleDateFormat class
import java.util.                                 -- Needed for integer math
import netrexx.lang.Rexx

-- this is our main class
class qandagui

Properties inheritable static -- some vars for the whole class
                question1 = Rexx[99]
                answerX = Rexx[99,5]
                RorW = Rexx[99,5]
                ans_done = int[99]
                rightones = int 0
                try_cnt = 0
                sub_k = int
                Random_Int = int
                My_Int = rexx
                response1 = Rexx
                 
method main(s=String[]) static
        say 'Executing the latest code on' date() source
/*        t1=time('R') */
/* Open and check the files       */
        do
                inhandle=BufferedReader(InputStreamReader(FileInputStream('C:\\Documents and Settings\\keklein\\My Documents\\REXX\\NetRexx\\bin\\QandA.txt')))
                say 'Processing infile'
                catch Z=IOException
                        say '# error opening file' Z.getMessage
        end
/* The processing loop to load our table from the txt file.               ***/
        loop sub_k = 0 by 1
                line = inhandle.readLine -- get next line as Rexx string
                if line=null then leave sub_k  -- normal end of file
                parse line 'Q1 ' question_in
                question1[sub_k] = question_in
                line = inhandle.readLine -- get next line as Rexx string
                if line=null then leave sub_k  -- normal end of file
                parse line -
                        A1 answer_in1 ',' -
                        A2 answer_in2 ',' -
                        A3 answer_in3 ',' -
                        A4 answer_in4 ',' -
                        A5 answer_in5 ',' . ;
                answerX[sub_k,0] = answer_in1
                answerX[sub_k,1] = answer_in2
                answerX[sub_k,2] = answer_in3
                answerX[sub_k,3] = answer_in4
                answerX[sub_k,4] = answer_in5
                RorW[sub_k,0] = A1
                RorW[sub_k,1] = A2
                RorW[sub_k,2] = A3
                RorW[sub_k,3] = A4
                RorW[sub_k,4] = A5
        end sub_k
        loop label checkarray sub_i = 0 to (sub_k - 1)
                say
                say sub_i question1[sub_i]
                loop label innerloop sub_j = 0 to 4
                        say sub_i sub_j "-->" answerX[sub_i,sub_j] RorW[sub_i,sub_j]
                end innerloop
                say
        end checkarray
        say 'Total questions to be asked =' sub_k "Press enter to continue..."
        response1=ask
        if response1.upper ==  "Q" | response1 == "X" then exit
loop label clrscn for 99; say; end clrscn;
-- loop label Rep_Screen_thru_table until frm.Possible_Answer[ix] = 'Right.'
trace results
    RepeatScreen(sub_k)
-- end Rep_Screen_thru_table ;        


method RepeatScreen(total_lines = int) static
                try_cnt = try_cnt + 1
                rightones = rightones + 1
                Random_Int = GetRand(sub_k)
            loop label findundone while ans_done[Random_Int] == 1
                        if Random_Int < sub_k then Random_Int = Random_Int + 1
                        if Random_Int >= sub_k then Random_Int = 0
                end findundone
                ans_done[Random_Int] = 1
                this_question='Question' Random_Int || ')' question1[Random_Int]
        abf=AboutFrame(this_question,answerX[Random_Int,0],RorW[Random_Int,0],answerX[Random_Int,1],RorW[Random_Int,1],answerX[Random_Int,2],RorW[Random_Int,2],answerX[Random_Int,3],RorW[Random_Int,3],answerX[Random_Int,4],RorW[Random_Int,4],try_cnt)
         
         abf.SetTitle('BJCP Training')          /* Set a title */
                  abf.Set_Question(this_question)
                  abf.Set_Pos_Answer(answerX[Random_Int,0],RorW[Random_Int,0])
                  abf.Set_Pos_Answer(answerX[Random_Int,1],RorW[Random_Int,1])
                  abf.Set_Pos_Answer(answerX[Random_Int,2],RorW[Random_Int,2])
                  abf.Set_Pos_Answer(answerX[Random_Int,3],RorW[Random_Int,3])
                  abf.Set_Pos_Answer(answerX[Random_Int,4],RorW[Random_Int,4])
                  abf.SelectQuestion(0) /* Select first Question */
                  abf.ShowAbout() /* Show it */

                say try_cnt "attempts. " rightones "correct. " try_cnt - rightones "wrong." try_cnt / rightones || "%"

/*        t2=time('E') */
/*  t=rexx(t2-t1).format(7,5).strip('L').strip('T','O')  */
/*  say "Percent:" rightones/(rightones)*100"%  Elapsed time in seconds:" t */

method GetRand(total_lines = int) returns rexx static
        My_int = (total_lines*Math.random()) % 1 -- %1 make result to integer
        RETURN My_Int
       
class AboutFrame extends Frame
Properties inheritable
                  NbrFrames = 0
                  TxtWho = TextArea(' ',400,999,TextArea.SCROLLBARS_NONE)
                  List_Question = java.awt.List(5)         -- define a List Box
                  TxtAppl = Label                                         -- declare read-only text
                  PbtCncl = Button('Exit the quiz')         -- define a push button
                  dispScore = TextField(12)                         -- define a push button
                  myint = int 1                                                 -- declare number of questions
                  questions = int                                         -- declare number of questions
                  Possible_Answer = String[]                 -- declare this array
                  Possible_AnswerL = String[]
Method AboutFrame(Here_Question = String, -
                                 Here_answer1 = String, -
                                 Here_RW1 = String, -
                                 Here_answer2 = String, -
                                 Here_RW2 = String, -
                                 Here_answer3 = String, -
                                 Here_RW3 = String, -
                                 Here_answer4 = String, -
                                 Here_RW4 = String, -
                                 Here_answer5 = String, -
                                 Here_RW5 = String, -
                                 Total_trys = int) -
                                 public

        myint = Total_trys
        say myint "=" Total_trys
         dispScore = TextField(myint)         -- define a place to put the score
         nbrFrames = nbrFrames+1
         if nbrFrames > 10 then exit
-- As our class is a frame extension, we should not call Frame()
-- else we'd create yet another frame
   win = Frame("About")                                         -- should not be coded
         win = this                                                         -- "win" is nicer than "this"
-- We can call the parent class to set a frame title.
         super.SetTitle(Here_Question)                         -- define default frame title

         Possible_Answer = String[5]                        -- create this array
         Possible_AnswerL = String[5]                        -- create this array
         questions = -1 -- no questions defined yet

         -- To close the window from the system menu work with WindowListener
         anObject = AboutFrameController() -- Create this object

-- Because "we"        are a frame, no need to write "win.add"
-- but it may be clearer for some readers.
         win.addWindowListener(anObject)
-- To be able to react to end-user frame events
         pbtCncl.addActionListener(AboutActionClass(this,'pbtCncl') )
         List_Question.addActionListener(AboutActionClass(this,'List_Question') )
         List_Question.addItemListener(AboutActionClass(this,'List_Question') )

-- add the visible objects to the frame
         TxtAppl = Label('The application has been written by')

         TxtWho.setEditable(0)                         -- make this area read only
         win.add("North" , TxtAppl)         -- add these objects to the frame
         win.add("West" , List_Question)
         win.add("Center" , TxtWho)
         p = Panel()                                         -- Host the button in a "panel"        to keep it small
         win.add("South" , p)                         -- add the "panel"         to the frame
         p.add(PbtCncl)                                 -- place the button in the "panel"
         q = Panel()                                         -- Host the button in a "panel"        to keep it small
         win.add("East" , q)                         -- add the "panel"         to the frame
         q.add(dispScore)                                 -- place the button in the "panel"
               
-- use some colors
         hYell = color(255,255,128) -- define a color object
         TxtAppl.setBackground(color.white) -- color of application text
         setBackground(color.white) -- color of our frame
         pbtCncl.setBackground(color.lightGray) -- color of our button
         List_Question.setBackground(hYell) -- color of our LISTBOX
         TxtWho.setBackground(hYell) -- color of our text area

----- calculate a good place for our frame ---------------
         setSize(1100,200) -- define size of window.
         offset = (NbrFrames-1) *10 -- don't place all at same place

         d = getToolkit().getScreenSize() -- get size of the screen
         s = getSize() -- get size of our frame
         SetLocation( (d.width - s.width) %6 + offset, -
                                                                       (d.height - s.height)%6 + offset )

Method SetTitle(t = String) -- Define title of the window
         super.setTitle(t) -- Must be preceeded by "super"         else we
                                                       -- call ourselves

Method Set_Question(t = String) -- Define the title of the window
         TxtAppl.setText(t)

Method Set_Pos_Answer(My_Answer = String,Descript = String)
         questions = questions+1                                 -- add an element to the questions list box
         List_Question.add(My_Answer)
         Possible_Answer[questions] = Descript         -- add his description to array
--         say questions My_Answer Descript

Method Set_Pos_Answer(My_Answer = String,Descript = String,DescLong = String)
         questions = questions+1
         List_Question.add(My_Answer)
         Possible_Answer[questions] = Descript
         Possible_AnswerL[questions] = DescLong

Method SelectQuestion(ix = int)
         if ix<= questions then List_Question.select(ix)

Method ShowAbout()
         -- As "we" the object are in fact a frame, no need to code
        this.setVisible(1)
        -- setVisible(1)

--------- This class handles events on the frame itself         ----------
class AboutFrameController extends WindowAdapter
         method windowClosing(e = WindowEvent)
                  Say 'Closed by system menu'
                  exit

--------- This class handles Action Events with objects in the frame
class AboutActionClass implements ActionListener,ItemListener
         Properties inheritable
                  frm = AboutFrame                         -- frm is an object of class AboutFrame
                  myEventName = String                -- a string is passed and available in the class
                int_I = int 0
                rightones = 0

         -- Constructor
         method AboutActionClass(x = AboutFrame, anEvent = String)
                  frm = x
                  myEventName = String anEvent

         method actionPerformed(e = ActionEvent)
                  Say 'Event happened for:' myEventName
                  Select
                           when myEventName = 'pbtCncl' then do
                                    Say 'Closed by Cancel button'
                                    frm.dispose()
                                    return
                                    end
                           when myEventName = 'List_Question' then do -- double click in List Box
                 -- Beware: testing if ..[] = '' is dangerous, it may yield a
                 -- null pointer exception. So test for "null"
                                    ix = frm.List_Question.getSelectedIndex() -- Get the selected line
                                    t = ''
                                    if frm.Possible_AnswerL[ix] <> null then
                                             if frm.Possible_AnswerL[ix] <> '' then
                                                      t = frm.Possible_AnswerL[ix]
                                    if t<>'' then do
                                             frm.TxtWho.setForeground(color.black)
                                             frm.TxtWho.setText(t)
                                             end
                                    else do
                                             frm.TxtWho.setForeground(color.red)
                                             frm.TxtWho.setText('More information about' -
                                                                                         frm.List_Question.getSelectedItem()-
                                                                                         'is not available')
                                             end
                                    end
                           Otherwise
                                    Say 'Problem:' myEventName 'is unknown'
                           end

         method itemStateChanged(e = ItemEvent)
         -- Apparently we warp to this point when the answer item is clicked.
                  Select
                           when myEventName = 'List_Question' then do
                                    ix = frm.List_Question.getSelectedIndex() -- Get the selected line -if any
--                                    Say 'Select event in Listbox, item:' ix
                                   if frm.Possible_Answer[ix] = 'Right.' then do
                                        rightones = rightones + 1
                                        say "Great! you found the right answer." rightones
                                            frm.dispose()
                                           qandagui.RepeatScreen(75)
                                    end
                                   if frm.Possible_Answer[ix] = 'Wrong.' then do
                                        -- increment the counter up in the qandagui class
                                         say frm.dispScore.getText()
                                        if frm.dispScore.getText() > 0 then do
                                                 int_I = frm.dispScore.getText()
                                                 int_I = int_I + 1
                                                say int_I " <-- gettext #"
                                                end
                                        else do                                -- if the field is null grab the try_cnt
                                                 int_I  = qandagui.try_cnt + 1
                                                say int_I " <-- gettext #"
                                                end
                                    end
                                    frm.TxtWho.setForeground(color.black)
                                    if ix >= 0 then frm.TxtWho.setText(frm.Possible_Answer[ix])
                                                                                         else frm.TxtWho.setText(' ')
                                    end
                           Otherwise
                                    Say 'Problem:' myEventName 'is unknown'
                   end
                  Say 'This is the Possible_answer:' frm.Possible_Answer[ix]
                GuiApp(int_I)
                frm.dispScore.setText(int_I)

-- display the number of correctly answered questions
-- display the number of incorrect answers
-- display the percent of correct answers
class GuiApp
Properties inheritable
window = Frame

method GuiApp(The_Score)
-- Create a frame window
        window = Frame('Multiple choice quiz score.')
-- Set the size of the window
        window.setSize(210,100)
-- Set the window position to the middle of the screen
        d = window.getToolkit().getScreenSize()
        s = window.getSize()
        window.setLocation((d.width - s.width) % 2,(d.height - s.height)%2)
-- Add a label to the window. The label text is centered
        f = SimpleDateFormat("H:mm:ss" ) -- Formats hours:minutes:seconds
        text1 = Label("Started at:"  f.format(Date()) ,Label.CENTER)
        text2 = Label("Total running score of attempts." The_Score,Label.CENTER)
        window.add("North" , text1) -- Add the label to the window
        window.add("Center" , text2) -- Add the label to the window
-- add the window event listener to the window for close window events
        window.addWindowListener( CloseWindowAdapter() )
-- show the window
        window.setVisible(1)
/*-------------------------------------------------------------------------------
The CloseWindowAdapter exits the application when the window is closed.
WindowAdapter is an abstract class which implements a WindowListener interface.
The windowClosing() method is called when the window is closed.
-----------------------------------------------------------------------------*/
class CloseWindowAdapter extends WindowAdapter
        method windowClosing( e=WindowEvent )
exit 0


The above program uses the following input file:

 Q1 Name a commercial example of a brown porter.
 Right. Sam Smith Taddy Porter, Wrong. Sleeman Cream Ale, Wrong. Anchor Porter, Wrong. Baltika porter, Wrong. Leffe Blonde,
 Q1 Name a commercial example of a robust porter.
 Wrong. Samual Smith Taddy Porter, Wrong. Brooklyn Brown Ale, Wrong. Lost Coast Downtown Brown, Wrong. Baltika porter, Right. Great Lakes Edmund Fitgerald,
 Q1 Name a commercial example of a (5B) traditional Bock.
 Right. Einbecker Ur-bock, Wrong. Sleeman Cream Ale, Wrong. Zum Uerige, Wrong. Avery Salvation, Wrong. Rochefort 8,
 Q1 Name a commercial example of a (11C) Northern English Brown Ale.
 Right. Newcastle, Wrong. Sleeman Cream Ale, Wrong. Brooklyn Brown Ale, Wrong. Bell's Best Brown, Wrong. Lost Coast Downtown Brown, W% Lost Coast Downtown Brown,
 Q1 Which action will help avoid DMS in the finished beer?
 Wrong. Boil the wort with the cover on, Right. Cool the wort quickly, Wrong. Prevent evaporization of boiling wort, Wrong. add cinnamon, Wrong. stir wort often,
 Q1 Hop bitterness in beer comes primarily from what?
 Wrong. tannins, Wrong. essential oils, Right. hop resins, Wrong. scorching the wort, Wrong. myrcene
 Q1 Boiling Fuggle hops for 10 minutes will do which of the following:
 Wrong. drive off essential oils, Wrong. isomerize Cohumulone, Wrong. give a herbal aroma, Right. all of the above,
 Q1 Sniff the entry immediately after pouring to ensure proper evaluation of volatile aromatics.
 Right. True, Wrong. False,
 Q1 Which of the following is NOT a purpose of the BJCP?
 Right. standardize beer styles,  Wrong. promote the appreciation of real beer, Wrong. promote beer literacy, Wrong. recognize beer tasting and evaluation skills,
 Q1 To acheive a judge designation of Apprentice, what score on the test is required?
 Wrong. 90-100, Wrong. 80-89, Wrong. 70-79, Wrong. 60-69, Right. <60,
 Q1 To acheive a judge designation of Recognized, what score on the test is required?
 Wrong. 90-100, Wrong. 80-89, Wrong. 70-79, Right. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of Certified, what score on the test is required?
 Wrong. 90-100, Wrong. 80-89, Right. 70-79, Wrong. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of National, what score on the test is required?
 Wrong. 90-100, Right. 80-89, Wrong. 70-79, Wrong. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of Master or above, what score on the test is required?
 Right. 90-100, Wrong. 80-89, Wrong. 70-79, Wrong. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of Apprentice, how many experience points are required?
 Wrong. 50, Wrong. 40, Wrong. 20, Wrong. 5, Right. none,
 Q1 To acheive a judge designation of Recognized, how many experience points are required?
 Wrong. 50, Wrong. 40, Wrong. 20, Wrong. 5, Right. none,
 Q1 To acheive a judge designation of Certified, how many experience points are required?
 Wrong. 100, Wrong. 50, Wrong. 40, Wrong. 20, Right. 5,
 Q1 To acheive a judge designation of National, how many experience points are required?
 Wrong. 100, Wrong. 50, Wrong. 40, Right. 20, Wrong. 5,


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A Rexx value is not a number ? (Re: [Ibm-netrexx] Hijacking, Part 1 ... (Re: Some thoughts about the real problems at hand)

ThSITC
In reply to this post by Rony G. Flatscher (wu-wien)
Hello Rony, many thanks for the testcase.

The correct answer *should  be*:

call process number, "17.71"
------------------------------^
line 3: error: Expected Number

This is detected in the semantic analysis of Rexx2Nrx, by the Type detection algorithms. I will, however, have to re-test it when I'm thru with the new 7.00 version.

Have a nice day,
Thomas.

PS: My personal opinion goes along this thread, but I do NOT like to fight with anybody about this... My decision and opinion is simply based on
more than 40 years of programming in various languages ;-)
=========================================================



Am 18.10.2011 17:49, schrieb Rony G. Flatscher:
Thomas,

Consider this Rexx program:
say "enter a number"
parse pull number
call process number, "17.71"
exit

process: procedure
     parse arg number, divisor
     say number"/"divisor"="number/divisor
     return
Then run the above program and enter "1" on the first run and look at the output. Then re-run it entering something like "abc".

How would you (or your package) translate that Rexx program to NetRexx?

What results does the NetRexx version give, if you feed it the above two values?
(And what is the meaning of "options binary", according to the NetRexx language specification, in this context, what would it do?)

---rony



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: OO programmer wannabee

ThSITC
In reply to this post by kenner
Hello Kenneth, *and all*:

Your example program does raise an *interesting question*:

In which CONTEXTS is 'source' recognized as a known symbol ?
Is this specified anywhere in nrl3.def ?

I (personally) thought it is only allowed in 'parse source' !
Please advise...

Thomas.

PS: Kenneth, I also do see that you did comment out t1=time('R').

May I advise, that my RexxTime class (already in the org.netrexx repository
on KENAI under org.netrexx.thsitc.runtime.compatibility, class RexxTime, *does implement* the date(...) and time(...) functionality as specified in classic or Open Object Rexx.!

Usage is:

import org.netrexx.thsitc.runtime.compatibility

class qandagui USES RexxTime
     t1=time('R')

Note the usage of the (far too less used USES keyword of NetRexx!)

Thomas Schneider.
=====================================================
Am 18.10.2011 18:56, schrieb [hidden email]

I have been teaching myself netrexx and OO coding for over a year now with the help of this list and the resources it points me to. My progress has been quite good, building on the examples I gleened from the net. Thanks to all of you who have prepared the tutorials and documentation. Now I wonder if anyone would have the time and inclination to look at some of my code and tell me if I am on the right track. My biggest confusion is with encapsulation. I _want_ to pass some values around and have them computed and displayed in different frames.

/*NetRexx */

options replace comments java crossref savelog symbols verbose4 trace1 logo

--import java.awt.List
import java.io.Reader
import java.text.                                 -- Needed for the SimpleDateFormat class
import java.util.                                 -- Needed for integer math
import netrexx.lang.Rexx

-- this is our main class
class qandagui

Properties inheritable static -- some vars for the whole class
                question1 = Rexx[99]
                answerX = Rexx[99,5]
                RorW = Rexx[99,5]
                ans_done = int[99]
                rightones = int 0
                try_cnt = 0
                sub_k = int
                Random_Int = int
                My_Int = rexx
                response1 = Rexx
                 
method main(s=String[]) static
        say 'Executing the latest code on' date() source
/*        t1=time('R') */
/* Open and check the files       */
        do
                inhandle=BufferedReader(InputStreamReader(FileInputStream('C:\\Documents and Settings\\keklein\\My Documents\\REXX\\NetRexx\\bin\\QandA.txt')))
                say 'Processing infile'
                catch Z=IOException
                        say '# error opening file' Z.getMessage
        end
/* The processing loop to load our table from the txt file.               ***/
        loop sub_k = 0 by 1
                line = inhandle.readLine -- get next line as Rexx string
                if line=null then leave sub_k  -- normal end of file
                parse line 'Q1 ' question_in
                question1[sub_k] = question_in
                line = inhandle.readLine -- get next line as Rexx string
                if line=null then leave sub_k  -- normal end of file
                parse line -
                        A1 answer_in1 ',' -
                        A2 answer_in2 ',' -
                        A3 answer_in3 ',' -
                        A4 answer_in4 ',' -
                        A5 answer_in5 ',' . ;
                answerX[sub_k,0] = answer_in1
                answerX[sub_k,1] = answer_in2
                answerX[sub_k,2] = answer_in3
                answerX[sub_k,3] = answer_in4
                answerX[sub_k,4] = answer_in5
                RorW[sub_k,0] = A1
                RorW[sub_k,1] = A2
                RorW[sub_k,2] = A3
                RorW[sub_k,3] = A4
                RorW[sub_k,4] = A5
        end sub_k
        loop label checkarray sub_i = 0 to (sub_k - 1)
                say
                say sub_i question1[sub_i]
                loop label innerloop sub_j = 0 to 4
                        say sub_i sub_j "-->" answerX[sub_i,sub_j] RorW[sub_i,sub_j]
                end innerloop
                say
        end checkarray
        say 'Total questions to be asked =' sub_k "Press enter to continue..."
        response1=ask
        if response1.upper ==  "Q" | response1 == "X" then exit
loop label clrscn for 99; say; end clrscn;
-- loop label Rep_Screen_thru_table until frm.Possible_Answer[ix] = 'Right.'
trace results
    RepeatScreen(sub_k)
-- end Rep_Screen_thru_table ;        


method RepeatScreen(total_lines = int) static
                try_cnt = try_cnt + 1
                rightones = rightones + 1
                Random_Int = GetRand(sub_k)
            loop label findundone while ans_done[Random_Int] == 1
                        if Random_Int < sub_k then Random_Int = Random_Int + 1
                        if Random_Int >= sub_k then Random_Int = 0
                end findundone
                ans_done[Random_Int] = 1
                this_question='Question' Random_Int || ')' question1[Random_Int]
        abf=AboutFrame(this_question,answerX[Random_Int,0],RorW[Random_Int,0],answerX[Random_Int,1],RorW[Random_Int,1],answerX[Random_Int,2],RorW[Random_Int,2],answerX[Random_Int,3],RorW[Random_Int,3],answerX[Random_Int,4],RorW[Random_Int,4],try_cnt)
         
         abf.SetTitle('BJCP Training')          /* Set a title */
                  abf.Set_Question(this_question)
                  abf.Set_Pos_Answer(answerX[Random_Int,0],RorW[Random_Int,0])
                  abf.Set_Pos_Answer(answerX[Random_Int,1],RorW[Random_Int,1])
                  abf.Set_Pos_Answer(answerX[Random_Int,2],RorW[Random_Int,2])
                  abf.Set_Pos_Answer(answerX[Random_Int,3],RorW[Random_Int,3])
                  abf.Set_Pos_Answer(answerX[Random_Int,4],RorW[Random_Int,4])
                  abf.SelectQuestion(0) /* Select first Question */
                  abf.ShowAbout() /* Show it */

                say try_cnt "attempts. " rightones "correct. " try_cnt - rightones "wrong." try_cnt / rightones || "%"

/*        t2=time('E') */
/*  t=rexx(t2-t1).format(7,5).strip('L').strip('T','O')  */
/*  say "Percent:" rightones/(rightones)*100"%  Elapsed time in seconds:" t */

method GetRand(total_lines = int) returns rexx static
        My_int = (total_lines*Math.random()) % 1 -- %1 make result to integer
        RETURN My_Int
       
class AboutFrame extends Frame
Properties inheritable
                  NbrFrames = 0
                  TxtWho = TextArea(' ',400,999,TextArea.SCROLLBARS_NONE)
                  List_Question = java.awt.List(5)         -- define a List Box
                  TxtAppl = Label                                         -- declare read-only text
                  PbtCncl = Button('Exit the quiz')         -- define a push button
                  dispScore = TextField(12)                         -- define a push button
                  myint = int 1                                                 -- declare number of questions
                  questions = int                                         -- declare number of questions
                  Possible_Answer = String[]                 -- declare this array
                  Possible_AnswerL = String[]
Method AboutFrame(Here_Question = String, -
                                 Here_answer1 = String, -
                                 Here_RW1 = String, -
                                 Here_answer2 = String, -
                                 Here_RW2 = String, -
                                 Here_answer3 = String, -
                                 Here_RW3 = String, -
                                 Here_answer4 = String, -
                                 Here_RW4 = String, -
                                 Here_answer5 = String, -
                                 Here_RW5 = String, -
                                 Total_trys = int) -
                                 public

        myint = Total_trys
        say myint "=" Total_trys
         dispScore = TextField(myint)         -- define a place to put the score
         nbrFrames = nbrFrames+1
         if nbrFrames > 10 then exit
-- As our class is a frame extension, we should not call Frame()
-- else we'd create yet another frame
   win = Frame("About")                                         -- should not be coded
         win = this                                                         -- "win" is nicer than "this"
-- We can call the parent class to set a frame title.
         super.SetTitle(Here_Question)                         -- define default frame title

         Possible_Answer = String[5]                        -- create this array
         Possible_AnswerL = String[5]                        -- create this array
         questions = -1 -- no questions defined yet

         -- To close the window from the system menu work with WindowListener
         anObject = AboutFrameController() -- Create this object

-- Because "we"        are a frame, no need to write "win.add"
-- but it may be clearer for some readers.
         win.addWindowListener(anObject)
-- To be able to react to end-user frame events
         pbtCncl.addActionListener(AboutActionClass(this,'pbtCncl') )
         List_Question.addActionListener(AboutActionClass(this,'List_Question') )
         List_Question.addItemListener(AboutActionClass(this,'List_Question') )

-- add the visible objects to the frame
         TxtAppl = Label('The application has been written by')

         TxtWho.setEditable(0)                         -- make this area read only
         win.add("North" , TxtAppl)         -- add these objects to the frame
         win.add("West" , List_Question)
         win.add("Center" , TxtWho)
         p = Panel()                                         -- Host the button in a "panel"        to keep it small
         win.add("South" , p)                         -- add the "panel"         to the frame
         p.add(PbtCncl)                                 -- place the button in the "panel"
         q = Panel()                                         -- Host the button in a "panel"        to keep it small
         win.add("East" , q)                         -- add the "panel"         to the frame
         q.add(dispScore)                                 -- place the button in the "panel"
               
-- use some colors
         hYell = color(255,255,128) -- define a color object
         TxtAppl.setBackground(color.white) -- color of application text
         setBackground(color.white) -- color of our frame
         pbtCncl.setBackground(color.lightGray) -- color of our button
         List_Question.setBackground(hYell) -- color of our LISTBOX
         TxtWho.setBackground(hYell) -- color of our text area

----- calculate a good place for our frame ---------------
         setSize(1100,200) -- define size of window.
         offset = (NbrFrames-1) *10 -- don't place all at same place

         d = getToolkit().getScreenSize() -- get size of the screen
         s = getSize() -- get size of our frame
         SetLocation( (d.width - s.width) %6 + offset, -
                                                                       (d.height - s.height)%6 + offset )

Method SetTitle(t = String) -- Define title of the window
         super.setTitle(t) -- Must be preceeded by "super"         else we
                                                       -- call ourselves

Method Set_Question(t = String) -- Define the title of the window
         TxtAppl.setText(t)

Method Set_Pos_Answer(My_Answer = String,Descript = String)
         questions = questions+1                                 -- add an element to the questions list box
         List_Question.add(My_Answer)
         Possible_Answer[questions] = Descript         -- add his description to array
--         say questions My_Answer Descript

Method Set_Pos_Answer(My_Answer = String,Descript = String,DescLong = String)
         questions = questions+1
         List_Question.add(My_Answer)
         Possible_Answer[questions] = Descript
         Possible_AnswerL[questions] = DescLong

Method SelectQuestion(ix = int)
         if ix<= questions then List_Question.select(ix)

Method ShowAbout()
         -- As "we" the object are in fact a frame, no need to code
        this.setVisible(1)
        -- setVisible(1)

--------- This class handles events on the frame itself         ----------
class AboutFrameController extends WindowAdapter
         method windowClosing(e = WindowEvent)
                  Say 'Closed by system menu'
                  exit

--------- This class handles Action Events with objects in the frame
class AboutActionClass implements ActionListener,ItemListener
         Properties inheritable
                  frm = AboutFrame                         -- frm is an object of class AboutFrame
                  myEventName = String                -- a string is passed and available in the class
                int_I = int 0
                rightones = 0

         -- Constructor
         method AboutActionClass(x = AboutFrame, anEvent = String)
                  frm = x
                  myEventName = String anEvent

         method actionPerformed(e = ActionEvent)
                  Say 'Event happened for:' myEventName
                  Select
                           when myEventName = 'pbtCncl' then do
                                    Say 'Closed by Cancel button'
                                    frm.dispose()
                                    return
                                    end
                           when myEventName = 'List_Question' then do -- double click in List Box
                 -- Beware: testing if ..[] = '' is dangerous, it may yield a
                 -- null pointer exception. So test for "null"
                                    ix = frm.List_Question.getSelectedIndex() -- Get the selected line
                                    t = ''
                                    if frm.Possible_AnswerL[ix] <> null then
                                             if frm.Possible_AnswerL[ix] <> '' then
                                                      t = frm.Possible_AnswerL[ix]
                                    if t<>'' then do
                                             frm.TxtWho.setForeground(color.black)
                                             frm.TxtWho.setText(t)
                                             end
                                    else do
                                             frm.TxtWho.setForeground(color.red)
                                             frm.TxtWho.setText('More information about' -
                                                                                         frm.List_Question.getSelectedItem()-
                                                                                         'is not available')
                                             end
                                    end
                           Otherwise
                                    Say 'Problem:' myEventName 'is unknown'
                           end

         method itemStateChanged(e = ItemEvent)
         -- Apparently we warp to this point when the answer item is clicked.
                  Select
                           when myEventName = 'List_Question' then do
                                    ix = frm.List_Question.getSelectedIndex() -- Get the selected line -if any
--                                    Say 'Select event in Listbox, item:' ix
                                   if frm.Possible_Answer[ix] = 'Right.' then do
                                        rightones = rightones + 1
                                        say "Great! you found the right answer." rightones
                                            frm.dispose()
                                           qandagui.RepeatScreen(75)
                                    end
                                   if frm.Possible_Answer[ix] = 'Wrong.' then do
                                        -- increment the counter up in the qandagui class
                                         say frm.dispScore.getText()
                                        if frm.dispScore.getText() > 0 then do
                                                 int_I = frm.dispScore.getText()
                                                 int_I = int_I + 1
                                                say int_I " <-- gettext #"
                                                end
                                        else do                                -- if the field is null grab the try_cnt
                                                 int_I  = qandagui.try_cnt + 1
                                                say int_I " <-- gettext #"
                                                end
                                    end
                                    frm.TxtWho.setForeground(color.black)
                                    if ix >= 0 then frm.TxtWho.setText(frm.Possible_Answer[ix])
                                                                                         else frm.TxtWho.setText(' ')
                                    end
                           Otherwise
                                    Say 'Problem:' myEventName 'is unknown'
                   end
                  Say 'This is the Possible_answer:' frm.Possible_Answer[ix]
                GuiApp(int_I)
                frm.dispScore.setText(int_I)

-- display the number of correctly answered questions
-- display the number of incorrect answers
-- display the percent of correct answers
class GuiApp
Properties inheritable
window = Frame

method GuiApp(The_Score)
-- Create a frame window
        window = Frame('Multiple choice quiz score.')
-- Set the size of the window
        window.setSize(210,100)
-- Set the window position to the middle of the screen
        d = window.getToolkit().getScreenSize()
        s = window.getSize()
        window.setLocation((d.width - s.width) % 2,(d.height - s.height)%2)
-- Add a label to the window. The label text is centered
        f = SimpleDateFormat("H:mm:ss" ) -- Formats hours:minutes:seconds
        text1 = Label("Started at:"  f.format(Date()) ,Label.CENTER)
        text2 = Label("Total running score of attempts." The_Score,Label.CENTER)
        window.add("North" , text1) -- Add the label to the window
        window.add("Center" , text2) -- Add the label to the window
-- add the window event listener to the window for close window events
        window.addWindowListener( CloseWindowAdapter() )
-- show the window
        window.setVisible(1)
/*-------------------------------------------------------------------------------
The CloseWindowAdapter exits the application when the window is closed.
WindowAdapter is an abstract class which implements a WindowListener interface.
The windowClosing() method is called when the window is closed.
-----------------------------------------------------------------------------*/
class CloseWindowAdapter extends WindowAdapter
        method windowClosing( e=WindowEvent )
exit 0


The above program uses the following input file:

 Q1 Name a commercial example of a brown porter.
 Right. Sam Smith Taddy Porter, Wrong. Sleeman Cream Ale, Wrong. Anchor Porter, Wrong. Baltika porter, Wrong. Leffe Blonde,
 Q1 Name a commercial example of a robust porter.
 Wrong. Samual Smith Taddy Porter, Wrong. Brooklyn Brown Ale, Wrong. Lost Coast Downtown Brown, Wrong. Baltika porter, Right. Great Lakes Edmund Fitgerald,
 Q1 Name a commercial example of a (5B) traditional Bock.
 Right. Einbecker Ur-bock, Wrong. Sleeman Cream Ale, Wrong. Zum Uerige, Wrong. Avery Salvation, Wrong. Rochefort 8,
 Q1 Name a commercial example of a (11C) Northern English Brown Ale.
 Right. Newcastle, Wrong. Sleeman Cream Ale, Wrong. Brooklyn Brown Ale, Wrong. Bell's Best Brown, Wrong. Lost Coast Downtown Brown, W% Lost Coast Downtown Brown,
 Q1 Which action will help avoid DMS in the finished beer?
 Wrong. Boil the wort with the cover on, Right. Cool the wort quickly, Wrong. Prevent evaporization of boiling wort, Wrong. add cinnamon, Wrong. stir wort often,
 Q1 Hop bitterness in beer comes primarily from what?
 Wrong. tannins, Wrong. essential oils, Right. hop resins, Wrong. scorching the wort, Wrong. myrcene
 Q1 Boiling Fuggle hops for 10 minutes will do which of the following:
 Wrong. drive off essential oils, Wrong. isomerize Cohumulone, Wrong. give a herbal aroma, Right. all of the above,
 Q1 Sniff the entry immediately after pouring to ensure proper evaluation of volatile aromatics.
 Right. True, Wrong. False,
 Q1 Which of the following is NOT a purpose of the BJCP?
 Right. standardize beer styles,  Wrong. promote the appreciation of real beer, Wrong. promote beer literacy, Wrong. recognize beer tasting and evaluation skills,
 Q1 To acheive a judge designation of Apprentice, what score on the test is required?
 Wrong. 90-100, Wrong. 80-89, Wrong. 70-79, Wrong. 60-69, Right. <60,
 Q1 To acheive a judge designation of Recognized, what score on the test is required?
 Wrong. 90-100, Wrong. 80-89, Wrong. 70-79, Right. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of Certified, what score on the test is required?
 Wrong. 90-100, Wrong. 80-89, Right. 70-79, Wrong. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of National, what score on the test is required?
 Wrong. 90-100, Right. 80-89, Wrong. 70-79, Wrong. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of Master or above, what score on the test is required?
 Right. 90-100, Wrong. 80-89, Wrong. 70-79, Wrong. 60-69, Wrong. <60,
 Q1 To acheive a judge designation of Apprentice, how many experience points are required?
 Wrong. 50, Wrong. 40, Wrong. 20, Wrong. 5, Right. none,
 Q1 To acheive a judge designation of Recognized, how many experience points are required?
 Wrong. 50, Wrong. 40, Wrong. 20, Wrong. 5, Right. none,
 Q1 To acheive a judge designation of Certified, how many experience points are required?
 Wrong. 100, Wrong. 50, Wrong. 40, Wrong. 20, Right. 5,
 Q1 To acheive a judge designation of National, how many experience points are required?
 Wrong. 100, Wrong. 50, Wrong. 40, Right. 20, Wrong. 5,


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



--
Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: A Rexx value is not a number ? (Re: [Ibm-netrexx] Hijacking, Part 1 ... (Re: Some thoughts about the real problems at hand)

Rony G. Flatscher (wu-wien)
In reply to this post by ThSITC
Thomas:

On 19.10.2011 12:27, Thomas Schneider wrote:
Hello Rony, many thanks for the testcase.

The correct answer *should  be*:

call process number, "17.71"
------------------------------^
line 3: error: Expected Number

This is detected in the semantic analysis of Rexx2Nrx, by the Type detection algorithms. I will, however, have to re-test it when I'm thru with the new 7.00 version.

Have a nice day,
Thomas.

PS: My personal opinion goes along this thread, but I do NOT like to fight with anybody about this... My decision and opinion is simply based on
more than 40 years of programming in various languages ;-)
no matter how many years of programming one has, it is important what language concepts one is able to overlook and to apply.

There are issues which cannot be resolved by "personal feelings" of one individual or another, hence such "feelings" cannot qualify, if decisions have to be undertaken.

In this particular discussion you probably need to be fully aware of the concepts of the Rexx language (and ooRexx language, if you claim to be able to deal with it as well) and the NetRexx language.

---

In your answer you did not show a NetRexx version of the Rexx program, so here is one (the original Rexx program is at the end of this mail):
say "enter a number"
number=ask
process(number, "17.71")


method process(number, divisor) static
     say number"/"divisor"="number/divisor
     return
---

If you run this NetRexx program and supply the value "1" via the keyboard the following output is generated:
F:\test\schneider>NetRexxC -exec test.nrx
NetRexx portable processor, version NetRexx 3.01RC2, build 1-20110925-2337
Copyright (c) RexxLA, 2011.  All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program test.nrx
    function process(Rexx,Rexx)
===== Exec: test =====
enter a number
1
1/17.71=0.0564652739
If you run the Rexx program given in my original e-mail ("challenge") below and supply the value "1" via the keyboard the following output is generated using  ooRexx:
F:\test\schneider>rexx test.rex
enter a number
1
1/17.71=0.0564652739
So both, Rexx and NetRexx behave the same!

---

If you run this NetRexx program and supply the value "abc" via the keyboard the following output is generated:
F:\test\schneider>NetRexxC -exec test.nrx
NetRexx portable processor, version NetRexx 3.01RC2, build 1-20110925-2337
Copyright (c) RexxLA, 2011.  All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program test.nrx
    function process(Rexx,Rexx)
===== Exec: test =====
enter a number
abc
===== Exception running class test: java.lang.NumberFormatException: abc =====
   --- in test.process(Rexx,Rexx) [test.nrx:6]
 7 +++      say number"/"divisor"="number/divisor
   +++                                   ^
   --- in test.main(String[]) [test.nrx:1]
 3 +++ process(number, "17.71")
   +++ ^^^^^^^
Processing of 'test.nrx' complete
If you run the Rexx program given in my original e-mail ("challenge") below  and supply the value "abc" via the keyboard the following output is generated using  ooRexx:
F:\test\schneider>rexx test.rex
enter a number
abc
     8 *-*   say number"/"divisor"="number/divisor
     3 *-* call process number, "17.71"
Error 41 running F:\test\schneider\test.rex line 8:  Bad arithmetic conversion
Error 41.1:  Nonnumeric value ("abc") used in arithmetic operation
So both, Rexx and NetRexx behave the same!

---

As you can see, just by experimenting a little bit would you become able to not depend on "feelings" anymore.
:)

---

You should really look into this simple Rexx program and one of its NetRexx representations, and also reread the Rexx (and NetRexx) design principles and language specifications as only then would you be able to fully understand, why a Rexx value can be a number [and among other things why that possibility is so important for the (easiness) of the programming language(s)].

---rony




Am 18.10.2011 17:49, schrieb Rony G. Flatscher:
Thomas,

Consider this Rexx program:
say "enter a number"
parse pull number
call process number, "17.71"
exit

process: procedure
     parse arg number, divisor
     say number"/"divisor"="number/divisor
     return
Then run the above program and enter "1" on the first run and look at the output. Then re-run it entering something like "abc".

How would you (or your package) translate that Rexx program to NetRexx?

What results does the NetRexx version give, if you feed it the above two values?
(And what is the meaning of "options binary", according to the NetRexx language specification, in this context, what would it do?)

---rony



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Hijacking, Part 2 ... (Re: Some thoughtsaboutthe real problems at hand)

Tom Maynard
In reply to this post by Mike Cowlishaw
On 10/16/2011 11:55 AM, Mike Cowlishaw wrote:
Hindsight is a wonderful thing!

Or, to put it another way, "It's comforting to realize that it really was an oncoming train."  (Or: "Is that really a train's tail light?"

Tom.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Hijacking, Part 2 ... (Re: Some thoughtsaboutthe real problems at hand)

Robert L Hamilton
Hind-sight trumps foresight and Planning every time. . .

BobH
Richardson Texas USA

On Sat, Oct 22, 2011 at 12:11 AM, Tom Maynard <[hidden email]> wrote:
On 10/16/2011 11:55 AM, Mike Cowlishaw wrote:
Hindsight is a wonderful thing!

Or, to put it another way, "It's comforting to realize that it really was an oncoming train."  (Or: "Is that really a train's tail light?"

Tom.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/




_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Should I bother getting "package Redbook" to work?

kenner
In reply to this post by Tom Maynard

International Technical Support Organization
Creating Java Applications Using NetRexx
September 1997

Or is this obsolete? Is there some tutorial that I would benefit from faster? My goal is to convert some netrexx text oriented programs to a gui interface (currently on Windoze xp).

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Should I bother getting "package Redbook" to work?

rvjansen
Kenneth,


this is a good book but as you already suspected, the GUI section is
outdated - that is to say, everything in it still works (like AWT GUIs)
but you would want to look into Swing userinterfaces, or even JavaFX (or
a hundred other possibilities, fow which I am probably opening the door
to be discussed on the mailing list).

What I personally did in a number of projects, was to use NetBeans for
the work of drawing the userinterface (assembling the parts of it on a
canvans, creating the dialog boxes etc) and let it create the event loop
for you, and in there use NetRexx classes to do the actual work. The
good integration between the two languages make for an enjoyable time
doing that.

The added benefit when you do it this way is, that you can reuse the
NetRexx classes if the need for another interface pops up, like a JFC
web interface for example.

best regards,

René


On Tue, 25 Oct 2011 09:43:24 -0400, [hidden email]
wrote:
> International Technical Support Organization
> CREATING JAVA APPLICATIONS USING NETREXX
> September 1997
>
> Or is this obsolete? Is there some tutorial that I would benefit from
> faster? My goal is to convert some netrexx text oriented programs to
> a
> gui interface (currently on Windoze xp).

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

RE: Should I bother getting "package Redbook" to work?

Dave Woodman
Strange that this should come up today - I am looking (as of today) at WindowBuilder in Eclipse and doing the "real" work in NetRexx, much as René suggests

As an observation, The WindowBuilder guys reckon that their model should be extensible to any language where an Eclipse AST exists, so we may, eventually, be in a position to go native with a visual GUI designer.

   Dave.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of rvjansen
Sent: 25 October 2011 16:28
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Should I bother getting "package Redbook" to work?

Kenneth,


this is a good book but as you already suspected, the GUI section is
outdated - that is to say, everything in it still works (like AWT GUIs)
but you would want to look into Swing userinterfaces, or even JavaFX (or
a hundred other possibilities, fow which I am probably opening the door
to be discussed on the mailing list).

What I personally did in a number of projects, was to use NetBeans for
the work of drawing the userinterface (assembling the parts of it on a
canvans, creating the dialog boxes etc) and let it create the event loop
for you, and in there use NetRexx classes to do the actual work. The
good integration between the two languages make for an enjoyable time
doing that.

The added benefit when you do it this way is, that you can reuse the
NetRexx classes if the need for another interface pops up, like a JFC
web interface for example.

best regards,

René


On Tue, 25 Oct 2011 09:43:24 -0400, [hidden email]
wrote:
> International Technical Support Organization
> CREATING JAVA APPLICATIONS USING NETREXX
> September 1997
>
> Or is this obsolete? Is there some tutorial that I would benefit from
> faster? My goal is to convert some netrexx text oriented programs to
> a
> gui interface (currently on Windoze xp).

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

RE: Should I bother getting "package Redbook" to work?

kenner

Is Netrexxify also no longer supported? How about RexxVerA.nrx?  

I find links and no joy.
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Should I bother getting "package Redbook" to work?

Kermit Kiser
In reply to this post by Dave Woodman
Also strange - I had just added a change request to Kenai to add Swing
to the default NetRexx imports to make graphics use a bit easier. But I
was worried that Eclipse users might object if they were using SWT
instead of Swing. Is that an issue?

Is the AST a language definition? Didn't Bill create something like that
for the Eclipse plugin?

-- Kermit

On 10/25/2011 9:12 AM, Dave Woodman wrote:

> Strange that this should come up today - I am looking (as of today) at WindowBuilder in Eclipse and doing the "real" work in NetRexx, much as René suggests
>
> As an observation, The WindowBuilder guys reckon that their model should be extensible to any language where an Eclipse AST exists, so we may, eventually, be in a position to go native with a visual GUI designer.
>
>     Dave.
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of rvjansen
> Sent: 25 October 2011 16:28
> To: IBM Netrexx
> Subject: Re: [Ibm-netrexx] Should I bother getting "package Redbook" to work?
>
> Kenneth,
>
>
> this is a good book but as you already suspected, the GUI section is
> outdated - that is to say, everything in it still works (like AWT GUIs)
> but you would want to look into Swing userinterfaces, or even JavaFX (or
> a hundred other possibilities, fow which I am probably opening the door
> to be discussed on the mailing list).
>
> What I personally did in a number of projects, was to use NetBeans for
> the work of drawing the userinterface (assembling the parts of it on a
> canvans, creating the dialog boxes etc) and let it create the event loop
> for you, and in there use NetRexx classes to do the actual work. The
> good integration between the two languages make for an enjoyable time
> doing that.
>
> The added benefit when you do it this way is, that you can reuse the
> NetRexx classes if the need for another interface pops up, like a JFC
> web interface for example.
>
> best regards,
>
> René
>
>
> On Tue, 25 Oct 2011 09:43:24 -0400, [hidden email]
> wrote:
>> International Technical Support Organization
>> CREATING JAVA APPLICATIONS USING NETREXX
>> September 1997
>>
>> Or is this obsolete? Is there some tutorial that I would benefit from
>> faster? My goal is to convert some netrexx text oriented programs to
>> a
>> gui interface (currently on Windoze xp).
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

RE: Should I bother getting "package Redbook" to work?

Dave Woodman
AST = Abstract Syntax Tree - an in-core representation of the program after it has been parsed.

My thoughts were exactly that Bill's work could bear bonus fruit - once the WindowBuilder guys have generalised their tool.

        Dave.  

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Kermit Kiser
Sent: 25 October 2011 21:29
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Should I bother getting "package Redbook" to work?

Also strange - I had just added a change request to Kenai to add Swing
to the default NetRexx imports to make graphics use a bit easier. But I
was worried that Eclipse users might object if they were using SWT
instead of Swing. Is that an issue?

Is the AST a language definition? Didn't Bill create something like that
for the Eclipse plugin?

-- Kermit

On 10/25/2011 9:12 AM, Dave Woodman wrote:

> Strange that this should come up today - I am looking (as of today) at WindowBuilder in Eclipse and doing the "real" work in NetRexx, much as René suggests
>
> As an observation, The WindowBuilder guys reckon that their model should be extensible to any language where an Eclipse AST exists, so we may, eventually, be in a position to go native with a visual GUI designer.
>
>     Dave.
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of rvjansen
> Sent: 25 October 2011 16:28
> To: IBM Netrexx
> Subject: Re: [Ibm-netrexx] Should I bother getting "package Redbook" to work?
>
> Kenneth,
>
>
> this is a good book but as you already suspected, the GUI section is
> outdated - that is to say, everything in it still works (like AWT GUIs)
> but you would want to look into Swing userinterfaces, or even JavaFX (or
> a hundred other possibilities, fow which I am probably opening the door
> to be discussed on the mailing list).
>
> What I personally did in a number of projects, was to use NetBeans for
> the work of drawing the userinterface (assembling the parts of it on a
> canvans, creating the dialog boxes etc) and let it create the event loop
> for you, and in there use NetRexx classes to do the actual work. The
> good integration between the two languages make for an enjoyable time
> doing that.
>
> The added benefit when you do it this way is, that you can reuse the
> NetRexx classes if the need for another interface pops up, like a JFC
> web interface for example.
>
> best regards,
>
> René
>
>
> On Tue, 25 Oct 2011 09:43:24 -0400, [hidden email]
> wrote:
>> International Technical Support Organization
>> CREATING JAVA APPLICATIONS USING NETREXX
>> September 1997
>>
>> Or is this obsolete? Is there some tutorial that I would benefit from
>> faster? My goal is to convert some netrexx text oriented programs to
>> a
>> gui interface (currently on Windoze xp).
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

12345