Matrix
Klarke's C/C++ Home
posts - 61,comments - 0,trackbacks - 0

---> pdfujitsu01 


/icd/secure_fujitsu/Fujitsu-PD/

/icd/secure_fujitsu/Fujitsu-PD/ryon/CM5M202/CCR921352

posted @ 2011-08-31 09:17 Klarke 阅读(2599) | 评论 (0)编辑 收藏
好的编程原则跟好的系统设计原则和技术实施原则有着密切的联系。下面的这些编程原则在过去的这些年里让我成为了一名优秀的程序员,我相信,这些原则对任何一个开发人员来说,都能让他的编程能力大幅度的提高,能让他开发出可维护性更强、缺陷更少的程序。

      我不要自我重复 — 这也许是在编程开发这最最基本的一个信条,就是要告诉你不要出现重复的代码。我们很多的编程结构之所以存在,就是为了帮助我们消除重复(例如,循环语句, 函数,类,等等)。一旦程序里开始有重复现象的出现(例如很长的表达式、一大堆的语句,但都是为了表达相同的概念),你就需要对代码进行一次新的提炼,抽象。

  http://en.wikipedia.org/wiki/Don%27t_repeat_yourself
      提炼原则 — 跟“不要自我重复原则”相关,这一原则是说“程序中任何一段具有功能性的代码在源代码文件中应该唯一的存在。”

  http://en.wikipedia.org/wiki/Abstraction_principle_(programming)

  保持简单 — 简单化(避免复杂)永远都应该是你的头等目标。简单的程序让你写起来容易,产生的bug更少,更容易维护修改。

  http://en.wikipedia.org/wiki/KISS_principle

  不要开发你目前用不到的功能 — 除非你真正需要用到它,否则不要轻易加上那些乱七八糟用不到的功能。

  http://en.wikipedia.org/wiki/YAGNI

  用最简单的方法让程序跑起来 — 在开发时有个非常好的问题你需要问问自己,“怎样才能最简单的让程序跑起来?”这能帮助我们在设计时让程序保持简单。

  http://c2.com/xp/DoTheSimplestThingThatCouldPossiblyWork.html

  不要让我动脑子 — 这实际上是Steve Krug 关于web界面操作的一本书的书名,但也适用于编程。主旨是,程序代码应该让人们花最小的努力就能读懂和理解。如果一段程序对于阅读者来说需要花费太多的努力才能理解,那它很可能需要进一步简化。

  http://www.sensible.com/dmmt.html

  开放/封闭原则 — 程序里的实体项(类,模块,函数等)应该对扩展行为开放,对修改行为关闭。换句话说,不要写允许别人修改的类,应该写能让人们扩展的类。

  http://en.wikipedia.org/wiki/Open_Closed_Principle

  为维护者写程序 — 任何值得你编写的程序在将来都是值得你去维护的,也许由你维护,也许由他人。在将来,当你不得不维护这些程序时,你对这些代码的记忆会基本上跟一个陌生人 一样,所以,你最好还是当成一直在给别人写程序。一个有助于你记住这个原则的办法是“写程序时时刻记着,这个将来要维护你写的程序的人是一个有严重暴力倾 向,并且知道你住在哪里的精神变态者”。

  http://c2.com/cgi/wiki?CodeForTheMaintainer

  最少意外原则 — 最少意外原则通常是使用在用户界面设计上,但这个原则同样适用于编写程序。程序代码应尽可能的不要让阅读者感到意外。也就是说应该遵循编码规范和常见习惯,按照公认的习惯方式进行组织和命名,不符常规的编程动作应该尽可能的避免。

  http://en.wikipedia.org/wiki/Principle_of_least_astonishment

  单一职责原则 — 一个代码组件(例如类或函数)应该只执行单一的预设的任务。

  http://en.wikipedia.org/wiki/Single_responsibility_principle

  最小化耦合关系 — 一个代码片段(代码块,函数,类等)应该最小化它对其它代码的依赖。这个目标通过尽可能少的使用共享变量来实现。“低耦合是一个计算机系统结构合理、设计优秀的标志,把它与高聚合特征联合起来,会对可读性和可维护性等重要目标的实现具有重要的意义。”

  http://en.wikipedia.org/wiki/Coupling_(computer_programming)

  最大化内聚性 — 具有相似功能的代码应该放在同一个代码组件里。

  http://en.wikipedia.org/wiki/Cohesion_(computer_science)

  隐藏实现细节 — 隐藏实现细节能最小化你在修改程序组件时产生的对那些使用这个组件的其它程序模块的影响。

  http://en.wikipedia.org/wiki/Information_Hiding

  笛米特法则(Law of Demeter) — 程序组件应该只跟它的直系亲属有关系(例如继承类,内包含的对象,通过参数入口传入的对象等。)

  http://en.wikipedia.org/wiki/Law_of_Demeter

  避免过早优化 — 只有当你的程序没有其它问题,只是比你预期的要慢时,你才能去考虑优化工作。只有当其它工作都做完后,你才能考虑优化问题,而且你只应该依据经验做法来优 化。“对于小幅度的性能改进都不该考虑,要优化就应该是97%的性能提升:过早优化是一切罪恶的根源”—Donald Knuth。

  http://en.wikipedia.org/wiki/Program_optimization

  代码复用 — 这不是非常核心的原则,但它跟其它原则一样非常有价值。代码复用能提高程序的可靠性,节省你的开发时间。

  http://en.wikipedia.org/wiki/Code_reuse

  职责分离 — 不同领域的功能应该由完全不同的代码模块来管理,尽量减少这样的模块之间的重叠。http://en.wikipedia.org/wiki/Separation_of_concerns

  拥抱变化 — 这是Kent Beck的一本书的副标题,它也是极限编程和敏捷开发方法的基本信条之一。很多的其它原则都基于此观念:面对变化,欢迎变化。事实上,一些经典的软件工程 原则,例如最小化耦合,就是为了让程序更容易面对变化。不论你是否采用了极限编程方法,这个原则对你的程序开发都有重要意义。http://www.amazon.com/gp/product/0321278658

posted @ 2011-08-18 14:01 Klarke 阅读(133) | 评论 (0)编辑 收藏
restoreDesign . tri_des_rx_1
saveTestcase -dir case

PS:
restore_setting.tcl
posted @ 2011-08-12 14:02 Klarke 阅读(142) | 评论 (0)编辑 收藏
cvs: error while loading shared libraries: libcrypto.so.4: cannot open shared object file: No such file or directory
posted @ 2011-08-08 16:06 Klarke 阅读(97) | 评论 (0)编辑 收藏
Os:
uname -a
cat /etc/issue

Cpu:
cat /proc/cpuinfo
head /proc/meminfo
posted @ 2011-08-05 16:02 Klarke 阅读(87) | 评论 (0)编辑 收藏

Here are a few examples. Also see the documentation for the `-d' option in the previous section.

  • To print the date of the day before yesterday:
    date --date='2 days ago'
    
  • To print the date of the day three months and one day hence:
    date --date='3 months 1 day'
    
  • To print the day of year of Christmas in the current year:
    date --date='25 Dec' +%j
    
  • To print the current full month name and the day of the month:
    date '+%B %d'
    
    But this may not be what you want because for the first nine days of the month, the `%d' expands to a zero-padded two-digit field, for example `date -d 1may '+%B %d'' will print `May 01'.
  • To print a date without the leading zero for one-digit days of the month, you can use the (GNU extension) - modifier to suppress the padding altogether.
    date -d=1may '+%B %-d'
    
  • To print the current date and time in the format required by many non-GNU versions of date when setting the system clock:
    date +%m%d%H%M%Y.%S
    
  • To set the system clock forward by two minutes:
    date --set='+2 minutes'
    
  • To print the date in the format specified by RFC-822, use `date --rfc'. I just did and saw this:
    Mon, 25 Mar 1996 23:34:17 -0600
    
  • To convert a date string to the number of seconds since the epoch (which is 1970-01-01 00:00:00 UTC), use the `--date' option with the `%s' format. That can be useful in sorting and/or graphing and/or comparing data by date. The following command outputs the number of the seconds since the epoch for the time one second later than the epoch, but in time zone five hours later (Cambridge, Massachusetts), thus a total of five hours and one second after the epoch:
    date --date='1970-01-01 00:00:01 UTC +5 hours' +%s
    18001
    
    Suppose you had not specified time zone information in the example above. Then, date would have used your computer's idea of the time zone when interpreting the string. Here's what you would get if you were in Greenwich, England:
    # local time zone used
    date --date='1970-01-01 00:00:01' +%s
    1
    
  • If you're sorting or graphing dated data, your raw date values may be represented as seconds since the epoch. But few people can look at the date `946684800' and casually note "Oh, that's the first second of the year 2000."
    date --date='2000-01-01 UTC' +%s
    946684800
    
    To convert such an unwieldy number of seconds back to a more readable form, use a command like this:
    date -d '1970-01-01 946684800 sec' +"%Y-%m-%d %T %z"
    2000-01-01 00:00:00 +0000
    
posted @ 2011-08-05 15:59 Klarke 阅读(839) | 评论 (0)编辑 收藏
 在实际编写程序时,经常会弄不清楚各个基本数据类型的数据表示范围和占用的字节数。现在将C/C++的基本数据类型总结如下,所有的类型在 VS2005+32位机器+win732位操作系统 上进行了验证。

符号属性   长度属性      基本型   所占位数   取值范围              输入符举例                   输出符举例

--             --               char     8             -2^7 ~ 2^7-1       %c             %c、%d、%u
signed      --               char     8             -2^7 ~ 2^7-1       %c             %c、%d、%u
unsigned  --               char     8             0 ~ 2^8-1            %c             %c、%d、%u

[signed]   short          [int]     16            -2^15 ~ 2^15-1                     %hd
unsigned  short          [int]     16           0 ~ 2^16-1                            %hu、%ho、%hx

[signed]    --              int        32            -2^31 ~ 2^31-1                     %d
unsigned   --              [int]     32            0 ~ 2^32-1                            %u、%o、%x

[signed]    long          [int]     32             -2^31 ~ 2^31-1                    %ld
unsigned   long          [int]     32             0 ~ 2^32-1                          %lu、%lo、%lx

[signed]    long long  [int]     64              -2^63 ~ 2^63-1                   %I64d
unsigned   long long  [int]     64              0 ~ 2^64-1                         %I64u、%I64o、%I64x

--              --              float     32              +/- 3.40282e+038              %f、%e、%g
--              --              double 64              +/- 1.79769e+308       %lf、%le、%lg %f、%e、%g
--              long          double 64              +/- 1.79769e+308              %Lf、%Le、%Lg

说明: []代表可省略,在C语言中是没有bool数据类型的,C++中有。

posted @ 2011-07-13 09:53 Klarke 阅读(565) | 评论 (0)编辑 收藏

1.
p4 integ -d -i //depot/icd/fe/10.10/Rel/USR3/Modules/mib/...@909970,909970 //depot/icd/fe/11.10/Rel/RTM/Modules/mib/...
p4 integ -d -i //depot/icd/fe/11.10/Rel/RTM/Modules/mib/...@909970,909970 //depot/icd/fe/11.10/Rel/USR1/Modules/mib/...          

2.

p4 resolve -am                         
3.

p4 resolve                               

posted @ 2011-07-11 13:38 Klarke 阅读(153) | 评论 (0)编辑 收藏

1.Q:如何用find找出当前目录下所有的普通文件(不包含隐藏文件)并移动到制定的目录中。
A:
引用:
find sourcedir -type f -exec mv -f {} targetdir \;


2.Q:用find . -name [a-zA-Z].* -print 为何什么都不显示?(目录夹下是有这样的文件的)
A:find . -name "[a-zA-Z].*"
or
find . -name "?.*"
or
find . -name ".*" #查找隐含文件

posted @ 2011-07-04 16:18 Klarke 阅读(78) | 评论 (0)编辑 收藏

1. Add subdirectories
find folder -type d -print | xargs cvs add

2. Add all the files
find folder -name CVS -prune -o -type f -print | xargs cvs add


Add File as Binary

1. cvs add -kb filename

This is used to add word document

 

 

posted @ 2011-07-04 16:04 Klarke 阅读(1137) | 评论 (0)编辑 收藏
仅列出标题
共7页: 1 2 3 4 5 6 7