java

Suggestions for books to buy for an office library?

We're thinking of starting up a little bit of a "library" here at work for programming/development books, to have some shared books available as references. Any suggestions on titles to put on the list? We mostly concentrate on Java and web application development, using Spring, Web Services, SQL, etc. My thoughts so far: Effective J...

jsp utf encoding

I'm having a hard time figuring out how to handle this problem: I'm developing a web tool for an Italian university, and I have to display words with accents (such as è, ù, ...); sometimes I get these words from a PostgreSql table (UTF8-encoded), but mostly I have to read long passages from a file. These files are encoded as utf-8 xml, ...

Inheritance in Java - creating an object of the subclass invokes also the constructor of the superclass. Why exactly?

Hallo, I have a question about inheritance in Java. I have two classes A and B, and class B, inherits from A: public class A { public A() { System.out.println("Hi!"); } } public class B extends A { public B() { System.out.println("Bye!"); } public static void main(String[] args) { ...

Java equivalent of Cocoa NSNotification?

I am writing a Java application using SWT widgets. I would like to update the state of certain widgets upon a certain event happening (for example, updating the data model's state). Is there something in Java similar to Cocoa's NSNotificationCenter, where I can register an object to listen for notification events and respond to them, as...

Which Java MVC frameworks integrate easily with StringTemplate?

It's hard to see how StringTemplate integrates easily (or not) with popular Java web MVC frameworks. Which Java MVC frameworks integrate easily with StringTemplate? A good answer: mentions one solution to integrate with a framework, includes a link to something useful and applicable, like: a tutorial, or documentation, or a referenc...

Spreadsheet Parser in Java/Groovy

Hi I'm looking to parse spreadsheets (xls/ods) in Groovy. I have been using the Roo library for Ruby and was looking to try the same tasks in Groovy, as Java is already installed on a development server I use, and I would like to keep the number of technologies on the server to a simple core few. I am aware that the ods format is zipped...

Errors forming a JAXP Schema (javax.xml.validation.Schema)

We are using JAXB 2.x to generate data objects from a massive schema system (42 XSD files). That entire process runs fine, no problems there. But they deprecated (and removed from implementation) the entire JAXB validation framework, replacing it with the JAXP validation framework instead. (This is all located in the javax.xml.validation...

Breadth-First search in Java

Hi I am having to run a breadth-first search in Java for an assignment. I have a 5x5 grid of tiles (24 in total - 1 tile is left 'blank'). The point of the search is to rearrange the tiles by moving the 'blank' up, down, left or right to eventually rearrange the tiles into the correct order. To do this search, I have created an Arrayli...

Using swing how can I flash the Windows Taskbar

I'm developing a swing application and I need to flash the windows task bar. I can't use frame.requestFocus(); because I don't want to steal focus from any other application. ...

HQL - row identifier for pagination

Does anyone know if HQL has a keyword to identify rows such as ROWID or ROWNUM? I would like to implement pagination with HQL but I am not able to use .setMaxResult() or .setFirstResult() because I don't work with the session object directly and therefore don't use the Query object but simply create my query as a string and use the .fin...

Is there a good *strict* date parser for Java?

Is there a good, strict date parser for Java? I have access to Joda-Time but I have yet to see this option. I found the "Is there a good date parser for Java" question, and while this is related it is sort of the opposite. Whereas that question was asking for a lenient, more fuzzy-logic and prone to human error parser, I would like a ...

Spring MVC validation with Annotations

I'm having quite some trouble since I migrated my controllers from classical inheritance to use the annotations like @Controller and @RequestMapping. The problem is that I don't know how to plug in validation like in the old case. Are there any good tutorials about this? ...

Passing pointer from java to native

Hi. Im making an inerface to a DLL library, so i can use it with Java. I need my native function to modify the value of a jlong parameter. Like the parameter was passed by reference. My Java method must have the exact parameters as the native function MPUSBWrite shown down here. Example of actual not working code: The MPUSBWrite gets it...

Changing the values of variables in methods, Java

Hello, I have a questions about changing the values of variables in methods in Java. I have the following example class: public class Test { public static void funk(int a, int[] b) { b[0] = b[0] * 2; a = b[0] + 5; } public static void main(String[] args) { int bird = 10; int[] tiger = {7}; T...

How to write the sequence 1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 in JAVA ?

I'm currently beginning to program with Java. I tried to code the sequence in the title as an output in Java, but I'm stuck! I'm experimenting with the for function, any help is welcomed ;) ...

Search for usage of a class object with a given operator? [Eclipse]

For example, let's say I want to find all instances of using the == operator with any string object, so that I can replace it with .equals() instead. How can I do such a search? Otherwise I'd have to pick through all my code line-by-line... Thanks :) ...

Java Generics

Can someone explained, as detailed as possible, the differences between the following types? List List<Object> List<?> Can I get an answer, not a link? Let me make this more specific. When would I want to use public void CanYouGiveMeAnAnswer( List l ){} ? When would I want to use public void CanYouGiveMeAnAnswer( List<Object...

Mask URL in JSF

I have an enterprise application written in JAVA with JSF (using RichFaces 3.3). Currently my URL looks like this: http://localhost/WebApplication/faces/folder1/page.jsp Question is how do I mask my url to make it like this: http://localhost/folder1/page.jps Basically i want to hid "Application/faces/" Thanks ...

Java Message Distribution / Subscription?

I am creating a set of widgets in Java that decodes and displays messages received at a serial interface. The message type is defined by a unique identifier. Each widget is only interested in a particular identifier. How to I program the application in a way to distribute the messages correctly to the relevant widgets? ...

Lightweight portal server for WebSphere Portal development?

I'm doing some portlet development for IBM WebSphere Portal 6.1. However, the deployment process is painfully slow. As this is my first time doing portlet development, I'm not too familiar with the various portal servers out there. I'd like some recommendations for a lightweight portal server on which I can deploy quickly for developm...