2007年11月28日水曜日

writing in python

I'm trying to prototype a file archiver with python. Initially I started with bash and made a script that works for my limited type of tasks; taking a list of files, source directory, and destination directory and then copying to a temporary directory.
I simply call tar command to finish archiving.

Then I realized I wanted to add several features like being able to read a recipe for a particular archive from a file, to use substitutions and matching of key words in recipes, to handle remote files, ... Now it's getting hard for me to make the script simple, so I decided to rewrite it in python to make it easier for me and practiceusing python.

So far I needed to find basename, dirname, file testing, getting options, key inputs, ...

Key inputs are easy:
val = raw_input("type a value for val")

http://docs.python.org/lib/module-shutil.html

For getting options in commands, there are two choices afaik, and I gave it a try to optparse:
http://docs.python.org/lib/module-optparse.html

I liked the notations, so I am going to stick with it.

There are other features of python I need to learn, but that's all for today...

2007年11月19日月曜日

Code reviews to make your life easier...

When I was looking for some advise on code reviews, I encountered this article:
Effective Code Reviews Without the Pain

It was a fresh idea to me that reviewing process could be positive rather than negative. I think finding bugs is the primary reason to review codes, which makes me feel it's like a trial in a court. There should be bright sides indeed, as described in the article.

Nevertheless, finding bugs and getting rid of defects are important, and I needed to know how to improve the process. Another article on:
http://opensource.mit.edu/

seems like a good start...

2007年11月17日土曜日

I needed to write a script to avoid repeating similar commands yesterday.

http://www.ibm.com/developerworks/library/l-bash.html
http://tldp.org/LDP/abs/html/
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html