Given a List of POJO's, if I serialize them with XStream I get:
<list>
<pojo>
<a>a</a>
<b>b</b>
</pojo>
<pojo>
<a>a</a>
<b>b</b>
</pojo>
</list>
How can I do the serialization and omit the <list> </list> entries? I've used addImplicitCollection for a similar purpose but that was to omit the collection inst...
Hi,
I would like to execute foo.bat from within a Groovy program and have the resulting process' output redirected to stdout. Either a Java or Groovy code example would be fine.
foo.bat can take several minutes to run and generates a lot of output, so I would like to see the output as soon as it is generated, rather than having to wait...
I'm subclassing JTable and using a DefaultTableModel to model my table data. The following class sets up the JTable, and adds one row to the model.
import java.io.File;
import java.util.Iterator;
import java.util.Vector;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
pub...
I'm trying to take a seven-character string and generate all the possible 3- and 4-letter permutations of it. This seems like something that recursion would be handy for (most all permutation generators I've seen are recursive), but I keep getting stuck at how to avoid repetition. That is, if my input string is "aabcdef" I don't want any...
The typically method to reference a file contained with a JAR file is to use ClassLoader.getResource. Is there a way to get the contents of a directory within a JAR files (similar to java.io.File.listFiles())? Note that the JAR file is within the classpath and its filename might not be known during runtime.
Basically I have a bunch of n...
I have a basic facility for allowing users to remotely apply changes to the logging files in my application. Some logs are configured using java.util.logging properties files, and some are configured using log4j/log4cplus-style properties files. I'd like to do some basic validation of the properties that users try to apply. Namely, I ...
Hi all,
I run findbugs against all of my code and only tackle the top stuff. I finally got the top stuff resolved and now am looking at the details. I have a simple entity, say a user:
public class User implements Serializable
{
protected Date birthDate;
public Date getBirthDate()
{return(birthDate);}
public void se...
How can i find the device of my fingerprint reader through the Java programming? Is there any specific method in any specific package?
...
According to its feature list "Quartz can run as a stand-alone program (within its own Java Virtual Machine), to be used via RMI".
I could not find any documentation how to start it in stand-alone mode, however.
"java -jar quartz.jar" does not do anything (there is not even a Main-Class specified in its mainfest).
All the examples in ...
Hi,
I'm relatively new to hibernate and was wondering if someone could help me out.
While I have no issues implementing a normal join on multiple columns in hibernate using the @JoinColumns tag, I'm stumped when trying to implement the following query in annotations:
SELECT A.* FROM TABLEA A
LEFT OUTER JOIN TABLEB B
ON A.UID = B.ID
AND...
There's a (relatively) new sort on the block called Timsort. It's been used as Python's list.sort, and is now going to be the new Array.sort in Java 7).
There's some documentation and a tiny Wikipedia article describing the high-level properties of the sort and some low-level performance evaluations, but I was curious if anybody can pro...
I would like to know whether there is a way to write a comet server in C#. i have a C# code that generates data periodically, and I want to push these data to a java app. So would like to convert my C# code to a comet server.
Also would like to know whether there is any comet server implemented that lets us connect the C# application an...
Hey,
There is a similar question here but regarding the class path.
http://stackoverflow.com/questions/1585811/classnotfoundexception-com-mysql-jdbc-driver
I've had everything working great until some days ago. Suddenly my little application can't find the mysql driver. And i don't understand why (really I've checked everything)
I got...
I have a requirement that i need to load two versions of a jar at once. To avoid class path collisions I'd like to rename the packages of one of the jars. Then in source you could always easily determine the version by the package name.
I've played with javap but couldn't find an assembler for Java 1.6. I've also attempted to decompi...
I am having some trouble creating a for loop within a constructor to iterate over a map and an array at the same time. Here, it is indicated that this cannot be done with an enhanced for loop.
I have something like this, which raises a compiler error. Basically, the class has a Map which I want to populate via the constructor which take...
We use Oracle on a project and would like to also support MySQL. How close are their SQL dialects?
Is it perhaps even possible to use the same SQL source for both without too many gymnastics?
Details:
We're using iBatis, a persistence manager that cleanly segregates the SQL statements into resource files. But we work at the SQL le...
The classical unit testing is basically just putting x in and expecting y out, and automating that process. So it's good for testing anything that doesn't involve time. But then, most of the nontrivial bugs I've come across have had something to do with timing. Threads corrupt each others' data, or cause deadlocks. Nondeterministic behav...
Hello All...
I am developing an application in Spring Web MVC where i need to execute some of the linux script..
I am using tomcat version 5.5 for running my project in linux..
My code is looking like this :
Process proc = runtime.exec("sudo cp /var/tmp/mailserverfiles/editinterface.txt /etc/sysconfig/network-scripts/editinterface.tx...
Problem:
A jar file was failed to deploy on a UAT server.
Reason:
Because when we are trying to rename it,it is showing
"cannot rename the file it is been used by another user".
step choosen in order to solve the problem
log on UAT server(xxx).
we need the list of java processes along with the PID on our UAT server
which is r...
Hi all,
I have a program which calls a shell command. When I executes the command using java's run.exec, it is not working but when I executes the command directly in terminal, it works like charm.
ex: pdf2swf "3bbba47.pdf" -T 9 -o "3bbba47.swf" didnt worked
from java program but worked directly executing it in terminal.
But when...