今天在寫apollo的ad 部份 有一個部份是在實做百面骰的部份 用百面骰的概念來實做百分比的呈現 例如我有5個值 a 的 比例是20, b 的 比例是30, c 的 比例是50, d 的 比例是80, f 的 比例是160 然後依比例來讓他們呈現應有的次數 最直接想的是 直接塞個20+30+50+80+160 的array 不過覺得這樣做實在是挺白痴的 覺得應該有更好的方法 經過”貓哥”的小小提示”區間” 我想到的是 $rand = rand(1,$ad_total); 用for 來做 if (0
posted in program by johnpupu
要裝taglist 之前會用到 ctags 所以乖乖的先去裝上吧 # cd /usr/ports/devel/ctags/ # make install clean 然後就可以去抓taglist了 然後去你vim的資料夾底下解壓就可以 像我的是vim7 # cd /usr/local/share/vim/vim7/ # unzip taglist_XXX.zip 基本上這樣就裝好了 然後你可以參考一下我的.vimrc的配置如下 ” FOR Tlist let Tlist_Ctags_Cmd = “/usr/local/bin/exctags” ” FOR BSD let Tlist_Auto_Open=1 ” 開啟vim/gvim 的時自動打開 Tlist let Tlist_Auto_Update=1 ” 自動更新目前的 tag 列表 let Tlist_Enable_Fold_Column=1 let Tlist_Sort_Type = “name” ” 顯示的 tag 排序方式:name/order let [...]
會有這個須求主要是因為,我在把mysql 3 dump 出來時,要input 進新的mysql 5 時 發現在些中都會變成這樣 許\多商品已經銷售一空\r\n 在不少中文字中會多了\ 這個,可是又有\r\n這樣的符號 所以就把所有大蓋可能會出現的字元(除了中文) 給找出來然後加上^就等於相反了。所以這個意思就是說 我只想要找出中文字元而已 %s/\([^0-9A-Za-z=%"'#$^&*()]\)\\\([^0-9A-Za-z=%"'#$^&*()]\)/\1\2/g 感覺寫的很爛!!!不過至少寫出來了~~哈
posted in program by johnpupu
the day before yesterday , i found a new nekobe's AJAX shoutbox and Pierre's AJAx shoutbox . so i use my leisure to combined the "mixed version" to defend the spam. I use the "Pierre's way" to do the first shield and the "nekobe's way" to do the last shield. The "Pierre's way" can let [...]
posted in program by johnpupu