2010年2月19日 星期五

Facebook Application Development Reference

之前寫了一些Facebook Application, 包括了Facebook Connect等技術都有用到, 但是Facebook的API改版頗快, 所以之前閱讀的書籍可能也有些過時了, 以下列出供有緣人參考...
因此有志於開發此類應用程式的人一定要訂閱它的RSS以追蹤最新的訊息,

有時間再把開發心得與技術補上吧...

PHPGMailer

之前需要寫個GMail的寄信程式, 發現已經有人寫好PHPGMailer的class了, 就備份一下吧,

對了, Google Docs現在可以上傳任何格式的檔案了, 真是方便阿 : )

2010年1月21日 星期四

Cross-Domain Communication

由於XMLHttpRequest-based的通訊模式有著安全性的限制, 使得不同網域之間無法進行資訊的傳輸, 當然在實做上還是有很多迂迴的解決方式, 比如說facebook connect利用Iframe建立一傳輸的通道, 再透過此通道將資料往上傳, 有關以iframe來溝通也可參考這篇, 而Yahoo!則利用JSONP做為Web Service的資料交換,

舉例來說, 當foo.com想與bar.com進行資料交換時, 我們可以在foo的主機上加入bar上的script以取得bar的資料,
<html>
<head>
<title>Cross-Domain Communication with JSON</title>
</head>
</body>
<script type="text/javascript">
function call_bar(obj) {
 alert(obj.name);
}
</script>
<script type="text/javascript" 
src="http://bar.com/?callback=call_bar"></script>
<body></body>
</html>    
  
而在bar上的script中則提供JSON格式的資料內容, 其中call_bar為callback function的名稱, 此callback將會在foo讀取到script的內容時回呼, 並且無法控制執行順序,
call_bar({"name":"bar"})
  
透過以上例子, 將能進行跨網域的資料交換, 參考資料:

2009年12月15日 星期二

Antivir False Positive Alarm

昨天(2009/12/14)發現小紅傘的誤判, 回報之後回信說明了是誤判, 但病毒碼似乎還沒對此結果做更新...

誤判情形是這樣的, 只要將<a href="http://www.paypal.com.tw/">這樣的字串寫入文字檔, 就會被判斷為HTML/Spoofing.Gen, 搜尋了一下, 之前也有別人遇到類似的問題阿 (煙)

update一下: 今天(2009/12/23)發現病毒碼更新了

2009年11月5日 星期四

[Adroid] MAERD

Eng.Mode
*#*#4636#*#*

Reset
[Home]+[Power]
[ALT]+[L]
[Home]+[Backup] - reboot system now
[ALT]+[L] - toggle log text display
[ALT]+[S] - apply sdcard:update.zip
[ALT]+[W] - wipe data/factory reset

2009年10月21日 星期三

[Tips] 如何在virtual host對php做不同的設定

以顯示/不顯示php錯誤訊息為例
[root@localhost ~]# vi .htaccess 
php_flag error_reporting = E_ALL
php_flag display_errors = Off 

出處: php_flag in .htaccess

[Tips] scp & ssh-agent

如何在local機器與remote機器進行自動化scp?

1.製作public keys & private keys
[root@local ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): <- 不用輸入
Enter same passphrase again: <- 不用輸入
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
7e:16:f4:57:87:5c:60:be:91:70:82:ac:cc:a9:95:74 root@localhost.localdomain

2. 從local機器複製/root/.ssh/id_dsa.pub到remote機器
[root@local ~]# scp /root/.ssh/id_dsa.pub root@remote:/root/.ssh/id_dsa.pub
root@remote 's password:
id_dsa.pub 100% |*****************************| 718 00:00 

3.將id_dsa.pub加到authorized_keys
[root@remote ~]# cat /root/.ssh/id_dsa.pub >> /root/.ssh/authorized_keys 

4.再以ssh連線到遠端機器, 未來將不用再輸入密碼啦
[root@local ~]# ssh root@remote

出處: 請問如何用scp或rsync每天自動備份到不同的日期目錄中?