全球最嚴個資法,台灣說第二,不知道有沒有其他國敢跳出來說第一,所以一堆公司開始了所謂的控管,免不的,資料庫有些敏感性資料也要加密,只好找找資料,試一下db2怎麼對表格中的欄位來進行加解密。
db2 針對不同型態,提供了不同的加解密函式,根據版本不同,有些函式還未提供,或是只供內部使用,所以只把我試出來可以用的列出來。
資料型態,主要針對varchar
使用下列函式:

mark528 發表在 痞客邦 留言(0) 人氣()

java 1.5 String.format 以前就覺得很好用,本想查查有多少 Conversion 可以用,沒想到一查 Formatter 中的各種 Conversion ,稍微試了一下,以前像 Date 處理、add leading zero、金額加上","等情況,都變得很容易處理了。
import java.util.Date;
public class StringFormatT {
public static void main(String[] args) {
System.out.println("===== test argument index ======================================================");
System.out.println("original\t10\t20");
System.out.println("format\t\t%1$s\t%1$d\t%2$s\t%2$d");
System.out.println(String.format("result\t\t\"%1$s\"\t%1$d\t\"%2$s\"\t%2$d", 10, 20));
System.out.println("original\t10\t20\t30\t40");
System.out.println("format\t\t%1$s\t%3$d\t%4$s\t%2$d");
System.out.println(String.format("result\t\t\"%1$s\"\t%3$d\t\"%4$s\"\t%2$d", 10, 20, 30, 40));
System.out.println("================================================================================");
System.out.println("===== formatted as string ======================================================");
System.out.println("original\t\"abc\"\tnull\t(byte)1\t3.14");
System.out.println("format\t\t%s\t%S\t%s\t%S");
System.out.println(String.format("result\t\t%s\t%S\t%s\t%S", "abc", null, (byte)1, 3.14));
System.out.println("================================================================================");
System.out.println("===== formatted as boolean =====================================================");
System.out.println("original\t\"abc\"\tnull\t(byte)1\t3.14");
System.out.println("format\t\t%b\t%B\t%b\t%B");
System.out.println(String.format("result\t\t%b\t%B\t%b\t%B", "abc", null, (byte)1, 3.14));
System.out.println("================================================================================");
System.out.println("===== formatted as hex =========================================================");
System.out.println("original\t\"100\"\tnull\t100\tnew Integer(100)\t3.14");
System.out.println("format\t\t%h\t%H\t%h\t%H\t\t\t%h");
System.out.println(String.format("result\t\t%h\t%H\t%h\t%H\t\t\t%h", "100", null, 100, new Integer(100), 3.14));
System.out.println("================================================================================");
System.out.println("===== formatted as character ===================================================");
System.out.println("original\t'A'\t97\t97");
System.out.println("format\t\t%s\t%C\t%c");
System.out.println(String.format("result\t\t%s\t%C\t%c", 'A', 97, 97));
System.out.println("================================================================================");
System.out.println("===== formatted as integer =====================================================");
System.out.println("original\t100\t100\t100");
System.out.println("format\t\t%d\t%o\t%h");
System.out.println(String.format("result\t\t%d\t%o\t%h", 100, 100, 100));
System.out.println("================================================================================");
System.out.println("===== formatted as big number ==================================================");
System.out.println("original\t123456789L");
System.out.println("format\t\t%1$d\t\t%1$,d");
System.out.println(String.format("result\t\t%1$d\t%1$,d", 123456789L));
System.out.println("================================================================================");
System.out.println("===== formatted as float =======================================================");
System.out.println("original\t123456789.98765");
System.out.println("format\t\t%1$.2a\t\t%1$.2e\t\t%1$.2f\t\t%1$.2g");
System.out.println(String.format("result\t\t%1$.2a\t%1$.2e\t%1$.2f\t%1$.2g", 123456789.98765));
System.out.println("================================================================================");
System.out.println("===== formatted as date ========================================================");
long currentTime = System.currentTimeMillis();
Date date = new Date();
System.out.println("original\tCurrent datetime use System.currentTimeMillis()");
System.out.println("format\t\t%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS");
System.out.println(String.format("result\t\t%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS", currentTime));
System.out.println("format\t\t%1$tF %1$tT");
System.out.println(String.format("result\t\t%1$tF %1$tT", currentTime));
System.out.println("original\tCurrent datetime use java.util.Date");
System.out.println("format\t\t%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS");
System.out.println(String.format("result\t\t%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS", date));
System.out.println("================================================================================");
System.out.println("===== What's the effect of width.precision on String? ==========================");
System.out.println("original\tabcdefg");
System.out.println("format\t\t[%1$s]\t\t[%1$10s]\t[%1$10.4s]\t[%1$-10s]");
System.out.println(String.format("result\t\t[%1$s]\t[%1$10s]\t[%1$10.4s]\t[%1$-10s]", "abcdefg"));
System.out.println("================================================================================");
System.out.println("===== padding easy ==========================");
System.out.println("original\tadd leading zero");
System.out.println("format\t\t%012d");
System.out.println(String.format("result\t\t%012d", 123));
System.out.println("================================================================================");
System.out.println("===== test new line ============================================================");
System.out.println("original\t[%n]");
System.out.println("format\t\t%n");
System.out.println(String.format("result\t\t[%n]"));
System.out.println("================================================================================");
}
}
結果顯示:
===== test argument index ====================================================== original 10 20 format %1$s %1$d %2$s %2$d result "10" 10 "20" 20 original 10 20 30 40 format %1$s %3$d %4$s %2$d result "10" 30 "40" 20 ================================================================================ ===== formatted as string ====================================================== original "abc" null (byte)1 3.14 format %s %S %s %S result abc NULL 1 3.14 ================================================================================ ===== formatted as boolean ===================================================== original "abc" null (byte)1 3.14 format %b %B %b %B result true FALSE true TRUE ================================================================================ ===== formatted as hex ========================================================= original "100" null 100 new Integer(100) 3.14 format %h %H %h %H %h result bdf1 NULL 64 64 11e29ba7 ================================================================================ ===== formatted as character =================================================== original 'A' 97 97 format %s %C %c result A A a ================================================================================ ===== formatted as integer ===================================================== original 100 100 100 format %d %o %h result 100 144 64 ================================================================================ ===== formatted as big number ================================================== original 123456789L format %1$d %1$,d result 123456789 123,456,789 ================================================================================ ===== formatted as float ======================================================= original 123456789.98765 format %1$.2a %1$.2e %1$.2f %1$.2g result 0x1.d7p26 1.23e+08 123456789.99 1.2e+08 ================================================================================ ===== formatted as date ======================================================== original Current datetime use System.currentTimeMillis() format %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS result 2013-05-13 16:08:57 format %1$tF %1$tT result 2013-05-13 16:08:57 original Current datetime use java.util.Date format %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS result 2013-05-13 16:08:57 ================================================================================ ===== What's the effect of width.precision on String? ========================== original abcdefg format [%1$s] [%1$10s] [%1$10.4s] [%1$-10s] result [abcdefg] [ abcdefg] [ abcd] [abcdefg ] ================================================================================ ===== padding easy ========================== original add leading zero format %012d result 000000000123 ================================================================================ ===== test new line ============================================================ original [%n] format %n result [ ] ================================================================================

mark528 發表在 痞客邦 留言(0) 人氣()

Apple iOS Human Interface Guidelines
Android Design
Windows User Experience Interaction Guidelines
Windows 針對應用程式設計 UX
Windows Phone 設計指南

mark528 發表在 痞客邦 留言(1) 人氣()

剛好遇上要用db2 sequence, 將試過的語法做個備忘。
1. create
CREATE SEQUENCE XX_SEQ START 1 INCREMENT BY 1 MAXVALUE 999999 CYCLE NO CACHE
說明:
START WITH:起始值
INCREMENT BY:每次增加多少
MAXVALUE:設定最大值,不設定就設成 NO MAXVALUE
CYCLE:當到達最大值時,是否從頭開始,不循環設成NO CYCLE
CACHE:一次產生多個值於記憶體中,方便快速取用,如 CACHE 3 ,就會產生3個值於記憶體中,若不使用,則設成NO CACHE
2. alter (重新設定起始值) ALTER SEQUENCE XX_SEQ RESTART WITH 10
3. 使用 next value for seq_name 取值
SELECT NEXT VALUE FOR XX_SEQ FROM sysibm.sysdummy1
4. drop(刪除)
DROP SEQUENCE XX_SEQ RESTRICT

mark528 發表在 痞客邦 留言(0) 人氣()


囧,會想研究一下這東西的出發點,是因為我懶,以前新增新類別後,一些註解說明都是複製之前的類別內容,在來慢慢改,其中大部份的內容完全一模一樣,為了省下這一段工,以懶為出發點,就來研究如何客製化eclipse code template。
Step 1. 從eclipse menu 點擊 Window -> Preferences -> Java -> Code Style -> Code Templates
Step 2. 展開 Code 或 Comment ,選擇要修改的項目,在點擊 Edit 即可進行修改。
Note: 測試後發現 Comment 這部份怎麼修改都沒有反應。
最後我修改了 Code 中的兩個項目:
New java files(原始內容,其中filecomment, typecomment對應到Comment那部分,修改無效)
${filecomment}
${package_declaration}
${typecomment}
${type_declaration}
New java files(修改後,其中的log4j因為都會用到,懶到最高點,把它加進來)
${filecomment}
/*
* @(#)${file_name} ${date}
*
* Copyright (C) 2004 Your Company.
* All right reserved.
*/
${package_declaration}
import org.apache.log4j.Logger;
${typecomment}
/**
* 類別說明請新增
* @author ${user}
* @version 1.0 ${date}
*/
${type_declaration}
Class body(原本是空的,我加了log4j和Constructor)
/** for log4j */
static Logger log = Logger.getLogger(${type_name}.class.getName());
/** Constructor */
public ${type_name}() {}
經過這樣修改後,每次新增類別時,我又可以省打好多字 ^_______________^

mark528 發表在 痞客邦 留言(0) 人氣()


msn 雖然說4/8停止服務,但一直到今天才被強制要求更新至 skype,沒想到要安裝的時候一直出現『先前的安裝並未完成,而且需要重新開機』,可是重開機,錯誤訊息還是一樣,不給裝就是不給裝。
解決方式:
以下解決方式會修改到登錄編輯程式,請自行承擔使用「登錄編輯程式」的一切風險。
1. 按一下 [開始],再按一下 [執行]/windows 7是[搜尋程式與檔案]。
2. 輸入 regedit,再按一下 [確定]。
3. 找出並按一下下列登錄機碼:
   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
4. 找出並刪除機碼中的任何 PendingFileRenameOperations 值。
5. 提示您確認刪除時,按一下 [是]。
6. 結束 [登錄編輯程式]。
7. 重新執行 Skype 安裝程式。

mark528 發表在 痞客邦 留言(0) 人氣()

先來張完成圖,由左至右分別為MSM-07量產型、MSM-07UC和MSM-07S專用型。
常用工具:筆刀、尺、小剪刀、膠水、夾子和牙線。

製作流程:先將圖紙上各零件切割下來,在摸索的組回各部位,很多紙模都沒說明,所以只能憑經驗去組組看,再把適合的黏起來。
腳:





手:



頭、身體主要部分:


這邊手要先裝,才能把身體的背部黏起來。

再加上腳的部分:

火箭推進裝置:

製作完成品:
MSM-07 UC

MSM-07S專用型

MSM-07量產型

mark528 發表在 痞客邦 留言(0) 人氣()


用了一陣子 Windows 8 ,感覺蠻多困擾的地方,最在意就是明明桌機最常用的多視窗或多工作桌面的使用方式,常常被 Windows 8 預設程式搞得有夠火大,看個圖片或 pdf 都被切成全螢幕,一整個不方便。
底下是變更系統預設程式的方法,以看圖程式為例,操作步驟如下:
1. 按快速鍵 WIN+X 打開選開,選擇[控制台]

2. 選擇[程式集]

3. 選擇[設定您的預設程式]

4. 先點選左邊窗格中的[Windows 相片檢視器],再選擇[選擇此程式的預設值]

5. 依據您的需求,勾選要關聯至[Windows 相片檢視器]的副檔名,然後再按下[儲存]就可以了。

mark528 發表在 痞客邦 留言(7) 人氣()

想要在命令視窗或命令列中執行 DB2 腳本,您可用 db2 -svtf ScriptName 來執行。
例如,script 為sample.sql
db2 -svtf sample.sql
參數說明︰
s 代表遇到錯誤時中止執行(如果您希望即使遇到錯誤也不要中止執行,請去掉此參數s
v 代表輸出結果到螢
t 指以;號作為每行的分隔符號
f 指後面需跟腳本檔案名

mark528 發表在 痞客邦 留言(0) 人氣()

原本是眾家 Linux 預設採用的 Database ,現在卻紛紛被拋棄,Oxxxxe 堪稱開源界的殺手,Java 和 MySQL 都中招了。
Mageia 2(原 Mandriva 社區衍生版)和 OpenSUSE 12.3 以後版本開了第一槍,Fedora 社區也宣佈將會在即將發佈的 Fedora 19 使用 MariaDB 替代 MySQL。
MariaDB 是原 MySQL 創始人 Michael 'Monty' Widenius 建立的一個 MySQL 社區分支,為避免 MySQL 落入 Oracle 收購後存在的閉源風險,同時提供更多特性及更強的性能。
MariaDB 最新穩定版本為 5.5.29,開發版本為 10.0.1 Alpha。MariaDB 10.0 依然基於 MySQL 5.5 開發,但會引入 MySQL 5.6 部分特性。
MariaDB 提供以下特性:
•XtraDB 替換 InnoDB,XtraDB 是 Percona 開發維護的 InnoDB 威力加強版,整合 Google、Facebook 等公司和 MySQL 社區的補丁。
•Aria 存儲引擎和 Sphinx 存儲引擎
•基於 Gelera Cluster 的 MariaDB 集群方案
•多主複製(將在 MariaDB 10.0 實現,由淘寶貢獻)
•Cassandra 存儲引擎(將在 MariaDB 10.0 實現)

mark528 發表在 痞客邦 留言(0) 人氣()



夏天毛色是棕紅色的梅花鹿,每到冬天會換上較深暗的毛,毛皮會變密變長,斑點變淺,這件冬季新衣讓牠不怕冷,依舊悠哉悠哉吃草。

mark528 發表在 痞客邦 留言(0) 人氣()



台灣野豬不怕冷,冬天依舊到處掘地找食物,野豬媽媽帶頭教啣葉子鋪床,睡得更香更舒服。

mark528 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。