java

Are there tools to integrate Java and C++?

Hello, thanks for reading this question. I am doing this homework which need a GUI as frond end to integrate with back end code which written in C++. I wanna to write this front end GUI in java as its cross-platform feature and strong graphic components. Is there any good way I can integrate java and C++ well? Thank you ...

remote and dynamic proxy

i understand that ,once, developing remote proxy included generating stub/skeleton , though today this is no longer needed thanks to reflection. (dynamic proxy) i want to get a clear explanation as to why and how reflection replaces this need. for example i understood the stub was suppose to handle the communication over the network (...

Hibernate > CLOB > Oracle :(

I am trying to write to an Oracle clob field a value over 4000 characters. This seams to be a common issue but non of the solutions seem to work. So I pray for help from here. Down and dirty info: Using Oracle 9.2.0.8.0 Hibernate3 implementing pojo's with annotations Tomcat 6.0.16 Oracle 10.2.x drivers C3P0 connction pool provider In...

Useful Java Annotations

I'm interested in finding out exactly which Java annotations people think are most useful during development. This doesn't necessarily have to limited to the core Java API, you may include annotations you found in third party libraries or annotations you've developed yourself (make sure you include a link to the source). I'm really i...

Java: get a unique property of an object (like hashcode, but collision proof)

I have a task for which it is necessary to generate a unique value for every object in a set. using the hashcode would be perfect, if collisions weren't allowed in the hashcode contract. One idea: Record every object's hashcode into a multiset. Then, use hashcodes as the unique identifier, but if that hashcode is in the set more than o...

How to implement a cache with binary array as key and binary arrays as values in Java

I have a requirement to create a java cache which holds all the cities and airports. So, if i query the cache for a location, lets say a city, it should return all the airports in that city and if I query a location which is an airport, i should get back that airport. Also, each location has to be stored as a byte array in cache.(as the...

Why does InvokeLater cause my JFrame not to display correctly?

Ok I've read an searched all over the web, and I've not found the solution to my problem yet, perhaps I'm missing something simple, hence here I am... I've got a rather large project, that handles work orders for a repair business. It's all database connected, many many pages of code, and classes. But i just added a short bit of code to...

Error while defining String constant

Given: public static final String XML_POLICY = "<?xml version="1.0"?>" +"<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">" + "<cross-domain-policy>" + "<allow-access-from domain="*" to-ports="*" />" + "</cross-domain-policy>"; I am getting compile ...

JUnit tests run in eclipse return errors even though I have expected annotation

(This is a follow up question to this one.) I'm having a problem with JUnit4 tests in eclipse. I'm trying to use the @Test(expected=...) annotation to unit test exception throwing. The problem is that when I run the tests, they come back as errors instead of passing, even though I'm expecting the exceptions to be thrown. I'm using ecli...

Hibernate OO Design Question

I'm working on creating a Hibernate query engine that can create dynamic queries. Thus far I've been using the Criterion API to generate the queries. I'm having a hard time writing the engine in an OO fashion. I want to be able to create a new class for each association and have it pass back a fragment of the SQL call. For example: ...

Clean up code in finalize() or finally()?

I had the general view that clean up of resources is done in the finally{} block, recently I found this particular code snippet in a class and it was overriding the Object class' finalize() method. protected void finalize() { try { In.close(); Out.close(); socket.close(); } catch (Exception e) { ...

JOGL Snow Leopard and Eclipse

Hi everyone, I'm trying to get JOGL running in Eclipse 3.5 on a MacbookPro 64bit Snow Leopard with Java 1.6. The code runs on my XP machine, however, when I try to run it on my macBook, I get this error in Eclipse's console: Invalid memory access of location 00000000 eip=8fe11f32 And thats it. I've tried a few different codes, ...

JasperReports with resolution different than 72dpi

I've been trying to use JasperReports to print in a resolution above 72dpi, with no success. I need to use some resolution above 72dpi because I'm going to print in those pre-formatted adhesive labels, which need a certain level of precision when setting the positions. But, as JasperReports can only use pixels, and AFAIK only supports t...

How can I disable log4j RollingFileAppender buffering for a demo?

I have a Java programming lab-exercise in a course with students that I'd like to artificially write to disk in an inefficient manner. What I thought would be a mildly hard-to-find (as an exercise) would be having the app's log4j statements writing to disk in an unbuffered fashion. The app intentionally has prolific log statements. Wh...

Java: Static Class?

I have a class full of utility functions. Instantiating an instance of it makes no semantic sense, but I still want to call its methods. What is the best way to deal with this? Static class? Abstract? ...

hibernate don't read from ehcache.xml OR not timeout?

This is how my entity look like @Entity @Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @Table(name = "TestPojoOnly") @NamedQueries({@NamedQuery(name = "TestPojoOnly.findAll", query = "SELECT h FROM TestPojoOnly h"), @NamedQuery(name = "TestPojoOnly.findById", query = "SELECT h FROM TestPojoOnly h WHERE h.id = :id"), @Na...

Java : Reading in a binary file.

I have an program that allows a user to input their employee name and number and then their hourly wage and their total number of regular hours and overtime hours. Then writes out the data to a binary file. The program I need assistance with reads in that file, adds a new field at the bottom, "Gross Pay", and calculates the gross pay fr...

jpa @version optimistic locking

I loaded same entity record on 2 separate browser window then press submit (hibernate template.merge), version number incremented for both browser window, but never caught any problem with optimistic lock.. so how to test this? my save() look like this hibernatetemplate().merge(..); setJPAObject(null); //reset after save ...

understanding class diagram

Can anyone explain what the connectors mean? What freeware can generate a diagram like this? ...

How can I make the SmartGWT core smaller?

I have recently written a Hello World application using SmartGWT and noticed that the size of the application is huge. In my case it is over 600kb just for that application. I think that size is obscene so I narrowed the culprit down to two core libraries, ISC_Core and ISC_Foundation which combine for a total size of 649kb. Is there any...