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

Today's topics:

* Using BigInteger - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7be97102e1c754
* Inconsistent results of org.w3c.dom-based code evoked from different programs - 1 
messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2b4b6e41c6c1ec6
* MathFP - atan2 - 5 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4568ec7fc8654bd8
* version -> speed? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a63fd0f945fa2e4f
* writeObject and readObject problem - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e6fc9480a3a7f42a
* Tutorial/Help on programming Genetic Algroithms in Java/C++ - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d70b46d726e33955
* Socket problem -- response slow for host with domain (on SunOS 5.8) - 1 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfb84c34caf0c9e9
* Problem with Struts 1.1 and select box - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f2609668a5d78566
* javac for J2ME - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a92d0c7d82c93863
* read binary data from C file??? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c04d04f749f5ae1f
* Question About LinkedList - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7190a07093aa978f
* Is an extension of ".xslt2" a must for xslt stylesheets of spec 2.0 ? - 3 messages, 
2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/185fded1ba905165
* tomcat and multiple users with windows 2000 - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a4cb5b8675ccf091
* A Beginner Question - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a9aad5a41bf9769
* JMX registerMBean problem/question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/675548ca531a2629
  
==========================================================================
TOPIC: Using BigInteger
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7be97102e1c754
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 1:28 am
From: Babu Kalakrishnan <[EMAIL PROTECTED]> 

Jeremy Watts wrote:
> I've been trying to use the 'BigInteger' feature with no success - cant seem 
> to find any examples of code that for instance adds or subtracts two big 
> integer numbers.
> 
> How do you actually use BigInteger to do arithmetic on large integer 
> numbers??  Could someone give me some code examples please
> 

All operations on BigInteger numbers must be performed using the methods 
provided (such as add, subtract, multiply etc) - You cannot write them 
as expressions. e.g. If you want to add a and b which are BigIntegers, 
you have to do

BigInteger c = a.add(b);

Look at the API docs for the methods available.

BK




==========================================================================
TOPIC: Inconsistent results of org.w3c.dom-based code evoked from different programs
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2b4b6e41c6c1ec6
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 1:38 am
From: [EMAIL PROTECTED] (Bryan) 

"xarax" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> "Bryan" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi there,
> >
> > I ran into a kind of strange behavior of Java code. Maybe the reason
> > is obvious but I cannot figure it out ...
> >
> > Suppose I have a xml file and from the field "<footag>bar
> > text</footag>" I simply want to extract "bar text". The following is
> > my code:
> >
> > /**************************/
> > import org.w3c.dom.*;
> > .
> > .
> > .
> >
> > String text;
> > Node textFieldNode;
> > .
> > .
> > . //textFieldNode now points to the field.
> >
> > //code A:
> > NodeList myLs = textFieldNode.getChildNodes();
> > for (int ii = 0; ii < myLs.getLength(); ii++) {
> >    if (myLs.item(ii) instanceof Text)
> >    text = myLs.item(ii).getNodeValue();
> > }
> >
> > //code B:
> > text=textFieldNode.toString().replaceAll("<[/]*"+"footag"+">","");
> > .
> > .
> > .
> > /**********end of code********/
> >
> > The problem is: Both code A and B generate the right result ("bar
> > text") when I test it. But when I include this class into a .jar file
> > and try to call it from within another package, code A generates,
> > still, the right result but code B assigns "[footage: null]" to text.
> 
> You wrote "footage", instead of "footag".
Oops. That's a typo occurred when I tried to make up the example to
illustrate the problem. Sorry about that...
> 
> > Just keen to know why the code works so differently.
> >
> > Thanks in advance!
> >
> > Regards,
> > Bryan




==========================================================================
TOPIC: MathFP - atan2
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4568ec7fc8654bd8
==========================================================================

== 1 of 5 ==
Date:   Thurs,   Sep 23 2004 1:44 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Marek wrote:

> When I try use function atan2 form MathFP 2.0.5 or 2.0.5 I receive strange
> result.

The results are not strange, they are correct. The results you posted for
C++/Delphi are wrong.

> Below you can see test result form C(BC++5.5.1, and Delphi) and java(jdk
> 1.4)
> 
> MathFP:
> atan2(toFP(1), toFP(1))    = 0.78539
> atan2(toFP(1), toFP(-2))   = 2.67795 <- difference
> atan2(toFP(-1), toFP(1))   =-0.78539
> atan2(toFP(-1), toFP(-1))  =-2.35619 <- difference
> 
> C++/Delphi:
> atan2(1, 1)    = 0.7854
> atan2(1, -2)   = -3.6054 <- difference
> atan2(-1, 1)   = -0.7854
> atan2(-1, -1)  = -3.9270 <- difference
> 
> Can you tell me why? What I do wrong?

What you did wrong was not post the C++/Delphi code you used to acquire the
results -- those results are wrong.

My Java test program:

public class Test {
   
   public static void main(String[]args) throws Exception
   {
      double[][] data = {
         {1,1},
         {1,-2},
         {-1,1},
         {-1,-1}
      };
      for(int i = 0;i < data.length;i++) {
         double x = data[i][0];
         double y = data[i][1];
         System.out.println(Math.atan2(x,y));
      }
   }
};

The results:

0.7853981633974483
2.677945044588987
-0.7853981633974483
-2.356194490192345


My C++ program:

#include <iostream>

using namespace std;

int main(int argc,char *argv[])
{
        cout << atan2((double)1,(double)1) << endl;
        cout << atan2((double)1,(double)-2) << endl;
        cout << atan2((double)-1,(double)1) << endl;
        cout << atan2((double)-1,(double)-1) << endl;
        return 0;
}

The results:

0.785398
2.67795
-0.785398
-2.35619

-- 
Paul Lutus
http://www.arachnoid.com




== 2 of 5 ==
Date:   Thurs,   Sep 23 2004 2:16 am
From: "Marek" <[EMAIL PROTECTED]> 

> What you did wrong was not post the C++/Delphi code you used to acquire
the
> results -- those results are wrong.
Yes, you right. I got mixed up c/Delphi with Java. Sorry

MathFP:
atan2(toFP(1), toFP(1))    = 0.78539
atan2(toFP(1), toFP(-2))   = -3.6054 <- difference
atan2(toFP(-1), toFP(1))   = -0.78539
atan2(toFP(-1), toFP(-1))  = -3.9270 <- difference

C++/Delphi:
atan2(1, 1)    = 0.7854
atan2(1, -2)   = 2.67795 <- difference
atan2(-1, 1)   = -0.7854
atan2(-1, -1)  = -2.35619 <- difference

-------------
java:
import net.jscience.math.kvm.MathFP;

public class C1{
  C1(){
    int a = MathFP.atan2(MathFP.toFP(-1), MathFP.toFP(-1));
    System.out.println(MathFP.toString(a));
  }
  public static void main(String[] arg){
 new C1();
  }
}

-----------------
C:
#include <iostream.h>
#include <math.h>

int main(){
 cout << atan2(-1, -1) << endl;
 return 0;
}





== 3 of 5 ==
Date:   Thurs,   Sep 23 2004 2:40 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Marek wrote:

>> What you did wrong was not post the C++/Delphi code you used to acquire
> the
>> results -- those results are wrong.
> Yes, you right. I got mixed up c/Delphi with Java. Sorry
> 
> MathFP:
> atan2(toFP(1), toFP(1))    = 0.78539
> atan2(toFP(1), toFP(-2))   = -3.6054 <- difference
> atan2(toFP(-1), toFP(1))   = -0.78539
> atan2(toFP(-1), toFP(-1))  = -3.9270 <- difference

Show me the source for the method you are using here. What is toFP()? What
is atan2(), because it is not Math.atan2(). You are asking for advice about
a package you do not provide any information about.

IOW post a complete, short, compilable, working example of your code,
including any external packages.

> import net.jscience.math.kvm.MathFP;

Why are you not using the standard Java classes that are provided for this
purpose? Why are you not telling the maintainers of this package that their
code is broken (http://jscience.org)?

As a last resort, you could show us the source for the methods you are
using, so we can tell you how its programmers went wrong. If you cannot get
the source, maybe it would be better if you didn't use this package.

-- 
Paul Lutus
http://www.arachnoid.com




== 4 of 5 ==
Date:   Thurs,   Sep 23 2004 3:03 am
From: "Marek" <[EMAIL PROTECTED]> 


> Show me the source for the method you are using here. What is toFP()? What
> is atan2(), because it is not Math.atan2(). You are asking for advice
about
> a package you do not provide any information about.
I haven't external package source, only class files.

> Why are you not using the standard Java classes that are provided for this
> purpose?
Because I develop programs for J2ME. This platfom haven't float point
arithmetic.

Why are you not telling the maintainers of this package that their
They don't answer me

> code is broken (http://jscience.org)?
Maybe

> As a last resort, you could show us the source for the methods you are
> using, so we can tell you how its programmers went wrong. If you cannot
get
> the source, maybe it would be better if you didn't use this package.
I need ArcTan2 function work without float point arithmetic.

irek





== 5 of 5 ==
Date:   Thurs,   Sep 23 2004 3:22 am
From: Thomas Richter <[EMAIL PROTECTED]> 

Hi,

> MathFP:
> atan2(toFP(1), toFP(1))    = 0.78539
> atan2(toFP(1), toFP(-2))   = -3.6054 <- difference
> atan2(toFP(-1), toFP(1))   = -0.78539
> atan2(toFP(-1), toFP(-1))  = -3.9270 <- difference

>From a mathematical p.o.v, these results are fine. Angles are
only defined mod 2Pi, and -3.6054 = 2.67795 mod 2Pi, so the
result is ok. Typically, one wants atan2 to end up in the interval
(-Pi,Pi], though.

So long,
        Thomas




==========================================================================
TOPIC: version -> speed?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a63fd0f945fa2e4f
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 23 2004 1:45 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Peter wrote:

> Hi
>    Same java program, if i use jdk5.0 to compile it, it will run
> faster than compiled by 1.4.2?

Is that a question? What program? What results did you acquire in answering
your question?

-- 
Paul Lutus
http://www.arachnoid.com




== 2 of 2 ==
Date:   Thurs,   Sep 23 2004 2:29 am
From: Jacob <[EMAIL PROTECTED]> 

Peter wrote:

>    Same java program, if i use jdk5.0 to compile it, it will run
> faster than compiled by 1.4.2?

It probably depends on many factors.

My experience is that Java2D at least has
significantly better performace in 1.5.





==========================================================================
TOPIC: writeObject and readObject problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e6fc9480a3a7f42a
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 23 2004 1:45 am
From: "juicy" <[EMAIL PROTECTED]> 

So terrible i get message like this
java.lang.ClassNotFoundException
        at java/io/ObjectInputStream.loadClass0
        at java/io/ObjectInputStream.resolveClass
        at java/io/ObjectInputStream.readClassDescriptor
        at java/io/ObjectInputStream.readNewObject
        at java/io/ObjectInputStream.readObject
        at java/io/ObjectInputStream.goToEndOfBlockData
        at java/io/ObjectInputStream.readNewObject
        at java/io/ObjectInputStream.readObject
        at com/ms/!!!Internal_Class_0.DefaultReadMethod
        at java/io/ObjectInputStream.invokeDefaultReadObject
        at java/io/ObjectInputStream.defaultReadObject
        at java/io/ObjectInputStream.readNewObject
        at java/io/ObjectInputStream.readObject
        at MainVirtual.run
        at java/lang/Thread.run

:( What should i do now?




== 2 of 2 ==
Date:   Thurs,   Sep 23 2004 2:24 am
From: Gordon Beaton <[EMAIL PROTECTED]> 

On Thu, 23 Sep 2004 04:45:40 -0400, juicy wrote:
> So terrible i get message like this
> java.lang.ClassNotFoundException
>       at java/io/ObjectInputStream.loadClass0
>       at java/io/ObjectInputStream.resolveClass
>       at java/io/ObjectInputStream.readClassDescriptor
>       at java/io/ObjectInputStream.readNewObject
>       at java/io/ObjectInputStream.readObject
>       at java/io/ObjectInputStream.goToEndOfBlockData
>       at java/io/ObjectInputStream.readNewObject
>       at java/io/ObjectInputStream.readObject
>       at com/ms/!!!Internal_Class_0.DefaultReadMethod
>       at java/io/ObjectInputStream.invokeDefaultReadObject
>       at java/io/ObjectInputStream.defaultReadObject
>       at java/io/ObjectInputStream.readNewObject
>       at java/io/ObjectInputStream.readObject
>       at MainVirtual.run
>       at java/lang/Thread.run
> 
>:( What should i do now?

The process that did ObjectInputStream.readObject() doesn't have
access to a class definition that corresponds to the received object.
For example, you can't send an object "foo" of class MyClass to the
server, unless the server knows what MyClass is.

If the server doesn't need to actually *do* anything with the object
except immediately resend it on the ObjectOutputStream, let it read
the raw bytes from the SocketInputStream instead, and resend them on
the SocketOutputStream. That way it never has to create the object
itself.

/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: Tutorial/Help on programming Genetic Algroithms in Java/C++
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d70b46d726e33955
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Sep 23 2004 1:47 am
From: [EMAIL PROTECTED] (Ruben Hoste) 

Hello, I'm currently looking for more information on Genetic
Algorithms and more specifficaly on how to program them in Java or
C++. This is all concerning my thesis.
A lot of general information about GA's, what they are and how they
generally work I already found on the web, but I'm looking for some
more information on how to actually program them.
Is there a certain programming language preferably to use to program
the GA?
Has anyone help with some basic code I can use to study on?
In fact all help on programming GA's is more then welcome!

Thx a lot!

Ruben



== 2 of 3 ==
Date:   Thurs,   Sep 23 2004 2:28 am
From: Paul Lutus <[EMAIL PROTECTED]> 

Ruben Hoste wrote:

> Hello, I'm currently looking for more information on Genetic
> Algorithms and more specifficaly on how to program them in Java or
> C++. This is all concerning my thesis.
> A lot of general information about GA's, what they are and how they
> generally work I already found on the web, but I'm looking for some
> more information on how to actually program them.

"program them -> write them in source code". Yes?

> Is there a certain programming language preferably to use to program
> the GA?

If that were true, the name wouldn't apply. By definition, they are not
language-specific.

> Has anyone help with some basic code I can use to study on?

What? Maybe you could work on your sentence structure as you move toward the
goal of writing clear computer programs.

> In fact all help on programming GA's is more then welcome!

more then -> more than

-- 
Paul Lutus
http://www.arachnoid.com




== 3 of 3 ==
Date:   Thurs,   Sep 23 2004 2:39 am
From: bugbear <[EMAIL PROTECTED]> 

Ruben Hoste wrote:
> Hello, I'm currently looking 

Try google.

> for more information on Genetic
> Algorithms and more specifficaly on how to program them 
> in Java 
http://www.systemtechnik.tu-ilmenau.de/~pohlheim/EA_Java/ea_java.html

 > or C++.
http://lancet.mit.edu/ga/

      BugBear




==========================================================================
TOPIC: Socket problem -- response slow for host with domain (on SunOS 5.8)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfb84c34caf0c9e9
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 2:03 am
From: Nigel Wade <[EMAIL PROTECTED]> 

Nishi Bhonsle wrote:

> 
> 
> Nigel Wade wrote:
> 
>> Nishi Bhonsle wrote:
>>
>> >
>> > Hi:
>> >
>> > I have a servlet application deployed in OC4J. One of the page of the
>> application takes the value for a smtpServer entered by the user from the
>> client(value is a string), checks whether the value is valid  in the
>> following backend code --
>> >
>> > try
>> > {
>> > //if you can open a socket on the smtp host at port 25, then it is a
valid
>> smtp host
>> > Socket smtpSocket = new smtpSocket("smtpServerVal", 25);
>> > ...
>> > ...
>> > }
>> > catch(UnknownHostException uhe)
>> > {
>> > ..
>> > ....
>> > }
>> > catch(IOException ioe)
>> > {
>> > ...
>> > ...
>> > }
>> > where smtpServerVal is the value entered through the client
UI(browser).
>> >
>> > I noticed that when I pass
>> > Socket smtpSocket = new smtpSocket("yahoo", 25);
>> > I get the UnknownHostException immediately(response is quick) and the
page
>> returns.
>> >
>> > But when I pass
>> > Socket smtpSocket = new smtpSocket("yahoo.com", 25);
>> > The response of IOException takes a rather long time.. i.e. the page
takes
>> almost after 30 secs or more to return.
>> >
>> > I observe this slower response only when the backend code is run on a
>> solaris 8 machine, not on windows XP or 2000.
>> > Is this a known issue? How can I resolve this if any?
>> >
>> > Thanks, Nishi.
>>
>> Most likely one of two issues is involved here.
>>
>> The first is DNS. Any time a failure takes "around 30s" I think DNS. This
is
>> the usual timeout for the resolver libraries if they get no response from
a
>> DNS server. Check whether DNS is working correctly on the Solaris
machine.
>>
>> The second issue is firewalls. If there's a firewall in the way which
drops
>> rather than rejects packets destined for port 25 then you'll get a
timeout
>> delay. But I'd expect that to be considerably longer than 30s.
>>
>> Of course it could be a combination of the two, a firewall which is
>> dropping/rejecting the DNS responses from the DNS server...
>>
>> Without knowing what the constructor for smtpServer(String,int) does I
can't
>> say more.
> 
> The constructor Socket smtpSocket = new smtpSocket("smtpServerVal", 25);
> creates a stream socket ad connects it to the specified port number on the
named host
> here host = smtpServerVal (This is the Outgoing Mail Server hostname)
> port=25.
> (Got this information from java.net.Socket)
> 
> There is a firewall, but its the same for the windows machine too, so why
would the firewall on the solaris box cause such a big delay?

How many firewalls, if it's the same as for Windows as it is for Solaris,
what is "the firewall on the solaris box"? External firewalls can have
specific rules for each host, so could be setup correctly for the Windows
box and incorrectly for the Solaris box. 

> How can I check whether the DNS is working correctly on the machine?

Use nslookup to get the DNS entry for a hostname directly from your DNS
servers. If you get a proper response DNS is ok, and something else is
wrong. If you don't get a proper response use snoop (as root) to listen to
the network and detect packets going to and from the DNS server (use the
command 'snoop port 53') which should show you where the request is being
sent to, and whether any sort of response is coming back.

-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
            University of Leicester, Leicester, LE1 7RH, UK 
E-mail :    [EMAIL PROTECTED] 
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555




==========================================================================
TOPIC: Problem with Struts 1.1 and select box
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f2609668a5d78566
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 2:09 am
From: "cccc" <[EMAIL PROTECTED]> 

Hi,
I have a problem with this java code:

I want populate a select box with Jakarta Struts 1.1

<%
String multipleValues[] =
   { "Multiple 0", "Multiple 1", "Multiple 2", "Multiple 3", "Multiple 4",
     "Multiple 5", "Multiple 6", "Multiple 7", "Multiple 8", "Multiple 9" };
pageContext.setAttribute("multipleValues", multipleValues);
%>

<html:select property="multipleSelect" size="10" multiple="true">
    <html:options name="multipleValues" labelName="multipleValues"/>
</html:select>

Can you help me?

Ciao,
Carlo






==========================================================================
TOPIC: javac for J2ME
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a92d0c7d82c93863
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Sep 23 2004 2:43 am
From: Jacob <[EMAIL PROTECTED]> 

I know I can use the ktoolbar program to compile
code for the CDLC, but what is the javac equivalent?

I think it involves specifying -Xbootclasspath,
but I haven't found exactly how.

Thanks!




== 2 of 3 ==
Date:   Thurs,   Sep 23 2004 3:28 am
From: JScoobyCed <[EMAIL PROTECTED]> 

Jacob wrote:

> I know I can use the ktoolbar program to compile
> code for the CDLC, but what is the javac equivalent?
> 
> I think it involves specifying -Xbootclasspath,
> but I haven't found exactly how.
> 
> Thanks!
> 

All you need is to have the cdlc.jar and midp.jar in your classpth, then 
use javac normally:

javac -cp .;midp20.jar;cdlc10.jar;.\src\ com.foo.MyMIDP.java

-- 
JScoobyCed
What about a JScooby snack Shaggy ? ... Shaggy ?!



== 3 of 3 ==
Date:   Thurs,   Sep 23 2004 4:17 am
From: Jacob <[EMAIL PROTECTED]> 

JScoobyCed wrote:

>> I know I can use the ktoolbar program to compile
>> code for the CDLC, but what is the javac equivalent?
>>
>> I think it involves specifying -Xbootclasspath,
>> but I haven't found exactly how.
>>
>> Thanks!
>>
> 
> All you need is to have the cdlc.jar and midp.jar in your classpth, then 
> use javac normally:
> 
> javac -cp .;midp20.jar;cdlc10.jar;.\src\ com.foo.MyMIDP.java

But I need to make sure rt.jar is *not* in my classpath,
shouldn't I? I think it is by default?






==========================================================================
TOPIC: read binary data from C file???
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c04d04f749f5ae1f
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 23 2004 2:27 am
From: "Boudewijn Dijkstra" <[EMAIL PROTECTED]> 

"John Adams" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Hi,
>
>    I am sorry if this has been asked before but I couldn't find any hint
> scheming through the list. So here is my problem:
>
>    I have to write a client end in java reading data sent over UDP from
> a server (the server is written in C). The data format is a C struct
> with all the fields including long, int, float, etc. I got the data in
> the java client end in the format of a DatagramPacket, then I convert it
> to a byte array. Now the question is, how do I extract each field from
> the byte array? I know this is silly but I have tried using classes like
> ByteBuffer, Array, etc, without good result (The print out of the
> recieiving end differs than that from the sending end).

Experiment with a few struct values to find out where each byte ends up in the
array.  Then use << and | to fill ints and longs.  If you want floats and
doubles, use Float.intBitsToFloat() and Double.longBitsToDouble().





== 2 of 2 ==
Date:   Thurs,   Sep 23 2004 3:16 am
From: Gordon Beaton <[EMAIL PROTECTED]> 

On Wed, 22 Sep 2004 16:53:23 -0400, John Adams wrote:
>    I have to write a client end in java reading data sent over UDP
> from a server (the server is written in C). The data format is a C
> struct with all the fields including long, int, float, etc. I got
> the data in the java client end in the format of a DatagramPacket,
> then I convert it to a byte array. Now the question is, how do I
> extract each field from the byte array?

Others have already pointed out how you can read the data, however
it's worth mentioning that if the server gets recompiled with a
different compiler, or moved to a different platform (with no changes
to the data types) it could break your client.

The real solution is to change the server so that it doesn't write the
data in a format that is quite so compiler and platform dependent.

Writing raw binary data directly from a C struct is lazy, fragile and
non-portable. And as you've already discovered, it makes it difficult
and error prone to write a client in a different language, that
doesn't use the same compiler, or that will run on a different
hardware platform.

/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: Question About LinkedList
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7190a07093aa978f
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 23 2004 2:35 am
From: "Boudewijn Dijkstra" <[EMAIL PROTECTED]> 

"Edward H. Fabrega" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> My program will implement a flat file database (non-relational). I haven't
> started to code yet, as I'm transitioning from C++ MFC to Java. Using MFC I
> was able to do this with a linked list of StringArrays. In Java, I'm
> thinking about doing it with a LinkedList of ArrayLists, where each item in
> each ArrayList is a String. This will model the records. I will have a
> simple ArrayList to model the column labels.
>
> My question is: is there a better data model for a database that is
> achievable with the API? A store bought component or something from a third
> party API is not possible. I'm not worried about the UI at this point, only
> the data.

It depends.  For random access, LinkedList is very slow compared to ArrayList.
For adding and removing elements in a not-so-big list, LinkedList is slow
compared to ArrayList.  Also, LinkedList uses more memory per element than
ArrayList.





== 2 of 2 ==
Date:   Thurs,   Sep 23 2004 3:45 am
From: Frank <[EMAIL PROTECTED]> 

Edward H. Fabrega wrote:
> My program will implement a flat file database (non-relational). I haven't 
> started to code yet, as I'm transitioning from C++ MFC to Java. Using MFC I 
> was able to do this with a linked list of StringArrays. In Java, I'm 
> thinking about doing it with a LinkedList of ArrayLists, where each item in 
> each ArrayList is a String. This will model the records. I will have a 
> simple ArrayList to model the column labels.
> 
> My question is: is there a better data model for a database that is 
> achievable with the API? A store bought component or something from a third 
> party API is not possible. I'm not worried about the UI at this point, only 
> the data. 
> 

What are you trying to accomplish?

Implementing a general-purpose 'database' sounds like a poor idea. If 
you're trying to come up with a solution for something specific, we need 
more details to give reasonable advice on data structures. How/if the 
data set is manipulated at runtime, data access patterns and so on.

Read up on the collections API here:
http://java.sun.com/docs/books/tutorial/collections/index.html

-Frank




==========================================================================
TOPIC: Is an extension of ".xslt2" a must for xslt stylesheets of spec 2.0 ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/185fded1ba905165
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Sep 23 2004 2:40 am
From: "John  Keyes" <[EMAIL PROTECTED]> 

Hi Ken,

>From XSLT Version 2.0 Working Draft (http://www.w3.org/TR/xslt20/)

"The value of the version attribute must be a number (specifically, it
must be a DecimalLiteral  XP as defined in [XPath 2.0].) For this
version of XSLT, the value should normally be 2.0. A value of 1.0
indicates that the stylesheet module was written with the intention
that it should be processed using an XSLT 1.0 processor."

This is how XSLT processors determine the version.

For example:
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns="http://www.w3.org/1999/xhtml";>

Ken Philips wrote:
> If I want to use featurwes of Xslt Spec 2.0: Do I have to use an
extension
> of .xslt2 or can use .xslt as well?
> 
> Ken




== 2 of 3 ==
Date:   Thurs,   Sep 23 2004 3:15 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

John  Keyes <[EMAIL PROTECTED]> scribbled the following:
> Hi Ken,

>>From XSLT Version 2.0 Working Draft (http://www.w3.org/TR/xslt20/)

> "The value of the version attribute must be a number (specifically, it
> must be a DecimalLiteral  XP as defined in [XPath 2.0].) For this
> version of XSLT, the value should normally be 2.0. A value of 1.0
> indicates that the stylesheet module was written with the intention
> that it should be processed using an XSLT 1.0 processor."

> This is how XSLT processors determine the version.

> For example:
> <xsl:stylesheet
> version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> xmlns="http://www.w3.org/1999/xhtml";>

> Ken Philips wrote:
>> If I want to use featurwes of Xslt Spec 2.0: Do I have to use an
> extension
>> of .xslt2 or can use .xslt as well?
>> 
>> Ken

I suppose that means you don't have to name the file with a ".xslt2"
extension. Is that true?

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"War! Huh! Good God, y'all! What is it good for? We asked Mayor Quimby."
   - Kent Brockman



== 3 of 3 ==
Date:   Thurs,   Sep 23 2004 3:52 am
From: "John  Keyes" <[EMAIL PROTECTED]> 

That is correct, you do not have to name the file with a ".xslt2"
extension.





==========================================================================
TOPIC: tomcat and multiple users with windows 2000
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a4cb5b8675ccf091
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 3:06 am
From: "Generale Cluster" <[EMAIL PROTECTED]> 

Hello,
I'm trying to setup a server with windows 2000 and tomcat installed.
I need to provide tomcat to multiple users, each one having access to his
own webapps.
Is it possible to configure tomcat so that each user can manage his own apps
without affecting other users' applications?
I've read about running multiple instances under linux with -Dcatalina_home
parameter, but how can I manage it in win2k?
Moreover, is it possible to share a single instance of tomcat among
muiltiple users?
Are there security issues related to this?

Thank you
Alex.

-- 
elimina unsampdoriano per rispondere via email






==========================================================================
TOPIC: A Beginner Question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a9aad5a41bf9769
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 23 2004 2:57 am
From: "Rowland" <[EMAIL PROTECTED]> 


"Qingnan Zhou" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello, I am very new to Java.
> In C++, I can use #include to include other .cpp files.
> In Java, I know I am suppose to use import key word, but what type of
> file should follow import? .class or .java or neither?
>
> Thanks.
>
> James

In Java, you don't import files as such, you import packages and classes.
So, if I want to import the Vector class to hold a lsit in, I would use

import java.util.Vector;

Here, java.util is the package, and Vector is the class.

However, java.util has LOTS of very useful classes -
http://java.sun.com/j2se/1.4.2/docs/api/java/util/package-frame.html - and I
might want to import them all, so I use

import java.util.*;

Now I can create a Vector:

Vector v = new Vector();

Sometimes, I don't want to import the class, as I only use it once, or the
name conflicts with another class. Then, I might just use a fully qualified
class name, without any code...

java.util.Vector v = new java.util.Vector(); // This will not require an
import statement.

When you compile your program, you need to make sure you have told the
compiler where to find the classes/packages you have imported by using
the -classpath switch, or setting the CLASSPATH environment variable.

If you do a google search, or go to java.sun.com, there is FAR more
information out there on all these concepts - I suggest you read it
through - classes and packages are very confusing to begin with, but really
useful when you use them properly.





== 2 of 2 ==
Date:   Thurs,   Sep 23 2004 3:33 am
From: Joona I Palaste <[EMAIL PROTECTED]> 

Qingnan Zhou <[EMAIL PROTECTED]> scribbled the following:
> Hello, I am very new to Java.
> In C++, I can use #include to include other .cpp files.
> In Java, I know I am suppose to use import key word, but what type of
> file should follow import? .class or .java or neither?

These are very different concepts. In C or C++, the #include directive
fetches the physical source code text from another file (which may have
any extension you like, .h, .c, .cpp, .c++, or whatever) and inserts it
into your source code as if you had typed it there yourself.
In Java, the import directive doesn't fetch any text from any file
anywhere. What it does is import a *NAME* - this is similar to C++'s
namespaces. For example, "import com.foocorp.util.Blah;" means "from
now on, any unqualified class name Blah means com.foocorp.util.Blah".
"import com.foocorp.util.*;" means "from now on, any unqualified names
that aren't found elsewhere are searched in com.foocorp.util". I don't
know my C++ that well, but I think "using namespace" does a similar
thing.
The actual Java source code remains perfectly safe in the other .java
files, the compiler doesn't do anything special about them.

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Ice cream sales somehow cause drownings: both happen in summer."
   - Antti Voipio & Arto Wikla




==========================================================================
TOPIC: JMX registerMBean problem/question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/675548ca531a2629
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 3:53 am
From: [EMAIL PROTECTED] (Mario Lassnig) 

Hello all,

I have a separate JMX server which manages all MBeans. This server
works okay, no problem with that. Now what I need to do is the
following:
Some objects in other classes which are already running need to
register themselves with the JMX server. The problem is, i did not
find a way to do this at runtime via the registerMBean call to the
MBean server, because it is simply not available. What is available is
the createMBean call, which of course is not what I am looking for,
because it would instantiate a new object.
(the clients currently connect via rmi to the JMX server)
The question is the following: how can I connect a running object to a
JMX MBean Server running in another VM (that's why findMBeanServers
from the factory doesn't work) and register it there?
(jdk1.5-rc)

Many thanks in advance.



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

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