java

Options to configure a Linux box from Java

I'm trying to make an java application to manage Linux servers from a web interface. It is a bad idea to perform each task by calling bash shell ? Are there any other options other than those to use C, Perl or another language? ...

Tag Interface for Singletons

The 'singleton-ness' of a class is an important aspect of how a class should be used. However, it usually doesn't have any explicit status in the exposed API of a class. Yes, conventional method names such as getInstance() are often used, but that's not exactly what I'm referring to here. A 'tag interface' is an interface which contains...

GWT and Authentication

What are the best strategies to secure your GWT + Tomcat app to perform authentication and authorization? ...

how do I extract the 1st element from a ant CSV property..

given a CSV ant property, <property name="module.list" value="mod1,mod2,mod3,mod4,mod5"/> how can I just get the first element (ie "mod1" here)? I want to execute a command that will take in "mod1" as one of the arguments. Moreover.. I cannot modify this original "module.list" property to a list or anything else.. although I can crea...

Java - Method accessibility inside package-private class?

If I have a java class which is package-private (declared with "class", not "public class"), there is really no difference if the methods inside are declared public or protected or package-private, right? So which should I use, or when should I use which? I'm a bit confused. ...

What version of a JSR should a J2EE container implement?

Is it acceptable for a J2EE container to provide an implementation that complies with the public review version of a JSR, as opposed to the final draft (or even proposed final draft) ? I'm not sure on how to quantify/qualify the word 'acceptable' in this context, but what would be the 'gold standard' for stating that an implementation is...

Pen Plotter Problem(find shortest path for pen to move to draw a diagram,java)

Before the advent of inkjet and laser printers, straight line drawings used to be plotted by coloured pens on large sheets of paper: the pens moved very slowly so this was a time-consuming process. Since time is money, it was important to draw figures in an optimal way, using minimum time. you will implement an A* search procedure for t...

Java equivalent of Python repr()?

Is there a Java method that works like Python's repr? For example, assuming the function were named repr, "foo\n\tbar".repr() would return "foo\n\tbar" not foo bar as toString does. ...

Automating the generation of Java policy files

Does anyone know of mechanisms to automate the generation of security policy files for a Java application, especially that of J2EE/JEE applications? Are there tips that can be observed to generate accurate policy files without requiring an application to be rigorously tested with a near 100% coverage? ...

Java applet and JFrames

Hi all, I've got a java code that I found and adapted to my project. I am trying to build a java applet out of it. My problem is that from some reason the code demands me to add a JFrame to my applet. If I add a JFrame it works fine (The code has several threads its working on, perhaps it's connected?), the problem is that the JFrame ca...

Creating a JPA Provider

Does anyone know how to create your own JPA provider? I was considering making a custom JPA provider that could interface with a SOAP webservice we use. However, I can't seem to find any document describing how to create your own JPA provider. Where should I start looking? ...

parsing a non xml file in java

I want to parse a document that is not pure xml. For example my name is <j> <b> mike</b> </j> example 2 my name is <mytag1 attribute="val" >mike</mytag1> and yours is <mytag2> john</mytag2> Means my input is not pure xml. ITs simliar to html but the tags are not html. How can i parse it in java? ...

Hiding ImageJ interface elements

I'm working on a project involving enlisting a large number of relatively unskilled workers to do repetitive image analysis using ImageJ. I've written a set of macros which walk them through the analysis process, but in order to increase throughput and reduce errors, I'd like to figure out how to hide as much of the gui/menu interface as...

Java - Prepared statements and arrays

How can I handle an array in a prepared statement? i.e, I want to do a query and one of the parameters I get is an array of strings which I want to use in the query (Don't select rows that have a field that's in the array)? ...

Layout issue for imageview Android

I am facing problem in adding image at the end of the linear layout in android. Alwals it added at the begining. My question? 1)How to add this image at the end of the Layout. 2) After wards Can I add element from begining. ...

What is the purpose of JNDI

How can you realize the usage of JNDI , with an example if possible? ...

[XML] How to make this simple document valid

Hi. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!--This is auto-generated file. Do not change it!--> <DB> <foo /> <bar /> </DB> I have one problem with it - when i start parsing (DOM) it says that document is not valid. I've checked what's wrong and the problem is: Line: 4 Column: 6 Error: Can not find declaration...

What basic algorithm to choose for build sorted list? And how to get best perfomance durring adding to sorted list?

For exmple, i have undefined number of a pairs(key, value). And I want to build sorted list during iterate trough this pairs(it is long operation). I think to use a BinaryTree as a sorted structure and build list from tree after iterations. How you think in generally, is this method faster than simple sorting of the list getted from it...

Compare Java RPC vs WebServices

How do you compare Java RPC vs Java Web Services. I have a small hands on experience with Web Services. Now I need to know how RPC compares with Web Services. How does RPC work? Addition : When do we go for either of the options? ...

What is a good Web search and web crawling engine for Java?

I am working on an application where I need to integrate the search engine. This should do crawling also. Please suggest a good Java based search engine. Thank you in advance. ...