java

Utilities to generate an XML representation of a Java package/class?

I'm looking to generate an XML representation of the AST for a given java class (by parsing its source). Overall, what I want to do is write XSLT queries to find meta patterns in the source code - very much like PMD does. There was an open source utility that started this, but went stale. Anyone know of a utility to do this? -Mike ...

"Integration" between Rails' ActiveRecord and Java's Hibernate

Hi everybody: let me do a bit of "concept mining" here: I am involved in mantaining/extending an application whose functionality is distributed across several servers. For example, we have a machine running the ApplicationServer, another running the DataServer and so on. This application has a Web Interface. The current UI is totally im...

Can a thread observe junk values in an object due to memory incoherency?

After a lot of research I believe I understand the JMM quite well, certainly well enough to know that when an object is shared between two threads you must synchronize all access on the same monitor. I understand that if multiple active threads access an object concurrently all bets are off as to what they will observe. However, if an ...

Is Test coverage going down with JRebel?

it's good practice to write Unittests to be independed of the whole spring application context automate the test you are doing for continuous integration avoid dependency on the Servlet Container I guess with JRebel there's a temptation to test everything in the running application and 'forget' to write Unittests. What's your expe...

Null pointers everywhere because data is suddenly sparse.

Someone designed code that relied on full data; the XML always had every element. The data source is now sending sparse XML; if it would have been empty before, it's missing now. So, it's time to refactor while fixing bugs. There's 100+ lines of code like this: functionDoSomething(foo, bar, getRoot().getChild("1").getChild("A"). ...

How do you configure JBoss to trim additonal whitespaces generated by JSPs?

Getting lots of additional whitespace in the html output, looks like its because of the JSP tags =/ I saw this referenced somewhere: <init-param> <param-name>trimSpaces</param-name> <param-value>true</param-value> </init-param> That should put it in web.xml, I tried that but that didn't seem to work. Maybe I'm not putting it in t...

Guice best practices and anti-patterns

I'm not sure if there is merit to this question or not, but are there any best practices and anti-patterns specific to Google Guice? Please direct any generic DI patterns to this question. ...

AMF client in Java

Hi I am using BlazeDS java client to get info from this page. This page has a form in the middle that when you select a type, the location combo on the button gets updated. I am trying to use BlazeDS to get those values in java. I have been using Charles web proxy to debug, and this are the screenshots from the request and the response...

How to get information out of a java applet?

Hi everybody! I've a simple webpage with a java applet. The applet calculated a few values. (up to 30 lines of text) Then I want to send the values back to the server. Sorry for my english and thanks for your help! ...

no SqlMapClientTemplate specified spring + ibatis

I have the following line of code in my DAO which gives error No SqlMapClient specified getSqlMapClientTemplate().queryForList("someNameSpace.procedureIdName", parm); My class is extending SqlMapClientDaoSupport I noticed in the api there is a setSqlMapClientTemplate method which takes sqlmapclienttemplate as the parameter, however, ...

Connection timeout for DriverManager getConnection

I am trying to connect to DB using the standard JDBC way connection = DriverManager.getConnection(url, username, password); Is there a maximum value of timeout on the connection, how long does a connection live, can I increase the value. I want in cases the connection to be open forever , is it a good idea. ...

org.apache.commons.lang.StringEscapeUtils in python

Hello, is there any python module or code that implements the org.apache.commons.lang.StringEscapeUtils.escapeHtml ? exactly the same as in http://commons.apache.org/lang/api/org/apache/commons/lang/StringEscapeUtils.html#escapeHtml(java.lang.String) i googled around but could only find the cgi.escape function that doesn't do the sam...

Java: Why charset names are not constants?

Charset issues are confusing and complicated by themselves, but on top of that you have to remember exact names of your charsets. Is it "utf8"? Or "utf-8"? Or maybe "UTF-8"? When searching internet for code samples you will see all of the above. Why not just make them named constants and use Charset.UTF8? ...

Hi, I'd like to learn struts2 with eclipse. Which version of eclipse should i download?

Hi, I'd like to learn struts2 with eclipse. Which version of eclipse should i download? My background is as a c# developer, so i don't really know much at all about java but i'm keen to learn. I'm looking on the eclipse site http://eclipse.org/downloads/ and i think what i want is one of these, but i'm not sure: Eclipse for Java EE d...

Android - Are services shared among processes?

I have an android library which is distributed as a jar file for inclusion in 3rd party applications. Within the jar file is an Android Service. The service is exposed through a facade class in the jar file. Hence 3rd parties do not directly bind to the service, they just use the facade class. I have 2 questions about this architectur...

How can I modify the shortcut/hotkey "description" in a swing JMenu item?

Our swing application uses the "spacebar" key as a shortcut key. In other words, if you press the spacebar anywhere within the application window, it will perform a certain behaviour. What's more, this same behaviour can also be performed by using a JMenuItem in the window's menu bar. The normal way to implement this is to simply ...

generics error: not applicable for the arguments

Can someone explain to me why the following code does not work? public class Test { interface Strategy<T> { void execute(T t); } public static class DefaultStrategy<T> implements Strategy<T> { @Override public void execute(T t) {} } public static class Client { private Strategy<?> a; public void setStrategy(Strat...

Flash/Java whiteboard web applet

Hello. I want to put a whiteboard on my website so users can draw something and then save the image to the server containing the drawing. Are you aware of any open source/free already made whiteboard application out there ? I also need the save image function. Thank you ! LE: I am also able to pay a small amount of money on it so name s...

Java quick sort, reading from a user input file into any array (to be sorted)

What's up y'all, I am trying to write some code in Java that will read in the numbers from a file (one # on each line of .txt file) put them into an array, and then run quick sort on the array. Eclipse is showing some red that I am having trouble with. My errors are marked with comments, and what the error is, if anyone can help me get ...

How are Models (in MVC) and DAOs supposed to interact?

How are models and DAOs supposed to interact? I'm in the process of putting together a simple login module and I'm unsure where to put the "business logic." If I put the logic with the data in the model, how would I access the logic? Currently, I have: A controller that receives form data A model that is a simple reflection of...