2007年8月31日星期五

走了,实习结束了

我轻轻的走,
正如我轻轻的来,
不带走一片云彩...
我也轻轻的走,
正如我低调的来,
伴随着对于生活的感慨,
结束了未毕业前的一次生活体验.
以后绝对不要过那样的生活,
乏味的, 不受尊敬的劳动力.
本来打算再干一段时间,
但是当我知道了"人在做, 天在看"
 (人在做事, 房顶上的监视器在看)
的真正含义之后,
再也呆不下去了.
再加上旁边坐着一个闹腾的家伙,
受不了他天天在那里喊C#怎么怎么
自由了,
感觉很轻松.
庆幸没有签什么合同之类的.
反正大家都没什么诚意,
就当是不小心脚踩到泥坑吧.
还是当学生好.
真想一直躲在象牙塔中啊.
--
Shit happens!

2007年8月30日星期四

10 Rules of programming

By Malcolm McLean

 

  • The rule of one
    Thou shalt have one copy and one alone of any item under edit.

    Never fork development. It becomes virtually impossible to keep more than one version of a program in synch. A bug is fixed in one program, but the matching file in the other program has some subtle changes essential to make it work. So the fix may or may not be posted in, it may not even be relevant. Very quickly you will arrive at a situation in which no one knows what is happening.

    The rule also applies to program objects that can be edited by the user. The user expects that the interface will show a snapshot of the real state of his data. This is very hard to achieve if every menu item is caching data. Unfortunately it is also a difficult problem to fix; you need to impose rigorous mangement on non-modal meus especially. This is particularly true if efficiency considerations make it impossible to do a general refresh with every data value entered.


    The rule of two

    Thy names shall be binomial.

    In most cultures people have two-part names, such as Christian name / surname. When Linnaeus developed his system of biological nomenclature, scientists quickly simplified it to a binomial system, e.g. Pan troglodytes for a chimpanzee, Homo erectus for primitive humans. Three-part or higher names are not names but descriptions.

    The rule is of great importance in variable naming. In many languages variables are usually a member of a named structure or object. This means that both the member and the enclosing instance must have single-part names for the whole to be readable. Eg candidate.name not candidate_trainee.firstname . Names longer than two parts can of course be used in simple expressions. The rule applies when variables must be embedded in complex expressions.


    The rule of three

    Thou canst cope with only three levels of indirection.

    A human can just about read a mathematical expression with three levels of nested parentheses. Go to four and understanding breaks down. Similarly humans can cope with three levels of loop nesting, or arrays with three dimensions, or pointers to pointers to pointers.

    These things are all related to the fact that we are adapted to living in a three-dimensional world. Hence a three dimensional array has a physical analogue. Looping, indirection and parentheses are all used to support multi-dimensional arrays, hence really part of the same rule.


    The rule of four

    Thou shalt pass only four parameters to a function.

    If you expect your caller to remember the parameters a function takes, their order, and what they do, then you can pass a maximum of four parameters. Five is slightly too many to remember without effort, or to scan unconsiously. Four parameters is also the threshold for machine optimisation on may platforms.


    The rule of five

    Thou shalt have only five levels in a tree.

    A binary tree with five levels has sixteen members at the leaves. This is about the most that can fit onto a single diagram. Your call tree will of course be much bigger than five levels deep in a large program. However it can be broken down into files, with no more than five levels within each file, and no more than five levels of files in each library, and no more than five levels of libraries in each program. Or in object-oriented languages, no more than five levels of methods within each class, and no more than five levels of class dependencies.


    The rule of six

    Thou shalt use up to six letters in a minor identifier.

    This one is imposed by Fortran 77, which only allows six letters in identifiers. However it is a good rule to keep to for minor variables. Generally a one letter convention will exist for many variables in a function, such as N for an integer total and i for a counter, x, y and z for Cartesian co-ordinates, and so forth. The problem comes when we have source x, y and destination x, y. We can't use x, y for both. However sourcex, destinationx will make expressions far too long. srcx, destx is more acceptable. The limit is about six characters.

    Six digits is also the maximum that a human can take in without trouble. Unfortunately this rule is impossible to enforce in a computer programming context, because frequently greater precision is required for technical reasons. However it tells us that the rule of six also applies to names made of arbitrary characters, like "memptr". Identifiers which are English words are obviously perfectly readable. That's why the rule of six mentions "minor identifiers".


    The rule of seven

    Thou shalt pass only seven parameters to a function.

    Humans can take in about seven objects without counting them. This means that seven parameters is the limit for a readable function call. The rule of four was the rule for a scannable function call. The difference between scanning and reading is that the scanned call can be accepted as a single unit, the read call has to be worked through parameter by parameter. More than seven arguments and the reader will lose track of which is which and have to count arguments, matching them to the manual. So the code becomes non-readable, and is only acceptable if the reader already knows what the function does without looking at its argument list.


    The rule of eight

    Thou shalt have no rule of eight. A foolish consistency is the bugbear of little minds.


    The rule of nine

    Thou shalt hardcode only nine explicit conditions.

    In a two dimensional array each non-edge cell has eight neighbours, plus itself to make nine. This is about the limit for coding each condition explicitly. It is also the number of directions in common use � North, South, East, West, North-east, North-west, South-east, South-west, plus one for "stay still". OK, I am running out of ideas; this could be the rule of eight or the rule of ten. An if ... else ladder of nine is not unacceptable. If we go to cubic arrays we have 27 cells in each 3x3x3 block, and we must use loops to index them. Similarly if we want more than the eight compass directions, it is time to code as degrees rather than by name.


    The rule of ten

    Thou shalt have only ten commandments in a list of rules.

    That one was obvious.



  • --
    Shit happens!

    2007年8月5日星期日

    物价飞涨,给80后们看的省钱指南[转]


    本文由 xwsxws 在 2007-8-4 09:51 发表于: 倍可亲.美国 ( backchina.com )

    物价飞涨,在老板涨工资还遥遥无期的情况下,节流即是开源。

          找出一张纸,把你的各项支出列出来,好好分析你的消费支出,从战略,战术层面来节约。你每月的支出至少可以减少20%。

          1.不要在网上到处泡MM,这个开宵很大,一个月至少在500,上不封顶,约会支出是很恐怖的,吃饭,泡吧,礼物,开房间,买套套这些费用都很高。如果还没有找到合适的女生,不得不约会MM,至少大家先视频一下,不要看她N年之前的旧照,或者艺术照,大家或者先电话聊聊。免得见面大失所望,碍于男人面子,你又不能开溜,只好忍痛请恐龙吃饭。即浪费青春,又腰包出血。最好的办法是参加些网友活动,什么爬山啊,打球啊,先见面,感觉不错再
    发展。

          2.年青人最大的一笔开宵就是谈恋爱。如果她动不动就去什么高档的消费场所,赶快甩了她。别癞哈蟆想吃天鹅肉,梦想找一个富婆,这个跟买彩票一样,还是踏实点,找一个朴实点的女生,门当户对。两人同居,房租可省,两人自己做饭,伙食费用可省。

          3.如果可以,把各种各样的打折卡全部带上,至少每月能帮你省1-200元。去饭店吃饭,如果没有带打折卡,跟老板要发票,再问不开票有没有打折,老板一般会给你打个9折。

          4.如果每个月要用一打安全套,建议你批量采购,可以到淘宝上去采购,一个才4毛钱,100个才40元,足够你用半年,每个月至少可以省20元。

          5.尽量买最便宜的药来吃,贵的药与便宜药化学分子式相同,效果是一样的,不必要为生产商付广告费。

        比方说感冒药,不必吃20多元的康泰克,服点1元的朴感敏,效果一样,都是起缓解感冒症状的,还是要靠自身的抵抗力。医生给你开完处方,如果你有当医生的朋友,问一问或者上网咨询,很多药并不是必要的都可以省略掉。

          6.把该打的疫苗全部都打上,比方说什么乙肝疫苗,如果可能每一两年,做一次体检.经常做做锻炼,生活有规律,保持身体健康,是你应对生活压力,通货膨胀,节省意外支出的最好药方之一,以上几项做到至少能帮你节省80%的医药费。

          7.晚上打的11:00以后一般都会有加班费,你可以跟司机说,不收加班费。司机一般都会同意。

          8.小心选择手机套餐,否则是套你没商量。有一种套餐会设定几个免费号码,把你的死党,GF,家庭号码加进去。如果可能,最好用 QQ,msn语音聊天。没事别去相信免费下载手机铃声之类的东西,也别拨打不熟悉的声讯电话.
     
    ----邮件发布

    & lt;/p>