2008年3月2日 星期日

Virtualbox 作 Port Forwarding

  • An example of how to set up incoming NAT connections to a ssh server on the guest requires the following three commands:
    VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
    VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
    VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222

    The name guestssh is an arbitrary one chosen for this particular forwarding configuration. With that configuration in place, all TCP connections to port 2222 on the host will be forwarded to port 22 on the guest. Protocol can be either of TCP or UDP (these are case insensitive). To remove a mapping again, use the same commands, but leaving out the values (in this case TCP, 22 and 2222).

    • It is not possible to configure incoming NAT connections while the VM is running. However you can change the settings for a VM which is currently saved (or powered off at a snapshot).
  • 將 Host machine 的 8080 port 轉到 Guest machine 的 80 port:(假設 Guest machine 的名稱為 debian)
    # VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol" TCP
    # VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort" 80
    # VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort" 8080

    設定後,請重新開啟 VirtualBox 軟體。這樣別人就可以從 http://127.0.0.1:8080/ 來瀏覽 Debian 的網頁伺服器了。

讓 Firefox 不要使用 Alt-<key> 的選單快速鍵..

1. Open about:config
2. filter to ui.key.generalaccesskey
3. Change value to 18 (default -1)
4. Restart browser

2008年2月23日 星期六

設定 Programmer's Notepad 的 JAVA 開發環境...

在 [Tools]=>[Options] 裡面的 [Tools] 選項,在 Scheme 的地方選 Java,然後按右邊的 Add 按鈕,新增:

1. javac:
Command:
C:\Program Files\Java\jdk1.6.0_01\bin\javac.exe
Parameters:
-classpath %d %d%f
2. java:
Command:
C:\Program Files\Java\jdk1.6.0_01\bin\java.exe
Parameters:
-classpath %d %n
然後就可以從 [Tools] 選單裡面看到 javac 跟 java 兩個按鈕。而 Java 程式編譯與執行的結果,會秀在最下面的 Output 視窗。

2008年2月19日 星期二

[Vim] Cutting

  • 刪除游標所在這一行: <dd>
  • 刪除游標開始到行尾: <D> or <d$>
  • 刪除游標開始到行首: <d0>
  • 刪除游標開始到字尾: <dw>
  • 刪除游標開始到字首: <db>
  • 刪除游標開始的 5 行: <5dd>

2008年2月18日 星期一

[Vim] Copy & Paste

  • Copy 游標這一行:<Y> or <yy>
  • Copy 游標開始的兩行: <2Y> or <2yy>
  • 從游標這一行開始 Copy 到檔尾: <yG>
  • 從游標的位置開始 Copy 到字尾: <yw>
  • 從游標的位置開始 Copy 到行尾: <y$>
  • Paste 到游標的後面: <p>
  • Paste 到游標的前面: <P>

2008年2月14日 星期四

Windows PowerShell