<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-12756501</id><updated>2024-10-22T10:40:36.892+08:00</updated><category term="C#"/><category term="ASP.Net"/><category term="Java"/><category term="Regular Expression"/><category term="JavaScript"/><category term="SQLServer"/><category term="HTML"/><category term="IIS"/><category term="XPath"/><category term="Sun AppServer"/><category term="XML"/><category term="Virtual PC"/><category term="ASP"/><category term="CSS"/><category term="CMD"/><category term="Django"/><category term="Python"/><category term="Resin"/><category term="Tomcat"/><category term="VBScript"/><category term="XSL"/><category term="jQuery"/><title type='text'>yilin 的程式日記</title><subtitle type='html'>「其實所謂的人生，就是充滿了這麼多無聊的事情」</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>92</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-12756501.post-9133486455182798401</id><published>2016-11-07T13:46:00.001+08:00</published><updated>2016-11-07T13:47:28.867+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>[Python] VS2013 預設的 Django 專案修改紀錄</title><summary type="text">剛開始用VS2013玩 Django Web專案, 才發現開啟了一連串的災難, 為避免忘記, 還是做個紀錄好了.
環境說明:
1. 因原本電腦就裝了 Python3.4版, 所以一開始建環境時選的就是 Python3.4.
2. 建立完 Virtual Environment後, 顯示 Django 1.10.3 版, pip 1.5.6 版, setuptools 2.1 版.問題處理:
當裝完 Virtual Environment 後, VS 會出現 [Synchronize the Database] 的說明頁, 要開發人員去點選一個 [Django Sync DB…] 的功能. 
執行後出現以下的訊息:

 Executing manage.py syncdb
Unknown command: &#39;syncdb&#39;
Type &#39;manage.py help&#39; for usage.
</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/9133486455182798401/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/9133486455182798401' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/9133486455182798401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/9133486455182798401'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2016/11/python-vs2013-django.html' title='[Python] VS2013 預設的 Django 專案修改紀錄'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-1515835843443212004</id><published>2016-02-25T15:19:00.001+08:00</published><updated>2016-02-25T15:19:23.969+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Regular Expression"/><title type='text'>[Regex][C#] Pattern 比對的順序</title><summary type="text">假設要拆解 (A,B),C,(D,E,F),G 這樣的字串, 成為如下的結果:
(A,B)
C
(D,E,F)
G

第一個想到的會是用逗號(,)做分隔符號試試, 但得到的結果如下:
(A
B)
C
(D
E
F)
G



換用 match pattern 的方式來思考, 有以下兩種 patterns 是我們要的: 
被小括號框住的視為一個 pattern: \(.*?\)&amp;nbsp;&amp;nbsp; 
逗號之間的字元視為一個 pattern: [^,]+
以 C# 的程式實作, 大致如下:
string s = &quot;(A,B),C,(D,E,F),G&quot;;
MatchCollection matchs = Regex.Matches(s, @&quot;\(.*?\)|[^,]+&quot;, RegexOptions.IgnoreCase);
foreach (Match m in matchs)
{
  </summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/1515835843443212004/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/1515835843443212004' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/1515835843443212004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/1515835843443212004'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2016/02/regexc-pattern.html' title='[Regex][C#] Pattern 比對的順序'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-7813259856900709520</id><published>2015-04-10T17:47:00.001+08:00</published><updated>2015-04-10T18:05:07.682+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>[C#][Java] jni4net 基本使用 - Java呼叫C# 函式庫</title><summary type="text">首先, 到 jni4net 官方網站下載此套件. (我下載的是0.8.8版)
解壓縮後, 會得到三個資料夾:  

bin: 內有 proxygen.exe 執行檔, 用來產生Java與C#程式間溝通用的Proxy.  
lib: 包含將來執行時要用到的 .dll 與 .jar 檔.  
samples: 顧名思義, 放的是 jni4net 的範例程式碼.

使用情境: 撰寫一個 C# 的函式庫, 讓 Java 程式可透過 jni4net 套件執行該 C# 函式庫.
Step 1: 利用 Visual Studio 建立一個名為 CSharpLib 的 C# 函式庫專案, 並簡單寫一個MainTable.cs 程式如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/7813259856900709520/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/7813259856900709520' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/7813259856900709520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/7813259856900709520'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2015/04/cjava-jni4net-javac.html' title='[C#][Java] jni4net 基本使用 - Java呼叫C# 函式庫'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQ8xKS9RyHp61HWw6oxFTNFAsynoikihjIquAu4WSFbqTv3crVjzC-EwyQcBy_QKD2LnDJJ2xffoYHyYDDKe0cYXVD3YrmGhpkOjYfg7OpEYXfE91FR2HDx3X_N-kHOW0suLC5Iw/s72-c/?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-952445804328089154</id><published>2014-10-02T17:27:00.001+08:00</published><updated>2014-10-02T17:32:50.837+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Regular Expression"/><title type='text'>[Regex]加入數字的千分位(thousands separator)</title><summary type="text">因為Javascript的Regex沒有lookbehind, 所以一般在處理為數字加上千分位的作法會受到一些限制.以下先說明數字加上千分位的規則:  數字的整數部分每3位數插入一個逗號(,), ex: 123456 –&amp;gt; 123,456  小數點後不加入千分位, ex: 123456.1234 –&amp;gt; 123,456.1234 從字串的比對方式來說, 就是當1-3個數字字元, 其右方的數字字元長度是3的倍數時, 就為該比對到的Pattern最後補上一個逗號, 並依此類推至整個字串結束.所以一開始會有人寫成以下這樣的Regex Pattern:&quot;1234567&quot;.replace(/(\d{1,3})(?=(\d{3})+)/g, &quot;$1,&quot;);
結果發現, 怎麼不是1,234,567而是123,4,567 !?原因在於以下的比對步驟: 

因為是比對 (\d{1,3})(?=(</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/952445804328089154/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/952445804328089154' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/952445804328089154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/952445804328089154'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2014/10/regexthousands-separator.html' title='[Regex]加入數字的千分位(thousands separator)'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-1357185383806346102</id><published>2014-09-24T14:40:00.001+08:00</published><updated>2014-09-24T14:42:04.862+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>[C#] Dynamic change log4net connectionString</title><summary type="text">因為遇到資料庫連線字串是要從另一個系統取得, 所以研究了一下 log4net 如何動態設定資料庫連線.


撰寫一個繼承log4net.Appender.AdoNetAppender的class(ex: MyAdoNetAppender), 程式碼如下:public class MyAdoNetAppender : AdoNetAppender
{
  public new string ConnectionString
  {
    get
    {
      return base.ConnectionString;
    }
    set
    {
      base.ConnectionString = value;
    }
  }
}
＊這邊有兩點要注意:
A. 使用了new修飾詞隱藏base的ConnectionString.
B. </summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/1357185383806346102/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/1357185383806346102' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/1357185383806346102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/1357185383806346102'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2014/09/c-dynamic-change-log4net.html' title='[C#] Dynamic change log4net connectionString'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-2504094858610079342</id><published>2014-06-05T18:30:00.001+08:00</published><updated>2014-06-09T09:03:14.404+08:00</updated><title type='text'>[C# &amp;amp; Java] .Net 壓縮(GZipStream) VS. Java解壓縮</title><summary type="text">簡單說明需求:利用 .Net 程式將一個 PDF 檔案壓縮, 並將其轉為BASE64字串.
呼叫一個 Java 的 Web Service, 將此 BASE64 字串傳送到另一端.
Java 程式要轉換此 BASE64 字串, 並回存成 PDF 檔案.



這邊省略掉 Web Service 的傳輸說明, 僅說明 .Net 程式的壓縮與轉換 BASE64, 以及 Java 程式的 BASE64 轉換與解壓縮. .Net C# 程式:// 讀取 PDF 檔案
byte[] fileData = File.ReadAllBytes(@&quot;C:\test.pdf&quot;);
// 用來儲存最後轉換為 BASE64 字串的變數
string cmpData = string.Empty;
// 將檔案資料轉至 MemoryStream
using (MemoryStream msIn = new </summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/2504094858610079342/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/2504094858610079342' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2504094858610079342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2504094858610079342'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2014/06/c-java-net-gzipstream-vs-java.html' title='[C# &amp;amp; Java] .Net 壓縮(GZipStream) VS. Java解壓縮'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-823628488812106185</id><published>2014-02-18T23:19:00.001+08:00</published><updated>2014-02-19T17:55:42.875+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Regular Expression"/><title type='text'>[Regex]Match Overlaping Pattern</title><summary type="text">情境: 將字串 1 &amp;lt; 20 &amp;lt; 5 &amp;lt; 3 分解成 1 &amp;lt; 2020 &amp;lt; 55 &amp;lt; 3當利用Regex做字串比對時, 會發現比對是一連串的字串消化行為.所以若試著使用 (\d+\s*[&amp;lt;&amp;gt;=]+\s*\d+) 這樣的Pattern作比對時, 會發現只能比對到如下的結果:1 &amp;lt; 205 &amp;lt; 3 中間的部分因為20這個數字已經被消化掉, 所以不會再被使用來比對後續的字串.因此, 為了能達到一開始的目的, 我使用了 Lookahead &amp;amp; Lookbehind. Pattern: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (?=(\b\d+\s*[&amp;lt;&amp;gt;=]+\s*\d+\b))這邊要注意Pattern前後用了 \b 這個符號, 如果沒用此符號, 會多出一個 0 &amp;lt; 5 的Match結果.有興趣的可以</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/823628488812106185/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/823628488812106185' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/823628488812106185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/823628488812106185'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2014/02/regexmatch-overlaping-pattern.html' title='[Regex]Match Overlaping Pattern'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-4008377096569925760</id><published>2013-03-12T17:53:00.001+08:00</published><updated>2013-03-12T17:54:30.659+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><title type='text'>[ASP.Net] Chrome找不到favicon.ico時會產生新Session</title><summary type="text">先前認為 ASP.Net 網站加入 Global.asax 檔, 就可正確地建立 Session.
(參考: Session.IsNewSession 與 Session.SessionID)
不過沒想到 Chrome 瀏覽器很奇怪地會去存取網站的 /favicon.ico, 並在此 .ico 檔不存在時, 建立新的 Session, 導致 Session 的使用與預期不符.
還好解決方案還算簡單:為網站加入 favicon.ico 檔, 以避免 Chrome 因為該檔案產生 404 Error 而造成 Session 的重新建立.
在 MVC 專案中, 可在 router中加入一項 favicon.ico 的過濾.routes.IgnoreRoute(&quot;favicon.ico&quot;);

</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/4008377096569925760/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/4008377096569925760' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/4008377096569925760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/4008377096569925760'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2013/03/aspnet-chromefaviconicosession.html' title='[ASP.Net] Chrome找不到favicon.ico時會產生新Session'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-3836617584959819934</id><published>2013-01-21T11:40:00.001+08:00</published><updated>2013-01-21T11:42:53.846+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>[C#] Windows 目錄的長路徑與短路徑轉換</title><summary type="text">因為 Windows 的目錄/檔名允許空白字元, 所以造成寫命令列指令(ex: java)時往往要用雙引號(&quot;)包裝路徑, 以避免空白字元分隔了參數.
不過最近用了一個 SVG 轉圖的 Java 套件(SVG Rasterizer), 卻不接受雙引號框住的路徑. 反而要將路徑轉為無空白字元的短路徑才行. 在 C# 中要做到長短路徑互換, 可透過 DllImport 的方式來使用以下兩個 Windows 的函式: 
GetShortPathName 與 GetLongPathName. GetShortPathName 的使用範例如下:// 透過 DllImport 呼叫 Windows API
[DllImport(&quot;kernel32.dll&quot;, CharSet = CharSet.Auto)]
public static extern int GetShortPathName(
</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/3836617584959819934/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/3836617584959819934' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/3836617584959819934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/3836617584959819934'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2013/01/c-windows.html' title='[C#] Windows 目錄的長路徑與短路徑轉換'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-5111968601317493849</id><published>2012-11-19T14:27:00.001+08:00</published><updated>2012-11-20T12:02:40.755+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><title type='text'>[ASP.Net] MVC3 專案升級至 MVC4</title><summary type="text">前置作業: 
1. 透過 Microsoft Web Platform Installer 安裝 MVC4 開發套件.
2. 備份既有的 MVC 3 專案.

透過 Microsoft Web Platform Installer 選取 &quot;ASP.NET MVC 4 with Language Packs&quot;進行安裝.(圖一)  
圖一. 透過 Microsoft Web Platform Installer 安裝
按下 &quot;我接受&quot; 後開始安裝.


圖二. 安裝 MVC4.
安裝完畢後, 電腦(64位元)中的 C:\Program Files (x86)\Microsoft ASP.NET\ 會多一個 ASP.NET MVC 4 的目錄; C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\ 目錄中會多一個 v2.0 的</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/5111968601317493849/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/5111968601317493849' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/5111968601317493849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/5111968601317493849'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2012/11/aspnet-mvc3-mvc4.html' title='[ASP.Net] MVC3 專案升級至 MVC4'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKlhUlFyqdT95IU4lfWQq20dx1Cq4WCXxieap5xpg5seQLZ2CjZ0OixY_PnxlCX7Ao0RVdEoCSZxPlTvUN0oODoZsCTK-Wp0IRFhFikSz1_HPAEbAMWvOgP-ubjGN4IcsP_5HIrA/s72-c/?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-4103515993737248355</id><published>2012-06-17T00:24:00.001+08:00</published><updated>2012-06-17T00:26:30.034+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQLServer"/><title type='text'>[SQL Server] Trigger的資料異動紀錄(part2)</title><summary type="text">有時候我們會在資料表都建立後, 才想到要另外加個欄位(UpdateTime)記錄修改時間. 但欄位建了, 程式卻可能因為種種原因無法配合修改. 所以此時可透過 trigger 來幫助完成這項功能.
不過, 假如在 TableA 中加入了一個 AFTER UPDATE 的 trigger(TableA_UptTrigger) 去修改 TableA 的資料, 很顯然地可能會導致迴圈的產生. 此時, 有以下兩種選擇:
  

將 trigger 的遞迴功能關閉:ALTER DATABASE databasename
SET RECURSIVE_TRIGGERS OFF

這個設定是針對整個資料庫做的設定, 所以如果本身寫 trigger 的經驗不多, 先關掉也許也保險一點. 

在 RECURSIVE_TRIGGERS 是 ON 的狀態下, 透過 TRIGGER_NESTLEVEL() 這個</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/4103515993737248355/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/4103515993737248355' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/4103515993737248355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/4103515993737248355'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2012/06/sql-server-triggerpart2.html' title='[SQL Server] Trigger的資料異動紀錄(part2)'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-2231772159256879885</id><published>2012-03-15T01:57:00.001+08:00</published><updated>2012-04-27T17:38:00.209+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><title type='text'>[ASP.Net] 在IIS7中架設 Highcharts 的 Exporting 網站</title><summary type="text">Highcharts 預設的圖片下載是透過 http://export.highcharts.com/ 網站提供的服務來達到，且官網也有提供 Export module 供有需要的人自行架設。本文主要是在說明如何在 IIS7中架設此匯出圖片的網站，且該網站可使用整合式的 .Net Framwork v4 應用程式集區。


下載 ASP.Net 版的 Export module: https://github.com/imclem/Highcharts-export-module-asp.net  

圖1. 按下[ZIP]按鈕下載此套件

解壓縮後可看到兩個目錄(Exporting_Demo_website 與 Tek4.Highcharts.Exporting)，我們需要的是 /Exporting_Demo_website 這個目錄。

在此目錄中可以看到兩個 .config 檔 (</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/2231772159256879885/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/2231772159256879885' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2231772159256879885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2231772159256879885'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2012/03/aspnet-iis7-highcharts-exporting.html' title='[ASP.Net] 在IIS7中架設 Highcharts 的 Exporting 網站'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinXgHpcT898DQCY7RgHMBOnKDwIJ7WbikNU8FJreyj5C5FuAfAA_tIw0wvIwks47bDkClmdHjlDU4wWTE3ZIv6S0dP8qjO6YNPLloBkdcV6aEePm0IRODw7JJ2EsmZ09jXLODGZA/s72-c/?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-2617261706687574065</id><published>2012-03-13T15:46:00.001+08:00</published><updated>2012-04-27T17:35:25.856+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Regular Expression"/><title type='text'>[JavaScript] 以固定長度的方式為字串加入分隔符號</title><summary type="text">例: 以 CD-Key 的格式而言, 大致像 12345-67890-ABCDE-FGHIJ
但有時會為了方便使用者輸入, 會允許使用者輸入無分隔符號的字串, 此時就會想要簡單地依長度來分割字串, 並加入分隔符號.


以下的sample會將&amp;nbsp;1234567890ABCDEFGHIJ&amp;nbsp;轉換為&amp;nbsp;12345-67890-ABCDE-FGHIJ
var s = &quot;1234567890ABCDEFGHIJ&quot;;
alert(s.match(/.{5}/g).join(&#39;-&#39;));
但如果是&amp;nbsp;1234567890ABCDEFGHIJKLM&amp;nbsp;(多了KLM), 就還是會維持原來的結果.
因為最後的 KLM 長度並未為 5, 所以被略過.
若要讓&amp;nbsp;1234567890ABCDEFGHIJKLM 能被轉成&amp;nbsp;</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/2617261706687574065/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/2617261706687574065' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2617261706687574065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2617261706687574065'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2012/03/javascript.html' title='[JavaScript] 以固定長度的方式為字串加入分隔符號'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-6609376135100403456</id><published>2011-11-08T19:34:00.001+08:00</published><updated>2012-04-27T17:38:00.303+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQLServer"/><title type='text'>[SQL Server] 利用 Trigger 進行資料異動的備份</title><summary type="text">在系統開發過程, 我們往往沒事先規劃在一些重要資料修改過程中進行備份. 使得系統上線後又要改程式, 將程式中有進行修改 / 刪除的行為, 加入備份的程式碼 (例如將欲修改的資料寫一份到 log 表格). 但也許在經過工程師來來去去後, 新的工程師又忘了加入備份的程式碼, 導致最後又要重新檢視所有程式進行修改.為了避免上述的情況不段重演, 所以考慮在不動到程式的情況下進行資料備份, 也就是利用 trigger, 在指定表格修改或刪除的時候將資料備一份到 Log 表格.  以下我使用一個簡單的會員表格 (UserAccount) 進行說明:   建立 UserAccount 表格, 並新增幾筆資料以進行測試.     Column Name Data Type Description  user_name varchar(50) 帳號(PK)  user_pw varchar(50) 密碼</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/6609376135100403456/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/6609376135100403456' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/6609376135100403456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/6609376135100403456'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/11/sql-server-trigger.html' title='[SQL Server] 利用 Trigger 進行資料異動的備份'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1I9IBc-MlBeVjKOn3gyFGT5uBXCdbiKWxFkBg6At0avArrpRQkEQBUBKwmV_MvBXRuKj5UEC8PryyLMvHyWfN1KHir5SyMFKf6Y-OK4Fv34dlZ_9EwSUF4uBEobO8C_jgU7AcWA/s72-c/?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-2424087044206656500</id><published>2011-11-03T18:46:00.001+08:00</published><updated>2012-04-27T17:38:00.217+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>[Java] 讀取 Google Android Market 的 Sales Report</title><summary type="text">參考資料: http://code.google.com/intl/zh-TW/apis/checkout/developer/index.html
POST URL: https://checkout.google.com/api/checkout/v2/reports/Merchant/{merchantID}
在抓取 Report 前, 先說明如何找到後面程式需要的 Merchant ID 和 Merchant Key.

登入 https://checkout.google.com/sell/

切換到 [Settings] 頁籤, 然後按下位於左邊選單的 [Integration].

然後就能在右手邊的 [Account information] 看到兩個資訊: [Google merchant ID] 和 [Google merchant key]. (請將這兩個資訊記下來</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/2424087044206656500/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/2424087044206656500' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2424087044206656500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2424087044206656500'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/11/java-google-android-market-sales-report.html' title='[Java] 讀取 Google Android Market 的 Sales Report'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-1567110101983801111</id><published>2011-11-01T01:38:00.001+08:00</published><updated>2012-04-27T17:38:00.197+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>[Java] 讀取 App Store 的 Sales and Trends Report</title><summary type="text">參考文件: iTunes Connect Sales and Trends Guide (PDF)
在第三章 [Downloading, Reading and Understanding Sales and Trends Data] 有提到一個 Auto-Ingest Tool.
因為此 class 可在網路上找到 Source Code, 所以就能瞭解此程式到 App Store 抓 Report 的做法.
此程式的關鍵就在於 Apple 有放出一個 URL (https://reportingitc.apple.com/autoingestion.tft) 讓需要的人可透過簡單的 HTTP POST 來取得一個 .gz 檔.
取得此 .gz 檔後, 可再自行解壓縮以得到一個 .txt 的 CSV 資料檔, 最後再將此 CSV 格式檔匯入資料庫中.
首先, 先知道要對此 URL 傳送</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/1567110101983801111/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/1567110101983801111' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/1567110101983801111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/1567110101983801111'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/11/java-app-store-sales-and-trends-report.html' title='[Java] 讀取 App Store 的 Sales and Trends Report'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-5963000599684693848</id><published>2011-09-07T11:11:00.001+08:00</published><updated>2012-04-27T17:38:00.286+08:00</updated><title type='text'>[Others] 新版的 Microsoft Download Manager</title><summary type="text">以前下載 MSDN 的軟體時, 會自動啟動 File Transfer Manager (FTM).
不過這兩天要下載時, FTM都不會被啟動, 而是直接透過瀏覽器進行下載. (應該是因為我用了 IE9)
且由於檔案動輒幾 G 的大小, 常常斷線又沒續傳, 實在是頗傷腦筋.
後來查到 Microsoft 出了一版新的 Download Manager. (http://www.microsoft.com/download/en/details.aspx?id=26214)


這套軟體雖然跟 FTM 一樣可以設定 Retry 次數 / Retry 間隔 / 連線數, 但最好的地方在於可以新增 download link 了.
所以就算 MSDN 下載時沒啟動 Download Manager, 也可以手動將 Download link 貼上並新增.
以下是簡單的操作說明:
從 IE9 的</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/5963000599684693848/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/5963000599684693848' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/5963000599684693848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/5963000599684693848'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/09/others-microsoft-download-manager.html' title='[Others] 新版的 Microsoft Download Manager'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWs-Q-f8UivlPpAesRbGWEb3pIU_1UPbBndGMZWLJLpmradHDsNmqY2n7keVC55ig6dcIZ8fJARzuweQEp2LgFvX2fBXYLYwxDMahf6jju5UTf3HymcT1tvR1Kn5fnvpDlxG44Zg/s72-c/?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-6507345241505778318</id><published>2011-08-18T14:33:00.003+08:00</published><updated>2012-04-27T17:38:00.294+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>[Java] Apache 的 Commons Configuration 入門</title><summary type="text">
開發工具: Netbeans7.0 (http://netbeans.org/)  
Web Server: Tomcat5.5 (http://tomcat.apache.org/)  
所需套件:  
commons-configuration-1.6 (http://commons.apache.org/configuration/)  
commons-lang-2.6 (http://commons.apache.org/lang/)注意: 不要用到 commons-lang3 以上, 因為 namespace 改變了. (後續說明)  
commons-collections-3.2.1 (http://commons.apache.org/collections/)  
commons-logging (http://commons.apache.org/</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/6507345241505778318/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/6507345241505778318' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/6507345241505778318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/6507345241505778318'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/08/java-apache-commons-configuration.html' title='[Java] Apache 的 Commons Configuration 入門'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSj_5lj9D07z-GXPeF3OKW_3sKZ4Cgq5YyY8VPVRLLqimW_GMJ9HGGDcpG6Ie0aqTjSBAg_5F3bW9tY3f-xsc5l7yhX-ULrbmObt_fRMO3949R4Vf9Um7Pd0x3mv79d9KJzpxMYA/s72-c/?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-4113970880479277279</id><published>2011-04-06T19:26:00.005+08:00</published><updated>2012-04-27T17:38:00.241+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="XPath"/><title type='text'>[C#][XPath] 模擬 XPath 的 max 與 min</title><summary type="text">在 XPath 中, 有兩個函式感覺會很常用, 但 C# 中卻沒 support. 那就是 max() 和 min().   
少了這兩個函式, 每次想找 xml 資料中的最大/最小值, 就只能用 Linq 或是 Select 出所有標籤後, 在程式中去一個個比對.   
其實 XPath 只要轉個彎, 就能做出類似的功能.   

以下用一個簡單的 xml 來說明如何找出各班成績最好/最差的 &amp;lt;Student&amp;gt;:   
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;ClassSet&amp;gt;
    &amp;lt;Class&amp;gt;
        &amp;lt;Name&amp;gt;Class_A&amp;lt;/Name&amp;gt;
        &amp;lt;Student&amp;gt;
            &amp;lt;Name&amp;gt;</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/4113970880479277279/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/4113970880479277279' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/4113970880479277279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/4113970880479277279'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/04/cxpath-xpath-max-min.html' title='[C#][XPath] 模擬 XPath 的 max 與 min'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-8691962989881232064</id><published>2011-03-29T18:45:00.003+08:00</published><updated>2012-04-27T17:38:00.337+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>[BIRT] BIRT 的 Runtime Connection 設定 (proxool)</title><summary type="text">BIRT(Business Intelligence and Reporting Tools) 這套 Java 的報表套件其實還蠻好用的. 不過報表設計工具只有整合在 Eclipse.   有用過這一套的人大概都知道, 設計完一個報表後會產生一個 .rptdesign 的檔案.   而一般在程式中呼叫此報表檔, 並繫結資料的程式碼大致如下:   IReportRunnable design = this.birtReportEngine.openReportDesign(&amp;quot;test_report.rptdesign&amp;quot;);
IRunAndRenderTask task = this.birtReportEngine
                .createRunAndRenderTask(design);
// set report parameters
</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/8691962989881232064/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/8691962989881232064' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/8691962989881232064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/8691962989881232064'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/03/birt-birt-runtime-connection-proxool.html' title='[BIRT] BIRT 的 Runtime Connection 設定 (proxool)'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-4326630060058892188</id><published>2011-03-15T15:24:00.004+08:00</published><updated>2012-04-27T17:38:00.251+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQLServer"/><title type='text'>[SQL] IP 轉 Number, 與 Number 轉 IP 的 function</title><summary type="text">分析使用者的 IP 是來自哪個國家/城市, 在觀察網路行為上是很重要的一項數據.   
有興趣的人可以到這裡找尋一些 IP 與地理資訊的相關資源.   
至於 IP 轉換成數字的公式, 可以在 IP address 的 wiki 找到.   

以 wiki 中所舉的 172.16.254.1 來說:   

將 172 * 16777216 得到 一個 w 值 ( 2^24 = 16777216 ) 
將 16 * 65536 得到 一個 x 值 ( 2^16 = 65536 ) 
將 254 * 256 得到 一個 y 值 ( 2^8 = 256 ) 
將 1 * 1 得到一個 z 值 ( 2^0 = 1 ) 
最後透過 w + x + y + z 可得到此 IP 所代表的數字 2886794753 

反之, 將 2886794753 轉換為 IP 字串的</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/4326630060058892188/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/4326630060058892188' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/4326630060058892188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/4326630060058892188'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/03/sql-ip-number-number-ip-function.html' title='[SQL] IP 轉 Number, 與 Number 轉 IP 的 function'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-8474330810187655735</id><published>2011-01-27T17:41:00.003+08:00</published><updated>2012-04-27T17:38:00.316+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="XPath"/><title type='text'>[XPath][C#] 利用 XPath 的 contains 查詢特定的元素</title><summary type="text">透過 .Net 處理 XML 時, 有時會想要類似 SQL 裡的 IN (‘a’, b’, &#39;c’) 的查詢方式.    
查一下 w3schools 的 XPath 函式庫, 可以發現一個 function 還蠻符合的:     
fn:index-of((item,item,...),searchitem) 
只是一套用到程式中, 就會產生以下的 Exception:    
Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.
發生此問題的原因在於 .Net 並未完全支援 XPath 的函式, 有興趣的可以參考這個網址.

不過我發現有一個函式還不錯: fn:contains(string1,string2) 
</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/8474330810187655735/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/8474330810187655735' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/8474330810187655735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/8474330810187655735'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/01/xpathc-xpath-contains.html' title='[XPath][C#] 利用 XPath 的 contains 查詢特定的元素'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-3872597289737553692</id><published>2011-01-26T19:48:00.005+08:00</published><updated>2012-04-27T17:38:00.236+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="VBScript"/><title type='text'>[tool][VBScript] 用來刪除空資料夾的小工具</title><summary type="text">因為有些程式或 3rd-party 工具會產生一些暫時用的資料夾, 為了管理方便, 會想定時清掉沒資料或是過期的的資料夾. 這個小工具就是為了做這種事而寫的.   以下的程式可以包裝成 .vbs 檔, 然後設定到每日排程去執行.   
 Dim oFS   
Dim oFSFolder   
Dim sPath, sFlagPath, nExpireDays

Dim dFlagDate
&#39; 根目錄
sPath = &amp;quot;D:\test&amp;quot;
&#39; 用來比對資料是否過期的 flag 檔案
sFlagPath = sPath &amp;amp; &amp;quot;\flag&amp;quot;
&#39; 預設3天前的資料夾算是過期的資料夾
nExpireDays = -3

Set oFS = CreateObject(&amp;quot;</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/3872597289737553692/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/3872597289737553692' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/3872597289737553692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/3872597289737553692'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2011/01/toolvbscript.html' title='[tool][VBScript] 用來刪除空資料夾的小工具'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-2370947753515660561</id><published>2010-10-27T17:22:00.003+08:00</published><updated>2012-04-27T17:34:51.903+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>[jQuery] 在 jQuery 中處理 single/double quote</title><summary type="text">在透過 jQuery 設定標籤中的內容時, 有時會遇到內容中已經有單引號(&#39;) 或雙引號(&quot;) 的問題. 
例如: 從資料庫抓出了如下的一段 HTML 碼 
&amp;lt;b&amp;gt;&amp;lt;font color=&quot;#FF0000&quot;&amp;gt;This is a test&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;
接著透過 jQuery 的 .html() 將該資料設定至指定的一個 &amp;lt;div&amp;gt; 內: 
&amp;lt;div id=&quot;divMsg&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
$(&quot;#divMsg&quot;).html(&quot;${msg}&quot;);
&amp;lt;/script&amp;gt;
此時, 因為原本的 msg 變數中已經有雙引號存在, 所以若實際檢視輸出的 HTML 原始碼, 就會是以下的內容: 

&amp;lt;</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/2370947753515660561/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/2370947753515660561' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2370947753515660561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/2370947753515660561'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2010/10/jquery-jquery-singledouble-quote.html' title='[jQuery] 在 jQuery 中處理 single/double quote'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12756501.post-1674944481541858416</id><published>2010-09-14T19:17:00.002+08:00</published><updated>2012-04-27T17:35:25.784+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><title type='text'>[JavaScript] 在&amp;lt;select&amp;gt;中替換&amp;lt;option&amp;gt;的方式(KB 276228)</title><summary type="text">在網頁的設計中, 常會用到連動式的下拉式選單, 或是因為某個事件, 而置換掉下拉式選單中的選項. 但在 Microsoft 官網有提到一個問題: http://support.microsoft.com/kb/276228/zh-tw&amp;nbsp; 也就是, 不要用 innerHTML 去置換 &amp;lt;select&amp;gt; 中的 &amp;lt;option&amp;gt;.  以 jQuery 的用法來說, 很多人會使用以下的寫法: // clear all options
$(&quot;#myFavorList&quot;).find(&#39;option&#39;).remove();
// append new options
$(&quot;#myFavorList&quot;).append(&#39;&amp;lt;option value=1&amp;gt;Yahoo&amp;lt;/option&amp;gt;&#39;);
$(&quot;#myFavorList&quot;).append(&#39;&amp;lt;</summary><link rel='replies' type='application/atom+xml' href='http://yilinliu.blogspot.com/feeds/1674944481541858416/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12756501/1674944481541858416' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/1674944481541858416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12756501/posts/default/1674944481541858416'/><link rel='alternate' type='text/html' href='http://yilinliu.blogspot.com/2010/09/javascript-276228.html' title='[JavaScript] 在&amp;lt;select&amp;gt;中替換&amp;lt;option&amp;gt;的方式(KB 276228)'/><author><name>yilinliu</name><uri>http://www.blogger.com/profile/17139544409445269073</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhot5Ex_McKCtYamoalODzMEhGfkIjgsyqpIe9PwRVzL4pcUrIHVvE7w-PqjpsAFfmvg5pT-2OyTafUDdiVz_FCmwPNk5TkGlC1SzNtXYhiVAbXjAvfQw4g3C4zw0LhCNwCNJDWng/s72-c/?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry></feed>