java

Have you seen an appender that would log to separate files based on NDC in Log4j?

We have only a very small number of customers (fewer than 50) and we would like each one to have its own separate log file into which all of its server side logging info goes. I know you could use NDC and filters to direct log statements to different files using the standard appenders in Log4j but that would require quite a bit more setu...

Is it worth refactoring Swing code to conform to coding standards?

Code generated for swing always fails when it comes to code quality. Inevitably, there's one method that builds the entire interface, and there's anonymous event handling code that calls member methods. Does anyone have some nuggets on transforming this monstrous code to well organized code. Is it worth going without a GUI builder too...

What do I need to do to integrate JTA into a J2SE application?

Suppose I want to implement an application container. Not a full-on JEE stack, but I need to provide access to JDBC resources and transactions to third party code that will be deployed in an application I'm writing. Suppose, further, that I'm looking at JBossTS for transactions. I'm not settled on it, but it seems to be the best fit f...

Using java.util.prefs.Preferences in Jython

I seem to be having trouble storing Java preferences using a Jython script. If in Jython 2.5 beta I use: clazz = Class.forName('mypackage.myclass') prefs = Preferences.userNodeForPackage(clazz); # or Preferences.userRoot() prefs.put('propertyname', 'yes') The preferences are not stored. If I then add: prefs.flush() I get java.u...

Seeing actual maven invocations

Is there a way to get Maven to include in its logs the actual commands that were invoked to perform a particular operation? I'm having a problem where a javac invocation is failing and I'd like to see what maven was actually trying to do. ...

How do I switch panels inside a frame depending on a button action?

I have created an application that has a toolbar, menubar and content area. I have added the menu and toolbar to the application window, but I am stuck with displaying the panel in content area based on the button action (like add, display) which is clicked through the toolbar. Is this a right way to do this? Is there any better way to d...

lots of boolean flag inputs to a class

I have a dialog that displays various things depending on state of the application, security for the current user etc. I am currently passing in several boolean flags and then enabling and/or hiding UI components depending on these flags.Eg: new MyDialog(showOptionsTable, allowFooInput, allowBarInput, isSuperUser) Initially this start...

Fixing BeanNotOfRequiredTypeException on Spring proxy cast on a non-singleton bean?

I'm having an issue with pulling a Spring bean from an application context. When I try; InnerThread instance = (InnerThread) SpringContextFactory.getApplicationContext().getBean("innerThread", InnerThread.class); I get; org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'innerThread' must be of type [com.g...

Hibernate one to zero or one mapping

I'm trying to map a one to "zero or one" relationship in Hibernate. I think I may have found a way using a many-to-one. class A { private B b; // ... getters and setters } class B { private A a; } Class A's mapping specifies: <many-to-one name="b" class="B" insert="false" update="false" column="id" unique="true"/> and C...

Copying bulk documents (pdf files) from server to client machine with one click?

User selects the number of files (could be in 100s or 100s) User clicks on the Download link. User is presented a popup to provide the path on the client machine where the files are to be copied. After providing the path, user clicks on Save button on the popup. All the files would be copied from the server to the specified path on th...

Managing cookies in Java

What's the best practice to implement sign in "Remember Me" feature in Java? Obviously, storing cookies with username and password in user's browser is not secure enough. Create authentication token in cookies and db instead? Any simple examples? ...

Why isn't bitronix (BTM) binding the user transaction into JNDI?

Looks like Bitronix, as suggested elsewhere, works very well. However, I'm stumped by a problem with it. I get this exception from Hibernate, when I attempt to save the session after I call TransactionManager.begin(): 14:21:32,350 ERROR [JTATransaction] Could not find UserTransaction in JNDI javax.naming.NameNotFoundException: Name Us...

JTextArea font change is slow

I have a curious problem with the JTextArea control: When I bring up my JTextArea everything is fine and whatever I type shows up without delay. However as soon as I send a FontSizeAction to my EditorKit(RTFEditorKit in this case, but it does not seem to matter which I use), a delay, from 1 - several seconds, happens. Interestingly the d...

How would you transfer session info between Java/Servlet's and .NET

I have a web app built on Java Servlet technology. I am thinking of switching to a new framework, possibly switching over to a .NET stack with C# and ASP MVC. I don't want to take the current app down while I develop the new one. The goal is to have the old system run and just develop new modules in a new architecture. If I stay with a...

Some useful site with examples C++ and Java?

Could someone post some good links with examples of programs with code in C++ and(or) Java? ...

PropertyGrid in Java Swing

Does Java Swing have a control similar to the PropertyGrid in .NET? if so, which one is it? Or at least which one comes closest to it? Thanks! ...

Practical GUI toolkit?

I am thinking about cross-platform with nice programming language bindings (Java, Ruby and Python). What would be the "flattest" learning curve but yet enough powers to perform most of the standard GUI features? What would you guys/gals recommend; FOX, wx, Tk or Qt? ...

Why would only the prefixing return type of a java method execute ?

Hi, I am trying to understand some java code which for some reason appears to execute its return type class (the SQLExecutionInfo class) and nothing else within the method. Perhaps this is simply how the java works (i.e regardless of whether of what is within the method body the type of class being returned is first executed ??) The m...

Pdflib Java api

Hello, Does somebody knows a high level Java API that wraps the pdflib (horrible) Java API that is actually easy to use. To clarify, I have to use pdflib (my company uses it), so I need a wrapping API, not other alternatives. Thanks Tal ...

Use spnego credentials to access different page

I have an application that is served using jetty 6.1.12 from serverA. serverA is kerberized using the spnego filter and runs fine when I run it from the browser. I am now trying to access a different site (serverB) from one of the classes in the serverA. This new site uses the same authentication scheme i.e., if user can see pages on ser...