2011年12月29日 星期四

數學符號

對於一個自學資料結構和演算法的人來說(不才在下)似乎最頭痛的就是多年沒碰的一些數學符號比如說"級數" 啊,,還有 "對數",,,等的這些,,,太久沒碰,都忘了這些是什麼意思了.

2011年12月14日 星期三

演算法

想學一下演算法,所以去買了一本約300頁的中文入門書了^ ^,還買了一本用Python實作的演算法英文書,本書作者跟Beginning Python的作者是同一位.

2011年11月29日 星期二

`gets' function is dangerous







最近在讀蔡明志老師的C語言入門書,讀到字串那一段程式的實作發生一些情況,我是使用gcc為編譯器,使用`gets' function會出現`gets' function is dangerous,,,.的訊息,但是程式還是可以執行,後來改用fgets就ok了參考了 Hsian兄的blog

2011年11月23日 星期三

使用python寫cgi網頁

作業系統 ubuntu 11.10
網頁伺服器 Apache HTTP Server
如何使用python 在 ubuntu linux上跑cgi 網頁呢?以下是我參考Sheng Bao兄 的實做
首先進入 /etc/apache2/sites-available/default
進入後下指令打開default這檔案#sudo vi default


打開default後找到這一段 



    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
   
 把它修改成如下圖反白處 

記住:當你修改時,我假設你的apache http server 是還未啟動的狀態

修改完後:wq 接下來cd進入/usr/lib/cgi-bin

進入之後並sudo vi hello.py<----開始編寫python cgi 網頁
這是一個python cgi 網頁的例子



hello.py完成後一定要再下sudo chmod 775 hello.py, 這樣hello.py才能執行



 hello.py 完成後啟動 apache http server

接下來點擊 firefox 並在網址處打上localhost/cgi-bin/hello.py
localhost/cgi-bin/hello.py 這網址的/cgi-bin/就是當我們設定 default 時的cgi網頁預設路徑,裡面有存放hello.py

2011年11月16日 星期三

老歌



老歌讓人回味無窮,回味往事有時讓人感傷的,,哈哈,人還是要活在當下,展望未來 : )

2011年10月22日 星期六

kindle

amazon 買的 kindle 4 等了一個星期終於寄來了

開箱


充電


終於可以在kindle上讀我買的pdf電子書了,之前都是直接在電腦上讀,amazon是用ups寄貨的,kindle到之前ups會傳真一些報關文件給買家,然後買家要回傳一些ups要的文件,這樣買家才能收到kindle,如果有疑問可以打電話給ups的0800客服問清楚.
剛開機充電的時候還發生一些問題,usb線插了kindle燈號也亮黃燈了但kindle整個沒反應,最後壓住kindle的電源鈕20秒,讓它reset重啟才能動,,目前一切正常,開心的用著e-ink電子書閱讀了

2011年9月27日 星期二

install Mysql server in ubuntu 11.04

~$ sudo apt-get install mysql-server
/* during the installing it will ask you mysql server's password,,just type the password you want */
~$ sudo mysql -u root -p
/*enter the password */

mysql>



2011年9月22日 星期四

Beginning Python page.486 練習用python + scoket 做ㄧ個小型聊天室 ubuntu11.04

首先寫一段shell script 把防火牆從5005 port打開




從一台用opensuse的電腦telnet 過去
                                                                

2011年8月8日 星期一

beginning python p318, install twisted and test it by telnet in ubuntu 11.04

                         
                                     coding
                                     test use telnet!

in book beginning python page 318, there is an example for the twisted python programming. However, I do not know how to use telnet to test it,, here is what I discover,,.

2011年7月25日 星期一

check the python document file in Linux (opensuse 11.3)

        
                
                                    in the help(re),you can use /compile to search the "compile",and then enter q to quit

2011年7月21日 星期四

import re module and use it

                                               in the book beginning python(apress 2008) page 246, you should import re first and just can use it.

shell script expr

2011年7月7日 星期四

python 在ubuntu 和opensuse import的路徑例子 python in ubuntu and opensuse import path example


ubuntu 11.04



                                            
                                                              opensuse 11.3