顯示具有 Java 標籤的文章。 顯示所有文章
顯示具有 Java 標籤的文章。 顯示所有文章

2009年11月9日 星期一

AJAX File Upload Progress for Java

原文:http://www.codeguru.com/java/article.php/c13913/

我這次只實作到後端的部份,並沒有結合前端JavaScript和FileUploadListener...因為只上傳圖片,目前不需要

2009年10月16日 星期五

ResultSetMetaData 取得 ResultSet 相關資料 (column, table...)

API:http://java.sun.com/javase/6/docs/api/java/sql/ResultSetMetaData.html
ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
boolean b = rsmd.isSearchable(1);

##ShowAll##

2009年10月15日 星期四

打包json.jar

原文:http://processing.org/discourse/yabb2/YaBB.pl?board=Integrate;action=display;num=1163101573
##ShowAll##
Here are the steps I took (on Windows):

1. Download http://www.json.org/java/json.zip from json.org. Save it in a some directory, which I'll call %DOWNLOAD_HOME%.

2. Unzip it. Be sure you preserve the archive's directory structure (/org/json/) when you unzip the file.

3. Change directory into %DOWNLOAD_HOME%\org\json

4. Compile the files by running “javac *.java”. At least, this worked for me. There is no build.xml or anything, and it just seemed to compile into classes nicely.

5. CD back into %DOWNLOAD_HOME%

6. Create a jar file called json.jar. The syntax is something like:

jar -cvf json.jar org\json\*.class

2009年10月12日 星期一

取小數點後位數

import java.text.*;
..........

double temp = 579.625897000003;
DecimalFormat df = new DecimalFormat( "#.00");
System.out.println( df.format( temp ) );

..........

轉自:http://topic.csdn.net/t/20030204/12/1404748.html
DecimalFormat
##ShowAll##

2009年9月3日 星期四

Java FileWriter 開啟 append 功能

API:http://java.sun.com/javase/6/docs/api/java/io/FileWriter.html
範例文章:http://carrybetter.pixnet.net/blog/post/22039594

FileWriter(String fileName, boolean append)
Constructs a FileWriter object given a file name with a boolean indicating whether or not to append the data written.

##ShowAll##
就想說我已經用append()去寫入了,為什麼還是覆蓋掉前面的資料...原來還要給一個true的參數

2008年3月6日 星期四