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

Today's topics:

* JTextArea width problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d52c11f1bcc3844
* Difficulties with component events - 2 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a521cb5c55ab6b96
* newbie - jdbc Problem - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3b61df05d633ffba
* Need Testers for *nix - 'libXm.so' file detector - 4 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1469dad598e97f9
* tablet stylus as graphic - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5ebfa85eea4dee1
* Crash: servlets-tomcat-vmware-windows - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e694517317456be9
* Terminating a process tree - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d7dd1ce1cb22f1ca
* Jakarta HttpClient POST question - 4 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/454a24836108467a
* How do you report a JIT crash bug? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e12e8e3c39c7cc4
* J2ME / J2EE Communication - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52432739240ea23f
* Automatically adding missing cast - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f297258156171eae
* Deep nested static class - 5 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ed5e27a6f4900324
* optimizeit: how to workaround/minimize wrong cput time in Object.wait() - 1 
messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/567c06e241a81e28
* jsp standalone - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e96457c73f1eae3a
* request.setAttribute(...) versus session.setAttribute(...) - 1 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e301f649474cd744
* MIDlet Design Question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/45f298001caa915e
* How do I deal with focus events on custom components? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d4427f1a185f4b55
* Why the method of concat(String str) in String Class doesn't work? - 1 
messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f3694bc9d4d3d6
* Changing the time an application runs. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cf6870bc3893f10a
* jdbc new types - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4fa7de2791643843
  
==========================================================================
TOPIC: JTextArea width problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d52c11f1bcc3844
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 2:26 am
From: "Paul H. van Rossem" <[EMAIL PROTECTED]> 

On 08-11-2004 10:52, Neutrino wrote:
> Hello,
> I am using a JTextArea to display 10 lines with a maximum of 40 characters,
> so I created a JTextArea (10, 40). It is working correctly excepted the fact
> that the width of the text area is doubled under KDE  compared to XP Windows
> look-and-feel. With windows the width is closed to the correct size (I mean
> 40 characters fill the area quite correctly), but with Linux KDE, I can
> input quite 80 characters and the area is very large. I understand that for
> fonts size compatibilities and portability reasons the size could be
> different than 40 characters but a so important difference, I do not
> understand ? with other words, is there somewhere an description for what is
> the meaning of the parameter 'column' of the JTextArea constructor ?
> Best Regards,
> AR
> 
> 
Quote from the source code (JTextArea.getColumnWidth()):

* The meaning of what a column is can be considered a fairly weak
* notion for some fonts.  This method is used to define the width
* of a column.  By default this is defined to be the width of the
* character <em>m</em> for the font used.

1) Did you change the Font for the JTextArea?
2) You could override JTextArea.getColumnWidth() to solve this.

Good luck, Paul.




==========================================================================
TOPIC: Difficulties with component events
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a521cb5c55ab6b96
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 8 2004 2:26 am
From: DeMarcus <[EMAIL PROTECTED]> 


Hi,

How can I detect mouseclicks outside my component
without having to know about all other components
existing?

Thanks.
Daniel





== 2 of 2 ==
Date:   Mon,   Nov 8 2004 3:43 am
From: DeMarcus <[EMAIL PROTECTED]> 



DeMarcus wrote:

> 
> Hi,
> 
> How can I detect mouseclicks outside my component
> without having to know about all other components
> existing?
> 
> Thanks.
> Daniel
> 
> 

I found some interesting way of detecting the mouse
clicks with the following code.

getRootPane().getGlassPane().setVisible( true );
getRootPane().getGlassPane().addMouseListener( this );

But now that glassPane steals every mouse event. I just
wanna snoop the events. Does anyone have an idea how
I forward the events to where they belong?






==========================================================================
TOPIC: newbie - jdbc Problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3b61df05d633ffba
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 8 2004 3:13 am
From: [EMAIL PROTECTED] (Xarky) 

Hi,
   I added the PreparedStatment, and it seems to work till that part. 
Now, at runtime it is failing on line
   con.setAutoComit(false);



public void Transactions()
{
        ResultSet result = null;
        String query01 = null;
        boolean flag;
        int data=0;
                                
        query01 = "SELECT hours FROM HoursLog WHERE programmer='Pete'";         
        System.out.println ("Trying to make a transaction on HoursLog
table.");
        try
        {
                PreparedStatement ps = con.prepareStatement ("UPDATE ?HoursLog 
SET
hours = ? WHERE programmer = 'Pete'");
                con.setAutoCommit(true);                
                result = stmt.executeQuery (query01);
                flag = result.next();
                if (flag)
                {       
                        data = result.getInt("hours");
                        data = data + 2;
                        ps.setInt(1,data);                                      
                
                        ps.executeUpdate();
                } // end if
                else
                {
                        System.out.println ("Data searched not found.");
                } // end else
                        System.out.println ("11");
                
                con.setAutoCommit(false);
                System.out.println ("Transaction on HoursLog table completed.");
        } // end try statment
        catch(SQLException e)
        {
                System.err.println ("DatabaseMangager.Transactions() - 
Encountered
SQLException while trying to make a transaction on HoursLog table.");
                System.err.println (e);                 
                e.printStackTrace();
                System.exit(16);
        } // end catch statment
} // end method Transactions


"Andy Flowers" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> As identified in another post, the statement
>     query02 = "UPDATE HoursLog SET hours ="+ data+ "WHERE 
> programmer='Pete'";
> will fail as it will produce incorrect SQL.
> 
> Also even if this is fixed in your code the hours will ALWAYS be 0 as the 
> SQL string will be generated before you have read and set up data.
> 
> A simple, and better, way to get around this is to use a PreparedStatement 
> such as
> 
>   // initialise a prepared statement
>   PreparedStatement ps = con.prepareStatement("UPDATE HoursLog SET hours=? 
> WHERE programmer=?");
> 
>   // read data (and possibly the programmer to update)
>   ....
> 
>   // and then set the values you have read into the prepared statement
>   ps.setInt(1, data);       // hours to set
>   ps.setString(2, "pete"); // programmer to update
> 
>   // and finally execute the update
>   ps.executeUpdate();
> 
> Using a prepared statement will allow you to create the statement in some 
> initialisation block, such as where you create the connection, and then have 
> it reused by setting the parameters as needed.
> 
> See the API documentation for more info at 
> http://java.sun.com/j2se/1.5.0/docs/api/java/sql/PreparedStatement.html
> and also http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
>



== 2 of 2 ==
Date:   Mon,   Nov 8 2004 5:12 am
From: "Andy Flowers" <[EMAIL PROTECTED]> 

PreparedStatement ps = con.prepareStatement ("UPDATE ?HoursLog SET hours = ? 
WHERE programmer = 'Pete'");

The first ? (making ?Hourslog) is not required I believe ?

What error are you receiving ? Is it an exception or a compile time error ?

If it's an exception can you post the details.

"Xarky" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>   I added the PreparedStatment, and it seems to work till that part.
> Now, at runtime it is failing on line
>   con.setAutoComit(false);
>
>
>
> public void Transactions()
> {
> ResultSet result = null;
> String query01 = null;
> boolean flag;
> int data=0;
>
> query01 = "SELECT hours FROM HoursLog WHERE programmer='Pete'";
> System.out.println ("Trying to make a transaction on HoursLog
> table.");
> try
> {
> PreparedStatement ps = con.prepareStatement ("UPDATE ?HoursLog SET
> hours = ? WHERE programmer = 'Pete'");
> con.setAutoCommit(true);
> result = stmt.executeQuery (query01);
> flag = result.next();
> if (flag)
> {
> data = result.getInt("hours");
> data = data + 2;
> ps.setInt(1,data);
> ps.executeUpdate();
> } // end if
> else
> {
> System.out.println ("Data searched not found.");
> } // end else
> System.out.println ("11");
>
> con.setAutoCommit(false);
> System.out.println ("Transaction on HoursLog table completed.");
> } // end try statment
> catch(SQLException e)
> {
> System.err.println ("DatabaseMangager.Transactions() - Encountered
> SQLException while trying to make a transaction on HoursLog table.");
> System.err.println (e);
> e.printStackTrace();
> System.exit(16);
> } // end catch statment
> } // end method Transactions
>
>
> "Andy Flowers" <[EMAIL PROTECTED]> wrote in message 
> news:<[EMAIL PROTECTED]>...
>> As identified in another post, the statement
>>     query02 = "UPDATE HoursLog SET hours ="+ data+ "WHERE
>> programmer='Pete'";
>> will fail as it will produce incorrect SQL.
>>
>> Also even if this is fixed in your code the hours will ALWAYS be 0 as the
>> SQL string will be generated before you have read and set up data.
>>
>> A simple, and better, way to get around this is to use a 
>> PreparedStatement
>> such as
>>
>>   // initialise a prepared statement
>>   PreparedStatement ps = con.prepareStatement("UPDATE HoursLog SET 
>> hours=?
>> WHERE programmer=?");
>>
>>   // read data (and possibly the programmer to update)
>>   ....
>>
>>   // and then set the values you have read into the prepared statement
>>   ps.setInt(1, data);       // hours to set
>>   ps.setString(2, "pete"); // programmer to update
>>
>>   // and finally execute the update
>>   ps.executeUpdate();
>>
>> Using a prepared statement will allow you to create the statement in some
>> initialisation block, such as where you create the connection, and then 
>> have
>> it reused by setting the parameters as needed.
>>
>> See the API documentation for more info at
>> http://java.sun.com/j2se/1.5.0/docs/api/java/sql/PreparedStatement.html
>> and also 
>> http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
>> 






==========================================================================
TOPIC: Need Testers for *nix - 'libXm.so' file detector
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1469dad598e97f9
==========================================================================

== 1 of 4 ==
Date:   Mon,   Nov 8 2004 3:16 am
From: Thomas Weidenfeller <[EMAIL PROTECTED]> 

Andrew Thompson wrote:
> As such, I intend to use a simple class to attempt to detect
> the appropriate paths, and I figure that if I can detect the
> presence of 'libXm.so', that will get me %90 of the way.

Well, I don't know why you want to do that, especially, because there 
might be multiple X installations on a system, so there is absolutely no 
guarantee that you can detect anything out of this.

I also don't see why (at least on Unix) the installation of a screen 
saver requires to know the location of Xm. And, why are you looking for 
libXm, and not libX?

I would recommend something else: Instead of trying to somehow figure 
out a Java way to do it, check the native installation procedures on 
these platforms.

If supporting many different installation mechanisms gets to time 
consuming or confusing, just do what has been done in the last 30 years:

Provide a tar file, which also includes a small install shell script, 
asking the user the necessary questions when run.

If you distribute source code, provide a configure script. if you have 
the time to work through it, consider creating the configure script with 
GNU autoconf.

> I have hacked out some crude code to begin testing this 
> theory, it is below.  I would appreciate if some *nix
> enabled devlopers could run it on their boxes and paste
> the results back for me.

I will refuse to run it, because your code is outright dangerous. The 
moment you really start to search for libXm from the root down, two 
things can and will happen on non trivial systems:

(a) You will walk all network-mounted file systems, generating a lot of 
network traffic for nothing,

(b) You have absolutely no precaution for running into endless loops, 
created by symlinks pointing to one of their own parent directories.

If (b) happens on a file system as pointed out in (a) ...

As some food for thought, on my little workstation I get:

 > df | wc
      488    2929   44599

No joke ...

> Please note that if the code fails to find the file on any
> of the paths defined for the java.library.path, it will then
> revert to a 'brute force' search of the local disks 
> returned by File.listRoots(), so it might take 'a few 
> moments'..

Don't do it. It might take more than just a few moments.

Please, instead, tell us which directories you need to know for this 
screen saver installation, and why you need them.

/Thomas



== 2 of 4 ==
Date:   Mon,   Nov 8 2004 5:26 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Mon, 08 Nov 2004 12:16:21 +0100, Thomas Weidenfeller wrote:

> Please, instead, tell us which directories you need to know for this 
> screen saver installation, and why you need them.

Thanks for your interest ( and the possible avoidance of those 
disasters you were referring to ;-) perhaps it is best if you 
look over the 'Unix ReadMe' file I have placed here..
<http://www.physci.org/saver/unix_readme.txt>

I need to detect 
a) the existence of the 'xscreensaver'.  To know whether
the box has the necessary functionality installed.
b) the correct directories to install components..
the example refers to SCREENSAVER_BIN & SCREENSAVER_CONF
and all the paths start with /usr/..

Suggestions (in addition to your earlier ones) welcome.

-- 
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



== 3 of 4 ==
Date:   Mon,   Nov 8 2004 6:39 am
From: Thomas Weidenfeller <[EMAIL PROTECTED]> 

Andrew Thompson wrote:
> perhaps it is best if you 
> look over the 'Unix ReadMe' file I have placed here..
> <http://www.physci.org/saver/unix_readme.txt>

This is fubar in multiple ways. No, I don't blame you, I blame Sun :-)

Just some issues:

- You will notice that they require to provide valid values for jdkhome 
and xscreensaverhome before compiling. In other words, these locations 
are probably hard-coded in the binaries, jars, or whatever. If this is 
the case, the result can not be freely installed at all.

- You have to install (so I guess you also have to compile :-) a native 
wrapper. So you would need to compile this wrapper for each and every 
target platform you want to support. If you want to have one "Unix 
installation package", you would have to bundle the wrappers for the 
different platforms with your installation package. BTW: I would bet 
that Sun has made no provision to cross-compile these native wrappers. 
So, to build them you would need access to all the platforms you want to 
support (or set up cross compilation by yourself) ...

- They don't distinguish between an installation for one user and an 
installation for all users. They always suggest the later, which is bad, 
because no sane sysadmin will hand you the root password to allow you to 
install some screen saver

- At least on my old trusted Solaris 2.8 there is no xscreensaver by 
default. Instead, there is the old xlock (OpenWindows) and dtscreen 
(CDE/Motif). CDE/Motif screen savers use a particular CDE API - so the 
Java screen savers might not be integratable at all. Also, adding a 
screen saver to CDE/Motif is a rather strange process (requiring to set 
some environment variable and to provide particular CDE actions to start 
the saver). And, of course, instead of lesstif Solaris has the real 
Motif library Xm.

- Just providing the Java source (or a precompiled .class) and pointing 
Unix users to the screensaver SDK will also not work. At least not for 
Solaris users, since Solars does not come with a C compiler. I doubt Joe 
Average User will install a C compiler (Sun's is expensive, setting up 
GCC is some work) just to install a screen saver. And Joe Average User 
would also need ant, probably a JDK and not just a JRE, and the sources 
for xscreensaver.

All in all, a real mess which Sun has created here. To get it working 
you would have to spend a significant amount of time, and you would need 
access to the platforms.

/Thomas



== 4 of 4 ==
Date:   Mon,   Nov 8 2004 6:54 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Mon, 08 Nov 2004 15:39:07 +0100, Thomas Weidenfeller wrote:

> ...To get it working 
> you would have to spend a significant amount of time, and you would need 
> access to the platforms.

Thank you.  Win installation is relatively straightforward,
and I was toying with dropping the *nix support for the moment
(Mac and any others are not supported at all).

Your advice has convinced me to do just that.  
I will proceed with an installer for Win only.

-- 
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: tablet stylus as graphic
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5ebfa85eea4dee1
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 3:45 am
From: "Ike" <[EMAIL PROTECTED]> 

I am wondering if there is a simple applet somewhere, which I could embed in
an html form, such that on a tablet pc, using the tablet's
stylus, sign in some field, that field then, rather than being converted to
text(as is typical in tablets) is then maintained as an image, then, the
form is posted to a mysql database where the image of the signature is
retained as such.

Does anyone know of such an animal, or even something remotely like this?
Thanks, Ike






==========================================================================
TOPIC: Crash: servlets-tomcat-vmware-windows
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e694517317456be9
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 3:59 am
From: [EMAIL PROTECTED] (JC Koerber) 

Hello,

somebody who uses some servlets that i've developped has got some
(very) strange service crashes...
He uses:
* Windows 2000
* VMWare
* Apache Tomcat 5
* JDK 1.4.1_02
I can not reproduce those errors and logs do not give any error
message (tomcat debug level set to 6).
The service crashes with just this message in event logs: "service
terminated unexpectedly"...
It seems not to be a bug from my servlets nor from Tomcat, so i
suspect a crash of JVM...
Does anybody have any idea about what's happening or know how to find
what's going wrong with JVM and VMWare+Windows?

Thanks a lot!
JC.




==========================================================================
TOPIC: Terminating a process tree
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d7dd1ce1cb22f1ca
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 3:57 am
From: "Wayne Marrison" <[EMAIL PROTECTED]> 

(posted yesterday in comp.lang.java.help, but not sure if that was the right 
place and had no response, so posting in here today, sorry for the 
additional bandwidth to those that subscribe to both groups)

Hi group,

I'm new here, so apologies if I ask this in the wrong way.

I have been programming in java for about 2 months, and am currently trying
to control an external application that I start using:

Process proc;
Runtime rt;

proc = rt.exec("java.exe -cp ... etc.. something");

Then I capture the input/output & error streams and thread them off.

The problem I have, is that I need to architect for the eventuality of the
external process locking up and not responding to requests.  I have the
whole capturing of streams in a timeout, so I can tell when the external
program has not responded within a reasonable time, however when I issue the
proc.destroy() method, the java.exe process takes up almost 100% cpu and
never stops.  I have to use operating system tools to perform a manual kill
of the process.

I can only assume that the proc.destroy() doesnt kill the entire process
tree, and because the command line starts off java.exe, which runs the
something.class file, a process is orphaned somewhere.

Any help would be much appreciated.

Thanks

Wayne






==========================================================================
TOPIC: Jakarta HttpClient POST question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/454a24836108467a
==========================================================================

== 1 of 4 ==
Date:   Mon,   Nov 8 2004 3:54 am
From: "Wil Hadden" <[EMAIL PROTECTED]> 

Hi,

I have a quick and hopefully simaple question.

I have been trying to POST some data to a server, and the NamePairValue info
I have been using has a '@' and '+' in it.

When the POST is done the data is encoded ( urlencoded? ) to their %40
counterparts, but I don't want them to be, I want them
transmistted in ther original form.

Anyone know how to do that?

Thanks in advance
Wil





== 2 of 4 ==
Date:   Mon,   Nov 8 2004 4:37 am
From: Thomas Weidenfeller <[EMAIL PROTECTED]> 

Wil Hadden wrote:
> When the POST is done the data is encoded ( urlencoded? ) to their %40
> counterparts,

Which is standard compliant, RFC1738. I suggest you properly decode the 
data.

> but I don't want them to be, I want them
> transmistted in ther original form.

Which is not standard compliant. And I doubt they will change the 
standard, just because you want it.

If Jakarta supports this (I never checked), switch to 
multipart/form-data. But then you have to decode MIME in the responses.

/Thomas



== 3 of 4 ==
Date:   Mon,   Nov 8 2004 6:13 am
From: "Wil Hadden" <[EMAIL PROTECTED]> 


"Thomas Weidenfeller" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Wil Hadden wrote:
> > When the POST is done the data is encoded ( urlencoded? ) to their %40
> > counterparts,
>
> Which is standard compliant, RFC1738. I suggest you properly decode the
> data.
>
> > but I don't want them to be, I want them
> > transmistted in ther original form.
>
> Which is not standard compliant. And I doubt they will change the
> standard, just because you want it.
>
> If Jakarta supports this (I never checked), switch to
> multipart/form-data. But then you have to decode MIME in the responses.
>
> /Thomas

While you are technically correct that that is the standard I doubt if
whoever wrote the server I am posting to will change their software, just
because I would like them to.





== 4 of 4 ==
Date:   Mon,   Nov 8 2004 6:48 am
From: "Andy Flowers" <[EMAIL PROTECTED]> 

If that is the case then take a look at the source 
(http://jakarta.apache.org/commons/httpclient/downloads.html)

You could then look at how to implement a subclass of PostMethod and can 
override the generateRequestBody() function to generate the data in the way 
you want.

"Wil Hadden" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> "Thomas Weidenfeller" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Wil Hadden wrote:
>> > When the POST is done the data is encoded ( urlencoded? ) to their %40
>> > counterparts,
>>
>> Which is standard compliant, RFC1738. I suggest you properly decode the
>> data.
>>
>> > but I don't want them to be, I want them
>> > transmistted in ther original form.
>>
>> Which is not standard compliant. And I doubt they will change the
>> standard, just because you want it.
>>
>> If Jakarta supports this (I never checked), switch to
>> multipart/form-data. But then you have to decode MIME in the responses.
>>
>> /Thomas
>
> While you are technically correct that that is the standard I doubt if
> whoever wrote the server I am posting to will change their software, just
> because I would like them to.
>
> 






==========================================================================
TOPIC: How do you report a JIT crash bug?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e12e8e3c39c7cc4
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 4:20 am
From: Thomas Weidenfeller <[EMAIL PROTECTED]> 

Chris Uppal wrote:
> /You/ pay /them/ to look for bugs in /their/ software ?  Wow !
> 
> Now that's the business to be in...

Welcome to the real world. But from other postings of the OP it looks as 
if the problem isn't as important to him as he originally presented it. 
Which means, the alternative of just sitting there and waiting seems to 
be ok, too.

/Thomas




==========================================================================
TOPIC: J2ME / J2EE Communication
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52432739240ea23f
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 4:31 am
From: "Darryl L. Pierce" <[EMAIL PROTECTED]> 

Raydog wrote:

> Data events could be anytime, so the time between them could be very long
> to realtime (less then a second)
> from what i understand your idea is to let the servlet on the serverside
> hold onto the client connection for a
> period of time, would this approach be scalable ? can the same client make
> other requests to the servlets
> at the same time as hanging to the servlet ?

I doubt it. Most handsets can handle only a single connection at a time. One
way to overcome the problem would be to have the servlet fire SMS messages
to the handsets. But, this assumes the handset supports the Wireless
Messaging APIs. If so, your MIDlet would register to listen to a specific
SMS port for incoming messages. Your servlet would fire messages to the
port on the handset. When the handset receives the message, it notifies the
MIDlet that was registered for that port (and will start the MIDlet if it's
not already running) and the MIDlet can get to the message.

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




==========================================================================
TOPIC: Automatically adding missing cast
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f297258156171eae
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 4:39 am
From: "jAnO!" <[EMAIL PROTECTED]> 

"Kai Grossjohann" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

> But the problem is to find the right spot to add the cast.  Clearly,
> the spot indicated by "^" is not the right spot.  Does anyone have
> suggestions for this?
>
Yes, generics. New in Tiger.







==========================================================================
TOPIC: Deep nested static class
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ed5e27a6f4900324
==========================================================================

== 1 of 5 ==
Date:   Mon,   Nov 8 2004 4:51 am
From: Koos Pol <[EMAIL PROTECTED]> 

Hello,

I'm trying to create a method "bar" with very limited
scope/visibilty, only existing within the scope of "foo".
The following code results in "Illegal start of expression"


class test {

    public static void main(String args[]) {
    }

    private static void foo() {
        private static bar() {
        }
    }
}


Apparently deep nesting of methods seems impossible. Is this true?

For the curious, bar() contains calculation logic only valid
within the context of foo().

Thanks,
Koos

-- 
KP
43rd Law of Computing: "Anything that can go wr
fortune: Segmentation violation -- Core dumped



== 2 of 5 ==
Date:   Mon,   Nov 8 2004 4:59 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Koos Pol wrote:
> Apparently deep nesting of methods seems impossible. Is this true?

Nesting of methods is impossible, period.



== 3 of 5 ==
Date:   Mon,   Nov 8 2004 5:26 am
From: "Andy Flowers" <[EMAIL PROTECTED]> 

If bar() is only valid in the context of foo how about using classes ?

i.e.

class HandleFoo
{
    private void bar() {...}

    public void foo()
    {
       init class level PRIVATE variables
       call bar....
    }
}

or even nested classes ?? 
http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#246214

"Koos Pol" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello,
>
> I'm trying to create a method "bar" with very limited
> scope/visibilty, only existing within the scope of "foo".
> The following code results in "Illegal start of expression"
>
>
> class test {
>
>    public static void main(String args[]) {
>    }
>
>    private static void foo() {
>        private static bar() {
>        }
>    }
> }
>
>
> Apparently deep nesting of methods seems impossible. Is this true?
>
> For the curious, bar() contains calculation logic only valid
> within the context of foo().
>
> Thanks,
> Koos
>
> -- 
> KP
> 43rd Law of Computing: "Anything that can go wr
> fortune: Segmentation violation -- Core dumped 





== 4 of 5 ==
Date:   Mon,   Nov 8 2004 6:09 am
From: Koos Pol <[EMAIL PROTECTED]> 

Michael Borgwardt wrote (Monday 08 November 2004 13:59):

>> Apparently deep nesting of methods seems impossible. Is this
>> true?
> 
> Nesting of methods is impossible, period.

Ok, that's settled then... :-(

-- 
KP
43rd Law of Computing: "Anything that can go wr
fortune: Segmentation violation -- Core dumped



== 5 of 5 ==
Date:   Mon,   Nov 8 2004 6:17 am
From: Koos Pol <[EMAIL PROTECTED]> 

Andy Flowers wrote (Monday 08 November 2004 14:26):

> If bar() is only valid in the context of foo how about using
> classes ?
> 
> i.e.
> 
> class HandleFoo
> {
>     private void bar() {...}
> 
>     public void foo()
>     {
>        init class level PRIVATE variables
>        call bar....
>     }
> }


I've  considered that but I hate it to see bar() taken out of the
foo() context. bar() doesn't have a need to exist outside foo().

> or even nested classes ??

http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#246214

Thanks for the pointer!

Koos
-- 
KP
43rd Law of Computing: "Anything that can go wr
fortune: Segmentation violation -- Core dumped




==========================================================================
TOPIC: optimizeit: how to workaround/minimize wrong cput time in Object.wait()
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/567c06e241a81e28
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 5:34 am
From: "Robert Klemme" <[EMAIL PROTECTED]> 


"NOBODY" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> > Times for Object.wait() are quite uninteresting IMHO because you can't
> > change them anyway.  Also, Object.wait() does not much - most of the
> > time spent in this methods a thread is stopped because it waits for
> > Object.notify() (or notifyAll()).  The overhead of recording this
> > thread's status etc. is neglectible IMHO.
>
> IMHO, you are not on the track... ;-)

If I were you, I wouldn't be so sure of that.

> Lemme exlain again.
> I know 'wait()' is uninterresting. And I expect it to disappear from
> results too! But it doesn't, in a very annoying way...
>
> The fact is, (if you had read the link I sent),

How do you know I didn't?

> you would have
> understood that optimizeit may report false non-null cpu time for a
> thread that went out, did some work (JVMPI thread events that flag it as
> non blocked) and went back in the wait() (or sleep, or i/o read,
> etc...), between profiler 2 samples (lets say 5 ms).
>
> OI will report that this method (known as blocking only to humans, not
> the profiler) actually did some work as per the JVMPI events. Even if
> the work was only 0.1 ms of a 5 ms time window, OI will report that the
> method, here the wait(), has worked 5 ms.

Yep, that's perfectly clear to me.  It's a typical rounding error.

> Basically, if I got Will McQueen right, OI will only be told when a
> thread is blocking/unblocking, it does timestamp those JVMPI events to
> sum up cpu time, but doesn't save it per method/line at a lower
> granularity than the stackframe seen by the corser sampler (5ms). It
> only raise an activity flag ans assigns the time to that method/line.
>
>
> > How did you determine that it's that far off?
>
> I profile with sampling mode, per line, not method, the line is an
> Object.wait() and the profiler reports ~70% of time in that method.
> Can't be clearer.
> Beside, many other users have complained about that problem. This post
> is about figuring solution to a know problem. I don't have to argue
> about its existence.

But maybe you draw the wrong conclusions from your data.  Did it occur to
you that other conclusions could be valid or even more appropriate?
Apparently the thread does not much more than waiting most of the time.
This could either mean, all is well and your program is quite optimal.  Or
it means, there are too many invocations of wait().  You'd probably then
want to switch from notifyAll() to notify().  Or you have a problem on the
notifier side, for example with a farmer worker scenario where the farmer
is too slow putting tasks into the task queue; then workers will starve
and will wait most of the time.

Without knowing you app's architecture it's difficult to speculate.  I
guess you will have to find out the real reasons yourself.  But you should
definitely consider the option that OptimizeIt does give correct results
(apart from the rounding error).

> > I find OptimizeIt very useful.  Maybe you just use it the wrong way.
> > What exactly is it that you want to determine?
>
> I have used OI for the last 6 years. I think I know how to use
> it. What I want to determine is the real wait() %cpu due to real
> contention to reaquire the monitor.

So you don't want CPU time but wall clock time.  That's something
different.  If you monitor CPU time, you won't get an idea of the real
waiting time because a suspended thread does not take up CPU time.

> Right now, I've put many hour tuning
> and fixing hypothetical performance problems and yet, the know design
> pattern to improve the performance don't solve the problem, which means
> they were not the problem at first. I was mislead by bad profiler
> results.

... or because you asked the wrong questions or you interpreted profiler
results incorrectly.

> I want to know how to eliminate/minimize those wrong results.

As I said, I'm not sure that these results are rellay wrong.  Did you
profile with -Xrunhprof or another profiler to get a second opinion?

    robert





==========================================================================
TOPIC: jsp standalone
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e96457c73f1eae3a
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 8 2004 5:27 am
From: "William Brogden" <[EMAIL PROTECTED]> 

On Mon, 08 Nov 2004 10:06:27 +0100, steph  
<[EMAIL PROTECTED]> wrote:

> Hi,
>
> I'd like to use jsp as templating mechanisme to generate HTML files in a  
> standalone application.
>
> What is the best way ? Which api could I use ?
>
> I know I need a jsp compiler to compile .jsp files and a jsp runtime to  
> execute the compiled class. I try to use catalina implémentation with no  
> success.
>

JSP require the environment created by a servlet container such as Tomcat.
Why don't you just run Tomcat and write a little program to open a URL,
read the result, and write it to a file?
Bill



== 2 of 2 ==
Date:   Mon,   Nov 8 2004 6:51 am
From: steph <[EMAIL PROTECTED]> 

Le 08/11/2004 14:27, William Brogden a &eacute;crit :

> On Mon, 08 Nov 2004 10:06:27 +0100, steph  
> <[EMAIL PROTECTED]> wrote:
> 
>> Hi,
>>
>> I'd like to use jsp as templating mechanisme to generate HTML files in 
>> a  standalone application.
>>
>> What is the best way ? Which api could I use ?
>>
>> I know I need a jsp compiler to compile .jsp files and a jsp runtime 
>> to  execute the compiled class. I try to use catalina implémentation 
>> with no  success.
>>
> 
> JSP require the environment created by a servlet container such as Tomcat.
> Why don't you just run Tomcat and write a little program to open a URL,
> read the result, and write it to a file?
> Bill

With an embeded tomcat and httpclient for example ? why not.
But I thought that's a bit huge to run a webserver for my "little" problem of 
templating.

More widely, is there any simple api to have a templating mechanisme in a 
standalone application ?

-- 
stephane
retirez les lettres majuscules et le 666 de l'adresse pour l'utiliser.




==========================================================================
TOPIC: request.setAttribute(...) versus session.setAttribute(...)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e301f649474cd744
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 6:00 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

johnangxun wrote:

> to: john C. Bollinger&q;
> 
> 
>>As Sudsy was pointing out, you also need to watch out 
>>for caching behavior.  User agents (generally browsers), > proxies, and
> 
> web servers all may cache responses under 
> 
>>certain circumstances.  All may cause trouble, but the 
>>most likely to do so are user agents.  For instance, 
>>when a human user clicks the *"Back"* button on his 
>>browser's toolbar, he will generally get a cached 
>>version of the previously visited page instead of 
>>causing a new request to be issued for that page.  This > may be
> 
> different from what he would get by reissuing the > same request by which
> the cached page was originally 
> 
>>fetched.
> 
> 
> Can u explain more about this. I not clear to it. Thanks.

(*) User clicks hyperlink in page (1) displayed in browser window.

(*) Browser makes HTTP request for document associated with the link's URL

(*) Server prepares and sends a response, possibly changing session or 
application state while so doing

(*) Browser renders the content of the HTTP response (page 2), and 
caches a copy of it.

(*) User clicks a submit button or link in page 2

(*) Browser makes HTTP request for document associated with the link's 
URL or the form's action

(*) Server prepares and sends a response, possibly changing session or 
application state while so doing

(*) Browser renders the content of the HTTP response (page 3), and 
caches a copy of it.

(*) User clicks his browser's "back" button

(*) Browser [maybe] displays page 2 _from cache_, exactly as it was 
originally received.  Depending on the application, this differ from the 
result of a new request for page 2's URL.

> Recently I deal with the form processing. I have one form, user will key
> in a lot of the field. After human user finish key in, the enter the
> submit, the *confirmation page* will display, which show all the data key
> in by user. If human user need to change the information, their can click
> *back* button to rekey in again. 

No, they can't.

> But if I click the back button, all the information is the submit
> form(first form) will lost. 

That's why they can't.

> So is it any way to solve it. If I use the session.setAttribute at the
> submit form(first page) will it help? 

Surely it depends on what attribute you set to what value, when, and on 
how your application thereafter uses the the attribute.

If you want to provide a robust means for the user to update data they 
already submitted to the server then it must operate by means of the 
user sending a _new HTTP request_, not by their use of the browser's 
"back" button.  The user's current responses must be remembered in some 
way; this could be in one or more session attributes or in the 
confirmation page itself.  The data entry page would be populated (on 
the server side) with whatever remembered information the server has to 
work with.  This is all very high level.  The details of how you might 
accomplish such behavior are quite varied.


John Bollinger
[EMAIL PROTECTED]




==========================================================================
TOPIC: MIDlet Design Question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/45f298001caa915e
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 5:56 am
From: "Rhino" <[EMAIL PROTECTED]> 

I am trying to understand the proper technique for dismissing a form when I
am done with it.

My MIDlet, whose main class is MemberManager, displays a list of members of
an organization which the user can scroll. In addition, it provides buttons
or menu items to Add new members, Change data for members, and Delete
members. When they choose to Add a member, a Form containing input text
fields is displayed; the user enters data into those fields and presses one
of two buttons: Insert or Cancel. Insert means the user wants to add the
data to the record store and Cancel means that the user has changed his mind
and wants to return to the member list without adding the new data.

In my code, the logic for that displays the Add form and handles its two
buttons are in a separate class, MemberAddForm. In the button handling logic
in MemberAddForm, the logic for the Cancel button simply says to display an
information Alert that says "Insert cancelled" for 5000 milliseconds, then
display the memberList (a reference to the memberList was passed to the
MemberAddForm class). Here is the actual code:

 if (label.equals(CANCEL_INSERT_TEXT)) {
  System.out.println(CLASS_NAME + "." + METHOD_NAME + " - User chose " +
CANCEL_INSERT_TEXT + ".");
  String msg = "Insert Cancelled.";
  Alert cancelled = new Alert("Action", msg, null, AlertType.INFO);
  cancelled.setTimeout(5000); //milliseconds
  display.setCurrent(cancelled);
  return;
  }

This code works but after the return is executed, I am still on the Form
that is displayed by the MemberAddForm class, not the newly refreshed
memberList from the MemberManager class. What do I need to do to end the
MemberAddForm gracefully and get back to the member list in the
MemberManager class? I'm looking for something like the dispose() method
that I use when I write dialogs in J2SE.

My main class, MemberManager class, extends MIDlet. My supporting class,
MemberAddForm, extends Form. Is that the right approach or should
MemberAddForm also extend MIDlet? Is that my problem? If MemberAddForm also
extended MIDlet, I could destroy it when I am done with it. I'm a little
confused because my approach in J2SE would be to make MemberAddForm a dialog
that is initiated by a Frame but J2ME doesn't seem to have the concept of a
dialog.

Can anyone shed some light on this for me?

-- 
Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies." - C.A.R.
Hoare






==========================================================================
TOPIC: How do I deal with focus events on custom components?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d4427f1a185f4b55
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 6:20 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

DeMarcus wrote:

> 
> Hi,
> 
> I have created a custom MyComboBox component that extends
> from JPanel. From there I build up my combobox with a couple
> of standard swing components.
> 
> To me (as I want it) the MyComboBox has focus as long as any
> of the components within has focus.

But that conflicts with the way AWT / Swing define the focus.  Only one 
component has the focus at a time.  You can make your custom component 
simulate gaining / losing the focus, however, by having it listen for 
the internal components' focus events and fire its own focus events in 
response.  This ought to work fairly well as long as you keep the 
internal components well encapsulated, but it has potential to cause 
trouble if the internal components are exposed.

> My question is; what's the best way to detect a lost focus
> event on the whole MyComboBox?

See above.


John Bollinger
[EMAIL PROTECTED]




==========================================================================
TOPIC: Why the method of concat(String str) in String Class doesn't work?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f3694bc9d4d3d6
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 6:30 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

Sudsy wrote:

> Bruce Sam wrote:
> <snip>
> 
>> Why the method of concat() doesn't work?What I hope to do is only to
>> concatenate the str1 to the end of str2;
> 
> 
> Others have cited how the method works. In order to achieve your stated
> goal you could just do this:
> 
>     str2 += str1;

Which is equivalent to str2 = str2.concat(str1) (and also to str2 = str2 
+ str1, of course).  It is important to understand that in either case 
the String originally referred to by variable str2 is *not* modified; 
instead, a new String is constructed and a reference to it is stored in 
str2, replacing the previous reference.  I know Sudsy understands this 
well, but I have a colleague who at one point was confused by it, 
assuming that the += construct caused the left-hand String to be 
modified, and therefore that Strings were mutable.


John Bollinger
[EMAIL PROTECTED]




==========================================================================
TOPIC: Changing the time an application runs.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cf6870bc3893f10a
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 6:56 am
From: "End User" <[EMAIL PROTECTED]> 

Hi all,



I'm not a java programmer, so bear with me.



The question is short and simple.  How do I change the time, set for a 
program to exit?



These are the details:

There is a java applet demo of streaming delayed quotes:

http://finance.lycos.com/qc/livecharts/default.aspx?symbols=IBM



It exits the demo after about three minutes.  While checking the Sun Java 
Console in my Internet Explorer, I noticed a line that said: "URL = 
http://finance.lycos.com/qc/livecharts/ot_timedout.html time= 180000", which 
I suspect to be the culprit.



If so, how can I eliminate that?  Is it possible to change the time to a 
much greater value, or delete the limitation altogether?



Thanks in advance for any assistance!








==========================================================================
TOPIC: jdbc new types
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4fa7de2791643843
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 6:55 am
From: "Juan" <[EMAIL PROTECTED]> 

I'm looking for a database system other than Oracle that supports the jdbc 
2.0 types Array, Struct and so on. 





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

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 

Reply via email to