java

JavaFXSCript for server side applications

Has anybody tried to use JavaFX Script in server side applications. The language itself looks quite nice and modern, and is fully Java compatible. If Sun is serious about it, it could be quite ubiquitus on the server side too, where Java is strong. What do you think? ...

JSP code to Struts or JSTL tag

HI, I m doing the folling stuff in the jsp code I need to do it using Struts or using JSTL tag can any body have relevant idea please share.. The following is my JSP code <% Object category = request.getAttribute("categoryDetails"); Hashtable<String, Hashtable<String, Integer>> cat = (Hashtable<String, Hashtable<Str...

Generating code stub from class and javadoc

Is anyone familiar with a tool that generates code stubs with meaningful names from class and javadoc? The real question should've been "I have classes without debug information and a matching javadoc, but my IntelliJ IDEA 8.0.1 (please, no IDE wars) doesn't take into account the javadoc and shows me "void setLocation(Object object, Str...

Sum of the digits of the number 2^1000

2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2 power of 1000 (2^1000)? Can anyone provide the solution or algorithm for this problem in java? ...

Best Practice: network communication

Hi stackers, I'm programming a simple network chat with a Python server and a Java client. But one question came into my mind: Which "network protocol" should I use for communication? There are some possibilities for me: YAML: Nice to parse, problem: parsed objects contain language specific parts XML: Easy to parse, big overhead for ...

JavaFX is now out: Are Applets and Java Desktop officially dead/dying?

JavaFX is now out, and there are promises that Swing will improve along with JavaFX. Gone will be the days of ugly default UI, and at long last we can create engaging applications that are comparable to Flash, Air, and Silverlight in terms of quality. Will this mean that Java Applets that hail from 1990's are dead and not worth going b...

Oracle JDBC Euro character

We have a problem with the Euro character when saving and retrieving it from a Oracle 10g using the Oracle 10.2.0.3 JDBC driver. The problem only occurs during a JUnit test running under Linux. The Euro characters returned from database after saving are total screwed up. Oracle has been configured to use character set "WE8MSWIN1252". Cou...

Declare an object inside or outside a loop?

Is there any performance penalty for the following code snippet? for (int i=0; i<someValue; i++) { Object o = someList.get(i); o.doSomething; } Or does this code actually make more sense? Object o; for (int i=0; i<someValue; i++) { o = someList.get(i); o.doSomething; } If in byte code these two are totally equivalen...

How to get a c++ constant pointer equivalent in Java?

When I pass an immutable type object(String, Integer,.. ) as final to a method I can achieve the characters of a C++ constant pointer. But how can I enforce such behavior in objects which are mutable? public void someMethod(someType someObject){ /* * code that modifies the someObject's state * */ } All I want is to prevent som...

Are all compile-time constants inlined?

Let's say I have a class like this: class ApplicationDefs{ public static final String configOption1 = "some option"; public static final String configOption2 = "some other option"; public static final String configOption3 = "yet another option"; } Many of the other classes in my application are using these options. Now, I want to chan...

Writing a GIF file in Java

So I have this GIF file on my desktop (it's a 52 card deck of poker cards). I have been working on a program that cuts it up into little acm.graphics.GImages of each card. Now, however, I want to write those GImages or pixel arrays to a file so that I can use them later. I thought it would be as straight forward as writing .txt files, bu...

Intermittent ClassCastException from ElementNSImpl to own type during unmarshalling

We are experiencing an exceedingly hard to track down issue where we are seeing ClassCastExceptions sometimes when trying to iterate over a list of unmarshalled objects. The important bit is sometimes, after a reboot the particular code works fine. This seems to point in the direction of concurrency/timing/race condition. I can confirm t...

JAX-WS authentication agains a database

I'm implementing a JAX-WS webservice that will be consumed by external Java and PHP clients. The clients have to authenticate with a username and password stored in a database per client. What authentication mechanism is best to use to make sure that misc clients can use it? ...

How to stop editing with DefaultCellEditor when a separate JBtton is pressed

Hi, I got a table with a custom TableCellEditor (extending DefaultCellEditor) with a JFormattedTextField as the editor component. Now I got problem: when I press a separate button while editing. When the button is pressed, the editor remains "open and active" while I'd want it to stop editing so that the changes made would be available...

Best Practice for Spring MVC form-backing object tree initialization

If I have a form-backing object that has a complicated object tree -- say a Person that has a Contact Info object that has an Address object that has a bunch of Strings -- it seems that the object needs to be fully populated with component objects before I can bind to it. So if I'm creating a new Person, I need to make sure it has all t...

In Java Swing how can you manage a list of panels allowing multiple panels to be selected?

I’m working on an in-house app that tracks a bunch of tasks. I wanted to have a simple task monitor that would list the task name and the task’s status. I need this to look just a little nice, I’m no designer so whatever I do is going to suck, but a basic text display won’t work for the project requirements. What I am essentially attemp...

How do I dynamically replace the class loader for an Eclipse plug-in?

I am developing an Eclipse plug-in that fits a client-server model. Its a commercial project so we cannot re-distribute the JDBC drivers for the various databases we support with the plug-in. So I developed a preference page to allow the user locate the jars and have a simple discovery mechanism that iterates through the classes in the ...

Problem with starting OpenOffice service (soffice) from Java (command working in commandline, but not from Java)

I want to exceute a simple command which works from the shell but doesn't work from Java. This is the command I want to execute, which works fine: soffice -headless "-accept=socket,host=localhost,port=8100;urp;" This is the code I am excecuting from Java trying to run this command: String[] commands = new String[] {"soffice","-headl...

Texturing Vertex Buffer Objects

What I want to do is drawing a (large) terrain with OpenGL. So I have a set of vertices, lets say 256 x 256 which I store in a vertex buffer object in the VRAM. I properly triangulated them, so I've got an index buffer for the faces. // vertexes glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBufferId); glVertexPointer(3, GL_FLOAT, 0, 0); //...

Can I generate a compile time error based on the type of the field being Annotated

I have written a java annotation that looks like this: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) // can I further limit this to only fields of type DomainObject? public @interface Owns { } After briefly looking around I couldn't see if there was a way to further limit the usage of this annotation so that only fie...