Writing to Excel using java code

import java.io.FileOutputStream; 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; /** * This is a sample to create an Excel Sheet using Jakarta POI API * * @author Nitin Aggarwal * @version 1.0 */ public class CreateXL { /** A place for the output Excel file to go */ public static String outputFile = “C:/Work/JPOI/excel_in_java.xls”; […]

read more

Reading contents of Excel using java code

There are two good choices for reading & writing Microsoft Excel Spreadsheet files from Java, in a platform independent way, – jexcelapi and Jakarta POI (HSSF). Both of them provide nice interface to access Excel data structure and even generate new spreadsheet. Comparison of JExcelAPI with Jakarta-POI (HSSF) 1. JExcelAPI is clearly not suitable for […]

read more

Maven Archtypes List

Each archetype page should enforce the following pattern : * Archetype name* Command line to call the archetype* If the archetype can be used in an existing projects directory* A tree view of the resulting files* Some additional information like the additional properties used by the plugin To use an archetype: mvn archetype:generate Generate gives […]

read more

How to Upload Multiple Files in Java

package com.mp.ws; /** * * @author nitinaggarwal * */ public interface IFileUpload { public byte[] get1File(String name); public byte[][] getMulitpleFiles(String names[]); public String getXmlFile(String name); } package com.mp.ws; /** * * @author nitinaggarwal * */ public class FileUpload implements IFileUpload { public byte[] get1File(String name) { byte data[] = null; FileReader fr = new FileReader(); […]

read more

Pagination: Server Side or Client Side?

What is it best way to handle pagination/sorting and filtering? Server side or at the client side? Numerous times in your projects you might have to face a situation where you need to pull chunks of data dynamically. The obvious issue that you then face is paginationsorting and filtering. You then start to think if […]

read more

Java Persistence API – Getting Started

The Java persistence API (JPA) allows you to store data from POJO’s (Plain old Java Objects) into database tables. The persistence metadata is specified using Java annotations, XML mapping files or a combination of both. In case both are used then the XML information overwrites the annotations in the Java code. This persistence metadata defines […]

read more

Native XML Web Services in SQL Server 2005

These days, you should hardly be surprised when you run into a business requirement to make data available over the Web. Fortunately, database products are making it easier and easier to hook up Internet protocols directly to your data. Microsoft SQL Server is a case in point. While SQL Server 2000 did allow Web data […]

read more

Java Console and File Input/Output Cheat Sheet

Console OutputSystem.out.print(“Hello “);System.out.println(“world”);Console InputBufferedReader in = new BufferedReader(new InputStreamReader(System.in));String text = in.readLine();File OutputPrintWriter out = new PrintWriter(new FileWriter(“K:locationoutputfile.txt”)));out.print(“Hello “);out.println(“world”);out.close();File InputBufferedReader in = new BufferedReader(new FileReader(“K:locationinputfile.txt”));String text = in.readLine();in.close();Converting input dataString text = in.readLine();int x = Integer.parseInt(text);double y = Double.parseDouble(text);Reading until EOFwhile (in.ready()) { text = in.readLine(); System.out.println(text);}Pulling apart delimited items on a lineString text = […]

read more

Splitting the ALSB Logging

What it does Normally the AquaLogic Service Bus logs in the main Weblogic domain log. This sample code splits the ALSB logging to a separate log. How it Works A startup class is used to direct ALSB log entries to the new ALSB log. A log filter is used to stop the ALSB logs from […]

read more

Reverse Engineering using UML Graph

I have been on several teams where we studiously designed UML diagrams at the beginning of the project. As the project progressed, and deadlines approached, the UML diagrams were left somewhere behind, not to be updated in months. When a new developer joined the team, we showcased the old UML diagrams, and kept telling “Oh, […]

read more