comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* Window - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/49cdd5064665d598
* Question about celluar phones - 6 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cba2c5e46af164b2
* Sort Array Problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc8b01c6cee7f666
* Thread synchronization - 8 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1
* Compiler trick - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a2992422eec9fe49
* .NET Programmer Needs To Learn Java - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b99c5dff939a0cea
* commons validator without struts - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8b3d4ec3736d40e4
* passing several arguments - use inner class? - 7 messages, 6 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cdb480d0184f6bd5
* J2ME: The Complete Reference - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29dde018c381d116
* byte representation of a class - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/754ced8b07b9a2d3
* Hot opportunities for Java Consultants in Cleveland - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bbfc57cd6338b153
* Newbee question Mobile software - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f36a637b3fe577e4
  
==========================================================================
TOPIC: Window
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/49cdd5064665d598
==========================================================================

== 1 of 2 ==
Date:   Wed,   Sep 15 2004 1:43 am
From: [EMAIL PROTECTED] (rinkuu) 

Window w = new Window(Window owner);
        
is it possible to create a window object by using this statement. iam
a new bee please help me . if any body can tell me why i cannot create
a widow object.



== 2 of 2 ==
Date:   Wed,   Sep 15 2004 1:54 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

rinkuu wrote:
> Window w = new Window(Window owner);
>       
> is it possible to create a window object by using this statement.

Certainly.

> iam a new bee please help me .

We are willing to.

> if any body can tell me why i cannot create
> a widow object.

Nobody can tell you that without more information, at the very least:

- What *exactly* did you do?
- What did you expect to happen?
- What *exactly* happened instead?




==========================================================================
TOPIC: Question about celluar phones
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cba2c5e46af164b2
==========================================================================

== 1 of 6 ==
Date:   Wed,   Sep 15 2004 1:44 am
From: [EMAIL PROTECTED] (JAlexa9898) 

Lets say you had an applet that you wanted to write and distribute for
commercial reasons. Which way in your opinion would be the better way to go and
I am not sure about the logistics of either way so forgive me for starting at
square one here. Would you rather have people be able to access it with a
celluar phone or with a PC? Is there money to be made by having people
accessing applets with celluar phones?



== 2 of 6 ==
Date:   Wed,   Sep 15 2004 1:59 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

JAlexa9898 wrote:

> Lets say you had an applet that you wanted to write and distribute for
> commercial reasons. Which way in your opinion would be the better way to go and
> I am not sure about the logistics of either way so forgive me for starting at
> square one here. Would you rather have people be able to access it with a
> celluar phone or with a PC?

Applets can't run on mobile phones (excluding perhaps some "smartphones"
that are more PDA than phone). Cell phones usually support only J2ME,
and what they run are "MIDlets".

> Is there money to be made by having people
> accessing applets with celluar phones?

Assuming you mean MIDlets: that depends entirely on the content, I'd say.
But over here, I occasionally see TV ads for downloadable games,
presumably implemented as MIDlets, so there must be some money in it.



== 3 of 6 ==
Date:   Wed,   Sep 15 2004 2:41 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 15 Sep 2004 08:44:34 GMT, JAlexa9898 wrote:

> Lets say you had an applet that you wanted to write and distribute for
> commercial reasons. Which way in your opinion would be the better way to go..

That would depend entirely 
on what the applet does..

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology



== 4 of 6 ==
Date:   Wed,   Sep 15 2004 3:59 am
From: [EMAIL PROTECTED] (JAlexa9898) 

Ok what if say it was a computer game



== 5 of 6 ==
Date:   Wed,   Sep 15 2004 4:21 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 15 Sep 2004 10:59:30 GMT, JAlexa9898 wrote:

Trimming is good, but it is best to leave 
*something* in the post that indicates what 
you are replying to, like..

> Ok what if say it was a computer game

That is not specific enough.  People
look to playing different games on PC's and
mobiles.  The graphics on a mobile need
to be much simpler, for example, and the 
available memory is tiny.

So, for example.
Quake - PC.  It simply would not run on 
a mobile device.

Simple Puzzles - Mobile.  People have access to
*thousands* of free puzzles on PC's and would
almost certainly not pay for them.

But then, I think you have a mistaken impression
of 'transferring' games between PC's and mobiles.

That is not going to happen.  Even when it
is possible to write a game for both, you
need to write each separately.

Perhaps you should write a couple of simple 
apps. for both the mobile and standard Java 
and see how you go.  You will probably be 
in a much better position to judge whether
it is even practical to port the type of 
games you want to program, to J2ME.
..Or at least be in the position to ask 
smarter (more specific, better thought out) 
questions than, "Ok what if say it was 
a computer game".

HTH

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology



== 6 of 6 ==
Date:   Wed,   Sep 15 2004 4:33 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Andrew Thompson wrote:
> So, for example.
> Quake - PC.  It simply would not run on 
> a mobile device.

That depends entirely on your definition of "mobile device".
I did successfully run Quake on a PDA a couple of years ago,
could even enter a network game.

It was rather slow, but unplayable only because the game is
designed to be played with a mouse and a full keyboard.




==========================================================================
TOPIC: Sort Array Problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc8b01c6cee7f666
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 1:56 am
From: Babu Kalakrishnan <[EMAIL PROTECTED]> 

Jenny wrote:
> I tried the code below.  It did not work.  I even created an Object[]
> to hold Integers 1,2 and 3, it still did not work.  

Using an Object array (Or an Integer[]) and storing Integer objects should have 
worked if your comparator was implemented correctly. (See below : I'll assume 
that your array to be sorted is an Object[] or Integer[] that holds Integer 
objects created with the "new Integer(value)" construct.)

Could you help me
> to sort 1,2,3 to be 3,2,1?  I know how to write code to sort it.  I'd
> like to learn the Comparator.  Thanks a lot.
> 
> Comparator myComp = new Comparator(){
>     public int compare(Object o1, Object o2){
>       int[] a1 = (int[])o1;
>       int[] a2 = (int[])o2;
>       if(a1[0] < a2[0]){
>         return 1;
>       }else if(a1[0] > a2[0]){
>         return -1;
>       }else{
>         return 0;
>       }
>     }
>   };

The arguments with which the comparator's compare method is called are always 
members of the array - (i.e Objects )- not the array itself (that's what you 
seemed to assume). And all that the comparator needs to do is to return an 
integer result that is negative,zero or positive indicating the result of the 
comparison between those two arguments. So in your case the arguments you 
receive will be Objects of type "Integer", and the method can be written as :

      public int compare(Object o1, Object o2)
      {
         Integer a1 = (Integer)o1;
         Integer a2 = (Integer)o2;
        return a1.intValue()-a2.intValue();     // for reverse sort
      } 

Note the simplification in the last line. Since the comparator doesn't insist 
that the result be any specific value (like 1 or -1), when the arguments are 
unequal, 3 comparisons are unnecessary - a simple subtraction would do since it 
will return a result with the proper sign.

BK




==========================================================================
TOPIC: Thread synchronization
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1
==========================================================================

== 1 of 8 ==
Date:   Wed,   Sep 15 2004 2:07 am
From: "Mike Schilling" <[EMAIL PROTECTED]> 


"Chris Uppal" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Mike Schilling wrote:
>
>> "Chris Uppal" <[EMAIL PROTECTED]> wrote in message
>> > I'm still not sure I'm following you.  Is your objection that without a
>> > "hidden" lock object, it is possible for an arbitrary bit of foreign
>> > code to
>> > execute a synchronised block on the object in question, thus 
>> > potentially
>> > preventing it from making further progress in its real task ?
>>
>> No, it's that any class C can do a
>>
>>     synchronized(o)
>>
>> on any object o it has access to.  If that object is also synchronizing 
>> on
>> itself, this can play havoc with its internal synchronization logic.
>> Note that this is independent of how well the internal synchronization is
>> encapsulated, or of whether the object's class is visible  to C.
>
> As far as I can see, this is the same as I was asking; am I still
> misunderstanding you ?
>

No, I think I was misunderstanding you.  If by "execute a synchronised block 
on the object in question", you mean what I described as

    synchronized(o)

then, yes, we're talking about the same thing.

>
>> I don't think
>>
>>     private Object lock_object();
>>
>>     synchronized(lock_object)
>>
>> differs in concept from
>>
>>     synchronized(this)
>>
>> particularly when you understand the reason for it.
>
> Well, there are two possibilities that I can see.  One is that you are 
> putting
> the "edges" of synchronisation in the same places I would (i.e. the 
> externally
> visible temporal behaviour of all the visible objects is the same whether 
> it's
> coded in your style or mine).  If that is the case then the difference is
> clearly fairly minor -- by definition -- but I would question why you are
> choosing an relatively more obfuscated and potentially error-prone (e.g.
> forgetting to make the lock object "final", as above ;-) expression,

Why is it important that it be final?  It's a good idea not to change it, of 
course :-)

> when Java
> has a built-in expression that is easier to work with, and which does not
> suggest that the program /might/ be doing something more complex than it
> appears.

That's largely a question of idiom.  Once you're used to seeing private lock 
objects, the sight of another one no longer makes that suggestion.  And I 
prefer it purely for safety; the same reasons I make almost all fields 
private.






== 2 of 8 ==
Date:   Wed,   Sep 15 2004 2:17 am
From: "Mike Schilling" <[EMAIL PROTECTED]> 

Does anyone know the status of JSR 133 (fixing the Java memory model) ?  It 
was intended to be part of 1.5, but since the final vote was only two days 
ago, that seems unlikely. 





== 3 of 8 ==
Date:   Wed,   Sep 15 2004 4:30 am
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Chris Uppal coughed up:
> Lee Fesperman wrote:
>> Thomas G. Marshall wrote:
>
>>> ...[rip]...
>>
>> By 'rip', I assume that means that [...]
>
> I think Thomas uses "rip" where another would use "snip".  I admit
> that when I first saw it, I took it as insulting -- something like
> "we don't need all /this/ crud".

Nah.  I use ...[sniped out stupidity]... for that :)  And at least the
notion of text removal of it was clear.

And I don't use ...[rip]... all the time.  Sometimes I use ...[stomp]... :)

No "crud" implication intended.  I'm sorry that you took it that way.


-- 
Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"






== 4 of 8 ==
Date:   Wed,   Sep 15 2004 5:10 am
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Lee Fesperman coughed up:

...[rip]...


>> In usenet, it is /very/ improper to snip out sections without
>> warning, particularly to make it sound as if the conversation had
>> proceeded without interruption, when it did not.
>
> I was saving a few electrons, since you are loath to back down on
> even the smallest detail.

...by not showing that you removed lines to make it seem as if the
conversation occurred without it?  That is dishonest, and you should know
better than to do that in usenet.

Apologies but I just cannot let you continue this crap.  Do the ad hominem
thing all you like for this, but your tone is far to insulting again to let
you try to hand wave away your mistakes as if they did not occur, and
pretend that you were on correct footing when doing so.

I was wrong when I said that this thread was too twisted for me.  You have
not made so twisted that I cannot stop you from continuing this charade.


> You insist, so I'll bother some electrons...
> You used "synchronization structure" without a modifier. That is
> imprecise and confusing. Java is in the C language family. In the C
> family, structure without a modifier refers to a data block.

The modifier was "synchronization".


> A class
> in Java is conceptually a structure with behavior. A better term is
> synchronization block (referring to a code block), though
> synchronized block is really to the point.

"Structure" (particularly since there is no such data construct in java) can
apply to any organization of code if used as an adjective, (but it is not
required).  "Structured Programming", for example, does /NOT/ imply the use
of C data structures.  Or are you saying it does????  You can also refer to
the structure of someone's code.

I used the term "Synchronization Structure", in that example specifically
because I wanted to make sure that it was understood that I am referring to
/both/ synchronization blocks /and/ synchronization methods.  It is clear,
and you seem content to say it is I splitting hairs, when you are the one
attempting (and failing) to do so.

...[rip]...


>>>>> To continue: By /within/, do you mean --- lines of code textually
>>>>> inside the braces of a synchronization block (or synchronized
>>>>> method)?
>>>>
>>>> The execution of such lines of code.  Yep.
>>>
>>> The effect is to say that lines of code textually 'exterior' to the
>>> synchronized block are not protected.
>>
>> I did not say, nor imply that at all.
>>
>>> That is wrong. Code /within/
>>> the block may call methods outside the block even in different
>>> classes, packages and standard API. This code (during the call) will
>>> be synchronized on the synchronization object's monitor.
>>
>> No kidding.  When I say
>>
>>         The execution of such lines of code.  Yep
>>
>> You think it's ok to say that I'm implying that the function calls
>> within the block are not protected?  You think that's somehow not
>> clear that they are???  When you execute a line of code, you execute
>> it, regardless of what that line of code entails, which includes
>> method calls.  If you think that needs to be spelled out, you are in
>> the wrong place in usenet entirely.
>
> Yes it was not clear. You explicitly stated that lines of code not
> within the block were not synchronized.

And when you asked what I meant (as shown above):

        LF:
        By /within/, do you mean --- lines of code textually
        inside the braces of a synchronization block (or
        synchronized method)?

I made it very clear:

        TGM:
        The execution of such lines of code.  Yep.

As usual, it is you try to twist meanings around and play the word games.

...[rip]...

-- 
Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"






== 5 of 8 ==
Date:   Wed,   Sep 15 2004 5:14 am
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Mike Schilling coughed up:
> Does anyone know the status of JSR 133 (fixing the Java memory model)
> ?  It was intended to be part of 1.5, but since the final vote was
> only two days ago, that seems unlikely.

Do you find the JSR's easy to navigate?  I find it almost as confusing as
the RFC lightyear long collection.  Particular to your point, I find it
almost impossible to figure out when something "made it" and into what
revision.


-- 
Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"






== 6 of 8 ==
Date:   Wed,   Sep 15 2004 5:19 am
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Mike Schilling coughed up:

...[rip]...


> And I prefer it purely for safety; the same reasons I
> make almost all fields private.

That last one is a particularly good practice.

I am not one to /fully/ fall for the time honored "do not externally modify
an objects attributes".  But I've seen my share of horrendous abuses of such
things to make sure that /no one/ touches the guts of an object without me
"knowing" about it.


-- 
Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"






== 7 of 8 ==
Date:   Wed,   Sep 15 2004 5:18 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Wed, 15 Sep 2004 11:30:44 GMT, Thomas G. Marshall wrote:
..
> ...[sniped out stupidity]... 

Is that the process of removing dumb people 
from the population with the help of a 
bell-tower and a high powered rifle?    ;-)

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane



== 8 of 8 ==
Date:   Wed,   Sep 15 2004 5:32 am
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Chris Uppal coughed up:
> Thomas G. Marshall wrote:
>
>>>> Particularly when the user grabs a thread safe list using
>>>> Collections.synchronizedList().
>>>
>>> Ugh, yes!
>
>> And how would you deal with my example then?  Let's make it a little
>> more general:
>>
>>         // move our thing up x notches...
>>         ourThing.set(ourThing.get() + x);  // not thread safe.
>> Kaboom.
>>
>> /THAT/ is a error waiting to happen (actually it's an error already
>> if multithreading on a single instance).  What would you do?  If you
>> create the following:
>
> class MyClass
> {
>     private int ourThing thingness = 0;
>     public synchronised get() { return thingness; }
>     public synchronised increment(int by) { thingness += n; }
>     // TODO: is this really needed ?
>     public synchronised set(int n) { thingness = n; }
> }
>
> but it's doubtful whether I'd provide a public set() method unless
> there was clear need for both set() and increment() as public
> operations.
>
> Put into my terms.  Instances of MyClass accept responsibility for
> ensuring that they can be increment()-ed in a thread-safe manner.  It
> is not the /caller's/ responsibility to do so.

I hear you on your concern here.


> You may notice that this leads to broadening of the interface of
> MyClass -- I'm entirely happy with that. Such broadening is (IMO)
> natural in decent OO code. (As an aside, much Java code is not -- in
> this specific sense, and IMO -- very well written.  The received
> wisdom is to keep classes lean, and to put the logic in the caller.
> But I think that just leads to a mess where responsibility does not
> properly follow object boundaries.


As I pointed out already, I too am worried about the potential lack of
documentation concerning the locking details within an object.

But your interface expansion notion does not hold for existing classes
beyond your control.  Say you need to pull something out of a collection or
even a GUI table in one section and move it to another?  This operation:

        Entry entry = thang.grab(someplace);
        thang.set(entry, elsewhere);

Is hugely thread unsafe.  If you don't do this:

        synchronized(thang)
        {
            Entry entry = thang.grab(someplace);
            thang.set(entry, elsewhere);
        }

then you might wish to make sure that all access goes through another method
of your own construction elsewhere...

        //unified control to Things
        public class SafeThingMutator
        {
                // you prefer synced methods, so ok, I'll use a general
                // operation sync supplied by another poster...
                public static synchronized
                        void modify(Runnable operation)
                {
                        operation.run();
                }
        }

...but what if the Thing is part of a larger Swing GUI element that makes
its /own/ modifications to Thing on its own.  /That/ wouldn't go through
your protection routine.

These are common issues.  What would you do?


-- 
Onedoctortoanother:"Ifthisismyrectalthermometer,wherethehell'smypen???"







==========================================================================
TOPIC: Compiler trick
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a2992422eec9fe49
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 2:25 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

Chris Uppal <[EMAIL PROTECTED]> scribbled the following:
> Joona I Palaste wrote:

>> If we have two
>> threads, one of which does A and B, the other does C and D, then the
>> actual physical sequence may be A-B-C-D, A-C-B-D, A-C-D-B, C-A-B-D,
>> C-A-D-B or C-D-A-B. It is always guaranteed that all four operations
>> are done, A is done before B, and C is done before D. Nothing else
>> about the ordering is guaranteed. (This is assuming a strictly
>> sequential intra-thread execution with no control structures.)

> I may be missing your point here, but I think that without synchronisation,
> there is no such guarantee.  As it happens I've just written a passage in
> another post which fits just as well here.  Apologies to anyone who sees it
> twice ;-)

> This is discussed in the Java Memory Model JSR, see:

> http://www.cs.umd.edu/~pugh/java/memoryModel/PublicReview.pdf

> Two threads, two shared variables A and B, two passages of code that access
> them without synchronisation:

> Initially A == B == 0

> Thread 1:
>     r2 = A;
>     B = 1;

> Thread 2:
>     r1 = B;
>     A = 2;

> A legal result of this is that r2 == 2 and r1 == 1.  The JSR describes this as
> "surprising behavoir".  Which is a classic bit of understatement...

Ah, I have not been clear enough. When I mentioned the actions A, B, C
and D, I was only talking about the actual operations (in this case "A"
is "r2=A", "B" is "B=1", "C" is "r1=B", D is "A=2"), not about overall
effects in the program state. In other words, I left the outcome of the
actions as undefined.
If this sounds too confusing, another way to put it is that what I wrote
applies only when A, B, C and D are independent actions whose effects do
not affect each other.

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"C++ looks like line noise."
   - Fred L. Baube III




==========================================================================
TOPIC: .NET Programmer Needs To Learn Java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b99c5dff939a0cea
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 2:26 am
From: "Vincent Cantin" <[EMAIL PROTECTED]> 

> Some questions:
>
> 1. Is there a low cost way to learn, compile and develop for this
langauge?
> (aka Visual Studio but not costing an arm and a leg like this platform)

It is hard to shoot a bullet in your feet with Java. In fact, Java will
embed the bullet in a safe exception just before it touch the feet. So ...
it will not cost you a leg, you will just be notified of a
IllegalArgumentException : "Bullets are not elligible for leg penetration"
... when the bullet will try to peneter the feet and the penetration will be
canceled.

Vincent






==========================================================================
TOPIC: commons validator without struts
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8b3d4ec3736d40e4
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 2:17 am
From: Ricardo Trindade <[EMAIL PROTECTED]> 

Hi,

        I' having troubles using commons-validator (latest release, also tried
today's snapshot) without struts.

        Specifically I tried the code in CVS that can be reached through the FAQ
item :
        http://wiki.apache.org/jakarta-commons/ValidatorStandalone

        I couldn't understand why this examples uses Validators from the test
package, instead of using, for example, GenericValidator. I tried to change
the example to use GenericValidator, but validating my bean always fails.

        My XML (header removed):

<form-validation>
        <global>
                <validator name="inteiros"
classname="org.apache.commons.validator.GenericValidator" method="isInt"
methodParams="java.lang.String" msg="errors.int"/>
        </global>
        <formset>
                <form name="ValidateBean">
                        <field property="firstName" depends="inteiros"/>
                </form>
        </formset>
</form-validation>


thanks
Ricardo Trindade




==========================================================================
TOPIC: passing several arguments - use inner class?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cdb480d0184f6bd5
==========================================================================

== 1 of 7 ==
Date:   Wed,   Sep 15 2004 3:41 am
From: Sebastian Kerekes <[EMAIL PROTECTED]> 

Hi,

I have a rather theoretical question.

Let's say I have a method which gets a handful of arguments, maybe ten 
or more. Passing that much arguments doesn't look nice, so what about 
implementing a inner class that contains all those variables for use in 
this method? Is it good style to create a data structure just to use it 
for one method?

And there's the other case: The method has to return several parameters. 
  If all the elements have the same type, I could use an array - but the 
user has to know what meaning a value has at a specific position. 
Doesn't sound very good to me. So maybe return some type of collection, 
eg. a HashMap? Isn't this a bit too much overhead for just returning 
serveral values? And once again the caller has to know what he wants out 
of the Map. Well, and there's the solution to create a simple inner 
class with public values. Just to have all necessary values in one 
structure.

So, what do you think? Which approach is best in what case and is there 
anything else you can suggest?

Greetings,

Sebastian



== 2 of 7 ==
Date:   Wed,   Sep 15 2004 4:07 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Wed, 15 Sep 2004 12:41:19 +0200, Sebastian Kerekes wrote:

> I have a rather theoretical question.

* Try pinning down a particular 
situation, because..
..
> So, what do you think? Which approach is best in what case ..?

..it depends on the actual nature 
of the actual data.

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology



== 3 of 7 ==
Date:   Wed,   Sep 15 2004 4:22 am
From: "Matt Humphrey" <[EMAIL PROTECTED]> 


"Sebastian Kerekes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I have a rather theoretical question.
>
> Let's say I have a method which gets a handful of arguments, maybe ten
> or more. Passing that much arguments doesn't look nice, so what about
> implementing a inner class that contains all those variables for use in
> this method? Is it good style to create a data structure just to use it
> for one method?
>
> And there's the other case: The method has to return several parameters.
>   If all the elements have the same type, I could use an array - but the
> user has to know what meaning a value has at a specific position.
> Doesn't sound very good to me. So maybe return some type of collection,
> eg. a HashMap? Isn't this a bit too much overhead for just returning
> serveral values? And once again the caller has to know what he wants out
> of the Map. Well, and there's the solution to create a simple inner
> class with public values. Just to have all necessary values in one
> structure.
>
> So, what do you think? Which approach is best in what case and is there
> anything else you can suggest?

First, I don't recommend using array positions for meaning--the burden of
maintaining or even debugging that kind of code is too high.  Different
parameters should have different names.

I also find that if I have a method that needs 10 parameters I probably have
not designed my  classes correctly--there's something about those 10 that
may constitute state information and can be composed into a class.
Nevertheless, however, there is no escaping intrinsic complexity and
sometimes you just have to have 10 parameters or a class of 10 with
properties and one method.

Cheers,
Matt Humphrey [EMAIL PROTECTED]  http://www.iviz.com/





== 4 of 7 ==
Date:   Wed,   Sep 15 2004 4:29 am
From: Sebastian Kerekes <[EMAIL PROTECTED]> 

Andrew Thompson wrote:

> * Try pinning down a particular 
> situation, because..

I talked about this topic with a fellow worker and wondered what you may 
think. It talked with him about a method which does some computation and 
returns about 10 parameters (like min/avg/max<Something>) that the 
returns with a collection. I suggestest an inner class.

It happens from time to time that I'm not sure in which way to pass or 
return values, so that's why I ask how you work ..



== 5 of 7 ==
Date:   Wed,   Sep 15 2004 4:30 am
From: Daniel Bonniot <[EMAIL PROTECTED]> 

> Let's say I have a method which gets a handful of arguments, maybe ten 
> or more.

"If you have a procedure with 10 parameters, you probably missed some." 
(fortune cookie)

:-)

Daniel
--
The Nice programming language: http://nice.sf.net



== 6 of 7 ==
Date:   Wed,   Sep 15 2004 4:53 am
From: Jacob <[EMAIL PROTECTED]> 

Sebastian Kerekes wrote:

> So, what do you think? Which approach is best in what case and is there 
> anything else you can suggest?

You might have a problem with your design:

You should probably bundle your input and out parameters in
classes and pass instances of this class(es). That done,
you'll realize that the method in question could be a
member of the class just created, and the need for lengthy
parameter lists and return values vanishes.

I try this approach whenever I get a situation where I need
to pass lots of stuff around. It might not fit your
actual case of course.

Using an inner class looks more like a hack to me. You don't
bundle variables because you want to pass them around easily,
but because they belong together.




== 7 of 7 ==
Date:   Wed,   Sep 15 2004 4:39 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Sebastian Kerekes wrote:

>> * Try pinning down a particular situation, because..
> 
> 
> I talked about this topic with a fellow worker and wondered what you may 

He meant the *programming* situation, not the social one.

> think. It talked with him about a method which does some computation and 
> returns about 10 parameters (like min/avg/max<Something>) that the 
> returns with a collection. I suggestest an inner class.

More details, please. "min/avg/max<Something>" sounds like it would make
a lot of sense even as a top-level class, not an inner class.

Returning a Collection or array is definitely very wrong unless there
really are set or list semantics, i.e. the elements will always be processed
together in the same way.




==========================================================================
TOPIC: J2ME: The Complete Reference
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29dde018c381d116
==========================================================================

== 1 of 2 ==
Date:   Wed,   Sep 15 2004 4:42 am
From: "Darryl L. Pierce" <[EMAIL PROTECTED]> 

Jeff wrote:

> My question is:
> Does this book "J2ME: The Complete Reference" (ISBN: 0072227109 ) cover
> MIDP 2.0 and CDLC 1.1 API features??
> 
> I'm considering to buy this book, but only if it covers these topics...
> Is it a good book, do you recommend it???

The back of the book should tell you what version(s) of the specification
are covered.

-- 
/**
 * @author Darryl L. Pierce <[EMAIL PROTECTED]>
 * @see    The Infobahn Offramp <http://mcpierce.mypage.org>
 * @quote  "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk
 */



== 2 of 2 ==
Date:   Wed,   Sep 15 2004 5:15 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Wed, 15 Sep 2004 07:42:57 -0400, Darryl L. Pierce wrote:

> Jeff wrote:
..
>> Does this book "J2ME: The Complete Reference" (ISBN: 0072227109 ) cover
>> MIDP 2.0 and CDLC 1.1 API features??
..
> The back of the book should tell you what version(s) of the specification
> are covered.

I went hunting at amazon, and while I found this..
<http://www.amazon.com/exec/obidos/tg/detail/-/0072227109/ref=sib_rdr_dp/103-4155585-8239062?%5Fencoding=UTF8&no=283155&me=ATVPDKIKX0DER&st=books>
..it fails to mention the CDLC/MIDP versions, 
and the only 'example page' offered is the 
front cover.  :-(

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane




==========================================================================
TOPIC: byte representation of a class
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/754ced8b07b9a2d3
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 5:07 am
From: [EMAIL PROTECTED] (Benjamin von Eicken) 

> What else do you want to use? There is nothing else than
> the class-file. Alternatively you might use the class-loader,
> but there you can look into the API (which I would have to do
> anyway because I don't know how for myself at the moment)

It is not possible to use the class-loader.

> ObjectOutputStream doesn't write the byte-code of the
> java-class, only the status of an instance of the
> specific class. The deserialization gets the information
> what kind of class to be initialized before setting the
> values coming from the stream.

I know, but somehow it writes a signature. Whatever this
looks like, a class with more code ends up in more bytes
in the stream.

> Streams are the basic concept in Java for reading and
> writing data, so your IMHO going into a wrong direction.

I see...

regards

Benjamin




==========================================================================
TOPIC: Hot opportunities for Java Consultants in Cleveland
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bbfc57cd6338b153
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 5:26 am
From: [EMAIL PROTECTED] (Jerome Anderson) 

Hey All - 

I'm putting out an A.P.B. for Java Developers in the Cleveland area,
or folks who are willing to work in Cleveland.  Sun Certification is a
huge plus, and consulting experience would make you a rock star. 
Contact me via e-mail with a resume if you're interested, and feel
free to tell friends!

Thanks,

Jerome




==========================================================================
TOPIC: Newbee question Mobile software
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f36a637b3fe577e4
==========================================================================

== 1 of 1 ==
Date:   Wed,   Sep 15 2004 2:34 pm
From: "fm" <[EMAIL PROTECTED]> 

thanks
but no answer in other ng...
and I X posted only once !
;o)
regards
any help ?
in fact, JAR & JAD work fine in local mode, not at all on internet
I installed MIME type on IIS
www.cvamm.org/portable/test.jar
www.cvamm.org/portable/test.jad

help !
;o))))
thanks
david


"fm" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello
> I am newbee, thanks for your help.
> I installed JBuilder X Enterprise...
> Made the tutorial for the Hello world Midiet, all works fine on my PC.
> Installed the Mime Type on IIS 2000 server
> Transfered the JAR & JAD on my website and made a push test to my Nokia 
> 3200
> Connecting thru GPRS, informations received, tryed to install.....and 
> then,
> my Nokia answer : "software not supported"....
> Any suggestions ?
> Thanks for your help
> david
>
> 





=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

<a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to