| 伟's profile晴朗下午PhotosBlogLists | Help |
|
May 08 Healthy computingIntroduction
Any type of work can lead to injuries and other health issues. Computer work is no exception to this rule. When programming, we often have to spend many hours sitting in the same position and staring in one direction. Even if we cannot control the amount of time that we spend at the computer, we can at least control how we spend it. We must remember that neglecting a healthy computer environment increases the risk of immediate injuries and can lead to severe health problems in the future. These issues are no joke and should be treated seriously. In this article I would like to describe how to avoid and overcome injuries related to computer work. This involves having proper set up for your chair, keyboard, mouse and monitor, as well as, having correct sitting posture, document positioning and use of input devices. Finally, I will touch on some simple exercises that will keep you healthy during long working hours. Setting up the chair
First lets have a look at chairs as they are the single most important component to a healthy environment. There is no such thing as a perfect chair and you should try a variety of chairs to find the one that suits you best. Chairs that have wheels are generally a good idea, especially if you are working at multiple desks and need to move around the room. Be careful though; because some floors are slippery and make you unintentionally move backwards as you type. If you are using a non-adjustable chair and it is too high then consider using a footrest. The main idea is to feel comfortable while sitting in your chair. This means that your back should be well supported and the actual seat does not apply too much pressure to the back of your knees. Adjust the chair height until your feet are comfortably placed on the ground and your knees are nicely relaxed. Next adjust the reclining angle. Experts recommend keeping the chair slightly reclined, as this helps relieve tension from your lower back. Also if you can, adjust the reclining tension so that the chair provides consistent support as you move back and forth. Sitting posture
Your sitting posture is also important. It is a good idea to change your posture every now and then. By doing so you will improve circulation and reduce muscle fatigue. Your back should be comfortably reclined - it should not be erect or leaning forward. Your head should be well balanced - do not tilt it back or too far forward as this will strain your neck. Your arms should be relatively close to the body - not out to the side or too much to the front. Your wrists should be roughly level with your forearms. If your chair has armrests then make sure that they do not interfere with your arm movements. Document positioning
Often we have to work from printed documents while using the computer. Improper positioning of documents can lead to neck and shoulder pain. Try to keep your body straight and avoid twisting it at awkward angles. It helps to have a large desk so that both monitor and documents can be in direct view. If your desk is too small to fit your documents then consider using a monitor mounted document holder. On a personal note, I strongly recommend learning how to touch-type. Not only does it save you time, but also prevents you from having to constantly turn your neck while typing. Choosing the right keyboard
When it comes to buying a new keyboard there is no shortage of choice. The most commonly used type of keyboard is the "101-key traditional" keyboard. Generally these are well suited for everyday use and there is no need to change them unless you have special requirements. If you have a broad chest then perhaps you should try a split keyboard. Split-design keyboards divide the letter keys into two halves. By doing so, they aim to achieve a more natural position for your wrists and forearms. Contoured keyboards arrange the keys in a way that approaches the natural position of your fingers. This reduces the distance that your fingers have to travel between keys, thus minimizing the risk of strain. Finally, there are keyboards that use a different layout altogether. For example, chording keyboards use fewer keys and are operated by using combinations of keys instead of individual keystrokes. Dvorak keyboards position the most commonly used letters directly under the user's strongest fingers. Although these keyboards have their own advantages, they take considerable time to master.
Setting up the keyboard
Now lets examine some of the ways in which you can adjust your keyboard. Ideally you should have a keyboard tray, as this allows you to make both horizontal and vertical adjustments. Position the keyboard so that it is about 4 inches above your lap level. Always un-extend the "legs" that are attached to the front of your keyboard. If you can, tilt the keyboard slightly forward, as this will keep your wrists in a relaxed neutral position. Position your keyboard so that the middle of the letter keys is centered with respect to your body. Using the keyboard
When typing it is important to follow a few simple guidelines. Try to use a light touch, because striking the keys too hard can strain the tendons from your fingers. Do not bend your wrists up and down too much as this can cause pain and lead to injuries. Keep your elbows at angles equal or greater than 90 degrees - this avoids nerve compressions that lead to sore wrists and arms. Do not use wrist rests or armrests while typing - only use them when resting. Avoid raising you shoulders to meet the keyboard, instead you should lower the keyboard or adjust your chair height. Setting up the mouse
The mouse can be set up in a similar manner to the keyboard. If the mouse is too far from the keyboard then your shoulders will tire from supporting your outstretched arm. So place your mouse within easy reach, close to the keyboard. Use your operating system to adjust the mouse's speed and response time. As mice come in different shapes and sizes it is important to find one that fits comfortably in your hand. Using the mouse
When using the mouse try to avoid making "flicking" movements with your wrist as this can lead to wrist and finger pain. Instead, move the mouse with your forearm. A scroll wheel is an absolute must when editing those long documents and pieces of code. Avoid having your fingers "hover" above the buttons - give them a rest by letting them lie gently on the buttons. Also avoid tilting and angling your wrists - keep them in a neutral position. Just like with keyboards, there is no need to use excessive force when clicking mouse buttons. Setting up the monitor
It is vital to position your monitor correctly, because failing to do so can lead to neck pain, shoulder pain and even eyestrain. The best position for the monitor is in the center of your workspace. This position guarantees that you don't have to experience any uncomfortable twisting and awkward posture. Just like with televisions, it is not advisory to sit too close to your monitor. You should sit about an arm's length away and even further for monitors that are larger than 19 inches. Position your monitor so that the top of the viewing area is about 2-3 inches above your eye level. Reducing glare
Window light can cause many viewing problems associated with monitor use. For example, if your monitor is positioned next to a window then you will have competing brightness levels between the window and the monitor. This can be very uncomfortable and often causes headaches and fatigue. On the other hand, a window situated behind you will produce glare. One solution is to keep windows mostly shut and use overhead lighting. Another solution is to attach an anti-glare screen to your monitor. However the best solution is to use an LCD (liquid crystal display) monitor. These monitors are ideal, because they emit minimal glare and save desk space at the same time. Exercises Now for some exercises that you can do between work to relieve tension and muscle fatigue: Stand up and stretch your arms over your head. Give your eyes a rest by looking into the distance or closing them for a few seconds. Turn your neck slowly to the left for 5 seconds and then to the right for 5 seconds. Repeat several times. Relax your arms at your side and rotate your shoulders in a circular motion. Clasp your hands behind your back and slowly arch your back, bending your head backwards. Hold for up to 5 seconds. Place your hands palm-to-palm and slowly rotate them away from you until you feel a mild stretch. Clench both fists and hold for 5 seconds. Now spread your fingers as far as you can and hold for another 5 seconds. Repeat several times. March 29 什么是专家? Specialization is knowing more and more about less and less until you know everything about nothing. March 22 对我未来的简单规划
做8~10年程序员。前3年在Sigrity,之后选择一个注重技术的公司,比如Google。让我的工作充满挑战。让我多多赚些钱。 我是一个passionate,自信,骄傲的程序员。但是现代文明的所有东西常常令我惊讶,有时坐着地铁,看着各种塑料制品。我就感觉这个世界优秀的人太 多了。至于我,我必须让我的这一优势为世界带来一些有价值的东西。然后,也就是约8年后,我就要向开始学习我的新专业了。那就是声学。不要废话说这样子的 职业的发展不是连续的,我可以读一个声学方向的学位,然后我就会学会所有转型需要的知识,非常容易。 人的职业生涯是短暂的,人的一生虽然短暂,也要比人的职业生涯多约30年。(20年长大,10年养老). 因此10年的时光在职业生涯中不是短暂的。用这么长的时间来满足我对软件业的热情,补偿我大学时的热情,迷茫和苦恼,可以了。 因为我在十年后不是做程序员了,我不是和我的Team member一起共事,那时候我跟着一个优秀的声学专家,在各个音乐厅里做各种测量。为设计有更好声学性能的建筑而提供建议。因此提高我的综合素质是非常必要的。 记得金强告诉我Daily summary and plan怎么写时说,plan可以写的简单点。说的没错。 “For a better future we forget good now." "Tomorrow is unpredictable, yesterday is past, today is a gift, that's why today is called present". 所以,规划未来应该被投入较少精力,规划现在应该被投入更多精力,而度过现在,则应该被投入最多精力。 如何充实自己的业余时间。 1. 多锻炼身体, Balance phisical and mental. 2. 多拜访朋友。 3. 写博客,以便多认识些同好。 4. 给几位好朋友写email. 5. 学习哄人开心。 6. 爱情尚遥不可及,干脆铁定注意。让自己心静3年。既然围城到处都是,何必继续验证?单身的生活也会有乐趣-可能会更多。停止任何瞎折腾。 7. 任由自己的兴趣蔓延。 从今天起,面朝大海,心态乐观。想想前两天牙龈发炎的日子。那才是真正的痛苦。这种日子都能过,还有什么不美好?!人生苦短,既然人会希望长生不老,又何必让自己有日子过不去的无聊? March 09 春天来了,好多期望! 接连下雨多天,今天天气一下子好晴朗!
柳树上已经长了许多新芽,嫩嫩的,绿绿的。
所有心里的期望在春光里重新结芽青绿了!
所有最美好的记忆,所有梦寐中的期盼!
这个全新的季节!
我亲爱的看到这篇日志的朋友,我愿所有美好的东西,如春天的到来一般,不可抗拒的,自然而然的进入你的生活!
刘伟的每一刻都是崭新的! February 22 接连做了两个噩梦大概最近睡眠状况变差了,虽然睡眠时间更长了 - 以前的时候躺在床上还要看看东方电影频道有什么好看的片子,现在躺在床上,一打开电视眼睛就睁不开。整个人慵懒异常,只想闭着眼睛。
昨 天晚上做的两个噩梦太可怕了,要不是早就是一个唯物主义者,我估计都要精神异常了。在第一个噩梦中,我还是躺在床上,看到有两只很毒的虫子在我的鞋子里面 跑来跑去,我人好像懒懒的,随手拿起一瓶不知道什么东西喷了喷,虫子跑到墙上去了。于是我又得过且过的睡下了。然后便是稀里糊涂 - 梦都是不连贯,杂乱无章的。突然间,鞋子已经穿在我的脚上了!
鞋子穿在我的脚上!
我意识到事情不妙,赶紧脱下鞋,天啦!只见我第脚底一串串疙瘩,有大有小,一直延伸到了大腿那里。其中的有些肿块变得非常大!
于是在一阵恶心和悚然中,我醒了过来。
这 个恐怖的梦让我想起了中学的免疫知识。人的身体是有区别“自我”和“非我”的能力的。当免疫系统察觉到外界的入侵时,会动员一些英勇的细胞去消灭异类。因 此发炎时白细胞的数量会大大增加,红肿的地方也是白细胞聚集的结果。在我的梦中那些肿块那么大,说明这显然是一场惨烈的战斗。
- 人的免疫系统是非常重要的... 是我们的祖先用自然选择中大量同类的牺牲换来的。我们的祖先都是基因上的佼佼者。
迷糊中我摸了摸自己的腿,发现那里的皮肤都是平的,“还好只是个梦啊” 我想,于是我又睡着了。但想不到又有一个噩梦等着我。这个该死的噩梦给人一种日有所思,也有所梦的感觉。
我梦见自己不知道怎么样,总之我刚刚有一个某某学科的更高的学位的样子。然后我跑过去面试,但是,当我到我面试的地方时,却发现这个地方和生化危机中某个破败的仓库一样。我穿过阴冷的地下室,被带到了一个像废品堆积室般的地方,然后好像胡乱的在说着什么。
接 着蒙太奇般的,我突然得到了兰州的“海默石油流量计公司”的消息,说我被解雇了。其实我早已经不在那里上班了。我在那里培训了一个月的英语并且效果不错, 进步很大。有个叫Mejdi的人在兰州工专上课,同时跑到各个公司做商务英语培训。还有个叫刘一川的老师会很可爱的示范 "our" 怎么样读 - 但问题是我在那个梦里,听到我被海默解雇的时候,感觉很不好。
这就是我的第二个噩梦。这是一个残酷的噩梦,残酷的原因是他太真实了。裁员,压力,疲惫,迷茫。所有都是现实中的残酷。这些残酷不像是南京大屠杀,不像是人肉叉烧包,你看了后会矫情的叹息几声,但心里清楚其实他们离自己很遥远,然后去打几局麻将,吹一吹牛。
也 许我还没有拥有一个真正成熟的心态,我一直在企图去多了解一些行业,了解不同人的历史的生活工作状态,发现最适合自己的路。我告诉自己,迷茫是一种这个阶 段必然的状态,或许在我工作后很长时间,我的目标只是给自己一个方向。我是精力充沛的,是聪明好动的,是不吝惜自己的努力的。但混乱,毫无控制的热情只有 在运气极好的情况下才会给一个人期望的生活。要明确方向,就得学习社会。
学习社会不是一个可以从Google搜到答案的题目,不是通过读一本《Find out your career path in 21 days》就可以明白的道理。所以我给发现自己的方向以充足的耐心,话虽如此,但似乎我还是有那么点担忧,否则,怎么会做这样的梦呢?
当我想起梦中那破败的仓库的时候,我就想到了当年参观学校号称“亚洲最大的消声室”时的感受,太破了。但是听说有人用这么破破烂烂的东西赚了无数米。真的有那么多吗?
思而不学则罔! February 13 脚本语言更快还是C++更快?安静!!我知道你是一个很优秀的软件工程师,我知道你认为这种讨论毫无意义。但请不要急着扔鄙视的砖头,请先听我把话说我。耐心点!我要告诉你的是新东西! 话还得从我之前对Tcl的解释器做的一点小小改动说起。当时公司需要在产品中嵌入Tcl的解释引擎,但在工程中加入了Tcl的代码后,运行结束时却发现了大量的内存泄漏。因此习惯打杂的我被叫过去解决这个问题。仔细的阅读了Tcl内存管理的算法后,我发现Tcl的的内存使用方式的确是相当高效的。 Tcl内部有一个Bucket列表,每个Bucket包含一个可用内存块的链表,链表中所有内存块的大小是相同的。内存的申请与回收主要通过这种缓存完成。 我们以一次内存申请过程为例,假设要申请的内存大小为50,那么一次申请的过程如下: 1. 首先查找大小为64的Bucket中是否有可用内存块,如果有,则直接将该块取出返回。 2. 否则,从最大Bucket开始查找一块可用内存,将其切分为大小64的小块,这样大小为64的Bucket又有可用内存块了。 3. 如果在进行第二部的时候找不到更大的内存块,则向OS申请。申请的大小为最大Bucket中内存块的大小。 至于内存回收时,则直接将其放回大小与其对应的Bucket中。 这里大家也明白为什么我们在嵌入Tcl的时候会发现内存泄漏,因为Tcl对内存本来就是只吞不吐的,所有使用完毕的内存都被缓存了下来 – Tcl依赖Windows来做内存回收的。 不谈我们是怎么解决这个问题的,我想说的是,这种内存管理策略是相当有效的。 首先,由于所有向操作系统申请的内存都是固定大小的,因此可以大大减少内存碎片。 其次,多级的内存管理方式大大减少了堆查找所消耗的时间。 再次,对于常见的应用程序,开发人员所申请的内存的大小常常落在一定范围。因此当程序运行一段时间后,反复的内存申请,释放将会是不停的把一块内存放入,取出某个Bucket,如果内存管理是交给OS的,想想性能会差多少! 最后,在多线程的Tcl中,每个线程都会拥有自己的Cache,这可以大大降低malloc是lock全局堆所浪费的大把时间。 现在回到文章开头的观点,为什么有时候脚本语言会比C++快?让我们来这样想象一下,我们现在要开发一款坦克大战游戏(抱歉一时间想不出更好的例子了),里面会不断的创建子弹对象,敌人的坦克对象,各种效果对象,又不断的销毁,因此内存申请与回收的效率对运行速度非常重要。使用C++的程序员将直接使用操作系统提供的内存管理功能,而使用Tcl的程序员,虽然脑子里面思考的东西和使用C++的程序员差不多,却已经不知不觉中使用了经过更好优化打内存管理策略。因此使用Tcl写出来的程序很可能会跑得更快。 当然了,内存的管理只是Tcl所做的优化中的一种,因为我没有完全读过Tcl的代码,所以很难说Tcl还做了什么能大幅提高效率的优化。但我相信肯定还有不少我所未知的优化。 当然,你可以说Tcl也是用C写的。但问题是你自己用C写代码的时候会考虑这么多吗?你不会啊! 你还可以说用C也可以写出很robust的代码,但通常你嫌麻烦啊,或者也写的很累啊! 所以我认为: 1. 不必用C++写的代码,尽量不用C++,或者尽量少用。 2. 多学点各个层次的计算技巧,要比死抱着C++重要的多。 3. 多了解一下编译器如何优化,也要比在C++里面硬嵌汇编更能提高性能。(同样的道理,汇编不见得比C++快,有时候我看反汇编的代码时,发现编译器的优化能力令我发指!) February 11 如何读代码1 - 驳斥两条常见误区首先我必须有力的反击在软件开发中充满迷惑性的两点误区,据我所知者两点误区已经深深毒害了软件开发人员多年,大大的降低了代码质量。他们是:
1. 我们的代码应该有很多文档。 2. 我们的代码似乎很烂。
首先来看看误区1:
在软件开发中,新加入一个项目的程序员常常会有这样的抱怨: “我们的代码没有文档”。这种抱怨甚至会得到项目中已经颇有经验的程序员的附和。但其实这种抱怨是带有不合理要求的,不应该支持的,是可以驳回的。
首先,这世界上90+的软件是没有(或缺乏)文档的,千万不要以为在大公司会有很“理想”的写一大堆文档然后才开始写代码的“正规流程”。如果不相信,可以问问你在大公司,比如Microsoft, IBM等工作的朋友,看看我们耳熟能详的那些软件到底有多少文档。似乎只有外包公司比较重视文档,然而敏捷开发的风行也使开发者对书写笨重的文档难以保持耐心。文档与代码的不同步也使许多文档变得失去意义。
其次,让我们来看看文档对于开发者的意义。也许新加入的项目组成员会想,在理想的情况下,只要让我先看看文档,一点代码都不用看。等我通读完文档后,我打开代码就懂得全部的代码啦!然而这真的很幼稚。
好吧,也许你理由还是很充分,你认为磨刀不误砍柴工,你认为…. , 总之你认为就是应该有文档嘛!但是我们得面对现实的对不对,现实是,你所拥有的只是一堆代码,放在一个Visual Studio的Solution文件里面,你无法使用心爱的Adobe Reader, Microsoft PowerPoint and Visio,你只能使用对着Visual Studio,阅读一行行代码,所以,你所能考虑的只应该是如何多快好省的搞懂这些代码。
当然,我不是说你应该不写文档。
误区二:
好吧,无论有没有文档,有一件事情是肯定的,你现在对代码有了一些了解。是时候发表点自己的评价了,于是你说:
“我们的代码烂到家了!”
你的评价是有道理的,因为你的评价基于你对软件开发的真知灼见。你举出了无可动摇的事实,你说:
“这个地方应该用State模式,而我们则使用了大量的 if, else, switch。这个函数纯粹就是一个万能函数,并且与另一个函数严重耦合,更糟的是函数名也挂羊头卖狗肉。这个地方应该用二分查找,这里则应该用动态规划提高效率…”总之:
“这代码真应该从一开始就让我写!”
好主意!如果一开始就让你写,或许你会理解所有代码的来龙去脉,你会认为代码本来就应该是这个样子。你会认识到我们为得到这些混乱的代码,所付出的巨大努力:一个个优秀的程序员,一个个目光犀利的QA,以及大量花数年时间使用我们软件的客户,如辛勤哺育孩子一般,让我们的软件逐渐成长起来,而有人却认为他很烂?!
现在让我们看看我们的代码,看看这个5000行以上的函数,里面署有50位程序员的大名。而他的功能仅仅是显示一个窗口,随着岁月的积累,他开始变得庞大。但是不像中年发福的人,这个函数的增长,是在积累有用的东西,那就是:Bug fix。有人发现在没有安装Internet Explorer时窗口不能正确的现实,有人为内存不足时正确的现实窗口做了点特殊处理,为了使某个将数据存储与局域网服务器的客户能看到给窗口,我们还得加点代码;至于丑陋的LoadLibrary的调用,则是为了支持Windows 98以及Linux用户。
所有这些bug的发现都是在我们的软件被大量使用 - 测试之后发现的,定位这些bug花了我们大量的精力,时间。在一个个Bugfix 中,我们的软件从一个婴儿 – 单纯,简洁,变得越来越成熟,稳定,越来越善于处理来自客户的需求。然而,随着一个个Bug被修掉,我们的代码会逐渐零乱,代码中或许会混杂着各种各样的风格,或许会有重复的API调用,或许有些地方必须要提高性能了,甚至或许会有自相矛盾的地方。但是你应该感觉得到与这微不足道的缺陷相比,他所能提供的强大的功能,他所具有的巨大的容错性,才是我们代码真正的本色!
至于那些毛病,我们有你,优秀的开发人员。对于软件进化已成为软件开发主流的当代,代码重构是一个程序员最需要提高的能力。
况且,从态度来说,一个喜欢自己工作与之上的code base的程序员,会有更积极的态度,因而也更能改进现有的代码。 November 25 A voluntary advertisement for Microsoft AgentA voluntary advertisement for Microsoft Agent I knew Microsoft Agent recently when I was messing around surfing platform SDK documentation for some funny windows features to make use of. The minute I set eyes on the title “Microsoft Agent” I thought it would be a framework for developing network application. Then, when I knew I was wrong, also I knew I’ve found some technology cool enough for me to have an in-depth sight. Anybody who had used Microsoft Word 97 wouldn’t feel strange about the picture above. This picture shows one of the very few examples of Microsoft Agent usage – who else is using this in their application? From a programmer’s perspective of view, this darling paperclip shows a great potential in improving the way application interact with users. Today’s software usually has much more functionality than the ones users need. The button a beginner user wants to click is always hiding in a huge set of advanced features, complex options and other thing provided by over-warm-hearted software developers, so to help users get started become a big challenge for software developers. This paperclip above is a perfect example to guide the user to learn the features on writing letters. Guessing the user may be writing a letter, the paperclip think the best opportunity to exhibit their “Letter assistant” feature has come! However, Microsoft didn’t make good use of there cool idea. The stupid paperclip gives no usable tip on using Microsoft Word. Microsoft has an “Office Usability Improvement Program”, maybe from the feedbacks they collect through this program they found that the first thing a user do after he starts Microsoft Word is to turn off this annoying paperclip. So in Office XP released in 2001, they removed it, and about why they did that they made up a fairly reasonable reason. http://www.microsoft.com/presspass/features/2001/apr01/04-11clippy.mspx Then yes, in Microsoft Office, Microsoft Agent is completely a failure. But does that mean Microsoft Agent itself is a technology of no advantage? The reason why the use of Microsoft Agent in Microsoft Office is a failure is that Microsoft, inventor of Microsoft Agent, is a good introducer of the new way to interact, but not a good practicer. Microsoft did nothing further but just put the search box and search results in a balloon window, but that’s nothing new. In this article I won’t spend time to discuss why the evolution Microsoft thought they included in their Office is in fact not. Nor will I say how it can be improved. Despite its failure in Microsoft Office, Microsoft Agent is a technology innovative and with big potentiality. The aim of Microsoft Agent is to help developers develop conversation based interactions. All robots in science fiction films are best examples of conversation based interactions. The “terminator” is one of the most famous robots in movies. This man may have a fan in Microsoft staffs and as a result made Microsoft to simulate him on Microsoft Windows. An overview of the technology So to achieve this on desktop, in Microsoft Agent, they provide mainly three components: 1. A set of animated characters, to act as the more natural user interface. Because Microsoft doesn’t want to terminate Windows, the characters they provide are no killers like “Terminator”. They are nice, darling, and always with a smile. 2. A TTS (Text to Speech) engine, to replace the traditional text output to sound output, like we talk with each other every day. This feature has exceeded the technology which is supposed to show up in late 2080. We know “terminator” can just speak a dull voice with an unchangeable tune. Microsoft Agent utilize quite advanced linguistic technologies. 1. Questions are not spoken like remarks. (That’s what the cool “terminator” does.). 2. You can specify which word to emphasis, for example: “Please \Emp\ pay first!” This feature is quite useful if the restaurant using your application has a customer who forgets to pay his bill often. 3. A voice command recognition engine, to replace traditional mouse and keyboard user input. This feature seems need improvement if Microsoft wants to beat the “terminator”. The speech recognition engine can just pick out which command you are most likely to execute. However, this functionality is sufficient with most cases. A typical usage Well, for example, when some one is ordering a dish online. He would feel quite fresh about the boy greeting him. Then you said with your micro phone. Now you finished your order. A pleasant experience, isn’t it? Conclusion Although never been popular since its first release from Microsoft – even its pre-existence, Microsoft Bob came out to be a failure; Microsoft Agent is an evolution in the history of user interaction development. The issue is the people who use it, not the technology itself. Just build your next project on Microsoft Agent to give your customer the best experience they’ll ever have! November 21 论对象序列化
对象序列化是几乎所有的应用程序开发者都必然面临的问题。当我们修改了Windows的某项配置,保存了自己辛苦创建的Word文档,在论坛上发表了某篇帖子,或是发送了一封Email, 我们在进行着文档序列化的操作。 在一个程序员看来,文档的序列化方式,决定了一个应用程序的整体架构,也决定了软件中看到80%以上代码的形态。因为软件就是处理数据的,80%以上用户关心的数据都是要存储的。存储的方式决定了对象的建模,也就决定了操作对象的代码。 现在让我们逐个看看常见的几种对象序列化方式。
1. 从fopen(fname, "wb") 开始的对象序列化
2. 基于文本解析
3. 基于数据库
4. 面向对象的存储系统
December 01 笑傲江湖之名言病来似山倒, 病去如抽丝 我宗武功之名虽然 流传天下,实则那是末学,殊不足道。达摩老祖当年只是传授弟子们一些强身健体的法门 而已。身健则心灵,心灵则易悟。但后世门下弟子,往往迷于武学,以致舍本逐末,不体 老祖当年传授武功的宗旨,可叹,可叹。”说着连连摇头。 方证方丈续道:“但那般刺密谛大师所阐发的,大抵是禅宗佛学。直到十二年后 ,二祖在长安道上遇上一位精通武功的年轻人,谈论三日三晚,才将《易筋经》中的武学 秘奥,尽数领悟。”他顿了一顿,说道:“那位年轻人,便是唐朝开国大功臣,后来辅佐 太宗,平定突厥,出将入相,爵封卫公的李靖。李卫公建不世奇功,想来也是从《易筋经 》中得到了不少教益。”令狐冲“哦”了一声,心想:“原来《易筋经》有这等大来头。 ”方证又道:“《易筋经》的功夫圜一身之脉络,系五脏之精神,周而不散,行而不断, 气自内生,血从外润。练成此经后,心动而力发,一攒一放,自然而施,不觉其出而自出 ,如潮之涨,似雷之发。少侠,练那《易筋经》,便如一叶小舟于大海巨涛之中,怒浪澎 湃之际,小舟自然抛高伏低,何尝用力?若要用力,又哪有力道可用?又从何处用起?” 令狐冲连连点头,觉得这道理果是博大精深,和风清扬所说的剑理颇有相通处。方证又道 :“只因这《易筋经》具如此威力,是以数百年来非其人不传,非有缘不传,纵然是本派 出类拔萃的弟子,如无福缘,也不获传授。便如方生师弟,他武功既高,持戒亦复精严, 乃是本寺了不起的人物,却未获上代师父传授此经。”令狐冲道:“是。晚辈无此福缘, 不敢妄自干求。”方证摇头道:“不然。少侠是有缘人。” 笑傲江湖(2)令狐冲全身重量都挂在他的左手之上,显得全然虚弱无力 ,口中却兀自怒骂:“谁要你讨好?他奶奶的。”一跛一拐的回入洞中。风清扬微笑道: “你用这法子取得了一日一夜,竟不费半点力气,只不过有点儿卑鄙无耻。”令狐冲笑道 :“对付卑鄙无耻之徒,说不得,只好用点卑鄙无耻的手段。”风清扬正色道:“要是对 付正人君子呢?”令狐冲一怔,道:“正人君子?”一时答不出话来。风清扬双目炯炯, 瞪视着令狐冲,森然问道:“要是对付正人君子,那便怎样?”令狐冲道:“就算他真是 正人君子,倘若想要杀我,我也不能甘心就戮,到了不得已的时候,卑鄙无耻的手段,也 只好用上这么一点半点了。”风清扬大喜,朗声道:“好,好!你说这话,便不是假冒为 善的伪君子。大丈夫行事,爱怎样便怎样,行云流水,任意所至,甚么武林规矩,门派教 条,全都是放他妈的狗臭屁!” November 30 笑傲江湖1、令狐冲闭 上了眼睛,但只过得一会,便又睁了开来,道:“我只道这里风景好,但到得瀑布旁边, 反而瞧不见那彩虹了。”仪琳道:“瀑布有瀑布的好看,彩虹有彩虹的好看。”令狐冲点 了点头,道:“你说得不错,世上哪有十全十美之事。一个人千辛万苦的去寻求一件物事 ,等得到了手,也不过如此,而本来拿在手中的物事,却反而抛掉了。”仪琳微笑道:“ 令狐大哥,你这几句话,隐隐含有禅机,只可惜我修为太浅,不明白其中的道理。倘若师 父听了,定有一番解释。”令狐冲叹了口气,道:“甚么禅机不禅机,我懂得甚么?唉, 好倦!”慢慢闭上了眼睛,渐渐呼吸低沉,入了梦乡。 2、 聪明才智之士,勇武有力之人,极大多数是积极进取的。道德标准把他们划分为两类 :努力目标是为大多数人谋福利的,是好人;只着眼于自己的权力名位、物质欲望,而损 害旁人的,是坏人。好人或坏人的大小,以其嘉惠或损害的人数和程度而定。政治上大多 数时期中是坏人当权,于是不断有人想取而代之;有人想进行改革;另有一种人对改革不 存希望,也不想和当权派同流合污,他们的抉择是退出斗争漩涡,独善其身。所以一向有 当权派、造反派、改革派,以及隐士。中国的传统观念,是鼓励人“学而优则仕”,学孔 子那样“知其不可而为之”,但对隐士也有极高的评价,认为他们清高。隐士对社会并无 积极贡献,然而他们的行为和争权夺利之徒截然不同,提供了另一种范例。中国人在道德 上对人要求很宽,只消不是损害旁人,就算是好人了。《论语》记载了许多隐者,晨门、 楚狂接舆、长沮、桀溺、荷丈人、伯夷、叔齐、虞仲、夷逸、朱张、柳下惠、少连等等, 孔子对他们都很尊敬,虽然,并不同意他们的作风。 3\风清扬摇摇头,说道:“你是岳不群 的弟子,我本不想传你武功。但我当年……当年……曾立下重誓,有生之年,决不再与人 当真动手。那晚试你剑法,不过让你知道,华山派‘玉女十九剑’倘若使得对了,又怎能 让人弹去手中长剑?我若不假手于你,难以逼得这田伯光立誓守秘,你跟我来。”说着走 进山洞,从那孔穴中走进后洞。令狐冲跟了进去。风清扬指着石壁说道:“壁上这些华山 派剑法的图形,你大都已经看过记熟,只是使将出来,却全不是那一回事。唉!”说着摇 了摇头。令狐冲寻思:“我在这里观看图形,原来太师叔早已瞧在眼里。想来每次我都瞧 得出神,以致全然没发觉洞中另有旁人,倘若……倘若太师叔是敌人……嘿嘿,倘若他是 敌人,我就算发觉了,也难道能逃得性命?”只听风清扬续道:“岳不群那小子,当真是 狗屁不通。你本是块大好的材料,却给他教得变成了蠢牛木马。”令狐冲听得他辱及恩师 ,心下气恼,当即昂然说道:“太师叔,我不要你教了,我出去逼田伯光立誓不可泄漏太 师叔之事就是。”风清扬一怔,已明其理,淡淡的道:“他要是不肯呢?你这就杀了他? ”令狐冲踌躇不答,心想田伯光数次得胜,始终不杀自己,自己又怎能一占上风,却便即 杀他?风清扬道:“你怪我骂你师父,好罢,以后我不提他便是,他叫我师叔,我称他一 声‘小子’,总称得罢?”令狐冲道:“太师叔不骂我恩师,徒孙自是恭聆教诲。”风清 扬微微一笑,道:“倒是我来求你学艺了。”令狐冲躬身道:“徒孙不敢,请太师叔恕罪 。”风清扬指着石壁上华山派剑法的图形,说道:“这些招数,确是本派剑法的绝招,其 中泰半已经失传,连岳……岳……嘿嘿……连你师父也不知道。只是招数虽妙,一招招的 分开来使,终究能给旁人破了……” 令狐冲听到这里,心中一动,隐隐想到了一层剑术的至理,不由得脸现狂喜之色。风 清扬道:“你明白了甚么?说给我听听。”令狐冲道:“太师叔是不是说,要是各招浑成 ,敌人便无法可破?”风清扬点了点头,甚是欢喜,说道:“我原说你资质不错,果然悟 性极高。这些魔教长老……”一面说,一面指着石壁上使棍棒的人形。令狐冲道:“这是 魔教中的长老?”风清扬道:“你不知道么?这十具骸骨,便是魔教十长老了。”说着手 指地下一具骸骨。令狐冲奇道:“怎么这魔教十长老都死在这里?”风清扬道:“再过一 个时辰,田伯光便醒转了,你尽问这些陈年旧事,还有时刻学武功么?”令狐冲道:“是 ,是,请太师叔指点。”风清扬叹了口气,说道:“这些魔教长老,也确都是了不起的聪 明才智之士,竟将五岳剑派中的高招破得如此干净彻底。只不过他们不知道,世上最厉害 的招数,不在武功之中,而是阴谋诡计,机关陷阱。倘若落入了别人巧妙安排的陷阱,凭 你多高明的武功招数,那也全然用不着了……”说着抬起了头,眼光茫然,显是想起了无 数旧事。 May 30 Top Coder Member QuoteThe time you enjoy wasting is not wasted time. -- Bertrand Russell
Life is a lesson you learn it when you are through
Impossible is nothing
Curiouser and curiouser!
the one who wakes up early wants to sleep all day. (opengl)
Go Poland! (tomic)
war doesn't show who's right, just who's left (misof)
I'm not as stupid as you look. (Yarin)
The competent programmer is fully aware of the strictly limited size of his own skull -Dijkstra
In theory, there is no difference between theory and practice. But, in practice, there is.
All my achievements are dedicated to Kate -Egor
Silence and Harmony -haha
You see obstacles only when you take your eyes off the goal
Being in a hurry is a complete waste of time.
Life is hard and then you die. Say less, do more.
The difference between failure and success is doing a thing nearly right and doing a thing exactly right. --Edward Simmons
The difference between failure and success is doing a thing nearly right and doing a thing exactly right. --Edward Simmons Logic is a systematic method of coming to the wrong conclusion with confidence
Hope for best,prepare for worst.
June 04 同桌de你昨晚听了《同桌地你》,感觉好感伤。以前要好得同学,现在都已经不怎么联系了。大家都在考虑做好自己的事,都有自己新的朋友,都在幸福自己的幸福,烦恼自己的烦恼。如果彼此有所联系,也不可能再和往日一样。而且大多就像中学时代本身一样,或许永远的在你的视线中消失了。
|
|
|