Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

tony hutcheson

Ranch Hand
+ Follow
since Dec 08, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by tony hutcheson

parmeet,
Are you complaining that you didn't win? I have seen your multiple posts this past week, in fact I have responded to one of them. I hope that you gained some knowledge in XML from your increased participation.
It would be nice to win a book, but I am thankful that this forum is available to us. Winning a book would be a bonus, but I think the help that I have recieved from JavaRanch has been more valuable. Many times I learn more when I try to answer others questions.
Let's congratulate the winners and not envy their good fortune! Better luck to you next time.
I am not sure how to help you get output. I am fairly new to XML also, but I can tell you what I did.
I followed an example in "Beginning XML" from Wrox Press which instructed me to use XT, which is available from http://www.jclark.com/xml/xt.html, as the transformation engine. I then ran xt.exe from the command line:
xt <name of xml file> <name of xsl file> <optional: name of output file>
If you leave out the output file the result of the transformation will appear in the command prompt window. This worked for me and gave me the results I expected.
I would suggest finding a simple example of using XSLT in a book or on a website and try to duplicate it's results, then apply that to your xml and xsl files to see what happens.
Good luck!
I hope the following helps:
<xsl:template match="numbers"> indicates that we want to work with the <numbers> node(s).
After that is a list from A through N. The left of "=" describes what we want to do in terms that we can understand outside of xsl. The right of "=" shows how this is done in xsl.
For example:
<xsl:value-of select="x+y"/> says to take the value of the nodes <x> and <y> (remember we are dealing with children of <numbers> ), and add them together to get the desired result. In this case we would get an out put of 7.2.
I hope this helps.
I know this was posted a long time ago, but I wanted to respond because it helped answer a question I had.
I tried "creating" a database with Star Office and was frustrated rather quickly. The help files were not very clear from the start that SO does not have the stuff to create a database, only to connect to them (unless you install Adabas D). I will try either DB2 or Adabas and then connect it to SO.
Star Office has not disappointed, just frustrated a couple of times. Knowing is more than half the battle.
21 years ago
This is only #36
Oh well, only one way to go.
21 years ago
Cool, now I know how to figure out my number of posts!!
21 years ago
From what I understand, neither is an example of Polymorphism. However, method overriding is a part of it.
From "Beginning Java 2" by Ivor Horton: "Polymorphism...means the ability of a single variable of a given type to be used to reference objects of different types, and to automatically call the method that is specific to the type of object the variable references." (p231 JDK1.3 edition)
example (also from the above mentioned book):
public class Animal{
private String type;
public Animal(String aType,){
type = new String(aType);
}
public String toString() {
return "This is a " + type;
}
}
public class Dog extends Animal{
private String name;
public Dog(String name){
super("Dog");
name = new String(aName);
}
public String toString() {
return super.toString() + " It's name is " + name;
}
}
public class Cat extends Animal{
private String name;
public Cat(String name){
super("Cat");
name = new String(aName);
}
public String toString() {
return super.toString() + " It's name is " + name;
}
}
You can then do the following:
Animal[] theAnimals = { new Dog("Rover"), new Cat("Max")};
System.out.println(theAnimals[0]);
System.out.println(theAnimals[1]);
and you would get -
This is a dog It's name is Rover
This is a cat It's name is Max
That is polymorphism - where the Animal class can refer to the objects of the Dog and Cat class and use the appropriate methods.
Hope this helps.
21 years ago
I have a guess. Do you live in the Central time zone? Because
January 1, 1970, 00:00:00 GMT
is the same as
December 31, 1969, 18:00:00 CST
It then adjusted for the time zone on your computer.
Hope that helps.
21 years ago
I believe your problem is that you are comparing strings using '=='. Since a string is an object, '==' compares if the references to the string are equal.
What you need to use is String.equals() as in :
if ( pass.equals( p ) ) .....
This will compare the contents and not the references. I hope this is clear.
p.s. for not equals you would put
if ( !pass.equals( p )) .....
[This message has been edited by tony hutcheson (edited March 20, 2001).]
21 years ago
I am sorry. I only have the class files. However, I do not have a problem with it returning null. The problem occurs when it returns a string of 'len' length, but filled with null bytes. So if you get the length of the string it will give you whatever the value of 'len' is, but it will contain all null values. I did not know if this is something about the way that java handles ByteArrayOutputStreams. The only solution that I can think of is creating a string :
nullStr = new String( new byte[len] )
and comparing it thus:
str.equals( nullStr )
although I am not sure that this will work.
21 years ago
IBM's MQSeries is being used in the following:
MQMessage msg;
int len = 5;
String str = msg.readString(len);
The underlying class for MQMessage is a byte[]. It creates ByteArrayOutputStreams to read from.
What happens is str ends up with a value of null bytes and I get false with the following comparisons:
str.equals(null) results in false
str == null results in false
str.equals( new String() ) results in false
It doesn't appear to be specific to MQSeries but I do not know. Does anyone know of how to solve this in Java so that I can determine if str actually read something in?
21 years ago
I am just starting to learn XML and already see many advantages. Thank you for this discussion. Many good points were made that helped me understand XML better. I am involved in a project to integrate a legacy system with ours where the legacy system is sending data in flat files (they won't use XML), but we are mapping the data to XML so our web based app can use it. We hope the XML will be a standard for future legacy integrations.
a note to Yoo-Jin Lee: You can use a "d" to designate a double. It is understood to be there if you do not put it. Therefore, it is a valid assignment.
Another voice from someone who has been there: Swing is not tested on the exam.
Layout managers are on the exam. I know you didn't ask but I felt the need to say it.
thanks for your time here at javaranch Floyd. note: I don't believe Carl Sagan ever said "billions and billions" - it was a false caricature of him hosting Cosmos
21 years ago