Thursday, May 5, 2011

Wednesday, May 4, 2011

Java Gson

http://code.google.com/p/google-gson/

Save RequestStream to file

DataInputStream dataStream = new DataInputStream(req.getInputStream());
byte datas[] = new byte[formDataLength];
int totalBytes = 0;
while (totalBytes < formDataLength) {
int bytes = dataStream.read(datas, totalBytes, formDataLength);
totalBytes += bytes;
}

saveMp3(datas);

public static void saveFile(byte[] datas) throws Exception{
FileOutputStream fileOutputStream = new FileOutputStream("xxxxx");
fileOutputStream.write(datas);
fileOutputStream.flush();
fileOutputStream.close();
}

Tuesday, May 3, 2011

Java learning

http://ghads.wordpress.com/2008/09/19/create-unique-identifiers-in-java-uuid/

Sunday, May 1, 2011

JSP Installation

Tomcat 7 with Eclipse
Follow the instruction to setup the whole development environment:


==========================================
a. Download Java SE 6 with JDK (If you don't use EJB, you don't need the Java EE version)


b. Installation of Tomcat server