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

Today's topics:

* Runtime.getRuntime().exec PROBLEM - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90ad1ee379698f32
* problem with Panel in an applet - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c5c3a2df7fd4b725
* Exception Handling - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a34b306b81d0e163
* link between Applet en Javascript - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/32b00be5c1796d03
* Socket problem in applet - 2 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/469e9f779424c7fa
* Verify .java matches .class - 5 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f0f3cde9fea4611c
* java.util.regex ^ problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8557b1f56abfcb4d
* Java trick - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad
* Problem with a simple CMP bean while working on JBoss - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8fb2455973de436
* Question about access and visibility - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/47b97d0f661b9d8e
* java static factory method vs. constructor - object reuse - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c9c44eab569d8444
* A HTTP server question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ed9ac9e989861f8
* how can i simulate my pc as http server by writing java code to send the http 
response by socketstream to some pc in the internet?! - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d2d914791c738e87
* byte to long: convertion problem - 4 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b121052e661ad459
* Problem in executing pl/sql block through jdbc - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c96714693c45cc1
  
==========================================================================
TOPIC: Runtime.getRuntime().exec PROBLEM
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90ad1ee379698f32
==========================================================================

== 1 of 2 ==
Date:   Tues,   Sep 21 2004 4:06 am
From: [EMAIL PROTECTED] (Mao) 

Hi.
I'm trying to print a document using the acrord32 or gsprint command
directly from my java program named "cde".

The problem is that: If i run multiple instance of my program "cde",
sometimes the adobe or gs print only one document and not the other
especially if I run em both in a short temporal distance.
To solve the problem I'm trying to know if acrord32 or gs are already
printing a document and waiting until there is no document.

Is there a way to know that?? ( using J2EE )
Is there another way to solve the problem??

Thanks in advance



== 2 of 2 ==
Date:   Tues,   Sep 21 2004 7:16 am
From: Gordon Beaton <[EMAIL PROTECTED]> 

On 21 Sep 2004 04:06:13 -0700, Mao wrote:
> I'm trying to print a document using the acrord32 or gsprint command
> directly from my java program named "cde".
> 
> The problem is that: If i run multiple instance of my program "cde",
> sometimes the adobe or gs print only one document and not the other
> especially if I run em both in a short temporal distance.
> To solve the problem I'm trying to know if acrord32 or gs are already
> printing a document and waiting until there is no document.
> 
> Is there a way to know that?? ( using J2EE )
> Is there another way to solve the problem??

Is gsprint the following script?

http://www.linuxjournal.com/modules.php?op=modload&name=NS-lj-issues/issue47&file=2328l1

If so, the problem is that it always spools to the same temporary
file, but it's easily fixed. Edit the script, and replace each
occurrence of "/tmp/gs.out" with "/tmp/gs-$$.out".

Acroread has a similar problem that you might be able to solve by
specifying separate temp directories each time you run it (i.e. by
setting TMP or TMPDIR), however I haven't looked more closely than
that.

/gordon

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




==========================================================================
TOPIC: problem with Panel in an applet
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c5c3a2df7fd4b725
==========================================================================

== 1 of 2 ==
Date:   Tues,   Sep 21 2004 4:54 am
From: "Christian \"Raistlin\" Gulich" <[EMAIL PROTECTED]> 

I solved the problem. The problem is caused by a bug in the jvm. After 
upgrading the jvm my applet behaves as expected.
Detailed information can be found here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4745222

Thanks again, Christian



== 2 of 2 ==
Date:   Tues,   Sep 21 2004 5:12 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Tue, 21 Sep 2004 13:54:21 +0200, Christian "Raistlin" Gulich wrote:

> I solved the problem. 

Excellent!

>...The problem is caused by a bug in the jvm. After 
> upgrading the jvm my applet behaves as expected.

Thanks for reporting back with the solution.

-- 
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: Exception Handling
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a34b306b81d0e163
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 21 2004 5:09 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Jacob wrote:
> In general: If you test for cases that cannot happen, you confuse
> your fellow programmers (or yourself two weeks down the road).

Actually, it's exactly where assertions should be used.
And if done correctly (when assertions are not available)
exception handling can have a similar positive effect:
document assumptions the programmer made about what state
the program should be in.


> You are indicating a possible flow of logic that is not there;
> You make your program more complex than necessary, and make
> maintainance harder. In short:
> 
> Prefer a solid program crash for "impossible" cases.

That depends on the application. If it provides a publically
available service (like an ATM), you often do NOT want a "solid
crash" just because there's a bug in some rarely-occurring
code path.

What you definitely do want is to fall back to some well-defined
state (e.g. end the user session) and log debugging information.



> Extenssive use of exception handling is a sign of programmer
> laziness in my opinion. If you take the time and consider all
> aspects of your data model and logic, there should be no room
> left for exceptional behaviour other than when dealing with
> external hardware (network, printers, ports, memory, etc.)

"should" isn't good enough. There exists currently no tool or
technique that can provide absolute certainly that you
actually have considered all such aspects, and that you have
implemented these considerations completely and correctly.
And even the best programmers frequently find that they didn't
succeed in doing so.




==========================================================================
TOPIC: link between Applet en Javascript
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/32b00be5c1796d03
==========================================================================

== 1 of 2 ==
Date:   Tues,   Sep 21 2004 5:18 am
From: "Phildes" <[EMAIL PROTECTED]> 

> > In my applet, I would like to run a Javascript method.
> > How my applet could reconize the HTML page and the components of this
page.
>
> Try here for JS/Java interaction tips.
> <http://www.rgagnon.com/howto.html>
> Listed under 'JavaScript' | 'Interaction with Java'

It is the exact answer of my question. Thank you.

Phildes





== 2 of 2 ==
Date:   Tues,   Sep 21 2004 5:54 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Tue, 21 Sep 2004 14:18:53 +0200, Phildes wrote:

>>> In my applet, I would like to run a Javascript method.
>>> How my applet could reconize the HTML page and the components of this
> page.
..
>> <http://www.rgagnon.com/howto.html>
..
> It is the exact answer of my question. 

Real's 'HowTo' has answered many questions for me,
it is a wonderful resource.

Hang around for a bit, and you might get to talk to 
the author.  Real pops in occasionally with short
links to very comprehensive answers.

>..Thank you.

(chuckle)  Thanks, Real.

-- 
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: Socket problem in applet
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/469e9f779424c7fa
==========================================================================

== 1 of 2 ==
Date:   Tues,   Sep 21 2004 5:41 am
From: "Christian \"Raistlin\" Gulich" <[EMAIL PROTECTED]> 

Hallo,

I have an applet, which is part of a client server architecture. It 
contains a static object c, which encapsulates the communication 
function with the server by defining some methods. The communication is 
done via an ObjectInputStream and an ObjectOutputStream.
The applet works pretty well so far. Problems occur, if the browser 
window is actualized by the user. To keep the existing server 
connection, my init method looks like this:

   public void init() {
     if (c == null) {
       c = new Client(serverIP, serverPort);
     }
   }

So, if the connection already exists, it should not be changed. But 
after reloading the applet, the communication doesn't work anymore. The 
client seems to be able, to transmit messages to the Server. But it 
doesn't receive the messages correctly any more. At first it reads 
messages, that are already read before the refresh. After this there is 
this Exception:

java.io.StreamCorruptedException
at 
java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2350)
 
at 
java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2383) 
at 
java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2455) 
at
java.io.DataInputStream.readInt(DataInputStream.java:392)
at 
java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
at java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
at 
de.tuilmenau.gulich.ihs.Client$ServernachrichtWarteThread.run(Client.java:405)


After throwing this Exception once, further attemps to communicate with 
the server follow to

java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:397)
at 
java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2660)
at
java.io.ObjectInputStream.readInt(ObjectInputStream.java:900)
at 
de.tuilmenau.gulich.ihs.Client$ServernachrichtWarteThread.run(Client.java:405)


The Client implements a Thread to receive server messages, to prevent 
blocking of the whole applet if there should be delays.

Does any body know, what causes this behaviour?


Thanks, Christian



== 2 of 2 ==
Date:   Tues,   Sep 21 2004 7:01 am
From: "Christian \"Raistlin\" Gulich" <[EMAIL PROTECTED]> 

Hallo again,

I could localize the problem, but wasn't still able to fix it.
When the Browser refreshes the Applet, it generates a new ThreadGroup. 
The Thread, which listens for server communication is still in the old 
ThreadGroup.
If I change this and create a new group for it directly under "main" and 
outside the ThreadGroup, which is generated by the browser, the problem 
disappears. I can do this in my JBuilder-Applet-Testbed but in a browser 
it isn't possible because of a SecurityException.
Do you have any other ideas to solve this problem?

Thanks, Christian




==========================================================================
TOPIC: Verify .java matches .class
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f0f3cde9fea4611c
==========================================================================

== 1 of 5 ==
Date:   Tues,   Sep 21 2004 5:43 am
From: Thomas Schodt <[EMAIL PROTECTED]> 

David Davidson wrote:
> The question though is how do you verify that the class file is the
> same, it may have the same file size, but how do I know that the
> internal logic is the same? I wondered if there is any kind of Java
> byte code comparer, I've tried decompiling the class that I've
> compiled and decompiling the class I'm comparing it to, but the
> results of the decompilation don't seem consistent.

Use cmp on binary files, use diff on text files.

You can decompile (javap -c) the original and the newly compiled class 
file and the resulting output should be identical if the sources were 
identical.



== 2 of 5 ==
Date:   Tues,   Sep 21 2004 5:56 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

David Davidson wrote:

> The question though is how do you verify that the class file is the
> same, it may have the same file size, but how do I know that the
> internal logic is the same?

If the contents are identical (bytewise) then obviously they have the
same behaviour.

If the contents are not the same, it's theoretically impossible to
determine whether they have the same behaviour.

In practice, there are probably quite narrow bounds for what compilers
are allowed to vary, but trying to do such a comparison in a way that
doesn't fail with any combination of compilers and compiler versions
would still be a daunting task that I doubt anyone has attempted.



== 3 of 5 ==
Date:   Tues,   Sep 21 2004 6:00 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Thomas Schodt wrote:
> Use cmp on binary files, use diff on text files.
> 
> You can decompile (javap -c) the original and the newly compiled class 
> file and the resulting output should be identical if the sources were 
> identical.

No, you can't count on that at all, not even if the same version of the
same compiler produced both class files. There are compilers (I seem to
remember that Sun's actually is one of them) where the order of entries
in the constant pool (which is irrelevant to the semtantic of the class)
varies between different runs.



== 4 of 5 ==
Date:   Tues,   Sep 21 2004 6:41 am
From: Thomas Schodt <[EMAIL PROTECTED]> 

Michael Borgwardt wrote:
> Thomas Schodt wrote:
> 
>> Use cmp on binary files, use diff on text files.
>>
>> You can decompile (javap -c) the original and the newly compiled class 
>> file and the resulting output should be identical if the sources were 
>> identical.
> 
> 
> No, you can't count on that at all, not even if the same version of the
> same compiler produced both class files. There are compilers (I seem to
> remember that Sun's actually is one of them) where the order of entries
> in the constant pool (which is irrelevant to the semtantic of the class)
> varies between different runs.

Interesting.

I assumed there might be things like timestamps in there
so that a binary comparison would identify differences.

The contant pool is dumped with javap -verbose
so when using that I guess one would have to do some
post processing (reformatting&sorting that section of the output)
before running it through diff (unless the number of files is small).

It means it is almost impossible to make any sense of a binary comparison.



== 5 of 5 ==
Date:   Tues,   Sep 21 2004 6:45 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Thomas Schodt wrote:
> The contant pool is dumped with javap -verbose
> so when using that I guess one would have to do some
> post processing (reformatting&sorting that section of the output)
> before running it through diff (unless the number of files is small).

The problem is that entries in the constant pool are referenced by their
indices throughout the class, so you'd have to adjust all those
references as well.

> It means it is almost impossible to make any sense of a binary comparison.

Yup.




==========================================================================
TOPIC: java.util.regex ^ problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8557b1f56abfcb4d
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 21 2004 5:48 am
From: Glenn Meter <[EMAIL PROTECTED]> 

That did the trick. Next time I'll RTFM more carefully.

Thanks,
Glenn


On 2004-09-20 23:43:48 -0500, Chris Smith <[EMAIL PROTECTED]> said:

> From the API documentation for java.util.Pattern:
> 
>     By default, the regular expressions ^ and $ ignore line terminators
>     and only match at the beginning and the end, respectively, of the
>     entire input sequence. If MULTILINE mode is activated then these
>     expressions match just after or just before, respectively, a line
>     terminator or the end of the input sequence with the exception that
>     the expression ^ never matches at the end of input, even if the last
>     character is a newline.
> 
> So try:
> 
>     Pattern p = Pattern.compile("^match", Pattern.MULTILINE);
>     Matcher m = p.matcher("foo\nmatch bar\n");
>     boolean b = m.find();
> 
> I haven't tried it, but I suspect it will work.






==========================================================================
TOPIC: Java trick
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 21 2004 6:03 am
From: [EMAIL PROTECTED] (Brian J. Sayatovic) 

"andreas" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> IMHO this behaviour is very consistent.
> since a object can be null at any time and the method returns
> an object of type CDummy the returned value is
> 
> null of type CDummy. therefore the static variable is accessable.

If that were the case than instanceof would return true in such cases,
but it does not.  "null instanceof CDummy" returns false.

Regards,
Brian.




==========================================================================
TOPIC: Problem with a simple CMP bean while working on JBoss
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8fb2455973de436
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 21 2004 6:04 am
From: Sudsy <[EMAIL PROTECTED]> 

Subra wrote:
<snip>
> .;D:\jboss-3.2.4\server\default\lib\jboss-j2ee.jar;D:\jboss-3.2.4\serv
>  
> er\default\lib\jbossall-client.jar;D:\jboss-3.2.4\server\default\lib\jnet.jar;
>  EmployeeSalInsertClient
>  Exception in thread "main" javax.ejb.FinderException: Unknown query: 
> public
>  abstract emp.Employee 
> emp.EmployeeHome.findByPrimaryKey(java.lang.Integer)
<snip>

Were you aware that the default type of the primary key is String?
Check the prim-key-class element in your ejb-jar.xml file; it
should be java.lang.Integer in your case.





==========================================================================
TOPIC: Question about access and visibility
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/47b97d0f661b9d8e
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 21 2004 6:33 am
From: Mark F <[EMAIL PROTECTED]> 

Jacob wrote:
> Mark wrote:
> 
>> Class Alpha is an abstract base class with package level visibiltiy
>> and a protected method:  protectedMethodAlpha
>>
>> Class Gamma is a concrete class which inherits from Alpha and
>> overrides (actually defines) the protected method.  It is contained
>> within the same directory as Alpha
>>
>> Class Delta is a concrete class which inherits from class Gamma and is
>> in a different package and has public visibility.
>>
>> Should class Delta be able to override protectedMethodAlpha?
> 
> 
> Yes.
> 
> In the discussion, Alpha and Gammas relation to Alpha
> is irrelevant. For Delta the interface of Gamma is the
> only thing that matters.
> 
> Gamma must be public for Delta to extend it from outside
> its package. Then Delta can override all of Gammas public
> and protected members (including protectedMethodAlpha).
> 
> 

For some reason when I try to create a project that illustrates this 
Class Delta cannot find class Gamma, and I get an error line (red 
squiggly line) under "..extends Gamma"

-Mark




==========================================================================
TOPIC: java static factory method vs. constructor - object reuse
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c9c44eab569d8444
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 21 2004 6:38 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

javaguy44 <[EMAIL PROTECTED]> scribbled the following:
> Hi,

> I'm just picked up Bloch's Effective Java and had a question about the
> reuse of objects when using a static factory method.

> Take the following:

> class Foo
> {
>   private Foo() {}

>   public static Foo getInstance() {
>     return new Foo()
>   }
> }

> How is an object of Foo being reused?  All I see is that every time
> static getInstance is called, it returns a new Foo object.  What am I
> not seeing?  Am I missing something underneath the hood that the JVM
> is checking?

An object of Foo is not being reused. The code above is obviously only
an example of what might be done. As it stands, it offers no benefit
whatsoever over a public constructor. But it could be expanded into
either a Singleton or a Factory.
For a Singleton, getInstance() should reuse the same Foo object. For a
Factory, it should do something with the Foo it creates, or have the
opportunity to return a subclass of Foo.

> One more question - can only immutable class objects be reused?

No, there is no such restriction. Reuse any class you want to.

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




==========================================================================
TOPIC: A HTTP server question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ed9ac9e989861f8
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 21 2004 6:49 am
From: [EMAIL PROTECTED] (mike) 

regards:

 I write java program,a simple HTTP server
 when client connected my machine,HTTP server send the HTTP header to the client,
 and then send a XHTML file to the client.

 I use MS IE to test the HTTP server,it is OK.MS IE shows the XHTML file. 
 but when I use nokia 6600 to browse,nokia 6600 cannot browse the XHTML file.

 when java programs is running,indicate that(I do mark at the java program)
(1)HTTP server do receive nokia 6600's HTTP request.
(2)HTTP response headers is sent to the client.
(3)the XHTML file is sent to the client.

but nokia 6600 cannot browse the XHTML file.
could someone excellent to give me a constructive suggestion?
thank you




==========================================================================
TOPIC: how can i simulate my pc as http server by writing java code to send the http 
response by socketstream to some pc in the internet?!
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d2d914791c738e87
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 21 2004 7:04 am
From: "Keith M. Corbett" <[EMAIL PROTECTED]> 

"mike" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> regards:
>
>     I write java code to simulate my machine as a HTTP server,when client
>
>     connect to my HTTP server,my HTTP server replied client a xhtml file.
>
>     I use MS IE browser to test,MS IE test OK to read the xhtml file.
>
>     But when I use nokia 6600 to browse the file,nokia 6600 cannot browse
>
>     the xhtml file.why?.......Is something wrong with my idea?

What error do you get on the Nokia 6600?

Have you verified the Nokia can recognize and display XHTML files? (try
files on other servers)

Have you eliminated network issues as a possible source of your problem? Is
your server inside a firewall? (e.g. home or company network) In your
testing, did you run a client program (MS IE) on a remote host, ie. one not
local to the server? To verify that remote clients can connect to your
server, login to a remote host and run "telnet xxx 80" where xxx is your
server host and 80 is the HTTP server port.

/kmc






==========================================================================
TOPIC: byte to long: convertion problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b121052e661ad459
==========================================================================

== 1 of 4 ==
Date:   Tues,   Sep 21 2004 7:10 am
From: "cccc" <[EMAIL PROTECTED]> 

Hi,

I want translate 8 byte to a long.
But  I am a problem.

The source code that I am using is:

char[] data={0x3f, 0xe7, 0x5d, 0x40, 0x5f, 0x50, 0xcc, 0x33};

long as =
(0xFF & data[0]) << 56 |
(0xFF & data[1]) << 48 |
(0xFF & data[2]) << 40 |
(0xFF & data[3]) << 32 |
(0xFF & data[4]) << 24 |
(0xFF & data[5]) << 16 |
(0xFF & data[6]) << 8 |
(0xFF & data[7]);

System.out.println("BIN="+Long.toBinaryString(as));
System.out.println("HEX="+Long.toHexString(as));

Why first print show 32 bit instead of 64?
Why second print show a hexadecimal value  different to array?

You can help me?

Ciao,
CC





== 2 of 4 ==
Date:   Tues,   Sep 21 2004 7:40 am
From: Jonck <[EMAIL PROTECTED]> 

In <[EMAIL PROTECTED]> cccc wrote:
> Hi,
> 
> I want translate 8 byte to a long.

Hi,
Check out Roedy Green's Conversion Amanuensis, that'll tell you all you 
will ever need to know on conversion issues.

Cheers, Jonck



== 3 of 4 ==
Date:   Tues,   Sep 21 2004 7:42 am
From: Jonck <[EMAIL PROTECTED]> 

In <[EMAIL PROTECTED]> Jonck  wrote:
> In <[EMAIL PROTECTED]> cccc wrote:
>> Hi,
>> 
>> I want translate 8 byte to a long.
> 
> Hi,
> Check out Roedy Green's Conversion Amanuensis, that'll tell you all 
> you  will ever need to know on conversion issues.
>
> Cheers, Jonck
>

Sorry, forgot to post the URL :-)

Here you go: http://mindprod.com/converter.html



== 4 of 4 ==
Date:   Tues,   Sep 21 2004 7:41 am
From: Wolf Martinus <[EMAIL PROTECTED]> 

cccc wrote:
> long as =
> (0xFF & data[0]) << 56 |

you need to cast to long before shifting or the shifting op will be 
limited to int range (32Byte):

long as = (long) data[0] <<56 [...];




==========================================================================
TOPIC: Problem in executing pl/sql block through jdbc
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c96714693c45cc1
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 21 2004 7:32 am
From: Galen Boyer <[EMAIL PROTECTED]> 

On 20 Sep 2004, [EMAIL PROTECTED] wrote:
> Thanks for your reply; there was problem with file
> parsing. Used bufferedReader's readLine() instead of read()
> alongwith little bit of tweaking with code and everything got
> sorted out.

Well, I hope you also removed the creation of triggers within
your java code.

-- 
Galen Boyer



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

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