java

Creating a PDF from Java and Displaying it in a webpage

Currently I am using FOP to generate a pdf from java code and an xslt document. The FOP spits out a PDF file that is displayed (embeded) into a webpage. The documents can range between one and several thousand pages long, and it can take some time to generate them. Is there a better tool that and do this? Is FOP the best option in the ...

Findbugs warning: Equals method should not assume anything about the type of its argument

When running FindBugs on my project, I got a few instances of the error described above. Namely, my overriding versions of equals cast the RHS object into the same type as the object in which the overriding version is defined. However, I'm not sure whether a better design is possible, since AFAIK Java does not allow variance in method ...

Output SQL query results to flat-file with Java

Is there an easy or straightforward way in Java to output the results of a DB Query to a file (either csv, tab, etc). Perhaps even in Hibernate? I know that a query results can be dumped to a flat file on the DB Server. I am looking for a way that an application can run a query and get those results into a file. I realize one option ...

Is there a general "backend" library for Java reflection

I'm currently working with a specialized, interpreted, programming language implemented in Java. As a very small part of the language, I'd like to add the ability to make calls into Java. Before I dive into all of the nitty-gritty of reflection, I was wondering if anyone knew of a general library for doing the "backend" part of invoking...

Fastest way to share data objects between a Java server and a C# client

What is the fastest way to share data structures between Java and C#? I want something where I can literally send a "car" object or a "foo" object and have it serialized and deserialized on both server and client. ...

What does Java use to determine if a key is a duplicate in a Map?

My first instinct is to say each key is an object, and has a hash code, which is what is used to determine if a duplicate is being inserted. However, I can't find anything to back that up for sure. Can someone provide a link that says that, or provide the real answer here? Thanks! ...

Input and Output Stream Pipe in Java

Does anyone have any good suggestions for creating a Pipe object in Java which is both an InputStream and and OutputStream since Java does not have multiple inheritance and both of the streams are abstract classes instead of interfaces? The underlying need is to have a single object that can be passed to things which need either an Inpu...

Faster Insert Oracle Hash Cluster Table

Hi! Since I kicked off the process of inserting 7M rows from one table into two others, I'm wondering now if there's a faster way to do this. The process is expected to finish in an hour, that's 24h of processing. Here's how it goes: The data from this table RAW (word VARCHAR2(4000), doc VARCHAR2(4000), count NUMBER); should find a...

Multi-threading: Objects being set to null while using them.

I have a small app that has a Render thread. All this thread does is draw my objects at their current location. I have some code like: public void render() { // ... rendering various objects if (mouseBall != null) mouseBall.draw() } Then I also have some mouse handler that creates and sets mouseBall to a new ball when the ...

Simple transparency example not working in Java 3D

Hi all, I'm a complete n00b in j3d (but an expert in Java). Just starting out, I'm running into a problem playing with transparency. I've got a simple example which draws a rotating planar quad (disappears when showing the back face because I haven't disabled backface culling). With the Color3b and COLOR_3 lines uncommented (and the co...

Is there an equivalent to BundleActivator for Eclipse fragment projects?

I am building an Eclipse plug-in that provides a set of core features in the regular plug-in project. The optional features I am providing via fragment projects. But I need the fragments to register themselves with the main plug-in on start-up. I cannot have a Bundle-Activator in the fragment project. So I am wondering is there some alt...

JTable entire table data change

Is there a relatively simple way to change all the data in a JTable? For example, if I have a JTable named books which contains information about all books by a certain author, and then the user changes the author, I would have to update that table with a completely new set of information (note, because of the volume of data in question,...

Regex for splitting a string using space when not surrounded by single or double quotes

Hello all. I'm new to regular expressions and would appreciate your help. I'm trying to put together an expression that will split the example string using all spaces that are not surrounded by single or double quotes. My last attempt looks like this: (?!") and isn't quite working. It's splitting on the space before the quote. Exampl...

What is the use of Strictfp method in java?

What is the use of Strictfp method in java? ...

Double value returns 0.

Here's an example: Double d = (1/3); System.out.println(d); This returns 0, not 0.33333... as it should. Does anyone know? ...

Java GUI - General

Hello all you helpful folks @ stackoverflow! Best resources for Java GUI's? Looking at the Java Documentation, it is pretty easy to figure out the basics of JButtons, JFrames, etc but grasping the concepts of accessing JComponents from a frame, what creating a different panel does, etc is not very easy to understand. Is there some tut...

Variable event

Hi guys I'm having a problem with a Klondike Solitaire I'm programming. It's almost finished but now when I try to compile (I'm using Dr. Java, yeah I know), it keeps popping up with 2 errors. Cannot find symbol: Variable event Cannot find symbol: Method "findbunki" (java.awt.Point) I've already imported java.awt, so that can't be it....

Do you write interactive console applications?

I believe people still write a lot of console applications, including interactive ones, especially small utilities and administrative interfaces. Mostly for sake of simplicity. Do you write interactive console applications? Do you think it should be even easier than already is? U: for clarity, let's define 'interactive console applicat...

Mono - sharing code on client and server . . .

We are trying to come up with our client and server standard and there is a big debate. One school of thought is C# client and java servers using some type of proprietary messsage library to share data objects (think XML like structure . .) The issue with this model is that there is lots of code that needs to be duplicated (validation,...

Java 6 Excessive Memory Usage

Does Java 6 consume more memory than you expect for largish applications? I have an application I have been developing for years, which has, until now taken about 30-40 MB in my particular test configuration; now with Java 6u10 and 11 it is taking several hundred while active. It bounces around a lot, anywhere between 50M and 200M, and...