Archive for 軟體分享
jQuery Plugin – 台灣郵遞區號 3+2 版本
Posted by essoduke - 2010 年 08 月 31 日 21:28:52 - 17 User Views
自從 3 碼版本釋出後,就有詢問 3+2 版本的可能性,考慮到當時惰性發作所以一直沒有動工,直到這次狠下心來直接改寫才有雛型產生。
這個版本主要是使用中華郵政所提供的 XML 並以縣市為單位分成數十個 json,用 Ajax 方式以期效能上不會拖累太多。
基本功能如同舊版一樣,也加上了 1.3 之後更新的手動輸入功能,不過 3+2 改為符合的縣市路名單一號碼有多筆記錄對應時,僅列出符合的記錄。
目前僅測試於 IE8/ Firefox 3.6 / Google Chrome 5
–
年底縣市合併後勢必會再改版,所以現在是做心酸的 XD
jQuery 台灣郵遞區號外掛 v1.3
Posted by essoduke - 2010 年 08 月 25 日 20:48:49 - 46 User Viewstwzipcode v1.3 加入了輸入郵遞區號取得縣市名稱的功能,以及 zipSel, zipReadonly 兩個選項。
下載位址:
- twzipcode-1.3.js (14 KB)
[C#] KMClear – 鍵鼠清潔輔助器
Posted by essoduke - 2010 年 05 月 24 日 22:49:22 - 134 User Views首先,這不是能自動幫你清潔鍵鼠的工具 XD
它只是鎖定鍵盤滑鼠讓你在開機的時候可以清潔而已

支援平台:Windows 7, 2008, XP, 2003
環境需求:.Net FrameWork 3.5
檔案下載:KMClear.exe(11KB)
源碼下載:KMClear.zip(112KB – Visual C# 2008 Express)
這類程式有兩個重點要處理,一個是全螢幕執行,另一個就是鍵盤攔截。
全螢幕執行比較簡單,完全不需要 API:
- private void Form1_Load(object sender, EventArgs e)
- {
- this.SetVisibleCore(false);
- this.FormBorderStyle = FormBorderStyle.None;
- this.Left = (Screen.PrimaryScreen.Bounds.Width / 2 - this.Width / 2);
- this.Top = (Screen.PrimaryScreen.Bounds.Height / 2 - this.Height / 2);
- this.SetVisibleCore(true);
- }
另一個則是需要借助 Low-level API 的鍵盤攔截:
- using System;
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- namespace KMClear
- {
- internal class HookAPI
- {
- /* API Assign */
- [DllImport("user32.dll", SetLastError = true)]
- public static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, uint threadId);
- [DllImport("user32.dll", SetLastError = true)]
- public static extern bool UnhookWindowsHookEx(IntPtr idHook);
- [DllImport("user32.dll", SetLastError = true)]
- public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
- [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
- private static extern IntPtr GetModuleHandle(string lpModuleName);
- public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
- private static IntPtr hKeyboardHook = IntPtr.Zero;
- private HookProc KeyboardHookProcedure;
- private const int WH_KEYBOARD_LL = 13;
- private const int WM_KEYDOWN = 0x0100;
- /// <summary>
- /// Start Keyboard Hook Process
- /// </summary>
- public void HookStart()
- {
- if (hKeyboardHook == IntPtr.Zero)
- {
- using (Process curProcess = Process.GetCurrentProcess())
- {
- using (ProcessModule curModule = curProcess.MainModule)
- {
- KeyboardHookProcedure = new HookProc(KeyboardHookProc);
- hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProcedure, GetModuleHandle(curModule.ModuleName), 0);
- if (hKeyboardHook == IntPtr.Zero)
- {
- HookStop();
- throw new Exception("SetWindowsHookEx failed.");
- }
- }
- }
- }
- }
- /// <summary>
- /// Stop Keyboard Hook Process
- /// </summary>
- public void HookStop()
- {
- bool retKeyboard = true;
- if (hKeyboardHook != IntPtr.Zero)
- {
- retKeyboard = UnhookWindowsHookEx(hKeyboardHook);
- hKeyboardHook = IntPtr.Zero;
- }
- if (!(retKeyboard)) throw new Exception("UnhookWindowsHookEx failed.");
- }
- /// <summary>
- /// Keyboard Hook Process
- /// </summary>
- /// <param name="nCode"></param>
- /// <param name="wParam"></param>
- /// <param name="lParam"></param>
- /// <returns></returns>
- private IntPtr KeyboardHookProc(int nCode, IntPtr wParam, IntPtr lParam)
- {
- if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
- {
- int vkCode = Marshal.ReadInt32(lParam);
- Console.WriteLine((System.Windows.Forms.Keys)vkCode);
- return new IntPtr(1);
- }
- return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);
- }
- }
- }
我的常用 js 函式庫
Posted by essoduke - 2010 年 02 月 26 日 12:11:16 - 318 User Views※ 2010-03-02 補充:
Object prototype 改寫會導致 jQuery 出現異常,所以必須將 Object.prototype.isArray 註解或刪掉。
請參考:Prototyping Object in Javascript breaks jQuery? – StackOverflow
整理了一支我常用於網站開發的 js 函式庫,也包含了對字串、日期、陣列物件的 Prototype 增強函數,採 MIT 授權釋出,歡迎任意使用。
源碼:lib.common.js(16 KB)
壓縮:lib.common-min.js(9 KB)
Prototype: String
- var url = 'http://essoduke.org/?s=測試';
- var x = 'Test 測試';
- var y = '<strong>HTML</strong>';
- var z = '&;lt;strong&;gt;HTML</strong>';
- /* trim: 移除字串前後空白 */
- x.trim(); // result: Test
- /* bytes: 取得字串 bytes 長度 */
- x.bytes(); // result: 9
- /* empty: 是否為空 */
- x.empty(); // result: false
- /* left: 取字串左側 n 個字元 */
- x.left(4); // result: Test
- /* right: 取字串右側 n 個字元 */
- x.right(4); //result: t 測試
- /* HTMLEncode: 編碼 HTML 標籤 */
- y.HTMLEncode(); // result: &lt;strong&gt;HTML&lt;/strong&gt;
- /* HTMLDecode: 還原被編碼的 HTML 字串 */
- z.HTMLDecode(); // result: <strong>HTML</strong>
- /* URLEncode: 進行 URL 編碼 */
- url.URLEncode(); // result: http%3A%2F%2Fessoduke.org%2F%3Fs%3D%E6%B8%AC%E8%A9%A6
Prototype: Array
- var arr = [1, 2, 2, 3, 4, 4, 5];
- /* unique: 刪除重複的元素 */
- arr.unique(); // result: 1, 2, 3, 4, 5
- /* remove: 刪除第 n+1 個元素 */
- arr.remove(3); // result: 1, 2, 2, 4, 4, 5
- /* find: 尋找符合內容元素的鍵值 */
- arr.find(2); // result: 1, 2
Prototype: Date
- var x = new Date();
- /*
- * DateDiff: 計算傳入日期的差異
- * @param string cDate : 要比較的日期
- * @param string mode: 計算類型 y=年, m=月, w=周, d=日
- */
- x.DateDiff('2010-01-01', 'd'); // result 56
- /* DateAdd: 加上或減去指定的日期時間間隔
- * @param string interval : 時間間隔單位 y, m, d, w, h, n, s, l
- * @param integer numer: 時間間隔單位次數,可為正數或負數
- * @param string pattern: 回傳的時間格式(非必要,預設 'yyyy-MM-dd hh:mm:ss')
- */
- x.DateAdd('d', 100); // result '2010-06-06 11:21:47'
- /*
- * format: 格式化日期
- * @param string interval : 引數可參考 http://php.net/manual/en/function.date.php
- */
- x.format('Y m j'); // result '2010-02-26'
Prototype: Object
- /* isArray : 判斷是否為陣列 */
- var x = [1, 2, 3];
- x.isArray() // result 'true'
- var x = 'Test';
- x.isArray() // result 'false'
Functions
- var web = new COMMON();
- /* regexp: 驗證常用欄位 account, password, email, url, ip, date, time, number, twid 台灣身份證 */
- web.regexp('i.am@god.com', 'email'); // 驗證電子郵件
- web.regexp('http://test.com', 'url'); // 驗證網址
- web.regexp('10.10.10.10', 'ip'); // 驗證 IP
- /* timestamp2time: 將 timestamp 轉為時間日期格式 */
- web.timestamp2time(1267155821); // result 'Fri Feb 26 2010 11:46:30 GMT+0800 (Taipei Standard Time)'
- /* timestamp: 取得 timestamp */
- web.timestamp();
- /* leftPad: 字串左邊補零 */
- web.leftPad('100', 6); // result '000100'
- /* ie: 檢查是否為 IE */
- web.ie();
- /*
- * benchmark: 效能測試
- */
- web.benchmark.start(); // 開始計算
- [.....]
- web.benchmark.stop(); // 結束計算並返回執行秒數
- /*
- * cookie: cookie 操作
- */
- web.cookie.get('index'); // 取得 cookie[index] 內容
- web.cookie.set('index', '100'); //設置 cookie[index] 為 100
- web.cookie.remove('index'); // 移除 cookie[index]
- /*
- * debug: inline 方式顯示傳入變數內容或列舉子物件
- * ※此方法需使用 <a href="http://jquery.com/">jQuery Library</a>,建議 1.3.2 以上版本
- */
- var x = 'String';
- web.debug(jQuery); // 列舉 jQuery 所有內容
- web.debug(x); //顯示 x 變數內容
解決 TeamSpeak 3 中文化後字體過小的問題
Posted by essoduke - 2010 年 01 月 14 日 21:14:49 - 662 User Views如果在安裝 TeamSpeak 客戶端中文化後發生字體變成「標楷體」以及過小的問題,可以下載這個檔案解決:
default.qss(1KB 右鍵另存)
或是將下列文字加入「X:\Teamspeak Client\style\default.qss」,若熟悉 CSS 語法也可以自行更改。
- QAbstractScrollArea, QCheckBox, QComboBox, QDockWidget, QFrame,
- QGroupBox, QHeaderView, QLineEdit, QListView, QMainWindow, QMenu,
- QMenuBar, QProgressBar, QPushButton, QRadioButton, QScrollBar,
- QSizeGrip, QSlider, QSpinBox, QSplitter, QStatusBar, QTabWidget,
- QTabBar, QTableView, QToolBar, QToolBox, QToolButton, QToolTip, QTreeView {
- font:normal 12px PMingLiu;
- }
說明:這個檔案為預設佈景主題的樣式檔,改寫各個元素所使用的字型及大小為 12px 新細明體。
另外補上目前最完整的正體中文化(戰地秘境版已停止更新):
下載:Teamspeak 3 Client 正體中文語系(ZIP 98KB 右鍵另存)
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.



