星期四, 7月 23, 2009

HOW-TO 再Tomcat中設定對於用戶端的限制

1. 使用筆記本開啟[TOMCAT_HOME]\conf\server.xml
2. 找尋得

<host appbase="webapps" autodeploy="true" name="localhost" unpackwars="true" xmlnamespaceaware="false" xmlvalidation="false">
</host>

3. 再Host這標籤裡面撰寫關於Context的定義 範例如下

<context path="/axis2">
</context>


4. 再Context標籤中再寫入限制用戶端的定義 範例為Context名稱為axis2,只允許本機存取

<context path="/axis2">
<valve classname="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1"></valve>
</context>

5. 重新開啟Tomcat

PS: 另外還有以主機名稱來作限制的
<valve classname="org.apache.catalina.valves.RemoteHostValve" allow="*.foo"></valve>

參考文件 :
1. Apache Tomcat Configuration Reference-The Context Container
2. Apache Tomcat Configuration Reference-The Valve Component
3. Professional Apache Tomcat,作者:Chanoch Wiggers, Ben Galbraith, Vivek Chopra, Amit Bakore, Sing Li, Sandip Bhattacharya, Romin Irani, Chad Fowler,John Wiley and Sons, 2003, ISBN:0764543725, 9780764543722, pp172-175

星期一, 6月 01, 2009

取得系統已安裝軟體清單(C#)

//HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
RegistryKey regkey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", true);
string[] names = regkey.GetSubKeyNames();
for (int i = 0; i < names.Length; i++) {
RegistryKey a = regkey.OpenSubKey(names[i]);
string dName = (string)a.GetValue("DisplayName", "");
if (!dName.Contains(sname)) continue;
return true;
//Console.WriteLine(dName);
//Console.WriteLine("\t" + a.GetValue("UninstallString", ""));
}

星期三, 4月 08, 2009

星期三, 3月 25, 2009

星期日, 3月 15, 2009

支持本土創作者



這首歌是國片渺渺的主題曲,作詞作曲都是艾青。


詞曲:艾青

艾青:一位好友失戀了,我想以歌聲獻上一份安慰鼓勵。
也送給身邊的每一個人,你們都是我的天使!

艾青's Blog 及專輯試聽: http://www.wretch.cc/blog/ginagreen

艾青's StreetVoice 音樂作品 : http://tw.streetvoice.com/music/user-song-list.asp?sd=611461