java

Encoding conversion in java

is there any free java library which i can use to convert string in one encoding to other encoding, something like icnov in php? i'm using java version 1.3 ...

Display the meta/control key in a JLabel

We want to show a hint for a JList that the user can select multiple items with the platform dependent key for multiselect. However I have not found any way to show the OS X COMMAND symbol in a JLabel, which means the symbol that's printed on the apple keyboard on the command key, also called apple key. Here's a picture of the symbol ...

Java implementations of the Prototype Pattern

What implementations of the Prototype Pattern exist on the Java platform? A prototype pattern is a creational design pattern used in software development when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects. Prototype based programming: Prototype-based programming ...

java: what are the best techniques for communicating with a batch server?

Hi all, I've a WEB application (with pure Java servlet) that have some heavy computational work, with database access, that can be done in asynchronous mode. I'm planning to use a dedicated server to execute such batch jobs and I'm wondering which tools/techniques/protocols to use for communication between servlets in the WEB server and ...

Comparing hibernate-mapped dates?

How can i map a date from a java object to a database with Hibernate? I try different approaches, but i am not happy with them. Why? Let me explain my issue. I have the following class [1] including the main method i invoke and with the following mapping [2]. The issue about this approach you can see, when you look at the console output....

When does Hibernate read from second-level cache and when from DB?

As far as I know Hibernate let's you configure entities and collections to be stored in a second-level cache. When does Hibernate try to read these cached entities from the second-level cache and when does it hit the DB? Does Hibernate only read from the second-level cache when loading entities by calling Sesssion.get() and when initia...

unsupported protocol: jndi with Websphere 6.1

I have the problem, that getting a ressource from my archive failed with a MalformedURLException: unknown protocol: jndi The archive is a war file and is deployed into Websphere successfully. When I try to access some files inside the archive via jndi://server/context/filename I get the MalformedURLException. Did anyone know, how t...

How to ignore whitespace while reading a file to produce an XML DOM

Hello, I'm trying to read a file to produce a DOM Document, but the file has whitespace and newlines and I'm trying to ignore them, but I couldn't: DocumentBuilderFactory docfactory=DocumentBuilderFactory.newInstance(); docfactory.setIgnoringElementContentWhitespace(true); I see in Javadoc that setIgnoringElementContentWhitespace meth...

JBoss/EJB vs Symmetric DS

Hi all I'm working on a project which is just about to start, and since I was busy with another one my colleagues went ahead and started working on the specs to the new one. When I came in, they had just chosen to do persistence with plain SQL (promptly accepted my suggestion to add Hibernate, though) but insisted in that data replicati...

Geographical position from Java mobile application?

Is there a way of programmatically determining a rough geographical position of a mobile phone using J2ME application, for example determining the current cell? This question especially applies to non-GPS enabled devices. I am not looking for a set of geographical coordinates, but an ability for a user to define location specific softw...

Eclipse3.3 Junit issues running one test out of a class with more than one

Language is Java. Using JUnit4.1 jar, and jMock1.1 but still using JUnit3 style definitions. Test classes extend MockObjectTestCase (which eventually extends JUnit's TestCase). If I open a test class with more than one test, then right-click in outline view and select run, it runs that one test, then it runs all the other tests in Unro...

Creating multi-platform CDs for software distribution

This is not strictly programming related, but I hope still relevant. I'm working on a project which is written in Java and intended for use on PCs and Macs. It will be distributed on CD (and perhaps DVD, eventually). Our intended audience is decidedly non-technical and, as such, it's important the CD "just work" when it's loaded. Thi...

expose RMI server in JBoss?

I need to access RMI methods from a client front end. For different reasons, I have JBoss running on the server side. This makes me thinking of using JBoss to expose the RMI server methods. I'm kinda new to JBoss, so my question would be: What steps are required in order to make the RMI server methods visible to the client? ...

How do I create a "Hello World" application in java for an iphone?

I'd like to create a basic "Hello World" style application for the IPhone using Java - can anyone tell me how? ...

Abstract Java Grid

Hi, I'm looking for an abstract representation of a grid in Java (grid as in that thing with columns and rows of data). Do such things exist? I want to be able to sort, filter, keep track of rows, set column properties etc. I'll then be realising the grid on the web. To be clear: I've already decided on the ultimate view technology ...

How to improve Netbeans performance

hello and good day for everyone This is my question. Exists a real way to get Netbeans load faster and working time too? It is to slow and when you have some time coding is worse it eat all my ram with no more.... bye bye ...

Ways to save enums in database

Hey guys. I am wondering what the best ways to save enums into a database is. I know there are name() and valueOf() methods to make it into a String back. But are there any other (flexible) options to store these values? Is there a smart way to make them into unique numbers (ordinal() is not safe to use)? Any comments and suggestions...

Size of a byte in memory - Java

I have heard mixed opinions over the amount of memory that a byte takes up in a java program. I am aware you can store no more than +127 in a java byte, and the documentation says that a byte is only 8 bits but here I am told that it actually takes up the same amount of memory as an int, and therefore is just a Type that helps in code c...

Using request.setAttribute in a JSP page

Is it possible to use request.setAttribute on a JSP page and then on HTML Submit get the same request attribute in the Servlet? ...

What is the best way to precompile JSPs using ANT

I am trying to figure out the best way to use ANT to precompile JSPs that will be deployed to an Oracle application server. Even though I am deploying to an Oracle app server I would like to avoid using Oracle's version of ANT. ...