├── .gitignore ├── LICENSE ├── README.md ├── img └── CSAPP-IEEE-754.png ├── 决策与判断.md ├── 历史的教训.md ├── 李光耀观天下.md ├── 深入理解计算机系统.md ├── 深度工作.md ├── 禅与摩托车维修艺术.md ├── 简单的艺术.md ├── 链接 装载与库.md ├── 非暴力沟通.md └── 高效程序员的45个习惯.md /.gitignore: -------------------------------------------------------------------------------- 1 | plan.md -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tim的读书笔记 2 | 我是一名游戏程序员,有一个技术博客:[Tim's Blog](http://wuzhiwei.net)。 3 | 4 | 这是我的读书笔记集群,笔记将全部用markdown编写。 5 | 6 | 读书笔记将显著的分为两类:技术和非技术。 7 | 8 | 技术类一般不包括编程语言学习书籍。 9 | 10 | 非技术类不涉及小说类。 11 | 12 | 我的豆瓣读书主页为:[http://book.douban.com/people/timcs/](http://book.douban.com/people/timcs/)。 13 | 14 | ## 目录 15 | * [简单的艺术](https://github.com/iWoz/ReadingNotes/blob/master/%E7%AE%80%E5%8D%95%E7%9A%84%E8%89%BA%E6%9C%AF.md) 16 | * [高效程序员的45个习惯](https://github.com/iWoz/ReadingNotes/blob/master/%E9%AB%98%E6%95%88%E7%A8%8B%E5%BA%8F%E5%91%98%E7%9A%8445%E4%B8%AA%E4%B9%A0%E6%83%AF.md) 17 | * [禅与摩托车维修艺术](https://github.com/iWoz/ReadingNotes/blob/master/%E7%A6%85%E4%B8%8E%E6%91%A9%E6%89%98%E8%BD%A6%E7%BB%B4%E4%BF%AE%E8%89%BA%E6%9C%AF.md) 18 | * [深入理解计算机系统](https://github.com/iWoz/ReadingNotes/blob/master/%E6%B7%B1%E5%85%A5%E7%90%86%E8%A7%A3%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F.md) 19 | * [决策与判断](https://github.com/iWoz/ReadingNotes/blob/master/%E5%86%B3%E7%AD%96%E4%B8%8E%E5%88%A4%E6%96%AD.md) 20 | * [链接 装载与库](https://github.com/iWoz/ReadingNotes/blob/master/%E9%93%BE%E6%8E%A5%20%E8%A3%85%E8%BD%BD%E4%B8%8E%E5%BA%93.md) 21 | * [非暴力沟通](https://github.com/iWoz/ReadingNotes/blob/master/%E9%9D%9E%E6%9A%B4%E5%8A%9B%E6%B2%9F%E9%80%9A.md) 22 | * [深度工作](https://github.com/iWoz/ReadingNotes/blob/master/%E6%B7%B1%E5%BA%A6%E5%B7%A5%E4%BD%9C.md) 23 | * [历史的教训](https://github.com/iWoz/ReadingNotes/blob/master/历史的教训.md) 24 | 25 | 欢迎关注公众号: 26 | ![image](https://user-images.githubusercontent.com/1621110/215088294-fc24b001-23d3-40e4-be2e-1f50a0d6d936.png) 27 | -------------------------------------------------------------------------------- /img/CSAPP-IEEE-754.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iWoz/ReadingNotes/7d20da3b5ece14c109bd215c2a50bd2ef8c86141/img/CSAPP-IEEE-754.png -------------------------------------------------------------------------------- /决策与判断.md: -------------------------------------------------------------------------------- 1 | #《决策与判断》读书笔记 2 | 3 | ##Chapter 1 - 选择性知觉 4 | * 知觉具有选择性,即容易受自己的**预期**影响 5 | * 知觉也会受到做出的承诺的影响,人们的知觉倾向于与自己的承诺保持一致 6 | * 由于知觉易受影响,所以在做重大决策前,问自己几个关键的问题: 7 | * 我看待事物的方式是否受到某种动机的驱使? 8 | * 我看待和处理问题是是否夹杂了自身的预期? 9 | * 我是否与那些与我有不同预期的人交换过意见? 10 | 11 | ##Chapter 2 - 认知不协调 12 | * 人们往往想要减少或者避免心理上的不一致,不一致会引起不协调,而可能会感到不满或不爽 13 | * 人们会尽一切可能减少认知不协调感,为了降低这种不协调感,人们可能会通过撒谎等方式 14 | * 当人们为一件事情付出越多,他们就认为这件事越有价值,而且越有压力为这件事情持续付出 15 | * 当下注之后,人们会更加相信自己的选择,即使概率是一样的,这就是为了降低决策后的认知不协调感 16 | * 如果你希望一个人形成对某个事物的积极态度,就引导他,使他致力得到这个事物 17 | * 如果你希望一个人对某种错误行为的态度更加温和,则引导他做出这种错误行为;相反,则引导他不去做出这种错误行为 18 | 19 | ##Chapter 3 - 记忆和事后聪明式偏差 20 | * 记忆不是过去存进记忆库的拷贝,而是在提取它的时候建立起来的,简而言之,记忆是根据碎片重建的 21 | * 记忆的重建高度取决于情境因素,所以约会时第一印象,周边环境,共同做的事情是否留下了愉快的心情都很重要 22 | 23 | ##Chapter 4 - 情境依赖性 24 | * 对比效应:在绝对条件下去了解一个人是不可能的,人的品质是对比出来的 25 | * 房地产经纪先带去看破房子或者贵的离谱的房子,然后再去看一般的房子就是利用了对比效应 26 | * 初始效应:第一印象很重要,人们往往会先入为主。当然,第二第三印象也很重要,它们都是初始印象 27 | * 近因效应:人们更加清楚的记得最后出现的信息而非最先出现的信息。这与初始效应产生了对抗 28 | * 在辩论中,如果对方会立即回击,且辩论结束后人们要过一会才会做出判断应该选择最先发言,这时初始效应最大,近因效应随着时间的流逝而威力减少 29 | * 但是如果各自的发言有一定的时间间隔,而且人们要在双方发言结束后立即做出判断,则应该最后发言,这时近因效应最大 30 | * 晕轮效应:好看的人会得到更高的评价,也更聪明,牛校的毕业生就一定都很牛逼,明星拍广告销量会变大等等 31 | * 晕轮效应容易使人们因为一两项的好而做出全部都好的错误判断 32 | 33 | ##Chapter 5 - 可塑性 34 | * 人们的答案会受到问题或者答案选项顺序的影响。如果两个问题都是关于同一主题的,则回答者为了保持一致,后一个答案通常会按照前一个答案的思路来组织 35 | * 答案选项越多,顺序效应则越强烈,往往最后一个选项被选择的频率最高 36 | * 当人们对一个问题知之甚少时,这种顺序效应则更加明显,人们可能会被问题的语境和顺序来诱导出一个答案 37 | * 这种答案往往是「虚假意见」,为了过滤这种「虚假意见」,在提问时,要先问是否听说过这个问题,否则就不要采纳其答案 38 | * 人们宣称的态度和行为相关性很小,永远不要轻信别人的承诺,而要看他的具体行动 39 | 40 | ##Chapter 6 - 问题的措辞和框架的影响 41 | * 在问题的答案中引入一个中间选项可能会鼓励人们选择中立,去除中间选项,常常能有效检测出人们的一般倾向 42 | * 另外,问题的度量单位会影响调查答案的大小,比如多长时间和多短时间,往往前者的回答的时间会更长;同理多高和多矮 43 | * 当面临获利时,人们往往倾向规避风险,「二鸟在林」不如「一鸟在手」;然而当面临损失时,人们往往喜欢赌一赌运气 44 | * 心理分账:人们会以不同的态度对等值的钱,并做出不同的决策行为。对工资的钱,我们往往会精打细算,然而对于彩票中奖的钱,就划分到另外一个账户里去了,可能会胡乱花费 45 | * 消费者对绝对值(优惠XX元)和相对值(打X.X折)优惠的体验存在较大差异,而且呈现这样一种规律:当购买额度较小时,消费者对相对值优惠更敏感,即在商家相同让利水平的情况下,相对值比绝对值能让消费者体验到更多的优惠。相反在购买额度较大时,消费者对绝对者优惠更敏感。 46 | 47 | ##Chapter 7 - 期望效用理论 48 | * 金钱的价值(效用)随着获取金额的增多而递减 -------------------------------------------------------------------------------- /历史的教训.md: -------------------------------------------------------------------------------- 1 | @(读书笔记) 2 | # 历史的教训 3 | 4 | * 历史的第一个教训就是要**学会谦逊**,人类历史只是宇宙的一瞬,一颗小行星的撞击就可能让人类全体灭绝。 5 | * 飞机的发展会让地理上的限制变小,制空权在新形势下要比制海权更为重要。 6 | * 弱肉强食,适者生存,生命即是竞争,竞争养分,粮食,阳光,土地和配偶,乃至上升到国与国的层次。**不平等是与生俱来的**,人人生而平等是指人权上的平等,但是出身,家境,智力,体格等等各方面人们都存在差异和不平等。 7 | * **平等和自由互相对立**,往往是弱者要求平等,而强者追求自由。 8 | * 生命需要繁衍,自然喜欢数量,量变产生质变。当一个族群的人口越来越多时,它在经济和政治上的权力也会随之增大。子宫战争,**出生率就像战争**一样,决定着族群的命运。 9 | * 历史大体是由少数求新的人(伟人)之前的冲突造成的,大多数人只为胜利者鼓掌,充当社会实验的人类原材料。 10 | * 保守派和激进派都互相有他们的价值,激进派可以拓展人类的边界,创造出新事物;而保守派则会对新事物进行反复研磨,以确保安全。两者对立共存,能确保人类的良性发展。对于生存来说,保守派可能更有价值,因为根须深厚比枝繁叶茂更加重要。 11 | * 道德规范会随着经济史的阶段而发生改变。譬如,在原始狩猎时代,人必须要残暴,贪婪才能确保自己能生存下来,好色才能确保自己的基因得以繁衍。这些品质到了农业时代和工业时代便成为了坏品质。随着信息化时代的到来,道德规范或许会进一步进行调整。 12 | * **宗教会死而不僵**,是人们的一种心灵寄托,也能帮助维护社会道德秩序。只要有贫穷和压迫,就会有宗教的市场。共产主义的国家基本都脱离了宗教,也许是因为人们把共产主义当做了自己的信仰吧。 13 | * 财富集中(两极分化)是一种不可避免的自然现象,通过暴力(战争,革命)或和平手段(改革)来进行再分配,从而得到**周期性**的缓解。 14 | * 这种周期性的过程往往是因为人性导致的,**人性不变,所以历史总是惊人的相似**。唯一真正的革命,是对心灵的启蒙和对能力的提升,只有这样,人类才能不断进步。只有**教育**,才能带来民主。 15 | * 社会主义和资本主义会彼此吸取对方的优点而逐渐产生融合,随着全球化时代的到来,意识形态上的隔阂将会被逐渐消除。 16 | * 战争和对立是常态,而和平是短暂的,**要居安思危**。没有永远的朋友,只有不变的利益,当人类面临外星生物的入侵时,全球或许才能统一起来一致对外。 17 | * 文明终究会面临死亡,人也会面临死亡。然而思想和文化遗产会一代一代的流传下去,生生不息。 18 | 19 | 于己,修身齐家治国安天下,先修身养性,传播先进正确的思想给其他人,力争握住历史浪潮,顺势而为! -------------------------------------------------------------------------------- /李光耀观天下.md: -------------------------------------------------------------------------------- 1 | @(读书笔记) 2 | #「李光耀观天下」书评 3 | 4 | 我很欣赏务实主义者,或者说问题解决者,也许因为我自己就是一个比较注重务实和喜欢解决问题的人。李光耀显然就是这么一个人,李最欣赏的领导人邓小平也是这种人。 5 | 6 | 在本书中,李光耀散发出自信和理性的光芒,对世界政治和经济做了分析,读之感觉受益匪浅。 7 | 8 | ##领导者 9 | 10 | 改革开放四十年来,我国取得举世瞩目的进步,正在朝着世界第一强国迈进。这一切取决于邓小平及那一代改革派领导人的决定。 11 | 12 | 邓之所以能将中国从文革泥潭中拉出来并成功推行改革开放,主要是因为: 13 | 1. 邓参加过红军,是老一辈革命家,在军队中享有威望。 14 | 2. 邓在75年主持政府工作时,积累了大量的信任,让大家看到了邓的能力。 15 | 3. 邓是一个实干主义者,不管白猫黑猫,只要抓到老鼠就是好猫。所以邓不怕扣上走资派的帽子。 16 | 17 | 李光耀在书中对邓大为赞扬,称之为「最伟大的领袖」,除了邓的能力和手腕外,还有邓的胸怀和自律。李在一次晚宴中向中国在东南亚输出革命表达不满,以为邓会大为光火,没想到邓主动接纳,海纳百川,有容乃大。邓喜欢抽烟,李已经戒烟,所以邓在和李会谈时一根烟未抽,显示出强大的自制力。 18 | 19 | 李在书中对习大大也是颇有好评,认为习心胸宽广,不摆架子又具有使命感。 20 | 21 | 李说到自己在近90岁时还能端坐,不需要轮椅和拐杖,主要是因为生活规律,戒烟,又保持运动习惯,归结为一点,即自律。 22 | 23 | 由此可见,成为一个卓越的领导者,需要具备以下几点素质: 24 | 1. 言必行,行必果,言行一致 25 | 2. 能力出色,可以令人信服 26 | 3. 心胸宽广,可以吸取不同意见 27 | 4. 自律 28 | 29 | ##中国崛起 30 | 31 | 中国需要一个强大的中央政府,即中央集权,才能兴旺发达,国泰民安。现如今中央更为强大,权力也更加集中,这也许对现在的中国是一件好事。 32 | 33 | 随着沿海城市的人口爆满,书中提到中国计划在中部建立6个城市群,以容纳近3亿的农村人口流入城市。 34 | 35 | 中国正处在一个高速发展期,已经对美国的霸主地位产生威胁,未来势必将取代美国成为世界第一强国。 36 | 37 | 与此同时,中国也面临着诸多问题: 38 | 1. 法制不够完善,更多的时候还是人治。 39 | 2. 对知识产权和专利保护较弱,缺乏创新土壤。 40 | 3. 国企效率低下。 41 | 4. 环境污染日益加剧。 42 | 5. 国人储蓄观念(穷怕了)很重,国内消费仍未完全打开。 43 | 44 | 我相信,随着全面深化改革的进一步推进,中国会朝着更好的方向发展。 45 | 46 | ##国际环境 47 | 48 | 美国由于其强大的经济实力和优秀的人才储备,未来仍将是世界强国。未来最重要的双边关系就是中美关系。然而随着中国的全面崛起,美国在亚洲的影响力将下降,在台湾问题上美国或许将不得不向中国妥协。随着中国的日益强大,中国统一是必然趋势。 49 | 50 | 日本由于其低生育率和排斥移民的风俗,导致其在未来将走向平庸。 51 | 52 | 朝韩或许很难统一,因为这并不符合中国的利益。 53 | 54 | 印度受限于种姓制导致其优秀基因流动受限,又因为没有一个全国统一的语言,使得很难让所有国民在思想上统一起来,而导致其发展受限。 55 | 56 | 李很推崇一门统一的,有优势的语言。譬如新加坡选择英语作为第一语言,使得其更能与世界接轨。 57 | 58 | 欧洲则是陷入各种危机,比如长时间的福利社会导致人们工作热情衰减,从而发展缓慢。欧洲若不能统一行动,则将实力大减。 59 | 60 | 中东则是李预言最先可能爆发核战的地方,伊朗一旦研制出核武器,势必会对中东乃至世界局势造成深远影响。 61 | 62 | 全球化早已到来,世界已经变成一个地球村。只有积极建设自己,准备充足,以开放的姿态面对世界,才有可能取得成功。 63 | 64 | ##最后 65 | 66 | 修身,齐家,治国,安天下。 67 | 68 | 多读书,多思考,多总结。 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /深入理解计算机系统.md: -------------------------------------------------------------------------------- 1 | #《深入理解计算机系统》 读书笔记 2 | 3 | ##Chapter 1 - 计算机系统漫游 4 | * 只由ASCII字符构成的文件成为*文本文件*,其他的所有文件成为*二进制文件* 5 | * 编译系统的四个阶段: 6 | * 预处理阶段 7 | * 编译阶段 8 | * 汇编阶段 9 | * 链接阶段 10 | * 系统的硬件组成 11 | * 总线 :贯穿整个系统的电子管道,通常被设计为传送定长的字节块,也就是字(word)。字的字节数是一个基本的系统参数,称为字长。 12 | * I/O设备:负责系统和外界的联系通道。例如显示器,键鼠,磁盘等等。 13 | * 主存:有一组DRAM芯片组成,是一个临时存储设备,用于存放处理器所需的程序和数据。 14 | * 处理器:解释储存在主存中指令的引擎。处理器的核心为*程序计数器*(PC)的字长大小的寄存器。在任意时间点,PC都指向主存中的某条机器语言指令(地址)。 15 | * 高速缓存 16 | * 由于主存与处理器寄存器的读取速度差距过大,需要在主存和寄存器中间加入高速缓存,用于存放处理器在不久的将来可能会用到的信息。 17 | * 高速缓存可以使存储设备分层。速度越快的设备容量越小;而容量越大的设备速度则越慢。针对不同的需求进行满足,同时节约成本。 18 | * 操作系统 19 | * 操作系统是硬件和应用程序中间的一层软件 20 | * 可以防止硬件被失控的应用程序滥用 21 | * 和为应用程序提供使用复杂硬件的简单接口 22 | * **进程** 23 | * 进程是操作系统对应用程序的一种抽象。一个系统上可以同时运行多个进程,然而每个进程都好像独占地使用硬件。实际一个进程的指令和另一个进程的指令是交错执行的。操作系统实现这种交错执行的机制称为**上下文切换**(context switching)。 24 | * 上下文(context)为操作系统保持进程运行所需的所有状态信息。任何时刻,只有一个进程在运行,当操作系统决定从当前进程转移到某个新进程时,就会进行上下文切换。 25 | * 上下文切换的过程为:系统保存当前进程的上下文,恢复新进程的上下文,将控制权转移到新进程,新进程从它上次停止的地方开始。 26 | * 线程:一个进程由多个线程组成,每个线程都运行在进程的上下文中,并**共享相同代码和全局数据**。 27 | * 虚拟存储器:是一个抽象概念,为每个进程提供假象,好像每个进程都在独占的使用内存,每个进程看到的存储器都是一样的,称为**虚拟地址空间**。 28 | * 虚拟地址空间由大量定义的区组成,每个区都有专门的功能。 29 | * 代码和数据 30 | * 堆:运行时可以动态分配的地址空间 31 | * 共享库:动态链接 32 | * 栈:函数调用 33 | * 内核虚拟存储器:应用程序不可读写 34 | * 文件:字节序列。**每个I/O设备,包括键鼠,显示器,甚至网络都可以被视为文件**。文件使应用程序可以统一的看待各式的I/O设备,而无需了解I/O设备的不同技术。 35 | * 操作系统内核提供了三个基础的抽象概念: 36 | * 文件:I/O设备的抽象 37 | * 虚拟存储器:主存和磁盘的抽象 38 | * 进程:处理器,主存和I/O设备的抽象 39 | * 网络提供了计算机系统间的通信,网络实际可以视为一种I/O设备。 40 | 41 | ##Chapter 2 - 信息的表示和处理 42 | * 最重要的三个数字编码 43 | * 无符号(unsigned),表示大于或等于0的数字 44 | * 二进制补码(two's-complement),表示有符号(正负)整数 45 | * 浮点数(floating-point),表示实数的科学记数法 46 | * **值得注意的是,浮点数是不可结合的**,因为精度有限 47 | * 在Lua中,`print(3.14+1e+20-1e+20)`得`0`,而`print(3.14+(1e+20-1e+20))`得`3.14` 48 | * 字节(byte):8位的块,是大多数计算机的最小可寻址存储器单位 49 | * 字长(word size):指明整数和指针的标称大小。其决定了虚拟地址空间的最大大小。如32位字长,限制了虚拟地址空间大小为`2^32Byte = 4GB`。 50 | * 寻址:多字节对象被存储为连续的字节序列,对象的地址为字节序列的最小地址。 51 | * 字节顺序: 52 | * 如:`0x01234567`,存在0x100~0x103的字节顺序中,最高的字节为01,最低的字节为67 53 | * 小端法:最低的地址存最低的位 从0x100~0x103分别为 67 45 23 01 54 | * 大端法:最高的地址存最低的位 从0x100~0x103分别为 01 23 45 67 55 | * 使用ascii码在任何系统都将得到相同的结果,与字节顺序和字大小规则无关。因而,文本数据比二进制数据有更强的平台独立性。 56 | * 有关字符编码,可参考博文:[字符编码笔记:ASCII,Unicode和UTF-8](http://www.ruanyifeng.com/blog/2007/10/ascii_unicode_and_utf-8.html)。 57 | * 布尔代数的特性: 58 | * a | ~a = 1 59 | * a & ~a = 0 60 | * a ^ a = 0 61 | * a ^ ~a = 1 62 | * a ^ 0 = a 63 | * a ^ 1 = ~a 64 | * DeMorgan's law: 65 | * ~(a&b) = ~a | ~b 66 | * ~(a|b) = ~a & ~b 67 | * 利用亦或操作的特性构造的原地换位代码: 68 | ```C 69 | void inplace_swap(int *x, int *y) 70 | { 71 | *x = *x ^ *y; 72 | *y = *x ^ *y; 73 | *x = *x ^ *y; 74 | } 75 | ``` 76 | 77 | * 位向量的应用: 78 | * 有限集合,若位为1,则表示集合中包含了该位下标的值的数字;若位为0,则相反。 79 | 80 | 例如一个位向量为a=[01101001]表示集合A={0,3,5,6};位向量b=[01010101]表示集合B={0,2,4,6}。则 a|b = A并B ; a&b = A交B,而~a = A的补集。 81 | 82 | * 掩码(masking)运算: 83 | 84 | 掩码0xFF = 000...00011111111 则x&0xFF = 由x最低有效字节组成的值,其他字节都被置为0。 85 | 86 | ~0将生成一个全1的掩码,不管机器的字长是多少,具有很强的移植性。 87 | 88 | C中逻辑运算和位运算是完全不同的。而且逻辑运算具有断路的特性:若对第一个参数求值能确定表达式的值,那么逻辑运算符将不会对第二个参数进行求值。 89 | 90 | * 移位运算: 91 | * 左移 <<:丢弃k个最高位,最低位补k个0 92 | * 逻辑右移 >>:丢弃k个最低位,最高位补k个0 93 | * **算术右移** >>:丢弃k个最低位,最高位**补k个最高位的拷贝** 94 | * 无符号数(unsigned)的右移必须是逻辑右移,补0 95 | * 有符号数的右移大多数使用算术右移,补最高位的拷贝 96 | 97 | * **二进制补码**(two's-complement)的表示:将字的最高有效位解释为负权。 98 | * 二进制补码的值可用如下公式求出:$B2T_{w}(\vec x) \equiv -x_{w-1}2^{w-1} + \sum_{i=0}^{w-2}x_{i}2^{i} $ 99 | 100 | * 最高有效位($x_{w-1}$)被称为符号位(sign bit),设为1时,表示值为负数;设为0时,表示非负。 101 | * 二进制补码的范围是不对称的: 102 | * $ |TMin_{w} = TMax_{w} + 1| $ 即,**$TMin_{w}$没有与之对应的正数** 103 | * 最大的无符号值比最大的补码值的两倍大一:$UMax_{w} = 2TMax_{w} + 1$ 104 | * 补码中的-1与$UMax_{w}$是同样的位序列 105 | * 强制类型转换:没有改变参数的位表示,即位序列不变,但是改变了这些位的解释 106 | * **二进制补码与无符号数的映射关系**如下: 107 | $$T2U_{w}(x) = \begin{cases} 108 | x+2^{w},& x<0\\ 109 | x,& x\geq0 110 | \end{cases}$$ 111 | 可见-1在补码中被转换成了最大的无符号数 112 | * **无符号数与二进制补码的映射关系**如下: 113 | $$U2T_{w}(x) = \begin{cases} 114 | x,& x<2^{w-1}\\ 115 | x-2^{w},& x\geq2^{w-1} 116 | \end{cases}$$ 117 | * 一个方便记忆的记法是:对于$0 \leq x < 2^{w-1}$的值,二进制补码与无符号的表示是一样的,值都是x;对于之外的值只需加上或减去$2^{w-1}$即可 118 | * 在C语言中的`printf`函数中,%d表示有符号十进制,%u表示无符号十进制 119 | * 在C语言中,如果表达式两端分别为有符号和无符号,则会**隐含地将有符号强制转换为无符号然后进行运算**,这常常导致bug出现 120 | * 无符号整数扩展:在开头添加k个0,称之为零扩展 121 | * 二进制补码扩展:在开头添加k个最高有效位的值,被称为**符号扩展** 122 | * 由于有符号与无符号的强制转换经常导致困扰,因此建议**不使用无符号整数类型**。 123 | * 整数运算 124 | * 无符号加法:对于精度有限的无符号整数的加法,可能会产生溢出(丢弃最高位)。 125 | 对于$0\leq x,y \leq2^{w}-1$: 126 | $$x+y = \begin{cases} 127 | x+y,& x+y<2^{w}\\ 128 | x+y-2^{w}& 2^{w}\leq x+y<2^{w+1} 129 | \end{cases}$$ 130 | 判断溢出的一个方法是对于$s=x+y$,如果$s < x$或 $s < y$则表示溢出。 131 | * 二进制补码加法:先将加号两端二进制补码转为无符号,然后执行无符号加法,然后再转为二进制补码形式 132 | 对于$-2^{w-1}\leq x,y \leq2^{w}-1$: 133 | $$x+y = \begin{cases} 134 | x+y-2^{w},& 2^{w-1}\leq x+y & 正溢出(更小)\\ 135 | x+y,& -2^{w-1}\leq x+y<2^{w-1} & 正常\\ 136 | x+y+2^{w}& x+y<-2^{w+1} & 负溢出(更大) 137 | \end{cases}$$ 138 | * 二进制补码的负运算(非) 139 | 对于$-2^{w-1}\leq x < 2^{w-1}$: 140 | $$-x = \begin{cases} 141 | -2^{w-1},& x=-2^{w-1}\\ 142 | -x& x > -2^{w-1} 143 | \end{cases}$$ 144 | 一种有名的位运算技术:$-x = \tilde x + 1$ 145 | 即对x的每位取反然后再+1。 146 | * 整数乘法: 147 | 对于$-2^{w-1}\leq x,y \leq2^{w-1}-1$: 148 | $$x * y = (x * y)\ mod\ 2^{w} $$ 149 | * 整数除法 $x/y$ 150 | * 永远得到整数 151 | * 若得到小数,则: 152 | * **若x与y同号,说明得到正数,则对结果向下取整**,如$5/2 = \lfloor2.5\rfloor = 2$ 153 | * **若x与y不同号,说明得到负数,则对结果向上取整**,如$-5/2 = \lceil-2.5\rceil = -2$ 154 | * IEEE 754 **浮点数表示** 155 | * 浮点数的表示:$V = (-1)^{s} \times M \times 2^{E} $ 156 | * s表示sign,符号位,负数为1,正数为0 157 | * M表示有效位,为一个二进制小数 158 | * E表示2的幂 159 | * 域(二进制位序列)的划分: 160 | * 单独的符号位s 161 | * k位的指数域$e_{k-1}...e_{1}e_{0}$ 编码E 162 | * n位的小数域$f_{n-1}...f_{1}f_{0}$ 编码M 163 | * 其中指数域的有三种不同表达: 164 | * 规格化值:指数域不全是0,也不全是1 165 | $$E = e_{k-1}...e_{1}e_{0} - (2^{k-1} - 1)$$ 166 | $$M = 1 + \frac {f_{n-1}...f_{1}f_{0}} {2^n} $$ 167 | 168 | * 非规格化值:指数域全是0 169 | $$E = 1 - (2^{k-1} - 1)$$ 170 | $$M = \frac {f_{n-1}...f_{1}f_{0}} {2^n} $$ 171 | * 特殊数值:指数域全为1,若小数域全部为0,则表示无穷大;否则,表达NaN(Not a Number) 172 | ![Alt text](./img/CSAPP-IEEE-754.png) 173 | 174 | * 舍入:由于浮点数的表示精度有限,所以会需要进行舍入。 175 | * 最常用的舍入方式为偶数舍入,即先向最近的值进行舍入,如果为中间数值,则向偶数进行舍入。 176 | * 向偶数舍入可以避免统计偏差,即向上舍入或者向下舍入都容易使平均值的结果偏高或者偏低。 177 | * 浮点数运算:因为舍入会带来精度丢失,而且浮点数加法不具备结合性(即:只要运算符的位置不改变,则运算顺序的改变不会带来结果的影响),所以会有不一致的情况出现。 178 | * 如:`(3.14+1e10) - 1e10`因为舍入会得到0.0;而`3.14+(1e10-1e10)`则会得到3.14。**这是在日常编码中需要注意到的地方。** 179 | * **奇技淫巧** 180 | * 使用二进制补码,可以利用位运算求负`~x+1 = -x` 181 | * 可以利用移位运算轻松制造掩码。比如制造0xFF,可以用`(1<<8)-1`获得。更一般的,制造最低位为连续k个1时,可用`(1<