Archive for the ‘Reading’ Category

本文是我读完第二章--《七个习惯概论》的心得体会。

人的行为总是一再重复。因此卓越不是单一的举动,而是习惯。 --Aristotle

因此,想要追求卓越就需要有好的习惯,而要改变坏的习惯更是困难,需要在“知识”(做什么,为何做)、“技巧”(如何做)和“意愿”(想要做)三个方面努力。我个人觉得往往在开始的时候,是想要做的,但往往遇到了困难或者其他的诱惑就有可能不想或者不那么想要做了,这个时候更要提醒自己坚持才能取得胜利。

本章还提到了一个全书都特别重要的概念:效能。效能的高效在于产出和产能的平衡。我觉得现实中,我们往往忽视了产能,而一味的过份追求产出。所以,我觉得有必要多讲讲对产能的理解。

个人的产能

对于我们个人而言,我们的产能取决于自己的知识和经验的储备。如果你不持续学习新的知识,和积累经验,你分析问题的视野就会变得狭隘,同时也只能在目前的职位上踏步,每天忙忙碌碌,经济上一直受制于现在的老板。试想,在这种情况下,你何谈高效?

同时,我们自己的身体也是宝贵的产能。“身体是一切革命的本钱”,如果条件允许还是尽可能的少熬夜,多吃素食,并合理运动。(目前这点我就做得不好,从现在开始要好好调整,也希望大家能注意保重身体)

团队的高效

老板往往希望员工从每天下一个金蛋变为二个,而后三,越多越好,如果员工某天的产出少了,就会令自己很不舒服,觉得花了这么多钱,没有让员工overload(就好像现在很多小公司都希望自己的服务器cpu高负荷运转,什么xen都是为了实现这个目的),很不划算。

然而,人远不同于机器,对机器的运维经验,用到人身上就大相径庭了。你可以回答以下两个问题:

  • 你雇佣一名员工,希望他对于公司的产品热忱吗?
  • 你雇佣一名员工,希望他更多帮你去思考和解决问题吗?

钱不是万能的,买不到员工的心也买不到他的头脑。而心是忠诚与热忱的根源,头脑才是创造力与智慧的源泉。谈到这里,我不由的想说,其实很多小公司里,部分同学还是很有创造力的,只是超负荷的加班,已经逐渐让他变得呆滞。而一些牛叉的公司里,由于企业特别在意团队的产能,给出了各种团队成员提高产能的资源(比如培训,高效的电脑设备,舒适的环境),自然进入的员工会一直保持一种很好的状态,从而公司也变得伟大。

由内而外全面造就自己

Posted: March 31, 2011 in Reading
Tags: ,

以前就读过《高效能人的七个习惯》,这七个习惯分别是:积极主动、以始为终、要事第一、双赢思维、知彼解己、综合综效、不断更新。但现在回头看看,这些习惯并没有很好的融入到自己的日常工作和生活当中,我想是因为当时读得太快,太过功利了吧。

最些在公司被一些损人利己的事和人所烦恼,心情实在不爽。昨天也和好友保平聊到了一些公司的事情,他最近在读这本书,也推荐我再温习一下。今天在上班地铁里便开始读了起来。

这里记录我读的第一章--《由内而外全面造就自己》的心得体会。

品德是这个年代特别容易被忽视的珍宝,很多时候,良好的品德本身就是一种特别好的个人魅力。而往往很多人,忽视他,追求速成,拉帮结派,甚至为了个人的利益做出一些伤天害理的事情,为达目的不择手段,过于结果导向。

而为什么那么容易放弃品德呢?这是因为缺乏一些基本的,放之四海皆准的原则作为指导。我个人认为要坚持以下原则:

  • 诚信
  • 正直
  • 服务:即贡献自我
  • 追求卓越

图片感知实验,反应了思维定式这一事实,我们必须要认识到这点,在工作中审视自己的定式和接受别人的意见,打开自己的视野。

“一颗邪恶的大树,砍它枝叶千斧,不如砍它根基一斧头。” --梭罗

要想有实质性的变化,还是要靠思维的转换,但这点是很难做到的,我觉得只有不断学习、实践,并积极的思考才能不断的转换自己的思维,一次次打破固有的定式。

“如果我们时时忙着展现自己的知识,将何从忆起成长所需的无知?” --梭罗

违背自然的成长过程,只会让你平添失望和挫败感。要想获得成功,必须要从内而外的进行锻造,遇到问题多从主观上找原因,而不是先把问题归结于客观环境。

Just some notes after reading “Eloquent Ruby” chapter two.

  • use unless in place of if not
  • use until in place of while not

You should think that do sth in the unless or until block unless/until condition is true.

Use each, Not for

Case statements use the === operator to do the comparisons. Since classes use === to identify instances of themselves, you can use a case statement to switch on the class of an object. And you can use a case statement to detect a regular expression match.

only false and nil are treated as false, you should avoid testing for truth by testing for specific values.

@first_name ||= '' shorter than @first_name = '' unless @first_name

Just some notes after reading “Eloquent Ruby” chapter one.

indent

use two spaces per indent

comments

There are good reasons for adding comments to your code, the best being to explain how to use your software masterpiece. These kinds of “how to” comments should focus on exactly that: how to use the thing. Don’t explain why you wrote it, the algorithm that it uses, or how you got it to run faster than fast. Just tell me how to use the thing and remember that examples are always welcome.

Sometimes it’s also wise to include a “how it works” explanation of particularly complicated bits of code. Again, keep this kind of explanation separate from the “how to”.

The occasional in-line comment can also help.

Remember, good code is like a good joke: It needs no explanation.

Camels for Classes, Snakes Everywhere Else

  • Almost everything in this context means methods, arguments, and variables, including instance variables use snake case.
  • Class names are camel case.
  • Constants use all uppercase, punctuated by underscores.

Parenthess

both in method definitions and calls surround parenthess.

don’t surround parenthess:

  • conditions in control statements
  • defining or calling a method with no parameters
  • puts, instance_of?, and your right feeling

Look set.rb in your ruby lib path for more ruby conventions.

Naming

  • end the name of a method that answers a yes/no or true/false question with a question mark
  • reserve ! to adorn the names of methods that do something unexpected, or perhaps a bit dangerous

My vpn sp have twelve ip, so I want to choose the best ip.

#!/usr/bin/env ruby
#coding: utf-8

ping_count = 10

servers = (1..12).to_a.map { |el| "us#{'%03d' % el}.example.com" }

results = []

servers.each_with_index do |el, i|
  r = `ping -q -c #{ping_count} #{el}`
  puts "processing: #{'%2.2f%' % ((i+1)/12.0*100)}" if i < 11

  #The ping utility returns an exit status of zero 
  #if at least one response was heard from the specified host;
  #a status of two if the transmission was successful but no responses were received;
  packet_loss = r.scan(/d+.d+(?=%)/)[0]
  avg = r.scan(/d+.d*(?=/)/)[1]
  results << [el, [packet_loss.to_f, avg.to_f]] if $?.exitstatus == 0
end

puts "finished!"

puts results.min { |x, y| x[1][0] <=> y[1][0] and x[1][1] <=> y[1][1] }