java

Text replacement efficiency

An extension to my previous question: Text cleaning and replacement: delete \n from a text in Java I am cleaning this incoming text, which comes from a database with irregular text. That means, there' s no standard or rules. Some contain HTML characters like &reg, &trade, &lt, and others come in this form: &#8221, &#8211, etc. Other tim...

How can I make JOptionPane dialogs show up as a task on the taskbar?

Edit: The question follows the horizontal rule; my own answer precedes it. Based on help from Oscar Reyes, I crafted this solution: import javax.swing.JOptionPane; import javax.swing.JFrame; public class MyApp extends JFrame { public static void main(String [] args) { new MyApp(); } public MyApp() { sup...

Using HeapDumpOnOutOfMemoryError parameter for heap dump for JBoss

I was told I can add the -XX:+HeapDumpOnOutOfMemoryError parameter to my JVM start up options to my JBoss start up script to get a heap dump when we get an out of memory error in our application. I was wondering where this data gets dumped? Is it just to the console, or to some log file? If it's just to the console, what if I'm not lo...

Default XML namespace, JDOM, and XPath

I want to use JDOM to read in an XML file, then use XPath to extract data from the JDOM Document. It creates the Document object fine, but when I use XPath to query the Document for a List of elements, I get nothing. My XML document has a default namespace defined in the root element. The funny thing is, when I remove the default name...

What will replace Beans Binding in Java 7?

I read somewhere - the link escapes me - that Beans Binding will not be a part of Java 7. Does anybody know what will replace it? Also, are there any alternatives to beans binding in the current release of Java? ...

Java 2D and resize

I have some old Java 2D code I want to reuse, but was wondering, is this the best way to get the highest quality images? public static BufferedImage getScaled(BufferedImage imgSrc, Dimension dim) { // This code ensures that all the pixels in the image are loaded. Image scaled = imgSrc.getScaledInstance( dim.width, dim.height, ...

Dot matrix fast printing with precise layout in Java

I'd like to know what practical way of constructing reports for EPSON Dot Matrix printers exists in Java. At this time, I'm having the LX300+II model to play with. I know that there are basically two ways of using this printer: As a typewriter, outputting directly raw ASCII data to the parallel port Graphical printing, with graphical ...

GroupLayout: Is it worth learning?

I'm relatively new to java (specifically swing) and have recently been making some fairly simple applications, learning as I go. The latest one has lots of form components such as JLabels, JTextFields, JButtons, etc etc. All were placed in NetBeans using a visual builder. I have to say I'm not really taking to NetBeans and have really ju...

How do you use TLS/SSL Http Authentication with a CXF client to a web service?

I'm trying to access a web service secured by a certificate. The security is setup on IIS and the web service is behind it. I don't think WS-SECURITY will do this type of authentication. Is there any way to pass the client certificate when you call the web service? I'm just getting an IIS Error Page that says "The page requires a clien...

Struts tiles visual debugging

At a previous job they had a debug mode that would highlight struts tiles in the browser so you could tell what each tile was doing and the tile's filename. This was enormously helpful for when you are lost in a forest of nested tiles. Now that I'm at a new struts place, I've been trying to figure out how to implement it but I'm coming...

What are the advantages of Apache Wicket?

I'm not a Java developer so I might get some terms wrong... but. An application I integrate with is moving from Spring to Wicket. While it should not affect my integration with it I got to wondering why they would do this? From what I know Spring is the more popular framework. I know nothing about it except it's popular. I did read ...

Common Access Card (CAC) Authentication Using Java

I'm bascially looking for someplace to start learning how to interface with a government CAC card using java. Ultimately, my goal is to find out how to use CAC card authentication (by PIN number) to authorize access to a website hosted using a Tomcat/J2EE server. But I'll need somewhere to start. So I figure I'd start by writing a smal...

How to find out an element node with a empty string value in xsl

Hi, everyone: I am working on transforming a xml file from old version to new version. Here is the basic template which i am using: <xsl:template match="*"> <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}"> <xsl:copy-of select="@*"></xsl:copy-of> <xsl:apply-templates></xsl:apply-templates> </xsl:element>...

Glassfish logs on JSF Page

I have JSF with Richfaces app on Glassfish server. Is it possible to make an ajax window on the page and show info from Glassfish's log file that is located in [GlassfishFolder]/domains/domain1/logs/server.log? And also I want to clean up that log to make it look like in NetBeans. Thanks ...

Use Spring options tag to display enum's toString value

I'm using Spring for an HTML form. One of the fields is an enum and thus I'd like a HTML drop-down list (<option> tag). My enum's name is different than the toString() value. For example: public enum Size { SMALL("Small"), LARGE("Large"), VERY_LARGE("Very large"); private final String displayName; private Size(String displ...

Kill Quartz's thread after redeploying application

In my app i'm using quartz to schedule some jobs to run in my Java application on Glassfish. Sometimes when i'm redeploying my application i'm forgetting to turn off my scheduler and it's impossible to stop them after new version of app has been deployed. So, the question is how does one can stop/kill quartz's threads after application h...

How to communicate with a USB device under Windows and Java?

I'd like to communicate with a USB device under Windows and Java but I can't find a good library to do so. I don't want the user to have to install any extra hardware or device drivers to make this work. That is, I want to be able to interact with USB just like other Windows applications do. I am familiar with jUSB and JSR 80 but both s...

Libraries Conflict for Quartz

have a weird situation. I'm using Glassfish server for my Enterprise application. In that application i'm using JSF, Richfaces, Quartz, Jasper Reports, and Commons Email. When I build and deploy application to my dev. computer, dev and test servers, everything works fine. But when I deploy app to Production server with same glassfish I c...

change directory and run the batch file in the same command prompt

Hi, Is there any way to open the command prompt and change directory in the command prompt and run the batch file in the same command prompt using java. I know how to open the command prompt using java. Thanks, ...

JasperReport size limit

Is there a way to set a limit on the size of a JasperReport? We just looked at a WebSphere 6.1 Heapdump and someone tried to create a report and it was 1.5GB of memory in the heap. And it brought our Websphere server to its knees. Thanks, T ...