Lon Allen

Ranch Hand
+ Follow
since May 24, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Lon Allen

How do I avoid the extra "\" that appears in my ant generated time values?
example:
build.date=2004/02/03 10\:45
I am using the following:
<entry key="build.date" type="date" value="now" />
If I use pattern="yyyy/MM/dd HH:mm" I get the same thing.
Thanks,
Lon Allen
21 years ago
I am trying to find a way to be able to query local data objects with SQL commands to avoid constantly hitting the database. I have an app that creates temporary tables in the database from some SELECT statements and I use those temp tables as the datasource for many more queries and temp table creations. If I could load local objects with the same data from these queries and query them instead I could buy some performance back by not having to hit the database so often. I know that .NET supports "disconnected" tables to allow something like this, but I cannot find anything in Java that I can so it with.
TIA
How can I create a local table that I can use to make SQL queries to instead of creating a temp tables on the Db to make the same calls to? I have an application that makes several SQL calls to the database and each call creates a temp table to contain the new results. I want to just create a local tables on the client that I can manipulate instead of having to make all the calls to the database to do the work. I gather my results from the various SQL calls and build a new set of data to eventually write back to a different table in the Db when I am done.
Any suggestions?
[ January 08, 2004: Message edited by: Lon Allen ]
The only thing I see that I need to synchronize with is the queue object, which I am. The queue object has synchronized methods for put and get also. But to remove that from the equation, I stripped all my code that did anything other than just reading the data, appending each line of data to the StringBuffer and sending the data to a file for inspection. I still get lost messages at several points in the transfer.
Because the messages are assembled at the client, in the client code, and a true EOF was not being placed at the end of the message (which readLine() should return a null with), we have settled on adding a tag of our own that we agreed upon, and if I don't get that tag I never break out of the readLine() loop, which is not a problem. The parts of the message that I am not getting are at the beginning of the message. I am usually only getting the last 1/4 or less of the message. BTW, the messages are XML messages with linefeeds ("\n") at the end of each line so that I just do a readLine() for each line of data. That way I don't have to worry about the size of each data packet getting out of hand.
I have also set the priority of the socket reading thread to one higher (10)than the other threads in my app (5). I have the other threads "wait(timespan)" after doing their work and I have the reading thread "Notify" after each object is placed in the queue. But, like I said, even if I don't do the other work and just display the messages to the System.out or a file I get the same message loss problem.
Thanks,
Lon
I have an application that I create a serverSocket to run in a thread to read data being sent to the server. I use the basic server scheme where I block in a while loop using input.readLine() and I place the recieived data in a StringBuffer. When the end of transmission is reached I break out of this loop and place the StringBuffer in a queue for another worker thread to chew on. I then return to the while loop where I block for more incoming data.
This application works as long as the load of incoming messages is low (less than 30 messages per second using a message 1K in size). If I bump up the client to send messages at a rate higher then that I begin to get incomplete messages received at the serverSocket. If I display the data being sent at the client, the message is complete on that end. I am not sure what the issue is.
I have some C and VB colleagues that are telling me that the JAVA TCP API should be throttling back at the port to avoid an overrun/flood of data by telling the TCP API at the client to throttle back on sending data. They tell me that they do not have these issues in those languages and are blaming Java for my issues.
I have no idea as to why the messages are getting lost/truncated.
Any clues as to why this is happening would be greatly appreciated.
Note that I used the client/server tutorial at Sun to base my design on so I am not doing anything out of the ordinary to receive the incoming messages. I am using Java 1.4.2 for my SDK and JRE.
Lon Allen
I figured it out. I put the following at the end of sending the data in the client:
socketWriter.println("\u0004"); //after while loop
and changed the while loop in the server to
while (!(lineIn = socketReader.readLine()).equals("\u0004"))
works good now.
[ June 16, 2003: Message edited by: Lon Allen ]
21 years ago
I am wanting to pass an xml formatted string from a client to a server. The server will manipulate the data and send it back to the client. For now I am just reading the file in using a BufferedReader, sending the contents to the server and echoing it back. The problem I am having is that when passing the contents of the file to the server there is no EOF marker since the while loop I use is triggered by .readLine() != null.
The following code is in the client and sends the file contents to the server.

In this block of code there are two "while" loops that are controlled by ".readLine() != null". The first one works fine (since it is reading the data from am actual file), but the second one never quits the loop on the returned data.
I am assuming that since the first loop exits before an EOF character can be written to the socket that the returned data doesn't have an EOF character to key off of.
My server has a similar loop that sends the received lines back to the client. It too has the same problem with the while loop.


How can I insert an EOF character into the stream so that the while loops that are reading lines on an input stream have a means of exiting the loops?
TIA
Lon Allen
21 years ago
Here is a little more info:
When IE6 saves the table as an xls file it always sets the filename to the same thing (ie. myjsp.jsp.xls). Whereas Netscape keeps a count of how many times the table has been opened and adds an increment to the filename each time (ie. myjsp.jps-1.xls, myjsp.jsp-2.xls...). It appears that when I display the initial xls file in the lower frame of my web page some kind of a handle or object name (maybe the xls filename for all I know) is created. When I change the data indices and try to redisplay the table/xls only a blank page is displayed. It is like the browser thinks the page is already there and doesn't attempt to display it.
I am thinking that I am having the notorious cache problem with IE6 and can't find anyway to fix it. Trying to set the following has no effect:

Lon
[ May 28, 2003: Message edited by: Lon Allen ]
21 years ago
JSP
I should note that this is occurring with IE 6.0. If I run this in Netscape, instead of the xls spreadsheet being displayed in the lower frame an excel window is opened and the spreadsheet is displayed there. If I change the indices for the table in the upper frame and select Submit again a new spreadsheet is opened into the excel window along with the first displaying the new data.
Lon Allen
21 years ago
JSP
I have a JSP that contains 2 frames. An upper frame contains two select lists to allow the user to select a range of data to be displayed in the lower frame (Initially the lower frame is a "blank" page since nothing has been submitted yet). Once the user selects the "start" and "end" indices to be displayed in the lower frame and selects the submit button I format some data returned by a bean to display in a table in the lower frame. If the submit button is selected again, regardless of whether or not the indices are changed the table data is redisplayed with the correct data.
I changed the contentType to "application/vnd.ms-excel" to display the table in excel instead of HTML. The problem I am having is that if I re-submit the form by selecting my Submit button again the lower frame goes blank and I cannot get the excel table to display again. I have to force the entire page to be refreshed from scratch to be able to bring the data into view again. This causes the user to have to reselect start and end indices again and then selecting submit.
Any clues as to why I can't resubmit the data to be displayed? When I have the contentType as "text/html" changing the indices and re-submitting works fine, I just can't get it to work when the contextType is for excel.
TIA
Lon Allen
21 years ago
JSP
My bad! Oversite... meant to change it to coderanch. Cut-n-paste will get you in trouble. I knew that there was something else I had wanted to mention to the original poster: "You need to change the getProperty2() method to public".
Thanks for catching that Bear.

Lon
[ November 05, 2002: Message edited by: Lon Allen ]
22 years ago
JSP
property and property2 are supposed to be private instances variables in your bean. Typically:

You are referencing bean properties in your JSP that do not exist in the bean.
The following will work:

I have all my beans like this and have never had a problem accessing any of the properties in them.
Be sure and associate all properties with input variables via:
<jsp:setProperty name="listboxes" property="*" />
Don't forget that you can also access the properties in a bean via the public methods you created.
Example:
<%= listboxes.getProperty() %>
<% out.print(listboxes.getProperty2()); %>
hth,
Lon Allen
[ November 04, 2002: Message edited by: Lon Allen ]
[ November 04, 2002: Message edited by: Lon Allen ]
[ November 05, 2002: Message edited by: Lon Allen ]
[ November 05, 2002: Message edited by: Lon Allen ]
22 years ago
JSP
Thanks Bear!
That was a lot of help.

Lon
I have a form that contains a textarea. The data in the textarea is the contents of a log file that can get pretty lengthy. When I click on an <input="submit"> button in the form all of the data in the form gets sent to the server. I could care less for this to happen and would rather just clear the form so that all that data isn't passed to the server (also all the form data is displayed in the "Address" field of the browser window which I also want to avoid).
The way the form works is that a JavaBean call actually populates the textarea in the following way:

When the page is updated after the Refresh Log button is pressed the call to getSysLogData() will populate the textarea with the data that the bean gets out of a file. I just want to avoid sending all the data in the textarea to the server when the Refresh Log button is pressed since I don't care about it in the first place. I just want the page to update and make the call to the bean to get the data.
So how can I clear the form when the Refresh Log button is pressed before the actual "Submit" of the form takes place?
Lon Allen