java

What architecture? Distribute content building across a cluster.

Hi All, I am building an content serving application composing of a cluster of two types of node, ContentServers and ContentBuilders. The idea is to always serve fresh content. Content is fresh if it was built recently, i.e. Content.buildTime < MAX_AGE. Requirements: *ContentServers will only have to lookup content and serve it up (...

Java charset and Windows

I have a java program that runs msinfo32.exe (system information)in an external process and then reads the file content produced by msinfo32.exe. When the java program loads the file content into a String, the String characters are unreadable. For the String to be readable I have to create the String using String(byte[] bytes, String c...

How can I work with Novell eDirectory services in J2SE?

How can I work with Novell eDirectory services in J2SE? Will JNDI work with eDirectory? What are some resources I can use to learn about whatever library or libraries you suggest? I just want to play around with retrieving information via LDAP for right now, and if I get things working the way I want, I will probably need to be able t...

Reading HTML file to DOM tree using Java

Is there a nice parser/library which is able to read an HTML document into a DOM tree usinf Java? I'd like to use the standard DOM/Xpath API that Java provides. But all libraries I can find only seem have custom APIs to solve this task. Furthermore the conversion HTML to XML-DOM seems unsupported by the most of the available parsers. A...

What options do I have for reading Excel files and evaluating formulas in C#, Java and PHP?

I've seen various means of reading (and writing) Excel spreadsheets. For example: In .Net as an ADO.Net source (as per Reading Excel files from C#); In Java with either JExcelAPI ("jxl") or Apache POI; In PHP with the Excel Spreadsheet Writer (as per Format text in Excel file via PHP and PHP:Writing to excel file using PEAR). But I'...

JavaBeans Activation Framework: is it worth learning?

Recently I've stumbled upon a class named javax.activation.DataHandler. But while reading the javadoc of JDK6, I was not able to understand the aim and rationale of the framework. If you have have used the framework in real life project, please share your experience and explain what a developer can "earn" from it. ...

Does Java need tuples?

This question got me re-thinking about something that always bothered me: Does Java need tuples? Do you feel the lack of them in your day-to-day work? Do you think tuples would simplify otherwise complex data structures you find yourself implementing? ...

How do you access Class object for generics?

How can I access Class object for Generics? Currently, I am doing it this way: List<String> list= new ArrayList<String>(); list.getClass(); Is this OK? Or, what should be the way? ...

Spring constructor params?

Some of my classes have final fields that are populated from the constructor as well as properties that can be assigned from getters and setters. If I can do this using spring, what does the springcontext.xml file look like that creates objects in this way? Thank you ...

What are the things Java got right?

What are the things that Java (the language and platform) got categorically right? In other words, what things are more recent programming languages preserving and carrying forward? Some easy answer are: garbage collection, a VM, lack of pointers, classloaders, reflection(?) What about language based answers? Please don't list the ...

What are the things Java got wrong?

I read a lot of blogs and see people all the time talking about bad things in the java programming language; a lot of them are about annotations and generics that were added to the language in 1.5 release. What are the things in the language or the API that you don't like or would design differently? ...

Creating package-level associative array in java

Is it possible to create a java representation of a package-level oracle associative array. For example, given the following: CREATE OR REPLACE PACKAGE MyPackage AS TYPE t_numbers IS TABLE OF NUMBER INDEX BY PLS_INTEGER; I find I cannot write the following java: ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("M...

Map problem with JPA / Hibernate / PG

I have two entities, Entity1 and Entity2, on a one to many relationship. On Entity1 I have a map which contains entries. The code I use to persist a new Entity1 with some Entity2 on the map is like this: Entity1 e1 = new Entity1(); Entity2 e2 = null; e1.setE2s(new HashMap<String, Entity2>()); for (String key : someKe...

refresh setCellEditor for JTable

Hi, I was looking for an answer for a previous question and had an ingenious idea to overcome a limit on JTable. I need the editor to be different on a row by row basis, whereas JTable can only handle a single editor for each column. So my idea is to use a MouseListener to check the row and column on the JTable and set new editor ea...

CPLEX Error 1001: Out of memory

Hi I was trying to solve an LP with CPLEX. It throws an exception "CPLEX Error 1001: Out of memory" when I am building the model. Please note that I am getting this error while modelling and not while optimizing. There are google results for Out of memory scenarios during optimization. Your help is highly appreciated Thanks ...

How do you make REALLY large boolean arrays using Java?

When I try to make a very large boolean array using Java, such as: boolean[] isPrime1 = new boolean[600851475144]; I get a possible loss of precision error? Is it too big? ...

(Java) How can I override a class using a separate jar?

A customer requires a preview of a new feature of our product. They asked to have that feature sent to them in a jar file (like a patch). There's no problem with including the new classes in said jar file. However, an existing class was modified, which is needed to integrate the new feature. They just want to add this new jar file withou...

Consuming in Java a .NET Web Service that requires a custom SOAP Header

So I need to consume a Web Service that uses a custom SoapHeader, as described below. What is the simplest way to pass the correct values through this header using Java. I'm using Netbeans. <?xml version="1.0" encoding="utf-8"?\> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSc...

How can I find out how many rows a MySQL query returns in Java?

How can I find out how many rows a MySQL query returns in Java? ...

How do I dynamically access request parameters with JSP EL?

I'm looping through a list of items, and I'd like to get a request parameter based on the item's index. I could easily do it with a scriptlet as done below, but I'd like to use expression language. <c:forEach var="item" items="${list}" varStatus="count"> <!-- This would work --> <%=request.getParameter("item_" + count.index)%> ...