I want to programmatically setup a FactoryBean on an existing ApplicationContext.
There are a lot of examples on how to define a bean programmatically (e.g.: http://www.carlobonamico.com/blog/2008/01/22/how-to-dynamicallyprogrammatically-define-spring-beans/), but they do not work when I try to define a factory bean
...
I'm using the Animator class from the Timing Framework to perform a simple animation (moving a JPanel), roughly based on examples in Filthy Rich Clients
I've overridden timingEvent() as follows
public void timingEvent(float arg0) {
float fraction = this.animator.getTimingFraction();
fraction = Math.min(1.0f, fraction);
if...
Imagine this simple scenario for full text search: Articles with Comments. I want to search articles also by text in comments. That alone is fairly simple to implement.
Not all comments are visible to all users though. User that writes comment can also restrict it's visibility to concrete Role (so comment has 2 fields: text and role).
...
I've compiled my source with java version 1.6 using the parameters -source 1.5 and -target 1.5, and the compiler doesnt complain at all.
Still, the application won't run with java 1.5 due to missing methods. Ofcourse I could rewrite some of my source code to be 1.5 compliant, but what I don't understand is; shouldn't the java bytecode i...
I'm implementing a SOAP client using Apache Axis 2. Since the SOAP client must handle heavy number of requests I am using a connection pool.
To do that I had to set a few transport layer configuration of my stub that was generated from a WSDL file:
stub._getServiceClient().getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Const...
Why is Java's Class<T> generic?
...
I apologize if this is a really beginner question, but I have not worked with Java in several years.
In my application, I need to keep up with a list of files (most, if not all, are txt files). I need to be able to add to this list, remove file paths from the list, and eventually read the contents of the files (though not when the file...
We're thinking of injecting this tool into the mix for high volume automated transcoding (to replace FFMPEG).
Has anyone used it? I need to set priorities on the videos. Is there a default mechanism to avoid starvation on lower priority transcodes? or does that have to be handled manually in the code that feeds the videos?
...
I have a hierarchy of application contexts. The bean that is defined in the parent context depends on a bean that is defined in the child. Here's how it looks like:
public class X {
public static class A {
public B b;
public void setB(B b) { this.b = b; }
}
public static class B { }
public static...
I have tried using the method drawOval with equal height and width but as the diameter increases the circle becomes worse looking. What can I do to have a decent looking circle no matter the size. How would I implement anti-aliasing in java or some other method.
...
The button in the code below is to me the only object that should listen for ActionEvents but when I resize the window the circle changes color which should only happen when the button is pressed.
Does it in some way use frame.repaint() when resizing the window that generates new values for the drawPanel object or even makes a new draw...
I need to get the aspect ratio from a multitude of video formats (flv, wmv, mp4, mov, etc). What would you guys recommend as a relatively slim JAR that has the tools to inspect the video's header and get this data out. I don't need anything too beefy as this is the sole operation that it's going to perform.
FFMPEG is not an option, bt...
I'm converting a legacy iBatis implementation to Hibernate, and for backwards compatibility purposes need to present counts of an object's collections rather than the collections themselves. The original query was:
select A.*, ( select count(*) from B where B.A_id = A.id ) as B_count from A;
and b_count would be presented in the resp...
Does anyone have sample code, or a tutorial which demonstrates how to use Grappa? I've searched high and low and can't find anything.
...
I need to write a function that takes in some kind of input stream thing (e.g. an InputStream or a FileChannel) in order to read a large file in two passes: once to precompute some capacities, and second to do the "real" work. I do not want the whole file loaded into memory at once (unless it is small).
Is there an appropriate Java clas...
We are using JTidy to clean up some html for sax processing. We've had a lot of trouble around spacing issues as shown in this example:
Html
<i>stack<span
class="bold">overflow</span></i>
which outputs "stackoverflow"
But...
Post JTidy
<i>stack
<span
class="bold">overflow</span></i>
which outputs "stack overflow" (note the new ...
I want to use the ClassLoader to load a properties file for the Properties class. I've simplified the below code to remove error handling for the purposes of this discussion:
loader = this.getClass().getClassLoader();
in = loader.getResourceAsStream("theta.properties");
result = new Properties();
result.load(in);
In the same directory...
I was wondering if it were possible to fit text along the curve of a circle. It would be great if there were a way to accomplish this in Java2D.
...
Executor seems like a clean abstraction. When would you want to use Thread directly rather than rely on the more robust executor?
...
Is there a difference between ++x and x++ in java?
...