嘗試了很多方式想要清除 Temporary Internet Files,但因為安全性無法列出所有檔案,所以無法清除!
其實只需利用 RunDll32.exe 即可達成刪除 快取 及 Cookie。
Temporary Internet Files
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
Cookies
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
History
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
Form Data
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
Passwords
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32
Delete All
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
Delete All – “Also delete files and settings stored by add-ons”
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351
以往常常遇到 Javascript 執行較長時間就會出現 "終止Javascript警訊" 或 "瀏覽器當掉",此時就可以利用 Conurrent Thread Library,就可以達到 Multi-Thread 效果,就不會當掉了。
檔案下載:Concurrent.Thread-full-20090713
相關說明:http://sourceforge.net/apps/mediawiki/jsthread/
範例:
<script src="Concurrent.Thread-full-20090713.js" language="javascript"></script> <script language="javascript" type="text/javascript"> Concurrent.Thread.create(function(){ var i = 0; while(true) document.body.innerHTML += (i++) + " "; }); </script>
有時候需要設定程式於指定時間執行,就需要透過 crontab 來設定排程資料!
編輯工作排程:
vim /etc/crontab
利用 iperf 工具準確測試網路間的傳送速度,其中一台電腦虛設為 Server 一台為 Client ,即可測試兩台電腦間的傳送速度。
軟體下載 for windows:iperf
軟體下載 for linux:http://sourceforge.net/projects/iperf/
A 電腦 Server 端,執行以下指令:
iperf –s
網頁中常常會出現明碼的信箱位址,時常會被機器人爬取,做為廣告發送目標。
本篇我利用 .Net 產生 JavaScript,防止機器人直接抓取原始碼中的電子信箱位址。
using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text; namespace Test { public partial class Test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Response.Write(MailToJS("[email protected]")); } /// <summary> /// 產生指定範圍的亂數 /// </summary> /// <param name="Min"></param> /// <param name="Max"></param> /// <returns></returns> public int RandomNext(int Min, int Max) { RNGCryptoServiceProvider rngp = new RNGCryptoServiceProvider(); byte[] rb = new byte[4]; rngp.GetBytes(rb); int value = BitConverter.ToInt32(rb, 0); value = (value % (Max - Min + 1)); if (value < 0) value = -value; value += Min; return value; } /// <summary> /// 將信箱轉為JS /// </summary> /// <param name="Mail"></param> /// <returns></returns> protected string MailToJS(string Mail) { List<string> CList = new List<string>(); for (int i = 32; i <= 64; i++) CList.Add(Convert.ToChar(i).ToString()); for (int i = 91; i <= 126; i++) CList.Add(Convert.ToChar(i).ToString()); List<string> NList = new List<string>(); while (CList.Count > 0) { int R = RandomNext(0, CList.Count - 1); NList.Add(CList[R]); CList.RemoveAt(R); } List<int> EList = new List<int>(); Mail = Mail.ToLower(); Mail = "<a href=\"mailto:" + Mail + "\" hidefocus=\"true\">" + Mail + "</a>"; foreach (char c in Mail) EList.Add(NList.IndexOf(c.ToString())); for (int i = 0; i < NList.Count; i++) { if (NList[i] == "'") NList[i] = "'" + NList[i].Replace("'", "\\'") + "'"; else if (NList[i] == "\\") NList[i] = "'" + NList[i].Replace("\\", "\\\\") + "'"; else NList[i] = "'" + NList[i] + "'"; } StringBuilder SB = new StringBuilder(); SB.AppendLine("<script type=\"text/javascript\">"); SB.AppendLine("<!--"); SB.AppendLine("\t(function(){"); SB.AppendLine("\t\tvar ek = [" + String.Join(",", NList.ToArray()) + "];"); SB.AppendLine("\t\tvar en = [" + String.Join(",", EList.ToArray()) + "];"); SB.AppendLine("\t\tvar ds = \"\";"); SB.AppendLine("\t\tfor(var i in en) ds += ek[en[i]];"); SB.AppendLine("\t\tdocument.write(ds);"); SB.AppendLine("\t})();"); SB.AppendLine("// -->"); SB.AppendLine("</script>"); return SB.ToString(); } } }
因為修改 Web.config、Bin及回收都會造成 Session 遺失,只需開起 ASP.NET State Service 即可解決此問題。
到控制台 設定 > 服務 > ASP.NET State Service :
安裝 squid 指令:
apt-get install squid
安裝完成後,編輯 /etc/squid3/squid.conf:
vi /etc/squid3/squid.conf
編輯 http_port 預設為 3128,可以改為想設定的 Proxy Port:
只需輸入以下指令即可安裝 PPPoE:
pppoeconf
PPPoE 連線指令:
poff dsl-provider
PPPoE 斷線指令:
pon dsl-provider
利用 NPOI 指定欄位儲存格格式:
HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet("工作表名稱"); HSSFRow Row = (HSSFRow)sheet.CreateRow(0); //欄位為數值 注意不可為字串 Row.CreateCell(0).SetCellValue(Convert.ToDouble("123")); HSSFCellStyle cs = (HSSFCellStyle)workbook.CreateCellStyle(); //Format格式為數字 cs.DataFormat = HSSFDataFormat.GetBuiltinFormat("0"); //Format格式為百分比小數兩位 cs.DataFormat = HSSFDataFormat.GetBuiltinFormat("0.00%"); Row.GetCell(0).CellStyle = cs;
利用 NPOI 公式指令:
HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet("工作表名稱"); HSSFRow Row = (HSSFRow)sheet.CreateRow(0); Row.CreateCell(0).CellFormula = "SUM(A1:B1)"; Row.CreateCell(1).CellFormula = "A1-B1"; //更新有公式的欄位 sheet.ForceFormulaRecalculation = true;