APACHE POI / CATATAN</>↗Apache POI24 Mar 2009
In this example we try to obtain the Excel’s cell data type so that we can read the value using the right method. The data to be read is in a file named celltype.xls. The matrix below depict how the file is. | COL ROW | 0 1 2 3 4 —-|————————- 0 | 1 […]
APACHE POI / CATATAN</>↗Apache POI20 Mar 2009
In this example we demonstrate how to read data from an Excel file. In this example we limit to read a string data only. After reading the data, iterating each row and cells of the Excel file we display the content to the program console. package org.kodejava.poi; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; […]
LOGGING / CATATAN</>↗Logging17 Mar 2009
In this example we create a rolling or a sequenced of log files. Instead of just limiting the file size (see. How do I limit the size of log file) we can also make the log file to roll. This will prevent a lost to an important log message if we use a single log […]
LOGGING / CATATAN</>↗Logging16 Mar 2009
In this example you learn how to limit the size of a log file when using a FileHandler handler. Limiting the log file will prevent the log file to grow wildly without limit. package org.kodejava.util.logging; import java.util.logging.Logger; import java.util.logging.FileHandler; import java.io.IOException; public class LogFileLimit { // The log file size is set to 1 MB. […]
LOGGING / CATATAN</>↗Logging12 Mar 2009
To create a custom Formatter we need to extend the java.util.logging.Formatter abstract class and implements the format(LogRecord) method. In the method then we can format the log message stored in the LogRecord to match our need. The java.util.logging.Formatter class also have the getHead(Handler) and getTail(Handler) which can be overridden to add a head and a […]
LOGGING / CATATAN</>↗Logging08 Mar 2009
To prevent log records being forwarded to the logger’s parent handlers we can set false the useParentHandlers field using the Logger.setUserParentHandlers(boolean useParentHandlers) method. package org.kodejava.util.logging; import java.util.logging.Logger; import java.util.logging.ConsoleHandler; public class NoParentLogger { public static void main(String[] args) { Logger logger = Logger.getLogger(NoParentLogger.class.getName()); // Do not forward any log messages the logge...