java

Hibernate list operation question

I'm working on a utility to update a list of entities in a database as a group. The database contains a list of entities. The result of the update is a new list. The API accepts this new list. The update may end up modifying some of the entities in the list, creating new ones and deleting some. So at the entity level, I may have to do a...

is it possible to load a HtmlPage from a string ?

I have stored a webpage's HTML in the database. I want to take advantage of HtmlUnit's ability to find/reference DOM elements. Is it possible to load the HtmlPage object from a string (via a database column)? ...

Question about decorator pattern and the abstract decorator class?

This question was asked already here, but rather than answering the specific question, descriptions of how the decorator pattern works were given instead. I'd like to ask it again because the answer is not immediately evident to me just by reading how the decorator pattern works (I've read the wikipedia article and the section in the bo...

How to create WSDL file given SOAP WSDL operations

I haven't had any experience with web service related development. So, any ideas will be greatly appreciated. Suppose, I have a file listing draft specification of WSDL operations. Following is one example. How would I go about creating the WSDL file. Is notepad sufficient or do I need to have WSDL editor? getHostSystemInfo Return...

RMI interface loading

Hi Guys. Have a question related to how RMI loads the interface classes. So here is my set up: An interface that defines the operation that the rmi server performs. Common public interface Computable<T> extends Remote{ public AnalyticalServiceOutput<T> compute(Request request) throws RemoteException; } Server Computable<Map<S...

best way to extract elements from a html page?

What is the preferred way to extract elements from a HTML page in Java? My HTML is has many of the following rows: <tr class="item-odd"> <td class="data"><a href="http://....."&gt;TITLE&lt;/a&gt;&lt;/td&gt; <td><div class="cost">$1.99</div></td> </tr> The class alternates item-odd and item-even. I need to extract: Ur...

Apache Buildr issue with ant task / Hash.from_java_properties

I have a buildr script that first loads a java properties file, then creates an ant task. I'm getting an abort error: Buildr aborted! org/apache/tools/ant/DefaultLogger when running buildr. Here's the (simplified) buildfile: CONFIG = Hash.from_java_properties("a=1") define "my_project", :version => "1.0" do ant("ant_test") do |ant...

Translating SOAP Web services calls into JMX API

I have SOAP web services for Application 1 available to me. And, I'd like to implement a Java application that translate Application 1's Web Services calls to Application 2's JMX API. So App 1 can manage a bunch of operations through App 2. If I understand the problem correctly, I want to build a SOAP/JMX Proxy (Remote Proxy design patt...

general java server/client tutorial

im developing a multi-player card game that needs the clients to communicate with each other or a general server. i have never done this before so i need some direction or tutorial on how to achieve this. so far i have created the local, single person version of the game... ...

xpath to get rows inside a table

I have a html table like: <table ..... class="cars"> <tr class="item-odd"> ... </tr> <tr class="item-even"> </tr> </table> How could I get the table rows using xpath? //tr[contains(@class, ???) can I use OR in there somehow to say item-odd|item-even ...

move all dependent libraries to a folder in netbeans

I have downloaded a few libraries for my netbeans solution to work. I want to store these in a seperate folder so when I save to GIT, I can checkout my project at home at not have to redownload all the libs it references. Can I do this if I already have my project up and running? ...

Are there thread group-local variables in Java?

I am looking for a class similar to ThreadLocal which would work on thread groups instead of threads. If there is not such a class (in some open source library) how would you implement it? Some better idea than having thread groups in WeakHashMap? I am implementing a debugging framework tunable in run-time with various parameters in gl...

What will Support for Dynamic Languages in Java 7 be like?

It seems JSR 292 will add support for dynamic languages to the JVM but I've not seen many details about it. Will dynamic types be incorporated into the language (or just the VM)? If so, what will the semantics look like? Will there be something like C# 4's: dynamic x = 10, y = 5; Console.WriteLine(x + y); ...

Rasterizing Java Fonts

Exposition: I'm writting an OpenGL app in Java via JOGL. The built in fonts with GLUT are very basic. I want to be able to take a Java Font, render all the characters in it to a 2D array of bytes (a greyscale image representing the characters), which I can then load as a texture in OpenGL. Problem: I can load the textures in OpenGL; I...

Integer counter - What to do when Max-Value?

How do you solve the max value problem when using an integer counter, that looks like counter = counter + 1; When this reaches the max value, how do you know this happened? Do you add another counter for this counting how often this happened? My question concerns about java. ...

Getting Binary HTTP Post parameter in an Java/Tomcat/HttpServlet

I have a binary value being URL Encoded, and then POSTed to an HttpServlet. The following code shows how I first attempted to extract this data. Very simple except that the result is a String, not bytes. This seemed to work at first, except that an extra byte appeared three bytes from the end. What I eventually figured out was that my d...

AppEngine datastore persistency manager get all except

I'm trying to find the most efficient way to get all objects from the datastore except ones already contained in a list. Eg. PersistencyManager.getObjectsById(List) will return a list of objects with given ID's. I want a getObjectsExcept(List) method that will return all of the objects that are not contained in the given collection. ...

Java object wrapper

I have a WS ( CarASessionBean )it will call another WS ( CarBProxy ) to create a car details. So inside my CarASessionBean WS has a method call createCar : (In proxy has the same method as well call createCar just it take in CarB object as parameter). public void createCar(CarA car) { //here i will call the proxy and here error...

How do I get XSLT to stop using scientific notation when outputting the results of numeric operations?

I have a bit of XSLT which is performing some magic on integer database identifiers. The relevant code snippit is <xsl:variable name="releaseId" select="@ID + $contentOffsetId"/> <xsl:attribute name="OLD_ID"> <xsl:value-of select="@ID" /> </xsl:attribute> <xsl:attribute name="RELEASE_ID"> <xsl:value-of select="$releas...

Transfer file over socket.

I found this code witch I tried and it works great but(!). I want to store the file in a folder that I will choose and also get it from a folder that I again will chose. Since the Sender get an argument then I suppose that if I give an argument like /home/user/test.txt then that's ok and it'll work out fine but I don't get how to store t...