2009年8月7日星期五
2008年7月2日星期三
毕业游-北京第一日
话说在那个忙的像狗的早上,妞送我到了机场,然后她不得不就坐了车回去了。 我们都多么想多留对方一下,哪怕是登记前的那短短的几分钟。自己独自推着行李车,换登机牌,在托运行李的时候说我的行李超重5公斤,要交100多块钱。于是我就想自己背着了,那个机场的人看我是穷学生就放了我一马。于是赶快拉着行李去安检了。结果没5分钟就OK了,我还以为要等1个多小时呢。在等飞机的时候,一直和妞保持着电话,在我还没有等到电话的时候,她已经回到了学校。我们都不想挂掉这电话,我们都知道这个联通的免费电话可能只能多大这么一个小时了。
但是时间总是不停止的,到了上飞机的时候了,是自己一个人第一次坐飞机。想坐一个靠窗子的位置,看看成都的天空上面是否是万里无云。可是我那个座位好像不是靠窗户的,于是上机以后就问乘务员换,结果正好有个人晕机,说不要靠窗户的位置可以不,然后空姐笑的很开心的对我们让我们自行调配。昏死,原来坐飞机也和坐火车一样,可以自己商量的换座位(算我孤陋寡闻了)。结果我的那个位置虽然是边上的,结果我旁边正好没有窗户,也不是应急门,就是没有窗户。 不过在飞的时候还是看到了云层之上的那种景色,很漂亮。
下了飞机,我是到北京的南苑机场。一下飞机发现只有我们一辆飞机在机场里, 那个机场的出口和入口都只有一个。大有临时机场的味道。 真的小的可以的。本来以为会在国际机场的,结果完全不是,还说要见识一下首都现在的保安状况呢~结果这个机场就没见什么保安!
出了机场,马上被一群出租车司机围住,被很热情的问来问去。怕了他们了。坐上机场大巴前往西单。路上的时候实验了一下N95的route66 导航系统,还真好用的,不过还是很不准。司机的选路经常让route66晕头转向。不过我更相信司机叔叔一些。
到西单下车,等了大概半个小时,终于等到了王波同学,现在好像比以前更壮了。他带着我走下了西单地铁的入口,结果他掏出一张AFC保障的牌子,直接从小门进去了。然后我刷他的卡进站。新地铁给我的感觉不错,不过真的比以前只有3根线的时候复杂多了。在里面晕头转向的。在地铁里面看到有带着“文明督导员”袖章的人指挥我们排队。还听说公交的文明督导员还要帮忙让你进入,先是把人推进公交,等公交的车门关不到的时候,就直接上脚踹,和他们胳膊上的袖章形成了鲜明的对比。很讽刺啊。
坐了大概1一小时的地铁,我们到了王波住的地方。是一个环境很差,差的很北方的小村村,在北京的5环外了都。
路很泥,还有地方在修房子,不过都是3-4层的自建房,不过自从地震以后就觉得这样的房子很不可靠。
网上和他们宿舍一起的兄弟一起吃了饭之后,就赶快睡觉了。他们睡的确实比较早,不过都是刚出来混,比较不容易吧。晚上查了很晚的资料,关于第二天去什么地方玩得资料,决定去北京的那个欢乐谷去玩。
第二天起来以后,天气还是灰蒙蒙的,要下雨似的,两个人商量了一下决定去别的地方,不去欢乐谷了, 想去离地铁比较近的地方,最后想起了去雍和宫,然后回来的路上去清华大学看看。于是马上上路,今天我没带行李,直接跟在他后边就进入了地铁站的员工通道,感叹北京地铁的便宜啊,两块钱想去哪就去哪?国家拨了大笔的money来支持啊,一般刚拨款以后很快就用完了。玩模拟城市的时候就深刻的体会到了地铁的贵!呵呵。
到了雍和宫,好多好多老外,买了张票以后进去发现这个地方很眼熟,好像以前来北京的时候来过。到了这种地方没有导游我们只是瞎逛,最后只是从地铁的报站里面得到信息——雍和宫是一个喇嘛庙呵呵。老外看的津津有味,我们却显得很无聊,于是决定吃饭然后去清华。
中午吃得杂碎,北京这边叫卤煮。味道和家里的不怎么一样,一点都不辣,很咸。北京的吃的卖的比较贵,不过只是 那些主城区是这样,在我住的地方还是不贵。不想成都是郊区卖的比市区都黑~当然大概只是犀浦镇是这样的吧。
随后乘坐地铁赶赴清华,坐车迷迷糊糊的到了清华科技园的门口,但是却找不到清华的门。忽然王波说那是google的大楼,激动啊~赶快到google的门口照了张相,自己就不照进去了,等以后如果能进去再照~呵呵。于是非常羡慕+嫉妒清华的同学们,门口就这么多NB公司,太方便了。还看到sohu的公司等~没怎么激动,穿过了一个复杂的长廊,来到了清华西门的门口,进去以后发现自行车很多,不过从这个门出来的大多数都是汽车,这个门出去便可以到中关村的嘛~
具体怎么转悠的就不多说了,说说自己对清华的感受吧。
- 自行车多,对自行车的支持也好,每个宿舍楼的1楼都是自行车的车棚,那样自行车被偷的状况应该会下降许多把。
- 毕业捐衣服,这应该是他们社团办的一个活动,但是看到他们在车棚里面一件一件的检查每一件衣服的情况觉得确实做事很细心。其实我们做事也可以这么细心的。
- 建筑很有特色,我说的是新建的那些建筑。宿舍楼都建的很有波浪曲线,大概是某研究生的项目吧~呵呵
- 像公园一样的大学,清华有很多的绿地和公园,荷花池我都见了3个,还养着几只孔雀,里面还有几只白孔雀。出门的时候看见某同学拿着好几根在白孔雀的羽毛。汗!
- 旅游的人多。。。
2008年2月20日星期三
2007年11月23日星期五
动态库编译方法[转]
gcc x.c y.c z.c -fPIC -shared -o libtest.so
# 将main.c和动态连接库进行连接生成可执行文件
gcc main.c -L. -ltest -o main
# 输出LD_LIBRARY_PATH环境变量,一边动态库装载器能够找到需要的动态库
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
# 测试是否动态连接,如果列出libtest.so,那么应该是连接正常了
ldd main
# 执行就不用说了吧
--------------------------------------------------
建议创建一个Makefile来作这些事情。
-fPIC:表示编译为位置独立的代码,不用此选项的话编译后的代码是位置相关的所以动态载入时是通过代码拷贝的方式来满足不同进程的需要,而不能达到真正代码段共享的目的。
-L.:表示要连接的库在当前目录中
-ltest:编译器查找动态连接库时有隐含的命名规则,即在给出的名字前面加上lib,后面加上.so来确定库的名称
LD_LIBRARY_PATH:这个环境变量指示动态连接器可以装载动态库的路径。
当然如果有root权限的话,可以修改/etc/ld.so.conf文件,然后调用
/sbin/ldconfig来达到同样的目的,不过如果没有root权限,那么只能采用输出LD_LIBRARY_PATH的方法了。
2007年10月2日星期二
2007年9月28日星期五
N70,竟然不提示短信
基本没有删除过,除了一些没意义的。
可是今天竟然短信来了不提示了,
搞了半天,格式化什么都试过了,
格式化以后是好了,
可是把备份的短信和一些其他东西弄回去以后
问题又出现了。
郁闷了好长时间,
忽然想到了把收件箱里的东西移动到自己的文件夹里面
行不行,试过以后还是不行,
恢复一下出厂设置, YEAH,
问题解决。OK了,哈哈, 好高兴。
今天还把我的移动心机给刷成了大陆行货。OKOK啦。~
终于告别丑陋的移动图标了, 速度也快了不少。
2007年9月21日星期五
2007年9月4日星期二
LDD第一个例子运行成功!
太高兴了,在经过了无数次莫名其妙的失败以后,终于搞定了内核模块~
哈哈哈哈~~~
大家不要笑我哈,高兴是很正常的~
总结经验, 主要是准备工作没有做好,
1. 要下载linux-kernel-src , 然后 make all
2.make modules_install 把你的模块文件放到 /lib/modules/linux-XX-XX中
最后把源文件中的 /linux/config.h去掉,
然后把makefile中的 uname -r 换成 /lib/modules/linux-XX-XX 就OK了。。。
呵呵。。。可以开始研究kernel device driver 了。
--
Shit happens!
2007年8月31日星期五
走了,实习结束了
自由了,
--
Shit happens!
2007年8月30日星期四
10 Rules of programming
By Malcolm McLean
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以后一般都会有加班费,你可以跟司机说,不收加班费。司机一般都会同意。
2007年4月14日星期六
我,过敏?不是麻木吗?
后来医生推荐我做一个叫生物共振的检查,说是德国引进的设备.先进...汗...一次检查要400,以后治疗一次200...治疗5次一个疗程,医生说4 -5次就能治好,看他那么心虚.一定需要很多次吧...
最后上网一查....又是科学骗局.昏倒...这是链接< /a>....
后来在去锦里的路上,我想起了灌灌的宝贝说的那些话,说我麻木,etc,还记得19岁那个未眠的生日...那天以后对我改变很多,在很多方面吧,甚至有些细微到无法察觉.
我这个麻木的人现在敏感到这个程度...昏倒了,不过说实在的,自那次之后,就让自己变的稍微敏感一点,结果就敏感成这样了...当然我在谈的也不完全是病...
做回自己吧,活着,舒服些好...