Dar Var

Ranch Hand
+ Follow
since Oct 12, 2004
Merit badge: grant badges
For More
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 Dar Var


My application receives 3 object types. These are basic pojos A, B and C.
Each time I recieve A, B or C object I use it to update the values in another pojo type Z.

The setters and getters in both A, B & C match the getters and setters in type Z.

Is there any way to easier way to update Z using some design pattern?

i.e. I'd prefer not the do this for each update:

Someone mentioned the Visitor pattern but I'd need an example on how this could be used.
12 years ago

Couple of questions:

Does anyone have a material on the best way to implement a State Diagram using the Java 6 features? e.g. I'm pretty sure the state model would make usage of Java enums...

Also whats the UML tool to generate Java 6 code from a State Diagram?


I believe the XPath implementation that comes with Java 5 requires a DOM tree first before running the XPath expression.

So obviously for large XML documents this is a problem because it will build up a large DOM tree in memory.

So how do I efficiently run make XPath expressions on large XML Documents in Java 5

Anyone know of a algorithm or Java class that can perform an unpivot operation on a ResultSet.

i.e. similar to Oracles Unpivot operator. See Example here

However I have to do this on the ResultSet returned. I can't do it in the sql.
Here is my XML doc:

Here is my XPath code:

The Problem this code will only print out the first isbn on each loop.

The real question is how can I apply an XPath expression to a Node??
I understand the Java localization stuff. But how to use it with Apache Commons Logging:

If I get the log messages using a ResourceBundle, is there any way to pass this into Apache Commons Logging.

Do I need to implement the Log Interface to get the info, debug etc methods to use a ResourceBundle.
14 years ago
Can anyone point me at an example of how to do internationalization using Apache Commons Logging and Log4J.

The messages I need to log will also need to output the values of a local variable
14 years ago

If I read and write the XML file using "us-ascii" then I get the degree symbol as before °
The input XML doesn't declare any encoding.

When I output as us-ascii encoding the output of the degree symbol is °

So is there any way to get the XMLSerializer to ouput ° instead of the degree symbol °

The reason is a Windows GUI Tool I have no control over is reading the XML and doesn't understand the degree symbol and won't open.

For some reason (don't ask why) this Windows GUI Tool requires ° and not the the degree symbol output by the XML parser.
I am given the following XML file (test.xml) as input. The XML file does not declare any encoding. I have no control over this file.

<row label="30&#x00B0;"/>

&#x00B0; is the encoding for the degree symbol ° in some encoding. Internet Explorer understands it anyway and replaced it with the degree symbol.

My Java program reads this XML using:

After a couple of DOM changes I then output the Document above to File using:

However, the problem is it outputs the XML with the actual degree symbol and not the encoding:

I have some question on

1. Is this the best way to print log messages?

I'm using Apache Commons logging and Log4J to log messages.

2. How can I use the same String.format argument more than once. I tried the following but it doesn't work

3. I need to internationalize log messages to English, French etc. Any ideas examples anywhere on how I can do this?

Thanks in advance.
14 years ago
Does Scala license prohibit use in commercial products?
14 years ago
With the introduction of JavaFX and the new Java Browser Plugin is there now a standard way to download the correct Java version to the Client no matter what Browser or OS they are using.

In the past I had huge difficulty deploying Applets.

If the Applet required a specific JRE version differant methods were suggested to download and install that JRE on the client:

I tried all these techniques with varying degrees of success.
In my experience none of them worked accross all Browsers and OS's.

What standard method is now used to download the correct JRE?
15 years ago
I have been visually comparing the performance of JavaFX and Flash for playing media using the cartoon Big Buck Bunny.

With the latest JDK and JavaFX SDK Big Buck Bunny takes between 5 - 10 seconds to start

With the latest Flash it starts instantly on YouTube:

Will/Can the start times be improved further for JavaFX?

Or is it that JavaFX needs something like Flash Media Server to stream videos to the JavaFX plugin?
15 years ago