2016/08/08 阅读笔记

Quora: How can I study for 10+ hours a day without getting depressed and how can I make myself get used it?

Such a stupid question.

  1. Don't study more than 7.5 hours a day. You can't learn when you are exhausted.
  2. Take a day off per week. Do something you like on that day.
  3. Make a plan.What knowledge is most critical in each of the subjects? First, concentrate only on that.
  4. Study from low to high resolution.
  5. Nap. A lot.
  6. Study one topic for 2.5 hours. Then switch to another. Continue.
  7. Read. Then put down the book. Then summarize what you have read. Don't look at what you were reading when you summarize.

  1. Avoid time specific plans unless you're a monk or living in an extremely isolated environment.
  2. Create a simple mechanism for notes and plans. You don't need any complex thing. The aim here is to work efficiently so these tools should be tools, not the whole story.
  3. Create tasks as atomic as possible. Task should not be long. Best practice is that the task can be done after 1-2 hours of efficient work. If the task is big, you divide it into subtasks. In other words, avoid context switching as much as possible.
  4. Get rid of all external distraction.
  5. Use Pomodoro Technique.
  6. If you have a long-run work and you can't complete it at the end of the day, take a note for tomorrow's yourself in order to remember the basic of teh task. And tomorrow, you start the day by glancing over the connected tasks.

If studying makes you depressed, it's because your mind considers it a chore that you're forced to do. Doing any such chore for long periods of time is awful and depressing. On the other hand, doing somehting you love is fun, even when it's physically or mentally exhausting. So what you need to do is make the experience more valuable and enjoyable.

  1. Knowing WHY you're learning something.
  2. Really understanding what you're learning.

  1. Learn and practise proven efficient and effective study tools like SQ5R and Cornell Notes.
    • SQ5R reading/satudying strategy: [Survey, Question, Read, Record, Recite, Review, Reflect],
2016/8/8 posted in  Tech

2016/07/02 阅读笔记

How I became (and stayed) a successful programmer

How do I take a new skill like programming, grow it, shape it, and tune it over time so I can achieve longevity in the industry?

1. I surround myself with programmers who are way better than me

The best way to improve (at anything) is to learn from people better than you.

I remind myself to talk less and to listen more.

2. I occasionally leave my comfort zone

Leaving comfort zone helps me think differently by challenging a bunch of established ideas I already have.

Maybe you don't want to do this constantly because it can be hard to get into a rhythm with your normal area of work. But in moderation it can really open your mind to new ways of thinking.

Find a programming task that takes you out of your comfort zone and make it your next project. Then watch it pay off in spades.

3. I value being independent

What't most inportant is how you choose to find the answers to your questions.

This means I'll try to do most things myself first, and only when I really get stuck, I'll ask for help.


  • You learn how to be resourceful.
  • You earn respect by being courteous of other people's time and work.
  • You start developing your creativity.

Please don't quit -- every expert was once a beginner

Great developments never come from within your comfort zone

It's always hard to push yourself to the next level, because it requires greater effort than the usual. It requires more energy, which may tire you physically and mentally.But don't think about that. Think about the result. The achievement.

Every time you take a step toward expertise, no matter how small, it is still a step.

Learn in diffuse mode

Since it may be hard to get a concept the first time you read about it, you can do something that will make it better for you and help you get it quickly.

Read the full text with total focus (first time, even if you don't understand), okay? Now, read it again. After the second time, google the concept and try to read about it in different articles. That will help you see it from different angles, which will help you better understand it.

Next time is to read the text a third time. Your understanding of the concept is much better now than it was the first time you read it, even though in all likelihood you're still early on in your quest to truly understand that concept.

This medhod is called Diffuse mode. You can apply this type of learning toward applies to videos and tutorials, as well.

Every expert was once a beginner.

"You never fail until you stop trying." - Albert Einstein

You should know that reaching a high level takes time.

"I'm convinced that about half of what separates the successful Entrepreneurs from the non-successful ones is pure perseverance." - Steve Jobs

Some tips:

  • Don't work alone.
  • Don't wait for inspiration. Discipline is reliable.
  • Real work usually isn't fun.
  • Practice, practice, and practice.
  • Tutorials fish on your behalf, so you don't need to learn how to fish yourself. You need to read books.
  • Always try to understand a new concept using different resources.
  • Don't just read. Build. Try, try, and keep trying.
  • Frustration, boredom, tiredness, exhaustion -- these are all normal.
  • Ask.

"Long-term consistency trumps short-term intensity." - Bruce Lee

2016/7/2 posted in  Tech

2016 Week 21 阅读笔记


The great software developers, indeed, the best people in every field, are quite simply never on the market.j

The average great software developer will apply for, total,maybe, four jobs in their entire career.

—— Joel Spolsky

  1. 最好的人也许不投简历,就决定去哪里了。所以要在他们做决定之前找到他们。
  2. 比较差的会投很多次简历,找不到工作的时间约多,投的简历越多,给整个 pool 带来很多噪音,top 10% 的简历也许根本不算全部人的 top 10%。

—— 邹欣

Joel Spolsky 写了一本书,专门讲了公司招聘的心得和体会,《Smart and Gets Things Done》

现在绝大多数应届生简历而言,也许最具信息量的部分不是「精通 xxx,熟悉 yyy,掌握 zzz」,不是「在 uuu 实习过」,也不是这个项目那个作业,反倒是越来越被认为不重要的一项:毕业学校。原因是简历上的其他条目的信息量太小了。




  1. 清晰、明确。完全可度量。
  2. 防伪:读没读过,随便一问便知。而正因为应聘者也知道这事不像实习经验可以忽悠,所以也不敢乱往简历上捅词。
  3. 不在乎是否「泄题」:书单是完全公开的,无所谓,本来就是要你去读的。
  4. 管你用心不用心读,只要读了,读完了,就有区别。(笔者注:根据经验,没有用心读完可能真的没有什么卵用)
  5. 不存在「怎么做」的障碍:所有人都知道怎么读书——一页一页读。
  6. 不需要招聘者投入精力:书单在此,就这么简单。
  7. 评估的负担很大程度上转移到了应聘者身上:是不是认真看完了,有没有心得体会。

「书单计划」的背后是另一个悲剧的现实,如果不是因为这个现实,这个计划也完全没有必要,那就是,中国 IT 大学教育当中要求学的书,和企业真正需要你读的书相比,不是完全不够用,就是写得不够好,或者更悲剧的就是根本用不上,所以在这个大背景下出来的牛人都是自己淘书自己学的。

第一份工作的月薪 = 大学四年买过的技术书籍价格的总和

—— 熊力


有经验的面试者只要稍稍扫两眼一个人的 GitHub 历史,跳出几个 check-in 历史看一看,便完全能够迅速判断这个人是否满足他的要求。不再需要费劲心机地去想题目,去观察,去揣测,去花费大量的时间的同时还只能采样到几个极为有限的点。

书单 + GitHub,就相当于一个两年左右的面试。

没有哪个行业像 IT 行业这样特殊:没有什么东西不能够(应该)在互联网上学到的。


  1. 《编码的奥秘》
  2. 《深入理解计算机系统》
  3. 《Windows 核心编程》
  4. 《程序员的自我修养》
  5. 《代码大全》
  6. 《程序员修炼之道》
  7. 《编程珠玑》
  8. 《编程之美》
  9. 《The C Programming Language》
  10. 《The C++ Programming Language》
  11. 《Programming: Principles and Practice Using C++》
  12. 《Accelerated C++》
  13. 《计算机程序的构造和解释》
  14. 《Clean Code》
  15. 《Implementation Patterns》
  16. 《Design Patterns》
  17. 《Agile Software Development, Principles, Patterns, and Practices》
  18. 《Refactoring》
  19. 《C++ 编程思想》
  20. 《Effective C++》
  21. 《深度探索 C++ 对象模型》
  22. 《C++ 语言的设计和演化》
  23. 《C 专家编程》
  24. 《C 陷阱与缺陷》
  25. 《C 语言接口与实现》
  26. 《Lua 程序设计》
  27. 《Linkers and Loaders》
  28. 《COM 本质论》
  29. 《深入理解 Windows 操作系统》
  30. 《Unix 编程艺术》
  31. 《代码优化:有效使用内存》
  32. 《深入理解 Linux 内核》
  33. 《TCP/IP 详解》
  34. 《软件随想录》
  35. 《黑客与画家》
  36. 《编程人生》
  37. 《人月神话》
  38. 《算法导论》
  39. 《快速软件开发——有效控制与完成进度计划》
  40. 《IT 项目管理那些事》
  41. 《最后期限》
  42. 《走出软件作坊》
  43. 《你的灯亮着吗》
  44. 《Algorithms》(by Sanjoy Dasgupta, Christos Papadimitriou and Umesh Vazirani)
  45. 《Data Structures and Algorithms》
  46. 《The Design of the UNIX Operating System》
  47. 《Compilers》(龙书)
  48. 《Computer Architecture: A Quantitative Approach》
  49. 《Flow》
  50. 《Outliers》(Why hard work and luck are both important)


  1. 乘着对一件事有热情的时候,一股脑把万事那个最难的阶段熬过去。
  2. 根据主题来查阅资料,而不是根据资料来查阅主题。按照主题来阅读,你会发现读的时候不再是老老实实地一本书看完再看另一本,而是非常频繁地从一本书跳到另一本书,从一处资料跳到另一处资料,从而来获得多个不同的人对同一个主题是如何讲解的。因为即便是经典的书,你也不能指望它对其中每一个主题的介绍都是尽善尽美的,有些书对某个主题(知识点)的介绍比较到位,有些书则对另一些知识点介绍得比较到位。而有时候一篇紧凑的 paper 比一本书上讲得还要好。我硬盘里面的书按照主题分类,每个主题下面都有一堆书,当我需要学习某个主题的知识时,我会把里面涉及这个主题的书都翻开来,索引到相关章节,然后挑讲得好的看。
  3. 好资料,坏资料。好资料的特点:从问题出发;重点介绍方法背后的理念,注重直观解释,而不是方法的技术细节;按照方法被发明的时间流程来介绍(先是遇到什么问题,然后怎样分析,推理,最后发现目前所使用的方法)。坏资料的特点是好资料的反面:上来就讲方法细节,仿佛某方法是从天上掉下来的。根本不讲为什么要用这个方法,人们最初是因为面对什么问题才想到这个方法的,其间又是怎样才想出这个方法的,方法背后的直观思想又是什么。
  4. 学习一个东西之前,首先在大脑中积累充分的「疑惑感」。即弄清面临的问题到底是什么,在浏览方法本身之前,最好先使劲问问自己能想到什么方法。一个公认的事实是,你对问题的疑惑越大,在之前做的自己的思考越多,当看到借到之后的印象就越深刻。
  5. 有选择地阅读。这里的选择体现在两个地方,一是选择一本书中感兴趣的章节优先阅读,二是对一本书中技术性较弱或信息密度较低的部分快速地略读。一般来说,除了技术性非常强的书之外,大多数书的信息密度很低,有很多废话。一般来说在阅读的时候应该这样来切分内容:1. 问题是什么?2. 方案是什么?3. 例子是什么?如果是需要解释一个现象的,那么1. 现象是什么?2. 解释是什么?3. 之城这个解释的理由是什么? 4. 例子是什么。
  6. 为什么看不懂?1. 你看得不够使劲。对于这类情况,仔仔细细地再多读两遍,多试着去理解两遍,往往会恍然大悟。2. 其中涉及到了你不懂得概念,这是技术性的不理解,这种情况就需要 Cross Reference。如果一句话中用到了你不懂得概念,那就去查。奇怪的是很多人看不懂也不分析一下为什么不懂,就直接放弃了。正如解决问题一样,问题卡住解决不了了,第一时间要做的就是分析为什么解决不了,而不是直接求救。3. 作者讲述的顺序不对,你接着往下看,也许看到后面就明白前面的了。
  7. 如何搜寻到好书。1. 同作者的著作。2. Amazon 相关推荐和主题相关的书列。3. 一本好的著作(或一份好的资料——不管是书还是网页)在参考资料里面重点提到的其他著作。4. 有时对于一个主题,可以搜索到好心人总结的参考资源导引,那是最好不过的。

What every computer science major should know

  • What should every student know to get a good job?
  • Waht should every student know to maintain lifelong employment?
  • What should every student know to enter graduate school?
  • What should every student know to benefit society?

Portfolio versus resume

Every computer science major should build a portfolio.

A portfolio could be as simple as a personal blog, with a post for each project or accomplishment. A better portfolio would include per-project pages, and publicly browsable code (hosted perhaps on github or Google code).

Contributions to open source shold be linked and documented.

A code portflolio allows employers to direcctly judge ablility. GPAs and resumes do not.

Technical communication

I would recommend that students master a presentation tool like PowerPoint or (my favorite) Keynote.

For producing beautiful mathematival documentation, \(LaTex\) has not equal. All written assignments in techical courses should be submitted in LaTex.

An engineering core

The Unix philosophy

The Unix philosophy is one that emphassizes linguistic abstraction and composition in order to effect computation.

Systems administration

Programming Language

Discrete mathematics

Data structures and algorithms



Operating System



2016/5/19 posted in  Tech



repeat-whilewhile 判断循环条件之前,先执行一次循环的代码块,和其他语言中的 do-while 是类似的。

repeat {
} while condition


switch 语句会尝试把某个值与若干个模式(pattern)进行匹配。根据第一个匹配成功的模式,switch语句会执行对应的代码。当有可能的情况较多时,通常用 switch 语句替换 if 语句。

switch 语句必须是完备的,每一个可能的值都必须至少有一个 case 分支与之对应。在某些不可能涵盖所有值得情况下,你可以使用默认(default)分支满足该要求,这个默认分支必须在 switch 语句的最后面。

不存在隐式的贯穿(No Implicit Fallthrouth)

和其他语言的 Switch 不同,在 Swift 中,当匹配的 case 分支中的代码执行完毕后,程序会终止 switch 语句,而不会继续执行下一个 case 分支。所以,不需要再 case 分支中显式地使用 break 语句。

如果想要贯穿到特定的 case 分支中,请使用 fallthrough 语句。


case 分支的模式也可以是一个值得区间。


可以只用元组在同一个 switch 语句中测试多个值,元组中的元素可以是值,也可以是区间,使用下划线 _ 来匹配所有可能的值。


case 分支的模式允许将匹配的值绑定到一个临时的常量或变量,这些常量或变量在该 case 分支里就可以被引用了。

case 分支的模式可以使用 where 语句来判断额外的条件。



continue 语句告诉一个循环体立刻停止本次循环迭代,重现开始下次循环迭代。


break 语句会立即结束整个控制流的执行。


在 Swift 中,你可以在循环体和 switch 代码块中嵌套循环体和 switch 代码块来创造复杂的控制流结构。然而,循环体和 switch 代码块亮着都可以使用 break 语句来提前结束整个方法。因此,显式地指明 break 语句想要终止是哪个循环体或者 switch 代码块,会很有用。

为了实现这个目的,可以使用标签来标记一个循环体或者 switch 代码块,当使用 break 或者 continue 时,带上这个标签,可以控制该标签代表对象的中断或者执行。



if 语句一样, guard 的执行取决于一个表达式的布尔值。我们可以使用 guard 语句来要求条件必须为真时,以执行 guard 语句后的代码。不同于 if 语句,一个 guard 语句总是有一个 else 分句,如果条件不为真则执行 else 分句中的代码。

2016/5/18 posted in  Tech

Swift 学习笔记:字符串和字符



在实际的编译时,Swift 编译器会优化字符串的使用,使实际的复制只发生在绝对必要的情况下,这意味着将字符串作为值类型的同时可以获得极高的性能。

Working with Characters

可以使用 for-in 循环来遍历字符串中的 characters 属性来获取每一个字符的值。

字符串可以通过传递一个值类型为 Character 的数组作为自变量来初始化。



append() 方法可以将一个字符附加到一个字符串变量的尾部。


Unicode Scalars(Unicode 标量)

Swift 的 String 类型是基于 Unicode 标量建立的。Unicode 标量是对应字符或者修饰符的唯一的 21 位数字。

Unicode 码位(code poing)的范围是 U+0000U+1F425 或者 U+E000U+10FFFF。Unicode 标量不包括 Unicode 代理项(surrogate pair)码位,其码位范围是 U+D800U+DFFF

注意,并不是所有的 21 位 Unicode 标量都表示一个字符,因为有一些标量是留作未来分配的。

字符串字面量的特殊字符(Special Character in String Literals)

可扩展的字形群集(Extended Grapheme Clusters)

每一个 Swift 的 Character 类型代表一个可扩展的字形群。一个可扩展的字形群是一个或多个可生成人类可读的字符 Unicode 标量的有序排列。


如果想要获得一个字符串中的 Character 值得数量,可以使用字符串的 characters 属性的 count 属性。

注意在 Swift 中,使用可拓展的字符群集作为 Character 值来连接或改变字符串时,并不一定会更改字符串的字符数量。



使用 startIndex 属性可以获取一个 String 的第一个 Character 的索引。使用 endIndex 属性可以获取最后一个 Character 的后一个位置的索引,所以 endIndex 属性不能作为一个字符串的有效下标。如果 String 是空串,两者是相等的。

String.Index.predecessor() 获得前一个索引,successor() 获得后一个索引。

Characters 属性的 indices 属性会创建一个包含全部索引的范围(Range),用来在一个字符串中访问单个字符。


  • insert(_:atIndex:):在一个字符串的制定索引插入一个字符
  • insertContentsOf(_:at:):在一个字符串的指定索引插入一个字符串
  • `removeAtIndex(_:):在一个字符串的指定索引删除一个字符
  • removeRange(_:):在一个字符串的指定索引删除一个子字符串



使用 ==!= 来比较两个字符/字符串是否相等/不等。


  • hasPrefix(_:)
  • hasSuffix(_:)

字符串的 Unicode 表示形式(Unicode Representations of Strings)

当一个 Unicode 字符串被写进文本文件或其他存储时,字符串中的 Unicode 标量会用 Unicode 定义的几种编码格式(encoding forms)编码。每一个字符串中的小块编码都被称为 code units。这些包括 UTF-8,UTF-16,UTF-32 编码格式。

2016/5/17 posted in  Tech