This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!

jesse harris

Ranch Hand
+ Follow
since Oct 02, 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 jesse harris

thanks bill,
actually I dont even need to parse it, I just need to return the xml returned from the URL, I don't even need to process it. I know this probably seems silly, why don't i just hit the other darn server, well, its all mod_perl.....nuff said??? lol just kidding, kind of...I already have a SOAP env setup with axis and am a bit weary of writing the soap stuff using perl.

thanks for the thoughts
Jesse
15 years ago
normaly that is true, but as axis does a lot of the work for me it appears to handle the returned text differently based on type, if my service class returns a String the xml gets escaped, if I return a Document it doesnt, but it seems like a waste to create document object.

am i missing something?
15 years ago
I am writing a service with axis, this service makes a call to a url which returns XML, I want to return this xml without parsing or processing as the body of teh soap message. I have gotten this to work by returning a Document object (dom) but this puppy's gotta scale and I really dont see the need to create parsers and documents and such. I tried returning a string but of course all the XML chars get escaped.

This seems simple.
any tips appreciated
Jesse Harris
15 years ago
I was asked this question and was unsure of the correct answer,
what would be the implications between these 2 approaches for comparing strings.
String foo = "foo";
so the 2 different ways would be
boolean same = "foo".equals(foo);
vs
boolean same = foo.equals("foo");
I have my guesses, but wanted to see what you guys have to say.
thanks
Jesse
15 years ago
Also stop is deprecated, how should I be killing the stuck thread, if my call to the resource is one line and it halts on that line then how could I stop it other than calling stop(), there is no looping and there is no way to set a flag and detect it right?
thanks
Jesse
how about something like this
//generator would make the DB call
Generator g = new Generator();
g.start();

try
{
Thread.sleep(1000);
if (!g.done)
{
g.stop();
g = null;
}
}
catch (InterruptedException e)
{

e.printStackTrace();
}

so in this instance, we would be in the method of the DB mgr class ther statement would be passed to that method, how would the generator class get valuse passed to it, should there be instance variables in the generator class that I set, then it uses those valuse to do its work?
I have a problem with one of my apps, when I attempt to get a DB connection or execute a query sometimes a table is locked, or the resource is unavailable. When this happens the application grinds down to a crawl because the requests are queing up, I have an alternate data source that i can access when my primary resource is unavailable. So i was thining threads are the solution to this problem. I assume I would have the call to the DB in a thread and also have a timer thread, so that if the DB call doesnt return by the time the timer thread wakes, then i teminate the DB call. Is this the proper way of thinking about this problem?
Here are some issues I am running into,
first if my Db class extends thread, then the only way for me to have it execute in its own thread is to call start, and have a run method. This would mean that each class that extends Thread can only execute the code in its run method and the code run calls(and still be in its own thread) right?
Wouldnt this be a problem, for example I have a DB manager class that you pass a SQL statement to and it will execute a query or an update, or an insert, how would I pass the statement if run doesnt take arguments?
am I totally lost here?
thanks guys
Jesse
The lang attribute will be available as a paramter in the request not at an atribute, it is a request paramater not an object in the request object,
use
String lang = request.getParameter("lang");
that should give you the parameter
then you can set your locale.
16 years ago
I am using the
<bean:include id="itemList" page="/displayitem.jsp"/>
tag to include a jsp,
and the usebean tag is in the included jsp,
but when I do this the objects I am putting in
the request are gone, I have tried including an action
instead of directly to the jsp file, and all files are contained
within the same module. No dice.
anyone have any ideas on this one,
thanks in advance
Jesse
16 years ago
Jim,
thanks for the input, I am going to implement his idea, which I alredy knew how to do, but I was maily just kicking the idea around for further thought. The reason I don't want to use the javascript method is that this is a web application implemented in struts, and if you use the javascript you are losing a lot of functionality and localization of the framework. Thans everyone for you input.
and happy cinco de mayo.
16 years ago
Hey Jim,
whats your take on the overhead of having that exception thrown? I know that if the exception is thrown and caught in the same method the overhead isn't that bad, but more than if you did not have the exception thrown, in the context of a web app you could have thousands of users hitting that server with excetpion generating input, in that case you proabably would want to avoid having the exception thrown right? I just wonder about this because there is no method for it in the API and it just seems that would be a core procedure.
16 years ago
"so I assumed thier must be the equivalent built into the core API"
I guess not,
thanks all
16 years ago
For sure I can validate it with client side javascript but this is in a web applicaion that uses the struts framework where the validation is done in a bean. If you start putting the valiation in the html you lose much funtionality of the framework and contort the intended use of the classes. Javascript has a method bulit into it to check if a var is a number, so I assumed thier must be the equivalent built into the core API, but I was unable to find it in the docs so thats why I am here. I know there is support on a char basis but I was hoping for something more robust.
16 years ago
right, but what if I want to detect if a string is a number without the possibility of throwing a NumberFormatException. I am trying to eliminate the overhead of the exception being thrown. this is for an input field in an html form that gets hit very frequently and I dont want to do the validation with javascript.
16 years ago
Is there another way to validate that a string is a valid integer input without calling parseInt() and letting the exception be thrown and catching it, I know you can take it character by character and make sure that each one in a number, but is there a method that does this for me, like isNumber(String).
thanks in advance
Jesse
16 years ago