2012年5月23日 星期三

how to tag people(friends) in a facebook photo using flash(as3)

facebook 上傳照片時如何 tag 朋友?

可以用 tags 這個這個屬性,
tags:JSON.encode([ { "tag_uid":_friendId, "x":0, "y":0 } ])

說明如下,
tag_uid: friend id
tag_text: some text
x: 水平x座標,百分比[0-100]
y: 垂直y座標,百分比[0-100]

*注意* 最後記得要 JSON.encode 成字串

完整範例如下

2012年5月11日 星期五

how to enable gzip on dotcloud

put nginx.conf at the root of application.
cat nginx.conf
gzip on;
gzip_http_version 1.0;
gzip_types text/plain application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript font/truetype;
gzip_disable "MSIE [1-6]\.";

now restart nginx.
dotcloud run app.www sudo /etc/init.d/nginx restart

enjoy it.

2012年4月30日 星期一

2012年4月24日 星期二

sublime text 2 tips

sublime text 2
一定要用它超好用的 multi-selection 功能

ctrl+alt+up/down:開啟 select lines 功能
alt+shift+方向鍵 or shift+方向鍵:select words
ctrl+mouse click:開啟 multi-selection 功能

游標在要選取的文字上,ctrl+d 逐一選取文件中相同的文字
游標在要選取的文字上,alt+F3 選取文件中所有相同的文字

其它常用的功能
ctrl+shift+p:command mode
ctrl+p:切換 folder 裡的檔案
alt+Number:切換分頁
ctrl+r:@goto symbol/definition
ctrl+alt+a:alignment

sublime text 2 build swf

sublime text 2 build swf

ctrl+shift+p
install package for actionscript3

tools->build system->new build system
{
"cmd": ["d:\\Data\\Data\\My documents\\ProgramFiles\\flex_sdk_4.5.1\\bin\\mxmlc.exe", "${file}"],
"selector": "source.actionscript",
"encoding": "big5"
}
save as ActionScript.sublime-build
c:\Users\XXX\AppData\Roaming\Sublime Text 2\Packages\ActionScript 3\

不設 encoding 會噴
Decode error - output not utf-8

ctrl+b or F7
compile as3

2012年3月26日 星期一

dotcloud

試用 dotcloud + php

基本上就是照官方文件
cygwin 真是好用到爆炸,簡直不用再另外裝 linux 了,
直接在 windows 上用,我還另外裝了 vim/screen。