java

Java GUI amd FPGA

Hi, I study on a robot simulator that written on Java environment.But sonar scan simulations and computational burden of some driven algorithms on robot drop my simulator's performance. So ı have decided to use fpga module and put the computational burden on it.I have spartan 3a development kit for this implemenatation. Does anyone ha...

StringUtils.defaultString euphemism for collections?

Is there an analogous method to StringUtils.defaultString for collections, so you can avoid checking for null value, since in most cases, the desired effect is the same as if it were an empty list? e.g. to replace if (list != null) { for (String item: list) { // ... } } with something like for (String item: ListUtils.defaultList...

How to determine at runtime the path to a Mavenized Eclipse project directory

Total Maven newbie, trying (along with the rest of a sizeable team) to convert a monstrous pile of legacy code from ant over to Maven. It's working reasonably well, but I'm having the following problem. I have a project, let's call it Core, that at runtime needs to load some files checked in under some different projects, let's call the...

java.lang.NoSuchMethodError: method java.util.TreeMap.firstEntry with signature ()Ljava.util.Map$Entry; was not found.

I'm trying to use ceilingKey(), ceilingEntry(), firstKey() and firstEntry() of the TreeMap class but getting error: java.lang.NoSuchMethodError: method java.util.TreeMap.firstEntry with signature ()Ljava.util.Map$Entry; was not found. This error is caused by following code: if (tmpmap.size() == 1 && tmpmap.firstKey() == req_sbyte && t...

How can I use pointers in Java?

I know Java doesn't have pointers, but I heard that Java programs can be created with pointers and that this can be done by the few who are experts in java. Is it true? ...

Precision nightmare in Java and MSSQL

Hi everyone, I've been struggling with precision nightmare in Java and MSSQL up to the point when I don't know anymore. Personally, I understand the issue and the underlying reason for it, but explaining that to the client half way across the globe is something unfeasible (at least for me). The situation is this. I have two columns in ...

Exception thrown after processing onSubmitAction

Hi, I am very new to Spring and I have a simpleFormController with 2 methods. referenceData() with is called when the page loads and onSubmitAction() which is called on the submit of a form. I am getting a nullPointerExcpetion after all my onSubmitAction() code has completed and I suspect it has something to do with where the flow of ...

Question on Java Generics Bounded Wildcard

Is there a difference between 1) <N extends Number> Collection<N> getThatCollection(Class<N> type) and 2) Collection<? extends Number> getThatCollection(Class<? extends Number>) ...

Comparing Java enum members: == or equals() ?

I know that Java enums are compiled to classes with private constructors and a bunch of public static members. When comparing two members of a given enum, I've always used .equals(), e.g. public useEnums(SomeEnum a) { if(a.equals(SomeEnum.SOME_ENUM_VALUE)) { ... } ... } However, I just came across come code tha...

Singular Value Decomposition Implementation

I have a SVD library implemented in C. But I want to call its functions in a Java program. Is there a easy way to do that? Or someone please suggest a link for a SVD implementation in Java. ...

Java: Strong Code mobility How to?

Does anyone know how to use Java for Strong code mobility? Have you ever done it before? Here's what I try to achieve. Suppose we have 2 separate Java applications that communicate over network. App A and App B. App A has a class x instantiated as an object, and has been using it. App B has no prior knowledge of this class x. App A n...

Combination of field as unique where one is a one-to-may unidirectional with HIbernate/JPA annotations

hello i'm not sure whether the title depicts the my situation very well.I'm developing a user and contact managment system with hibernate. i have an UserAccount pojo, contact pojo and phone object.i limited it to 3 since since those are in concern.UserAccount has a bidirectional with contact, and both have unidirectional with phone pojo....

getting better performance appending strings than going through standard Java stringbuilder.append

Hi, as part of the process of populating a search engine, I populate a Berekely-DB value-store as well. This process is repeated each night and at the moment +/- 60% of the total running time each night is caused by creating the values to be inserted into the value-store ( so excluding the actual insertion into Berekely-DB and the time...

How do I prevent form resubmission in Seam?

I have a simple form that I don't want accidentally submitted multiple times. I can easily block the user from multiple clicks when they first see the page, but I have no control over them hitting the back button. So, having worked with Struts, I decided that a form submit token was the way to go. Is there an easier way? Is this func...

Eclipse no longer displays compile error badges

The compile error badges have stopped showing up on my source files but still display at the project level (see screen shot below). They used to show up for me, but since this morning, they've stopped displaying as they usually do. The exact compile error still shows in the Problems view, but there is no quick way to determine at a glan...

Should the jndi name for a datasource be looked up by a ServiceLocator?

I have a J2EE webapp which is used to upload a file which is then processed by a database procedure. Because we do not want the webapp to have to wait until the database procedure completes, it is executed in a different thread. The process running in the separate thread needs to obtain and close its own connection. The webapps usually...

How to start cxf service on localhost but return external address in wsdl?

I'm using cxf and jetty behind apache to expose a webservice via soap. The goal is to start jetty on http://localhost:9000 in all cases and have apache proxy to it, but have the autogenerated wsdl show a soap:address appropriate to the environment it's running in (eg http://api.testing.example.com, http://api.uat.example.com, https://ap...

Faster implementation of Math.round?

Are there any drawbacks to this code, which appears to be a faster (and correct) version of java.lang.Math.round? public static long round(double d) { if (d > 0) { return (long) (d + 0.5d); } else { return (long) (d - 0.5d); } } It takes advantage of the fact that, in Java, truncating to long rounds in to ...

upload file using inputstream in GAE java

I am trying to upload file to google sites and am obtaining the stream using apache commons file upload. I get the input stream as under InputStream is = fileItem.openStream(); How will I convert this input stream in file object so that below call succeeds and I am able to set the MediaFileSource to above converted file. Atta...

Java Null Conditional

I have the following pattern appearing many times in my Java code and was wondering how some of you might refactor it. Object obj1 = buildObj1(); if (obj1 != null) { return obj1; } Object obj2 = buildObj2(); if (obj2 != null) { return obj2; } Object obj3 = buildObj3(); if (obj3 != null) { return obj3; } ...