java

DBus-Server in Java?

Is there a server implementation of DBus for Java? There's a lib for clients and services (not servers). ...

How do I auto load a database jar in Groovy without using the -cp switch?

I want to simplify my execution of a Groovy script that makes calls to an Oracle database. How do I add the ojdbc jar to the default classpath so that I can run groovy RunScript.groovy instead of groovy -cp ojdbc5.jar RunScript.groovy ...

HashSet.remove() and Iterator.remove() not working

I'm having problems with Iterator.remove() called on a HashSet. I've a Set of time stamped objects. Before adding a new item to the Set, I loop through the set, identify an old version of that data object and remove it (before adding the new object). the timestamp is included in hashCode and equals(), but not equalsData(). for (Itera...

Any disadvantages to using spring to separate tests and data?

I've been struggling coming up with a good solution to separate my testing data from unit tests (hard coded values). Until it dawned on me that I could create beans with spring and use those beans to hold my data. Are there any draw backs to coding my unit tests this way? Albeit they run a bit slower seeing as how spring has to c...

msvcr71.dll file missing on Win Vista when trying to run my java swing application

I've done numerous searches and I realize that I can just download this file and install it either in windows/system32 or in the application's directory. My question is, how does this dll generally get installed on Vista? I tried installing the .net framework 3.5 and it didn't get installed with that. Background: I'm running a java.jar...

jdbc: when can i close what

currently i have jdbc code with the following basic stucture: get Connection (do the next 4 lines several times, never closing statement) get statement get result set process result set close result set close connection It occurred to me after writing this code that i need to close the statement. 1 what are the effects of not cl...

File Upload with Java (with progress bar)

I'm extremely new to Java, and have mostly just been teaching myself as I go, so I've started building an applet. I'd like to make one that can select a file from the local disk and upload it as a multipart/form-data POST request but with a progress bar. Obviously the user has to grant permission to the Java applet to access the hard dri...

In Java, for a string x, what is the runtime cost of s.length()? Is it O(1) or O(n)?

I've been told that code such as: for (int i=0; i<x.length(); i++) { // blah } is actually O(n^2) because of the repeated calls to x.length(). Instead I should use: int l=x.length(); for (int i=0; i<l; i++) { // blah } Is this true? Is string length stored as a private integer attribute of the String class? Or does lengt...

JSP bean tag for property that might not exist

In JSP I can reference a bean's property by using the tag ${object.property} Is there some way to deal with properties that might not exist? I have a JSP page that needs to deal with different types. Example: public class Person { public String getName() } public class Employee extends Person { public float getSalary() } In J...

Referencing existing SWIG wrappers when creating new ones

I have an existing library (JPhysX) that is a Java wrapper for a native C++ library (PhysX). The Java library makes use of types generated by SWIG, for example, com.jphysx.SWIGTYPE_p_NxStream, which represents a pointer to an NxStream object in the C++ code. Now I want to create my own C++ class that inherits from the C++ type NxStream, ...

Which is the best JSON rewriter for Java?

Which JSON rewriter is the best for applications written in Java? Criteria may vary. I'm personally most interested in stability and performance. ...

Hibernate CRUD à la Ruby on Rails' Scaffolding

Guys, Do you know of any tool that would do like Ruby on Rails' Scaffolding (create simple CRUD pages for any particular class to allow quickly populating a database with dummy data), only which used Java classes with Hibernate for database access, and JSP/JSF for the pages? It is a drag when you are programming one part of an applica...

Automating unit tests (junit) for Eclipse Plugin development

I am developing Eclipse plugins, and I need to be able to automate the building and execution of the test suite for each plugin. (Using Junit) Test are working within Eclipse, and I can break the plugins into the actual plugin and a fragment plugin for unit testing as described here, here and in a couple places here. However, each of ...

Learning Java

I've been doing C++ development for the last 5 years and need to pick up Java for a new job. Do you have any suggestions on books/websites/etc to help me with the transition? ...

indispensible JSP tag libraries

Hi, I'm interested to know what are the "must have" JSP tag libraries apart from JSTL. All I've found so far are ccc - for accessing static constants in JSP (without scriptlet) displaytag - for generating sophisticated HTML tables that includes data paging, grouping, sorting, exporting etc. What other indispensible tag libs are out ...

Word Wrap in Net Beans

I'm just learning to code in java. Netbeans is great but I just found there's no way to wrap text in it (or hopefully I haven't found it yet). Is there any way to do this, and if not, is there any similarly good IDE for Java with this functionality (hopefully free as well). Thanks. ...

Are there any tools to help the user to design a State Machine to be consumed by my application?

When reading this question I remembered there was something I have been researching for a while now and I though Stackoverflow could be of help. I have created a framework that handles applications as state machines. Currently all the state business logic and transactions are handled via Java code. I was looking for some UI implementat...

What's a good way to teach my son to program Java

OK, so I've read through various posts about teaching beginner's to program, and there were some helpful things I will look at more closely. But what I want to know is whether there are any effective tools out there to teach a kid Java specifically? I want to teach him Java specifically because (a) with my strong background in C I fe...

Best OS for java development?

What is the best OS for Java development? People from Sun are pushing the Solaris, yes Solaris have some extra features included in itself such as (dTrace, possibility for Performance tuning the JVM, etc.. ). Some friends of mine, had port their application on solaris, and they said to me that the performances was brilliant. I'm not happ...

Which exception should I raise on bad/illegal argument combinations in Python?

I was wondering about the best practices for indicating invalid argument combinations in Python. I've come across a few situations where you have a function like so: def import_to_orm(name, save=False, recurse=False): """ :param name: Name of some external entity to import. :param save: Save the ORM object before returning. ...