java

Java component for chunking arbitrary text into groups of 4x20 pages

I'm looking for a component that can take a string of arbitrary length and chop it up into "pages" for display on a 4x20 (4 lines, 20 chars per line) LCD. I'd like to add some smarts to the formatting, such that it will try to not break words at the end of the display (except for very long words), not start a new line with a space char,...

Bulk upload data into data store for GAE Java project.

I would like to populate the data store. Yet all the examples and instructions for populating the data store are concerned with Python projects. Is there a way to upload bulk data using the AppEngine Java tools? (At the moment the data is in CSV format, but I can easily reformat the data as needed.) It would be especially useful if it c...

Retrieving a model from ModelAndView in jsp

Hi all, I am currently trying to return a model from onSubmit() in my controller. I then am trying to retrieve this in my jsp. for example Map model = new HashMap(); model.put("errors", "example error"); return new ModelAndView(new RedirectView("login.htm"), "model", model); and then retrieving it with <c:out value="${model.errors}...

HttpClient request set Attribute question

Hi I play for a while (couple of weeks) with this HttpClient lib. I want somehow to set Attribute to the request. Not parameter but Attribute. In my servlet I want to use Integer inte = (Integer)request.getAttribute("obj"); I have no idea what i miss. i try this. NameValuePair[] pair = new NameValuePair[1]; pair[0] = new NameValuePair...

Java web service, xsd date instead of dateTime

In Java EE 1.4 using JAX-RPC 1.1, how can i expose web service, so the wsdl has a complex type (person) where one of the properties of the person is a date which is shown in the WSDL/XSD as only a date (such as a birthdate) instead of a dateTime (where the time is not wanted) in the WSDL/XSD? i would like the xsd referenced in the wsdl ...

Is there still a good reason to support JDK 1.4?

I'm looking at putting together an opensource project in Java and am heavily debating not supporting JDKs 1.4 and older. The framework could definitely be written using older Java patterns and idioms, but would really benefit from features from the more mature 1.5+ releases, like generics and annotations. So really what I want to know i...

How to read well formed XML in Java, but skip the schema?

I want to read an XML file that has a schema declaration in it. And that's all I want to do, read it. I don't care if it's valid, but I want it to be well formed. The problem is that the reader is trying to read the schema file, and failing. I don't want it to even try. I've tried disabling validation, but it still insists on trying ...

Which Eclipse version should I use for Google GWT and Google App Engine development?

Ganymede, probably. But there are so many different ones. Any idea? ...

A question about java web apps and X-REAL-IP header.

I'm setting up a demo of a project for a client. On my server I have a lot of sites built with different technologies that are running under different servers on different ports. I'm using nginx as a reverse proxy for all of them. This particular application is built with java (spring MVC / Blazeds) and will be deployed under tomcat 6 fo...

Can i use Hibernate ORM framework without any restriction in Groovy and/or JRuby ?

Hi, I like Groovy/JRuby simplicity. But in order to use it, i would like to know whether Hibernate ORM framework works same way as in Java language ? Is there some limitation or restriction ? regards, ...

Java Unit tests on methods that use third parties libs that don't use Interfaces

I'd like to know how do you test your methods if the libs you are using don't use Interfaces My class is like private ThirdParyClass thirdPartyClass; void myMethod() { AnotherThirdPartyClass param = "abc"; ... thirdPartyClass.execute(param); } I want to test that execute is called with the "abc" param. I was thinking in creating M...

With GNU classpath, is it possible to build a crossplatform (Win32 and Linux) jar

I thought that gnu classpath was just an open source version of the Java library. Apparently it is tied heavily to the host system? Is this true. For example, would it be possible to build a gnu classpath 'rt.jar' with only Java bytecode and what are the args to use that as the bootstrap library? ...

Generic method in Java, determine type

I would like to be able to detirmine the return type of my method call at runtime, but I can not seem to be able to get the Type of T. public <T> T getT() { Object t = null; Class<?> c = t.getClass(); System.out.println(c.getName()); return (T) t; } Is there any way to determine the Type of T at runtime in Java? ...

I want to display results from database 10 per page in jsp

I have the following code for my website, and I want to expand this result to display 10 results per page. If some one can help me I will be grateful. java.sql.PreparedStatement p = servlet1.DB.query("select * from user where userdate like "); p.setString(1,userdate); java.sql.ResultSet r = p.executeQuery(); ...

Java Exception printing twice

I know the exception is kind of pointless, but I was trying to learn how to use / create exceptions so I used this. The only problem is for some reason my error message generated by my exception is printing to console twice. import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Scanner; ...

Appengine and GWT - feeding the python some java

I realize this is a dated question since appengine now comes in java, but I have a python appengine app that I want to access via GWT. Python is just better for server-side text processing (using pyparsing of course!). I have tried to interpret GWT's client-side RPC and that is convoluted since there is no python counterpart (python-gw...

New language for a jr programmer new to the industry?

As a programmer new to the software engineering industry, I'm trying to decide a new language to learn. I currently use Ruby/Javascript/HTML/CSS/SQL at the workplace, but would like to try a compiled language for a change. I am currently torn between learning a functional language like Haskell, or an imperative language like Java. All ...

weird GzipInputstream problem

Hi all, I have a server that basically caters to multiple clients. I am basically using gzip(input/output)stream to compress the data between client-server. Many clients can send the requests to server at the same time and hence i have a thread to cater to each client. Now, the problem tat i am experiencing is that "randomly" some cli...

Embedded HTTP server in Swing Java app

I wish to embed a very light HTTP server in my java swing app which just accepts requests, performs some actions and returns the results. Is there a very light java class that I can use in my app which listens on a specified port for Http requests and lets me handle requests? Note that I am not looking for a stand-alone http server, ju...

How can I capture all mouse events in a JFrame/Swing?

I have a JFrame that has a large number of changing child components. (Many layers) Is there any way to add a listener for all mouse events? Something like KeyEventDispatcher? ...