Danny's profile季节的水滴PhotosBlogListsMore Tools Help
20/10/2009

如果可以分身就好了

感觉有看不完的书,有做不完的事情。
唉,如果可以分身就好了!
It seem there have endless books and documents should to read, and endless work should to do.
Oh dear, what shall I do? 
 
5/10/2009

为什么在Oracle里删除了表数据,但空间却得不到释放

Q: 为什么我在Oracle下Delete Table,但是表空间却得不到释放?
A: 学习一下Delete和Truncate的区别:
    1. 当使用Delete语句删除表的所有数据时,不会释放表所占用的空间;使用"Truncate Table"语句不仅会删除表的所有数据,而且还会释放表段所占用的空间;
    2. Delete属于DML(Data Manipulation Language)操作,支持事务;Truncate属于DDL(Data Definition Language)操作,不支持事务;
    3. Delete语句的操作可以回退,但Truncate Table语句的操作不能回退。
23/09/2009

站在领导的角度思考问题

一定要站在领导的角度来思考问题,要理解领导的意图啊。
 
南宋初年,岳飞几次向宋高宗请战,收复失地。为什么屡次遭拒,甚至被贬职?
不理解领导意图呗,当时宋钦宗还没有死,还被金国作为俘虏软禁着。如果岳飞收复失地,救回宋钦宗,那么宋高宗怎么办?

抱住单元测试不放(转载)

一般来说,SaaS 的领跑者往往是许多人构建的大型应用程序。大型应用程序的单元测试中,数据总是一致的:在后期执行单元测试的项目总是惨败。与此相反,成功的 SaaS 开发人员在编写代码之前运行单元测试。例如,如果我要编写一个名为ServiceController 的类,我不会直接开始编写该类。相反,我编写根据类中的方法运行所有单元测试用例的类。接下来我甚至会进一步运行测试用例,尽管我知道它们将失败,因为我没有为该类编写任务代码。

这样做的目的在于,排除单元测试中出现 bug 的可能性,保证总是能通过单元测试。一般来说,很容易无意中犯这个错误。如果所有单元测试都失败,我就可以开始编写实际代码了。当我完成新类的编写时,我将再次运行单元测试。只要通过所有的测试用例,我就将向单元测试自动库添加新的单元测试类,在每次构建时运行。换句话说,我为应用程序创建的整个单元测试库都成为构建流程的一部分。实际上,在我每次开始构建项目之前,都将运行所有的单元测试,以确保应用程序代码的完整性没遭到无意破坏。

在编程的世界中,我发现只有几个开发人员严格遵守该过程。但是,他们都是行业内最受尊敬的、最具声望、身价最高的开发人员。如果您想知道提高身价的捷径,请坚持单元测试。

18/09/2009

Change

这是奥巴马在竞选总统时用的最多的一个词。
 
每个人的风格都是不同的。
而且同样的做事风格,在一些人眼里可能很完美,在另一些人眼里却可能很Stupid。
要不你改变他,要不改变你自己去适应。前者很难,后者却很容易。
 
有时责任心强不一定会比责任心差一点的好,因为言多必失,活干多了总难免会出差错。
拿多少工资,干多少活。该我干的自然干好,不该我干的该找谁找谁去。
 
面试的时候装作什么都懂,干活时装作什么都不太懂。
这样面试时成功几率大,干活时压力和工作量却不会太大。
 
为人要保持低调。
最后引用Jobs一句话: "Stay hangry, stay foolish"。
27/08/2009

Managing Your Manager 如何对待上司

From: Code Complete (By: Steve McConnell)
 
In software development, nontechnical managers are common, as are managers who have technical experience but who are 10 years behind the times.
Technically competent, technically current managers are rare. If you work for one, do whatever you can to keep your job. It’s an unusual treat.

If your manager is more typical, you’re faced with the unenviable task of managing your manager. “Managing your manager” means that you need to tell your manager what to do rather than the other way around. The trick is to do it in a way that allows your manager to continue believing that you are the one being managed. Here are some approaches to dealing with your manager:
 ● Plant 895 ideas for what you want to do, and then wait for your manager to have a brainstorm (your idea) about doing what you want to do.
 ● Educate your manager about the right way to do things. This is an ongoing job because managers are often promoted, transferred, or fired.
 ● Focus on your manager’s interests, doing what he or she really wants you to do, and don’t distract your manager with unnecessary implementation details. (Think of it as "encapsulation” of your job.)
 ● Refuse to do what your manager tells you, and insist on doing your job the right way.
 ● Find another job.
 
The best long-term solution is to try to educate your manager. That’s not always an easy task, but one way you can prepare for it is by reading Dale Carnegie’s How to Win Friends and Influence People.
 

在软件开发过程中,非技术人员往往是管理者。最为例外的情况是管理者有工作经验,但是已是十年未再干过了。会技术的管理者是少见的。如果你为某一人工作,应尽力保住你的饭碗。这不是一件容易的事情。作为一个阶层,每一位雇员都想升到他并不能胜任的层次。

如果你的上司并不是一个特别的人,你将不得不学会如何面对你的上司。“控制你的上司”意味着你应告诉你的上司怎样去做,而不是用其他方法。其要决在于用这样一种方法使你的上司相信你仍是受他管理的一员。以下是一些对付你上司的方法:
  • 拒绝按照你上司的吩咐去做,坚持按正确方法继续你的工作。
  • 假装按照你上司的吩咐去做,暗地里按照正确的方法去做。
  • 先对自己如何做有一个全盘计划,等着上司对你的见解做评论并让人如何去做。
  • 告诉你上司正确的方法,这是一个中途应变方法,因为你的上司经常提升、调动或被解雇。
  • 寻找另一份工作。
最好的解决方法是努力说服你的上司。这并不是一件容易的事情,但是你可阅读《How to Win Friends and Influence People》(《怎样赢得朋友和影响他人》)一书以学会如何准备这件事。
19/08/2009

Java Puzzlers & Effective Java

这是偶最近在看的两本书,均出自Google的Joshua Bloch之手。正好一本晚上回家看,一本在公司闲的时候看。
 
看这两本书的时候不住的冒出一个BT的想法:下次谁来面试Java developer的时候,就可以直接把这两本书上面的问题拿出来做面试题。
 
External Links:
17/08/2009

jstack 堆栈跟踪

jstack命令行工具连接到指定的进程或核心文件,并打印所有连接到虚拟机的线程的堆栈跟踪信息,包括Java 线程和VM 内部线程,有时也包括本地堆栈框架。该工具还执行死锁检测。
 
用法:jstack [option] pid
参数(Options):
-F Force a stack dump when 'jstack [-l] pid' does not respond.
-l Long listing. Prints additional information about locks.
-m prints mixed mode (both Java and native C/C++ frames) stack trace.
-h prints a help message.
-help prints a help message

 

Reference: http://java.sun.com/javase/6/docs/technotes/tools/share/jstack.html

21/07/2009

Ubuntu登录后即重启

    本来想玩一下Ubuntu炫目的桌面的,结果安装了emerald以后输入用户名和密码就立即自动重启(只能怪自己不自量力,集成显卡还玩这个)。
     只好Ctrl + Alt + F2进入命令行界面,apt-get remove emerald删除emerald。
15/07/2009

体质明显下降了

      症状之一就是会经常流汗,虽说夏天流汗是很正常的事情,但是对于我来说今年夏天流汗突然一下子增多很多(去年大夏天在外面踢球也没出过这么多汗呀)。
      想了一下原因无非:体重的增加、长期坐在电脑前和缺乏运动,这才造成了体质的不断下降;再加上总觉得自己年轻什么都无所谓和经常加班,结果自然也就愈演愈烈。
      本着“身体就是本钱,健康创造价值”的理念,遂决定:1.做事情要有规划,提高效率;2.适当增加运动量;3.保持合理的饮食习惯;4.生活要有规律;5.注意睡眠和休息......没有提到的将继续补充。
3/07/2009

火灾

30/06/2009

Linux/Unix Command: crontab

The crontab command, found in Unix and Linux operating systems, is used to schedule commands to be executed periodically. To see what crontabs are currently running on your system, you can open a terminal and run:
    sudo crontab -l
To edit the list of cronjobs you can run:
    sudo crontab -e
This will open the default editor (could be vi or pico, if you want you can change the default editor) to let us manipulate the crontab. If you save and exit the editor, all your cronjobs are saved into crontab. Cronjobs are written in the following format:
    * * * * * /bin/execute/this/script.sh
 
Scheduling explained:
As you can see there are 5 stars. The stars represent different date parts in the following order:
1. minute (from 0 to 59)
2. hour (from 0 to 23)
3. day of month (from 1 to 31)
4. month (from 1 to 12)
5. day of week (from 0 to 6) (0=Sunday)
 
Example:
1. Logon Linux use comment account (eg: danny)
2. Create an autorun.sh file
 (1) [danny@www ~]$ cd /home/danny
 (2) [danny@www danny]$ vi autorun.sh 
 (3) [danny@www danny]$ chmod 755 autorun.sh
3. Edit the corrent Crontab
[danny@www danny]$ crontab –e
    0 23 * * * /home/danny/autorun.sh

Efficiency of the Filzip3.04

Yesterday, I wanted extract a file which include 50,000 sub-files (but each sub-file is just 4kb), it spend me 7~8 hours.
 
Oh, my god, I wasted the whole day just unzip a file. What I did is download and install 7-Zip instead immediately.
 
Maybe I should send a email to Mr. Philipp Engel(philipp.engel(at)filzip.com) and tell him about this, before he release the new version, pls do the performance test first.
26/06/2009

Ubuntu下安装Eclipse

1、首先下载eclipse-SDK:http://www.eclipse.org/downloads/

2、安装eclipse
(1)把eclipse-SDK解压到某个目录中,如解压到/opt下,得到/opt/eclipse目录
(2)在/usr/bin目录下创建一个启动脚本eclipse,执行下面的命令来创建:sudo vi /usr/bin/eclipse
然后在该文件中添加以下内容:
#!/bin/sh
export MOZILLA_FIVE_HOME=”/usr/lib/mozilla/”
export ECLIPSE_HOME=”/opt/eclipse”
$ECLIPSE_HOME/eclipse $*
(3)让修改该脚本的权限,让它变成可执行,执行下面的命令:
sudo chmod +x /usr/bin/eclipse
 
3、在桌面或者gnome菜单中添加eclipse启动图标
(1)在桌面或者启动面板上添加图标:
在桌面(右键单击桌面->创建启动器)上创建一个新的启动器,然后添加下列数据:
名称:Eclipse
命令:eclipse
图标: /opt/eclipse/icon.xpm
(2)在Applications(应用程序)菜单上添加一个图标
用文本编辑器在/usr/share/applications目录里新建一个名为eclipse.desktop的启动器,如下面的命令:sudo vi /usr/share/applications/eclipse.desktop 
然后在文件中添加下列内容:
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse Platform
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;Development;
保存文件。完成整个安装过程,可以双击桌面eclipse的图标来运行eclipse。
4/06/2009

Space国内竟然不能访问

Space空间本周竟然不能访问,难道是因为Bing上线?

3/06/2009

50 Specific Ways to Improve Your Testing

1.  Requirements Phase
Item 1: Involve Testers from the Beginning
Item 2: Verify the Requirements
Item 3: Design Test Procedures As Soon As Requirements Are Available
Item 4: Ensure That Requirement Changes Are Communicated
Item 5: Beware of Developing and Testing Based on an Existing System

2.  Test Planning

Item 6: Understand the Task At Hand and the Related Testing Goal
Item 7: Consider the Risks
Item 8: Base Testing Efforts on a Prioritized Feature Schedule
Item 9: Keep Software Issues in Mind
Item 10: Acquire Effective Test Data
Item 11: Plan the Test Environment
Item 12: Estimate Test Preparation and Execution Time

3.  The Testing Team

Item 13: Define Roles and Responsibilities
Item 14: Require a Mixture of Testing Skills, Subject-Matter Expertise, and Experience
Item 15: Evaluate the Tester's Effectiveness

4.  The System Architecture

Item 16: Understand the Architecture and Underlying Components
Item 17: Verify That the System Supports Testability
Item 18: Use Logging to Increase System Testability
Item 19: Verify That the System Supports Debug and Release Execution Modes

5.  Test Design and Documentation

Item 20: Divide and Conquer
Item 21: Mandate the Use of a Test-Procedure Template and Other Test-Design Standards
Item 22: Derive Effective Test Cases from Requirements
Item 23: Treat Test Procedures As "Living" Documents
Item 24: Utilize System Design and Prototypes
Item 25: Use Proven Testing Techniques when Designing Test-Case Scenarios
Item 26: Avoid Including Constraints and Detailed Data Elements within Test Procedures
Item 27: Apply Exploratory Testing

6.  Unit Testing

Item 28: Structure the Development Approach to Support Effective Unit Testing
Item 29: Develop Unit Tests in Parallel or Before the Implementation
Item 30: Make Unit-Test Execution Part of the Build Process

7.  Automated Testing Tools

Item 31: Know the Different Types of Testing-Support Tools
Item 32: Consider Building a Tool Instead of Buying One
Item 33: Know the Impact of Automated Tools on the Testing Effort
Item 34: Focus on the Needs of Your Organization
Item 35: Test the Tools on an Application Prototype

8.  Automated Testing: Selected Best Practices

Item 36: Do Not Rely Solely on Capture/Playback
Item 37: Develop a Test Harness When Necessary
Item 38: Use Proven Test-Script Development Techniques
Item 39: Automate Regression Tests When Feasible
Item 40: Implement Automated Builds and Smoke Tests

9.  Nonfunctional Testing

Item 41: Do Not Make Nonfunctional Testing an Afterthought
Item 42: Conduct Performance Testing with Production-Sized Databases
Item 43: Tailor Usability Tests to the Intended Audience
Item 44: Consider All Aspects of Security, for Specific Requirements and System-Wide
Item 45: Investigate the System's Implementation To Plan for Concurrency Tests
Item 46: Set Up an Efficient Environment for Compatibility Testing

10.  Managing Test Execution
Item 47: Clearly Define the Beginning and End of the Test-Execution Cycle
Item 48: Isolate the Test Environment from the Development Environment
Item 49: Implement a Defect-Tracking Life Cycle
Item 50: Track the Execution of the Testing Program
 

Effective Software Testing: 50 Specific Ways to Improve Your Testing

By Elfriede Dustin

Publisher: Addison Wesley

Pub Date: December 18, 2002

ISBN: 0-201-79429-2

1/06/2009

A good blog to learn Oracle

Focusing Specifically On Oracle Indexes, Database Administration and Some Great Music
Richard Foote's Oracle Blog (Thanks for Jussi Volanen sharing)
31/05/2009

eclipse的提示功能不见了怎么办

windows->preference->java->Editor->content Assist->Advance
27/05/2009

Python中and和or的特殊性质

Python 中,andor 执行布尔逻辑演算,如你所期待的一样。但是它们并不返回布尔值,而是返回它们实际进行比较的值之一。

1. and 介绍

>>> 'a' and 'b'         (1)
'b'
>>> '' and 'b'          (2)
''
>>> 'a' and 'b' and 'c' (3)
'c'
(1) 使用 and 时,在布尔环境中从左到右演算表达式的值。0''[](){}None 在布尔环境中为假;其它任何东西都为真。还好,几乎是所有东西。默认情况下,布尔环境中的类实例为真,但是你可以在类中定义特定的方法使得类实例的演算值为假。你如果布尔环境中的所有值都为真,那么 and 返回最后一个值。在这个例子中,and 演算 'a' 的值为真,然后是 'b' 的演算值为真,最终返回 'b'
(2) 如果布尔环境中的某个值为假,则 and 返回第一个假值。在这个例子中,'' 是第一个假值。
(3)

所有值都为真,所以 and 返回最后一个真值,'c'

2. or 介绍

>>> 'a' or 'b'          [1]
'a'
>>> '' or 'b'           [2]
'b'
>>> '' or [] or {}      [3]
{}
>>> def sidefx():
...     print "in sidefx()"
...     return 1
>>> 'a' or sidefx()     [4]
'a'
[1] 使用 or 时,在布尔环境中从左到右演算值,就像 and 一样。如果有一个值为真,or 立刻返回该值。本例中,'a' 是第一个真值。
[2] or 演算 '' 的值为假,然后演算 'b' 的值为真,于是返回 'b'
[3] 如果所有的值都为假,or 返回最后一个假值。or 演算 '' 的值为假,然后演算 [] 的值为假,依次演算 {} 的值为假,最终返回 {}
[4] 注意 or 在布尔环境中会一直进行表达式演算直到找到第一个真值,然后就会忽略剩余的比较值。如果某些值具有副作用,这种特性就非常重要了。在这里,函数 sidefx 永远都不会被调用,因为 or 演算 'a' 的值为真,所以紧接着就立刻返回 'a' 了。

如果你是一名 C 语言黑客,肯定很熟悉 bool ? a : b 表达式,如果 bool 为真,表达式演算值为 a,否则为 b。基于 Pythonandor 的工作方式,你可以完成相同的事情。

  • 使用 and-or 技巧

3. and-or 技巧介绍

>>> a = "first"
>>> b = "second"
>>> 1 and a or b {1}
'first'
>>> 0 and a or b {2}
'second'
{1}  这个语法看起来类似于 C 语言中的 bool ? a : b 表达式。整个表达式从左到右进行演算,所以先进行 and 表达式的演算。1 and 'first' 演算值为 'first',然后 'first' or 'second' 的演算值为 'first'
{2} 0 and 'first' 演算值为 False,然后 0 or 'second' 演算值为 'second'

然而,由于这种 Python 表达式单单只是进行布尔逻辑运算,并不是语言的特定构成,这是 and-or 技巧和 C 语言中的 bool ? a : b 语法非常重要的不同。如果 a 为假,表达式就不会按你期望的那样工作了。(你能知道我被这个问题折腾过吗?不止一次?)

4. and-or 技巧无效的场合

>>> a = ""
>>> b = "second"
>>> 1 and a or b         (1)
'second'
(1) 由于 a 是一个空字符串,在 Python 的布尔环境中空字符串被认为是假的,1 and '' 的演算值为 '',最后 '' or 'second' 的演算值为 'second'。噢!这个值并不是你想要的。

and-or 技巧,也就是 bool and a or b 表达式,当 a 在布尔环境中的值为假时,不会像 C 语言表达式 bool ? a : b 那样工作。

and-or 技巧后面真正的技巧是,确保 a 的值决不会为假。最常用的方式是使 a 成为 [a]b 成为 [b],然后使用返回值列表的第一个元素,应该是 ab中的某一个。

5. 安全使用 and-or 技巧

>>> a = ""
>>> b = "second"
>>> (1 and [a] or [b])[0] <1>
''
<1> 由于 [a] 是一个非空列表,所以它决不会为假。即使 a0 或者 '' 或者其它假值,列表 [a] 也为真,因为它有一个元素。

到现在为止,这个技巧可能看上去问题超过了它的价值。毕竟,使用 if 语句可以完成相同的事情,那为什么要经历这些麻烦事呢?哦,在很多情况下,你要在两个常量值中进行选择,由于你知道 a 的值总是为真,所以你可以使用这种较为简单的语法而且不用担心。对于使用更为复杂的安全形式,依然有很好的理由要求这样做。例如,在 Python 语言的某些情况下 if 语句是不允许使用的,比如在 lambda 函数中。

  • 进一步阅读

Python Cookbook 讨论了其它的 and-or 技巧

《Dive Into Python》 http://diveintopython.org (英文原版) 和 http://www.woodpecker.org.cn/diveintopython(中文版)

13/05/2009

Windows下如何得到一个站点的IP

C:\>ping mail.163.com
Pinging mcache.idns.yeah.net [123.125.50.22] with 32 bytes of datas:
 
C:\>nslookup mail.163.com
Server:  bogon.cn.bl.medicel.com
Address:  192.168.9.10
Non-authoritative answer:
Name:    mcache.idns.yeah.net
Address:  123.125.50.22
Aliases:  mail.163.com, mcache.mail.163.com
12/05/2009

The Scrum Development Process

 
Other useful website about Scrum:
 
There has a book you can download for free:Scrum and XP from the Trenches
You can get more information about the auther: Henrik Kniberg, and his blog is: http://blog.crisp.se/henrikkniberg
 
Amoy  
Photo 1 of 42

Danny Shi

Location
就用那几根火柴,开一场烟火晚会。点不亮黑夜影子,依然是我的流星。
by 
by 
by 
by 
by 
by 
by 
by 
by 
by