直接套用 ajax response 裡的部份物件

最近遇到一個狀況, 當我一個頁面寫好後, 可以用 page=1, 2,…,n 換頁

但是其中只有部份資料是會更動的(也就是說, 基本 layout 是不動的)

這時通常我們會選擇, 將這個部份抽出, 然後原始 layout 頁面全部都用 ajax 呼叫

但是今天終於被我找到方法了 orz

也就是利用 find() 這個 method 去取出 ajax response 裡的需要資料直接套用

但是這樣還不夠, 因為 ajax 的 success response 並不是物件, 所以必須

1
2
3
4
5
6
$.ajax({
'url': '/somepage/'+pageNum,
'success': function(response) {
$('#target').html(jQuery(response).find('#target).html());
}
});

Android Phone: Can’t establish a reliable data connection to the server

I’m using a ROOTed HTC HERO w/ Android 2.1 (VillainRom 10.3). About 2 weeks ago I can’t sync anything from my Google account.

While trying any solution from website, for example: wipe, reflash and etc, the problem still cannot be solved. Till I found this page I known what happened.

can't establish a reliable data connection to the server错误的解决办法

And finally I exam the file: /etc/hosts.conf, there exists2 3 more addition lines containing statical IP mapping. After removing them, I works…But all my phone data must be repaired lol…

解決 Oracle imp/exp 後資料庫欄位註解變亂碼的問題

System: linux, UTF8
Oracle NLS info: NLS_CHARACTERSET=AL32UTF8, NLS_LANGUAGE=AMERICAN

當我們要 exp(ort) 資料到其他資料庫, 然後imp(ort) 時會遇到很奇怪的狀況

表內的資料都是正常的中文, 但欄位的敘述是亂碼(一堆’?’)

找了一堆資料後的結論是, 該資料庫(表)的語系為 ”TRADITIONAL CHINESE_TAIWAN”.AL32UTF8

1
select userenv('language') from dual;

但是系統預設的是 “AMERICAN”.AL32UTF8

所以變成必須在 import 以及 export 時都先設定資料庫應該要使用的語系

1
export NLS_LANG="TRADITIONAL CHINESE_TAIWAN".AL32UTF8

這樣就可以啦

修正 bind 出現 max open file (1024) 的錯誤

While I upgrading my gentoo box, the BIND had been recomplied. After I re-steup my configurations there exists an error on the log.

max open files (1024) is smaller than max sockets (4096)

This is a bug introduced from kernel and I found a solution from Bombcar Heavy Blog.

1
2
# cd /etc/security/limits.d
# vim named.conf

And fillout the settings:

named        soft    nofile        4096

Then modify the named.conf settings:

# vim /etc/bind/named.conf

In the Options section, filling it:

files 4096;

Finally, restart the named and the error disappear. 😀

升級 gentoo 的 perl 到 5.12.2 後 openwebmail 不能使用的問題

After upgrading my gentoo box’s perl to 5.12.2, the openwebmail dead. The basic result is in the 5.12 version there is no suidperl program.

To solve this, after reading related materiel, the step listing:

1
2
3
# cd {http root}/cgi-bin/openwebmail
# perl misc/tools/wrapsuid/wrapsuid.pl {http root}/cgi-bin/openwebmail
# grep "suidperl" ./.*.* | awk -F ':#' '{print $1}' | xargs sed -i 's/suidperl/perl/'

The step 2 will first change all the .pl files into hidden file and then make a wrapper written in C language. And the step 3 is for changing all the suidperl corresponding interpreter line to perl.

But after this I encounter another problem that there shown I must setuid to root in webpage while using it. The solution is to change owner to root again because the wrapper program broken it.

# chmod 4555 *.pl

And it works! All the material is from Openwebmail.