2014年8月8日 星期五

改win7的預設動態tcp port範圍

用netsh這個命令,可以從命令中的help得到用法 netsh interface ipv4 set dynamicportrange tcp 10000 10000

2014年7月4日 星期五

Batch file to delete files older than N days

forfiles -p "C:\what\ever" -s -m *.* -d <number of days> -c "cmd /c del @path"
See forfile documentation for more details.
For more goodies refer to An A-Z Index of the Windows XP command line

If you don't have forfiles installed on your machine, copy it from any Windows 2003 Server to your Windows XP machine at %WinDir%\system32\ This is possible since the EXE is fully compatible between Win2003 and WinXP.

Later versions of Windows and Windows Server have it installed by default.

Update Win7: Syntax has changed a little therefore the updated command is:
forfiles -p "C:\what\ever" -s -m *.* /D -<number of days> /C "cmd /c del @path"
ref from stackoverflow

2013年10月7日 星期一

啊~不小心把eclipse專案裡的程式碼給砍了

今天不小心把eclipse專案裡的程式碼給砍了,
一開始用Undelete之類的軟體,用了一個免費但很爛的,氣個半死...
而且已經有檔案被蓋掉了  Orz...
過了3秒,冷靜下來之後想到用eclipse內建的Local History功能,它有暫存沒commit的檔案在它的神秘目錄裡面,可以去裡面慢慢挖,把檔案救回來!
路徑如下:
workspace的目錄/.metadata/.plugins/org.eclipse.core.resources/.history/

ref from eclipse的wiki

2013年8月20日 星期二

MySQL的中文問題

--可以修改某個Schema的編碼
alter database 死雞碼 character set utf8;

--可以修改某Table的編碼
alter table 表格名稱 convert to character set utf8;

2013年6月26日 星期三

查詢資料量大的Table

select * from dba_segments s, dba_tables t
where s.owner = t.owner 
and   s.SEGMENT_NAME = t.TABLE_NAME
and   s.OWNER not in  ('SYS', 'SYSTEM')
order by bytes desc;

2013年6月23日 星期日

下載檔案

//利用 java.net.URLEncoder.encode 把檔名轉成中文,避免下載時產生亂碼
response.setHeader("Content-Disposition","attachment; filename=" + java.net.URLEncoder.encode(request.getParameter("key"),"utf-8"));