Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

Gerald Luckenbill

+ Follow
since Nov 05, 2003
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gerald Luckenbill

I am looking for sample code on how to create a method with the signature
Collection getOptions();
and populate it with Strings that will serve as the value and property for html ptions. (I am finding this tricky since Collection is an interface rather than a class - so I just want some sample code to see how it is done)
Ultimately what I am trying to do is populate an html:select and then the options - I was told that if I have a method with the above signature then the code in the jsp would look like:
<html:select property="someProperty"> (BTW - what does this someProperty have any meaning here>
<html ptions property"options"/>
I want to use this approach rather than some others where I have to use separate beans, because I can use the ActionForm of this jsp to store my data for the list/menu widget.
16 years ago
I am trying to set the priority of a message that is sent to a queue:
My code:
Message message = my_session.createMessage();
System.out.println("set priority to 8 for zero byte");
System.out.println("default priority is: " + message.getJMSPriority());
System.out.println("after set priority is: " + message.getJMSPriority());
is not working in that when you look at the queue (IBM MQ series BTW) the message has a priority of 4. Even though my last call to message.getJMSPriority()); in the above code returns an 8.
I can successfully set the priority on the Queue object but I need to set it at the message level?
Many Thanks
I was told you can get the java process id (OS thing) from within the java program - someone told me I could get it from some method in the Thread arena but I can't find it.
Many Thanks
try setting the preferredSize of the JLabel
JLabel myLabel = new JLabel("Some Text");
myLabel.setPreferredSize(new Dimension(100,50));
//then add to the layout manager
I don't know what you are doing but you might want to embed your label in a JPanel to make it look better and then add the JPanel to the borderLayout - again, just make sure you set the preferred Sizes of the components or they won't show up.
16 years ago
Thanks for the replies.
Could you be more specific? What class is this from:
You can get the "OUTBOUND" element with Document#getDocumentElement(). Then you can access "NAME", "FILENAME", "ID", and "SUM" with Node#getChildNodes(). The value of each element can be obtained using Node#getNodeValue().
Any code samples?
Also, from the examples I have seen is there anyway I can use the dom or sax parsers or something else without having an actual xmlFile - my program has an xml string that I am reading off a queue, that I need to parse.
Many Thanks!
Hopefully this is a really easy question for someone - I am looking for the easiest way to extract the values out of this xml string: I am limited to using Java 1.3. The tag names will always be the same. Is there an existing Java class/api, which will do this - or do I have to just string parse this thing.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<NAME>Joe Blow</NAME>
To be clear I need to extract, Joe Blow, c:\\tmp\\SampleFile.txt, etc. from this string.
Many Thanks!
I want to be able to read a file, from the file system line by, basically delimited by \n (new line character).
Then I need to get the size of that line in bytes. And then I will do some processing with that line, which is basically appending it to a buffer with some massaging.
What I don't want to do is read the whole file into a String Buffer at one time and then do my parsing with the StringBuffer - the issue is my file could be extremely large and I am supposed to break my processing into chucks when I hit a certain size.
So, in summary, how do I read a file line by line and then get the size in bytes of that line. I am assuming I will use FileReader but I can only find examples that read it in char by char.
Many Thanks
16 years ago
This might be an easy problem for someone but I can't see to get it down:
What I have is a vector which contains objects that are a bean class I created.
What I need to do is go thru this vector in reverse order - and remove from the bottom up the beans from the vector until I hit a bean which contains an int that is equal to another int that my program knows about. Then I have to remove that bean - but then I want to stop - I don't want to remove any beans above that in the vector. Of course, my bean has some method like getMyInt() that I will use.
Does anyone follow this? I don't think it is hard - I am just stuck on it.
Many Thanks!
16 years ago
Thanks very much for the responses:
To clarify - regarding the size:
Well what I am really after is the bytes - preferably I would like some api which would return bytes - but if that does not exist I guess I could convert the chars to bytes and thus compute my size in btyes - does anyone know what that algorithm is - to convert chars to bytes - is it something like a char = 2 bytes, or a char = 4 bytes?

And to clariy where to break the xml:
I have a specified tag that I have to break on. If I go over the max size a bit till I come to the specified tag that is okay.
Many Thanks!!
16 years ago
I can't get the following code to work when I am trying to access a queue remotly - the queue is on a Unix server and my java program, which contains this snipet, is sitting on a Windows client - I am new to JMS so it could be something obvious. But, this code works fine when I accessing a local queue on my windows client. I am using IBM MQSeries.
public String put() {
try {
QueueConnectionFactory factory = null;
factory = new MQQueueConnectionFactory();
((MQQueueConnectionFactory) factory).setHostName(my_hostname);
((MQQueueConnectionFactory) factory).setPort(my_port);
((MQQueueConnectionFactory) factory).setChannel(my_channel);
//don't think I need this setTargetClient do I?
//(( queue).setTargetClient(

((MQQueueConnectionFactory) factory).setQueueManager(my_queueManagerName);
System.out.println("break 1!");

javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'my_queue_manager_name' MQJE001: Completion Code 2, Reason 2058

my_connection = factory.createQueueConnection();
System.out.println("break 2!");
my_session = my_connection.createQueueSession(
System.out.println("break 3");
my_queue = (Queue) my_session.createQueue(my_queueName);
my_queueSender = my_session.createSender(my_queue);
etc. etc.

} //end put

-Many Thanks-
Wow, that is perfect - I didn't even check that - as I recall using the last version of JBuilder personal and I couldn't find that fuctionality on that version so I assumed it was the same.
16 years ago
I am using JBuilder9 personal - it by default uses java 1.4 - but I would like to use 1.3(due to constrainsts in other areas) - I don't know if there is an easy way to change it within the IDE itself - since this is only the personal version - but maybe I could change some ini file to point to a 1.3 directory or something along those lines - or I would be happy to use an older JBuilder personal version that uses 1.3 by default, but I couldn't find where I could download a version like that any longer.
Many Thanks!
16 years ago
This is really helpful but not all the way there - now I need to figure out what is proprietary to IBM MQSeries - from my research I believe I need to pass a properties object when I create the initial context - something like:
Properties env = new Properties();
env.put(Context.PROVIDER_URL, "?");
InitialContext jndi = new InitialContext(env);
When I add this, which seems to be critical or I get(javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial) to the sample in the above link I get this error:
Could not create JNDI API context: javax.naming.NoInitialContextException: Cannot instantiate class: [Root exception is java.lang.ClassNotFoundException:]
So, what are the property values I need for IBM MQ - or what am I missing?
Thanks a lot!!!
16 years ago
Does anyone have any sample code on how to put a text file or just straight text onto an IBM MQSeries queue with JMS?
Many Thanks