Re: Problem with difference between Mac & Linux Java

1998-06-30 Thread pat cavanagh



Glenn Valenta wrote:

> I'm new to Java and have taken a course at CU Denver in Java
> Programming. The course outline states (ironically) that you must
> have W95 or a Mac to take the course. I have entered it using
> Linux. All has been fine up till I turned in my first code. The
> following code compiles and runs on my machine without error but
> the instructor stated that when he compiled and ran my code, he
> got an error.
>
> "I get an IO exception on any input to sreport.java. Let
> me know if you are seeing a different behavior."
>

i can also get this error on nt, but your code works ok on
solaris with jdk1.2beta3. my linux machine is not accesible
at the moment, however.

> Why would this code work fine on Linux and not on his Mac?
> Could someone be so kind as to compile and confirm my results?
>

he has a mac? well i don't know enough about macs to be sure,
but i have good reason to believe that it doesn't work on windows
because pressing "enter" on a windows machine generates
"carriage return/line feed" whereas on a linux machine it generates
"carriage return". by slightly modifying your code, i was able to
make it work on windows, but then it didn't work properly
on solaris. now i could just *tell* you what i did, but i wouldn't
want to spoil the fun by doing your homework for you now would i? ;-)

but here's a few hints:


> (I'm unsure of what version he is running.)
> My version is JDK_1.1.5 on RH5.0 using kernal 2.0.33
>
> //sreport.java/
> //  a cheesy program to demonstrate IO   //
> // Program will add sales items and calculate//
> // Salesman's commistion //
>

you spelled commission ^^ wrong up there

> import java.io.*;
>
> public class sreport {
>   public static void main(String args[]) throws IOException
> {
>   double _total=200; //var init to base salary
>   final double _PC=0.09;//percent commission
>
>   final double _A=239.99*_PC;
>   final double _B=129.75*_PC;  //commission on cost of
>   final double _C=99.95*_PC;   //each Item
>   final double _D=350.89*_PC;  //itemcost * percent-commission
>
>   char prod=0;
>   do
> {
>   System.out.println("Enter the Product Sold ( A->D ). X to Exit");
>   prod=(char)System.in.read();
>   switch(prod)
> {
> case'a':case'A':
>   _total+=_A;
>   break;
> case'b':case'B':
>   _total+=_B;
>   break;
> case'c':case'C':
>   _total+=_C;
>   break;
> case'd':case'D':
>   _total+=_D;

you don't have a default for your switch statement, so i can put in
products E through Z or even a-z, 0-9, !@#$%^&*()_{}:"';\/. if i want to.
(not that this is in any way related to your problem of course).

> }
>   System.in.skip(1);//remove nl
> }while(prod!='x'&&prod!='X');
>   System.out.println("Total Weekly Pay is $"+_total);
>}
> }
>

maybe one of these last lines needs to change a little bit?
if you are really close to a deadline i can tell you the answer,
but the problem basically is that this command line stuff is
not portable across architectures. pay close attention to
the different values returned by windows and unix pressing
the enter key, and the answer will leap out and byte you.
see your instructor and ask for only graphical assignments,
then you should be ok. if your deadline fast approaches,
i can tell you the answer in return for copious amounts of
beer. ;-)

hope this helps,
kanpai!
pat




Re: Problem with difference between Mac & Linux Java

1998-06-30 Thread Eitzenberger Thomas

pat cavanagh wrote:

> > }
> >   System.in.skip(1);//remove nl
> > }while(prod!='x'&&prod!='X');
> >   System.out.println("Total Weekly Pay is $"+_total);
> >}
> > }
> >
>
> maybe one of these last lines needs to change a little bit?
> if you are really close to a deadline i can tell you the answer,
> but the problem basically is that this command line stuff is
> not portable across architectures. pay close attention to
> the different values returned by windows and unix pressing
> the enter key, and the answer will leap out and byte you.
> see your instructor and ask for only graphical assignments,
> then you should be ok. if your deadline fast approaches,
> i can tell you the answer in return for copious amounts of
> beer. ;-)
>
> hope this helps,
> kanpai!
> pat

 I never tried it but isn't there a property called line.separator  in
java.lang.System.getProperties() ??

BTW could I get a beer too ?

mfg ET




Re: Problem with difference between Mac & Linux Java

1998-06-30 Thread Geoffrey S. Knauth

I think the problems you're having are with:

  System.in.skip(1);//remove nl

The argument is a long, not an int, so 1L would probably be better.
But the documentation for anInputStream.skip(long n) says:

  Skips over and discards n bytes of data from this input
  stream. The skip method may, for a variety of reasons, end up
  skipping over some smaller number of bytes, possibly 0. The
  actual number of bytes skipped is returned.

So you should test the return value of skip() and you should catch
IOException as well.

Ask your instructor to provide you a stack trace along with the next
bug report.

-- 
Geoffrey S. Knauth   http://world.std.com/~gsk




Re: More keyboard problems

1998-06-30 Thread Joachim Schaaf

Steve Cohen wrote:
> 
>   I am getting my feet wet with java-linux.
> As a first step, I am simply copying code from the disk included with
> the book
> "Java for C/C++ Programmers" by Michael C. DaConta.
> The first "Hello World" program worked okay but the second one,
> attached, does not.
> On my RedHat 5.0 systems (yes, I've upgraded glibc and ld) the dialog
> comes up but no keyboard input shows up.  Any idea why?

> // our book class
> import book;

I guess without this package (book) noone can compile it ...


Joachim
-- 
Joachim Schaaf 
IoS - Gesellschaft fuer innovative Softwareentwicklung mbH
Donatusstrasse 127-129, 50259 Pulheim, Tel/Fax: ++49-2234-986432/3
Email: [EMAIL PROTECTED], WWW: http://www.ios-online.de/




Re: Troubling getting JDK1.1.6v2 to work

1998-06-30 Thread J. Robert Buchanan

Feng,

Thanks very much. I followed your suggestion and all seems to
be well now.

Thanks,
Bob Buchanan ([EMAIL PROTECTED])
Phone: 717-872-3659, FAX: 717-871-2320, http://www.millersv.edu/~jbuchana
Mathematics Dept. Millersville University
P.O. Box 1002, Millersville, PA 17551-0302




Re: More keyboard problems

1998-06-30 Thread Juergen Kreileder

Steve Cohen <[EMAIL PROTECTED]> writes:

>   I am getting my feet wet with java-linux.
> As a first step, I am simply copying code from the disk included with
> the book
> "Java for C/C++ Programmers" by Michael C. DaConta.
> The first "Hello World" program worked okay but the second one,
> attached, does not.
> On my RedHat 5.0 systems (yes, I've upgraded glibc and ld) the dialog
> comes up but no keyboard input shows up.  Any idea why?
Yep, your code is buggy ;-)


> public boolean handleEvent(Event evt) {
>   if (evt.id == Event.ACTION_EVENT)
...
>   }
>   return true;
This should be:
return super.handleEvent(evt);
If you just do a 'return true' only ACTION_EVENTs will be handled.
> }
> }

Jürgen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802




Re: What's up in keyborad Listener?

1998-06-30 Thread Juergen Kreileder

"Andrew An(Tae-Yoon)" <[EMAIL PROTECTED]> writes:

> I tested a few java program,including this program.
> 
> import java.awt.*;
> import java.awt.event.*;
> import java.awt.event.KeyEvent;
> 
> class KeyEventTest{
>   public static void main(String[] args){
>   KeyEventTest tester = new KeyEventTest();
>   Frame f = new Frame();
>   
>   f.add(tester.display,"Center");
>   f.add(tester.input,"West");
>   f.setSize(400,200);
>   f.setVisible(true);
>   
>   }
>   
>   int posX = 0,posY = 0;
>   
>   String inputString = "";
>   
>   TextField input = new TextField(){
>   public Dimension getPreferredSize(){
>   return new Dimension(0,0);
>   }
>};
>   
>   Canvas display = new Canvas(){
>   public void paint(Graphics g){
>   g.drawString(inputString,posX,posY);
>   }
>};
>   
>   KeyEventTest(){
>   display.addKeyListener(kl);
>   display.addMouseListener(ml);
>   display.addFocusListener(fl);
>}
>   
>   MouseListener ml = new MouseAdapter(){
>   public void mousePressed(MouseEvent ev){
>   inputString = "";
>   posX = ev.getX();
>   posY = ev.getY();
>   input.requestFocus();
>   display.repaint();
>   }
>   };
>   
>   FocusListener fl = new FocusAdapter(){
>   public void focusGained(FocusEvent ev){
>   input.requestFocus();
>   }
>};
>   
>   KeyListener kl = new KeyAdapter(){
>   public void KeyTyped(KeyEvent ev){

public void keyTyped(KeyEvent ev){
 
>   System.out.println("in the process of
> key handling.");//debug.
>   inputString += ev.getKeyChar();
>   display.repaint();
>   }
>};
>   
>  }
>   
> key Event is never transmited to  kl.
> I use jdk1.1.5 and Linux Redhat 5.1.

kl is a KeyListener for the Canvas display, but you traverse the focus
to the (not visible) TextField input with your 'input.requestFocus()'
statements. TextField input does not invoke kl's keyTyped method because
kl belongs to display.
If you replace all occurrencies of 'input.requestFocuse' with
'display.requestFocuse' it will work.

Jürgen.


-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802




Re: How many sockets can you serve?

1998-06-30 Thread Uncle George

I suspect at this time it is a hard coded limit in java/vm. Not just for
sockets in particular, but for the sum of all opened channels
gat
Charles Forsythe wrote:

> Fellow Java Linux users:
>
> I have a simple client/sever benchmark (code below) designed to see how
> many simultanious open sockets I can sustain.  The answer seems to be
> about 250.  This is really sad because the crufty HP-UX JDK 1.1.3






Re: How many sockets can you serve?

1998-06-30 Thread Bruce J. Carter

Charles Forsythe wrote:
> 
> Fellow Java Linux users:
> 
> I have a simple client/sever benchmark (code below) designed to see how
> many simultanious open sockets I can sustain.  The answer seems to be
> about 250.  This is really sad because the crufty HP-UX JDK 1.1.3
> managed to make it to 1200.  The exception is weird, too.  Linux throws:


I would have to look at the kernel source, but I do know that on most
commercial Unix system the maximum open file diescriptors is set in an
include file. This can be modified and the kernel rebuilt, on a system
like AIX it configurable with a tool called "smit". On SVR4 it takes a
kernel rebuild, I beleive that is the case with HP-UX, and on Linux I
would think the same thing would hold true. 

One must keep in mind too the implications of opening a lot of fds, and
remember in Unix all devices an sockets are reached via a FD. Which
takes up memory, both kernel and user space memory. If performance is
not a concern then start looking at the kernel headers for MAX_FDS,
MAX_OPEN_FDS, or something along those lines. There may also be
something that tells the kernel what the MAX number of socket
descriptors are allowed also.

The VM, and I could be wrong about this, shold not limit you to how many
open socket/file descriptors can be open at any given time. When I get
home this evening I can verify all of the above and send a reply.

Hope this helps.


Cheers,

Bruce...




Re: How many sockets can you serve?

1998-06-30 Thread Uncle George

maybe i should have more clearly stated, thats for java/vm/linux. the "C"
interface to the os has been "enhanced" to work with linux et al. That
limit need not be there, i guess its just another ti=hing to look at
gat

Charles Forsythe wrote:

> > I suspect at this time it is a hard coded limit in java/vm.
>
> Hmmm... possible, but why is it different for HP and Linux?  Why is it,
> for that matter, *worse* in JDK 1.1.6 on Linux than 1.1.3 on HP-UX?
>
> -- Charles






RE: How many sockets can you serve?

1998-06-30 Thread Stefaan A Eeckels


On 30-Jun-98 Charles Forsythe wrote:
>  I have a simple client/sever benchmark (code below) designed to see how
>  many simultanious open sockets I can sustain.  The answer seems to be
>  about 250.  This is really sad because the crufty HP-UX JDK 1.1.3
>  managed to make it to 1200.  The exception is weird, too.  Linux throws:
Linux has a compile-time limit of 256 open files. You'll need to change
the NR_OPEN symbol in include/linux/fs.h and include/linux/limits.h.
Please review include/linux/posix_types.h, which explains that a
maximum of 1024 open files per process are supported, and that this
is a crib from OSF/1. From a cursory glance at the kernel sources,
it seems to me that the __FD_SETSIZE could be increased without
problems, but YMMV.

Please don't forget to update the system-wide number of open files
and inodes by echoing the appropriate value to
/proc/sys/kernel/files-max and /proc/sys/kernel/inode-max
in your rc.d boot scripts.

PS. Maybe you might want to review the design decision to
have 2500 open sockets. IMESHO you'd be better off splitting
the application over several servers. BTW, Java is a speed-hog,
is there any good reason to use it for the server?

HTH

Stefaan
-- 

PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___
A consultant is a person who borrows your watch, tells you what
  time it is, pockets the watch, and sends you a bill for it.




Re: Creating non-sun RMI Registry

1998-06-30 Thread Jason Dillon

Were you able to attach it to java.rmi.Naming?

--jason


On 30-Jun-98 Jason Gilbert wrote:
> 
> On Mon, 29 Jun 1998, Jason Dillon wrote:
> 
>> Does anyone happen to know how to install a non-sun RMI Registry object that
>> Naming will talk to?  I can't seem to find any documentaion on this at all. 
>> I
>> rather suspect that it is not possible, but why the Registry interfaces?
> 
> By non-sun you apparently mean use the Registry interface to create a 
> registry.  I've done and it worked.  It was awhile back so I'd have to 
> take a look back at it if you want something past "yes, it's possible".
> 
> jason




Re: still problem in key listener

1998-06-30 Thread Juergen Kreileder

"Andrew An(Tae-Yoon)" <[EMAIL PROTECTED]> writes:

> Thanks for reply.
> I replaced input.requestFocus with display.requestFocus.
> But it didn't solve the problem.Nothing changed.Would you give me more
> ideas?

Did you also change 'KeyTyped' to 'keyTyped'? With these modifications
your code works for me. When I click somewhere on the frame and type in
something, the typed string shows up at the click location.

Jürgen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802



RE: Citrix ICA client

1998-06-30 Thread Andrew An(Tae-Yoon)

I ran citrix ICA client a few times in Linux.
Even in Pentium 200, it gave low performance(speed).
But It was an exciting experienece.
> -Original Message-
> From: Steven Heutinck [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, July 01, 1998 2:55 AM
> To:   [EMAIL PROTECTED]
> Subject:  Citrix ICA client
> 
> Has anyone had any experience with the Citrix's  Java  ICA client
> running on Linux?
> 
> Cheers,
> 
> Steve Heutinck
> 



Re: More keyboard problems

1998-06-30 Thread Steve Cohen

Joachim Schaaf wrote:

> Steve Cohen wrote:
> >
> >   I am getting my feet wet with java-linux.
> > As a first step, I am simply copying code from the disk included with
> > the book
> > "Java for C/C++ Programmers" by Michael C. DaConta.
> > The first "Hello World" program worked okay but the second one,
> > attached, does not.
> > On my RedHat 5.0 systems (yes, I've upgraded glibc and ld) the dialog
> > comes up but no keyboard input shows up.  Any idea why?
>
> > // our book class
> > import book;
>
> I guess without this package (book) noone can compile it ...
>
> Joachim
> --
> Joachim Schaaf
> IoS - Gesellschaft fuer innovative Softwareentwicklung mbH
> Donatusstrasse 127-129, 50259 Pulheim, Tel/Fax: ++49-2234-986432/3
> Email: [EMAIL PROTECTED], WWW: http://www.ios-online.de/

Sorry about that.  Okay, it's all there now.  src1-7.java is a new version
incorporating Juergen Kreileder's code fix.  It still doesn't work.
src1-4.java has the book class.




// gui classes
import java.awt.Frame;
import java.awt.TextField;
import java.awt.Panel;
import java.awt.Button;
import java.awt.GridLayout;
import java.awt.Event;
import java.awt.Color;
import java.awt.Label;

// our book class
import book;

// a utility class
import java.util.Vector;

class bookWindow extends Frame {
TextField title;
TextField author;
TextField publisher;
Vector theBooks;
int currentIdx;

bookWindow() {
super("Book Shelf");

// initialize the growable array
theBooks = new Vector(3);
currentIdx = 0;

Panel centerPanel = new Panel();
centerPanel.setLayout(new GridLayout(0, 2));

centerPanel.add(new Label("   Title"));
centerPanel.add(title = new TextField(20));

centerPanel.add(new Label("   Author"));
centerPanel.add(author = new TextField(20));

centerPanel.add(new Label("   Publisher"));
centerPanel.add(publisher = new TextField(20));

add("Center", centerPanel);

Panel bottomPanel = new Panel();
bottomPanel.add(new Button("store"));
bottomPanel.add(new Button("clear"));
bottomPanel.add(new Button("prev"));
bottomPanel.add(new Button("next"));
bottomPanel.add(new Button("exit"));
add("South", bottomPanel);

move(200, 100);
pack();
show();
}

public boolean handleEvent(Event evt) {
if (evt.id == Event.ACTION_EVENT)
{
if ("store".equals(evt.arg))
{
book aBook = new book(title.getText(),
  author.getText(),
  publisher.getText());

theBooks.addElement(aBook);
currentIdx = theBooks.size();
return true;
}
if ("clear".equals(evt.arg))
{
title.setText("");
author.setText("");
publisher.setText("");
return true;
}
if ("prev".equals(evt.arg))
{
if (currentIdx > 0)
{
book aBook = (book) theBooks.elementAt(--currentIdx);
title.setText(aBook.getTitle());
author.setText(aBook.getAuthor());
publisher.setText(aBook.getPublisher()); 
}
return true;
}
if ("next".equals(evt.arg))
{
if (currentIdx < (theBooks.size()-1))
{
book aBook = (book) theBooks.elementAt(++currentIdx);
title.setText(aBook.getTitle());
author.setText(aBook.getAuthor());
publisher.setText(aBook.getPublisher()); 
}
return true;
}
if ("exit".equals(evt.arg))
{
System.exit(0);
}
}
return super.handleEvent(evt);
}
}

class bookGUI {
public static void main(String args[])
{
new bookWindow();
}
}


// books.java
import java.lang.String;
import java.io.DataInputStream;
import java.lang.System;
import java.io.IOException;

class book {
protected String title;
protected String author;
protected String publisher;
book next;

book()
{
title = author = publisher = " ";
next = null;
}

book(book other)
{
title = other.title;
author = other.author;
publisher = other.publisher;
next = null;
}

book(String aTitle, String anAuthor, String aPublisher)
{
title = aTitle;
author = anAuthor;
publisher = aPublisher;
next = null;
  

Re: More keyboard problems

1998-06-30 Thread Juergen Kreileder

Steve Cohen <[EMAIL PROTECTED]> writes:

> Joachim Schaaf wrote:
> 
> > Steve Cohen wrote:
> > >
> > >   I am getting my feet wet with java-linux.
> > > As a first step, I am simply copying code from the disk included with
> > > the book
> > > "Java for C/C++ Programmers" by Michael C. DaConta.
> > > The first "Hello World" program worked okay but the second one,
> > > attached, does not.
> > > On my RedHat 5.0 systems (yes, I've upgraded glibc and ld) the dialog
> > > comes up but no keyboard input shows up.  Any idea why?
> >
> > > // our book class
> > > import book;
> >
> > I guess without this package (book) noone can compile it ...

You can compile the relevant stuff if you comment out the book stmts.

> Sorry about that.  Okay, it's all there now.  src1-7.java is a new version
> incorporating Juergen Kreileder's code fix.  It still doesn't work.
> src1-4.java has the book class.

Your code works fine with JDK 1.1.6!

Jürgen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802



Re: More keyboard problems

1998-06-30 Thread Steve Cohen

Juergen Kreileder wrote:

> Steve Cohen <[EMAIL PROTECTED]> writes:
>
> > Joachim Schaaf wrote:
> >
> > > Steve Cohen wrote:
> > > >
> > > >   I am getting my feet wet with java-linux.
> > > > As a first step, I am simply copying code from the disk included with
> > > > the book
> > > > "Java for C/C++ Programmers" by Michael C. DaConta.
> > > > The first "Hello World" program worked okay but the second one,
> > > > attached, does not.
> > > > On my RedHat 5.0 systems (yes, I've upgraded glibc and ld) the dialog
> > > > comes up but no keyboard input shows up.  Any idea why?
> > >
> > > > // our book class
> > > > import book;
> > >
> > > I guess without this package (book) noone can compile it ...
>
> You can compile the relevant stuff if you comment out the book stmts.
>
> > Sorry about that.  Okay, it's all there now.  src1-7.java is a new version
> > incorporating Juergen Kreileder's code fix.  It still doesn't work.
> > src1-4.java has the book class.
>
> Your code works fine with JDK 1.1.6!
>
> Jürgen
>

Hmm, it works now for me too.
Now to write some of my own code.



Re: Regexp utility classes..

1998-06-30 Thread Pavel

I had some references but now have managed to find only one (but the
best). It is free (but not GNU and no sources). Manages full Perl5
regular expression syntax. OROMatcher.

http://www.oroinc.com/

All the Best
Pavel

Per Widerlund wrote:
> 
> Hello List..
> 
> This may not be the appropriate mailing list to ask about this,
> but does anyone know of some good classes for handling regular
> expressions?
> 
> /Per Widerlund




Problem with difference between Mac & Linux Java

1998-06-30 Thread Glenn Valenta

I'm new to Java and have taken a course at CU Denver in Java
Programming. The course outline states (ironically) that you must
have W95 or a Mac to take the course. I have entered it using
Linux. All has been fine up till I turned in my first code. The
following code compiles and runs on my machine without error but
the instructor stated that when he compiled and ran my code, he 
got an error.

"I get an IO exception on any input to sreport.java. Let
me know if you are seeing a different behavior."

Why would this code work fine on Linux and not on his Mac?
Could someone be so kind as to compile and confirm my results?

(I'm unsure of what version he is running.)
My version is JDK_1.1.5 on RH5.0 using kernal 2.0.33

//sreport.java/
//  a cheesy program to demonstrate IO   //
// Program will add sales items and calculate//
// Salesman's commistion //

import java.io.*;

public class sreport {
  public static void main(String args[]) throws IOException
{ 
  double _total=200; //var init to base salary
  final double _PC=0.09;//percent commission

  final double _A=239.99*_PC; 
  final double _B=129.75*_PC;  //commission on cost of
  final double _C=99.95*_PC;   //each Item
  final double _D=350.89*_PC;  //itemcost * percent-commission

  char prod=0;   
  do
{
  System.out.println("Enter the Product Sold ( A->D ). X to Exit");
  prod=(char)System.in.read();
  switch(prod)
{
case'a':case'A':
  _total+=_A;
  break;
case'b':case'B':
  _total+=_B;
  break;
case'c':case'C':
  _total+=_C;
  break;
case'd':case'D':
  _total+=_D;
}
  System.in.skip(1);//remove nl
}while(prod!='x'&&prod!='X');
  System.out.println("Total Weekly Pay is $"+_total); 
   }
}


-- 
Glenn Valenta  Engineering http://www.coloradostudios.com
[EMAIL PROTECTED]   http://ouray.cudenver.edu/~gavalent/
[EMAIL PROTECTED]  <-main mail account




Re: What's up in keyborad Listener?

1998-06-30 Thread Eitzenberger Thomas

Andrew An(Tae-Yoon) wrote:

> key Event is never transmited to  kl.
> I use jdk1.1.5 and Linux Redhat 5.1.

Well from my point of view let's use requestFocus() on the canvas !

mfg ET

PS Beer Beer Beer !




Re: Problem with difference between Mac & Linux Java

1998-06-30 Thread pat cavanagh



Eitzenberger Thomas wrote:

> pat cavanagh wrote:
>
> > > }
> > >   System.in.skip(1);//remove nl
> > > }while(prod!='x'&&prod!='X');
> > >   System.out.println("Total Weekly Pay is $"+_total);
> > >}
> > > }
> > >
> >
> > maybe one of these last lines needs to change a little bit?
> > if you are really close to a deadline i can tell you the answer,
> > but the problem basically is that this command line stuff is
> > not portable across architectures. pay close attention to
> > the different values returned by windows and unix pressing
> > the enter key, and the answer will leap out and byte you.
> > see your instructor and ask for only graphical assignments,
> > then you should be ok. if your deadline fast approaches,
> > i can tell you the answer in return for copious amounts of
> > beer. ;-)
> >
> > hope this helps,
> > kanpai!
> > pat
>
>  I never tried it but isn't there a property called line.separator  in
> java.lang.System.getProperties() ??
>

ah yes, so there is. i've never tried it either, because after all, if i
wantedcommand line stuff, i would probably use perl, or maybe c++ if i was
feeling
really masochistic. but looking at the web page
http://www.javasoft.com/products/jdk/1.1/docs/api/java.lang.System.html#getProperties()

http://www.javasoft.com/products/jdk/1.1/docs/api/java.util.Properties.html#_top_

it looks like you could do something like this:
Properties p = System.getProperties();
String nl = p.getProperty("line.separator");

and then see if the next stuff on System.in is the same as nl.
i guess that would be portable. so to correct my previous
statement, "this command line stuff is easy to write non-portably
and a bit more work to write portably."


> BTW could I get a beer too ?

free beer for everybody! it's the new age of the java linux list.

kanpai!
pat





More keyboard problems

1998-06-30 Thread Steve Cohen

  I am getting my feet wet with java-linux.
As a first step, I am simply copying code from the disk included with
the book
"Java for C/C++ Programmers" by Michael C. DaConta.
The first "Hello World" program worked okay but the second one,
attached, does not.
On my RedHat 5.0 systems (yes, I've upgraded glibc and ld) the dialog
comes up but no keyboard input shows up.  Any idea why?


// gui classes
import java.awt.Frame;
import java.awt.TextField;
import java.awt.Panel;
import java.awt.Button;
import java.awt.GridLayout;
import java.awt.Event;
import java.awt.Color;
import java.awt.Label;

// our book class
import book;

// a utility class
import java.util.Vector;

class bookWindow extends Frame {
TextField title;
TextField author;
TextField publisher;
Vector theBooks;
int currentIdx;

bookWindow() {
super("Book Shelf");

// initialize the growable array
theBooks = new Vector(3);
currentIdx = 0;

Panel centerPanel = new Panel();
centerPanel.setLayout(new GridLayout(0, 2));

centerPanel.add(new Label("   Title"));
centerPanel.add(title = new TextField(20));

centerPanel.add(new Label("   Author"));
centerPanel.add(author = new TextField(20));

centerPanel.add(new Label("   Publisher"));
centerPanel.add(publisher = new TextField(20));

add("Center", centerPanel);

Panel bottomPanel = new Panel();
bottomPanel.add(new Button("store"));
bottomPanel.add(new Button("clear"));
bottomPanel.add(new Button("prev"));
bottomPanel.add(new Button("next"));
bottomPanel.add(new Button("exit"));
add("South", bottomPanel);

move(200, 100);
pack();
show();
}

public boolean handleEvent(Event evt) {
if (evt.id == Event.ACTION_EVENT)
{
if ("store".equals(evt.arg))
{
book aBook = new book(title.getText(),
  author.getText(),
  publisher.getText());

theBooks.addElement(aBook);
currentIdx = theBooks.size();
return true;
}
if ("clear".equals(evt.arg))
{
title.setText("");
author.setText("");
publisher.setText("");
return true;
}
if ("prev".equals(evt.arg))
{
if (currentIdx > 0)
{
book aBook = (book) theBooks.elementAt(--currentIdx);
title.setText(aBook.getTitle());
author.setText(aBook.getAuthor());
publisher.setText(aBook.getPublisher()); 
}
return true;
}
if ("next".equals(evt.arg))
{
if (currentIdx < (theBooks.size()-1))
{
book aBook = (book) theBooks.elementAt(++currentIdx);
title.setText(aBook.getTitle());
author.setText(aBook.getAuthor());
publisher.setText(aBook.getPublisher()); 
}
return true;
}
if ("exit".equals(evt.arg))
{
System.exit(0);
}
}
return true;
}
}

class bookGUI {
public static void main(String args[])
{
new bookWindow();
}
}


SSLava like ?

1998-06-30 Thread Mario Filipe

Hi

Does anyone know if there is a product like SSLava (or similar as long as it
implements SSL for java) available that is free ?

Thanks.

P.S : SSLava can be found at http://www.phaos.com

Mario Filipe
[EMAIL PROTECTED]
  




Citrix ICA client

1998-06-30 Thread Steven Heutinck

Has anyone had any experience with the Citrix's  Java  ICA client
running on Linux?

Cheers,

Steve Heutinck





Re: Linux native threads

1998-06-30 Thread Bernd Kreimeier

Stephen Zander writes:
 > In Private email with sbb, he informed me that the Sun developers
 > don't believe native threads gives any great advantage over green
 > threads in a uni-CPU environment.

I could not care less about SMI's opinion in this regard.

Green threads inhibit the Invocation API, as I learned
at some expense recently. End of story. I have been using
Japhar (phtreads) ever since, much to my satisfaction,
and have happily ignored JDK.

 > Obviously, that would not be true on a multi-CPU system.
 
Quoting Oaks/Wong, "Java Threads", ORA 1997:
"At the time of this writing, all implementations of
the Java virtual machine are not themselves written
as a threaded program, which means that even if you
have multiple processors in your computer, the
Java virtual machine only uses one processor at a
time."

I wouldn't be surprised if this is still true.
Interesting. I have to check on Japhar for this.

Further: JNI Specs, May 1997, p. 80:
"JDK 1.1.2 does not support cerating more than one
VM in a single process". If you are contemplating
having your app running two or more JVM's, think
again. Haven't seen a change mentioned for JDK 1.2
or JDK 1.1.6, but maybe I missed that.

Japhar supports more than one VM per process, but
I have not tried that (yet).

There was an announcement for a release of 1.1.6
with native pthreads supposed to show up here:
  http://www.gr.opengroup.org/java/jdk/linux

Going to check later...


   b.





Re: JDK 1.1.5/1.1.6 glibc dump

1998-06-30 Thread Bernd Kreimeier

Michael Plump writes:
 > > Happens with and without greenthreads/libc|libdl in the
 > > LD path. RedHat 5.1, glibc-2.0.7-13. 
 > check your /lib/ld.so.1 and /lib/libdl.so.1 and see what versions they are
 > (an "ls -l" should tell you)
 > then try running it with 1.9.6?

37146 May 10 04:49 /lib/libdl-2.0.7.so
   14 Apr 21 13:00 /lib/libdl.so.1 -> libdl.so.1.9.5
 5224 May  8 17:50 /lib/libdl.so.1.9.5
   14 Apr 25 12:35 /lib/libdl.so.2 -> libdl-2.0.7.so

Curious: what has 1.9.5 to do with anything? I have
the glibc ports of JDK:

  ldd libjava.so (as all others)
libm.so.6 => /lib/libm.so.6 (0x40075000)
libdl.so.2 => ./libdl.so.2 (0x4008e000)
libc.so.6 => ./libc.so.6 (0x40091000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2000)

Well, I go looking for a ld 1.9.6 RPM, but somehow I
doubt that this will help. Never mind, Japhar works 
nicely.

 b.






How many sockets can you serve?

1998-06-30 Thread Charles Forsythe

Fellow Java Linux users:

I have a simple client/sever benchmark (code below) designed to see how
many simultanious open sockets I can sustain.  The answer seems to be
about 250.  This is really sad because the crufty HP-UX JDK 1.1.3
managed to make it to 1200.  The exception is weird, too.  Linux throws:

java.net.SocketException: Invalid argument

HP-UX throws:

java.net.SocketException: Too many open files

...which makes a lot more sense.

I am running:
JDK 1.1.6v1
Redhat 5.0
Pentium II-266 128M
10 Based T

Shouldn't I be able to do better than 250 sockets?  Is there a tunable
parameter I'm missing?  I need to reach 2500... or I have to use a
different OS/Language combo!

-8<--- To Reproduce --
I run the following pairs (see code below):

java MonsterServer 2500 15
java SocketMonster 2500 localhost

-8<--- MonsterServer.java --
import java.net.*;
import java.util.*;

public class MonsterServer {
  public static void main(String[] argv) {
int i = 0;
try {
  int numsocks = Integer.parseInt(argv[0]);
  int maxq = Integer.parseInt(argv[1]);
  System.out.println("Maximum set to " + numsocks + " sockets: " 
+ new Date());
  Socket[] s = new Socket[numsocks];

  ServerSocket ss = new ServerSocket(4321, maxq);

  while(i < numsocks) {
s[i++] = ss.accept();
  }
  System.out.println("Socket limit reached");
} catch(Exception e) {
  e.printStackTrace();
  System.out.println("We opened " + i + " sockets.");
}
  }
}
-8<--- SocketMonster.java --
import java.net.*;
import java.util.*;

public class SocketMonster {
  public static void main(String[] argv) {
int numsocks = Integer.parseInt(argv[0]);
System.out.println("Opening " + numsocks + " sockets: " 
+ new Date());
Socket[] s = new Socket[numsocks];
int i = 0;
try {
  System.out.println("Starting the opens: " + new Date());
  for(i = 0; i < numsocks; s[i++] = new Socket(argv[1], 4321));
  for(i = 0; i < numsocks; s[i++].close());
} catch(Exception e) {
  e.printStackTrace();
  System.out.println("We made it to socket " + i);
}
  }
}
-8<--- End Code --




subscribe

1998-06-30 Thread Juergen Hartmut Koch

 
 S/MIME Cryptographic Signature


Re: How many sockets can you serve?

1998-06-30 Thread Charles Forsythe

> I suspect at this time it is a hard coded limit in java/vm.

Hmmm... possible, but why is it different for HP and Linux?  Why is it,
for that matter, *worse* in JDK 1.1.6 on Linux than 1.1.3 on HP-UX?

-- Charles




Event model, etc

1998-06-30 Thread Cailen Fisher

I am just starting to mess with the GUI, and I'm having trouble getting
my event handling to work in applications with java 1.1... Any thoughts?

Thanks.




Re: Creating non-sun RMI Registry

1998-06-30 Thread Jason Gilbert

Jason Dillon wrote:
> 
> Were you able to attach it to java.rmi.Naming?

Yes?  I was able to access it using the java.rmi.Naming
interface.  You just have to make sure you give it valid names I
believe.  Look at the Naming source that comes w/ the jdk. 
Unless you aren't tainted yet;^)  The Naming class is just a
wrapper around the Registry interface.  I also wrote a Handler
class so that I could use rmi://... in URL objects.

jason
 
> >
> > By non-sun you apparently mean use the Registry interface to create a
> > registry.  I've done and it worked.  It was awhile back so I'd have to
> > take a look back at it if you want something past "yes, it's possible".

-- 
Jason Gilbert | http://www.scott.net/~jason/
  | http://www.homewood.net
--
I wish I could make the garbage collector thread in my
brain less agressive.



still problem in key listener

1998-06-30 Thread Andrew An(Tae-Yoon)

Thanks for reply.
I replaced input.requestFocus with display.requestFocus.
But it didn't solve the problem.Nothing changed.Would you give me more
ideas?
Bye.



Registering open-source projects

1998-06-30 Thread Maksim Lin

Hello all,

Apologies for the off-topic cross-post but I thought these 2 mail-lists
would contain people with a general interest in this topic.

I just wanted to pass on the gist of some emails I exchanged with
Patrick Lenz (freshmeat maintainer).  Basically I asked if they were
happy to have java open-source projects registered with freshmeat
(freshmeat.net), to which the reply was yes (and that there maybe anoter
site up specialising in java apps soon).  Also there has been a web-ring
setup by John Jensen over at
http://members.tripod.com/~mpTOOLS/ring.html

(I know a few other sites have been setup in the past, but unfortunetely
they don't seem to be being maintained lately).

The reason I'm "advertising" this stufff is that I think there are
probably still some really good/useful/neat projects being worked on out
there that we never hear about because there are no accepted places to
register this stuff.  For instance I only recently heard about a useful
app on the Freebuilder list, because it happened to get cross-posted
there and I think I remember the author saying afterwards that he got
more responses about it after he sent the post to the list than he had
up till then.  

So hopefully if authors register their projects at these places, we will
all benefit from hearing about these projects and hopefully the authors
will beneift too, by getting more exposure for their projects and thus
more co-developers/testers/users.

Well, now returning to your regular list traffic ...

Thanks,
Maksim Lin.



No luck with thread

1998-06-30 Thread Markian Jaworsky

Still no luck with the suggested thread change.

Specifically, when compiling a program which uses threads comes with:
robot.java -
"Could not instantiate /java/lang/Thread"

//robot.java, an intended java 1.1 program
import java.awt.*; 
import java.awt.applet.*;

public class robot extends Applet implements Runnable {
   Thread animator;
   public void start() { (if animator == null) 
animator = new Thread(this);
 animator.start(); 
   }
   public void stop() { if animator != null) animator.stop(); }
   public void run() { //some code }
}


output of ldconfig and ldd -v appears fine (libawt and libjava) are
picked up correctly. So I'm at a loss to
understand the nature of the problem.  No other problems with the JDK.
HotJava1.1.4 and Netscape 4.05 (non-java 1.1) work fine, so I suspect
it's JDK related. 

kernel 2.0.34, libc5.4.44, ld.so.1.7.14, jdk1.1.3

Cheers,

Mark