Krzysztof Jurkowski

Greenhorn
+ Follow
since Jun 03, 2009
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 Krzysztof Jurkowski

Hello,

What is your opinion on RxJava and reactive programming? It has a lot in common with Java 8 concepts, so do you think that in fact it is a missing feature of Java and should become a standard in Java 9?

Thank you in advance for answering!
5 years ago
Hello,

I'm really curious why Elasticsearch and it's competitor Solr are based on Lucene? Is there really no true alternative for Lucene?
Or perhaps one day Elasticsearch will ship with a search engine library of it's own?

Thank you in advance for answering!
6 years ago
You're right - this was a problem of default namespace.
I found a working solution for JDOM:

But I cannot figure out how to do it with XPathAPI... I tried:

but it throws: com.sun.org.apache.xpath.internal.domapi.XPathStylesheetDOM3Exception: Prefix must resolve to a namespace: svg

Do you know what is wrong with the XPathAPI code? Or perhaps could you suggest an alternative for XPathAPI that accepts org.w3c.dom.Document.

Thanks!
12 years ago

Paul Clapham wrote:Presumably that site just tests expressions for well-formedness.


Actually it highlights expression matching nodes, so I'm sure it should return a result.

I tried: //text[.="11"] and //text[.='11'].
None works.

Even when I try //text, which should return all the text nodes it gives me an empty list.

On the other hand I tried to execute equivalent code in JDom:

and it also returns an empty list.
So something must be wrong with the svg document or the XPath expression.
If you wish you can download a sample document from:
http://dl.getdropbox.com/u/296382/tree.svg
12 years ago
Hi,
I want to create a find tool for my JSVGCanvas, so that user can zoom on a certain text in the drawing.
The svg file looks as follows:



To do it I just need to select a text node in the SVGDocument, get the x and y attributes and I have the coordinates or the node on the drawing.

The problem is that when I call:

than the returned list is empty.

Same story with:

it returns null!

I tested this XPath expression with http://ponderer.org/download/xpath/ and it works fine.
What am I doing wrong?
12 years ago

David Newton wrote:What was wrong with your idea of passing the objects to the constructor?


I thought that the only way to start a new process in java is to use Runtime or ProcessBuilder. Let me know if I'm wrong, but I thought that all you can pass to Runtime or ProcessBuilder are String arguments.
Than if you call Runtime.exec (ProcessBuilder.start), all string arguments are passed to static void main.

Since I don't know the solution of my problem perhaps I didn't make myself clear - I don't know how this can be achieved, but I need to execute a class in a separate process and I need to pass an Object arguments to the constructor.

12 years ago
Hi,
I need to create a new process and pass a number of objects to its constructor.
I know I could serializes these objects and deserialize them in created process, but is there a way to avoid it?
Or perhaps there is a way to share memory among processes?
I found on the internet a thing called JOPI: a Java object-passing interface (http://portal.acm.org/citation.cfm?id=583815&dl=GUIDE&coll=GUIDE&CFID=53393199&CFTOKEN=39328707) but I cannot find jar with JOPI anywhere.

Thank you in advance for answering!
12 years ago
I will investigate both solutions. Thank you for help! JavaRanch is the best!!!
12 years ago

David Newton wrote:I'd add only that unless there's a compelling reason to do this with a servlet it might be easier to just use any number of existing load/performance testing tools that are already written, debugged, and provide a lot of functionality for simulating user interactions.



May I ask you to suggest one?
12 years ago
Hi,
for a purpose of performance testing I need to write a servlet that will call a number of servlets in a existing web application.
It will measure a average execution time of each servlet. The sequence of servlet names and arguments is stored in a xml file, which is accessed by the testing servlet.
For example:

Moreover such testing scenario will be executed simultaneously for several user - I will create a thread for each user and call the sequence of servlets from the xml file. Results of measurements will be stored in a file.

In our web application a gatway between client and server in a Dispatcher class which forwards client requests to a specific servlet according to provided command parameter.

So having a servlet name and parameter I do as follows:


This way I can measure time of servlet execution and moreover I can store the result of execution in StringBuffer.
The problem is that each time I call the Dispatcher this way I get a different sessionId - so that objects stored in the session object by previous servlet cannot be accessed by the following one.

I tried calling the Dispatcher using an other RequestDispatcher, like this:

But this throws java.lang.IllegalStateException: Cannot forward after response has been committed.

So the question is: How can I call various servlets, provide request parameters and keep the same sessionId for each call? And BTW sorry for such a long post, but I wanted to explain the problem is details, because it might be that you will provide a completely different solution.

Thank you in advance for answering!

12 years ago