- Install Python 2.7.3 : http://www.python.org/download/releases/2.7.3/
Insall path : D:\Dev\Python2.7 - Install Google App Engine for Python : https://developers.google.com/appengine/downloads?hl=zh-tw#Google_App_Engine_SDK_for_Python
Installed version :GoogleAppEngine-1.7.2.msi
Install path : D:\Dev\Google\google_appengine\
Note : In the first page of setup starting, there is a notice that remind to use python 2.5, never mind, we just use python 2.7, and it is supported. - Install eclipse : http://www.eclipse.org/download/
Installed version : eclipse-java-juno-SR1-win32-x86_64.zip (here 64 bit version is used)
Install path : D:\Dev\eclipse - Install eclipse python development plugin: PyDev:
eclipse update site : http://pydev.org/updates- menu:Help=> Install New Software ...
- dialog:label[Work with]:text:"http://pydev.org/updates"=> button:[add]
- dialog:lable[Name]:text:"PyDev":label[Location]:text:"http://pydev.org/updates" => button[ok]
- checkbox:PyDev:button[Next]=>[Next]=> radio:accept => finish => adialog:checkbox[Aptana...]:button[Accept] => Restart eclipse
- Setup
- Setup Python Interpreter
menu:Windows:Perferences => dialog:tree:PyDev:Editor:Intepreter - Python => [Auto Config] =>select:python2.7 => [ok] - Setup workspace encodeing for Chinese compatible
menu:Windows:Perferences => dialog:tree:Workspace => label[Text for encoding]:radio[Others]:list[UTF-8]
2012年10月6日 星期六
GAE - Python Development Environment Setup
2012年9月27日 星期四
[Python]Extract the difference files from two directory comparison
import filecmp
import os, sys
# bash : find . -type f // to recursively file all of file only in directory
def diffExtract(basedir, diffdir):
# Determine the items that exist in both directories
d1_contents=set([])
d2_contents=set([])
for root, subFolders, files in os.walk(basedir):
for file in files:
subdir=root.replace(basedir, '') # just keep the common subdir path
d1_contents.add(os.path.join(subdir,file))
# print 'Dir1Files:', d1_contents
for root2, subFolders2, files2 in os.walk(diffdir):
for file in files2:
subdir2=root2.replace(diffdir, '')
d2_contents.add(os.path.join(subdir2,file))
# print 'Dir2files:', d2_contents
common = list(d1_contents & d2_contents) # get the common file by join the Set
'''
common_files = [ f
for f in common
if os.path.isfile(os.path.join("~/build/QCT2050", f))
]
for f in common :
ff=os.path.join("~/build/QCT2050", f)
print "JoinPath:", ff
if os.path.isfile(ff) :
common_files.append(ff)
print 'Common files:', common_files
'''
print "removing the common file from ", diffdir
delcount=0
for f in common :
ff1=basedir + f
ff2=diffdir + f
if (os.path.isfile(ff1) and os.path.isfile(ff2) and filecmp.cmp(ff1, ff2, shallow=False)) or os.path.islink(ff2) : #(os.path.isfile(ff)) :
#common_files.append(ff)
sys.stdout.write(".")
sys.stdout.flush()
os.remove(ff2)
delcount += 1
print '\n%d common files are deleted from directory, %s.' % (delcount, diffdir)
return
# Compare the directories
#match, mismatch, errors = filecmp.cmpfiles(basedir,
# diffdir,
# common)
#print 'Match:', match
#print 'Mismatch:', mismatch
#print 'Errors:', errors
# ===========================================
def listFileRecursive(dir):
# Determine the items that exist in both directories
for root, subFolders, files in os.walk(basedir):
for file in files:
print (os.path.join(root,file))
def mkfile(filename, body=None):
with open(filename, 'w') as f:
f.write(body or filename)
return
def make_example_dir(top):
if not os.path.exists(top):
os.mkdir(top)
curdir = os.getcwd()
os.chdir(top)
os.mkdir('dir1')
os.mkdir('dir2')
mkfile('dir1/file_only_in_dir1.txt')
mkfile('dir2/file_only_in_dir2.txt')
os.mkdir('dir1/dir_only_in_dir1')
os.mkdir('dir2/dir_only_in_dir2')
os.mkdir('dir1/common_dir')
os.mkdir('dir2/common_dir')
mkfile('dir1/common_file', 'this file is the same.txt')
mkfile('dir2/common_file', 'this file is the same.txt')
mkfile('dir1/not_the_same.txt')
mkfile('dir2/not_the_same.txt')
mkfile('dir1/file_in_dir1', 'This is a file in dir1.txt')
os.mkdir('dir2/file_in_dir1')
os.chdir(curdir)
return
if __name__ == '__main__':
#os.chdir(os.path.dirname(__file__) or os.getcwd())
#make_example_dir('example')
#make_example_dir('example/dir1/common_dir')
#make_example_dir('example/dir2/common_dir')
print ''
print 'Usage : %s basedir diffdir' % (sys.argv[0])
basedir=sys.argv[1] # The common part directory
diffdir=sys.argv[2] # The different part directory
print 'This program is to compare the content of base directory, and variant directory, then delete all of common and same content file from variant directory.'
print 'Warning : This program will really make change on the variant directory, %s.' % (diffdir)
print 'Please make sure that is what you want.'
raw_input("Press Enter to continue ...");
diffExtract(basedir, diffdir)
2012年8月6日 星期一
RTC Concept
Concept
Repozitory : The repository includes auditable item types, which maintain a history of item creation and subsequent modifications for audit purposes. The audit trail includes a record of past states of the item, the user who saved the item, and the time of the change. For item types that do not require audit history, the repository retains only the latest state of the item.
Project Area : The project area is a system representation of a software project. The project area defines the project deliverables, team structure, process, and schedule. A project area is stored as a top-level or root item in a repository. A project area references project artifacts and stores the relationships between these artifacts.
Repozitory : The repository includes auditable item types, which maintain a history of item creation and subsequent modifications for audit purposes. The audit trail includes a record of past states of the item, the user who saved the item, and the time of the change. For item types that do not require audit history, the repository retains only the latest state of the item.
Project Area : The project area is a system representation of a software project. The project area defines the project deliverables, team structure, process, and schedule. A project area is stored as a top-level or root item in a repository. A project area references project artifacts and stores the relationships between these artifacts.
2012年4月30日 星期一
Python - a study note
Reference : http://www.rexx.com/~dkuhlman/python_book_01.html
- Naming
- Allowed characters in a name: a-z A-Z 0-9 underscore, and must begin with a letter or underscore.
- Names and identifiers are case sensitive.
- Identifiers can be of unlimited length.Special names, customizing, etc. -- Usually begin and end in double underscores.
- Special name classes -- Single and double underscores.
- Leading double underscores -- Name mangling for method names.
- Leading single underscore -- Suggests a "private" method name in a class. Not imported by "from module import *".
- Trailing single underscore -- Sometimes used to avoid a conflict with a keyword, for example, class_.
- Naming conventions -- Not rigid, but here is one set of recommendations:
- Modules and packages -- all lower case.
- Globals and constants -- Upper case.
- Class names -- Bumpy caps with initial upper.
- Method and function names -- All lower case with words separated by underscores.
- Local variables -- Lower case (possibly with underscore between words) or bumpy caps with initial lower or your choice.
- No declaration or data type definition is needed/used.
- Block
- Python represents block structure and nested block structure with indentation, not with begin and end brackets
- The statements which go together must have the same indentation. Each such set of statements is called a block.
- The empty block -- Use the pass no-op statement.
- DocStrings : A doc string is a quoted string at the beginning of a module, function, class, or method.We can use triple-quoting to create doc strings that span multiple lines.
- Doc strings can be viewed with several tools, e.g. help(),obj.__doc__, and, in IPython, a question mark (?) after a name will produce help.
- Statement
- while running:
guess = int(raw_input('Enter an integer : '))
if guess == number:
print 'Congratulations, you guessed it.'
running = False # this causes the while loop to stop
elif guess < number:
print 'No, it is a little higher than that.'
continue
else:
print 'No, it is a little lower than that.'
break
else:
print 'The while loop is over.'
# Do anything else you want to do here
print 'Done' - for i in range(1, 5):
print i
else:
print 'The for loop is over'
Python Development with Eclipse
- extract Eclipse : eclipse-java-indigo-win32_32bit.zip
- Install PyDev plugin for Eclipse
- Help/Install New Software
- Add Repository : PyDev - http://pydev.org/updates
- select [PyDev] => [Next]/[Next]/Accept license/[Finish] => select trust certificate/[OK]
- Restart Eclipse
- Configuration PyDev
- Window/Preferences
- Select PyDev/Interpreter - Python => press [Auto Config] (ps. precondition : python installed) => [OK]
- Install UML modeling for phthon Feature (Using TextUML Toolkit + Acceleo)
- Install TextUML Toolkit
- Help/Install New Software
- Add Repository : TextUML Toolkit - http://abstratt.com/update/
- select All => [Next]/[Next]/Accept license/[Finish]
- Install Acceleo code generator – http://acceleo.org/update/
- Help/Install New Software
- Add Repository : Acceleo code generator – http://acceleo.org/update/
- select Acceleo => [Next]/[Next]/Accept license/[Finish]
- Install Acceleo code generation modules
- Help/Install New Software
- Add Repository : Acceleo code generation modules - http://acceleo.org/modules/update
- select Acceleo Modules Experimental/Ecore to Python code generator => [Next]/[Next]/Accept license/[Finish]
- Use PyDev to develop python
- Window/Open Perspective/Other => select PyDev/[OK]
- File/New/PyDev Project
- Project name : scm_build, Grammer version : 2.6 => [Finish]
- Create Python UML
- New/Other => Acceleo/Module Luncher [Next] Encore to Python => [Next]
- Encore Model : /scm_build/module/scm_build.ecore
Output folder : /scm_build/out
Error Log file : /scm_build/error.log
[Solved]Can't connect BoxNet Dav network drive in Windows XP
1. Start up WebClient service in Windows Service
2. connect net drive by file://www.box.net/dav
2. connect net drive by file://www.box.net/dav
2012年3月8日 星期四
Replace framework.jar on Android Emulator
1. Start up Emulator
$ cd {ANDROID SDK}/tools
$ ./emulator -avd {AVD_NAME}
2. Use adb shell to set rw access right on /system
$ ./adb shell
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# cd /system/bin
# cat sh > su
# chmod 4755 su
# exit
3. upload framework.jar to target directory
$ ./adb push
{MYDONUT_OUT_PATH}/target/product/generic/system/framework/framework.jar /system/framework
4. restart Emulator
$ ./adb shell
# stop
# start
訂閱:
文章 (Atom)