2009-06-01

vim + Ruby on rails

最近在 FreeBSD 上裝了 Ruby on Rails 因此把 Vim 裝起來 , 嗯 ~ 有了 Vim 之後看 Code 果然清楚多了 ~

1. 安裝 vim6+ruby , 不裝 X Windows 所以下 -DWITHOUT_X11。

#cd /usr/ports/editors/vim/
#make -DWITHOUT_X11 install clean

2. Copy Vim 設定檔 .vimrc 到使用者家目錄並且加入中文環境及自己所需要的設定。

#cp /usr/local/share/vim/vim64/vimrc_example.vim ~/.vimrc
#vi ~/.vimrc

set fileencoding=taiwan
set guifontset=8x16,kc15f,-*-16-*-big5-0
set cindent
set enc=taiwan
set fileencoding=taiwan
set hls
set nocompatible
set sw=2
set background=dark
set nomodeline
syntax on
highlight Comment ctermfg=darkcyan "更改Comment顏色
highlight Search term=reverse ctermbg=4 ctermfg=7

3. 原本的 vi 還是存在 , 若要使用 Vim 只要使用 vim 開啟檔便可。

放置rails.vim於/home/user/.vim/plugin/下

2009-05-01

Freebsd 7.0 初期環境建制

http://plog.longwin.com.tw/my_note-unix/2007/07/16/freebsd_initial_env_build_2007

cp /usr/share/examples/etc/make.conf /etc/
cp /usr/share/examples/cvsup/stable-supfile /etc/
cp /usr/share/examples/cvsup/ports-supfile /etc/
modify stable-supfile to use cvsup6.tw.freebsd.org
csup /etc/stable-supfile

ports用portsnap較快

對於Release版的security patch可以用freebsd-update來做更新
http://ohaha.ks.edu.tw/post/1/32
The freebsd-update(8) utility supports binary upgrades of i386 and amd64 systems running earlier FreeBSD releases. Systems running 7.0-RELEASE, 7.1-BETA, 7.1-BETA2, 7.1-RC1, or 7.1-RC2 can upgrade as follows:
# freebsd-update upgrade -r 7.1-RELEASE
During this process, FreeBSD Update may ask the user to help by merging some configuration files or by confirming that the automatically performed merging was done correctly.
# freebsd-update install
The system must be rebooted with the newly installed kernel before continuing.
# shutdown -r now
After rebooting, freebsd-update needs to be run again to install the new userland components, and the system needs to be rebooted again:
# freebsd-update install
# shutdown -r now
自動安裝官方已經compile好的binary

2009-04-30

cisco nat note

基本上在Cisco Router上的NAT有三種,但透過這三種NAT,又可以變化出LoadBalance等數種技巧 基本的三種NAT方式:

Static NAT:靜態NAT轉址,直接指定每個內部Private IP其對外Public IP,固定為1對1的方式。但這種方法,依然需要大量的外部真實IP供給內部IP連線使用,沒有達到節省IP的目的,已少人使用。
Dynamic NAT:動態NAT轉址,訂定一到數個NAT Pool,指定可用來做為NAT轉址所用的Public IP之集合,供給內部Private IP動態轉址使用。每一次Private IP的連線,Router會輪流分派一個Public IP對外連線使用。

PAT(Port Address Translation):埠號地址轉換,是NAT的另一種加強型的技術,它可以允許許多個內部Private IP轉換到單一的Public IP。
也可以用interface ip overload。
Private IP的可用位址:RFC1918設定了三塊區域的私人IP位址,一般都是以這三個區塊當作NAT轉址的內部IP。這些IP並不會在Internet的路由間繞送。
Addr Range IP & mask
10.0.0.0 - 10.255.255.255 10.0.0.0/255.0.0.0 1個Class A
172.16.0.0 - 172.31.255.255 172.16.0.0/255.240.0.0 12個Class B
192.168.0.0 - 192.168.255.255 192.168.0.0/255.255.255.0 16個Class C

設定範例:
1.Static NAT,一個簡單的範例,將內部192.168.1.100 /24 的IP轉址成外部200.1.1.1 /24
Router1#conf t
Router1(config)#int S 0/0/0
Router1(config-if)#ip address 200.1.1.1 255.255.255.0
Router1(config-if)#ip nat outside
Router1(config-if)#no shutdown
Router1(config-if)#exit
Router1(config)#int fa 0/1
Router1(config-if)#ip address 192.168.1.254 255.255.255.0
Router1(config-if)#ip nat inside
Router1(config-if)#no shutdown
Router1(config-if)#exit
Router1(config)#ip nat inside source static 192.168.1.100 200.1.1.1

2.Dynamic NAT,定義一個連線集合(200.1.1.1~200.1.1.10)/24給內部192.168.1.1/24連線使用
Router1#conf t
Router1(config)#int S 0/0/0
Router1(config-if)#ip address 200.1.1.1 255.255.255.0
Router1(config-if)#ip nat outside
Router1(config-if)#no shutdown
Router1(config-if)#exit
Router1(config)#int fa 0/1
Router1(config-if)#ip address 192.168.1.254 255.255.255.0
Router1(config-if)#ip nat inside
Router1(config-if)#no shutdown
Router1(config-if)#exit
Router1(config)#ip nat pool nat1 200.1.1.1 200.1.1.10 netmask 255.255.255.0
Router1(config)#access-list 1 permit 10.1.1.0 0.0.0.255
Router1(config)#ip nat inside source list 1 pool nat1
Router1(config)#exit

3.PAT(Overload),只定義一個IP提供NAT連線(200.1.1.1)/24給內部192.168.1.1/24連線使用
Router1#conf t
Router1(config)#int S 0/0/0
Router1(config-if)#ip address 200.1.1.1 255.255.255.0
Router1(config-if)#ip nat outside
Router1(config-if)#no shutdown
Router1(config-if)#exit
Router1(config)#int fa 0/1
Router1(config-if)#ip address 192.168.1.254 255.255.255.0
Router1(config-if)#ip nat inside
Router1(config-if)#no shutdown
Router1(config-if)#exit
Router1(config)#ip nat pool nat1 200.1.1.1 200.1.1.1 netmask 255.255.255.0
Router1(config)#access-list 1 permit 10.1.1.0 0.0.0.255
Router1(config)#ip nat inside source list 1 pool nat1 overload
Router1(config)#exit

2009-04-29

XP桌面圖示如何才能變成透明底色?

右擊桌面空白處,依次單擊“屬性/桌面/自定義桌面/web”選項,將“網頁”欄中的“當前主頁”以及“http//......”等所有各項前面的勾全部去掉(“http//……”為從Internet添加網頁或圖片的位址,一般不需要,可將它們全部刪除),並將下面“鎖定桌面專案”前面的勾也去掉,單擊確定完成設置,就又能看到可愛的桌面圖示了。

2008-11-21

excel無法直接點選開啟

q:
有誰知道這樣的問題呢?EXCEL的檔案無法直接點選開啟,必須要先進入EXCEL以後
再用開啟舊檔的方式開啟,這樣恩的好麻煩,有什麼方式可以解決呢?我用的是OFFUICE97
SR-2的版本,WORD的檔案開啟舊沒有問題,就是EXCEL這樣,重新安裝OFFICE後情況似乎依舊,有沒有人知道如何解決這個問題呢?先謝謝啦。

ans:
您所寫的錯誤訊息是當時所顯示的全文內容嗎?
因為如果如您之前所說,在*.xls上快按二下無法開啟,
但利用excel中的開啟舊檔就可以的話,
您可以試試下面的方法
1.按〔工具〕→〔選項〕
2.在〔選項〕對話框中,選〔一般〕頁
3.在〔設定〕中的〔略過其他應用程式〕取消打勾,按〔確定〕
4.關閉Excel,後再至*.xls檔案按二下,應該就可以正常開啟了!
供您參考!



感謝回覆,沒有把問題說清楚,開啟excel檔案可以執行excel本身的程式,但卻會出現開啟的檔案或是路徑不存在﹝其實這個檔案或是路徑確實存在﹞,使用的元件已經損壞.....
就這樣檔案都無法開啟,這些檔案確定都是正常的,拿到別台電腦也可以正常開啟,真的是很奇怪。

excel 2007也有類似的問題
請點選excel選項\進階
向下找到「一般」

disable(clear) 忽略其他使用動態資料交換(DEE)的程式。

試過修復安裝,無效。



2008-10-13

Install Adobe Acrobat Reader 8.1.2 on Ubuntu 8.04

sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
sudo apt-get install acroread

2008-08-26

Ubuntu Linux enable telnet service

Install telnetd server
$ sudo apt-get install telnetd
Restart inetd service
$ sudo /etc/init.d/openbsd-inetd restart

You should now be able to telnet to the server from Windows or Linux desktop system to Ubuntu Linux telnet server.

2008-08-19

dnspark nameserver ip list

ns1.dnspark.net. 3600 IN A 64.34.197.141
ns2.dnspark.net. 3600 IN A 83.170.90.100
ns3.dnspark.net. 3600 IN A 66.98.161.195
ns4.dnspark.net. 3600 IN A 209.160.66.110
ns5.dnspark.net. 3600 IN A 69.59.153.140

2008-08-15

裝置管理員並未顯示未連接到 Windows XP 電腦的裝置

裝置管理員並未顯示未連接到 Windows XP 電腦的裝置

檢視此文章適用的產品。
文章編號 : 315539
上次校閱 : 2005年11月2日
版次 : 1.1
徵狀
當 您按一下 [檢視] 功能表中的 [顯示隱藏裝置] 時,「裝置管理員」只會顯示非隨插即用的裝置、驅動程式和印表機。即使按一下 [顯示隱藏裝置],您已安裝但未連線至電腦的裝置 (如通用序列匯流排 [USB] 裝置或「隱藏連線」裝置) 也不會顯示在「裝置管理員」中。
回此頁最上方

其他可行方案
如果要解決這個問題,並在您按一下 [顯示隱藏裝置] 時顯示相關裝置: 1. 按一下 [開始],依序指向 [程式集] 及 [附屬應用程式],再按一下 [命令提示字元]。
2. 在命令提示字元中輸入下列命令,然後按下 ENTER:
set devmgr_show_nonpresent_devices=1
3. 在命令提示字元中輸入下列命令,然後按下 ENTER (其中 %SystemRoot% 為 Windows XP 安裝所在的資料夾):
cd\%SystemRoot%\system32
4. 在命令提示字元中輸入下列命令,然後按下 ENTER:
start devmgmt.msc
5. 疑難排解「裝置管理員」中的裝置和驅動程式。

注意:您必須先在「裝置管理員」中,按一下 [檢視] 功能表上的 [顯示隱藏裝置],才能夠查看未連接至電腦的裝置。
6. 完成疑難排解後,關閉「裝置管理員」。
7. 在命令提示字元中輸入 exit。

請注意,關閉命令提示字元視窗時,Window 會清除您在步驟 2 中所設定的 devmgr_show_nonpresent_devices=1 變數,避免隱藏連線的裝置在您按一下 [顯示隱藏裝置] 時顯現。
如果您是開發人員或進階使用者,而且想要檢視未連接至您電腦的裝置,可全域設置下列環境變數: 1. 用滑鼠右鍵按一下 [我的電腦]。
2. 按一下 [內容]。
3. 按一下 [進階] 索引標籤。
4. 按一下 [環境變數] 索引標籤。
5. 在 [系統變數] 方塊中設定該變數。
注意:這個方法僅適用於疑難排解或程式開發目的,或是用以防止使用者意外解除安裝了未連接至電腦的必要裝置 (如未連接筆記型電腦的 USB 裝置或銜接站)。
回此頁最上方

狀況說明
這是原本設計的作法。

2008-08-13

freebsd dante socks proxy server

用freebsd ports安裝完之後修改sockd.conf


sockd.conf

logoutput: /var/log/sockd/sockd 可用來查看連線的紀錄
internal: eth0 port = 1080
external: eth1 method: none username pam
clientmethod: none
user.libwrap: libwrap 自己vipw加入 user libwrap
#user.privileged: sockd
user.notprivileged: sockd 自己vipw加入user sockd
connecttimeout: 30

# Allow everyone from my LAN
client pass {
from: 192.168.0.0/24 port 1-65535 to: 0.0.0.0/0
log: connect disconnect
}

# Block everyone else
client block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}

# Block everyone connection to lo
block {
from: 0.0.0.0/0 to: 127.0.0.0/8
log: connect error
}

# Block subnet 172.16.0.0/32
block {
from: 0.0.0.0/0 to: 172.16.0.0/12
log: connect error
}

# Allow replys to bind and incoming udp
pass {
from: 0.0.0.0/0 to: 192.168.0.0/24 command: bindreply udpreply
log: connect error
}

# Allow tcp and upd connections from our lan to everywhere
pass {
from: 192.168.0.0/24 to: 0.0.0.0/0 protocol: tcp udp
log: error
}

# Log all the rest
block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}

用flashfxp 可成功 ftp出去。log有socks的連線紀錄,可幫助debug

2008-06-20

ubuntu 8.04 安裝紀錄,freebsd dhcp problem

ubuntu的dhclient是個嚴格的dhcp client,freebsd 7.0架設的dhcp server必須修改hosts
加入
255.255.255.255 dhcp
再輸入下列命令。
route -hosts 255.255.255.255 -interface eth0

ubuntu才能正確得到ip。

安裝好之後做了更新,相當簡單方便。
sudo pppoeconf設定pppoe帳號,密碼。
pon dsl-provider撥接
ifconfig檢查interface ppp0 ip

sudo apt-get update
也可以使用圖形化的介面管理工具。

ubuntu 預設的輸入法是 SCIM,但我習慣使用 gcin。

因為 SCIM 用不到了,所以我就移除了。

sudo apt-get remove –purge scim

安裝gcin

sudo apt-get install gcin

設定 gcin 為預設的輸入法。

sudo im-switch -s gcin



安裝pcmanx,大致上就沒什麼問題了。

2023 灌籃高手 SLAM Dunk

 2023 哩哩摳摳 昨天是難得的颱風假。 去看了二輪的灌籃高手。 電影院一堆的小朋友阿。 以下有小暴雷。 雖然我不算是非常的迷灌籃高手,但是還是很喜歡這部作品。 井上老師的畫風我也非常喜歡。 整部片是以良田的角度來看的。 以前我並不是很熟習良田這個角色,但是看到良田能重新站起來...