ipv6 in sinica

是說資訊室竟然沒有開放 ipv6 的設定(還是說也許有但是我不知道)

只能跑去使用計中的 6-to-4 broker 來做轉換的動作…

計中只提供 windows 設定方式, 不過因為 linux 的也很簡單, 所以分享一下

0.a register for Gateway 6 interface; then will receive an mail later for account actived

0.b install gogoc (or tspc in previous version)

# apt-get install gogoc

1. setting up gogoc.conf

# vim /etc/gogoc/gogoc.conf

1.a put the userid and passwd in line 30 and 31 (not absolutely)

1.b change the connect server as server=tb2.ipv6.ascc.net in line 52

1.c change authentication method as auth_method=digest-md5 by the suggestion of ascc in line 72

AND THE MOST IMPORTANT THING TO DO IS:

TO CHANGE THE TUNNEL MODE BECAUSE FIREWALL IN IIS WILL NOT ALLOW THE DEFAULT SETTING

2. change tunnel setting by tunnel_mode=v6udpv4 in line 165

3. finally, start the service, and the ipv6 is passed and the result via ping6 is listing:

moneycat@Galaxy:~$ ping6 ipv6.google.com
PING ipv6.google.com(2404:6800:8003::67) 56 data bytes
64 bytes from 2404:6800:8003::67: icmp_seq=1 ttl=58 time=2.84 ms

Enjoy it 😀

很多很多

好久沒寫日記了, 其實大多時間都是在噗浪上碎碎念就是…

不過最近電視上頻繁的播著某個酒品的廣告, 有一句廣告台詞我很喜歡, 雖然我已經忘記他實際上說的是什麼, 但大意是:

很多時候, 如果我們都只挑自己一定會做的事情去做, 就不會知道原來自己也能辦得到某件事情

是說想想也對, 真的這一路走來有太多太多的嘗試, 如果當初不去做, 就不會知道.

Continue reading “很多很多”

named ‘managed-keys.bind’ error

After upgrade to bind 9.3.0, I’ve got an error message while starting service:

managed-keys-zone ./IN: loading from master file managed-keys.bind failed: file not found.

Althouth it will not affect DNS server’s functionality, but it is annoying. The solution is to create an empty missing file in its WORKING directory. In my gentoo box, the named working directory is on /var/bind, so the step is:

# cd /var/bind
# touch managed-keys.bind
# /etc/init.d/named restart

And that’s all, the error has gone. 🙂

php warning after updraded to 5.3

After upgrading to PHP 5.3, my Cacti got lots of warnings like:

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function….

Thanks to Google, I found the best way to solve it is in the php.ini configure file. And the solution is to add a DEFAULT TIMEZONE for it. THat is, to modify the DATE section of cgi-/cli-php. My configure is:

date.timezone = Asia/Taipei

And that’s all 😀

不固定長度的 2D array 用 recursion 跑出所有組合

同事工作上遇到一個問題, 就是當不固定的 2d array 或是

不固定長度的數個 list 然後頭互串, 形成像是

A1->A2->A3, B1->B2 且 A1->B1 時

若要用 recursive 把所有的組合印出, 要怎麼處理?

最終我們要的答案是:

A1 B1, A2 B1, A3 B1, A1 B2, A2 B2, A3 B2

所以我的想法是很直觀的利用 recursive 做, 內容就是 先右再下 直到跑完所有情況

Continue reading “不固定長度的 2D array 用 recursion 跑出所有組合”

render of rails

通常我們用 render, 大多數是直接顯示字串, 但是他會把整個頁面蓋掉

render :text => ‘sth for show’

有時我們要用的是顯示模版並套用設計

render :template => ‘path to template’, :layout => ‘path to layout’

但是這次遇到一個情況, 如果我想傳參數進去的時候該怎麼辦, 找了一下發現可以直接傳參數

render :locals => { :sth => ‘content’, ‘sth2’ => ‘content2’ }

在 view 的部份可以直接調用

<%=sth%>

這樣就可以了

bug of app-admin/eselect-php

After upgrading(or installing, I forgot) the eselect-php-0.6.1, my lighttpd is broken.
Thanks chage, Airken and Keeper for help, the reason is the package will not select php module automatically.
Although the post-install information shows how to do that but it seems not very important that I ignore it.
If someone got the error of php, check the eselect setting.

1
eselect php show {cgi, cli, fpm, apache2}

If there is no default setting in them just do it.

1
eselect php set {cgi, cli, fpm, apache2} 1