20090324
半部九阴真经
而且还是上卷。
The Productive Programmer, Part I 笔记。
====================
Context switching eats time.
用于作为证据,说明 multiple clipboard 的重要性。
----
历史
[guyang@digi02 ~]$ history
1 17:37 ls
2 17:37 pwd
3 17:37 history
4 17:37 history
5 17:37 pwd
6 17:37 ls
7 17:37 ls -l
8 17:37 ls -l
9 17:38 history
10 17:38 history | grep ls
11 17:38 ls
12 17:38 history
[guyang@digi02 ~]$ !1
ls
100 a bin cat2.JPG Download input.txt map to sea.png Pictures text.aux text.tex 中华utf8
100.c aa blackduck.txt cat2 smile.JPG dwhelper learning mean sandbox text.dvi tour.png
30 aa.txt bookmark danmark.org eng.txt lib mean.c svn text.log tt.org
30.c a.txt canals Desktop fetion Mail News tc.txt text.pdf youngworkshop
[guyang@digi02 ~]$ !2
pwd
/export/home/aton4/guyang
[guyang@digi02 ~]$!h | grep p
history | grep p
2 17:37 pwd
5 17:37 pwd
10 17:38 history | grep ls
15 17:39 pwd
16 17:39 history | grep p
[guyang@digi02 ~]$ !2
pwd
/export/home/aton4/guyang
[guyang@digi02 ~]$
----
pushd & popd
----
快挺键的学习,需要在适用此键的上下文环境中。
One of my colleagues has a great way of teaching keyboard
shortcuts. Whenever you pairprogram with him, if you use a mouse to
select a menu or tool button, he makes you undo your operation, then
do it three times using the keyboard. Yes, it slows you down at first,
but the reinforcement (plus his evil eye when you forget them) is a
pressure cooker to learn shortcuts.
-----
grep显示文件名和行号
find . -name "*.java" -exec grep -n -H "new .*Db.*" {} \;
{} Placeholder for the filename found by find.
\; Terminate the command after -exec. Because this is a Unix command,
you might want to pipe the results of this into another command, and
the find command has to know when the "exec" is done.
[guyang@digi02 ~]$ grep -nH "main" *c
100.c:3:int main()
30.c:3:int main(int argc, char *argv[])
mean.c:3:int main(int argc, char *argv[])
-------------------
explorer /e,/root,c:\work\cit
-------------------
web开发自动化测试
You can also interact with pages that require an HTML POST instead of GET using the "-d"
command-line option:
curl -d "birthyear=1905&press=%20OK%20" www.hotmail.com/when/junk.cgi
Subvert Selenium to Walk Web Pages
Selenium‡ is an open source user acceptance testing tool for web applications. It allows you to
simulate user actions by automating the browser via JavaScript. Selenium is written entirely
in browser technology, so it runs in all mainstream browsers. It is an incredibly useful tool for
testing web applications, regardless of the technology used to create the web application.w
-------------------
uniq
#!/bin/bash
for X in $(egrep -o "[A-Z]\w*Exception" log_week.txt | sort | uniq) ;
do
echo -n -e "processing $X\t"
grep -c "$X" log_week.txt
done
----------------------
Monad
Windows Power Shell
----------------------
svn st | grep '^\?' | tr '^\?' ' ' |
sed 's/[ ]*//' | sed 's/[ ]/\\ /g' | xargs svn add
svn st
Get Subversion status on all files in this directory and all
its subdirectories. The new ones come back with a ? at the beginning
and a tab before the filename.
grep '^\?'
Find all the lines that start with the ?.
tr '^\?' ' '
Replace the ? with a space (the tr command translates one
character for another).
sed 's/[ ]*//'
Using sed, the stream-based editor, substitute spaces
to nothing for the leading part of the line.
sed 's/[ ]/\\ /g'
The filenames may have embedded spaces, so use sed
again to substitute any remaining spaces with the escaped space
character (a space with a \ in front).
xargs svn add
Take the resulting lines and pump them into the svn add
command.
--------------------------
自动化的理由之一
Does this task destroy my focus? (Almost any task takes you away from
your locus of attention, making it harder to get back to your focused
state.)
-----------------------------
Don't Shave Yaksv
译为"别给牦牛剪毛"
Yak shaving is dangerous because it eats up a lot of time. It also
explains why estimating tasks is so often wrong: just how long does it
take to fully shave a yak? Always keep in mind what you are trying to
achieve, and pull the plug if it starts to spiral out of control.
-----------------------
canonicality
简而言之,所有开发人员的机器配置都一样。
同步或使用hard link。
开发工具允许不同(避免代码对工具的依赖),但是库及framework的版本必须一致。
----------------------
No matter what you are copying and pasting, resuse by copy and paste
is evil.
而indirection是推荐行为。
------------------
vmware虚拟机镜像,避免授权问题。
-------------------
不应直接修改从ORM中得到的class code,应该先继承,然后在子类中添加或修改方法...这也是间接。
Of course, this is just a DAO (data access object) with no behavior:
it is merely a collection of get/set methods. If you need to add
behavior to this entity, you can subclass the DAO to add
methods. Never hand-edit a generated file because it will be
regenerated the next time you perform a build. NOTE Add behavior to
generated code via extension, open classes, or partial classes.
杨注:这样,在DSM生成的C代码中,也应该预留回调函数,而不应该允许直接修改生成的代码。
-----------------------
Always keep "living" documentation.
过时的文档 比没有文档更糟糕。
提到自研发工具svn2wiki
------------------
...continuous integration
-------------------
告诫是一遍又一遍啊。
Repetition is the single most diminishing force in software development.
Duplication is evil. Evil, I say!
DRY = Don't Repeat Yourself.
------------------
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment