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

Today's topics:

* java.util.logging, where to put logging.properties? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/764502fa3c82bce
* Detection other side of socket closed - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c7b8065953ab7e31
* excuse me,why i cannot read the complete HTML file...thank you - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f545235913c50e05
* How to setup a Directory Structure - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14207bd8aa4d8a79
* Need J2EE documentation - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57623df49e1132b8
* BufferOverflow exception on SocketChannel.read() - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d6f1b5b1f73b757
* What is Embedded Java? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bacf063e98ecf899
* Testing to which extent method calls affect processig speed - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/420f78baefc47a0
* Beginner Package Help Please - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edd6e8d4661e5b82
* regex - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c9a4b9523a66e2d
* Problems passing an array to an inner class - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/96d202ac6e817c77
* ImageroReader 1.50 - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/faa2e5cf9950e486
* i18n'ed Character Set in DBMS and tables - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e379b42b2be85e8e
* abstract interfaces - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3c9900fa9970d77f
* Java and good OO practices question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5af9b2617cafb4f
* TreeCellRenderer does not work? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74265422bb68a88d
* Strings are interned per JVM or per class ? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/95bd017971b5326b
* JBoss and log4j - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/17ca69b550a778e0
* Passing Large Size Data over Network - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3be58fc6ae618b13
* Overiding protected methods - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efccff5e5289e8d2
* Strange problem with JDOM, Xerces and XML Schemas - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f772ecb11366c88c
* opaque - Bedeutung ? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/34ebf17b0b59b7d8
* Retrieving Stored Procedure Returns - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f242177026be66a
  
==========================================================================
TOPIC: java.util.logging, where to put logging.properties?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/764502fa3c82bce
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 3:18 am
From: [EMAIL PROTECTED] (janne) 

I am doing some coding using java.util.logging, and can't seem to
figure out where to put logging.properties so that it could be found.
Actually I can get the properties working if I include the whole path
to the file in the -D initialization parameter, as in:

C:\Java\eclipse\workspace\projX\bin>java
-Djava.util.logging.config.file=C:\Java\eclipse\workspace\projX\bin\logging.properties
com.jannem.test.BasicTest

also, if I use a relative path to logging.properties from my current
directory, that works as well. But that's all a bit clumsy, I was
expecting that I could put logging.properties in my CLASSPATH
somewhere, and command

C:\Java\eclipse\workspace\projX\bin>java
-Djava.util.logging.config.file=logging.properties
com.jannem.test.BasicTest

would be able to find it. But it does not seem to be. I do not want to
modify the JRE-wide settings, I want to include a specific
configuration file for this application.

One attempt I tried was to put the whole thing to JAR, but I had no
luck with that either:

C:\Java\eclipse\workspace\projX>unzip -l test.jar
Archive:  test.jar
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  10-09-04 12:32   META-INF/
      106  10-09-04 12:32   META-INF/MANIFEST.MF
        0  10-09-04 11:49   com/
        0  10-09-04 11:49   com/jannem/
        0  10-09-04 11:49   com/jannem/test/
     1425  10-09-04 12:06   com/jannem/test/BasicTest.class
     2344  10-09-04 12:23   logging.properties
 --------                   -------
     3875                   7 files

C:\Java\eclipse\workspace\projX>java -cp test.jar
-Djava.util.logging.config.file=logging.properties
com.jannem.test.BasicTest

<...no log messages>

And ues, commons logging / Log4J would probably be less of a headache,
but that's not an option right now....




==========================================================================
TOPIC: Detection other side of socket closed
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c7b8065953ab7e31
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 3:21 am
From: "Vincent Cantin" <[EMAIL PROTECTED]> 

> > Hi,
> >
> > Here is my problem :
> >
> > I am developing a client/server application. I have my server which only
> > have 1 thread to process the requests of all the clients. I need that
none
> > of the read it makes from the input streams of the socket to be
blocking, so
> > I am reading the bytes available in the input stream before I do my
reads so
> > I am never in a blocking state.
> >
> > Now, my problem is that I don't know how to detect when a client close
his
> > socket. I saw on the net that usually the programmers are reading the
input
> > stream or writing the output stream in order to receive an IOException,
but
> > when the client close his socket, the available number of byte in the
input
> > stream of the server doesn't change, and I don't know how to make the
> > detection.
>
> You should probably look into Java NIO
> [http://java.sun.com/j2se/1.4.2/docs/guide/nio/]
>
> >
> > Do you see the paradox ? I need to call a blocking function if I want to
to
> > detect the close of the socket, but in my server I cannot afford to call
a
> > blocking function.
> >
> > If someone have a magical way to detect in a non-blocking way when a
client
> > close normally his socket, then I will really be happy to heard it.
>
> Here is an example on how to detect a remote socket close when using
> Java NIO [http://javaalmanac.com/egs/java.nio/DetectClosed.html]
>
> --
> Rune Fauske

Thank for all of you for the usefull information.
My server will be a success with them.
Java rulez :-)






==========================================================================
TOPIC: excuse me,why i cannot read the complete HTML file...thank you
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f545235913c50e05
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 3:23 am
From: "Vincent Cantin" <[EMAIL PROTECTED]> 

> The cause is that available() call only returns the number of bytes you
can
> read before blocking. It does not mean that's the end of the data... it is
> possible that not all the data have arrived when you call read().
>
> Use a while loop, and read until you get a -1 (which indicates end of
> stream).

Precision : available() will never return -1.
The minimum it usually returns is 0.






==========================================================================
TOPIC: How to setup a Directory Structure
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14207bd8aa4d8a79
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 3:34 am
From: [EMAIL PROTECTED] (Yakov) 

Regular Java applets can not access hard disk of the clients.
Read about trusted applets first.




==========================================================================
TOPIC: Need J2EE documentation
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57623df49e1132b8
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 3:36 am
From: [EMAIL PROTECTED] (Yakov) 

Start with the online J2EE Tutorial:
http://java.sun.com/j2ee/learning/tutorial/




==========================================================================
TOPIC: BufferOverflow exception on SocketChannel.read()
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d6f1b5b1f73b757
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 4:15 am
From: "Vincent Cantin" <[EMAIL PROTECTED]> 

> Folks,
>
> I have a situation that I can't explain and maybe it is due to some
> lack of understanding of NIO.  I have allocated a non-direct
> ByteBuffer and passed it as an argument to SocketChannel.read().  The
> channel is blocking.  I am (intermittantly) getting a
> java.nio.BufferOverflowException and I don't understand how that is
> possible.  The partial stacktrace below shows where it occurs.
>
> at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:190)
> at sun.nio.ch.IOUtil.read(IOUtil.java:209)
> at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:207)
>
> I have access to the HeapByteBuffer.java file and can see that the
> exception appears to be thrown because something in the sun.nio.ch
> package is copying data from what appears to be an internal ByteBuffer
> into what I'm assuming is my ByteBuffer.  Since the internal
> ByteBuffer has more data than my ByteBuffer can hold, the exception
> gets thrown.
>
> I don't have access to the sun.nio.ch source files, so I can't look at
> them to see what is happening.
>
> What I don't understand is why this is possible.  I thought that if I
> passed a ByteBuffer to SocketChannel.read(), it would only read as
> much data into the ByteBuffer as the ByteBuffer could hold.  Why is
> this exception thrown?  Is my understanding incorrect?
>
> Thanks to anyone who can help me make sense of this.
>
> ATC

I don't know exactly what is the problem, but ..
Do you remember to set the reading position of the buffer to the beginning
each time you read something ?






==========================================================================
TOPIC: What is Embedded Java?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bacf063e98ecf899
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 10 2004 4:54 am
From: Jacob <[EMAIL PROTECTED]> 

I've got some friendly advices from the Java Developer
Forum; In conclusion:

o A better term than "embedded" is "wireless". It will improve
   search results on the matter and seem to be the official term.

o The development is done towards the Java J2ME edition.
   It can be downloaded from
   http://java.sun.com/products/j2mewtoolkit/download-2_1.html

o Java classes are created as normal but put in a designated
   directory and compiled using the "ktoolkit" of J2ME.
   The "ktoolkit" itself utilizes J2SE which must be available.
   Java code will typically import javax.microedition.* stuff and
   classes will extend class "MIDlet".
   A tutorial is available at
   http://developers.sun.com/techtopics/mobility/midp/articles/wtoolkit/

o Applications ("MIDlets") are tested in a Nokia-lool-alike
   emulator inside of "ktoolkit". When complete, the toolkit
   is used to create a .jar and a .jad file.

o Deploying application to the actual device is described here:
   http://developers.sun.com/techtopics/mobility/midp/articles/deploy/

Thanks for all input.




== 2 of 2 ==
Date:   Fri,   Sep 10 2004 5:03 am
From: "Adam" <[EMAIL PROTECTED]> 

If you want to prepare a decent study/research, you shouldn't
just focus on the J2ME platform. Indeed it is the most popular,
but not the only technology used.

Adam






==========================================================================
TOPIC: Testing to which extent method calls affect processig speed
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/420f78baefc47a0
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 10 2004 5:24 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Albretch wrote:
>  Actually it is not exactly a hungarian notation. I learned coding
> simulating experiments in FORTRAN and then C (my first/true love) and
> I haven't been able to rid certain habits from that time. IT MAKES
> THINGS SO F EASIER WHEN YOU ARE DEBUGGING/MENTALLY MAPPING A NUMBER OF
> LONG PIECES OF CODE!!! It just reads like prose

To me, it's just unintelligible gibberish.

>  For variables: 
>  i2DAr:= two dimensional integer array
>  a2DAr:= two dimensional array of Strings
> 
>  when I generate classes on the fly:
>  3a2id:= class with 3 Strings 2 integers and 1 double
>  _ab2c:= class with and array of Strings a boolean and two characters

Even if you have internalized this and the usual problems of hungarian
notation aside: It's completely worthless for understanding what the
code DOES!

Technical details like these aren't what variable or class names must convey,
they're already present in the declarations. Lack of this information is NOT
what makes code difficult to understand.

To be useful at all, names must, absolutely MUST, convey information about
the *function* of the variable or class. Everything else is obfuscation.

You have posted a good example of horribly obfuscated, nearly impossible to
understand code. Duplicating the type information in the names does not help
in understanding it at all. What it needs are "talking" names like
StructData, GetSetData ConstructorGetData instead of JK00, JK02, JK04
and classNames,  averageTimes, timeDeviation instead of aSArKNms, d2DAr



== 2 of 2 ==
Date:   Fri,   Sep 10 2004 5:56 am
From: [EMAIL PROTECTED] (Albretch) 

"P.Hill" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
. . .
> Make a non-automated version with helpful names next time.
> 
> later,
> -Paul

 The code I posted I quickly scratched manually. 

 1._ What would you consider 'helpful names'? Isn't documentation
enough?
 Please, could you send to me -good- links about the 'cultural/social
aspects' of code?

 To me, anyone that comes with a history of C-like 'itoa' routines
would easily understand my code.  But I think you are very close to
convince me I should change my habits at once if I plan to post
libraries for the general public out there.

 2._ Is there such thing as a Java code beautifier?

 3._ I have taken the time to read source code libraries and they are
nicely javadoc'ed, but sometimes I find things I wouldn't consider so
clearly coded. I have heard the Linux Kernel source code is
excellently documented, but I would like to read some real Java code
out there that has been well documented.

 See you
 AM




==========================================================================
TOPIC: Beginner Package Help Please
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edd6e8d4661e5b82
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 10 2004 5:26 am
From: [EMAIL PROTECTED] (Kevin Murray) 

Sudsy <[EMAIL PROTECTED]> wrote in message n
> I cut and pasted your code and, apart from the "import static" statement
> [perhaps new to 1.5?], it all works as expected. You might be running
> into problems with old .class files in your classpath. This is not at
> all uncommon.

Yes, I am running 1.5. As for the class path, I use the -cp option
when executing javac and the path I use with that option is . (the
current directory). I am not using any IDE, just compiling and running
from the command line. I am doing this in the Linux environment,
though I doubt that would be any issue, then again being new to java I
wouldn't know at this point and time.



== 2 of 2 ==
Date:   Fri,   Sep 10 2004 5:50 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 10 Sep 2004 05:26:12 -0700, Kevin Murray wrote:

> Sudsy <[EMAIL PROTECTED]> wrote in message n
>> I cut and pasted your code and, apart from the "import static" statement
>> [perhaps new to 1.5?], it all works as expected. You might be running
>> into problems with old .class files in your classpath. This is not at
>> all uncommon.

To check what Sudsy mentioned, simply delete
all the class files and recompile them.

> Yes, I am running 1.5. As for the class path, I use the -cp option
> when executing javac..

Are you 'compiling using javac' or 
'executing using java/javaw'?

<http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javac.html#options>
Note that javac has no -cp option,
it has the -classpath option.

And to close, I feel you might get 
good value from a different group 
at the moment, described here...
<http://www.physci.org/codes/javafaq.jsp#cljh>

HTH

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology




==========================================================================
TOPIC: regex
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c9a4b9523a66e2d
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 5:52 am
From: Mark Wright <[EMAIL PROTECTED]> 

One joyful day (Thu, 09 Sep 2004 19:55:21 GMT to be precise), Alan Moore
<[EMAIL PROTECTED]> decided that the Usenet community would
benefit from this remarkable comment:

>>Three double-quotes in a row is easily accommodated by:
>>
>>   \".+\"
>>
>>Placing this at the start of the regexp group will allow it to contain
>>any number of " characters since the final one will be used (and
>>necessary) to complete the pattern match. Regular expressions are, by
>>default, greedy but exhaustive. That is, they will eat as much as they
>>can whilst allowing the patten to match.
>
>If the input contains more than one quote-escaped sequence, like
>
>  "xxx\"quoted\"yyy\"more quoted\"zzz"
>
>...the \".+\" will gobble up everything from the first quote to the
>last one, meaning the 'yyy' part won't be validated correctly. 

Good point!

>You
>have to either require quotes to be escaped within quoted sequences,
>or forbid them.  Whether other backslash escapes are permitted in
>quoted sequences is another question; if not, that part of the regex
>should read
>
>  "\"(?:[^\"\\\\]++|\\\\\")*\""
>
>...but I think my "escaped anything" approach is probably okay.

Probably, escaping is also a convenient way to resolve potential
ambiguities for the author/reader.

In any case, lookbehind should allow escaped quotes, with a reluctant *
quantifier to allow empty strings (something else I missed before) and a
separate independent group to isolate the quoted sections:

           "(?>\".*?(?<!\\\\)\")"

 Without the independent group the regex will allow this to pass:

          "This is a \"#ABC\"..[]blah \".\" fail test"

>>The backslash escape can't use lookbehind for the \ since this would
>>require allowing it in a non-escape context (it must first be allowed
>>before it can be used as a lookbehind), so a normal match is required:
>
>Lookbehind?  I never used lookbehind.

No, I didn't mean to imply you did. I was just pre-empting the
apparently obvious use of lookbehind for an escaped sequence.

<...>
>With these changes, your fifth and sixth tests fail instead of
>passing, and I think that's correct.  Maybe the OP can give us a
>ruling, though.

Indeed. Clearly defined problems are essential with regular expressions
in order to avoid the symbol spaghetti required for ambiguous logic.

In any case, assuming the fifth and sixth cases should fail, this is the
result:

               "^(?:" +
                 "(?>\".*?(?<!\\\\)\")" + "|" +
                 "[EMAIL PROTECTED]"\\\\\\[\\]]" + "|" +
                 "\\.(?!\\.)" + "|" +
                 "[EMAIL PROTECTED]"\\\\\\[\\]\\.]" +
               ")*$"

Mark Wright
- [EMAIL PROTECTED]

================Today's Thought====================
"In places where books are burned, one day,
 people will be burned" - Heinrich Heine, Germany -
  100 years later, Hitler proved him right
===================================================




==========================================================================
TOPIC: Problems passing an array to an inner class
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/96d202ac6e817c77
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 10 2004 5:56 am
From: [EMAIL PROTECTED] (Matteo) 

The following piece of code does not work:
        
    final int fNum = num;
    final Object[] fItems = items;
    
    SwingUtilities.invokeLater(new Runnable() 
        {
            public void run() 
                {                                       
                betterAddColumn(fNum,fItems);
                }
        });      

It doesn't throws any exception but the contenents of the array are
totally scrambled up inside BetterAddColumn. The int value gives no
problems. Clearly the workaround for "local variable is accessed from
within the inner class; it needs to be declared final" does not work
for arrays.
Is it possible to to pass a vector to a inner class?
I need invokelater because of the swing synchronization event thread
problems modifying a JTable.

Thanks,
Matteo.



== 2 of 2 ==
Date:   Fri,   Sep 10 2004 6:09 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Matteo wrote:
> The following piece of code does not work:
>       
>     final int fNum = num;
>     final Object[] fItems = items;
>     
>     SwingUtilities.invokeLater(new Runnable() 
>       {
>           public void run() 
>               {                                       
>               betterAddColumn(fNum,fItems);
>               }
>       });      

There's nothing wrong with that code.

> It doesn't throws any exception but the contenents of the array are
> totally scrambled up inside BetterAddColumn.

Because *other* parts of your code change it.

> The int value gives no
> problems. Clearly the workaround for "local variable is accessed from
> within the inner class; it needs to be declared final" does not work
> for arrays.

That's not a workaround. The point is that the inner class gets a *copy*
of the local variables. But in the case of objects (such as arrays)
that's just a copy of the reference to the object. The object itself
is not copied, and if it is changed by other parts of the code before
the inner class runs, the changes will be visible.

> Is it possible to to pass a vector to a inner class?

There will be no difference at all.

Either don't change the array after passing it to the inner class, or
make a copy of it and pass that.




==========================================================================
TOPIC: ImageroReader 1.50
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/faa2e5cf9950e486
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 6:00 am
From: "ak" <[EMAIL PROTECTED]> 

ImageroReader is in Java written library for reading of image files.
Supported file types are:
BMP, GIF, TIFF, PNG, JNG, MNG, JPEG, PSD, PBM, PGM, PPM.

Supported RAW files (basic support - full resolution image can't be yet
read, but thumbnails, previews and some metadata):
CRW, NEF, DCR

ImageroReader can also read thumbnails and metadata (IPTC, EXIF and XMP)
from those formats and THM files.
ImageroReader works with java1.1 and later.
ImageroReader defines simple Interface ImageReader to read image files.

ImageReader interface allows to get image width and height, image count
contained in file, define area to read, add ProgressListener and choose
image channel to read.
ImageroReader is free for non-commercial use.


What's new in 1.5.0:
Support for GIF files was added.

Download ImageroReader 1.5.0 at http://reader.imagero.com/download/

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader






==========================================================================
TOPIC: i18n'ed Character Set in DBMS and tables
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e379b42b2be85e8e
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 6:06 am
From: [EMAIL PROTECTED] (Albretch) 

I am/was posting to the general public.

 Now I see what you meant, when you said:

> . . . The "problem"
> (e.g. in Java's model) is that just because a user lives in some country /
> locale, he does not necessarily use the language(s) defined for these, hence
> he is forced to lie about his locale in order to get the desired language.
> Microsoft, BTW, worked this out, and fixed the problem in Windows 2000.

 Nowhere either written in the 'standards' or in the rationale behind
it (as I understand it) says or is implied that a user would be
'lying' about their language-locale pair settings if it does not
geographically reflect the place where they physically are.




==========================================================================
TOPIC: abstract interfaces
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3c9900fa9970d77f
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 10 2004 6:08 am
From: [EMAIL PROTECTED] (Razvan) 

Hi !






        In a Java test I noticed code like:

abstract interface IDummy
{
      // ......
}

        This should trigger a compiler error. Interfaces are abstract
by definition. It is pointless to define an abstract one. Am I right
or not ?





Regards,
Razvan



== 2 of 2 ==
Date:   Fri,   Sep 10 2004 6:17 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Razvan wrote:
>         In a Java test I noticed code like:
> 
> abstract interface IDummy
> {
>       // ......
> }
> 
>         This should trigger a compiler error. Interfaces are abstract
> by definition. It is pointless to define an abstract one. Am I right
> or not ?

No. Why should the compiler complain about an explicit declaration of
something that's already given implicitly? It's pointless but does no
harm and some people may consider it to improve clarity.

You're also allowed to explicitly declare interface methods public.




==========================================================================
TOPIC: Java and good OO practices question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b5af9b2617cafb4f
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 6:11 am
From: Mark Wright <[EMAIL PROTECTED]> 

One joyful day (Thu, 09 Sep 2004 14:36:46 GMT to be precise), "Richard
Molyneux" <[EMAIL PROTECTED]> decided that the Usenet community would
benefit from this remarkable comment:

>I have a question which has been nagging me for quite some time, regarding
>OO programming (in particular Java). I've written code which passes the
>instance of a class (called A) as a parameter in the creation of an instance
>of (another) class (called B). The instance of class A maintains a long term
>state of the program, while the instances of B merely provide updates to the
>state of A.
>
>Basically, I'm wondering if the use of such practices is wise in regard to
>OO (despite being technically allowed within Java)?

I see no problem with it, especially since it seems to me that this is a
minor variation on two well-established OO patterns:

1. The Visitor pattern, with B being the visitor.

2. The Mediator pattern, with B being the mediator controlling the state
of A.

Providing A is manipulated via accessors, this is hunkey-dorey as far as
OO is concerned.

Mark Wright
- [EMAIL PROTECTED]

================Today's Thought====================
"In places where books are burned, one day,
 people will be burned" - Heinrich Heine, Germany -
  100 years later, Hitler proved him right
===================================================




==========================================================================
TOPIC: TreeCellRenderer does not work?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74265422bb68a88d
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 6:18 am
From: Mark Wright <[EMAIL PROTECTED]> 

One joyful day (10 Sep 2004 02:04:43 -0700 to be precise),
[EMAIL PROTECTED] (David) decided that the Usenet
community would benefit from this remarkable comment:

>Hello,
>I implemented a TreeCellRenderer which should display user objects
>depending on a condition in different colours if they are selected or
>not. This is my implementation:
<...>

Why are you calling super.getTreeCellRendererComponent() and throwing
away the result? Usually, you return a new component such as a JPanel
from getTreeCellRendererComponent(), I've never seen anybody return the
renderer itself (not saying that's inherently wrong though).

Maybe you should try returning a new component?

Mark Wright
- [EMAIL PROTECTED]

================Today's Thought====================
"In places where books are burned, one day,
 people will be burned" - Heinrich Heine, Germany -
  100 years later, Hitler proved him right
===================================================




==========================================================================
TOPIC: Strings are interned per JVM or per class ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/95bd017971b5326b
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 10 2004 6:38 am
From: [EMAIL PROTECTED] (Razvan) 

Hi!




        The following code prints 'equal' on my system (jdk 1.4):


public class CDummy
{
        public static void main(String args[])
        {
                System.out.println("CDummy.");
                
                String temp = "unique";

                if (temp == CSomeDummy.s1) System.out.println("equal");
        }
}

class CSomeDummy
{
        static String s1 = "unique";
}


        Is this behaviour dictated by specifications ? Is it possible that
temp and CSomeDummy.s1 references will not be equal because the string
are in different classes ? Perhaps this is implementation dependent.



Regards,
Razvan



== 2 of 2 ==
Date:   Fri,   Sep 10 2004 7:10 am
From: "tony vee" <[EMAIL PROTECTED]> 

Hi Razvan

You have come accross a Java memory efficiency mechanism. To make Java more
memory efficient, the JVM sets aside a special area of memory called the
String constant pool. When the compiler encounters a String literal, such as
your "unique" literal, it checks the pool to see if an identical String
already exists. If a match is found, the reference to the new literal is
directed to the existing String and no new String literal object is
created - the String simply now has an additional reference pointing to it.
Since you have already created the "unique" String object and assigned the
reference to it to the s1 variable, instead of the compiler creating another
one, it simply assigns the reference of the exisiting one to the new temp
variable. So both s1 == temp and s1.equals(temp) will equate to true. If you
wanted to create a string and not use an existing one in the pool, do it
explicitly -

String temp = new String("unique");

and not by instantiating via a short cut mechanism, i.e.

String temp = "unique";

Doing it the long way will mean that s1.equals(temp) is still true, but s1
== temp is now false

As a quick aside:

Remember that Strings are immutable:

String s1  = "unique";
String temp = s1;

System.out.println(s1.equals(temp)) //prints true

//at this point there is only one String object referred to by two reference
variables

s1 = "not unique";

// this line creates a new String object and sets the value of s1 to point
to it, but this means that temp is now poining to a
different String object (that being the original one):

System.out.println(s1.equals(temp))  //prints false
System.out.println(s1) // prints not unique
System.out.println(temp) // prints unique

Enjoy!

Tony








==========================================================================
TOPIC: JBoss and log4j
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/17ca69b550a778e0
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 6:39 am
From: "tony vee" <[EMAIL PROTECTED]> 

Hi

I am trying to configure JBoss so that an enterprise application I have
written is able to use a separate log4j configuration file from the main
server. Currently, both the server and application use the same log4j config
file. Since the Logger class is static, and the server and appliction use
the same classloader, calling PropertyConfigurator.configure("myLogFile")
changes the logger for both server and appliction. This is not what I
want -I need the one log4j config file for the server and one log4j config
file for the application.

I believe that the solution may well revolve around using a separate
classloader for server and application. If so, I would very much appreciate
it if anyone could give me any information on impelemting this (or the URL
to this info). If not, any ideas would be gratefully received

Thanks

Tony






==========================================================================
TOPIC: Passing Large Size Data over Network
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3be58fc6ae618b13
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 6:37 am
From: YU <[EMAIL PROTECTED]> 

Hello!
There is one problem which has been causing me much trouble.
(Perhaps I haven't got enough exp on app development in Java)
In a network environment, we have to develop a system to transmit
large size data (several hundred MB). When using RMI, or J2EE, or
other distributed framework, how can this be done? Thanks!

YU





==========================================================================
TOPIC: Overiding protected methods
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efccff5e5289e8d2
==========================================================================

== 1 of 2 ==
Date:   Fri,   Sep 10 2004 6:57 am
From: [EMAIL PROTECTED] (PBP) 

Consider the following:
   
   public class A {
       protected void foo() {
       }
   }

 
  public class B {
     private class A2 extends A {
        public void foo() {
          super.foo(); 
        }
     }
     
     A2 a = new A2();
  }

  Is this a bad pattern? I don't want to change the code for class A,
because it's used everywhere as have been proven to be stable. The
'hack' use of A2 in class B above, is an exception. Everywhere else in
the application A is either extends or the foo() method is not used.



== 2 of 2 ==
Date:   Fri,   Sep 10 2004 8:02 am
From: Alex Hunsley <[EMAIL PROTECTED]> 

PBP wrote:

> Consider the following:
>    
>    public class A {
>        protected void foo() {
>        }
>    }
> 
>  
>   public class B {
>      private class A2 extends A {
>         public void foo() {
>           super.foo(); 
>         }
>      }
>      
>      A2 a = new A2();
>   }
> 
>   Is this a bad pattern? I don't want to change the code for class A,
> because it's used everywhere as have been proven to be stable. The
> 'hack' use of A2 in class B above, is an exception. Everywhere else in
> the application A is either extends or the foo() method is not used.

What, you're extending the class A just to defeat the protected access on the 
method A.foo()? Why not just make A.foo() public then? You usually can't break 
something by making access to a method more permissive![1]

Such a change is very trivial - just about the only way you could break A is if 
you misspell "public" when you write it, which will be an obvious error....

The bigger picture here seems to be that A.foo was originally intended to be 
internal (to clas A) only and subclasses, and not available to the outside 
interface. Now that you have a different class requiring access to foo(), don't 
bother with a subclass hack - I would suggest adding a new public method to A 
that just calls foo() (and give it a well thought out name as it is public), 
and leave foo alone.

[1] Of course, I am now awaiting the inveitable counter-example that someone 
else will post...!

alex






==========================================================================
TOPIC: Strange problem with JDOM, Xerces and XML Schemas
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f772ecb11366c88c
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 7:19 am
From: "Soeren" <[EMAIL PROTECTED]> 

I have a strange problem with JDOM, Xerces and XML Schemas.

When I read an XML file without a schema, everything goes fine. When I
assign a schema to the XML file, an element in level two returns null. I
have no problems reading the root tag, but the first tag inside the root tag
fails.

This happens both if I turn schema validation on or leave if off. There is
no difference.

Do you know why this happens

Thanks in advance.

Soeren.







==========================================================================
TOPIC: opaque - Bedeutung ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/34ebf17b0b59b7d8
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 7:23 am
From: "Martin Meier" <[EMAIL PROTECTED]> 

Hallo,

kann mir jemand verraten was genau "opaque" meint ?
Man kann zum Beispiel unter einem Frame die Methode setOpaque() nutzen.
Werde aus dieser Komponente nicht richtig schlau.

Liebe Grüße

Martin






==========================================================================
TOPIC: Retrieving Stored Procedure Returns
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f242177026be66a
==========================================================================

== 1 of 1 ==
Date:   Fri,   Sep 10 2004 7:35 am
From: Bryce <[EMAIL PROTECTED]> 

On 9 Sep 2004 16:01:53 -0700, "Xeth  Waxman" <[EMAIL PROTECTED]>
wrote:

>Greetings experts.  I'm having a problem retrieving values from a
>CallableStatement after executing a Stored procedure.  The RDBMS is MS
>SQL Server 2k and the JDBC driver is JTDS 0.8.1.  Here's the code I
>have:
>
>

should this be:
cs = con.prepareCall("{? = call spGetNextBatch(?,?,?,?,?,?,?,?,?)}");

the name spGetNextBatch makes the think there's an actual return value
with this stored procedure...

>cs.registerOutParameter(7, Types.INTEGER);
>cs.registerOutParameter(8, Types.INTEGER);
>cs.registerOutParameter(9, Types.INTEGER);
>cs.setString(1, "GCC");
>cs.setInt(2, 8);
>cs.setInt(3, 802);
>cs.setString(4, userName);
>cs.setString(5, batchComment);
>cs.setString(6, todayString);
>
>//everything's set - execute
>cs.execute();
>
>while (cs.getMoreResults() == true && cs.getUpdateCount()!= -1)
>{
>//processing stuff
>System.out.println("sizzling shizzle");
>}
>
>//get our values out
>int batchKey = cs.getInt(7);
>int nextBatchNo = cs.getInt(8);
>int retVal = cs.getInt(9);
>
>According to the profiler, the SP is executing and returning the
>appropriate values.  However, after running this code, all three value
>(batchKey, nextBatchNo , and retVal) are all unitialized (0), which is
>incorrect.  I am stumped as to what I should be looking for or fixing,
>and as always any assistance is appreciated.


--
now with more cowbell



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

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 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

<a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to