Skip to main content

Posts

Showing posts from November 4, 2012

Distinguish between pointers and references.

Item 1: Distinguish between pointers and references. Pointers and references look different enough (pointers use the "*" and "->" operators, references use "."), but they seem to do similar things. Both pointers and references let you refer to other objects indirectly. How, then, do you decide when to use one and not the other? First, recognize that there is no such thing as a null reference. A reference must always refer to some object. As a result, if you have a variable whose purpose is to refer to another object, but it is possible that there might not be an object to refer to, you should make the variable a pointer, because then you can set it to null. On the other hand, if the variable must always refer to an object, i.e., if your design does not allow for the possibility that the variable is null, you should probably make the variable a reference. "But wait," you wonder, "what about underhandedness like this?" char *pc = 0; c...

姚新宇律师: 关于奥巴马连任对在美华人的影响

姚新宇律师: 关于奥巴马连任对在美华人的影响 作者:姚新宇律师     发文时间: 2012年11月09日 22:18:19  http://www.mitbbs.com/ym_article/yaolaw/165.html 首先声明,这篇文章完全是我个人的看法,和我做律师业务没有关系。请大家理性看待。 奥巴马成功连任,值得祝贺,虽然在加州那一票没什么用,但还是表达了自己的支持, 晚上还喝了瓶啤酒。这本来是自己的私人事情。 但最近看到,有些人在大面积的攻击 虽然,现在年末快过节了,案子非常忙,我还是简单表达一下个人看法。 我认为, 奥巴马成功连任对在美华人无疑有很大好处。 1。健保法案 奥巴马推动的全民健保法案本来是美国社会发展的一大进步, 但共和党罗姆尼却极力反对,扬言一旦当选,就要废除。 生病看医生,就和吃饭一样,是人类社会最基本的生存需要,并不像私人飞机,游艇那 样的奢侈品。 不管穷人富人,谁也不想生病,但谁都会生病。就需要看医生。 稍微对美国有点基本常识的人都知道,美国的医疗保险制度是怎样一回事。 来美国已经十几年了,这个国家当然有各种各样的问题,如现在的 FISCAL CLIFF, 但就其各方面的制度而言,在 PLANET EARTH 上已经是最好的了。 纠纷出现时,旧金山市政府可以起诉加州州政府,联邦政府需要去法院起诉亚利桑那州 政府。 石家庄市政府敢起诉河北省政府么?国务院用的着起诉山东省政府么? 但唯一的例外就是美国的医疗保险制度,医疗帐单张口就来,能蒙就蒙,能骗就骗。 奥巴马的健保法案不是完美的,但共和党又拿不出自己的方案,只说如果当选就会废掉。 假如共和党拿出一个自己的方案,这次选举结果会可能不一样。 维持现状肯定是不行的。 2。移民 现在人们有一个很普遍的 MYTH, 就是共和党支持合法移民,民主党支持非法移民。 其实是不对的,绝大部分保守的共和党反对移民,不论是非法还是合法。 大家都知道,人们常说的移民问题,主要是指非法移民,因为合法移民所占比例太小了。 很多人都忽略不计。 知道这一点, 就会明白,为什么 NSC 比 TSC 难很多。 还有,奥巴马连任,综合移民改革势在必行。共...

C++ References

C++ references allow you to create a second name for the a variable that you can use to read or modify the original data stored in that variable. While this may not sound appealing at first, what this means is that when you declare a reference and assign it a variable, it will allow you to treat the reference exactly as though it were the original variable for the purpose of accessing and modifying the value of the original variable--even if the second name (the reference) is located within a different scope. This means, for instance, that if you make your function arguments references, and you will effectively have a way to change the original data passed into the function. This is quite different from how C++ normally works, where you have arguments to a function copied into new variables. It also allows you to dramatically reduce the amount of copying that takes place behind the scenes, both with functions and in other areas of C++, like catch clauses. Basic Syntax Declaring a vari...

真不觉得phd强到哪里去

发信人: Dreamer (不要问我从哪里来), 信区: Dreamer 标  题: Re: 真不觉得phd强到哪里去 发信站: BBS 未名空间站 (Sat Nov  3 14:56:15 2012, 美东) 【 在 Dreamer (不要问我从哪里来) 的大作中提到: 】 : 研究部门大多都是一个大phd带一群小phd,然后每个小phd带一队SDE做事情。不仅限于 : CS,制造行业也是,比如长安,长虹也都是这些。 唉。。。侬去各大公司看看管理层的背景就知道了。 PhD很少的,即便是CTO职位。 英雄不问学历,美国做的不错。 就不说顶级管理层,你去linkedin上看看一般经理的背景,就更能知道这一点了。 phd带小phd,再带sde,听起来好像不错, 可这种架构的科技公司都死很惨:柯达,微软,原来的贝尔实验室,惠普,太多了。 微软有研究院,标标准准你说的这种架构,多少年来扔了无数钱, 产出只有paper,paper,paper,对微软没有任何帮助,所有有点意义的新产品都是后 来收购的。 盖茨自己都说,微软研究院是个给学术界的福利。福利,就是养着的意思,不指望什么。 版上有人鄙视google。可说实话,现在也就Google这类新公司不再上这个当了, 只有很少的纯research人员,phd来了也要面对产品, 这才慢慢有了些不错的新东西。 做出来map reduce, dremel,F1等大规模计算的东西,捎带手的发了好几个paper, demo都把学术界的人给震了。可看第一二三作者,都是多年工作的小本或master工程师 而已。 哥做interview这么多年,区分好的phd面试者很容易:一看能多快速度写code;二看多 快能formulate一个新问题。 我猜例外就是制药行业,我觉得可能必须是phd才能lead, 因为病毒什么的恐怕要很深的研究才能理解。 其他的如军工,金融,造船,建筑,跟科技公司差不多。 --

在US读CS的Phd真要5-6年,每周60-80工作小时

发信人: SuperCary (Cary), 信区: CS 标  题: 在US读CS的Phd真要5-6年,每周60-80工作小时? 关键字: 读书,phd,cs,gre,toefl 发信站: BBS 未名空间站 (Sun Mar 25 02:11:40 2012, 美东) 先说说自己的基本情况。我是国内985高校的CS的master,毕业已经四五年了,一直在外企从事软件开发工作。打算考GRE和TOEFL,读一个master或者phd(考察中),希望拿到学位能留在US工作。 在UCI一个prof的主页上看到下面的要求。看完后有点悲催了。一方面是觉得人家人家教授知道咱的动机,另一方面是对研究生的要求感觉非常高,最后就是 对自己今后的人生充满迷茫。不知道US的master和phd,自己一个马上奔三的人能否坚持下来。或许,自己一直是一个人的缘故,不喜欢目前太稳定的工 作,总觉得这辈子就这么过去了没意思。可能如果我已经建立了家庭,或许就不会想着继续上学(离开中国)。其实自己是个喜欢研究技术的人,一方面总感觉专业 上有那么多东西需要学习,但是时间实在有限;另一方面总逃不开外界(社会风气以及自己的圈子)对自己的影响,无法很专注的投入,担心自己的生活没有物质保 障。 一句话,搞不清自己,加上父母反对。迷茫,焦虑,崩溃。 Quote: Be Passionate: Getting a Ph.D. shouldn't only be about immigrating into the United States — yet for many of our applicants, that appears to be the prime motivation. Ask yourself: does the area that I am applying for really interest me sufficiently that I want to be spending 5-6 years working in it, 60-80 hours a week? Successfully completing your Ph.D. requires an enormous amount of self-motivation. The dir...

关于博士在读期间申请opt-h1b的问题

发信人: xuanliang (盘亮条顺), 信区: JobHunting 标  题: 关于博士在读期间申请opt-h1b的问题 发信站: BBS 未名空间站 (Thu Nov  8 14:46:03 2012, 美东) 我现在是PhD第四年,得到一个公司的full time job offer,明年1月开始,学校也同 意我一边工作一边写论文。 现在的问题是,我该如何申请身份?我本来提出pre-completion OPT直到2013年10月份 H1B生效;但是HR回复的意思是,博士没有毕业前,申请的H1B是无效的。 那么这样的话,我是不是应该先用CPT工作(只能拿intern的工资),用完了再接pre- completion OPT,直到2014年5月毕业? 有人遇到过这种情况吗?非常感谢! --

看大选结果谈面试感言

本来想在大选前写这篇小杂文。 但是不想影响大家的投票, 毕竟咱是谈找工, 不是谈大选。 所以, 马后放一炮。 谈谈感想。 从职场角度来说, 这是当今世界上公开应聘的最高职位。 过程复杂, 规模宏大。 奥8干过四年, 有了本职位的工作经验。 占先。老罗的经历, 差一大节。 最炫耀的本事是能做到财政平衡。 拜托, 治理国家不仅仅是财政平衡吧? 这比您敲敲算盘复杂得海了去了。 财政平衡不是治理好家国的必要条件和充份条件吧? 奥8四年中取得的成绩有目共睹, 实打实的, 靠数字来说话。占先。 说老奥没把经济治理好。 这实在是不公平。 想想看, 这次大衰退是1929年以来最严重的。 想让它恢复不是件容易的事儿吧? 这是常识。 稍微有些经济学知识的人都会知道, 经济本身是有其规律的。 神仙也得顺从这个规律。 想四年来个翻天覆地, 就是把老毛“人定胜天”的口号喊破天也没戏。 指责奥 8? 站着说话不腰疼。换他们来? 就冲着把小克时的财政盈余打成财政赤字这种本事, 拉倒吧! 这个国家不是总统一个人在治理的。 是内阁,议会,各州政府在治理。在当今世界中, 国际经济大环境对某一国家在某一时期的经济的影响也是不容忽视的。另外, 在奥8的团队玩儿命干时,老罗的政党在议会中撤梯子挖墙角的事儿没少干。 反过来指责人家不能干, 干不好。 不厚道吧? 奥8 对今后的施政方针提得明确,具体, 有血有肉。 让人觉得实在, 可行。 老罗, 基本上在吹牛。 玩虚的。 而且, 前后不一, 列出的数字对不上帐。 这也太不靠谱了。庙堂之事, 启可儿戏? 奥8草根要出身, 他和他的政党代表中,下层人民的利益。 老罗, 正而八经的高富帅。 他和他的政党代表的是富人及上中产阶级的利益。现在的经济形势下, 自然是奥8 的阵营人多。奥8深刻了解这些东家需要的是什么, 而且成功地说服了他们。 这不,结果是明摆着的。 形象与表现方面。 老罗虽然是典型的高富帅, 但是没有领袖气质。上台演讲时的小碎步, 看人时的小媚眼儿是明显的无领袖气质的表现。 反观奥8, 阔步昂首及坚定的眼神给人以人自信和刚毅的感觉。 说实话, 第三次辩论时, 到最后, 老罗都有点带哭相了。那时真有点可怜他, 生怕这位老哥哭出声来 (开句玩笑了)。 这是一个很好的 c...

人为什么而活着?

每个人或多或少都想过,或许这个问题偶尔在你的脑海中掠过,或许它将困绕你的整个 人生,或许它总是在你不如意时常常浮现在心头……但我可以肯定地说,小孩子是不会 问这个问题的,小孩子是最接近自然的,他们哭就哭,象下雨打雷,酣畅淋漓;笑就笑 ,如朝阳升起,光芒四射!他们哭着哭着,可以马上又笑起来,但这不是演员的表情剧 ,孩子们的表情变化是真率的、真实的,不掺半点的表演造作的成分,他们的喜怒哀乐 都是那么的美丽――天然去雕饰!因为自然的东西,是最为美丽的!当小孩子有一天突 然在想突然在问:我为什么而活着时,那是因为他们“成熟”了,或是长大成“人”了 ,他们从此就由“自然”的一分子进入了“人”的行列了。 人,不是“自然”的,因为自然的,是不会问为什么活着的。你说,一棵树静静地生长 为什么,一朵花娇艳地开着为什么,一滴雨悄悄地落下为什么,一只鸟飞翔鸣叫为什么 ……问这些问题的是人!人是社会的,社会是名利高度聚集的“红尘”之地,很自然的 一个小孩子进入其中,通过社会性的生活与教育影响之后就会越来越“懂事”了,他知 道了贫富、苦乐、 尊卑等的对比,知道了竞争,知道了压力,于是天真的单纯的自然 本性就被“加工”成了“有理想”的人了。是的,人为什么而活着?就是为“理想”而 活着!每个人有每个人的“理想”:或为金钱财富,或为吃喝玩乐,或为学业事业有成 ,或为家庭望子成龙望女成风,或为博得名声载入史册,或为帮助别人博爱天下等等, 无论“理想”怎样千姿百态,归根结底其本质不外乎让自己活得更充实、幸福、快乐! 然而什么是“幸福”,什么是“快乐”,却是一个人一个样,当你非常口渴时,喝口开 水也将感觉快乐;当你很饥饿时,没有菜吃饭也能津津有味;当你生了胃病时,哪怕面 对山珍海味也毫无兴趣了;当你身着名牌西装,可感冒发烧时同样难受;当你身拥百万 财富,而子女没有出息你也一样苦恼不已;当一个三轮车夫每一天能挣四五十块钱时, 哪怕辛苦他也知足,而一个网吧老板每天收入要是四五百块钱,那他将是忧心忡忡,坐 立不安了……从中我们不难看见,幸福和快乐是暂时性的相对性的对比性的,它的存在 频率与一个人的欲望高与低、多与少息息相关――一个皇帝的幸福与快乐并不比一个农 民多!现在,不妨回头看看,每个人的“理想”其实就是种种的“欲望”,说自己将来 要怎样怎样如何如何...

中国留学生,为什么在北美找工作如此困难?

    我们是四大的经济金融分析资讯方面的工作,业务面很广,工作性质面对客户,要求极强的听说读写能力,和专业技能 ( 税务,财务,金融,经济,编程,数学 ) 。 ************ 上周四参加了一整天的新员工面试。全公司来了上百人。我们小组从三个学校的校园面试中筛选了十个学生,最终选三个。因为小组业务面临一些转型,这次面试要招收一些技术背景相对较强的学生。 我也参与了筛选简历,挑选学校面试这个环节的候选人。有一个当地不错的大学,发上来的简历80%是中国人,都是国内一流名牌大学毕业生,在这个学校学习金融或者经济硕士,都有非常强的数学和编程技能。通过看简历,我筛选了好几个中国人参加校园面试。 我老板去面试,他回来说中国学生英语不过关,他听不太清楚,也担心将来参加工作以 后社交方面的挑战。有一个中国女孩子表达不错,但是老板跟反复跟她说我们做的事情是A,她总是说她感兴趣做B。最后老板还是选了一个中国男生来参加公司面 试,让我看看怎么样,至少这个男生参加了toast master international 国际演讲协会。 这次面试整体让人感觉满意,终于我们找到了几个背景非常强的学生,而且看起来上进肯干的孩子。有一个西班牙女孩 5 年攻读四个本科学位 - 机械工程和商业两个大专业,另外还有能源和法语两个小专业。面试的时候言语间充满了能量,期望能在工作中得到挑战和机遇。 她说如果工作没有挑战,她很快就觉得没有意思了。 后来面试中国学生的时候,10分钟过去了,我就知道这个孩子没有机会。我开始给他做一些指导: 1) 这个男孩子就像背书一样。说话面无表情。后来同事说听不清楚他说话。说话时面部要有表情,语调抑扬顿挫,可以夹带手势。 2) 问到职业发展的时候, 他说就想找一份工作好好学习提高。 要表现出自己的职业规划。 我们在寻找能够帮助公司创造飞来的人,不光是一个技术工人。 我跟他 说我明白刚刚来到美国很不容易,不仅要应付学业,还有社交,语言。不过,我们有什么选择呢? 我们中国留学生最不介意的就是刻苦工作,在面试上是一个道理,准备,准备,再准备;练习,练习,再练习。我们总以为先生存下来再求发展,其实这是下策的想 法...

What if money was no object?

Configuration files for shells

Shells read configuration files on multiple circumstances which differ depending on the shell. These files usually contain commands for that particular shell and are executed when loaded. These files are usually used to set important variables like $PATH used to find executables, and others that control the behavior and appearance of the shell. This table shows the configuration files for popular shells: sh ksh csh tcsh bash zsh /etc/.login login login /etc/csh.cshrc yes yes /etc/csh.login login login ~/.tcshrc yes ~/.cshrc yes yes [4] $ENV (typically ~/.kshrc) [5] yes ~/.login login login ~/.logout login login /etc/profile login login login login ~/.profile login login login [6] login ~/.bash_profile login [6] ~/.bash_login login [6] ~/.bash_logout login ~/.bashrc int.+n/login /etc/zshenv yes /etc/zprofile login /etc/zshr...

Unix shell

A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems. Users direct the operation of the computer by entering commands as text for a command line interpreter to execute or by creating text scripts of one or more such commands. The most influential Unix shells have been the Bourne shell and the C shell. The Bourne shell, sh, was written by Stephen Bourne at AT&T as the original Unix command line interpreter; it introduced the basic features common to all the Unix shells, including piping, here documents, command substitution, variables, control structures for condition-testing and looping and filename wildcarding. The language, including the use of a reversed keyword to mark the end of a block, was influenced by ALGOL 68.[1] The C shell, csh, was written by Bill Joy while a graduate student at University of California, Berkeley. The language, including the control structures and the exp...

Shell Expansion

One small complication when running programs from within a shell is that the shell will sometimes substitute a pattern for a set of arguments. For example, consider this run in the Bash shell: $ ./command.py *.txt You might expect the following output: Executable: ./command.py Arg: *.txt but this isn't what you get. Instead the output depends on the number of .txt files in the current working directory. When I run it I get this: Executable: ./command.py Arg: errors.txt Arg: new.txt Arg: output.txt The Bash shell substitutes the *.txt command for the filenames of all the .txt files in the current directory so your program recieves more arguments than you might have expected. You can disable shell expansion by quoting the argument, but actually most of the time it is a very useful feature once you are aware of it. $ ./command.py "*.txt" Executable: ./command.py Arg: *.txt

Understanding sys.argv

If you are writing a Python program to accept command line arguments, the arguments passed on the command line are accessed as sys.argv . Here's a simple example, save it as command.py : #!/usr/bin/env python if __name__ == '__main__': import sys print "Executable: %s"%sys.argv[0] for arg in sys.argv[1:]: print "Arg: %s"%arg The if __name__ == '__main__': line ensures the code beneath it only gets run if the file is executed, not if it is imported. Make this file executable: $ chmod 755 command.py Here are some examples of this being run: $ python command.py Executable: command.py $ python command.py arg1 Executable: command.py Arg: arg1 $ python command.py arg1 arg2 Executable: command.py Arg: arg1 Arg: arg2 Notice that sys.argv[0] always contains the name of the script which was executed, regardless of how Python was invoked. sys.argv[1] and onward are the command line arguments. You can also invoke the program...

Reading from Standard Output and Standard Error

When you run programs with Popen, output is just sent to stdout as usual which is why you've been able to see the output from all the examples to far. If you want to be able to read the standard output from a program you have to set the stdout argument in the initial call to Popen to specify that a pipe should be opened to the process. The special value you set is subprocess.PIPE: subprocess.PIPE     Special value that can be used as the stdin, stdout or stderr argument to Popen and indicates that a pipe to the standard stream should be opened. Here's an example: >>> process = subprocess.Popen(['echo', 'Hello World!'], shell=False, stdout=subprocess.PIPE) To read the output from the pipe you use the communicate() method: >>> print process.communicate() ('Hello World!\n', None) The value returned from a call to communicate() is a tuple with two values, the first is the data from stdout and the second is the data from stderr. Here's...

Strings or Argument Lists

While it is handy to be able to execute commands pretty much as you would on the command line, you often need to pass variables from Python to the commands you are using. Let's say we wanted to re-write this function to use echo: def print_string(string):     print string You might do this: def print_string(string):     subprocess.Popen('echo "%s"'%string, shell=True) This will work fine for the string Hello World!: >>> print_string('Hello world!') Hello world! But not for this: >>> print_string('nasty " example') /bin/sh: Syntax error: Unterminated quoted string The command being executed is echo "nasty " example" and as you can see, there is a problem with the escaping. One approach is to deal with the escaping in your code but this can be cumbersome because you have to deal with all the possible escape characters, spaces etc. Python can handle it for you but you have to avoid using the shell. Let's look...

Using the Shell

Let's start with a simple example and run the Hello World! example in the same way as before, passing the command though the shell: >>> import subprocess >>> subprocess.Popen('echo "Hello world!"', shell=True) Hello world! As you can see, this prints Hello world! to the standard output as before but the interactive console also displays that we have created an instance of the subprocess.Popen class. If you save this as process_test.py and execute it on the command line you get the same result: $ python process_test.py Hello world! So far so good. You might we wondering which shell is being used. On Unix, the default shell is /bin/sh. On Windows, the default shell is specified by the COMSPEC environment variable. When you specify shell=True you can customise the shell to use with the executable argument. >>> subprocess.Popen('echo "Hello world!"', shell=True, executable="/bin/bash") Hello world! This example w...

Here Documents

Most shells, including Bash support here documents which enable you to embed text as part of a command using the << operator and some text to use as a delimiter. In the following example, text is passed to the tr command using a here document and END_TEXT as the delimiting identifier which specifies the start and end of the here document. $ tr a-z A-Z < > one two three > uno dos tres > END_TEXT ONE TWO THREE UNO DOS TRES The output lines produced from tr after execution are ONE TWO THREE and UNO DOS TRES. A common use of here documents is to add text to a file. By default variables and also commands in backticks are evaluated: $ cat << EOF > Working dir $PWD > EOF Working dir /home/user This can be disabled by setting the label in the command line in single or double quotes: $ cat << "EOF" > Working dir $PWD > EOF Working dir $PWD

Chained pipelines

The redirection and piping tokens can be chained together to create complex commands. For example: ls | grep '\.sh' | sort > shlist lists the contents of the current directory, where this output is filtered to only contain lines which contain .sh, sort this resultant output lexicographically, and place the final output in shlist. This type of construction is used very commonly in shell scripts and batch files.

Redirecting Standard Input and Standard Output to and from the Standard File Handles

As well as redirecting the stadard output, you can also redirect other streams, for example to send the standard error data to standard output. In Bash the >, < and >> operators we've already discussed can also be prefixed by the file descriptor (remeber the numbers 0, 1 and 2 in the table earlier) to redirect that stream. If the number is omitted it is assumed to be 1 for the standard output which is why the commands we've used so far work. This command executes program1 and send's any data it writes to standard error to file1. program1 2> file1 executes program1, directing the standard error stream to file1. Here's an example program you can use to test it. Save it as redirect1.py: import sys while 1:     try:         input = sys.stdin.readline()         if input:             sys.stdout.write('Echo to stdout: %s'%input)  ...

Piping

Piping allows the standard output from one program to be fed directly into the standard input of another without the need for a temporary file: $ program1 | program2 The | character is known as the pipe character and so this process is known as piping. Here's an example of piping the output from find . (which recursively prints the paths of the files and directores in the current directory) into the grep program to find just a particular file: find . | grep "The file I'm after.txt" Data from the first program is piped into the second program line by line so the first program doesn't have to finsih before the second program can start using it.

Redirecting Standard input and Standard Output to Files

You can redirect the standard output from a program to a file using the shell operator > in Bash (other shells may have slightly different syntax). Here's an example: $ program1 > file1 This results in program1 being executed and its standard output stream being written to file1, replacing any existing data in file1. If you'd wanted to append data to the end of the file instead you could use the shell operator >> in Bash: $ program1 >> file1 The shell operator < can be used to read data from a file and send it to the standard input stream of a program: $ program1 < file1 Again, program1 is executed but this time file1 is the source of the data for standard input instead of the keybaord. You can actually combine shell operators to achieve more sophisticated results. In the example below program1 is executed and data from file1 is sent to its standard input. The standard output from running program1 with the input from file1 is then written to file2: $ pr...

学什么语言的问题(java/c/c++/python/php/ruby)其实很简单

发信人: jym2307 (罪魁), 信区: JobHunting 标  题: 学什么语言的问题(java/c/c++/python/php/ruby)其实很简单 发信站: BBS 未名空间站 (Sat Nov  3 02:59:51 2012, 美东) 第一,去linkedin上按照语言关键字搜索,看看你要的地区,哪种语言提供的工作机会 多,级别高。例如,你可以搜索湾区50miles以内,java的职位有多少,c/c++和php的 有多少。不仅要看多少,还要看职位的级别和待遇。software engineer < sr < staff < principal。QA < QE = UI/Front < ServerSide Engineer 第二,看你的兴趣和将来的职业发展。想做通信和系统底层的,学c/c++。想做 enterprise software,尤其是应用/商用软件的,学java。想快速搭建网站的,想做UI 的,学php/ruby/javascript。每个领域都有其独特的技术需求。 第三,语言是不是相通的? 是相通的,但你必须要起码精通一门。目前来看,一般来说,最好在这几个语言中精通 一个:java/c.c++/python/php。虽然每年都有一些新的语言冒出来,例如scala之类的 ,但是想要代替主流语言,还是需要好几年的。虽说语言的语法是类似的,但是如果做 到熟练,那不写一年的代码恐怕很难做到“熟练”吧。 除此之外,每个语言都有自己的library和framework。就说java吧,随手一拎就是一大 堆: tomcat,log4j,junit,testng,ant,maven,apache common,apache http,jdbc,xml parser,json parser,annotation,injection, 还有hadoop那一大大大大堆东西 没有个2-4年,而且找到了一个巨能锻炼学习的职位,很难说是熟练java吧?语法只能 是一个语言最最基本的东西 结论:技术积累要和职业发展结合起来,知识面要广,但在有些领域要做精。好在美国 做码工可以做到四五十岁,能慢慢折腾。

What Happens When you Execute a Command?

When you click on the Terminal icon on your Desktop you are loading a program which in turn loads a shell. The commands you write are not executed directly by the kernel but are first interpreted by the shell.     Command      (eg. `ls -l')        ↓ Terminal Program (eg. `gnome-terminal')        ↓      Shell       (eg Bash)        ↓      Kernel      (eg. Linux 2.6.24) More information about shells:     http://en.wikipedia.org/wiki/Unix_shell More information about how processes are actually started:     http://pangea.stanford.edu/computerinfo/unix/shell/processes/processes.html When you execute a program from Python you can choose to execute it directly with the kernel or via a shell. If you are executing it directly you won't be able ...

Hey Jimmy Kimmel, I told My Kids I Ate All Their Halloween Candy Again

韩红---天路

Obama Wins the 2012 Election: Obama's Complete Presidential Victory Speech

OOP Features

Encapsulation Enforces Modularity     Encapsulation refers to the creation of self-contained modules that bind processing functions to the data. These user-defined data types are called "classes," and one instance of a class is an "object." For example, in a payroll system, a class could be Manager, and Pat and Jan could be two instances (two objects) of the Manager class. Encapsulation ensures good code modularity, which keeps routines separate and less prone to conflict with each other. Inheritance Passes "Knowledge" Down     Classes are created in hierarchies, and inheritance allows the structure and methods in one class to be passed down the hierarchy. That means less programming is required when adding functions to complex systems. If a step is added at the bottom of a hierarchy, then only the processing and data associated with that unique step needs to be added. Everything else about that step is inherited. The ability to reuse existing objects is ...

发篇荔枝帖---其实幸运是一种能力

山中伸弥刚刚得了诺贝尔生理学医学奖。 2006年他在Cell上发了个特别NB的paper之后,国内外所有奖都得遍了。 要是科学界也有大满贯一说的话,他就是。 这位大叔是个励志版。 其实也不是特别大叔,50岁,跟他一起得奖的John B. Gurdon爵士相比,至少还有20年 的奔头。神户大学本科,大阪市立大学博士,写在简历上其实挺一般,或者说是特别一 般的。 有人问日本NB的医学生在哪?东京大学理科三系呀!!! 他本科毕业做过实习医生,而且是整形医生。 博士毕业以后他去了美国做博后,UCSF的Gladstone研究所,这才是他人生轨迹的转变。 他彻底改行做病理了。 后来回国,他很悲催的搞不到科研经费,研究停滞,直到去了奈良先端科学技术大学院 大学(据说这学校很好),一发不可收拾,升了教授,研究大有前途,直接被京都大学 挖走了。 话说他发大牛paper的时候在京大才两年,虽然京大很NB,但在这件事情上绝对是学校 跟着他沾光。那之后就是得奖,各种得奖。 这个大叔的经历告诉我们: 1. 不管你的简历有多难看,你都有机会变成大牛; 2. 不管你是干什么的,你都可以改行而且变成大牛;--这个版上大牛Niggy就是现实版 3. 不管你多大岁数,你都来得及变身成为大牛; 同时你需要神马? 1。相信自己能变成大牛 2。想法(在别人都试图分离干细胞的时候,他试图把成熟细胞再转回干细胞) 3。行动(废话) 都说Fortune is kind of ability.幸运是一种能力,就是这个道理。

Multiple inheritance

Multiple inheritance is a feature of some object-oriented computer programming languages in which a class can inherit characteristics and features from more than one superclass. It is distinct to single inheritance, where a class may only inherit from one particular superclass. Languages that support multiple inheritance include C++, Common Lisp via the Common Lisp Object System, Perl and Python. Multiple inheritance has been a touchy issue for many years, with opponents pointing to its increased complexity and ambiguity in situations such as the "diamond problem", where it may be ambiguous as to which superclass a particular feature is inherited from if more than one superclass implements said feature. This can be addressed in various ways, including using virtual inheritance. Details In object-oriented programming (OOP), inheritance describes a relationship between two types, or classes, of objects in which one is said to be a subtype or child of the other. The child inher...

Inline Functions in C++

By Alex Allain Although you've already learned about basic functions in c++, there is more: the inline function. Inline functions are not always important, but it is good to understand them. The basic idea is to save time at a cost in space. Inline functions are a lot like a placeholder. Once you define an inline function, using the 'inline' keyword, whenever you call that function the compiler will replace the function call with the actual code from the function. How does this make the program go faster? Simple, function calls are simply more time consuming than writing all of the code without functions. To go through your program and replace a function you have used 100 times with the code from the function would be time consuming not too bright. Of course, by using the inline function to replace the function calls with code you will also greatly increase the size of your program. Using the inline keyword is simple, just put it before the name of a function. Then, when y...

原题:独立思考,规划未来,建立正确求学理念 作者:郭晏均

高燕定按语:从我的博客上,大家对郭晏均已经有了一定的了解。她毕业的那天,我请她为中国的莘莘学子写篇文章,讲述她在求学道路上的思考和经验,给后来者 以借鉴。毕业典礼之后,她与父母一起穿梭于美国各地度假,在繁忙的旅途中写下了这篇长文。我相信,这篇文章不仅对于即将出国留学的学生具有很大的参考价 值,对于即将在中国上学的大一新生、在读大学生以及高中生,也都具有一定的指导意义。我很感谢她用这篇文章,帮助我为很多给我来信的家长和学生解答了很多 问题。 2001年夏天,我从深圳实验中学只身来到美国参加哈佛大学的暑期教程,修大学一年级化学。一晃五年,我站在毕业典礼颁奖台上以电子工程专业,数学和化学 两个副专业的“学校荣誉”毕业(University Honors),获工学院学者称号(Engineering Scholars), 并是工学院两名最佳毕业生之一。我即将加入花旗公司投资银行部,开始在曼哈顿做分析师的新生活。在此,回首五年异国他乡作为小留学生的经历和父母教导的一 些人生理念,只希望这篇文章可以为后来的学弟妹们在为未来奋斗的征途上激发一些灵感。 大学时期,是人生很重要的一个阶段。对于我来说,是发掘自己潜能,兴趣爱好和建立事业开端的阶段。我花了非常多的时间去思考去定位自己最终的人生价值:我 这一生要成就什么才能最开心最满足,我要怎么做才能达到这个目的?人生的目标定了,就不容易随波逐流,人云亦云,就会踏踏实实一步一个脚印地打造自己的背 景,就会独立思考,有意识有主见地做每一件事。大学仅有四年,毕业的时候,你会准备好迎接未来事业上的挑战吗?进了大学就好比从零开始,有些人四年之内打 造出一份傲人的简历,找到满意的工作或者在学科研究上小有成就。而对于有些人来说,毕业等于失业,四年以后才感觉到茫然无措。许多中国的父母都叮嘱孩子要 好好读书将来考上好大学,可是考上以后呢?大学仅仅是人生的开始,不是终结。 大学四年最重要的一件事,或许是专业的选择了。从小到大,我的兴趣就很广泛,发掘和领悟世界的各个层面对我来说是很有意思的事情。我希望,暮年之时,有能 力研究天文和物理,梦想能够坐宇宙飞船上太空,希望能有时间有能力创作视觉和听觉方面的艺术作品,更希望在没老的时候能为中国的教育事业做出自己的贡献。 如何实现自己的梦想呢?母亲说,路要从宽往窄走。大一的我曾经是化学专业,曾经要转行...

中年大叔也想改行做DBA, 也请大牛指

发信人: sayes (功不唐捐), 信区: Database 标  题: Re: [BSSD]中年大叔也想改行做DBA, 也请大牛指点. 发信站: BBS 未名空间站 (Tue Apr  3 23:49:32 2012, 美东) DBA 也是需要做code的,一个stored procedure可能会把你调试的吐血的。 如果你对这个一点兴趣都没有,我建议你放弃DBA了。还不如去考个证书,当中学数学 老师 算了,美国缺数学老师。美国这边的学校,数学老师还紧缺的,工资也不低的都是 6、7万的。 发信人: Beijing (我是猪--听说猪是被祝福的), 信区: Database 标  题: Re: [BSSD]中年大叔也想改行做DBA, 也请大牛指点. 发信站: BBS 未名空间站 (Wed Apr  4 09:58:03 2012, 美东) 公司跟公司不一样,让DBA写java?有几个会的?很多DBA连SP都写不好,更不用谈OO的 东东了。你说的大都是新建或升级数据库,一个稳定的数据库,DBA写啥script,尤其 是新来的,会run前人写好的就行了。 老中传统思维要不得,要多学老印,要吹牛,首先是要敢吹牛,不吹牛怎么行。要敢吹 牛,首先要自信,自己都不相信自己,别人怎么能相信。 新手的目标不是怎么把工作做好,是怎么找个工作。先找个工作,再图发展,所以这个 阶段读文档远不如背面试题来得有效。工作了再开始读文档?恭喜你,你一辈子就是做 码工的命。 【 在 yhangw (云海苍山) 的大作中提到: 】 : 现在这年头对dba的要求已经越来越高了,system dba最好也懂些开发,一方面你对跑 : 在你数据库上的东西越了解,你就越可能更好的管理调试it; 另一方面从纯系统维护管 : 理考虑,如果你有一手好的shell/sql加上会写点java sp,那就有价值的多了。随着 : dbms自身的完善,原先很多需要shell的工作都可以放到数据库里面用sp做,作为db : objects,可管理性好多了。  我这边原先大部分scripts是shell的,有段时间曾想都转 : 成perl,但后来还是放弃了,觉得没有多少advantage over sql+shell。  dba本身需 : 要的知识很庞杂,精华就在于合...