Wednesday, August 31, 2011

Debug GAE application with PTVS

PTVS(python tools for Visual Studio) is a python plugin for Visual studio (like PyDev for Eclipse)

GAE local debug starts from <> which located in GAE installation path. dev_appserver command line document is here:

After write GAE code in VS, we prefer trigger it from VS, that make VS as an integrated environment  as it should be.

1, configure debug command:

startup file should be <>


argument indicated port and project position



2, press F5, let it go…

you’ll meet a lot of exception, it seems some problems in module loader. Anyway, it’s not exception from our code.


3, add this exception in ignore list.

open menu <Debug> <Exceptions…>

add the exception name “google.appengine.dist.py_zipimport.ZipImportError” under Python Exceptions, and uncheck the “User-unhandled” checkbox.


4, OK, you can take off now!

Monday, August 29, 2011

Turn on telnet & ftp services on Ubuntu

VNC is really lag cross Win and Linux, I’m suffering in the whole weekend .Today I tried to use outdated, but efficient solution: telnet & ftp >.<

sudo apt-get install telnetd //install telnet service

sudo /etc/init.d/openbsd-inetd restart //restart telnet service

you can simply turn on windows feature “telnet client”, and use telnet in windows command line





sudo apt-get install vsftpd //install ftp service

in FTP server configure file : /etc/vsftpd.conf, uncomment “write_enable=YES”, make sure you can upload file

sudo restart vsftpd //restart ftp service


simply try with windows ftp command


>send c:\1.png

Friday, August 26, 2011

Connect Oracle in python

1, download cx_Oracle module


[windows] double click the .msi file


1,download .rpm file,

2, install alien tool in Ubuntu

3, install rpm by command “sudo alien -i cx_Oracle-5.1-10g-py27-1.i386.rpm ”

4, mv cx_Oracle related stuff (cx_Oracle-5.1-py2.7.egg-info & from site-packages/ to dist-packages/

5, add “export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib” in .bashrc

6, source .bashrc


2, install oracle client, express version is enough

[Windows]set system variable: “ORACLE_HOME” to the path of where express client installed, e.g. D:\XEClient, (this step help cx_Oracle locate some DLLs under Client/bin folder)

[Ubuntu] download and install oracle-xe-client_10.2.0.1-1.0_i386.deb


4, make sure you can import cx_Oracle in python correctly now.

python –c ‘import cx_Oracle’


5, start coding in python

conn = cx_Oracle.connect(‘username’, “password”, cx_Oracle.makedsn(‘’, 1521, ‘servicename’)) #connect to db

cur = conn.cursor()

cur.execute(“select * from xxxtable”);

rows = cur.fetchall()

for r in rows:

print r


Monday, August 8, 2011

Share files with Guest account in Win7

when sharing a folder to public, you should
1, turn on Guest account @ “User Accounts”
2, add Guest to sharing users @ sharing setting dialog
3, turn off password sharing.
after step 2, user login your share folder with guest, can not log in in fact. because Win 7 require a password log in by default, just like when using remote desktop, you can not log in with the guest account.
click “network and sharing center”, and turn off “password protected sharing”
4, now you can share files with guest account Smile with tongue out

Friday, August 5, 2011

Bind a domain name with GAE app

域名提供商Godaddy. 如果只是要提供一個forward,很簡單. 用戶輸入WWW.XXX.COM, 就會跳轉到appspot的域名上, 但是那個不是我需要的.

1, 登錄app engine, 進入application settings, 選擇add domain
不過直接電價Add domain... 是不行的, 需要先點右邊的sign up for google apps>>



4,進入godaddy的管理頁面, 開始編輯ZONE FILE
CNAME下的www為 (後面要用到, 因为我们会用www来跳转到绑定的GAE APP)

5,OK 回到在GAE的添加domain頁面, 點擊 add domain… 進入
我要实现用户敲入xxx.com时候,默认为, 文档上说默认就是这样(而另外一个文档上又说几月几日起已经不支持这种nick name的跳转了.
不过我试了下不加new URL, google会提示
“GOOGLE app The requested URL / was not found on this server”
然后千辛万苦的找资料. 最后发现,还是要加上www.XXX.Com作为web address.這個時候google會告訴你, 需要去配置CNAME,而剛才我們已經順手將CNAME編輯過了.