2012年7月20日 星期五

[DB] DB 欄位值是 NULL 判斷語法

資料庫中欄位值是 NULL

java 判斷語法為 a == null

以上以 ms sql 為例

2011年11月16日 星期三

[Java] 當IE遇到不明副檔名會直接開啟該檔案的解決方法

遇到狀況:當IE遇到不明副檔名會直接開啟該檔案,改成用OutputStream的方式


response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename="xxx.txt");

InputStream is = new FileInputStream("要下載檔案的Path");
OutputStream os = response.getOutputStream();

int n = 0;
byte[] ba = new byte[1024];

while((n = is.read(ba)) != -1){
os.write(ba, 0, n);
}

is.close();
out.flush();
out.close();

response.setStatus(response.SC_OK);
response.flushBuffer();

2011年7月25日 星期一

[Dom4j] 需要的 jar 檔

dom4j-1.6.1.jar

jaxen.jar

2011年4月27日 星期三

SVN错误

SVN错误

现场描述:在Eclipse客户端第一次连到SVN时,如:svn://192.168.1.5/data/svn,然后要求输入用户名和密码。如果用户名和密码输入出错了,强行确定后。问题来了!会出现,以下错误信息:org.tigris.subversion.javahl.ClientException

Authorization failed
然后,就算把原有的位置废弃掉,第二次再连接时,也是老样的错误。这个原因是第二次连接还是用第一次的用户名和密码,所以还是出现上面的错误。
解决方法:把C:\Documents and Settings\chris\Application Data\Subversion这个文件夹删掉,然后重新链接,再输入正确的用户名和密码。即可OK了!

2011年4月17日 星期日

[eclipse] 設定記錄

windows => preferences => general => editors => text editors => show line numbers 打勾

windows => preferences => general => workspace => text file encoding 選UTF-8

2011年3月29日 星期二

[eclipse] JDK版本不一樣導致WTP項目錯誤

錯誤信息:Java compiler level does not match the version of the installed Java project facet.

解决方法: 專案點右鍵,選Properties,再選Project Facets,可以看到目前的JDK版本,選擇與menu中的 windows => preference中的 java => install JREs 的版本是要一致的

2010年11月12日 星期五

[Android] uses-permission 備註

AndroidManifest.xml 的 uses-permission 意義

頭尾是用"<"uses-permission">"包起來

android:name=”android.permission.INTERNET”
允許程式存取 internet

android:name="android.permission.ACCESS_NETWORK_STATE"
照字面的意思應該是允許程式存取網路的狀態吧!

android:name="android.permission.RESTART_PACKAGES"
以經不被支援了(This constant is deprecated. The restartPackage(String) API is no longer supported)

android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
(Allows mounting and unmounting file systems for removable storage.)
允許安裝和卸載在可移動存儲設備上吧

android:name="android.permission.WRITE_EXTERNAL_STORAGE"
寫入外部的儲存設備(應該是指SD Card)

android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"
(Allows an application to change whether an application component (other than its own) is enabled or not.)
允許一個程式是否改變一個組件或其他的啟用或禁用

android:name="android.permission.WRITE_CONTACTS"
(Allows an application to write (but not read) the user's contacts data.)
允許這個AP寫入(但不會讀出)用戶的聯絡人
 
android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
(Allows an application to access extra location provider commands)
允許應用程式訪問額外的位置提供命令