2012年2月10日 星期五

歷史紀錄

原始資料表

歷史資料表 << 原始資料表
  + 更新序號
  + 更新時間
  + 更新方式 (A, U, D)
  (+ 更新人)
  (+ 更新原因)

trigger
新增
  insert into 原始資料表
修改
  update 原始資料表
刪除
  delete from 原始資料表

------------------

歷史資料表只能新增 再 藉由trigger對 原始資料表作更動

由於所以無法指藉由資料來顯示是新增或是刪除
所以需要一個變更方式的欄位

------------------ update @ 2012/2/10 05:43
java 可以建立一個歷史紀錄的類別(介面)

public interface HistoricalData{

  void setUpdateSeq(int updateSeq);
  int getUpdateSeq();
  void setUpdateDatetime(Date datetime);
  Date getUpdateDatetime();
  void setUpdateType(String updateType);
  String getUpdateType();

}

2011年12月15日 星期四

libraries

Spring framework將Java的Reflection做了很厲害的包裝
用來完成IoC和DI
IoC : Inversion of Control
DI : Dependency Injection

Struts2 來自 WebWork2 Framework是用來建立Java web application的framework

struts2-spring : Spring與Struts2可以透過 struts2-spring-plugin 來連接 在Struts2中使用Spring

Apache commons dbcp - Database Connection Pooling
http://commons.apache.org/dbcp/
包裝了常用的連接資料庫用的功能
dbcp依賴 jakarta commons-pool

Json-lib能將beans, maps, collections, java arrays, XML等轉成JSON物件 與 把它反轉成 beans and DynaBeans
依賴

  • jakarta commons-lang 2.5
  • jakarta commons-beanutils 1.8.0
  • jakarta commons-collections 3.2.1
  • jakarta commons-logging 1.1.1
  • ezmorph 1.0.6


2011年10月13日 星期四

JDBC String 的參數列表

JDBC String 的參數列表
用到 zeroDateTimeBehavior 所以找到這個東東
因為資料庫填的日期是0000-00-00沒有辦法給Java 的Date類別轉換
這個參數有三種值 exception, round, convertToNull分別是丟出例外, 轉換成0000-01-01, 回傳null三種

What should happen when the driver encounters DATETIME values that are composed entirely of zeros (used by MySQL to represent invalid dates)? Valid values are "exception", "round" and "convertToNull".

http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html

2011年5月20日 星期五

真值表

AB0A&~BA&B~(A|B)~A&BAA^~B~AA^B~BBA|~B~A|B~(A&B)A|B1
100100010011010111
110010011000111011
000001001101011101
010000100110101111


這個是所有的真假值的排列組合

2011年2月4日 星期五

Windows Command Line

dir usage
  1. dir /b *.java
    • list all files end with .java in current directory in simple format
  2. dir /b/s *.java
    • list all files end with .java in current directory recursively in simple format
for usage
  1. for [/d][/r] %i in (set) do command [command-parameters]
    • %i : variable, case sensitive
    • set : file list. ex : (file.txt file2.txt), (*.txt)
    • /d : similar to 1. but (set) is not file list, is a directory list
    • /r : do same "for work" in every sub directory of current place
  2. for /L %variable in (start,step,end) do command [command-parameters]
    • numerical iteration. ex. (1,1,5) = (1 2 3 4 5), (5,-1,1) = (5 4 3 2 1)

  • FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
  • FOR /F ["options"] %variable IN ("string") DO command [command-parameters]
  • FOR /F ["options"] %variable IN ('command') DO command [command-parameters]
    or add usebackq option in options:
  • FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
  • FOR /F ["options"] %variable IN ('string') DO command [command-parameters]
  • FOR /F ["options"] %variable IN (`command`) DO command [command-parameters]
options is list below
  • eol=c : end of line charactor
  • skip=n : skip n lines
  • delims=xxx : delims charactor list
  • tokens=x,y,m-n : 
    • 指定每一行的哪些文字串應該被傳到 for 的內部以用來進行每一個重複操作。
    • 這會導致額外的變數名稱被配置。
    • m-n 格式代表一個範圍,指定了第 m 個到第 n 個字串項。
    • 如果在 tokens= 字串的最後一個字元是星號,則會配置一個額外的變數來接收最後一個字串項被分析後的其他文字。
  • usebackq 
    • 指定新語義開始作用。
    • `反括號`的字串會被當作命令來執行
    • '單引號'字串是純文字字串
    • 此外還允許使用"雙引號"來引用在 filenameset 內的檔名。
example :
     FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do @echo %i %j %k

%IMPORTENT%
    when using a variable in batch file, the usage is %%v not %v


看書很快樂!!

邊看書邊思考的時候 看的內容真的很容易記起來
=
剛來這裡的時候買的一本Design Pattern的書

三個禮拜了 第一次翻過去 跟第二次邊看邊想 兩種讀法真的有差

而且內容真的有記起來 看的速度也不見得比較慢

這種感覺 雖然不是很容易抓住

不過有查覺到或許可以透過多練習而習慣跟學會這種讀書的樂趣

這個真的是讀書的方法阿 多想可以多增加大腦的連結 而增加記憶的強度 跟能力

加油!! 希望可以持續

2010年12月13日 星期一

從Ubuntu 10.10 server開始安裝

#pppoe安裝與使用
sudo pppoeconf # 基本上一直按yes跟注意輸入帳號密碼就行了
sudo pon dsl-provider # 開啟連線
sudo poff # 關閉連線
sudo plog # 檢查狀態

apt-get update # 要得先更新

#在Ubuntu 10.10 server 中 安裝xwindows
apt-get install xinit
apt-get install gnome-core
apt-get install gdm xscreensaver
apt-get install ttf-arphic*
startx

# 安裝了視窗介面 跟 網路 就可以隨意了
# 目前感覺起來真的功力有增加
#以下為好用工具
apt-get install jockey # 管理driver
apt-get install vim      # 現在已經是沒有vim沒有辦法過日子了
sudo add-apt-repository ppa:lazyscripts/stable                  # 常用工具都在這裡 lazyscripts
sudo apt-get update && sudo apt-get install lazyscripts    # 包括gcin、多媒體撥放等
apt-get install file-roller # 預設是把壓縮檔mount到桌面 改回跳出顯示壓縮檔內容的界面
apt-get install unrar lha p7zip-full p7zip-rar

2010年12月10日 星期五

更改jvm

最近電腦常常當機 可是也不曉得為什麼 結果在~/裡面發現一些當機的資料
hs_err_pidxxxxx.log
仔細看了一看 發現是 jvm出了問題 也難怪開eclipse當機

依照網路上的資料 用了下面兩行顯示jvm跟更改jvm
sudo update-java-alternatives -l
sudo update-java-alternatives -s java-6-sun
但是 鐺鐺~~ 沒有那麼順利就成功的!!!
出現了一堆錯誤訊息 大致上是說少了一些java plugin
於是先安裝 sun-java6-plugin 就完成了!!
語法如下:
sudo apt-get install sun-java6-plugin
sudo update-java-alternatives -s java-6-sun
成功的更新了jvm!!

2010年12月8日 星期三

安裝 gcin

現在的linux也是越來越人性化了~~ 想當年~~ orz
兩行!!!!
sudo apt-get install gcin
im-switch -s gcin

gcin的介面還蠻舒服的 而且倚天鍵盤的設定 很容易找
雖然輸入不是很習慣 但是...是好物!!

2010年12月1日 星期三

ssh 免密碼登入

果然是已經學過的事情 在學一次果然很快 ="=
但是不紀錄下來 真的是不行
---------------------------------
三個步驟
1 ssh-keygen -t dsa
2 scp公鑰 到目標伺服器
3 連線到目標伺服器 將公鑰檔案附加到~/.ssh/authorized_key中

特別要注意的事情是
authorized_key的權限是600如果不是~~歹勢~ 是沒有辦法成功的!!!
至於scp的用法 scp 檔案 遠端帳號@遠端伺服器名稱