java

How do I use a Python library in my Java application?

What are the basic nuts and bolts of calling (running? interpreting? what can you do?) Python code from a Java program? Are there many ways to do it? ...

How can I uses Sesame's RDFXMLParser in JRuby?

I am not very experienced in Java and JRuby but need to parse RDF data using Sesame's RDFXMLParser in JRuby and my python-minded brain just does not want to get into it. I have problems translating the Java example into JRuby. At first I don't know how to define the RDFHandler in a way it would make sense. I also don't get why the parse ...

Similarity String Comparison in Java

I want to compare several strings to each other, and find the ones that are the most similar. I was wondering if there is any library, method or best practice that would return me which strings are more similar to other strings. For example: "The quick fox jumped" -> "The fox jumped" "The quick fox jumped" -> "The fox" This compa...

OpenMQ 4.2 cluster stops delivering messages

Hi. We have a system running an application connecting to a cluster of OpenMQ brokers (non-HA). It's been running for about a week without restart. This week we noticed the cluster stopped delivering messages to the consumers (I believe these were the messages on second broker). After checking it in the morning we saw it did not deliver ...

Is it possible to end a process nicely in a Java application?

In a Java application: currentProcess = Runtime.getRuntime().exec("MyWindowsApp.exe"); ... currentProcess.destroy(); Calling destroy simply kills the process and doesn't allow any user cleanup or exit code to run. Is it possible to send a process a WM_CLOSE message or similar? ...

JVM, Java, Multithreading, Object Creation

i am encountering a weird scenario, Is there a possibility of JVM re-using an already created object when we are initializing a new one and the object count is JVm is very high? abc a = new abc(); a.setAttribute("aaaa"); ......... a...is no longer being used...and has not yet been garbage collected by the JVM. There are multiple threads...

Is it possible to flush output with iText RTF (Java library) gradually? (outofmemory error)

I'm using iText to create an RTF document. It'll have a few hundred pages when completed. However, I keep getting an outofmemory error, when it's finished adding all the various paragraphs and tables to the document, and it's trying to actually create the RTF file (with document.close();) I've increased the Runtime memory with -Xmx350m,...

Is there a reason why software developers aren't externalizing authorization?

The value proposition of externalizing identity is starting to increase where many sites now accept OpenID, CardSpace or federated identity. However, many developers haven't yet taken the next step to externalize authorization and use approaches based on XACML. Is the reason lack of awareness or something else? How would you expect to l...

Difference between JPA Entity and Hibernate Entity

When I annotate a class with @Entity and try to resolve the dependencies, I get to choose the package between two different packages, javax.persistence.Entity and org.hibernate.annotations.Entity The javax package is JPA's entity-annotation, but why is there a hibernate entity-annotation and difference does it have with JPA's annotation...

Apache Commons fileUpload problem in java servlet

Hi. I tried doing this with Apache Commons FileUpload: protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException { PrintWriter out = null; try { response.setContentType("text/html;charset=UTF-8"); //MultipartFormDataRequest dataRequest = new MultipartFormD...

Download a file from the internet using java : How to authenticate?

Hi, Thanks to this thread http://stackoverflow.com/questions/921262/how-to-download-and-save-a-file-from-internet-using-java I know how to download a file, now my problem is that I need to authenticate on the sever from which I'm dowloading. It's an http interface to a subversion server. Which field do I need to look up into ? Using th...

How to find average loading time for website ?

How to write a code (in any programming language, preferably in java), which calculates the average loading time of any website (including all embedded elements such as images, Javascript, CSS, etc.) ? ...

What's wrong with Collections.sort?

I have these strings in an ArrayList of String in no particular order but when I invoke Collections.sort(listReference), the sorted result is incorrect, why do 10 and 11 (the last 2 characters) come before 07, 08, 09? 12880 20090506054200001 12880 20090506054200002 12880 20090513070200003 12880 20090513070200004 12880 2009052020260...

how to write delete query in hibernate for many to many relationship

I have two beans user and virtualdomain @Entity @Table(name = "tblUser") public class User implements Serializable { private Long id; private String username; private String deleteflag; private Set<VirtualDomain> virtualdomainset; @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() ...

Java bug? Different output on 2 identic regex's

My regular expression has 2 different outputs from the same code... but i don't know what's wrong. Here's a piece of code, i hope you can help me. Thanks! String s = "48° 18′ 13,94″ nördliche Breite, " + "11° 34′ 31,98″ östliche Länge"; String kommazahl = "[0-9]{1,2}([\\.,][0-9]+)?"; String zahl = "[0-9]{1,2}"; Pattern p1 = P...

a Good Example of ant best practices

I have read lots of articles on Ant that explain all sorts of options, and I've read much of the documentation for Ant, but I don't really know the "right" way to do many things. Can anyone recommend a Good Example illustrating how to use Ant? Something that is not too complicated but also not too simple. I found this one by Doug Sparli...

Best java book for a c++ developer?

Thinking in Java third edition is the one, for which I have a eBook with me.My primary focus is to take advantage of google frameworks like Android and GWT. ...

RV C# Client from Java Publisher

Does anyone know whether its possible to have a C# client subscribing for messages from a Java Publisher? I'm interested to know how the C# client will handle the different data types - is it possible to just stream a standard Java Pojo and the C# RV client will have some way of unmarshalling this? ...

How can I change the width of a JComboBox dropdown list?

I have an editable JComboBox which contains a list of single letter values. Because of that the combobox is very small. Every letter has a special meaning which sometimes isn't clear to the user in case of rarely used letters. Because of that I've created a custom ListCellRenderer which shows the meaning of each letter in the dropdown ...

Converting a SOAPMessage object to an instance of a XmlType annotated class in Java.

I'm working with SOAP using the javax.xml.soap package. I have a javax.xml.soap.SOAPMessage object that corresponds to a response to my SOAP request and I have to convert it to an instance of a class that was annotated with the javax.xml.bind.annotation.XmlType annotation. How can I do this conversion? ...