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

Today's topics:

* Rules Engines - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/99a72da1f622ccde
* can eclipse be configured to work with msjava projects? - 3 messages, 2 
authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1ea83c3a7250fe4
* multiple jar generation with eclipse? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/396001d421144eb8
* Attributes always empty when parsing XML documents - 5 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f93920023b216158
* How to write an efficient maximum function? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f759ff7cc130859e
* Java Thread Analysis - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c30c46b2c50ca5f
* Looking for a jar manager in java. - 2 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/21cca5a7232d050f
* Environment variable - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e10a85f420f52962
* stateless EJB - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9e6bf010caa6c078
* Problems with SAX parser in Java (SAX2 driver class 
javax.xml.parsers.SAXParser found but cannot be loaded) - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b50cc53cc8868e38
* program arguments - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/44d9b350ac879ea0
* Thread-question - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5766e179910e25fa
* J2ME Clie TJ37 - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bddd3f7bc08dbf92
* default constructor in Java versus C++ - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0018dff5a806578
* Java on Linux - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b359a0d20324fdbe
* use com port as parallel port - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/43f0abc240232d51
* JavaRanch? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/614f4214451b35cd
* Difference between JavaServerFaces and JavaServerPages+Swing ? - 1 messages, 
1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8aece321c50238bc
  
==========================================================================
TOPIC: Rules Engines
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/99a72da1f622ccde
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 16 2004 6:11 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 16 Nov 2004 05:09:36 -0800, Cindi Jenkins wrote:

> Any thoughts on this posting?
> http://blogs....

Nothing special, ..you?

-- 
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: can eclipse be configured to work with msjava projects?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1ea83c3a7250fe4
==========================================================================

== 1 of 3 ==
Date:   Tues,   Nov 16 2004 6:13 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Tue, 16 Nov 2004 12:30:16 +0100, Maciek Zywno wrote:

> Does it mean that eclipse cannot be used with MS java prjects?

Read my other post and stop wasting time futzing* with your IDE.

(* A vague term to express 'needlessly tweaking or adjusting the
parameters of system components to no good end effect')

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



== 2 of 3 ==
Date:   Tues,   Nov 16 2004 7:33 am
From: Maciek Zywno <[EMAIL PROTECTED]> 

Andrew Thompson wrote:
> Forget Eclipse for the moment.  It is not relevant to the question.

It is.

> If you can compile this project from the command line, you can 
> configure your IDE to work with, compile and jar the project.

Are you sure? If you know how to do it, why you don't help me with that?

> Now that I am sure you are speaking of the MSVM, it is important 
> to clarify if this Applet also works in other VM's.

what applet? :)



== 3 of 3 ==
Date:   Tues,   Nov 16 2004 9:07 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Tue, 16 Nov 2004 16:33:12 +0100, Maciek Zywno wrote:

> Andrew Thompson wrote:
>> Forget Eclipse for the moment.  It is not relevant to the question.
> 
> It is.
> 
>> If you can compile this project from the command line, you can 
>> configure your IDE to work with, compile and jar the project.
> 
> Are you sure? 

It depends on whether this code uses MS proprietary classes.

If it does, only an MS based IDE will be able to effectively 
deal with it.  If it does not, you can edit it using Notepad, 
Eclipse, NetBeans, TextPad, Emacs.., and compile it either
from the command line or (assuming you know how to configure
your own IDE) your IDE.

Does any of the source import classes starting with 

import com.ms...

?

>..If you know how to do it, why you don't help me with that?

Because you keep ..
a) Going on about NetBeans
n) Not answering my specific questions (in what is a very complex 
subject, you may notice if you check the FAQ[1] for MSVM/IE/Applet[2]).

[1] <http://www.physci.org/codes/javafaq.jsp>

>> Now that I am sure you are speaking of the MSVM, it is important 
>> to clarify if this Applet also works in other VM's.
> 
> what applet? :)

O..K, so you're saying this is a 1.1 application?
Either run from the command line/bat files with no GUI, 
or using a Frame?  

[2] It is unusual to get a 1.1 application, they are usually applets.

-- 
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: multiple jar generation with eclipse?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/396001d421144eb8
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 16 2004 6:18 am
From: "Yoann Poizeau" <[EMAIL PROTECTED]> 

Hello everybody,
I'm working with code warrior and i would like to change with eclipse.

I need for my project to generate multiple Jar at the same time but i 
haven't found the function in eclipse. I have find to generate 1 jar file 
but Is there a way to generate multiple jar by compiling multiple project?

Thanks,

Poizeau Yoann 






==========================================================================
TOPIC: Attributes always empty when parsing XML documents
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f93920023b216158
==========================================================================

== 1 of 5 ==
Date:   Tues,   Nov 16 2004 6:41 am
From: "Andy Carson" <[EMAIL PROTECTED]> 

I'm writing a small app that needs to parse XML-files. However, in the
method

final public void startElement( final String namespace, final String
localname, final String type, final org.xml.sax.Attributes attributes )
throws org.xml.sax.SAXException
    { (...) }

the attributes is always empty. Why is this?

The final public void characters( final char[] ch, final int start, final
int len ) seems to show correct behavior, i e the file seems to be parsed
"correctly".







== 2 of 5 ==
Date:   Tues,   Nov 16 2004 6:56 am
From: "William Brogden" <[EMAIL PROTECTED]> 

On Tue, 16 Nov 2004 15:41:36 +0100, Andy Carson <[EMAIL PROTECTED]> wrote:

> I'm writing a small app that needs to parse XML-files. However, in the
> method
>
> final public void startElement( final String namespace, final String
> localname, final String type, final org.xml.sax.Attributes attributes )
> throws org.xml.sax.SAXException
>     { (...) }
>
> the attributes is always empty. Why is this?

My guess is that your elements don't have any attributes.

Bill



== 3 of 5 ==
Date:   Tues,   Nov 16 2004 7:29 am
From: "Andy Carson" <[EMAIL PROTECTED]> 

> My guess is that your elements don't have any attributes.

I believe I have misunderstood the whole idea and the concepts behind the
concepts though I have googled a lot.

Say that I have the the XML-file below.

1) Are there any attributes in this file?
2) How do I retrieve the values in different PersonResultRecord effectively?

<PersonComposeResponse>
   <DeliveryId>881718</DeliveryId>
   <PersonResultSet>
      <PersonResultRecord>
         <ID>1043487240</ID>
         <FirstName>Irena</FirstName>
         <MiddleName></MiddleName>
         <LastName>Hansson</LastName>
      </PersonResultRecord>
      <PersonResultRecord>
         <ID>1043487240</ID>
         <FirstName>Irena</FirstName>
         <MiddleName></MiddleName>
         <LastName>Hansson</LastName>
      </PersonResultRecord>
   </PersonResultSet>
</PersonComposeResponse>





== 4 of 5 ==
Date:   Tues,   Nov 16 2004 8:29 am
From: TechBookReport <[EMAIL PROTECTED]> 

Andy Carson wrote:
>>My guess is that your elements don't have any attributes.
> 
> 
> I believe I have misunderstood the whole idea and the concepts behind the
> concepts though I have googled a lot.
> 
> Say that I have the the XML-file below.
> 
> 1) Are there any attributes in this file?
> 2) How do I retrieve the values in different PersonResultRecord effectively?
> 
> <PersonComposeResponse>
>    <DeliveryId>881718</DeliveryId>
>    <PersonResultSet>
>       <PersonResultRecord>
>          <ID>1043487240</ID>
>          <FirstName>Irena</FirstName>
>          <MiddleName></MiddleName>
>          <LastName>Hansson</LastName>
>       </PersonResultRecord>
>       <PersonResultRecord>
>          <ID>1043487240</ID>
>          <FirstName>Irena</FirstName>
>          <MiddleName></MiddleName>
>          <LastName>Hansson</LastName>
>       </PersonResultRecord>
>    </PersonResultSet>
> </PersonComposeResponse>
> 
> 
No attributes in there. An attribute (date) would look like this:

<PersonResultSet date="04/11/16">


Pan

===============================================
TechBookReport http://www.techbookreport.com



== 5 of 5 ==
Date:   Tues,   Nov 16 2004 9:13 am
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> 

With a SAX parser you have to accumulate the element's content
presented in the characters(...) callback.

Something like:

public static class MyParser
extends org.xml.sax.helpers.DefaultHandler {

private StringBuffer sbCharBuffer_ ;

public void characters(char [] ach, int nStart, int nLength) {
if(null==sbCharBuffer_) {
StringBuffer sbTemp = new StringBuffer(nLength + 1) ;
sbTemp.append(ach, nStart, nLength) ;
System.out.println("MyParser: ignoring " + nLength + " characters
(" + sbTemp.toString() + ")") ;
}
else {
sbCharBuffer_.append(ach, nStart, nLength) ;
}
}

public void startElement(String sURI, String sLocalName, String
sQName, org.xml.sax.Attributes attrs) {
System.out.println("startElement('" + sQName + "')") ;
sbCharBuffer_ = new StringBuffer(500) ;
}

public void endElement(String sURI, String sLocalName, String sQName)
{
System.out.println("endElement('" + sQName + "'): content was '" +
sbCharBuffer_ + "'") ;
  }
}





==========================================================================
TOPIC: How to write an efficient maximum function?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f759ff7cc130859e
==========================================================================

== 1 of 2 ==
Date:   Tues,   Nov 16 2004 6:46 am
From: Ahmed Moustafa <[EMAIL PROTECTED]> 

>> Is there something like C's macros to keep the code clean but to save 
>> the processing time for calling the macro?
> 
> 
> Er, use *inline* ?

That's how it was originally written, but changed to a method for the 
sake of readability.



== 2 of 2 ==
Date:   Tues,   Nov 16 2004 9:28 am
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Boudewijn Dijkstra coughed up:
> "Ahmed Moustafa" <[EMAIL PROTECTED]> schreef in bericht
> news:[EMAIL PROTECTED]
>> Hello,
>>
>> What would be the most efficient to write a maximum function in Java?
>>
>> Initially, I had the comparisons that looked for the maximum inside
>> the main method and then moved it inside its own method (code is
>> below) to be called from within the main method (to make the code
>> look prettier), but that cost me almost 3 additional seconds
>> processing time:
>>
>> <code>
>> private static float maximum (float a, float b, float c, float d) {
>> float t1 = a > b ? a : b;
>> float t2 = c > d ? c : d;
>> return t1 > t2 ? t1 : t2;
>> }
>> </code>
>
> That method always runs in the same amount of VM ticks.  It takes:
> - 3 comparisons;
> - 3 copies; and
> - 3 jumps.
>
> How about:
>
> private static float maximum(float a, float b, float c, float d)
> {
>   float max = a;
>   if (b > max) max = b;
>   if (c > max) max = c;
>   if (d > max) max = d;
>   return max;
> }
>
> which takes:
> - 1..4 copies;
> - 3 comparisons; and
> - 3 jumps.
>
> The average number of copies is calculated as follows:
> if a is maximum: 1 copy
> if b is maximum: 2 copies
> if c is maximum: 3 copies
> if d is maximum: 4 copies
> average copies = (1 + 2 + 3 + 4) / 4 = 10 / 4 = 2.5
>
> Note that 2.5 < 3
>
> You can even theoretically reduce that 2.5 to 1.5 by removing the
> first line and replacing 'max' by 'a', but that should probably be up
> to the optimizer.


Interesting!

What about this I wonder:

        private static float maximum(float a, float b, float c, float d)
        {
            if ((a >= b) && (a >=c) && (a >= d)) return a;
            if ((b >= a) && (b >=c) && (b >= d)) return b;
            if ((c >= a) && (c >=b) && (c >= d)) return c;
            if ((d >= a) && (d >=b) && (d >= c)) return d;
            assert(false);     // clinical paranoia.
        }

Note that >= is required and not >, because of the possibility of one or
more of them being equal.

-- 
Iamamanofconstantsorrow,I'veseentroubleallmydays.Ibidfarewelltoold
Kentucky,TheplacewhereIwasbornandraised.ForsixlongyearsI'vebeenin
trouble,NopleasureshereonearthIfound.ForinthisworldI'mboundtoramble,
Ihavenofriendstohelpmenow....MaybeyourfriendsthinkI'mjustastrangerMyface,
you'llneverseenomore.ButthereisonepromisethatisgivenI'llmeetyouonGod's
goldenshore.






==========================================================================
TOPIC: Java Thread Analysis
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c30c46b2c50ca5f
==========================================================================

== 1 of 2 ==
Date:   Tues,   Nov 16 2004 6:51 am
From: "William Brogden" <[EMAIL PROTECTED]> 

On 15 Nov 2004 13:12:15 -0800, Carl <[EMAIL PROTECTED]> wrote:

> Does anyone know of a tool that can be used to track a thread's
> lineage.  We currently have the situation where several thousand
> threads will be running in our system.  We believe that some piece of
> our code is causing too many threads to spawn.  We have been able to
> dump all of the threads and their names but sometimes it isn't useful
> due to poor names and/or the threads being third party (such as a
> CORBA thread.)  We would like a tool that can tell us which class
> started how many of each type of thread so that we may determine what
> we can do (if anything) to prevent a "thread leak."
>
> Thank you

Why not use ThreadGroups to provide a level of organization?

Bill




== 2 of 2 ==
Date:   Tues,   Nov 16 2004 9:42 am
From: Chris Smith <[EMAIL PROTECTED]> 

William Brogden wrote:
> Why not use ThreadGroups to provide a level of organization?
> 

This doesn't really solve much.  The OP's problem was that threads were 
being created by third parties.  If the OP had access to every thread as 
it was created, then obviously each one could be given a descriptive 
name, and the problem could be solved.

Aside from that, in general thread groups are considered poor form in 
new code.  They are an experiment that failed, and even Sun 
documentation recommends against using them any longer.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: Looking for a jar manager in java.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/21cca5a7232d050f
==========================================================================

== 1 of 2 ==
Date:   Tues,   Nov 16 2004 7:33 am
From: <@> 

Thankx to all.

Anyway what I need is a package to be included in a wider project. So
graphic interfaces aren't needed or wanted. And yes... I think a zip would
be good too.




----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 
Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---



== 2 of 2 ==
Date:   Tues,   Nov 16 2004 7:52 am
From: Thomas Kellerer <[EMAIL PROTECTED]> 

On 16.11.2004 16:33 @ wrote:

> Thankx to all.
> 
> Anyway what I need is a package to be included in a wider project. So
> graphic interfaces aren't needed or wanted. And yes... I think a zip would
> be good too.

Ant has a jar "utility" built in as well.

Thomas




==========================================================================
TOPIC: Environment variable
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e10a85f420f52962
==========================================================================

== 1 of 2 ==
Date:   Tues,   Nov 16 2004 7:52 am
From: "Stefan Poehn" <[EMAIL PROTECTED]> 

"Thomas S." <[EMAIL PROTECTED]> schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
> Stefan Poehn wrote:
>> is it possible to get an enviroment variable, e.g. $PATH, in a java
>> application in windows?
>
> java.lang.System.getProperty() should do it.
>

No. You can retrieve the environment _for the jvm_, not for the system, like 
$PATH. System.getProperty("$PATH"); 
System.getProperty("%PATH%");System.getProperty("PATH"); all return null.

> Thomas 





== 2 of 2 ==
Date:   Tues,   Nov 16 2004 9:30 am
From: Thomas Weidenfeller <[EMAIL PROTECTED]> 

Stefan Poehn wrote:
> No. You can retrieve the environment _for the jvm_, not for the system, like 
> $PATH. System.getProperty("$PATH"); 
> System.getProperty("%PATH%");System.getProperty("PATH"); all return null.

System.getenv()

Was AFAIR deprecated in some Java versions, but has been "un-deprecated" 
for some time.

/Thomas




==========================================================================
TOPIC: stateless EJB
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9e6bf010caa6c078
==========================================================================

== 1 of 2 ==
Date:   Tues,   Nov 16 2004 7:57 am
From: [EMAIL PROTECTED] (mank) 

What is better - 
a stateless EJB with 4 methods or 4 separate stateless EJBs ? 
Is there an overhead of creating more EJBs? How to make this decision?



== 2 of 2 ==
Date:   Tues,   Nov 16 2004 8:02 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

mank wrote:
> What is better - 
> a stateless EJB with 4 methods or 4 separate stateless EJBs ?
> Is there an overhead of creating more EJBs? How to make this decision?

Of course there is an overhead, but it's almost certainly insignificant.
The methods should simply be grouped logically. Closely related methods
should be put together.




==========================================================================
TOPIC: Problems with SAX parser in Java (SAX2 driver class 
javax.xml.parsers.SAXParser found but cannot be loaded)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b50cc53cc8868e38
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 16 2004 8:02 am
From: [EMAIL PROTECTED] (Per Magnus L?vold) 

Hi!
I am new to XML parsing, and I'm trying to parse an XML file which is
passed as a BufferedReader object.
I have followed the steps described in a Javaworld article
(http://www.javaworld.com/javaworld/jw-08-2000/jw-0804-sax.html) which
seems quite simple. I've also downloaded the latest Web Services
Developer Pack, installed it, and added the jar-file to the classpath
in JDeveloper.

After programming the parser class, I get an error message which I
can't figure out of:
"Unexpected error: SAX2 driver class javax.xml.parsers.SAXParser found
but cannot be loaded"

Why can't it be loaded? Any ideas?

Here is a sample of my code:

/* 
* this is the class that calls the XML parser (myXMLParser) 
* I beleive the error must lie here somewhere, or perhaps in the
configuration?
*/
myXMLParser test = new myXMLParser();
String parserclass =
System.getProperty("org.xml.sax.driver","javax.xml.parsers.SAXParser");
/*
* I beleive the error comes on this next line. 'parserclass' is
* identified as "javax.xml.parsers.SAXParser", which is found but
cannot
* be loaded? What could be wrong? It is added to the classpath.
*/
XMLReader xr = XMLReaderFactory.createXMLReader(parserclass);
xr.setContentHandler(test);
// 'br' (below) is the BufferedReader object of an XML file
xr.parse(new InputSource(br)); 

Regards, PML




==========================================================================
TOPIC: program arguments
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/44d9b350ac879ea0
==========================================================================

== 1 of 2 ==
Date:   Tues,   Nov 16 2004 8:37 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

Jeff Kish wrote:

> Hi.
> 
> It seems to be occuring at the command line outside of eclipse also, so... 
> Could 
> someone explain the unrolling/expansion under Windows XP of the commandline
> wildcard parameter? I can try under an OS group if that would be better.

Have you considered "help cmd"?  Or the "echo *.*" example I offered?  I 
should have qualified my earlier response by saying that I tested it on 
Windows 2000, not Windows XP.  Even so, if your program is getting 
expanded arguments, that does not necessarily mean that it's the shell 
doing the expansion, or that arguments will be expanded in some other 
invocation context than the command line context you tested.

If you want details then you probably should Google for them, search the 
MS knowledge base, or possibly ask on a more Windows-centric group.  It 
is my general Windows experience, however, not restricted to Java and 
across more than one IDE, that command line arguments fed to integrated 
debuggers are not expanded.


John Bollinger
[EMAIL PROTECTED]



== 2 of 2 ==
Date:   Tues,   Nov 16 2004 9:26 am
From: Thomas Weidenfeller <[EMAIL PROTECTED]> 

Jeff Kish wrote:
> mmm I have a feeling you are a unix sort of user, so you have a more mature 
> OS/environment that I
> do.

I use Solaris. I bet my newsgroup headers give it away.

> Now I need to figure out a way to expand programmatically the 
> file-spec-wildcard passed in as a
> parameter.

Google for "file globbing" or "wildcard" source code (almost any 
programming language should do, the code should be easily portable to Java).

/Thomas




==========================================================================
TOPIC: Thread-question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5766e179910e25fa
==========================================================================

== 1 of 2 ==
Date:   Tues,   Nov 16 2004 8:54 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

Chris Uppal wrote:
> One thing that this discussion has brought into focus for me, which I hadn't
> noticed before, is that not allowing the programmer to manipulate the "must
> finalise" flag (posited in an early post) is a fairly big design error in 
> Java.
> For one thing, as everyone knows, finalisation only ever happens once -- which
> is a very strange situation for an object that is allowed to "resurect" itself
> in its finaliser.  But the more serious problem is that there is no way for us
> to tell the JVM that finalisation will /not/ be needed for a given object.  
> For
> instance when we clean up explicitly in a cleanUp() method, then we should be
> able to say something like:
>     this.beNotFinalizable()
> to clear the (hypothetical) "must finalise" flag and allow the object to die
> normally without the various overheads (including keeping object networks
> alive) of finalization.
> 
> Actually, I'd prefer to have beFinalizable() and beNotFinalizable() as
> (probably protected) methods of Object, and for "finalisability" to be off for
> all objects, by default, regardless of whether they defined a finalize()
> method.  I.e. it should be the programmer's responsibility to manipulate
> finalisability as necessary, not left up to an ill-defined system
> "optimisation".

I think I have to disagree with you on this one, Chris.  The programmer 
can already control this dimension to a limited extent by deciding 
whether or not to override Object.finalize().  To be sure, that's a 
per-class decision, not a per-object one, but I think that's where the 
decision belongs.  It is also a design-time decision, not a runtime one, 
but I'm okay with that.  I would rather put the onus on the designer to 
adequately consider this issue than leave the developer to hack it out 
as he sees fit (even if the same person operates in both roles).  I am 
particularly not keen on the increased uncertainty about whether a 
finalizer might run, and about how many times it might run.

Do you have a concrete-ish example of how your version of finalization 
management would be an improvement over what Java already offers?  I 
appreciate the general desire to have more control, but I don't really 
see what it would gain you in this case.


John Bollinger
[EMAIL PROTECTED]



== 2 of 2 ==
Date:   Tues,   Nov 16 2004 9:50 am
From: Carl Howells <[EMAIL PROTECTED]> 

Chris Uppal wrote:

> BTW, don't forget that /not/ relying on finalisation can have costs too.  
> More,
> and more complicated, code.  More opportunity for error.  Even, potentially
> larger object networks -- e.g. if an object that may need cleanup cannot just
> be handed-over to another context and forgotten, then the recieving context 
> may
> have to keep a link back to the supplier so that it can "hand back" the object
> when it has finished with it.

Cleanup of non-memory resources can be done with a PhantomReference and 
ReferenceQueue combination, with much simpler semantics than those of 
finalization.  After all, there's no chance of object resurrection with 
that system, meaning that the cleanup *will* only be done once.

It is slightly more difficult to implement than just overriding a 
finalize method, admittedly...  But I think it's also conceptually more 
elegant.

Oh, and while I'm replying to you, I suspect your interpretation of my 
test results earlier in this thread was accurate..  Objects which need 
to be finalized just have to stick around for an extra GC cycle, 
delaying their collection somewhat, but no real bias exists.




==========================================================================
TOPIC: J2ME Clie TJ37
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bddd3f7bc08dbf92
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 16 2004 9:03 am
From: [EMAIL PROTECTED] (pepperMonkey) 

Thanks for the reply. :)
I'll have to try it out and see what happens. As mentioned I won't be
able to get my hands on IBM's Websphere Micro Edition and consequently
JARTOPRC from it. Does anyone know if you can get JARTOPRC outside of
the websphere product?
Thanks,
Hubert

"Rhino" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> "pepperMonkey" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi,
> > this is my first foray into the J2ME world so please be patient.
> > I own a Clie TJ37 (Palm OS 5.2) and was wondering what J2ME
> > implementations were available?
> > I know of only MIDP4Palm which seems fairly old (Palm OS 3.5+). Is
> > there any newer implementations? There is the Websphere Micro Edition
> > but that seems to only support Palm Pilots and not Clies.
> > Any help would be greatly appreciated.
> 
> I'm nearly as new to J2ME as you are - less than 2 weeks - but I'm using
> MIDP-2.0 which works nicely on my Palm Tungsten E which is running PalmOS
> 5.2.1. I don't know for certain if it will run on Clies but I think it
> should since, as I understand it, the OS is what's important, not the fact
> that the device is Palm or Sony.
> 
> My main development tools for J2ME are:
> - the Sun WTK (Wireless Toolkit) 2.2 (Beta 2) which I got from the Sun site
> - the EclipseME plugin 0.60 which I got from SourceForge (I'm also running
> Eclipse 3.0.1 as the framework in which I use the plugin ;-)
> - the JARTOPRC utility which converts the Jar file produced by EclipseME and
> the WTK to a PRC file so that I can install it on my Palm. (I don't have a
> cell or Bluetooth so I don't have any way to install apps except via Hotsync
> so I need to convert my jars to prc files.) This utility was obtained from
> the Websphere toolkit that I got at Palm if I'm remembering correctly.
> 
> These tools are working together well for me, except for one problem and I
> would recommend them to anyone who is trying to develop Java code for
> handheld devices.
> 
> [The problem I'm having is that I can't make the JARTOPRC utility generate
> my PRC file from the JAD and JAR files used in EclipseME; I get errors that
> I can't resolve and the the EclipseME developer can't resolve either. But
> I've got a satisfactory workaround: I just build the project again using WTK
> and then generate the package from the build result; JARTOPRC works fine
> then and I can install my application.]
> 
> I hope some of this helps ;-)
> 
> Rhino




==========================================================================
TOPIC: default constructor in Java versus C++
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0018dff5a806578
==========================================================================

== 1 of 2 ==
Date:   Tues,   Nov 16 2004 9:13 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

Gary Labowitz wrote:
> The JLS says: If a class contains no constructor declarations, then a
> default constructor that takes no parameters is automatically provided:
> 
> which is true. But if a class contains constructor declarations, you may
> supply a default constructor that takes no parameters. I believe the use of
> the word "default" means a constructor that takes no parameters, whether it
> is explicit or implicit.

Specifically, the first part of JLS(2e) 8.8.7 says:
If a class contains no constructor declarations, then a _default 
constructor_ that takes no parameters is automatically provided:

     * If the class being declared is the primordial class Object, then 
the default constructor has an empty body.
     * Otherwise, the default constructor takes no parameters and simply 
invokes the superclass constructor with no arguments.

A compile-time error occurs if a default constructor is provided by the 
compiler but the superclass does not have an accessible constructor that 
takes no arguments.

A default constructor has no throws clause.

It follows that is the nullary constructor of the superclass has a 
throws clause, then a compile-time error will occur.

--- end quote ---

Emphasis on the first occurrence of "default constructor" is from the 
source -- i.e. the quote is a *definition* of the term.  A default 
constructor is thus defined to be one provided automatically by Java for 
some class, which happens when no other constructor is provided.  It has 
the properties of taking no arguments, throwing no checked exceptions, 
and, except for the constructor for java.lang.Object, doing nothing but 
invoking the superclass' no-argument constructor.  (And note that the 
superclass' constructor is not referred to as a "default constructor".) 
  Note also in the last sentence quoted, the use of the term "nullary 
constructor" to refer to a constructor that takes no arguments.

It is true that some Java programmers rather loosely refer to any 
nullary constructor as a default constructor, but this usage is 
technically inaccurate, and no one who employs it should be shocked or 
offended at being corrected.  This is especially true in the context of 
discussion occurring in some part in a Java-oriented technical forum 
such as comp.lang.java.programmer.


John Bollinger
[EMAIL PROTECTED]



== 2 of 2 ==
Date:   Tues,   Nov 16 2004 9:38 am
From: Chris Smith <[EMAIL PROTECTED]> 

Gary Labowitz wrote:
> The JLS says: If a class contains no constructor declarations, then a
> default constructor that takes no parameters is automatically provided:
> 
> which is true. But if a class contains constructor declarations, you may
> supply a default constructor that takes no parameters. I believe the use of
> the word "default" means a constructor that takes no parameters, whether it
> is explicit or implicit.

A couple others have pointed to the language specification's definition 
of default constructor, and I don't see any way of reconciling your 
interpretation to the document.  This is clearly a definition.  The word 
"default constructor" is italicized in the text, and is contained in a 
section entitled "Default Constructor".  It contains obviously normative 
statements about the default constructor.  The text even contains the 
phrase "a default constructor that takes no arguments", which would be 
somewhat clumsy if the definition of a default constructor were simply 
that it takes no arguments.

The JLS uses the phrase "nullary constructor" as others have said, but I 
find that relatively few developers are familiar with that term and it 
causes confusion, so I prefer to say "no-argument constructor".

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: Java on Linux
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b359a0d20324fdbe
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 16 2004 9:19 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

Michael Borgwardt wrote:

> John C. Bollinger wrote:
>> You are thinking of the classpath.  It works under Linux just the same 
>> as under windows: you specify the CLASSPATH environment variable and / 
>> or specify the path on the java or javac command line via the 
>> appropriate switch.  It has not for a long time been necessary to put 
>> the standard class libraries in your classpath, however -- only user 
>> classes.
> 
> 
> Actually, it has been for a long time considered best practice to leave
> the CLASSPATH environment variable empty and specify the classpath
> on the command line.

You are quite right, but I said nothing to the contrary.  I'm sure in 
any case that the OP appreciates your effort to guide her more 
specifically toward the currently accepted best practices.


John Bollinger
[EMAIL PROTECTED]




==========================================================================
TOPIC: use com port as parallel port
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/43f0abc240232d51
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 16 2004 9:44 am
From: [EMAIL PROTECTED] (b3ny) 

> I think you have the wrong end of the stick here.

i knew thus... but the serial port has more than one in/output channels...
RxD and TxD are the two data channels, but whats up with the status bits??
DCD DSR RTS CTS and DTR can't i use them as normal in/outputs???

beny




==========================================================================
TOPIC: JavaRanch?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/614f4214451b35cd
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 16 2004 9:50 am
From: Chris Smith <[EMAIL PROTECTED]> 

Rhino wrote:
> Am I the only one having trouble posting to the newsgroups in the JavaRanch
> "Saloon"?

AFAIK, JavaRanch doesn't have newsgroups.  They have a web forum for any 
of a bunch of topics, but if they now make those fora accessible via 
NNTP, that's news to me.

You may find that many people who read Java newsgroups (including me) 
have a very poor opinion of JavaRanch.  This is mainly because as they 
were getting started, advocates of JavaRanch would frequently post 
insulting and rude messages to newsgroups.  These messages generally 
took the form of "you won't get an answer here, but go ask at 
JavaRanch".

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: Difference between JavaServerFaces and JavaServerPages+Swing ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8aece321c50238bc
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 16 2004 9:55 am
From: Chris Smith <[EMAIL PROTECTED]> 

Greg Smith wrote:
> swing is an applet. jsf is native html.
> 

Not exactly.  The standard components provided for JSF render in native 
HTML.  JSF, though, is a framework that allows for maintaining state and 
listening for events in pretty much any HTTP servlet-based 
request/response environment.  I could very easily write a JSF component 
that is a Swing applet, assuming the presence of LiveConnect to 
communicate the results back to hidden form fields in the HTML page.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



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

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