devxlogo

Tip Bank

Setting Logger Output with FOP

The following code demonstrates how to set a logger for FOP. You can send the logger’s messages to the System.out or in a file like this: //to System.outLogger logger=new ConsoleLogger(ConsoleLogger.LEVEL_INFO);fop.setLogger(logger);MessageHandler.setOutputMethod(MessageHandler.SCREEN);MessageHandler.setScreenLogger(logger);

Read an XML Document with the StAX Iterator API

This tip shows an example of how to use the Iterator API to read from an XML file: import javax.xml.stream.*;import javax.xml.stream.events.*;import java.io.*;public class StAXBasicEventReader{ public StAXBasicEventReader(){} public static void main(String[]

How To Debug Classic ASP Pages in VS 2005

VS 2005, like its predessor, does not allow debugging for classic ASP pages, by default. This forces you to attach the ASP worker process (w3wp.exe). Follow these steps: Enable ASP

Using the onMouseDragged Event in JavaFX

It’s easy to implement a nice dragging effect in JavaFX, using the onMouseDragged event in conjunction with the bind operator (incremental and lazy evaluation of attributes operator). import javafx.ui.canvas.*;import javafx.ui.*;import

Converting Numbers to Strings

Instead of writing your own function to convert an integer or float to a string, just use the C++ class stringstream (in the sstream header). In C++: #include #include #include

Capture a Screenshot in Java

Use the following Java code to capture a screenshot: import java.awt.AWTException;import java.awt.Rectangle;import java.awt.Robot;import java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;import javax.imageio.ImageIO;public class ScreenCapture { public static void main(String[] args) { try { Robot robot