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

Today's topics:

* Division by zero: float vs. int - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6dc583f6638fa877
* Keeping session alive using jakarta httpclient - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f3101b0e018afb1
* emacs Vs Eclipse? - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58b6f53b3e1b91e1
* retroweaver - anyone had a go at fixing it for current jdk1.5.0 release? - 3 
messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/747320088e6854dd
* test file type - 6 messages, 5 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5b6529e6515d9ab
* problems converting an object to Integer - 6 messages, 5 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29e74be87a8276b
* Problem with Bundles - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d84094f17500f336
* Garbage collector quiz - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8540975084df1f47
* Accessing network drives from 1.4.2 (windows box) - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f152296603006240
* problem with weblogic 5.1 an new jar files - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ec8d0c04d0ec9ef
* Tomcat not starting - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3596c52681c96c06
* Counting words in an Html Document - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5805c33eeb567770
* How to retrieve HTTP POST events - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b6fc4445a8f4042c
* How to time out a read from socket - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ab292f90bddfa04
* refresh in jsp - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b4f358300315d217
* Calling Xerces-C from Java - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfcd5377cc5193d7
* Automatic unit and functional testing - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/994002c05165464e
* Recommend a book? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/352d5311f32e2a67
* Checksum java - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dd1da7c2f5dfafc2
* J2EE deploytool: The requested resource is not available. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a28c5005abef64b
  
==========================================================================
TOPIC: Division by zero: float vs. int
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6dc583f6638fa877
==========================================================================

== 1 of 2 ==
Date:   Mon,   Oct 11 2004 8:20 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Joseph Daniel Zukiger coughed up:
> "Thomas G. Marshall"
> <[EMAIL PROTECTED]> wrote in
> message news:<[EMAIL PROTECTED]>...
>> Joseph Daniel Zukiger coughed up:
>>> "Thomas G. Marshall"
>>> <[EMAIL PROTECTED]> wrote in
>>> message news:<[EMAIL PROTECTED]>...
>>>> Joseph Daniel Zukiger coughed up:

...[rip]...

>>>>> So subclass Double.
>>>>
>>>> So no.  It's final.
>>>
>>> Nothing's final if you're willing to do a little drudge work. Wrap
>>> the class.
>>
>> (Double).equals() already works.  Let's stop this---I don't want us
>> moving into circles of already (usually) understood behavior.
>
> Oh, come on. Moving in circles is soooo much fun!
>
> Just kidding.
>
> But I'm still wondering, if you knew the functionality was available,
> why argue in favor of making a floating point primitive do
> non-primitive things?

It /should/ be a "primitive thing" IMHO.

The argument I'm making is that the floating point primitive operations 
should hold

        NaN == NaN, for all values NaN :)

That the .equals() method happens to get that right, is a side issue.

In light of the wars I'm willing to fight to the death, this is certainly 
not one of them.


...[rip]...

-- 
Forgetthesong,I'dratherhavethefrontallobotomy...





== 2 of 2 ==
Date:   Tues,   Oct 12 2004 4:34 am
From: "Tony Morris" <[EMAIL PROTECTED]> 

> And, lest there be any confusion, the Java specs mandate the observed
> behavior, regardless of what the underlying hardware may or may not do.
>
> John Bollinger
> [EMAIL PROTECTED]


And even less confusion, IEEE754 mandates this behaviour.
Java mandates that floating-point types behave as per IEEE754.

-- 
Tony Morris
http://xdweb.net/~dibblego/







==========================================================================
TOPIC: Keeping session alive using jakarta httpclient
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f3101b0e018afb1
==========================================================================

== 1 of 1 ==
Date:   Mon,   Oct 11 2004 7:39 pm
From: [EMAIL PROTECTED] (Michael Fortin) 

Hi,

I'm using jakarta commons httpclient v3.0 and I'm trying to emulate
what I would do using a browser, like logging on to a web application
and then doing an action which requires me to be logged on.

HttpMethod method = null;
int returnCode = 0;
String response = null;
method = new GetMethod(".../login?username=mike&password=test");
returnCode = client.executeMethod(method);
response = getStringFromInputStream(method.getResponseBodyAsStream());
// the response is the "admin" page, I'm logged on! 

method = new GetMethod(".../action?parameter=value");
returnCode = client.executeMethod(method);
response = getStringFromInputStream(method.getResponseBodyAsStream());
// the reponse is the login scren, I'm not authenticated :(

Can someone give me a hint on how I can acheve that?

Thanks,

Mike.




==========================================================================
TOPIC: emacs Vs Eclipse?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58b6f53b3e1b91e1
==========================================================================

== 1 of 3 ==
Date:   Mon,   Oct 11 2004 7:39 pm
From: [EMAIL PROTECTED] (Yakov) 

Will,

Your response should have a title "Using Keyboard vs. Mouse". In this
case I agree with most of your statements (keep in mind that IDEs also
have keyboard shortcuts for most of the menu items).

But does your editor help in learning Java? IDE certainly does. How
about debugging? I start my app server and the client in the same IDE
and easily debug the client's code first, the move to the servlet,
ejb, etc.
Talking about productivity... But sure thing, you can use
System.out.println() and also find the bug.

Regards,
Yakov Fain



== 2 of 3 ==
Date:   Mon,   Oct 11 2004 8:52 pm
From: Sudsy <[EMAIL PROTECTED]> 

Yakov wrote:
<snip>
> But does your editor help in learning Java? IDE certainly does. How
> about debugging? I start my app server and the client in the same IDE
> and easily debug the client's code first, the move to the servlet,
> ejb, etc.
> Talking about productivity... But sure thing, you can use
> System.out.println() and also find the bug.
<snip>

So perhaps you've put your finger on the crux. People who already
KNOW the Java language can find IDEs to be an impediment. Perhaps
they're perceived as a crutch by old-timers. It could also explain
the oft repeated suggestion to learn Java using the command-line
tools at first. Of course this runs counter to the philosophy of
those "programmers" weaned on the VB approach...  ;-)
If you require an IDE to assist you "in learning Java" (direct
cite) then your approach might be considered less-than-optimum by
some people (myself included, BTW).
That opinion doesn't carry over to the debugging, packaging and
deployment phases, IMHO. The ability to set breakpoints visually
in an IDE such as Eclipse and walk through the code is far more
productive than using jdb, in my experience. YMMV.
Nothing wrong with different tools for different jobs...

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.




== 3 of 3 ==
Date:   Tues,   Oct 12 2004 6:00 am
From: Galen Boyer <[EMAIL PROTECTED]> 

On Mon, 11 Oct 2004, [EMAIL PROTECTED] wrote:
> The ability to set breakpoints visually in an IDE such as
> Eclipse and walk through the code is far more productive than
> using jdb, in my experience. YMMV.  

Emacs has the JDEE which has a visual/mouse driven debugger.

> Nothing wrong with different tools for different jobs...

-- 
Galen Boyer




==========================================================================
TOPIC: retroweaver - anyone had a go at fixing it for current jdk1.5.0 release?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/747320088e6854dd
==========================================================================

== 1 of 3 ==
Date:   Mon,   Oct 11 2004 10:50 pm
From: [EMAIL PROTECTED] (Toby Reyelts) 

Alex Hunsley <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...

> I've just tried using retroweaver (http://retroweaver.sourceforge.net/) 
> which claims to be able to mong 1.5 bytecode into 1.4 (and pre) 
> compatible bytecode.
> Unfortunately, it appears that retroweaver was written with a slightly 
> out of date beta of jdk1.5, as it calls methods that don't exist:

It's a documented bug on the SF site. All you have to do is type "ant
clean" and then "ant" to rebuild Retroweaver with your JDK. I'll be
putting out a new release soon that will be compiled with JDK 1.5
final out of the box.

God bless,
-Toby Reyelts



== 2 of 3 ==
Date:   Tues,   Oct 12 2004 2:39 am
From: Alex Hunsley <[EMAIL PROTECTED]> 

Toby Reyelts wrote:
> Alex Hunsley <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> 
> 
>>I've just tried using retroweaver (http://retroweaver.sourceforge.net/) 
>>which claims to be able to mong 1.5 bytecode into 1.4 (and pre) 
>>compatible bytecode.
>>Unfortunately, it appears that retroweaver was written with a slightly 
>>out of date beta of jdk1.5, as it calls methods that don't exist:
> 
> 
> It's a documented bug on the SF site. All you have to do is type "ant
> clean" and then "ant" to rebuild Retroweaver with your JDK. I'll be
> putting out a new release soon that will be compiled with JDK 1.5
> final out of the box.
> 
> God bless,
> -Toby Reyelts

Hi Toby
thanks for that. Obviously I didn't scour the site enough! :)
alex



== 3 of 3 ==
Date:   Tues,   Oct 12 2004 3:19 am
From: Alex Hunsley <[EMAIL PROTECTED]> 

Alex Hunsley wrote:
> Toby Reyelts wrote:
> 
>> Alex Hunsley <[EMAIL PROTECTED]> wrote in message 
>> news:<[EMAIL PROTECTED]>...
>>
>>
>>> I've just tried using retroweaver 
>>> (http://retroweaver.sourceforge.net/) which claims to be able to mong 
>>> 1.5 bytecode into 1.4 (and pre) compatible bytecode.
>>> Unfortunately, it appears that retroweaver was written with a 
>>> slightly out of date beta of jdk1.5, as it calls methods that don't 
>>> exist:
>>
>>
>>
>> It's a documented bug on the SF site. All you have to do is type "ant
>> clean" and then "ant" to rebuild Retroweaver with your JDK. I'll be
>> putting out a new release soon that will be compiled with JDK 1.5
>> final out of the box.
>>
>> God bless,
>> -Toby Reyelts
> 
> 
> Hi Toby
> thanks for that. Obviously I didn't scour the site enough! :)
> alex

Sorry, perhaps I am being really silly here, but I have looked at the 
site again and can't find what I should be downloading. The package I 
originally downloaded yesterday was:

3/24/2004 - Retroweaver 1.0 RC5 Released.


...is this the one that should work?

thanks
alex





==========================================================================
TOPIC: test file type
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5b6529e6515d9ab
==========================================================================

== 1 of 6 ==
Date:   Tues,   Oct 12 2004 12:18 am
From: Claus Atzenbeck <[EMAIL PROTECTED]> 

Hi,

My application will be able to load text and graphic files. Is there a
method that lets me test what kind of file it is loading (text vs graphic)?

Thanks!

Claus



== 2 of 6 ==
Date:   Tues,   Oct 12 2004 2:29 am
From: Claus Atzenbeck <[EMAIL PROTECTED]> 

Andrew Thompson wrote:

> Beyond guessing from the file extensions (if present), no,
> not that know of.  Guessing file type from content is not easy.

Thanks! I think I?ll go for the file extensions solution. That seems to be
the quickest variant.

Thanks also to Jacob for his suggestion!

Claus



== 3 of 6 ==
Date:   Tues,   Oct 12 2004 2:08 am
From: Jacob <[EMAIL PROTECTED]> 

Claus Atzenbeck wrote:

> My application will be able to load text and graphic files. Is there a
> method that lets me test what kind of file it is loading (text vs graphic)?

In general no, but you are able to make a guess that
will probably solve your specific problem:

Assuming ASCII-text, you should be able to rule out
text by reading a portion (say 100 bytes) of the file
and identifying non-ASCII characters.

As a preproces you may of course classify the data
based on file extension.

For a more sophisticated, general solution, check the
UNIX "file"-command approach.

Sometimes one whould really like a general solution to
this problem; given a chunck of data, tell which "type"
the data is. However, when consider it more closely
(and imagine a central type repository, a consortium
controling it, Microsoft, ...) , it is probebly better
the way it is :-)





== 4 of 6 ==
Date:   Tues,   Oct 12 2004 4:38 am
From: Owen Jacobson <[EMAIL PROTECTED]> 

On Tue, 12 Oct 2004 07:44:31 +0000, Andrew Thompson wrote:

> On Tue, 12 Oct 2004 09:18:58 +0200, Claus Atzenbeck wrote:
> 
>> My application will be able to load text and graphic files. Is there a
>> method that lets me test what kind of file it is loading (text vs graphic)?
> 
> Beyond guessing from the file extensions (if present), no,
> not that know of.  Guessing file type from content is not easy.

Off-topic: are there any filesystems floating around that track actual
data types for files?  Either MIME types or some other heirarchical type
data?

Seems to me that MyClass.java really wants to be "MyClass" with file type
like "text/java" or similar, and MyClass.class wants to be "MyClass" with
file type "application/java-bytecode".  (Totally bogus MIME types aside.)

-- 
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution. 




== 5 of 6 ==
Date:   Tues,   Oct 12 2004 4:55 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Owen Jacobson wrote:
>>Beyond guessing from the file extensions (if present), no,
>>not that know of.  Guessing file type from content is not easy.
> 
> 
> Off-topic: are there any filesystems floating around that track actual
> data types for files?  Either MIME types or some other heirarchical type
> data?

MacOS has had "resource forks" with metadata about files for a long time,
BeOS had something similar. Not sure how prominent the file type featured
in this metadata.

The problem is that there is no universal standard for this kind of thing,
so the metadata usually gets lost when the file is transferred between
systems or over a network. You end up with lots of files where it's missing,
and applications that rely on it are useless.

It seems to have resulted in more problems, not fewer:
http://www.petitiononline.com/osxnomd/petition.html


> Seems to me that MyClass.java really wants to be "MyClass" with file type
> like "text/java" or similar, and MyClass.class wants to be "MyClass" with
> file type "application/java-bytecode".  (Totally bogus MIME types aside.)

Seems to me that this can be done resonably well by relying on filename
suffixes, and that seems to be as close to a universally accepted standard
as we're likely going to get anytime soon.



== 6 of 6 ==
Date:   Tues,   Oct 12 2004 4:55 am
From: Real Gagnon <[EMAIL PROTECTED]> 

> My application will be able to load text and graphic files. Is there a
> method that lets me test what kind of file it is loading (text vs
> graphic)? 

See http://www.rgagnon.com/javadetails/java-0487.html

Bye.
-- 
Real Gagnon  from  Quebec, Canada
* Looking for Java or PB snippets ? Visit Real's How-to  
* http://www.rgagnon.com/howto.html




==========================================================================
TOPIC: problems converting an object to Integer
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29e74be87a8276b
==========================================================================

== 1 of 6 ==
Date:   Tues,   Oct 12 2004 1:26 am
From: "andreas kinell" <[EMAIL PROTECTED]> 


> hello and thanks for your time, i am trying this piece of code and it
> doesn't work:
>
> Integer d1 = (Integer)up1;
>
> where up1 in an object and i'm trying to create a new Integer named d1
>
> the compiler doesn't give me an error, but when i run, in the command
> line it gives me:
>
> Exception in thread "main" java.lang.ClassCastException
>
> i am 100% that the object up1 contains an integer value.
>

guess what, i am not!
why don't you catch the ClassCastException and print the actual class of 
your object
should be something like

try{
    Integer d1 = (Integer)up1;
}catch(ClassCastException exception){
    System.out.prinln(up1.getClass().getName();
}

for correct syntax, see
http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html

andreas 





== 2 of 6 ==
Date:   Tues,   Oct 12 2004 1:31 am
From: Thomas Schodt <[EMAIL PROTECTED]> 

Alex wrote:
> i am trying this piece of code and it doesn't work:
> 
> Integer d1 = (Integer)up1;
> 
> where up1 is an object and i'm trying to create a new Integer named d1

What kind of object?
"a new Integer"? - You would need either the "new" keyword, or a method 
that returns an Integer object.

> the compiler doesn't give me an error

You told it to assume up1 is an Integer object.

> but when i run, in the command line it gives me:
> 
> Exception in thread "main" java.lang.ClassCastException

So, probably pd1 is not an Integer object then.

> i am 100% that the object up1 contains an integer value.

Maybe you mean; up1 is a String containing a decimal String 
representation of an integer value?

You probably want to parse it to get an int primitive value rather than 
an Integer object.



== 3 of 6 ==
Date:   Tues,   Oct 12 2004 1:50 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Alex wrote:

> hello and thanks for your time, i am trying this piece of code and it
> doesn't work:
> 
> Integer d1 = (Integer)up1;

That is not a piece of code, it is a line of code, and it is only enough to
support your theory, which is wrong.

> 
> where up1 in an object and i'm trying to create a new Integer named d1

up1 ia not an Integer instance, so the runtime complains appropriately.

> 
> the compiler doesn't give me an error, but when i run, in the command
> line it gives me:
> 
> Exception in thread "main" java.lang.ClassCastException

That is because up1 is not an Integer instance, as you would prove by
posting your code.

> 
> i am 100% that the object up1 contains an integer value.

You are 100% wrong. Post your code, not your theory.

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




== 4 of 6 ==
Date:   Tues,   Oct 12 2004 1:44 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 12 Oct 2004 01:10:36 -0700, Alex wrote:

> hello and thanks for your time, i am trying this piece of code and it
> doesn't work:

Lazy it it?  Tried flogging it?    ;-)

> Integer d1 = (Integer)up1;

..where's the rest of it?

> where up1 in an object and i'm trying to create a new Integer named d1

I do not want your descriptions* of your code.  Gimme the code.
<http://www.physci.org/codes/sscce.jsp>

> Exception in thread "main" java.lang.ClassCastException

<http://www.physci.org/codes/javafaq.jsp#exact>
Which leads to here..
<http://mindprod.com/jgloss/runerrormessages.html#INDEX>
..then here..
<http://mindprod.com/jgloss/runerrormessages.html#CLASSCASTEXCEPTION>

> i am 100% that the object up1 contains an integer value.

* Or your assurances..

And while I have your attention, please find your 'shift' key.
<http://www.physci.org/kbd.jsp?key=shift>

Also, you might get better value from a group described here..
<http://www.physci.org/codes/javafaq.jsp#cljh>

HTH

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



== 5 of 6 ==
Date:   Tues,   Oct 12 2004 3:41 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 12 Oct 2004 11:02:39 +0200, Peter Kirk wrote:

> "Andrew Thompson" <[EMAIL PROTECTED]> skrev i en meddelelse...
..
>> <http://www.physci.org/kbd.jsp?key=shift>
> 
> I like it! Doesn't work completely correctly for my keyboard though
> (danish).

I don't think it's exactly like any known keyboard, but that 
does not prevent it from conveying useful information.   ;-)

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



== 6 of 6 ==
Date:   Tues,   Oct 12 2004 4:36 am
From: Owen Jacobson <[EMAIL PROTECTED]> 

On Tue, 12 Oct 2004 01:10:36 -0700, Alex wrote:

> Integer d1 = (Integer)up1;
> 
> where up1 in an object and i'm trying to create a new Integer named d1

(snip)

> i am 100% that the object up1 contains an integer value.

Not enough relevant information.  You would've done much better to post
your complete source, or the source of a *short* example demonstrating
what you mean that can be compiled and run.

In any case, there's a few things I think you could possibly mean from the
above.

1.  up1 is an instance of a class that contains, as (one of) its
member(s), an int.  You want to create an Integer object containing this
int.

The only way to do so would be to modify whatever class up1 is an instance
of to provide a method that returns an Integer.  In all probability,
you're trying to do something the object that you really oughtn't, like
directly manipulate private data.  Don't do that; tell us what you're
trying to accomplish, both at the implementation level and the big picture.

2.  up1 is an instance of a class that contains, as (one of) its
member(s), an Integer.  You want to access this Integer directly.  Once
again, the only way to do this would be for up1's class to define a method
returning an Integer; once again, you're probably trying to directly
manipulate private data.  Don't.

3.  up1 is a String or string-like object (input stream, etc)
containing a textual representation of an integer (which is not,
contrary to popular opinion, enough to make up1 "an integer" or even
to make it "contain an integer" -- it contains only a representation) that
you'd like to read an integer out of. Look into Integer.parseInt (String),
and various I/O functions in java.io.

-- 
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution. 





==========================================================================
TOPIC: Problem with Bundles
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d84094f17500f336
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 2:14 am
From: [EMAIL PROTECTED] (Vyom) 

I am having a problem with the Java Embedded server, I'm using Jes2.0
on win 2000. I am able to run the example programs given, but the 
bundle I create cannot be installed. The error message shown in the
Management Panel is:

"[file:/...[snip]...\Server.jar] could not be installed. Please verify
that the file path is correct."

The files are all compiling properly and the PATH and CLASSPATH are
also set
appropriately.

Please help.




==========================================================================
TOPIC: Garbage collector quiz
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8540975084df1f47
==========================================================================

== 1 of 3 ==
Date:   Tues,   Oct 12 2004 2:16 am
From: [EMAIL PROTECTED] (Razvan) 

> I choosed 10, the right answer is 11. The reason for this is the fact
> that even if the variable tmp is out of scope it is STILL holding a
> reference to the last 'tmp' string. Is that true ?!! At the above
> mentionated line there is no way in the whole program to access any
> temporary string. Normally they should ALL be garbage collected. Can
> the out of scope variable tmp prevent the garbage collector from
> collecting the last string ?
> 
> 
> 
> 
> Regards,
> Razvan


      I really mess it up: the right answer was 10, I choosed 11. The
reason for this is that the out of scope variable 'tmp' holds a
reference to the last temporary string, thus this one cannot be
garbage collected. So, this is the question: can an out of scope
variable count as a VALID reference ?



Regards,
Razvan



== 2 of 3 ==
Date:   Tues,   Oct 12 2004 1:02 am
From: "Chris Uppal" <[EMAIL PROTECTED]> 

Razvan wrote:

> I choosed 10, the right answer is 11.

I think you meant that the other way around ?


> The reason for this is the fact
> that even if the variable tmp is out of scope it is STILL holding a
> reference to the last 'tmp' string. Is that true ?!!

Joona is correct, but I wanted to expand on this a little.

There are several issues that can confuse this.

One is that, as Joona says, some or all of the temporary Strings may already
have been garbage collected, rather than still merely being "eligible" for
collection.

Another is that the compiler is within its rights (as I read the spec) to
re-write the code as if it said:

    public static void main(String args[])
    {
        System.out.println("CDummy.");
        for(int ii=10; ii>=0; ii--)
        {
            String tmp = Integer.toString(ii);
            System.out.println(tmp);
            tmp = null;
        }
        System.out.println("END");
}

or the equivalent (which is not expressible in Java) where the store used for
the "tmp" variable is overwritten after the inner loop has completed.

So it is possible that /all/ the temporary Strings have become eligible for GC
by the time we read the final println("END").

However, what the question is presumably trying to get at is that, if you
ignore the above complexities, then in a typical implementation the last
temporary String is not available for collection until main() returns.

The reason for that is quite simple, it's that although Java-the-language has a
concept of local variables with a scope smaller than a whole method, the
language understood by the JVM (i.e. the classfile format) does not have that
concept.  In "JVM-speak" (never forget that JVM bytecodes are a high-level
language too -- at least as high-level as Java -- so the Java "compiler" should
really be called a translator) there are no named local variables, just a fixed
size list of "slots" which hold values that are local to each method
invocation.  Those slots come into existence when the method is called, and
their contents only become eligible for GC (typically) when the method returns.

So the Java compiler (sorry, "translator") has used one of the slots to hold
the values of "tmp", and -- unless it either takes special steps to null-out
that slot before the method returns (which no standard compiler does AFAIK), or
happens to re-use that slot for some other variable -- then the last value of
"tmp" will still be in that slot until the method returns.

    -- chris





== 3 of 3 ==
Date:   Tues,   Oct 12 2004 2:33 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

Razvan <[EMAIL PROTECTED]> scribbled the following:
>> I choosed 10, the right answer is 11. The reason for this is the fact
>> that even if the variable tmp is out of scope it is STILL holding a
>> reference to the last 'tmp' string. Is that true ?!! At the above
>> mentionated line there is no way in the whole program to access any
>> temporary string. Normally they should ALL be garbage collected. Can
>> the out of scope variable tmp prevent the garbage collector from
>> collecting the last string ?

>       I really mess it up: the right answer was 10, I choosed 11. The
> reason for this is that the out of scope variable 'tmp' holds a
> reference to the last temporary string, thus this one cannot be
> garbage collected. So, this is the question: can an out of scope
> variable count as a VALID reference ?

As has already been said, there is nothing preventing objects whose all
references have gone out of scope from still existing. A legal Java
implementation could have a garbage collector that only ever runs when
the whole program exits, and then sweeps up every object ever created in
the program.

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"B-but Angus! You're a dragon!"
   - Mickey Mouse




==========================================================================
TOPIC: Accessing network drives from 1.4.2 (windows box)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f152296603006240
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 1:25 am
From: steph <[EMAIL PROTECTED]> 

you can access to network drives if they are mapped on a letter like in all 
applications.

Le 11/10/2004 21:22, kalbee a &eacute;crit :

> We are attempting to access a network drive to move a file in a Java
> application and are unable to access or see network drives from within
> the JVM (??) -- does anyone have a solution?  The app is running on
> Windows 2000 Advanced Server, and we're using the 1.4.2 SDK, and we're
> managing the synchronization of files across servers dynamically.
> 
> Thanks,
> Kim

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




==========================================================================
TOPIC: problem with weblogic 5.1 an new jar files
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ec8d0c04d0ec9ef
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 1:32 am
From: carlo dainese <[EMAIL PROTECTED]> 

[Miren] wrote:
> hello
> i am using weblogic 5.1
> i want to use the PIO libraries (jar files) for creating excel files.
> in the weblogic lib directory i have put the jar file but when i use my 
> class tha weblogic says me that doesn't find the class of the jar file.
> 
> can you help me for solving this grear (for me) problem?
> 
> thnaks 
> 
> 

You should modify the instance classpath adding the PIO libaries.
Cheers
Carlo




==========================================================================
TOPIC: Tomcat not starting
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3596c52681c96c06
==========================================================================

== 1 of 2 ==
Date:   Tues,   Oct 12 2004 5:07 am
From: Sudsy <[EMAIL PROTECTED]> 

Manish Hatwalne wrote:
<snip>
> I am located in India and My JDK is j2sdk1.4.0_01 which is rather old.
> 
> Due to bandwidth restrictions, I can't upgrade to JDK 1.4.2 or later
> immediately.
> From where can I load this JCE and where should I copy it? (is it
> JAVA_HOME/jre/lib  ?)

Thought so. Plus you no doubt downloaded the export version, without
crypto. You can download JCE from <http://java.sun.com> but I don't
know that it will work with 1.4.
You might just have to bite the bullet and download a new, complete
version.

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.




== 2 of 2 ==
Date:   Tues,   Oct 12 2004 5:18 am
From: "Manish Hatwalne" <[EMAIL PROTECTED]> 


> I am located in India and My JDK is j2sdk1.4.0_01 which is rather old.
>
> Due to bandwidth restrictions, I can't upgrade to JDK 1.4.2 or later
> immediately.
> From where can I load this JCE and where should I copy it? (is it
> JAVA_HOME/jre/lib  ?)

OK. I found required policy jar files on Sun's ste, but now they have these
JCE policy files only for JDK 1.4.2 and not for JDK 1.4.0 :(
Where can I get this???

- Manish






==========================================================================
TOPIC: Counting words in an Html Document
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5805c33eeb567770
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 2:51 am
From: [EMAIL PROTECTED] (Francois) 

Hi,

I'm looking for a way to count the words in an Html Document or String.
Any idea or experience with this?

may thx in advance.
rgds,
Francois




==========================================================================
TOPIC: How to retrieve HTTP POST events
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b6fc4445a8f4042c
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 5:37 am
From: Jacob <[EMAIL PROTECTED]> 

I have sent a request to some network server and will get
the response as a HTTP POST message on a specified socket.

How do I write a Java daemon that will listen for this response?

Thanks!





==========================================================================
TOPIC: How to time out a read from socket
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ab292f90bddfa04
==========================================================================

== 1 of 2 ==
Date:   Tues,   Oct 12 2004 5:08 am
From: [EMAIL PROTECTED] (Ed) 

Guys,

I am looking to read from a socket and keep reading until I receive a
certain set of characters.  However in an "error" situation these
characters never arrive, the socket "dries up" and I need to be able
to spot this.

I have a loop as follows:

        
  while((c = m_reader.read()) != -1) 
  {
    message.append((char)c);
    if (message.toString().endsWith(endOfResponseString))
    {
      break;
    }
  }

Obviously if the server misbehaves, the m_reader.read() blocks and
everything hangs.

What I want is some way of "timing out" the loop after a period of
inactivity.

The server is a remote IP server so a message can be sent in separate
"chunks".  m_reader is a BufferedReader but that can be changed if it
helps achieve the desired affect.

Any ideas?

Cheers

Ed



== 2 of 2 ==
Date:   Tues,   Oct 12 2004 5:43 am
From: Gordon Beaton <[EMAIL PROTECTED]> 

On 12 Oct 2004 05:08:19 -0700, Ed wrote:
> I have a loop as follows:
>       
>   while((c = m_reader.read()) != -1) 
>   {
>     message.append((char)c);
>     if (message.toString().endsWith(endOfResponseString))
>     {
>       break;
>     }
>   }
> 
> Obviously if the server misbehaves, the m_reader.read() blocks and
> everything hangs.
> 
> What I want is some way of "timing out" the loop after a period of
> inactivity.

It looks to me like the remote process isn't closing his end of the
connection as maybe it should when an error occurs, or you'd get EOF
here.

Anyway you can use Socket.setSoTimeout() to limit the time you block
while reading. Or use java.nio.Selector.select() with a timeout,
*before* reading from the corresponding SocketChannel.

/gordon


-- 
[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e




==========================================================================
TOPIC: refresh in jsp
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b4f358300315d217
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 3:05 am
From: "Bo Rasmussen" <[EMAIL PROTECTED]> 

Hi,

I've run into what I guess should be common knowledge. The problem goes like
this

I have a rather simple web application with some buttons that fires a POST
request when hit. The parameters for the request could e.g. be
"reserve=yes". The problem is that when the user refreshes the page (done
manually) that same request is fired again resulting in another reservation.
The address line in IE says http://mydomain/mypage.jsp but somehow I receive
a POST request  http://mydomain/mypage.jsp?reserve=yes. How do I take care
of this situation - or have I misunderstood something. I was told that if I
used POST requests things should work....

Regards
Bo Rasmussen






==========================================================================
TOPIC: Calling Xerces-C from Java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfcd5377cc5193d7
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 5:30 am
From: "Jon Smith" <[EMAIL PROTECTED]> 

Is it possible to call a native version of Xerces-C instead of the java
implementation, to make it run quicker.

Thanks

Jon






==========================================================================
TOPIC: Automatic unit and functional testing
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/994002c05165464e
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 3:39 am
From: [EMAIL PROTECTED] (Pawel Radecki) 

Hi there!
DO you use in your big software projects unit and functional testing?
If so please let me know which technologies are using?

Thanks.

--
Regards,
Pawel Radecki




==========================================================================
TOPIC: Recommend a book?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/352d5311f32e2a67
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 3:57 am
From: [EMAIL PROTECTED] (Dave Monroe) 

[EMAIL PROTECTED] (Gregory L. Hansen) wrote in message news:<[EMAIL PROTECTED]>...
> Can you recommend an intro to Java programming in Linux?
> 
> I know Java is supposed to be platform agnostic, but different platforms 
> can have different details like which icon to drag a file on to, or what 
> command to give at the command line.  And I'm not looking to exclude the 
> rest, something with instructions like "If you are using ... then do ..." 
> would be great.  I just don't want to spend $50 for a book that leaves 
> out little details like how to make the program run, or find that I've 
> spent $50 for a stinker.

Download Netbeans.  It gives you a lot of pointers and hints.

It's free (www.netbeans.org).

It also runs on just about everything that has a JVM.




==========================================================================
TOPIC: Checksum java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dd1da7c2f5dfafc2
==========================================================================

== 1 of 2 ==
Date:   Tues,   Oct 12 2004 4:37 am
From: [EMAIL PROTECTED] (Alessio) 

first thing mine is only a pseudoLanguage code for second culo means
the anatomy part of the body that you have instead of the
face(ASSHOLE)!!!!!


Greeting Alessio



== 2 of 2 ==
Date:   Tues,   Oct 12 2004 4:45 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

Alessio <[EMAIL PROTECTED]> scribbled the following:
> first thing mine is only a pseudoLanguage code for second culo means
> the anatomy part of the body that you have instead of the
> face(ASSHOLE)!!!!!

Perhaps in Italy insulting people makes them want to help you, but I
think you'll find that here it has the exact opposite effect. =)

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"To err is human. To really louse things up takes a computer."
   - Anon




==========================================================================
TOPIC: J2EE deploytool: The requested resource is not available.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a28c5005abef64b
==========================================================================

== 1 of 1 ==
Date:   Tues,   Oct 12 2004 4:19 am
From: "Robert Mark Bram" <none> 

Hi All!

I am deploying a web service with the deploytool. This page documents the 
exact steps I took:
http://phd.netcomp.monash.edu.au/RobertMarkBram/notes/j2ee/webServices/tutorial/default.asp#use_deploytool

I believe the application is deployed. The deploy tool displayed a new 
window called "Distribute Module" that output "Operation Completed 
Successfully" at the end.. Further, in the deploy tool in the tree I click 
on:
Servers > localhost:4848
In the Applications tab I see Deployed Applications:
FirstCardService is Running!

But... when I enter this URL:
   http://localhost:4848/card-service/card?WSDL
I get this page:

   HTTP Status 404 - /card-service/card
   type Status report
   message /card-service/card
   description The requested resource (/card-service/card) is not available.
   Sun-Java-System/Application-Server

Any advice on this problem would be much appreciated!

Rob
:) 





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

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