2012年6月1日 星期五

import 自簽憑証到 JDK 中

  • 先找出jdk 存放憑証的地方,預設目錄為%JAVA_HOME%/jre/lib/security 底下的 cacerts 檔
  • 準備好 要匯入的檔案  例:/tmp/newcert.der
  • 工作目錄換到  %JAVA_HOME%/jre/lib/security
  • keytool -importcert -file /tmp/newcert.der -keystore cacerts -alias openssl_crt_der

2012年5月29日 星期二

command line svn ignore 設定

  • svn propget svn:ignore [路徑] →用來看[路徑]下的svn:ignore清單
      例:
    1. svn propget svn:ignore . → 看當前目錄的 ignore 設定
    2. svn propget svn:ignore folderA/borderAA → 看folderA/borderAA目錄下的 ignore 設定
    所以概念上,svn:ignore 是依每個目錄去讀取(設定)的。
  • svn propset svn:ignore [路徑] [ignore檔案名 或 pattern名]→用來設定[路徑]下的svn:ignore清單。
    一旦執行之後原本的ignore清單就會被overwrite掉,基本上個人不建議這種做法,因為沒有先看過 原本的設定是什麼的話,直接下指執令,裡svn:ignore設定會直接被清掉。就算看過了,你要把原本的設定重新打一次,再加上要新增的ignore。感覺蠻麻煩的。
  • $svn propedit svn:ignore [路徑]
    會用文字編輯器去編輯 svn:ignore但是如果subversion沒有設定預設的文字編輯器時,可以加上 --editor-cmd [編輯器] 來指定
      例:
    • $svn propedit svn:ignore . --editor-cmd vim , 表示指定用vim 來做為編輯器,編輯當前目錄的 svn:ignore。
    如果想要當前目錄下有個資料夾名稱是 folderA ,裡面有個檔案叫 ooxx.xml 想要把它ignore時。
    作法為
    1. 在當前目錄下 $svn propedit svn:ignore folderA --editor-cmd vim 進入編輯
      加上ooxx.xml 在文字檔內
    2. $cd folderA
      $svn propedit svn:ignore . --editor-cmd vim 進入編輯
      加上ooxx.xml 在文字檔內
    3. 但是不能在當前目錄下 $svn propedit svn:ignore . --editor-cmd vim 進入編輯
      然後加上 folderA/ooxx.xml 這樣是不會有ignore 的效果的

2012年4月30日 星期一

在 ubuntu 12.04 下自行安裝 subversion 1.7

在ubuntu 12.04 下 用apt-get 目前安裝的版本為1.6 想要自行安裝 1.7 過程如下:
  • 到 subversion 的官方網站下載目前 release 的最新版本: 下載的檔案為 subversion-1.7.4.tar.gz
  • 自行安裝要下 ./configure 時,遇到 錯誤訊息:說是沒有安裝APR (Apache Portable Runtime (APR))雖然不知道這什麼,但總之是安裝過程不可缺的。於是去下載
    Unix Source: apr-1.4.6.tar.gz和
    Unix Source: apr-util-1.4.1.tar.gz 回來 分別解開來,安裝 (./configure , make , make install)
    遇到要輸入 --with-apr 時,就加上參數 --with-apr=/usr/local/apr 遇到要輸入 --with-apr-util 時,就加上參數 --with-apr-util=/usr/local/par/bin
  • 又遇到錯誤訊息,說必需要有 sqllite ,下載sqlite-autoconf-3071100.tar.gz 版本,一樣 安裝(./configure, make , sudo make install)
  • error: subversion requires zlib →
    下載 zlib-1.2.6.tar.gz
    tar -xvzf zlib-1.2.5.tar.gz
    cd zlib-1.2.5
    (make, sudo make install)
  • 依上述方法安裝後,重新下 subversion 的指令:
    ./configure --prefix=/usr/local/zlib
    ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr/bin --with-zlib=/usr/local/zlib
    出現,警告訊息: configure: WARNING: we have configured without BDB filesystem support
    ......
    You don't seem to have Berkeley DB version 4.0.14 or newer
    ......
    再去 下載 Download Berkeley DB 5.3.15 for Linux : db-5.3.15.tar.gz
    安裝後 subversion 的 ./configure 終於過了
  • 最後就是手動安裝subversion

2012年4月24日 星期二

ubuntu 亮度 調整 Acer 8481

最近手邊有一台 Acer 8481 裝好 ubuntu 10.10 後一開機覺得亮度太亮, 系統調整亮度的功能似呼都沒有作用,於是google 一下,發現這篇:Ubuntu 10.10 brightness problem in Acer Aspire 4741 照它所提供的做法:
  1. sudo vi /etc/default/grub (自己習慣用vi)
  2. 把 GRUB_CMDLINE_LINUX="" 改成 GRUB_CMDLINE_LINUX="acpi_osi=Linux"
  3. sudo update-grub
  4. 重開機
重開機後,我用 Fn + ← → 就可以調整亮度了

2012年4月16日 星期一

X蝦米 on Ubuntu 10.10 ibus 123

下載現成做好的檔:Boshiamy for iBus
我自己是選 ibus-table-boshiamy_1.3.0.20101012-1_all.deb

不知道為什麼,double click ubuntu 軟體中心回應我錯誤不能裝,只好自己打開.deb
將 /tables/boshiamy.db 複製到 /usr/share/ibus-table/tables/
將/icons/boshiamy.png 複製到/usr/share/ibus-table/icons/
restat 輸入法。 搞定!



參考文章:

2012年3月21日 星期三

entity converter Value is not a valid 問題

問題描述:

在一個查詢頁,有 select 、button ,
select 項目用 做 view 和 controller 的值轉換。
範例如下:



但是在網頁很久沒有動作後,再去改變下拉選單的內容,會出現 Value is not a valid 錯誤訊息。

參考網路上說明後,推測是因為 過很久再去點選畫面時,view 經由entity converter 傳成的物件和 emtityManager 重新 query 的list 在比較時,發現沒有符合。所以認為選擇的值是 Value is not a valid 。

解決方法:overwrite equals 方法。 真是夠簡單的。

The scenario

JSF runs the converter and loads the entity from the persistence context; JSF runs any validators, and adds it's own - that the selected object must be in the original list; the validation fails as a new object has been loaded from the persistence context.

The solution

You've got two options:

Ensure that you are in a long-running conversation that spans the both the select list creation and the submission of the form.
Use key equality rather than object equality (make equals return true if both objects have the same natural or business key). It's important to note that basing equality on surrogate key identity isn't recommended. You can read more here
Which approach should you take? The second solution is the simplest to understand but sometimes it is hard (or not possible) to define a natural key so you'll need to use the first solution.
參考來源