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

Today's topics:

* Whiner Alert ! - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5b0f39eca4dd2fc5
* Is JCA approriate? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/deed8cd23edeab7d
* convert RSA keys - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/136546fb9c297e9a
* How to call an exe file - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3129305fceb82c26
* viva questions - any ideas? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5ea074c24d5897ac
* Need convert to postscript before printing? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d80517ce0ed195fd
* Excellent eBook for UML JAVA - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/78a843129c92e6a
* why does ObjectInputStream constructor block reading a header - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7b8520ff9f293b96
* java.net.SocketException: Insufficient buffer space - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c9c56b240ed60b1
* How to deference a String? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/826d1418a6f42154
* regex replace \\ by \ - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9f662bcf0fda45f7
* simplifying use of properties - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8ec2d768fef49b3
* Download an API of Java????? - 4 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/142c1513c28e9f21
* Monitoring Threads - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9045cfd146a9387a
* Calendar.roll on december,31 !!!! - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ea6aea82ed17ba7a
* JBOSS 4.0 and external Tomcat 5.0 - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1e85ba5cca56fcc
* Filtering files containing keywords - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c5b8ec2cea85367
  
==========================================================================
TOPIC: Whiner Alert !
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5b0f39eca4dd2fc5
==========================================================================

== 1 of 2 ==
Date:   Wed,   Nov 3 2004 7:29 pm
From: John Doe <[EMAIL PROTECTED]> 

Nym shifting cross posting anonymous remailer troll.

Sun <[EMAIL PROTECTED]> wrote:

>Path: 
>newsdbm05.news.prodigy.com!newscon03.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!pd7cy2so!shaw.ca!news.alt.net!news.dizum.com!sewer-output!mail2news-x5!mail2news-x4!mail2news-x3!mail2news-x2!mail2news
>Date: 31 Oct 2004 01:21:13 -0000
>Message-ID: <[EMAIL PROTECTED]>
>From: Sun <[EMAIL PROTECTED]>
>Subject: Whiner Alert !
>Newsgroups: 
>alt.test,alt.drugs.pot,comp.lang.java.programmer,comp.os.linux.advocacy,comp.sys.ibm.pc.games.action
>References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
>Comments: This message probably did not originate at the above address.        It was 
>automatically remailed by one or more anonymous remailers.        Please use [EMAIL 
>PROTECTED] to report abuse
>X-Remailer-Contact: Anonymous Mailer <[EMAIL PROTECTED]>
>X-Spam-Processed: dingoremailer.com, Sat, 30 Oct 2004 20:21:14 -0500 (not processed: 
>message from valid local sender)
>X-Return-Path: [EMAIL PROTECTED]
>X-MDaemon-Deliver-To: [EMAIL PROTECTED]
>Mail-To-News-Contact: [EMAIL PROTECTED]
>Organization: [EMAIL PROTECTED]
>Xref: newsmst01a.news.prodigy.com alt.test:2759095 alt.drugs.pot:632802 
>comp.lang.java.programmer:677607 comp.os.linux.advocacy:1102785 
>comp.sys.ibm.pc.games.action:702646
>
>



== 2 of 2 ==
Date:   Wed,   Nov 3 2004 7:59 pm
From: Werner <[EMAIL PROTECTED]> 

In article <[EMAIL PROTECTED]>
John Doe <[EMAIL PROTECTED]> wrote:
>
> Nym shifting cross posting anonymous remailer troll.
>
>

Would you like some cheese with that whine, bitch?







==========================================================================
TOPIC: Is JCA approriate?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/deed8cd23edeab7d
==========================================================================

== 1 of 1 ==
Date:   Wed,   Nov 3 2004 8:01 pm
From: "Reinf" <[EMAIL PROTECTED]> 

Hello Lee,
   Thanks for your reply!
   I fully agree that JCA is a little overkill for this case, so what kind
of tool/framework would you suggest?

The management of multiple broadcast cards involves the following issues:
 * Session support: That is, when the user logged in and started the
broadcasting of a specified card,  the current
session state shall be stored so that the state could be restored the next
time he logs in. This means that a new session is
created immediately after a user starts the broadcasting of a card. The
session associates the user and the card.
We call this user the (temporary) "owner" of this card(within the session
scope). A user could be the owner of more than
one card.

 * Status: A broadcast card could be in two status: Idle, Busy. Idle means
the card is ready, but nobody is using it,
and "Busy" means that card is using(locked) by a specified user.
A card turns from "Busy" to "Idle" when it's owner or the Administrator
stopped the broadcasting, and thus the session ends.

 * Permission:  When the broadcast of a card is started, no any other user
could stop it, except the Administrator and his owner.
So there will be two-kinds of permissions for the broadcast card:
read-only(View current status) and
write(Transmit data thru the card). Read-only permission is available to all
the users, while write permission is only available to
it's Owner and the Administrator.

Preferably, the framework could also support a list of allow/denied list of
hosts.

  Thank you!


----- Original Message -----
From: "Lee Fesperman" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.java.programmer
Sent: Thursday, November 04, 2004 6:42 AM
Subject: Re: Is JCA approriate?


> Reinf wrote:
> >
> > Hello group,
> >   I am working on a data broadcasting system(in java) which communicates
with
> > one physical broadcast card via JNI. The system itself is composed of
> > several EJBs and a web interface. And now we are redesigning the system
in
> > order to work with more than one broadcast card, which involves the
> > management of multiple hardware resource.
> >   My colleague suggestted the use of JCA(j2ee connector architecture),
and
> > his reason is that JCA includes features like Transaction processing,
resource
> > pool and etc, though it might sounds differrent from what Sun suggested.
> >
> >   Do you think JCA is really approriate for this purpose? And your
reasons
> > please.
> >   Thank you
>
> The interface you're describing sounds like a device driver style
interface. JCA is
> apparently intended for complex backend software systems, listing database
servers,
> application packages like CRM/ERP and messaging systems.
>
> JCA might be overkill for your situation, but I do think it could be
possibility. It is
> a fairly complicated API, so the question is -- is it worth the effort?
>
> Note: Though JCA provides a standardized transaction interface for
container sofware
> (like, application servers), your software will need to handle the actual
transaction
> processing. JCA also supports distributed transactions, but you must
provide the XA
> implementation as a resource manager.
>
> My JDJ article on JCA might help you make your decision:
> http://sys-con.com/story/?storyid=46283&de=1.
>
> --
> Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
> ==============================================================
> * The Ultimate DBMS is here!
> * FirstSQL/J Object/Relational DBMS  (http://www.firstsql.com)







==========================================================================
TOPIC: convert RSA keys
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/136546fb9c297e9a
==========================================================================

== 1 of 2 ==
Date:   Wed,   Nov 3 2004 8:08 pm
From: Chris Smith <[EMAIL PROTECTED]> 

CP wrote:
> I'm writing a client and server application. For the security purpose, i'm 
> using RSA encryption and decryption in C at the client side, whereas the 
> encrytion was wrinting in Java at server side.
> 
> My problem here is, at client side i've created a pair of RSA public and 
> private key in unsigned char[] format. But in java for cipher RSA, all the 
> public and private key are in object format. How can i convert the existing 
> keys in unsigned  char[] to java object.

Assuming you've got instances of RSAPublicKey or RSAPrivateKey and are 
using the java.security package, try calling getEncoded().  If you're 
doing something else, please let us know what the Java code looks like, 
or at least what API you're using.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



== 2 of 2 ==
Date:   Thurs,   Nov 4 2004 12:40 am
From: "CP" <[EMAIL PROTECTED]> 

I've created a pair of keys in c and use in java RSA encryption.

//public and private key which created in C
 byte[] pubKey = {
                                7,116,78,18, (byte)252, 61, (byte)157, 16,
                              (byte)232, (byte)133, 103, 106, (byte)130,
                              (byte)129, 77, (byte)154, 41, (byte)144, 
(byte)243,
                              105, 5, 101, 89, 89, 90,40,64,(byte)178,114,
                              64, (byte)200
                        };
  byte[] priKey = {
                            (byte)241, (byte)227,102, (byte)189, 
(byte)202,25,
                          30, 84, (byte)153, 97, (byte)138, 122, 27, 
(byte)227,
                          6, 106, 112, 35, 31, (byte)191, 93, 9, (byte)254, 
61,
                          93, (byte)140, (byte)165, 35, 61, (byte)221, 
(byte)228, (byte)170
                        };

 //Add provider
 try  {
        //Security.addProvider(new BouncyCastleProvider());
       Security.addProvider (new 
org.bouncycastle.jce.provider.BouncyCastleProvider());
    }  catch (Exception e)
  {
       e.printStackTrace(System.out);
    }

// initiate a cipher
Cipher rsaCipher = Cipher.getInstance("RSA", "BC");// Initialize the cipher 
for encryption

//PROBLEM!  how to convert the above key into publicKey object?
rsaCipher.init(Cipher.ENCRYPT_MODE, pub);

// Cleartext
   byte[] cleartext = "test".getBytes();

   // Encrypt the cleartext
   byte[] ciphertext = rsaCipher.doFinal(cleartext);


   // Initialize the same cipher for decryption
//PROBLEM!  how to convert the above key into privateKey object?
   rsaCipher.init(Cipher.DECRYPT_MODE, priv);

  // Decrypt the ciphertext
   byte[] cleartext1 = rsaCipher.doFinal(ciphertext);

    if ( true == Arrays.equals(cleartext, cleartext1 ))
        System.out.println("equal");
   else
        System.out.println("failed");


Thanks
Chiew Peng
"Chris Smith" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> CP wrote:
>> I'm writing a client and server application. For the security purpose, 
>> i'm
>> using RSA encryption and decryption in C at the client side, whereas the
>> encrytion was wrinting in Java at server side.
>>
>> My problem here is, at client side i've created a pair of RSA public and
>> private key in unsigned char[] format. But in java for cipher RSA, all 
>> the
>> public and private key are in object format. How can i convert the 
>> existing
>> keys in unsigned  char[] to java object.
>
> Assuming you've got instances of RSAPublicKey or RSAPrivateKey and are
> using the java.security package, try calling getEncoded().  If you're
> doing something else, please let us know what the Java code looks like,
> or at least what API you're using.
>
> -- 
> www.designacourse.com
> The Easiest Way To Train Anyone... Anywhere.
>
> Chris Smith - Lead Software Developer/Technical Trainer
> MindIQ Corporation 






==========================================================================
TOPIC: How to call an exe file
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3129305fceb82c26
==========================================================================

== 1 of 3 ==
Date:   Wed,   Nov 3 2004 8:10 pm
From: "bilian" <[EMAIL PROTECTED]> 

Hi all,
I have done an application on sending files from client to server. And now
i want all the files to be converted to pdf format. I found some freeware
or opensource for converting purpose. 
My question is how i call the (converter).exe program so as to run and
convert my files? 




== 2 of 3 ==
Date:   Wed,   Nov 3 2004 8:16 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Wed, 03 Nov 2004 23:10:49 -0500, bilian wrote:

> My question is how i call the (converter).exe program so as to run and
> convert my files?

Have a look at the Runtime.exec() variants under..
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#method_summary>

HTH

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



== 3 of 3 ==
Date:   Wed,   Nov 3 2004 8:23 pm
From: Chris Smith <[EMAIL PROTECTED]> 

bilian wrote:
> I have done an application on sending files from client to server. And now
> i want all the files to be converted to pdf format. I found some freeware
> or opensource for converting purpose. 
> My question is how i call the (converter).exe program so as to run and
> convert my files? 

Runtime.exec

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: viva questions - any ideas?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5ea074c24d5897ac
==========================================================================

== 1 of 2 ==
Date:   Wed,   Nov 3 2004 8:19 pm
From: Chris Smith <[EMAIL PROTECTED]> 

Michael Borgwardt wrote:
> > Q. What are the major changes in java from versions 1.1,1.2,1.3,1.4
> > A. Although the answer of this question is best found on the Sun's site.
> >    My instructor told that he was interested in the version groups of java.
> >    For ex, 1.1-1.2 is regarded as similar java version while 1.3-1.4 is
> >    regarded as another equal java version. Has anyone ideas on this?
> 
> That doesn't make sense. The difference between 1.1 and 1.2 is much,
> MUCH bigger than between 1.2 and 1.3.

This depends on where you're looking, too.  The Java standard API 
underwent a huge expansion between 1.1 and 1.2, but if I were only 
considering the language and truly core API, I wouldn't say Java changed 
at all!  On the other hand, the language changed a lot in the 1.0 to 1.1 
transition.  Both language and API underwent moderate changes from 1.3 
to 1.4, and they both changed to a greater extent again from 1.4 to 1.5.

The only really "minor" version change from BOTH a language and API 
standpoint appears to be from 1.2 to 1.3.

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



== 2 of 2 ==
Date:   Wed,   Nov 3 2004 8:28 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Wed, 3 Nov 2004 21:19:01 -0700, Chris Smith wrote:

> The only really "minor" version change from BOTH a language and API 
> standpoint appears to be from 1.2 to 1.3.

I regard the introduction of the JNLP API in 1.3 to have been 
significant, but that is because deployment is such a quirky 
(and often overlooked) matter.

-- 
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: Need convert to postscript before printing?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d80517ce0ed195fd
==========================================================================

== 1 of 2 ==
Date:   Wed,   Nov 3 2004 8:42 pm
From: "bilian" <[EMAIL PROTECTED]> 

I want to print files which are stored in a folder. From many forum, i
found that printer can only receive postscript format, and if i want to
print pdf or microsoft office files, i need to convert it to postscript
before send to printer.
Am i right? Can anyone gives opinion how to make it simple?




== 2 of 2 ==
Date:   Thurs,   Nov 4 2004 12:13 am
From: "Niels Dybdahl" <[EMAIL PROTECTED]> 

> I want to print files which are stored in a folder. From many forum, i
> found that printer can only receive postscript format, and if i want to
> print pdf or microsoft office files, i need to convert it to postscript
> before send to printer.
> Am i right?

If the printer is a postscript only printer, then you are right. Many
printers do also understand PCL.

> Can anyone gives opinion how to make it simple?

Use the Java print API, then the printer driver will do the conversion to
either postscript or PCL.
However it is not simple to interpret a pdf or MS office file.

Niels Dybdahl






==========================================================================
TOPIC: Excellent eBook for UML JAVA
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/78a843129c92e6a
==========================================================================

== 1 of 1 ==
Date:   Wed,   Nov 3 2004 9:29 pm
From: Sudsy <[EMAIL PROTECTED]> 

David Boncasio wrote:
> Hi All,
> 
> I have been searching for a good book for UML, finally I found an
> excellent eBook in PDF format at http://www.JavaSoft.8k.com ,
> There also I found another eBook called SCEA Complete KIT for Sun
> Certified Enterprise Architect exam.
<snip>

Hmmm...
The "Try It" button pays to [EMAIL PROTECTED] and this e-mail comes
(three times!) from [EMAIL PROTECTED]
Coincidence?
Or could it be (heaven forbid!) a case of spamming the newsgroup...

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





==========================================================================
TOPIC: why does ObjectInputStream constructor block reading a header
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7b8520ff9f293b96
==========================================================================

== 1 of 3 ==
Date:   Wed,   Nov 3 2004 10:34 pm
From: Esmond Pitt <[EMAIL PROTECTED]> 

Tony Morris wrote:
> 
> Because it includes non-blocking I/O.
> http://java.sun.com/j2se/1.5.0/docs/api/java/nio/channels/SelectableChannel.html#configureBlocking(boolean)

I'm sorry, I knew that, I was unclear: what I meant was why does the OP 
need non-blocking I/O? It was only an order of initialization problem.




== 2 of 3 ==
Date:   Thurs,   Nov 4 2004 1:15 am
From: [EMAIL PROTECTED] (kartik) 

"Tony Morris" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> "Esmond Pitt" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Tony Morris wrote:
> > > In that case, you want to look at the java.nio package.
> > >
> > Why?
> >
> 
> Because it includes non-blocking I/O.

But I do *not* want non-blocking I/O (and its associated complexity).
My only problem is that the ObjectInputStream constructor reads the
stream header before it really has to, and that's causing deadlock.



== 3 of 3 ==
Date:   Thurs,   Nov 4 2004 1:21 am
From: "Tony Morris" <[EMAIL PROTECTED]> 

> But I do *not* want non-blocking I/O (and its associated complexity).
> My only problem is that the ObjectInputStream constructor reads the
> stream header before it really has to, and that's causing deadlock.

It doesn't cause deadlock.
Perhaps you meant a blocked I/O operation?
I'm not sure if that particular constructor does block, but it's no secret
that J2SE I/O has flaws, and that this is one of them (the inability to
cleanly break out of a blocked I/O state).
In most cases, even an interrupt fails.

There are texts on the topic.
I suggest "Taming Java Threads", Allen Holub.
There's another good one my Doug Lea (forget the title).

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







==========================================================================
TOPIC: java.net.SocketException: Insufficient buffer space
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c9c56b240ed60b1
==========================================================================

== 1 of 1 ==
Date:   Wed,   Nov 3 2004 10:41 pm
From: Esmond Pitt <[EMAIL PROTECTED]> 

John C. Bollinger wrote:
> 
> As I wrote elsewhere, a SocketException almost surely reflects an error 
> condition reported by the native network stack.

I agree with John's diagnosis. You haven't actually told us, but I 
suspect the exception is being thrown by ServerSocket.accept() when the 
underlying network stack is trying to allocate the accepted socket's 
send/receive buffers. Make them smaller, and as John said your 
BufferedInputStream buffer is much too high too. There isn't much point 
in making it any larger than the socket receive buffer: all you're doing 
is fooling the sending TCP/IP stack into sending faster, or should I say 
earlier, than really necessary.

EJP





==========================================================================
TOPIC: How to deference a String?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/826d1418a6f42154
==========================================================================

== 1 of 2 ==
Date:   Wed,   Nov 3 2004 10:31 pm
From: Nick Coleman <[EMAIL PROTECTED]> 

Mike Schilling wrote:


> What exactly does the spec say that prevents it?  That seems like an
> arbitrary restriction, the kind that would appear only in ...
> 
> A school assignment.  I see.

Well, it's not school.  Yes, I am doing an assignment with unrealistic
specs, but this particular problem is my own creativity at work.

I don't want to use Maps or Sets because I'd have to hard code magic
numbers.  That's against the rules, yes?

Thanks to everyone who replied; reflect was what I was looking for.

-- 
Nick




== 2 of 2 ==
Date:   Wed,   Nov 3 2004 11:04 pm
From: "Mike Schilling" <[EMAIL PROTECTED]> 


"Nick Coleman" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Mike Schilling wrote:
>
>
>> What exactly does the spec say that prevents it?  That seems like an
>> arbitrary restriction, the kind that would appear only in ...
>>
>> A school assignment.  I see.
>
> Well, it's not school.  Yes, I am doing an assignment with unrealistic
> specs, but this particular problem is my own creativity at work.
>
> I don't want to use Maps or Sets because I'd have to hard code magic
> numbers.  That's against the rules, yes?

How does

    public static final String KEY_01 = "value1";
    public static final String KEY_02 = "value2";
    ...

    Map pairs = new HashMap();
    pairs.put("KEY_01",  KEY_01);
    pairs.put("KEY_02",  KEY_02);
    ...

hardcode magic numbers? 






==========================================================================
TOPIC: regex replace \\ by \
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9f662bcf0fda45f7
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 12:47 am
From: [EMAIL PROTECTED] (Stephan Ehlert) 

Hello again,

thanks for your fast replies. But unfortunately none of your solutions
solves my problem. I have written a second example. The String
"someText\\nsomeText2"
has to be replaced by "someText\nsomeText2" , so that someText2 is
written to a new line when I write the whole String into a file.
Note that the replacement shouldn't work with \n only, but with other
expressions like \t, too.

Thanks, Stephan

The code:
class XYZ {

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

    String s = "someText\\nsomeText2";      
    System.out.println(s);

//  s = s.replaceAll("\\\\\\\\", "\\\\"); // no match
//  s = s.replaceAll("\\\\", "");         // deletes \\
//  s = s.replaceAll("\\\\n", "\\\n");    // replaces \\n by \n
//  s = s.replaceAll("\\\\", "\\");       // should replace \\ by \,
but exc.
    System.out.println(s);
  }
}




==========================================================================
TOPIC: simplifying use of properties
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8ec2d768fef49b3
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Nov 4 2004 1:06 am
From: [EMAIL PROTECTED] (kartik) 

"Hal Rosser" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> "kartik" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Currently, use of (JavaBeans) properties requires manual calls to
> > getter & setter methods. Wouldn't it be better to extend the language
> > so that an expression "object.foo" (without a '()'), in the absence of
> > a field named foo, is treated as equivalent to a call to a
> > getter/setter method (depending on whether the property is being read
> > or written).
> >
> > I feel it would be better to do this *not* by a compile-time
> > transformation but by changing the spec of the getfield & putfield
> > instructions to invoke a getter/setter method when there is no
> > matching field. Then, classes can replace fields with properties (or
> > vice-versa) without hurting binary compatibility (for clients who
> > access the fields/properties using the "object.foo" syntax).
> >
> > Maybe static properties should also be allowed.
> >
> > Any comments? Thank you.
> 
> you can do that 
What?

> by declaring the properties public 
Meaning, declaring the fields public? That's a bad idea.

> [...] but then other classes would have access - but you don't want that.
I want them to be able to call the getter/setter methods using the
field access syntax, but not to access the underlying field used to
implement the property.



== 2 of 3 ==
Date:   Thurs,   Nov 4 2004 1:09 am
From: [EMAIL PROTECTED] (kartik) 

"Stefan Schulz" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> On 3 Nov 2004 00:47:10 -0800, kartik <[EMAIL PROTECTED]> wrote:
> 
> > I feel it would be better to do this *not* by a compile-time
> > transformation but by changing the spec of the getfield & putfield
> > instructions to invoke a getter/setter method when there is no
> > matching field. Then, classes can replace fields with properties (or
> > vice-versa) without hurting binary compatibility (for clients who
> > access the fields/properties using the "object.foo" syntax).
> 
> What if the property is not directly (or at all) backed by any field?
The accessor methods may use a field of the object, store the
information somewhere else, compute it on the fly, etc - client code
is insulated from such choices.



== 3 of 3 ==
Date:   Thurs,   Nov 4 2004 1:24 am
From: "Stefan Schulz" <[EMAIL PROTECTED]> 

On 4 Nov 2004 01:09:44 -0800, kartik <[EMAIL PROTECTED]> wrote:

> "Stefan Schulz" <[EMAIL PROTECTED]> wrote in message  
> news:<[EMAIL PROTECTED]>...
>> On 3 Nov 2004 00:47:10 -0800, kartik <[EMAIL PROTECTED]> wrote:
>>
>> > I feel it would be better to do this *not* by a compile-time
>> > transformation but by changing the spec of the getfield & putfield
>> > instructions to invoke a getter/setter method when there is no
>> > matching field. Then, classes can replace fields with properties (or
>> > vice-versa) without hurting binary compatibility (for clients who
>> > access the fields/properties using the "object.foo" syntax).
>>
>> What if the property is not directly (or at all) backed by any field?
> The accessor methods may use a field of the object, store the
> information somewhere else, compute it on the fly, etc - client code
> is insulated from such choices.

In that case, you do have a problem: If you redefine getfield JVM
instructions to call accessor methods, what do you do in the following
case:


class NoWay {
        public int foo;

        public int getFoo(){
                return 1;
        }

        public void setFoo(int x){
                // ha-ha
        }
}

should a setField for foo change the value?


-- 

Whom the gods wish to destroy they first call promising.




==========================================================================
TOPIC: Download an API of Java?????
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/142c1513c28e9f21
==========================================================================

== 1 of 4 ==
Date:   Thurs,   Nov 4 2004 1:08 am
From: [EMAIL PROTECTED] (acertijolandia) 

Hello

I need download the API of axis for java to local, to view it offline.
Do you know if some web has APIs in a .zip o another downloaded
archive???? (or a program that download all api without i have to
browser all pages)

Thanks 

     Javier



== 2 of 4 ==
Date:   Thurs,   Nov 4 2004 1:11 am
From: Thomas Kellerer <[EMAIL PROTECTED]> 

On 04.11.2004 10:08 acertijolandia wrote:

> Hello
> 
> I need download the API of axis for java to local, to view it offline.
> Do you know if some web has APIs in a .zip o another downloaded
> archive???? (or a program that download all api without i have to
> browser all pages)
> 
> Thanks 
> 
>      Javier

I'm not sure what you mean with "axis for java to local", but the JDK
documentation can be downloaded here:

http://java.sun.com/j2se/1.4.2/download.html

Thomas



== 3 of 4 ==
Date:   Thurs,   Nov 4 2004 1:54 am
From: "Yasir Khan" <[EMAIL PROTECTED]> 

Hi,

If you are talking about Apache WebServices Project "AXIS" for JAVA, then
you can download it from:

http://ws.apache.org/axis/download.cgi

Regards,
Yasir

"acertijolandia" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello
>
> I need download the API of axis for java to local, to view it offline.
> Do you know if some web has APIs in a .zip o another downloaded
> archive???? (or a program that download all api without i have to
> browser all pages)
>
> Thanks
>
>      Javier





== 4 of 4 ==
Date:   Thurs,   Nov 4 2004 1:58 am
From: Thomas Weidenfeller <[EMAIL PROTECTED]> 

Thomas Kellerer wrote:
> On 04.11.2004 10:08 acertijolandia wrote:
>>I need download the API of axis for java to local, to view it offline.
>>Do you know if some web has APIs in a .zip o another downloaded
>>archive???? (or a program that download all api without i have to
>>browser all pages)
> 
> I'm not sure what you mean with "axis for java to local", but the JDK
> documentation can be downloaded here:
> 
> http://java.sun.com/j2se/1.4.2/download.html

And while we try to make sens eof the OPs post, I think he means "API 
documentation" not API. To the OP: The later is the provided by the 
software.

/Thomas




==========================================================================
TOPIC: Monitoring Threads
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9045cfd146a9387a
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Nov 4 2004 1:16 am
From: snae <[EMAIL PROTECTED]> 

Hi,

I have an app that spawns a new Thread for several identical tasks that it
needs to carry out.  These tasks should never stop running and if they do
I want to take action.

I have looked at two methods of doing this.  Using ThreadGroup and
assigning each of the Threads to a ThreadGroup, then looping over the
contents of the ThreadGroup to check if each Thread is running.  The other
method is simply to dump each Thread object into an ArrayList and loop
over the contents of this.  Either way I would have thought would do the
trick - but which way is 'better'?

The other question I have is - if a Thread stops execution, and is stored
in one of the ways above, does the object persist?.  I need to be able to
restart a dead Thread, or at least get some information from that Thread
in order to start a new Thread with the correct information.

Thanks for any help.



== 2 of 3 ==
Date:   Thurs,   Nov 4 2004 1:32 am
From: "Stefan Schulz" <[EMAIL PROTECTED]> 

On Thu, 04 Nov 2004 09:16:09 +0000, snae <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I have an app that spawns a new Thread for several identical tasks that  
> it
> needs to carry out.  These tasks should never stop running and if they do
> I want to take action.
>
> I have looked at two methods of doing this.  Using ThreadGroup and
> assigning each of the Threads to a ThreadGroup, then looping over the
> contents of the ThreadGroup to check if each Thread is running.  The  
> other
> method is simply to dump each Thread object into an ArrayList and loop
> over the contents of this.  Either way I would have thought would do the
> trick - but which way is 'better'?
>
> The other question I have is - if a Thread stops execution, and is stored
> in one of the ways above, does the object persist?.  I need to be able to
> restart a dead Thread, or at least get some information from that Thread
> in order to start a new Thread with the correct information.
>
> Thanks for any help.

See the getState method (new in 1.5) for retrieving the status of a Thread

The Runnable of the Thread does indeed persist... so just store your state
here, and if you ever need to, make a new Thread with the same Runnable.



-- 

Whom the gods wish to destroy they first call promising.



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

snae wrote:
> I have an app that spawns a new Thread for several identical tasks that it
> needs to carry out.  These tasks should never stop running and if they do
> I want to take action.

First some terminology (it pays to keep the following separate, 
unfortunately Sun's documentation is not very clear about this):

A thread (lowercase) is a unit of execution. It is not an object or a class.

A Thread (uppercase) is a class in Java. Instances of this class provide 
a control and monitoring mechanism for threads (lowercase). One Thread 
instance controls zero or one thread.

> I have looked at two methods of doing this.

The most robust would be to leave such monitoring of "must run under all 
conditions" tasks to the operating system. Unfortunately Java has no API 
for delegating such tasks to the OS, so if you have to use pure Java, 
this is not an option.

> Using ThreadGroup and
> assigning each of the Threads to a ThreadGroup, then looping over the
> contents of the ThreadGroup to check if each Thread is running.

There is no need to loop. activeCount() (also available as 
Thread.activeCount()) returns the number of active threads in a 
ThreadGroup. If the number goes down, one of your threads has died.

> The other
> method is simply to dump each Thread object into an ArrayList and loop
> over the contents of this.

You can do this, but using the ThreadGroup seems simpler.

But in both cases, you have another issue: Deadlocked or otherwise 
hanging threads. If you need to deal with these, too, you might have to 
implement some heartbeat mechanism to detect this (E.g. a thread is 
supposed to regularly reset a timer. If it doesn't, the timer expires, 
and triggers some emergency action). You will then have the problem of 
getting rid of the hanging thread (the Thread object is no great help 
here, all the interesting methods have been deprecated - for very good 
reasons).

> The other question I have is - if a Thread stops execution, and is stored
> in one of the ways above, does the object persist?

Yes, because (see above) the Thread object and the thread are not identical.


> I need to be able to
> restart a dead Thread, or at least get some information from that Thread
> in order to start a new Thread with the correct information.

Restarting some activity, or picking up some activity which has been 
previously aborted requires that you know how much progress has been 
made until the problem happened. This requires that you model the state 
of all the objects which are supposed to be changed by a thread in a way 
that you can retrieve the state, use it to identify how fare you got, 
and be able to start a new thread at a defined point where you want to 
continue. Depending on the actual task, this might require a lot of 
thinking, followed by a lot of coding. Some transaction log might be of 
help here, too.

/Thomas




==========================================================================
TOPIC: Calendar.roll on december,31 !!!!
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ea6aea82ed17ba7a
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 1:54 am
From: [EMAIL PROTECTED] (Gianni) 

My application has this terrible bug and now is time to fix!
It works 364 days in the year but not on dec,31

I have to add one day to the "today".

In fact on 2004-dec-31 I have 2004-jan-1

I use :
Calendar calendar = Calendar.getInstance(Locale.GERMANY);
calendar.roll(6, 1);

but obviously does not work on dec,31... any idea how to fix it???
Thanks
Gianni




==========================================================================
TOPIC: JBOSS 4.0 and external Tomcat 5.0
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1e85ba5cca56fcc
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 2:05 am
From: [EMAIL PROTECTED] (Hugo) 

Hello,

I know that Tomcat 5.0 is embedded with Jboss 4.0 but one of my
specification is that to use an external Tomcat no the one provided by
Jboss.
So I would like to use an external Tomcat with my JBoss 4.0 but I
can't find any information or documentation that help me to do it.

If someone know the configuration that it is needed from Jboss thank
for help.




==========================================================================
TOPIC: Filtering files containing keywords
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c5b8ec2cea85367
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Nov 4 2004 2:05 am
From: [EMAIL PROTECTED] (otimus) 

HOW CAN I FILTER THE FILES WHICH CONTAIN A KEYWORD AND PUT INTO A
DIFFERENT DIRECTORY.



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

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