java

Testing/troubleshooting tool for network connections?

I am creating a non-blocking IO system for the server side of my project. The actual implementation isn't important (it is Java NIO if you care), but I feel very intimidated by the subtle issues you have to pay close attention to when programming socket communications. My knowledge is lacking in a lot of areas, so I can't even conceive...

How to persist a complicated, nested object with JPA

I'm working on a project which parses information with a NLP library from classified ads on internet forums. After the processing I have ForSaleItem instances and all sorts of details like condition, price etc. When I call the toString() method on these objects, it does not return a string stored in the object itself but rather looks up...

java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01438: value larger than specified precision allows for this column

I'm getting this error message in production. Unfortunately this comes from a purchased application and the support process is not precisely fast. This happens when data is being copied from one table to another. Both tables are supposed to have the same columns types and length. So far I have reviewed a some of them by doing the fol...

Multidimensional array manipulation - Java

I have a series of arrays that i draw data from and ultimately lead to a final array that holds the information i want. The final array is 2-dimensional, being comprised of a large number of single dimensional arrays, each holding up to 3 entries. int[][] realOcc = new int[result.length][3]; The way the array holds data is as follows:...

Looking for Java Telnet emulator

I am writing a back end program that telnets into a server, runs some commands and saves all the output from those commands. Something just like Expect. I would like to use an open source solution that is well supported and runs with JDK 6. I have found 3 options so far and would like some help deciding which one (or a better sugges...

In Java is there a performance difference between referencing a field through getter versus through a variable?

Is there any differences between doing Field field = something.getSomethingElse().getField(); if (field == 0) { //do something } somelist.add(field); versus if (something.getSomethingElse().getField() == 0) { //do something } somelist.add(something.getSomethingElse().getField()); Do references to the field through getters i...

Web Services with Google App Engine

I see that Google App Engine can host web applications that will return html, etc. But what about web services that communicate over http and accept / return xml? Does anyone know how this is being done in Goggle App Engine with Python or for that matter in Java (JAS-WX is not supported)? Any links o samples or articles is greatly appr...

Perl compared to Java

For programming tasks that need to be developed quick how does Perl compare to Java? How about as far as speed, would Perl be much slower than Java? Whenever I need to program something quick I use Java. All the available libraries and built in goodness make Java pretty nice in my eyes. But there's a lot of people that swear by perl. In...

Find primary key created by Hibernate JPA

Short version: Is there a simple way to get the value of a primary key after doing a merge() in Hibernate JPA? Details: I'm making a generic library that uses Hibernate. The library uses JPA's merge() to serialize a POJO to the database. What's the best way to discover the primary key's new value? I'm assuming that the primary key ...

Swing: Passing a value back to the UI from a scheduled thread

I have a system tray UI in Java that requires a schedule database poll. What is the best method for spawning a new thread and notifying the UI? I'm new to Swing and it's threading model. ...

How do I read a private field in Java?

I have a poorly designed class in a 3rd-party JAR and I need to access one of its private fields. For example, class IWasDesignedPoorly { private Hashtable stuffIWant; } IWasDesignedPoorly obj = ...; How can I use reflection to get the value of stuffIWant? ...

Java Inheritance Question

I Have something similar to this setup: public class Base { public String getApple() {return "base apple"}; } public class Extended extends Base{ public String getApple() {return "extended apple"}; } Somewhere else in the code I have this: { Base b = info.getForm(); if (b instanceof Extended){ b = (Extended) b;...

Eclipse TPTP or other java profiling solutions on OSX. Suggestions welcome

I'm attempting to profile junit tests in eclipse on OSX using TPTP. I installed the TPTP package from eclipse with no problem, I went to profile some code and it tells me: Agent Controller is unavailable under port 10002. Make sure that the service is started and the port number is correct under preferences. I searched around o...

Desktop Version of Google's Annotated Time Line Component?

I've been using Google's Annotated Time Line Visualization component for the last couple of weeks and I love it! I've been able to make plots with about 10k points without much trouble. Do you know of a desktop component I could plug into my application that delivers the same WOW factor that Google's component does? I don't care what th...

Caching large Arrays to SQLite - Java/ Android

Im currently developing a system where the user will end up having large arrays( using android). However the JVM memory is at risk of running out, so in order to prevent this I was thinking of creating a temporary database and store the data in there. However, one of the concerns that comes to me is the SDcard limited by read and write....

Calling remove in foreach loop in Java

In Java, is it legal to call remove on a collection when iterating through the collection using a foreach loop? For instance: List<String> names = .... for (String name : names) { // Do something names.remove(name). } As an addendum, is it legal to remove items that have not been iterated over yet? For instance, //Assume that...

Is there a way to transfer/translate the code written in Java to other languages?

Theoretically this seems possible to me. So can Any one confirm this to me, if it's possible? and if there is such a software that does this?(like Java to C++ or C#) And in general would it be possible to transfer languages like Java to server-side programing language like PHP? ...

TCP Vs. Http Benchmark

I am having a Web application sitting on IIS, and talking with [remote]Service-Machine. I am not sure whether to choose TCP or Http, as the main protocol. more details: i will have more than one service\endpoint some of them will be one-way the other will be two-ways the web pages will work infront of the services we are talking about...

Custom slider UI Swing

I'm trying to create a custom extension of BasicSliderUI. I'm just trying to make the thumb a circle (note I'm in the Windows L&F). I've created a very simple implementation that just calls g.drawOval, but whenever I drag it, it leaves a "trail" behind. Any ideas why this is? thanks, Jeff ...

What's a Java alternative to Google App Engine for developing iPhone Push Notification services?

I'm a Java programmer who is working on an iPhone application. I'd like it to use Push Notification services. I originally thought I could use Google App Engine to provide the payloads to Apple, but I see now that it won't be possible because App Engine doesn't support the low-level socket programming that is needed to communicate with...