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

Today's topics:

* Is it possible to set a block of code as non-JIT area? - 3 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efa6df384a75654c
* Is instanceof dirty? - 6 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/395347a70489adef
* Why would file reading stop at 1124 bytes with this code? - 2 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f79ea47a0b0aea21
* Remote web interface to a Java Application - 5 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4202ea9fb11a293f
* Getting a month from a date - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e7e9d79789939917
* Big Strings in java - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/917e13797df1e216
* 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
* Big Strings - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d3a8b4e7997caff
* Automatically adding missing cast - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f297258156171eae
* jsp standalone - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e96457c73f1eae3a
* runtime.getRuntim().exec(somecmd) problem with linux - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a3f83ceedc3184b0
* What is a Package in Java? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3e73247896cdb4d4
* internationalization versus localization - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e142d0209c11f9a
* J2SE 5.0 or JDK 1.5? - 4 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f54e232a7bd42422
* Terminating a process tree - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d7dd1ce1cb22f1ca
* Current J2EE AppServer vs previous version - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e7cbbdae1c12a1d1
  
==========================================================================
TOPIC: Is it possible to set a block of code as non-JIT area?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efa6df384a75654c
==========================================================================

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

"John C. Bollinger" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL 
PROTECTED]>...
> jacksu wrote:
> 
> > For the rest of the code, I would like the JIT to do the magic, but
> > for certain portion of the java code, I would make it untouched by the
> > JIT.
> 
> Why?
> 
> The answer is academic, I think, because although there might be a way 
> to disable JIT globally, there is no way to disable it only for specific 
> sections of code.  JIT is outside the scope of the Java and bytecode 
> languages -- they have no way to express instructions about it.  So what 
> is the goal underlying your inquiry?
> 
> 
> John Bollinger
> [EMAIL PROTECTED]

Actually our application crashes at one point, and that point has been
obsuficated. We think disable JIT on that portion of code may help.



== 2 of 3 ==
Date:   Mon,   Nov 8 2004 10:14 am
From: [EMAIL PROTECTED] (jacksu) 

Tor Iver Wilhelmsen <[EMAIL PROTECTED]> wrote in message news:<[EMAIL 
PROTECTED]>...
> [EMAIL PROTECTED] (jacksu) writes:
> 
> > For the rest of the code, I would like the JIT to do the magic, but
> > for certain portion of the java code, I would make it untouched by the
> > JIT.
> 
> Translation: I know (better than the makers of Hotspot) what portions
> of my code should be machine-translated and which should be
> interpreted.
> 
> The only way to do this is to write your own JVM implementation.
> Presumably you need a compiler extension as well, e.g.
> 
>  public void foo() {
> 
>     { /** @pragma interpreted */
>         int i = 42;
>         System.out.println(i);
>     }
> }


Thanks for reply. That sounds challenging. Do you have any tutorial to do that? 

Thanks again



== 3 of 3 ==
Date:   Mon,   Nov 8 2004 10:16 am
From: [EMAIL PROTECTED] (jacksu) 

"Chris Uppal" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> jacksu wrote:
> 
> > For the rest of the code, I would like the JIT to do the magic, but
> > for certain portion of the java code, I would make it untouched by the
> > JIT.
> 
> Since there's no mention of the JITer in either the Java standard or the JVM
> standard (i.e. the use of a JIT, or any alternative technology is purely an
> implementation detail) there can be no standard way of doing that.  Any such
> feature would be provided by the /specific/ implementation of the JVM that you
> are using.  Perhaps as a runtime -XX option that specified a file containing a
> list of methods that should/should not be optimised.
> 
> It's not an inherently silly thing to want, but I don't know of any JVM
> implementation that provides it -- probably because there's little need for it
> in general.
> 
> If you really /need/ to avoid the space/time costs of compiling some chunks of
> bytecode (and don't want to implement your own JVM) then you could always 
> write
> a small interpreter (in Java) and embed that, plus the stuff you want it to
> interpret, into your program.  If you go that route then I'd advise against
> using the JVM bytecode set as the target for your interpreter -- it is
> complicated and not particularly compact.
> 
>     -- chris

Thanks, do you have some example on that?




==========================================================================
TOPIC: Is instanceof dirty?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/395347a70489adef
==========================================================================

== 1 of 6 ==
Date:   Mon,   Nov 8 2004 10:20 am
From: Eric Sosman <[EMAIL PROTECTED]> 

DeMarcus wrote:
> Hi,
> 
> I come from the C++ world and there they say "no no" when
> you want to switch on type information. Even the inventor
> of C++ say so.
> 
> What's the common opinion about using the java keyword
> instanceof?

    Use it when you must.  For example, in

        class Thing {
            public boolean equals(Thing other) {
                return ...something...;
            }

            public boolean equals(Object other) {
                return other instanceof Thing
                    && equals((Thing)other);
            }
        }

the `instanceof' seems perfectly normal (and vastly
preferable to catching a ClassCastException).  On the
other hand, if you find code like

        if (ref instanceof Thing)
            ...
        else if (ref instanceof Ding)
            ...
        else if (ref instanceof Cosa)
            ...
        else
            throw new ResException(...);

... it's probably time to re-think the design.

-- 
[EMAIL PROTECTED]




== 2 of 6 ==
Date:   Mon,   Nov 8 2004 10:25 am
From: Chris Smith <[EMAIL PROTECTED]> 

DeMarcus wrote:
> I come from the C++ world and there they say "no no" when
> you want to switch on type information. Even the inventor
> of C++ say so.
> 
> What's the common opinion about using the java keyword
> instanceof?

Pretty much the same.

Nevertheless, a lot more dynamic code gets written in Java than in C++, 
including stuff with on-the-fly classloaders, mobile code, etc.  As a 
result, the need for instanceof can become apparent.  For example, say 
you've developed a plugin architecture based on bytecode, but you need 
to ensure that the class the user provides actually implements the 
correct interface.  This is a case where the traditional disadvantages 
of runtime type comparisons are moot, and performing the type check at 
runtime is a very good idea.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



== 3 of 6 ==
Date:   Mon,   Nov 8 2004 10:34 am
From: "Stefan Schulz" <[EMAIL PROTECTED]> 

On Mon, 08 Nov 2004 13:20:00 -0500, Eric Sosman <[EMAIL PROTECTED]>  
wrote:

>
> the `instanceof' seems perfectly normal (and vastly
> preferable to catching a ClassCastException).  On the
> other hand, if you find code like
>
>       if (ref instanceof Thing)
>           ...
>       else if (ref instanceof Ding)
>           ...
>       else if (ref instanceof Cosa)
>           ...
>       else
>           throw new ResException(...);
>
> ... it's probably time to re-think the design.

I would not be so strict... i would allow code like

if (ref instanceof GoodBoy)
        // do quick and efficiant algorithm only applicable for goodboys
else
        // do long and complicated algorithm that works in the general case

A good example of this kind of thinking would be the java.util.RandomAccess
interface.



-- 

Whom the gods wish to destroy they first call promising.



== 4 of 6 ==
Date:   Mon,   Nov 8 2004 10:34 am
From: "Stefan Schulz" <[EMAIL PROTECTED]> 

On Mon, 08 Nov 2004 18:04:14 GMT, DeMarcus <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I come from the C++ world and there they say "no no" when
> you want to switch on type information. Even the inventor
> of C++ say so.
>
> What's the common opinion about using the java keyword
> instanceof?

Try not to use it when other information will do, it is easy
to make mistakes. But it is a useful capability when used in
moderation.

Just my .02$
Stefan

-- 

Whom the gods wish to destroy they first call promising.



== 5 of 6 ==
Date:   Mon,   Nov 8 2004 11:01 am
From: Eric Sosman <[EMAIL PROTECTED]> 

Stefan Schulz wrote:
> On Mon, 08 Nov 2004 13:20:00 -0500, Eric Sosman <[EMAIL PROTECTED]>  
> wrote:
> 
> 
>>the `instanceof' seems perfectly normal (and vastly
>>preferable to catching a ClassCastException).  On the
>>other hand, if you find code like
>>
>>      if (ref instanceof Thing)
>>          ...
>>      else if (ref instanceof Ding)
>>          ...
>>      else if (ref instanceof Cosa)
>>          ...
>>      else
>>          throw new ResException(...);
>>
>>... it's probably time to re-think the design.
> 
> 
> I would not be so strict... i would allow code like
> 
> if (ref instanceof GoodBoy)
>       // do quick and efficiant algorithm only applicable for goodboys
> else
>       // do long and complicated algorithm that works in the general case
> 
> A good example of this kind of thinking would be the java.util.RandomAccess
> interface.

    "Re-think" is not a synonym for "reject."  Re-thinking
the design might lead to the conclusion that nothing should
change, despite appearances.  Or, as they say in American
football, "Upon further review, the play stands as called."

    With that understood, I'll stand by my opinion (which
I don't think is "strict" at all): Code liberally sprinkled
with `instanceof' operators ought to be re-thought -- but
not necessarily re-written.

-- 
[EMAIL PROTECTED]




== 6 of 6 ==
Date:   Mon,   Nov 8 2004 11:09 am
From: "Daniel Grieves" <[EMAIL PROTECTED]> 

I would disagree with this statement under certain circumstances, 
specifically if your design contract for a method specifies that an incoming 
variable be of a certain type.  For example, I'm a big fan of the old JGL 
library (I dunno, I just got hooked on it and never switched over to the 
new, templatized Java collection classes).  If for example I declare a 
method that takes a parameter of type Array, and I specify in the contract 
for that method that the Array will contain only objects of type String, 
then I would not feel bad about casting blindly and catching (or throwing) 
the ClassCastException.

Dan

"Eric Sosman" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> the `instanceof' seems perfectly normal (and vastly
> preferable to catching a ClassCastException).






==========================================================================
TOPIC: Why would file reading stop at 1124 bytes with this code?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f79ea47a0b0aea21
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 8 2004 10:17 am
From: "Mickey Segal" <[EMAIL PROTECTED]> 

"Steve Horsley" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Ah! You're not using that nasty available() thing at the receiver are you?
> Available() may welll return 0 if not all the reply has arrived yet. This
> is more likely to happen with larger strings. 1120 could be the size of 
> the
> payload after the HTTP header that hapens to fit in one packet.

The receiver was similarly messed up and fixing that too fixed the problem. 
Thanks to all for the help. 





== 2 of 2 ==
Date:   Mon,   Nov 8 2004 10:22 am
From: "Mickey Segal" <[EMAIL PROTECTED]> 

"Sudsy" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I hate to mention the obvious, but I don't see an invocation of
> setContentLength here. I know from experience that not specifying
> the length can give receivers conniptions.

Fixing the stream reading code in the receiving applet fixed the problem. 
But should one also use setContentLength in the servlet?  The only place 
I've seen setContentLength used has been for persistent connections, but are 
others just being sloppy? 






==========================================================================
TOPIC: Remote web interface to a Java Application
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4202ea9fb11a293f
==========================================================================

== 1 of 5 ==
Date:   Mon,   Nov 8 2004 10:22 am
From: [EMAIL PROTECTED] (Sheetal Khemani) 

> On 7 Nov 2004 20:59:51 -0800, Sheetal Khemani wrote:
> 
> > If I have a Java application running on a server, 
> 
> Do you control the application on the server?
> Did you write it?
> 
> >..is there some Java
> > technology by which I can remotely access/modify the memory of that
> > application ?
> 
> What *exactly* do you mean by that?
> Perhaps it is better to state what you want to *achieve*
> than what you want to *do*.  So, what do you hope to gain 
> through this 'memory modification'?

The application consists of a complex schedule, that I am yet to
write. I control everything about this application. The application
sits on some server on the web.

I need ways to interface into this application via the web browser to
do two things:

a) I need to be able to run an algorithm on this schedule.
b) I need to be able to modify the schedule within the application.

I am investigating the easiest way to design/implement this.

I know I could save the schedule in a database, and have an html
frontend. I can map the html requests to operations on the schedule.
Everytime someone modifys it I can update the database. Also if I need
to run the algorithm on it, I can load the database into memory (build
the schedule), run the algorithm, return the result in html.

What I am wondering is, can I skip the need of a database, store the
schedule prepetually in memory - and have java applets (or something
similar?) that can directly access the memory of the application ?
This would help me skip the whole html part too.

I don't know if this is possible, it's just a thought I'd like to
investigate. What got me thinking along these lines, is that in Unix
we can define shared memory across processes; this would be similar
only the memory would be shared across processes on seperate machines.
 
> > Basically, I need to write an interface, preferably within a web
> > browser, that can remotely access/modify memory of an application
> > running on a remote server.
> 
> Again you state what you want to *do*, rather than what
> you are trying to achieve.
> 
> > Any input is appreciated.
> 
> There are probably a number of ways to achieve the end 
> result you are after, but that depends on what that 
> 'end result' is.  Back to you.



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

On 8 Nov 2004 10:22:49 -0800, Sheetal Khemani wrote:

>> On 7 Nov 2004 20:59:51 -0800, Sheetal Khemani wrote:
>> 
>>> If I have a Java application running on a server, 
>> 
>> Do you control the application on the server?
>> Did you write it?
>> 
>>>..is there some Java
>>> technology by which I can remotely access/modify the memory of that
>>> application ?
>> 
>> What *exactly* do you mean by that?
>> Perhaps it is better to state what you want to *achieve*
>> than what you want to *do*.  So, what do you hope to gain 
>> through this 'memory modification'?
> 
> The application consists of a complex schedule, that I am yet to
> write. I control everything about this application. The application
> sits on some server on the web.
...
> I am investigating the easiest way to design/implement this.

The *easiest* way is not always the best..

> I know I could save the schedule in a database, and have an html
> frontend. 

That is part of the best way.

The best way to do this is to offer a rich client front end
to a D/B, that degrades cleanly (for those with no Java in 
the UA they are using) to HTML.

> What I am wondering is, can I skip the need of a database, 

If your app needs a D/B, use a D/B..

>..store the schedule prepetually in memory - 

...you must be kidding.  What happens when the JVM 
is dropped by some process you have no control over?  
All your data is lost.

At the very least write it as XML objects to a safe place 
on the server.  But then, that brings us back to the form 
of the data storage and processing and that (sorting, 
filtering, updating) is something a D/B is specialised to do.

>...and have java applets (or something
> similar?) that can directly access the memory of the application ?
> This would help me skip the whole html part too.

No - you need that even when you have the applets.

> I don't know if this is possible, 

Possible, probably.  Sensible, no.

>...it's just a thought I'd like to
> investigate. What got me thinking along these lines, is that in Unix
> we can define shared memory across processes; this would be similar
> only the memory would be shared across processes on seperate machines.

Java does not allow this level of memory 'sharing', but the
classes of an applet could communicate witha Java application 
on  the server in various ways in order to make it change 
the state of attributes it owns or has access to.

That is not the way I would recomend designing this web-app. though.

-- 
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 5 ==
Date:   Mon,   Nov 8 2004 11:39 am
From: Sheetal Khemani <[EMAIL PROTECTED]> 



> Java does not allow this level of memory 'sharing', but the
> classes of an applet could communicate witha Java application 
> on  the server in various ways in order to make it change 
> the state of attributes it owns or has access to.

This is what I am interested in. I want to investigate this further 
before crossing it out.

How does a Java applet communicate with a remotely running Java 
application ? What protocol is used for this communication and how is 
data transferred across (xml?) ? Could you point me to some documentation 
on how this is done.

Thanks
Sheetal



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

Sheetal Khemani wrote:
>>Java does not allow this level of memory 'sharing', but the
>>classes of an applet could communicate witha Java application 
>>on  the server in various ways in order to make it change 
>>the state of attributes it owns or has access to.
> 
> 
> This is what I am interested in. I want to investigate this further 
> before crossing it out.
> 
> How does a Java applet communicate with a remotely running Java 
> application ? What protocol is used for this communication and how is 
> data transferred across (xml?) ? Could you point me to some documentation 
> on how this is done.

If both sides are Java, this would usually be done with RMI:
http://java.sun.com/docs/books/tutorial/rmi/index.html



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

On Mon, 08 Nov 2004 19:39:49 -0000, Sheetal Khemani wrote:

(A.T.)
>> ..the
>> classes of an applet could communicate witha Java application 

Such as a D/B written in Java.

>> on  the server in various ways 

One of which is exactly the same way a pure HTML interface 
might interact witht the D/B.  Doing a post/get call to a 
.JSP/Servlet that connects to the D/B.

>>..in order to make it change 
>> the state of attributes it owns or has access to.
> 
> This is what I am interested in. I want to investigate this further 
> before crossing it out.
...
> How does a Java applet communicate with a remotely running Java 
> application ? 

Various ways, URL, sockets, RMI..

>..What protocol is used for this communication 

Depends on the data.  There are a multitude of possibilities.

-- 
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: Getting a month from a date
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e7e9d79789939917
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 8 2004 10:29 am
From: Tim Slattery <[EMAIL PROTECTED]> 

I need to extract the month from a Date object as an integer, where
month would range from 1 (for January) to 12 (for December). In the
documentation for the Data object, I see a deprecated getMonth().
Instead of getMonth, we're supposed to create a Calendar object and
use the Calendar.get(Calendar.MONTH) method.

But that method returns one of the Calendar values JANUARY,
FEBRUARY....DECEMBER. So, to get my integer I have to make a long
switch statement to figure out which of these values was returned. I
can't find any discussion of what the month values actually are.

Is there a way to shortcut this rigamarole? It seems that what should
take one line of code is taking about 40 instead.

--
Tim Slattery
[EMAIL PROTECTED]



== 2 of 2 ==
Date:   Mon,   Nov 8 2004 10:42 am
From: Carl <[EMAIL PROTECTED]> 

Tim Slattery wrote:
> I need to extract the month from a Date object as an integer, where
> month would range from 1 (for January) to 12 (for December). In the
> documentation for the Data object, I see a deprecated getMonth().
> Instead of getMonth, we're supposed to create a Calendar object and
> use the Calendar.get(Calendar.MONTH) method.
> 
> But that method returns one of the Calendar values JANUARY,
> FEBRUARY....DECEMBER. So, to get my integer I have to make a long
> switch statement to figure out which of these values was returned. I
> can't find any discussion of what the month values actually are.
> 
> Is there a way to shortcut this rigamarole? It seems that what should
> take one line of code is taking about 40 instead.
> 
> --
> Tim Slattery
> [EMAIL PROTECTED]

Not Quite, the Calendar.get() method returns an integer:
    public int get(int field)

In the case of Calendar.MONTH, remember that the month count is zero 
based, so:

GregorianCalendar gc = new GregorianCalendar();
System.out.println("Month: " + gc.get(GregorianCalendar.MONTH));

Prints 10 for November if run today. This is clearly documented here:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#MONTH





==========================================================================
TOPIC: Big Strings in java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/917e13797df1e216
==========================================================================

== 1 of 3 ==
Date:   Mon,   Nov 8 2004 10:33 am
From: [EMAIL PROTECTED] (Randy Dizitser) 

I have a string thats larger then the String class in java can
accomodate. How can I store it as one string?



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

On 8 Nov 2004 10:33:53 -0800, Randy Dizitser <[EMAIL PROTECTED]> wrote:

> I have a string thats larger then the String class in java can
> accomodate. How can I store it as one string?

Well, the largest String my machine can create is a whopping
268435456 chars long... That is 512 MB. Are you sure your String
is that long, and _needs_ to be that long?

Also, i am pretty sure that this is not a limitation of the String
class, but rather that my PC ran out out memory (the test program
failing with a OutOfMemoryError seems to indicate it ;) )

-- 

Whom the gods wish to destroy they first call promising.



== 3 of 3 ==
Date:   Mon,   Nov 8 2004 11:39 am
From: Chris Smith <[EMAIL PROTECTED]> 

Stefan Schulz wrote:
> Well, the largest String my machine can create is a whopping
> 268435456 chars long... That is 512 MB. Are you sure your String
> is that long, and _needs_ to be that long?
> 
> Also, i am pretty sure that this is not a limitation of the String
> class, but rather that my PC ran out out memory (the test program
> failing with a OutOfMemoryError seems to indicate it ;) )

Yes, you are correct.  The actual limit is 2^31 - 1, or about two 
billion, characters long.  Note that some APIs (such as 
DataOutputStream's writeUTF) may require a shorter length (in that 
example, 2^16 - 1, or about 64K, characters).

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
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 10:42 am
From: "Mickey Segal" <[EMAIL PROTECTED]> 

"Sudsy" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Any chance of posting an abbreviated example? Just the relevant code where
> you're performing the Panel replacement...

It is difficult to do this in a way that is anywhere near complete since the 
applet has 160 classes and about 30,000 lines of code.  But the code with 
the removeAll method is:

page = instantiateClass(pageCode);
page.resetValuesForPage();
removeAll();
page.reLayoutPage();
Page.constrain(this, page, 0, 0, 1, 1, GridBagConstraints.NORTH, 0, 0, 0, 0, 
GridBagConstraints.BOTH, 1, 1);
validate();  // calls setBounds and makes TextFields visible for setText to 
call textValueChanged
page.resetFocusForPage();  // after components are visible
invalidate();
validate();  // makes new components get their proper space

The one kludgy part of the code is two calls to validate, as a workaround 
for a Sun Java bug:
www.segal.org/java/text_events/
in which one can't write to a TextField until it is validated if one is 
expecting Pen input.  On my "to do" list is to find a more elegant 
workaround because it adds a lot of flicker in the Sun JVM, though not 
elsewhere.  If two calls to validate may be causing crashes 1% of the time I 
might give this a higher priority.






==========================================================================
TOPIC: Big Strings
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d3a8b4e7997caff
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 8 2004 10:47 am
From: [EMAIL PROTECTED] (Randy Dizitser) 

I have a string thats larger then the maximum size that the String
class can accomodate. Is there a way to still store my string as one
string?



== 2 of 2 ==
Date:   Mon,   Nov 8 2004 10:51 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

Randy Dizitser <[EMAIL PROTECTED]> scribbled the following:
> I have a string thats larger then the maximum size that the String
> class can accomodate. Is there a way to still store my string as one
> string?

According to my news server's timestamps, you posted this *after* Stefan
Schultz had replied to your previous, completely identical, message.
Don't you read this newsgroup?

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"The large yellow ships hung in the sky in exactly the same way that bricks
don't."
   - Douglas Adams




==========================================================================
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 10:47 am
From: [EMAIL PROTECTED] (Yamin) 

Kai Grossjohann <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Consider the following code snippet:
> 
>         for (Iterator it = coll.iterator();
>              it.hasNext();) {
>             String elem = it.next();
>         }
> 
> It produces the following compilation error (Sun JDK 1.4.2):
> 
> foo.java:47: incompatible types
> found   : java.lang.Object
> required: java.lang.String
>             String elem = it.next();
>                                  ^
> 
> I'm interested in writing code to fix this error automatically.  It is
> very easy to see what needs to be done: add a cast to String before
> the "it.next()" expression.
> 

As others have said, Java 1.5 FINALLY fixes this issue.  But if you
really want to fix it in 1.4, you have to take a few points into
account.

1.  If the number of these errors are not crazy huge (I don't know who
codes that long without trying to compile), a decent IDE can do it for
you.  I know borldand Jbuilder will automatically suggest a type cast
and do it appropriately.

2.  If you really want to fix it automatically, it would be pretty
hard to design a parser to handle all cases.  However If you're like
me and most often my casts are on one line by themselves anyways (the
simple case you present)
You could just to the following.
a.  get the errored line.
b.  get the first token at the start of the line.
c.  insert it after the first equals sign in parenthesis

Note, this would probably mess stuff up if run on an error not caused
by the type cast.  It also would not have cases where casting is not
exclusively on one line (there must be a term for this)...like this:
int length = ((String)it.next).length;




==========================================================================
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 10:47 am
From: "Alex Kay" <[EMAIL PROTECTED]> 

"steph" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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.
>
> Help.
>
> Thanks

I'm sure there are other ways but off the top of my head:-

1.You can run Jetty (a small but nice servlet/jsp container) in embedded
mode thus keeping with your standalone theme,

2. Many servlet/jsp servers have a command line utility to compile JSPs you
can then call the server from a utility pass some HTTP messages to it and
capture the HTML (this wouldn't be hard),

3. maybe write you're own simple template function and not have full-blown
jsp.

Cheers
Alex Kay





== 2 of 2 ==
Date:   Mon,   Nov 8 2004 11:54 am
From: Bryce <[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.
>

I'm not sure what you are trying to do, but JSP's get compiled NOT to
HTML, but to java servlets.

If you are looking for a good way to generate HTML files from a
template, you might want to look at Velocity (unless I'm not
understanding you).

http://jakarta.apache.org/velocity/


--
now with more cowbell




==========================================================================
TOPIC: runtime.getRuntim().exec(somecmd) problem with linux
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a3f83ceedc3184b0
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 8 2004 11:09 am
From: "A. Bolmarcich" <[EMAIL PROTECTED]> 

On 2004-11-08, wex <[EMAIL PROTECTED]> wrote:
> I tried this and could not get it to work.  See below for example if
> what I tried.  What am I doing wrong?
>
>>> Because just running the simple
>>> command:
>>> String[] cmd = {"/path with space/somecommand"};
>>> runtime.getRuntim().exec(cmd); 
>>> Gives me the io exception, it is as if the command is tokenized
> again
>>> somewhere in the native code.

As others have commented, it is difficult to tell what you are doing
wrong without seeing a complete program.  Here is a small complete
java program that works for me.


public class Y {
  public static void main(String args[]) throws Exception {
    Process p = Runtime.getRuntime().exec(new String[]
          {"/path with space/somecommand"}
    );
    p.waitFor();
    System.out.println("exit value = " + p.exitValue());
  }
}

                                                                                
When run with a /path with space/somecommand file that contains


#!/bin/sh
exit 5

                                                                                
I get the line of output

                                                                                
exit value = 5


Make sure that
- the permissions allow the user running the Java program to read and
  execute the file named "/path with space/somecommand"

- the first line of the file named "/path with space/somecommand"
  indicates what shell is to interpret the file



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

On Mon, 08 Nov 2004 19:09:12 -0000, A. Bolmarcich wrote:

> public class Y {
... (snip other 7 lines)
> }

Dang!  I thought I was being a bit generous to set the 
line number at '25'!  ( shoulda' stuck to 15... ;)




==========================================================================
TOPIC: What is a Package in Java?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3e73247896cdb4d4
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 11:23 am
From: [EMAIL PROTECTED] (Sipayi) 

Sometimes the simplest ideas of Java are never understood.

I have seen some coding conventions of Java in a multi-million
dollar *J2EE* project of a telecom giant. As per the coding 
conventions, ever class name in the project is prefixed by 13 
characters, AAA_BBBB_CCCC_<class name>
AAA for the project name, BBBB for the module and CCCC for 
classifying the class into utility/shared/business related/etc.,

<sigh>
-Siplin




==========================================================================
TOPIC: internationalization versus localization
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2e142d0209c11f9a
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 8 2004 11:22 am
From: [EMAIL PROTECTED] (Matt) 

I am confused what's the differences between 
internationalization localization. Or they
are both referring Java API supports on building multi-lingual 
java applications??

Please advise. thanks!!



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

Matt wrote:

> I am confused what's the differences between 
> internationalization localization. Or they
> are both referring Java API supports on building multi-lingual 
> java applications??

According to http://java.sun.com/j2se/corejava/intl/index.jsp

"Internationalization is the process of designing software so that it can be 
adapted 
(localized) to various languages and regions easily, cost-effectively, and in 
particular 
without engineering changes to the software. Localization is performed by 
simply adding 
locale-specific components, such as translated text, data describing 
locale-specific 
behavior, fonts, and input methods."




==========================================================================
TOPIC: J2SE 5.0 or JDK 1.5?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f54e232a7bd42422
==========================================================================

== 1 of 4 ==
Date:   Mon,   Nov 8 2004 11:27 am
From: [EMAIL PROTECTED] (Matt) 

I want to know if J2SE 5.0 and JDK 1.5 are identical terms?
We can use either one interchangably.

Please advise. thanks!!



== 2 of 4 ==
Date:   Mon,   Nov 8 2004 11:36 am
From: Chris Smith <[EMAIL PROTECTED]> 

Matt wrote:
> I want to know if J2SE 5.0 and JDK 1.5 are identical terms?
> We can use either one interchangably.

Yes.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



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

On 8 Nov 2004 11:27:50 -0800, Matt wrote:

> I want to know if J2SE 5.0 ..

Thought up by the Sun marketing people basically, because they
thought they were running too far behind in the 'versioning' 
numbers used by their competitors.

>..and JDK 1.5 are identical terms?

No.  The '1.5' represents the next logical version number for Java.

> We can use either one interchangably.

I would use '1.5' when conversing with other developers.  
(  If you do not want to be seen as someone gullible enough 
to swallow the guff spun by Sun's marketing people.   ;-)

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



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

Matt wrote:

> I want to know if J2SE 5.0 and JDK 1.5 are identical terms?
> We can use either one interchangably.

Not quite. The version/marketing thing aside, J2SE 5.0 is the platform
specification, while the JDK is Sun's implementation of this specification,
and particularly the one that includes a development environment (as opposed
to the JRE(runtime)-only distribution).




==========================================================================
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 11:31 am
From: "Wayne Marrison" <[EMAIL PROTECTED]> 


"John C. Bollinger" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Wayne Marrison wrote:
>
>> 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.
>
> No detail there, but it sounds like a correct approach.  Do you really 
> need to spawn a new VM for this, though?  Perhaps there are reasons why 
> you do need to do (or at least, reasons why it's convenient), but in many 
> cases it would work as well or better to just start up a new thread in the 
> current VM for an "external" Java process.

If you can point me in the right direction for an example on how to do this, 
it would be appreciated.  I'm still very new to this, but have deadlines to 
attempt to meet.

>
>> 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
>
> _Which_ java.exe?  You have (at least) two.  Not that it makes much 
> difference.
>
>> never stops.  I have to use operating system tools to perform a manual 
>> kill
>> of the process.
>
> If the external process is unable to respond to requests then it may be in 
> a state where it is unable to respond to the OS' normal signals to shut 
> down, either.

Using O/S tools works fine to kill the remaining java.exe.

>
>> 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.
>
> You are inappropriately mixing scope / terminology.  From the OS' point of 
> view, the program running is java.exe.  Period.  That particular program 
> will typically be multithreaded, but the OS has no sense or specific 
> knowledge of the particular class files from which the VM is drawing code 
> to execute.  It may be in your case that some thread of that process is 
> refusing to die, but that would be an OS- and state- dependent property of 
> the Java program, with some dependency on the OS-dependent implementation 
> of Process.destroy().  It is outside the scope of the specification of 
> Process.destroy().
>
> My recommendation would be to fix the external program, if that is 
> possible, and to avoid using Process.destroy().  You may be able to simply 
> abandon a deadlocked external program, although that's not very clean.  A 
> cleaner approach might be to spawn the "external" program _inside_ the 
> host VM (in its own thread), probably with the use of an appropriate 
> ClassLoader so as to isolate the external program from the host.  Make the 
> external app's thread a daemon thread so that it will (in principle) not 
> prevent the host from shutting down (and shutting it down) if it locks up. 
> The one problem this cannot solve is that of forcing the external app to 
> relinquish resources it has locked, such as TCP ports.

I cannot fix the external application, and strongly suspect that its the way 
I am trying to control it and close it that is causing the problem.  The 
external app is a 3rd party app and as such is beyond my adjustment.
>
>
> John Bollinger
> [EMAIL PROTECTED]

Thanks for your help sofar.

Wayne






==========================================================================
TOPIC: Current J2EE AppServer vs previous version
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e7cbbdae1c12a1d1
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 8 2004 11:52 am
From: "Raydog" <[EMAIL PROTECTED]> 

hi all
I just downloaded the current J2EE AppServer and my project (EJB) used to
deploy on the prev AppServer now no longer deployable on the current server
due to compatibility issues, is there any way i can fix that easily without
repacking ?

Thanks so much





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

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