Popular Posts
javax.net.ssl.SSLHandshakeException: Connection closed by peer in Android 5.0 Lollipop Recently, there is a error occurs when access website via ssl connection like below although it worked fine several days ago. // Enable SSL... Build an OpenVPN server on android device Preparation An android device, in this case, Sony xperia Z is used Root permission required Linux Deploy for deploy i... Enable SSL connection for Jsoup import org.jsoup.Connection; import org.jsoup.Jsoup; import javax.net.ssl.*; import java.io.IOException; import java.security.KeyManagement...
Stats
Enable UNC (c$, d$) on windows 7
  1. Windows Registry Editor Version 5.00
  2.  
  3. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
  4. "LocalAccountTokenFilterPolicy"=dword:00000001
Receive doPostBack params
Javascript:
  1. __doPostBack("btnQuery", '123456');
Code behind:
  1. string target = Request.Params["__EVENTTARGET"]; // btnQuery
  2. string args = Request.Params["__EVENTARGUMENT"]; // 123456
Query all columns of all tables
  1. SELECT
  2.     a.TABLE_NAME                as 表格名稱,
  3.     b.COLUMN_NAME               as 欄位名稱,
  4.     b.DATA_TYPE                 as 資料型別,
  5.     b.CHARACTER_MAXIMUM_LENGTH  as 最大長度,
  6.     b.COLUMN_DEFAULT            as 預設值,
  7.     b.IS_NULLABLE               as 允許空值,
  8.     (
  9.         SELECT
  10.             value
  11.         FROM
  12.             fn_listextendedproperty (NULL, 'schema', 'dbo', 'table', a.TABLE_NAME, 'column', default)
  13.         WHERE
  14.             name='MS_Description' 
  15.             and objtype='COLUMN' 
  16.             and objname Collate Chinese_Taiwan_Stroke_CI_AS = b.COLUMN_NAME
  17.     ) as 欄位備註
  18. FROM
  19.     INFORMATION_SCHEMA.TABLES  a
  20.     LEFT JOIN INFORMATION_SCHEMA.COLUMNS b ON ( a.TABLE_NAME=b.TABLE_NAME )
  21. WHERE
  22.     TABLE_TYPE in ('BASE TABLE','VIEW')
  23. ORDER BY
  24.     a.TABLE_NAME, ordinal_position
CTE, recursive search
  1. WITH DepartmentSearch(DeptID, DeptParent, DeptName, OuID)
  2. AS
  3. (
  4.     -- 找出簽核者所屬部門
  5.     SELECT d.DeptID, d.DeptParent, d.DeptName, d.OuID
  6.     FROM tbDepartment d
  7.     LEFT JOIN tbEmpDept ed ON ed.DeptID = d.DeptID
  8.     INNER JOIN tbFlowApprove fa ON fa.Approver = ed.EmpID
  9.     WHERE fa.FlowInsID = @FlowInsID AND fa.FlowAct = @FlowAct AND fa.ActAppendix IS NULL
  10.     UNION ALL
  11.     -- 遞迴向上找出主管部門
  12.     SELECT d.DeptID, d.DeptParent, d.DeptName, d.OuID
  13.     FROM tbDepartment d
  14.     INNER JOIN DepartmentSearch ON DepartmentSearch.DeptParent = d.DeptID
  15. )
  16. SELECT * FROM DepartmentSearch
other ref: 一般資料表運算式(Common Table Expressions, CTE)
Convert relative url to absolute
  1. Uri baseUri = new Uri("http://www.domain.com/path/sample");
  2. Uri absoluteUri = new Uri(baseUri, "../../other/path");
  1. Uri uri;
  2. Uri.TryCreate("http://www.domain.com/base/uri", "../relative/uri", out uri);