import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.DateUtil;
/**
* @author Acer
*
*/
public class HSSFCellUtil {
public static String getCellContent(HSSFCell cell, String type) {
return getCellContent(cell, type, "");
}
public static String getCellContent(HSSFCell cell, String type, String pattern) {
String content = "";
if (!(cell == null)) {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_STRING:
content = cell.getStringCellValue().trim();
break;
case HSSFCell.CELL_TYPE_BOOLEAN:
content = new Boolean(cell.getBooleanCellValue()).toString();
break;
case HSSFCell.CELL_TYPE_NUMERIC:
if (HSSFDateUtil.isCellDateFormatted(cell)) {
Date d = HSSFDateUtil.getJavaDate(cell.getNumericCellValue());
if (pattern != "" || (!pattern.equals(""))) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
content = sdf.format(d);
} else
content = d.toString();
} else {
if (type.equals("byte")) {
content = new Byte(new Double(cell
.getNumericCellValue()).byteValue()).toString();
} else if (type.equals("short")) {
content = new Short(new Double(cell
.getNumericCellValue()).shortValue())
.toString();
} else if (type.equals("int")) {
content = new Integer(new Double(cell
.getNumericCellValue()).intValue()).toString();
} else if (type.equals("long")) {
content = new Long(new Double(cell
.getNumericCellValue()).longValue()).toString();
} else if (type.equals("float")) {
content = new Float(new Double(cell
.getNumericCellValue()).floatValue())
.toString();
} else if (type.equals("double")) {
content = new Double(cell.getNumericCellValue())
.toString();
} else if (type.equals("string")) {
content = new Double(cell.getNumericCellValue())
.toString().replaceAll("\\.[0]*", "");
} else {
content = new Double(cell.getNumericCellValue())
.toString();
}
}
break;
default:
break;
}
}
return content;
}
}
星期三, 12月 29, 2010
以POI讀取Excel檔案儲存格內容
星期四, 12月 23, 2010
星期二, 12月 14, 2010
星期日, 12月 05, 2010
星期四, 11月 18, 2010
星期三, 11月 17, 2010
學習:後設認知(metacognition)理論
l 創立者
約翰·弗拉維爾(John Flavell, 1977)被認為是「後設認知」理論的創立者,以及這個詞語的「始創人」
l 發明定義
n Swartz及Perkins(1989)
n 即"cognition about cognition", "knowing about knowing",簡言之,就是對自己的認知過程(包括:記憶、感知、計算、聯想等各項)的思考。
l 解釋後設認知(metacognition)
n 先進行「後設」的語意分析
u 後設意指「在某件事情之後才發生」
u 舉例:我騎機車到學校,這是認知(詳細內容請見認知),到了學校以後回想整個過程、遇到的風景或事件並且進行仔細分析或歸納稱為「後設認知」
n 是「個體」認知的認知,必須要在「個體」有了「體驗」產生「認知」以後才能進行「後設認知」
l Three basic elements(三項基本元素)
A.[BEFORE] Developing a plan of action(發展行動之計畫)
1.What in my prior knowledge will help me with this particular task?
我有哪些知識可以幫助我完成這次特別的任務(工作)呢?
2.In what direction do I want my thinking to take me?
我要讓我的想法帶往哪個方向呢?
3.What should I do first?
我應該先做什麼呢?
4.Why am I reading this selection?
為何我要看(做)這個選擇呢?
5.How much time do I have to complete the task?
我要完成這個工作要花費多少時間呢?
B. [DURING] Maintaining/monitoring the plan(計畫之維護與監控)
1.How am I doing?
我該怎麼做呢?
2.Am I on the right track?
我有在正確的方向上嗎?
3.How should I proceed?
我該怎麼進行呢?
4.What information is important to remember?
還記得哪些訊息是重要的嗎?
5.Should I move in a different direction?
我應該朝向不同的方向嗎?
6.Should I adjust the pace depending on the difficulty?
因為有點困難我應該調整步伐嗎?
7.What do I need to do if I do not understand?
假使我不明白那麼我需要做些什麼呢?
C.[AFTER] Evaluating the plan(計畫之評估)
1.How well did I do?
我做得有多好呢?
2.Did my particular course of thinking produce more or less than I had expected?
期間我有沒有比我早先預期的或多或少產生特別的想法呢?
3.What could I have done differently?
我還能做些不同的改進嗎?
4.How might I apply this line of thinking to other problems?
如何應用此次思維的方式至其他問題呢?
5.Do I need to go back through the task to fill in any "blanks" in my understanding?
經過此次工作後我是否需要依據我的理解回去在任何"空白"處上填寫一些說明?
l 分類方式
n 顯明的(explicit)
n 隱藏的(implicit)
n 依據約翰·弗拉維爾之分類
I.後設認知知識
u 定義:指在認知的過程(processes)裡所獲得的知識(knowledge),亦即可用於控制認知過程的知識
u 再區分為三類
1.個人變數的知識(knowledge of person variables)
2.工作變數的知識(knowledge of task variables)
3.策略變數的知識(knowledge of strategy variables)
II.後設認知經驗(後設認知規則)
l 對教學之重要性
1.後設認知這個概念對教學非常重要。
2.唯有一個人瞭解到自己如何獲取一件新的知識,他才有能力把這個新的知識傳遞給其他人。
l 要訣
1.注意你是如何『注意』
2.『想想』你是如何思考
3.『學學』你是如何學習
l 讓大腦順從的方法
1.慢慢來,理解越多,需要強記的就越少
2.勤做練習,寫下心得
3.認真閱讀
4.將閱讀作為一件具有挑戰性的事
5.喝水,多喝水
6.談論它,大聲談論它
7.傾聽大腦的聲音
8.用心感受