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

Today's topics:

* applet and native method - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e332e887f6d6a04
* Thumbnail creation problem. really weird. - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b8449e560e72a644
* store whole InputStream in a String - 13 messages, 7 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d510835287103e9
* Print help - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d8e2a798b4dcd983
* How to set Http Request Header? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b191146c7bfc3a03
* Quake2 in Java - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60f3193b21a6bb3
* Java Student Needs Help - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48d209fbe843b0be
* setting classpaths with Ant - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22f3c778af80e37f
* What's the additional value of 'EnumMap' ? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/731db423dd8a0ec2
* java equivalent of perl module Locale::SubCountry? - 4 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b803837211c1c4ca
* How to invoke jar cammand in the java source code? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ba789da4111ad18
  
==========================================================================
TOPIC: applet and native method
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e332e887f6d6a04
==========================================================================

== 1 of 1 ==
Date:   Sun,   Sep 12 2004 12:04 pm
From: Dave Neary <[EMAIL PROTECTED]> 

Hi,

On Sun, 12 Sep 2004 12:04:59 -0400, kaul said:
> i have read that applet cannot call a native method due to security
> reasons.

This is untrue.

Cheers,
Dave.

-- 
             David Neary,
     E-Mail: bolsh at gimp dot org
Work e-mail: d dot neary at phenix dot fr
     CV: http://dneary.free.fr/CV/




==========================================================================
TOPIC: Thumbnail creation problem. really weird.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b8449e560e72a644
==========================================================================

== 1 of 2 ==
Date:   Sun,   Sep 12 2004 12:09 pm
From: "hilz" <[EMAIL PROTECTED]> 

Andrei:
Than you for your help.
this is too complicated for me since i have not used this part of java
before.
i've been trying to do what you suggested, but i don't seem to succeed.
would you be willing to share some code that shows how to do this?

thanks
hilz


"ak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> > > try image.getScaledInstance()
> >
> > this gives me a java.awt.Image object
> > then how do i write it to a JPG file?
> use PixelGrabber to get pixel array
> create appropriate DataBuffer and SampleModel,
> than create Raster which you can pass to PEGImageEncoder.
>
> -- 
> Andrei Kouznetsov
> http://uio.dev.java.net Unified I/O for Java
> http://reader.imagero.com Java image reader
>
>





== 2 of 2 ==
Date:   Sun,   Sep 12 2004 1:10 pm
From: "ak" <[EMAIL PROTECTED]> 

> Than you for your help.
> this is too complicated for me since i have not used this part of java
> before.
> i've been trying to do what you suggested, but i don't seem to succeed.
> would you be willing to share some code that shows how to do this?

may be it is better to create empty BufferedImage, get the pixels from Image
using PixelGrabber
and then set pixels on BufferedImage using setRGB();

//alredy scaled image
Image image;

//create BufferedImage without alpha
BufferedImage bi = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);

int[] pixels = new int[width * height];
PixelGrabber pg = new PixelGrabber(image, 0, 0, width, height, pixels, 0,
width);
try {
    pg.grabPixels();
} catch (InterruptedException e) {
    return;
}
if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
    throw new RuntimeException("can't fetch pixels");
}

bi.setRGB(0, 0, width, height, pixels, 0, width);

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader






==========================================================================
TOPIC: store whole InputStream in a String
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d510835287103e9
==========================================================================

== 1 of 13 ==
Date:   Sun,   Sep 12 2004 12:11 pm
From: "Gary Labowitz" <[EMAIL PROTECTED]> 

"ak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> > > This is the biggest problem of free software - programmers does not
> think
> > > about user.
> >
> > This is the funniest line I have ever read on this topic. Programmers of
> > free software do not think of anything else but the user. Were this not
> > true, they would charge for their programs.
>
> Please read your own website.
> It looks like fortress - your leading message is  "DON'T CONTACT ME!!!"
>
> > > Users have to do this and other things instead of one simple click.
> >
> > Yes, and if "one simple click" is your goal, you should definitely avoid
> > sitting at a computer.
>
> there much users which _must_ have computer - it is their job.
> And yes "simple click" could make their life easier.

General answer to all:

You guys break me up. As I recall Arachnophilia is careware. Where is all
your caring? And it is free. That's means don't be so demanding -- you got
your money's worth. As to OP topic (remember the OP?), as a teacher I find
it easier to teach a while(true) [with break] to get students running with a
valid program (all those usages being valid) and then expand on better ways
to do any given thing. In this case it results in code Paul suggests.

Paul: what you say is true, but one can't always impose strict academics on
students who are struggling with a sea of ideas, programming constructs, and
new ways of thinking. We start them in the wading pool. Those who don't
drown there get to try the deep end later. I'm sure you wouldn't like my
classes, but I'm not sure my students would like yours. By like, BTW, I mean
enjoy the actual learning of programming enough to spend the time and
thought needed to actually understand it.
To you other guys: lighten up. So you did it baby-fashion. So it works.
Okay. But now learn from the master (or at least one of them here) and move
on. Stop defending and attacking on such a dumb question. There are going to
be better ways of doing just about anything you care to mention; otherwise
we CAN close the patent office.

As for me, I don't care how it damned thing is coded -- just that it work.
Optimization comes ... uhh ... last.
-- 
Gary


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.760 / Virus Database: 509 - Release Date: 9/10/2004





== 2 of 13 ==
Date:   Sun,   Sep 12 2004 12:16 pm
From: Chris Smith <[EMAIL PROTECTED]> 

Tor Iver Wilhelmsen wrote:
> We canb call it the "Goto Pattern", then, because that's what
> "while(true)... break" really is.

There really is a serious difference between break/continue (including 
labeled break/continue) and goto.  It can be debated whether that 
difference fixes the pitfalls of the goto statement, but it's useless to 
deny that the difference exists.

That difference is that while break/continue can be used to exit a block 
of code from an arbitrary point, it cannot be used to enter a block of 
code at an arbitrary point.  There is a very strong case to be made that 
it's the latter -- arbitrary entry points to a block -- that is most 
threatening to readable code.  The former is a natural abstraction in 
many programming scenarios, esp. when try/finally is used judiciously as 
well.

For the record, though, in at least the specific case of reading from an 
InputStream, the universal idiom of "while ((len in.read(buf)) != -1)" 
is far easier to follow, simply because an average Java programmer will 
already know what to expect.

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



== 3 of 13 ==
Date:   Sun,   Sep 12 2004 12:30 pm
From: "ak" <[EMAIL PROTECTED]> 

> > Please read your own website.
> > It looks like fortress - your leading message is  "DON'T CONTACT ME!!!"
>
> And? Too many people contact me instead of reading the instructions. Sound
> familiar?

hundreds? thousands? millions?
lol

> Your thesis seems to be "I want to press one button and let the computer
> figure out what I mean."
>
this may be not so difficult as to let you understand what I mean.

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader





== 4 of 13 ==
Date:   Sun,   Sep 12 2004 12:36 pm
From: "ak" <[EMAIL PROTECTED]> 

> General answer to all:
>
> You guys break me up. As I recall Arachnophilia is careware. Where is all
> your caring? And it is free. That's means don't be so demanding -- you got
> your money's worth. As to OP topic (remember the OP?), as a teacher I find
> it easier to teach a while(true) [with break] to get students running with
a
> valid program (all those usages being valid) and then expand on better
ways
> to do any given thing. In this case it results in code Paul suggests.

the irony is that I agree that Paul's code is better,
but I don't agree with Paul's art to speak.

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader





== 5 of 13 ==
Date:   Sun,   Sep 12 2004 1:37 pm
From: Jacob <[EMAIL PROTECTED]> 

Paul Lutus wrote:

> As I have already said, once you have seen this pattern ten thousand times,
> it begins to seem familiar and readable. 

I prefer making code understandable for those that have
*not* read my code 10-thousand times. That's the majority
after all. It includes avoiding variable names like "len"
when meaning "length" and so on.




== 6 of 13 ==
Date:   Sun,   Sep 12 2004 8:02 pm
From: "Mike Schilling" <[EMAIL PROTECTED]> 


"Paul Lutus" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
.
>>> It is a hack.
>>
>> Argument by assetion 1.
>
> No, it is a hack, not an argument by assertion.

OK, I get it now.  I thought you were being serious.  I see now that you're 
doing a sort of Mionty Python routine:

You're wrong.

That's not a logical argument, it's simply an assertion:

No it isn't an assertion.

Why not?

 Because you're wrong.

Sorry it took me so long to catch on.
 





== 7 of 13 ==
Date:   Sun,   Sep 12 2004 9:41 pm
From: "Gary Labowitz" <[EMAIL PROTECTED]> 

"Jacob" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Paul Lutus wrote:
>
> > As I have already said, once you have seen this pattern ten thousand
times,
> > it begins to seem    familiarandreadable.

Above is the message as I received it. Checking the source it also reads as
above. I have been seeing a number of posts, very random, that have words
concatenated as the "familiarandreadable" above. I am worried as to where it
is coming from (since I'm using OE :)).
My question is to > > (I think Jacob): did you actually write
"familiarandreadable" without spaces for a reason, or did you have spaces
and it came through without?
TIA
-- 
Gary


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.760 / Virus Database: 509 - Release Date: 9/11/2004





== 8 of 13 ==
Date:   Sun,   Sep 12 2004 9:42 pm
From: "Gary Labowitz" <[EMAIL PROTECTED]> 

"Mike Schilling" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> "Paul Lutus" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> .
> >>> It is a hack.
> >>
> >> Argument by assetion 1.
> >
> > No, it is a hack, not an argument by assertion.
>
> OK, I get it now.  I thought you were being serious.  I see now that
you're
> doing a sort of Mionty Python routine:
>
> You're wrong.
>
> That's not a logical argument, it's simply an assertion:
>
> No it isn't an assertion.
>
> Why not?
>
>  Because you're wrong.
>
> Sorry it took me so long to catch on.

And you break me up, too. Could it be the whole ng is a Mionty (sic) Python
routine? [I'm sorry, I'll type that again.]
-- 
Gary


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.760 / Virus Database: 509 - Release Date: 9/11/2004





== 9 of 13 ==
Date:   Sun,   Sep 12 2004 9:53 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Gary Labowitz wrote:

> "ak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>> > > This is the biggest problem of free software - programmers does not
>> think
>> > > about user.
>> >
>> > This is the funniest line I have ever read on this topic. Programmers
>> > of free software do not think of anything else but the user. Were this
>> > not true, they would charge for their programs.
>>
>> Please read your own website.
>> It looks like fortress - your leading message is  "DON'T CONTACT ME!!!"
>>
>> > > Users have to do this and other things instead of one simple click.
>> >
>> > Yes, and if "one simple click" is your goal, you should definitely
>> > avoid sitting at a computer.
>>
>> there much users which _must_ have computer - it is their job.
>> And yes "simple click" could make their life easier.
> 
> General answer to all:
> 
> You guys break me up. As I recall Arachnophilia is careware. Where is all
> your caring?

Read the CareWare page (http://www.arachnoid.com/careware) before you make
the assumption you are making. Also read http://arachnoid.com/freeware for
a reality check.

> And it is free. That's means don't be so demanding -- you got 
> your money's worth. As to OP topic (remember the OP?), as a teacher I find
> it easier to teach a while(true) [with break] to get students running with
> a valid program (all those usages being valid) and then expand on better
> ways to do any given thing.

IMHO, this is a very bad approach to teaching structured programming. For
such a class, I would outlaw while(true), break, and continue, since all
programs can be written without them, and since they are only present in
the language to ease the transition into structured programming for those
with no background or adeptness in it.

> In this case it results in code Paul suggests. 
> 
> Paul: what you say is true, but one can't always impose strict academics
> on students who are struggling with a sea of ideas, programming
> constructs, and new ways of thinking.

That happens to be the best, and possibly last, opportunity to impose a
necessary discipline, for reasons it is difficult to convey to students,
most of whom think a working program is the ultimate goal (if that were
true, BASIC would have been the ultimate language).

The issue being discussed is at the heart of structured programming. I find
it is best to focus on this issue early on, with great attention paid to
details.

> We start them in the wading pool. 
> Those who don't drown there get to try the deep end later. I'm sure you
> wouldn't like my classes, but I'm not sure my students would like yours.
> By like, BTW, I mean enjoy the actual learning of programming enough to
> spend the time and thought needed to actually understand it.
> To you other guys: lighten up. So you did it baby-fashion. So it works.
> Okay. But now learn from the master (or at least one of them here) and
> move on. Stop defending and attacking on such a dumb question. There are
> going to be better ways of doing just about anything you care to mention;
> otherwise we CAN close the patent office.
> 
> As for me, I don't care how it damned thing is coded -- just that it work.

To put it bluntly, this is why programming is such a mess, and why there is
structured programming.

> Optimization comes ... uhh ... last.

This is not about optimization, it is about structure and maintainability.

-- 
Paul Lutus
http://www.arachnoid.com




== 10 of 13 ==
Date:   Sun,   Sep 12 2004 9:55 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

ak wrote:

>> > Please read your own website.
>> > It looks like fortress - your leading message is  "DON'T CONTACT ME!!!"
>>
>> And? Too many people contact me instead of reading the instructions.
>> Sound familiar?
> 
> hundreds? thousands? millions?
> lol

Over the life of Arachnophilia (1996 to the present), I haver been contacted
personally by at least 20,000 people, most asking a question answered in
the FAQ or documentation. You are in that group.

-- 
Paul Lutus
http://www.arachnoid.com




== 11 of 13 ==
Date:   Sun,   Sep 12 2004 9:59 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Mike Schilling wrote:

> 
> "Paul Lutus" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> .
>>>> It is a hack.
>>>
>>> Argument by assetion 1.
>>
>> No, it is a hack, not an argument by assertion.
> 
> OK, I get it now.  I thought you were being serious.

You will either return to the topic, or you will be killfiled. It is your
free choice, and your move.

If you had any knowledge of programming, you would understand what is being
discussed in this thread. If you had an argument, you would present it. I
have already presented mine: Disabling "while" by applying "true", thus
creating an unconditional block not provided by the language, then
repairing the broken result with "break", is a hack, one that violates the
most basic paradigm of structured programming.

-- 
Paul Lutus
http://www.arachnoid.com




== 12 of 13 ==
Date:   Sun,   Sep 12 2004 10:01 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Mon, 13 Sep 2004 00:41:09 -0400, Gary Labowitz wrote:

> "Jacob" <[EMAIL PROTECTED]> wrote in message news:...

>> Paul Lutus wrote:
>>
>>> As I have already said, once you have seen this pattern ten thousand
> times,
>>> it begins to seem    familiarandreadable.

> ..I have been seeing a number of posts, very random, that have words
> concatenated as the "familiarandreadable" above. I am worried as to where it
> is coming from (since I'm using OE :)).
> My question is to > > (I think Jacob): did you actually write
> "familiarandreadable" without spaces for a reason, or did you have spaces
> and it came through without?

Don't worry Gary, you are currently at
'a couple of times', but once you have 
read familiarandreadable ten thousand 
times it will be familiarandreadable and 
you will wonder how you ever got by 
without the expression.   ;-)

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



== 13 of 13 ==
Date:   Sun,   Sep 12 2004 10:03 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Jacob wrote:

> Paul Lutus wrote:
> 
>> As I have already said, once you have seen this pattern ten thousand
>> times, it begins to seem familiar and readable.
> 
> I prefer making code understandable for those that have
> *not* read my code 10-thousand times.

I prefer using the language as it was intended to be used, consistent with
the principles of structured programming.

Rule 1. If you use "while", you must test something. If instead you use
"while(true)", you are disabling the clause and creating an unconditional
block, a structure not provided in the language for a reason. After this
mistake, all you can do is add another mistake: a "break" that has no
purpose except to try to repair the earlier mistake.

> That's the majority after all.

The what? Science is not a popularity contest. Programming principles are
not based on consensus.

> It includes avoiding variable names like "len" 
> when meaning "length" and so on.

Try to return to the topic.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: Print help
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d8e2a798b4dcd983
==========================================================================

== 1 of 1 ==
Date:   Sun,   Sep 12 2004 12:35 pm
From: "neo" <[EMAIL PROTECTED]> 

"David Segall" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> "neo" <[EMAIL PROTECTED]> wrote:
>

> iReport (http://ireport.sourceforge.net/)is a good report designer. It
> is a visual front end for JasperReports
> (http://jasperreports.sourceforge.net/) and JFreeChart
> (http://www.jfree.org/jfreechart/index.html).

Thank you, David

Sorry my ignorance but is it possible to integrate this tool in Eclipse IDE 
? how can I do this ? 






==========================================================================
TOPIC: How to set Http Request Header?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b191146c7bfc3a03
==========================================================================

== 1 of 1 ==
Date:   Sun,   Sep 12 2004 2:05 pm
From: [EMAIL PROTECTED] (Yuri Mikhel) 

I  am writing a servlet to perform single signon to an application
that uses Basic Authetication. This 3rd party application is running
on a different server (may not be Java based). I have stored the
usernames and passwords for this app in an external LDAP server. So, I
can retrieve them, encode them in Base64 and send the header via a URL
Connection. Here's my code:

URL url = new URL("http://some.external.server/loginpage";);
URLConnection postUrlConnection = url.openConnection();

postUrlConnection.setDoOutput(true);
postUrlConnection.setUseCaches(false);
postUrlConnection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
postUrlConnection.setRequestProperty("Authorization", "Basic
c3lSTdGVduwWlYmwvZ2xj");

//I cannot call connect() if I need to read the stream - WHY?
//postUrlConnection.connect(); 

InputStream postInputStream = postUrlConnection.getInputStream();

BufferedReader postBufferedReader = new BufferedReader(new
InputStreamReader(postInputStream));
String postline = null;
while((postline = postBufferedReader.readLine()) != null) {
out.println(postline);
}

The servlet is able to login to the application, and it is returning
the page that I am suppose to see as if I log in directly thru the
URL.


I have 2 problems:

1. The returned page has images, files, and URL links that is relative
to the server I am connecting to. But, the client is actually
connected to my servlet on my machine. So, all the links are broken
and I can't get the images. Do I need to do URL re-writing for the
images/links to work? Can I do a sendRedirect() on the response and
yet still authenticated to the server?

2. I copied an URL that I know exist on the application to the
browser. Since my servlet (not the browser) was sending the auth
header, I was not able to go to that page on that application. The
application is asking me to login again with the Basic Auth dialog.
This tells me that the browser did not send the authorization header
on my next request. How do I store the authorization header created by
the servlet INTO THE BROWSER, so that it will be sent on all
subsequent requests?

Please help. Thanks.




==========================================================================
TOPIC: Quake2 in Java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60f3193b21a6bb3
==========================================================================

== 1 of 2 ==
Date:   Sun,   Sep 12 2004 2:10 pm
From: "java programmer" <[EMAIL PROTECTED]> 

A couple of days ago a new version of the jake2 project was released at
source forge.
Java friends are invited to take a look at and have fun with it - you'll
surely be surprised
about the result - just as we were :-)
http://www.bytonic.de/html/jake2.html
http://sourceforge.net/projects/jake2/

regards,
RST






== 2 of 2 ==
Date:   Sun,   Sep 12 2004 8:53 pm
From: Mark Murphy <[EMAIL PROTECTED]> 

java programmer wrote:
> A couple of days ago a new version of the jake2 project was released at
> source forge.
> Java friends are invited to take a look at and have fun with it - you'll
> surely be surprised
> about the result - just as we were :-)
> http://www.bytonic.de/html/jake2.html
> http://sourceforge.net/projects/jake2/
> 
> regards,
> RST
> 
> 
> 
  Very impressive, I was playing Quake with it last night. My CPU was 
pegged at 100% the entire time, but the game play was smooth.

Source to come I hope! Can other environments be built with this?




==========================================================================
TOPIC: Java Student Needs Help
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48d209fbe843b0be
==========================================================================

== 1 of 3 ==
Date:   Sun,   Sep 12 2004 2:47 pm
From: [EMAIL PROTECTED] (beyonder74) 

I have to write a program that lets the user input three numbers
between 1 and 10, the system generates three numbers between 1 and 10.
It must calculate the max of the three system and user numbers. If the
max of each do not match, ask the user for another three and the
system will generate another three and compare again until the max of
each matches. There has to be a counter for the number of times it
runs until it matches. Here is what I have so far, but I can not get
it to return the max.

Here is the main program:

import cs1.Keyboard;
    public class Application2_A1
   {
       public static void main (String args[])
      {
         int first;int second;int third;int userMax;
         int sys1;int sys2;int sys3;int sysMax;
             
         System.out.println("Enter first number: ");
         first=Keyboard.readInt();
         System.out.println("Enter second number: ");
         second=Keyboard.readInt();
         System.out.println("Enter third number: ");
         third=Keyboard.readInt();
         System.out.println(first+" "+second+" "+third);
         
        
         RandomMaxNum a=new RandomMaxNum();
         a.print();
         sys1=a.returnFirst();
         sys2=a.returnSecond();
         sys3=a.returnThird();
       }
    }


Here is the RandomMaxNum class:

import cs1.Keyboard;
    public class Application2_A1
   {
       public static void main (String args[])
      {
         int first;int second;int third;int userMax;
         int sys1;int sys2;int sys3;int sysMax;
             
         System.out.println("Enter first number: ");
         first=Keyboard.readInt();
         System.out.println("Enter second number: ");
         second=Keyboard.readInt();
         System.out.println("Enter third number: ");
         third=Keyboard.readInt();
         System.out.println(first+" "+second+" "+third);
         
        
         RandomMaxNum a=new RandomMaxNum();
         a.print();
         sys1=a.returnFirst();
         sys2=a.returnSecond();
         sys3=a.returnThird();
      }
   }

And finally, the MaxNum class:

 
    public class MaxNum
   {
    private int num1;
         private int num2;
         private int num3;
                 
         public MaxNum()
         {
                this.num1=num1;
                this.num2=num2;
                this.num3=num3; 
         }

    
       public int getMax(int num1,int num2,int num3)
      {
         int tempMax=Math.max(num1,num2);
         int max=Math.max(tempMax,num3);
         return max; 
      }
       public int returnMax()
      {
         MaxNum a=new MaxNum();
         int b=a.getMax(num1,num2,num3);
         return b;
      }
                        
   }



== 2 of 3 ==
Date:   Sun,   Sep 12 2004 2:57 pm
From: Jim Cochrane <[EMAIL PROTECTED]> 

In article <[EMAIL PROTECTED]>, beyonder74 wrote:
> I have to write a program that lets the user input three numbers
> between 1 and 10, the system generates three numbers between 1 and 10.

If you're serious about needing help, you'll get much better results with
a better subject line, one that gives a short summary of your problem,
or a topic your problem falls under.  "Java Student Needs Help" is so
vague, most people will just ignore your post.


-- 
Jim Cochrane; [EMAIL PROTECTED]
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]



== 3 of 3 ==
Date:   Sun,   Sep 12 2004 5:26 pm
From: Alex Hunsley <[EMAIL PROTECTED]> 

beyonder74 wrote:
> I have to write a program that lets the user input three numbers
> between 1 and 10, the system generates three numbers between 1 and 10.
> It must calculate the max of the three system and user numbers. If the
> max of each do not match, ask the user for another three and the
> system will generate another three and compare again until the max of
> each matches. There has to be a counter for the number of times it
> runs until it matches. Here is what I have so far, but I can not get
> it to return the max.

Throw us a bone here. What is the output/behaviour of the code you 
posted? What is the expected output/behaviour?




==========================================================================
TOPIC: setting classpaths with Ant
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/22f3c778af80e37f
==========================================================================

== 1 of 2 ==
Date:   Sun,   Sep 12 2004 3:08 pm
From: "El Durango" <[EMAIL PROTECTED]> 

I am writing an ant script which should set the classpaths for the necessary
Jar files.
Here is what I have:

<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="compile" basedir=".">
        <property name="src" value="."/>
        <property name="build" value="build"/>
        <property name="lib" value="lib"/>
        <target name="init">
                <mkdir dir="${build}"/>
        </target>
        <target name="compile" depends="init">
                <!-- Compile the java code -->

                <javac srcdir="${src}" destdir="${build}"/>
                <classpath>
                      <pathelement location="${baselib}\xercesImpl.jar" />
                        <pathelement location="${lib}\xmlParserAPIs.jar" />
                        <pathelement location="${lib}\xml-apis.jar" />
                        <pathelement location="${lib}\servlet-api.jar" />
                        <pathelement
location="${lib}\commons-fileupload-1.0.jar" />
                </classpath>
        </target>
</project>

However this is not working, as it fails with unresolved symbol errors.

Can anyone let me know how I can set classpaths using Ant, I seem to be
doing it the wrong way.

thanks.






== 2 of 2 ==
Date:   Sun,   Sep 12 2004 5:19 pm
From: "WJ" <[EMAIL PROTECTED]> 

I generally use fileset for my classpath.  Like this:

   <classpath>
    <fileset dir="${lib}">
            <include name="${baselib}/xercesImpl.jar"/>
            <include name="${lib}/xmlParserAPIs.jar"/>
            <include name="${lib}/xml-apis.jar"/>
            <include name="${lib}/servlet-api.jar"/>
    </fileset>
  </classpath>

Also note, I generally use forward slashes instead of back slashes, even on
Windows.  I've
had problems with back slashes from time to time.

You may also want to echo what ant thinks your ${lib} dir is.  e.g.
<echo message="${lib}" />

HTH


"El Durango" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am writing an ant script which should set the classpaths for the
necessary
> Jar files.
> Here is what I have:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="test" default="compile" basedir=".">
>         <property name="src" value="."/>
>         <property name="build" value="build"/>
>         <property name="lib" value="lib"/>
>         <target name="init">
>                 <mkdir dir="${build}"/>
>         </target>
>         <target name="compile" depends="init">
>                 <!-- Compile the java code -->
>
>                 <javac srcdir="${src}" destdir="${build}"/>
>                 <classpath>
>                       <pathelement location="${baselib}\xercesImpl.jar" />
>                         <pathelement location="${lib}\xmlParserAPIs.jar"
/>
>                         <pathelement location="${lib}\xml-apis.jar" />
>                         <pathelement location="${lib}\servlet-api.jar" />
>                         <pathelement
> location="${lib}\commons-fileupload-1.0.jar" />
>                 </classpath>
>         </target>
> </project>
>
> However this is not working, as it fails with unresolved symbol errors.
>
> Can anyone let me know how I can set classpaths using Ant, I seem to be
> doing it the wrong way.
>
> thanks.
>
>
>






==========================================================================
TOPIC: What's the additional value of 'EnumMap' ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/731db423dd8a0ec2
==========================================================================

== 1 of 1 ==
Date:   Sun,   Sep 12 2004 3:25 pm
From: Lasse Reichstein Nielsen <[EMAIL PROTECTED]> 

noname <[EMAIL PROTECTED]> writes:

> He probably means the algorithm is optimized for never having a hash
> collision, so it never has to check the list of values at each
> bucket. 

Indeed. It is a simple array, with only (at most) one value at each
index.
I haven't checked HashMap, but a typical hash map implementation would
have (linked) lists as entries in the array.

/L
-- 
Lasse Reichstein Nielsen  -  [EMAIL PROTECTED]
 DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
  'Faith without judgement merely degrades the spirit divine.'




==========================================================================
TOPIC: java equivalent of perl module Locale::SubCountry?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b803837211c1c4ca
==========================================================================

== 1 of 4 ==
Date:   Sun,   Sep 12 2004 5:50 pm
From: vturner <[EMAIL PROTECTED]> 

Perl has a nice module that converts state province codes for various
countries between a three-char code and the fully expanded name.  For
example, Australia (country code "AU") is composed of several states or
provinces, kind of like states in the US.  Two of the provinces are "QLD"
for "Queensland" and "NSW" for "New South Wales".  I need something that
can take an input of "Queensland" and return "QLD" and vice-versa.

I'm working on a java interface to USPS's online shipping tool and they
expect a country code of "AU" and a State code of "QLD".  However, the
person entering the information on the web site may choose to put in
"Australia" and "Queensland" for the country and state/province code,
respectively.  I can probably use java.util.locale to go back and forth
between "AU" and "Australia", but I can't find an equivalent way to go back
and forth between "Queenslands" and "QLD".  

Does any one know of a Java class/package like this?

some documentation on the perl module is described here:

http://www.cpan.org/modules/by-module/Locale/Locale-SubCountry-1.34.readme



== 2 of 4 ==
Date:   Sun,   Sep 12 2004 8:25 pm
From: Sudsy <[EMAIL PROTECTED]> 

vturner wrote:
<snip>
> Does any one know of a Java class/package like this?

I don't, but you could always pull down the ISO codes and write
something which uses a HashMap or similar construct to achieve
your goal.




== 3 of 4 ==
Date:   Sun,   Sep 12 2004 9:02 pm
From: vturner <[EMAIL PROTECTED]> 

Sudsy wrote:

> vturner wrote:
> <snip>
>> Does any one know of a Java class/package like this?
> 
> I don't, but you could always pull down the ISO codes and write
> something which uses a HashMap or similar construct to achieve
> your goal.
Yeah, but the whole idea is to avoid having to reinvent the wheel.  It's one
thing to maintain a mapping between 100 or so country codes and their
respective names, and another thing to keep track of all the province codes
within each country.  There's multiple provinces in each Country and most
of them are pretty esoteric -- it would be very difficult to know if you've
caught everything.  

I think what I might end up doing is just calling, from a Java program, a
perl script that invokes the perl module (using Runtime.exec() ) and just
pass back the info either via file or InputStream.



== 4 of 4 ==
Date:   Sun,   Sep 12 2004 9:42 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

vturner wrote:

> Sudsy wrote:
> 
>> vturner wrote:
>> <snip>
>>> Does any one know of a Java class/package like this?
>> 
>> I don't, but you could always pull down the ISO codes and write
>> something which uses a HashMap or similar construct to achieve
>> your goal.
> Yeah, but the whole idea is to avoid having to reinvent the wheel.  It's
> one thing to maintain a mapping between 100 or so country codes and their
> respective names, and another thing to keep track of all the province
> codes
> within each country.  There's multiple provinces in each Country and most
> of them are pretty esoteric -- it would be very difficult to know if
> you've caught everything.

So use the Perl database, dump its contents and create a Java version with
the same information.

> 
> I think what I might end up doing is just calling, from a Java program, a
> perl script that invokes the perl module (using Runtime.exec() ) and just
> pass back the info either via file or InputStream.

There really is no need for something like this. You may be able to read the
Perl files directly and glean the required information, and create a Java
class to handle this issue.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: How to invoke jar cammand in the java source code?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ba789da4111ad18
==========================================================================

== 1 of 2 ==
Date:   Sun,   Sep 12 2004 8:06 pm
From: wangyin <[EMAIL PROTECTED]> 

How to invoke jar cammand in the java source code?
  I want to click a button that invoke jar command zip selected item to
a .zip package.
  Thankx!



== 2 of 2 ==
Date:   Sun,   Sep 12 2004 9:39 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

wangyin wrote:

> How to invoke jar cammand in the java source code?
>   I want to click a button that invoke jar command zip selected item to
> a .zip package.

Provide an example of what you want to do, and try for more complete
sentences.

-- 
Paul Lutus
http://www.arachnoid.com




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

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 --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/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