├── draft ├── 4_函数.md ├── 5_符号.md ├── 2_1_计算器2.md ├── 6_执行控制.md ├── application │ ├── NPM.md │ ├── OOP.md │ ├── 正则式.md │ ├── JSON.md │ ├── functional_programming │ ├── css.md │ ├── html.md │ ├── SQL.md │ ├── template.md │ ├── filesystem.md │ ├── books.md │ ├── web_programming.md │ └── case_study.md ├── 2_2_3计算器3.md ├── 7_数据结构.md ├── 3_模块.md ├── 2_0_计算器.md ├── 1_第一个程序.md ├── dual.py └── 8_算法.md ├── 基本准则.md ├── README.md ├── 编程语言概览.md └── 零基础转行指南.md /draft/4_函数.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /draft/5_符号.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /draft/2_1_计算器2.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /draft/6_执行控制.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /draft/application/NPM.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /draft/application/OOP.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /draft/application/正则式.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /draft/2_2_3计算器3.md: -------------------------------------------------------------------------------- 1 | 布尔运算 2 | 3 | -------------------------------------------------------------------------------- /draft/application/JSON.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /draft/application/functional_programming: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /draft/7_数据结构.md: -------------------------------------------------------------------------------- 1 | # 数组 2 | 3 | # 关联列表 4 | 5 | # 集合 -------------------------------------------------------------------------------- /draft/application/css.md: -------------------------------------------------------------------------------- 1 | # html intro 2 | 3 | # js parse parse html 4 | 5 | -------------------------------------------------------------------------------- /draft/application/html.md: -------------------------------------------------------------------------------- 1 | # html intro 2 | 3 | 4 | # js parse parse html 5 | 6 | -------------------------------------------------------------------------------- /draft/application/SQL.md: -------------------------------------------------------------------------------- 1 | # DB介绍 2 | 3 | # SQL介绍 4 | 5 | # NodeJS 链接数据库 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /draft/application/template.md: -------------------------------------------------------------------------------- 1 | 信息存储在 JSON中 2 | 3 | 用template 生成简历,然后再创建pdf。 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /draft/application/filesystem.md: -------------------------------------------------------------------------------- 1 | # File Find 2 | 3 | ## how many file in your file system are pdfs? 4 | 5 | ## count number of words in current folder? -------------------------------------------------------------------------------- /draft/3_模块.md: -------------------------------------------------------------------------------- 1 | 在前面“Hello World"和 计算器的章节中,我们遇到了 2 | __console.log__ 和 __math.exp__ 。console和math即是模块。 3 | 4 | 模块可以理解为类似的函数的合集。比如math 模块,里面都是math 5 | 相关的函数。 6 | 7 | 我们一一来看。 8 | math exp 9 | math rand 10 | 11 | -------------------------------------------------------------------------------- /基本准则.md: -------------------------------------------------------------------------------- 1 | # 基本的原则 2 | 3 | 我考虑从什么写起得时候觉得有太多的东西,不知如何下手。 4 | 5 | 不如就写一写我如何学习这些知识的。 6 | 7 | ### 尝试 8 | 9 | 最基本的原则就是不断的尝试,如果遇到新东西就尝试去学习。 10 | 11 | 慢慢的你就能把这些东西联系起来。 12 | 13 | ### 理解 14 | 15 | 如果你想解决一个问题,你必须理解这个问题,弄明白才会有答案。 16 | 17 | 我最近读一篇文章,讲到作为一个程序员,要理解你自己写的代码,不能满足于,问题解决了。就完事了。我很受用。 18 | 19 | 很多时候,问题是类似的,比照比人的方案,稍加修改就能用。但是,如果你不理解,就很难做的更好。一旦有问题,修复起来,就会捉襟见肘。因为,实际是,自己并没有理解这个问题。 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 我是基本上完全靠自己摸索,来学编程的。 3 | 4 | 编程实际上不难,很多人觉得难,是因为学校和很多书教得太难。 5 | 6 | 比如我大学的时候,图书馆很多C和C++的书,太注重算法,让人觉得很难。教编程的书,适当的算法是可以的,但不能太注重算法。好多算法,如果没有实际的应用需求,对于连语言都不是很熟悉的人,是很枯燥的。算法应该再学习了语言之后再学。夹杂的在一起,容易让学习误以为算法也是这个语言。就会觉得难。 7 | 8 | 我自己摸索学的语言是Perl,这个归类是脚本语言。好多人看不上,但是并不妨碍我用它工作。我到现在也没有写过一行有用的C代码。我相信很多人跟我做类似的工作,一开始学C完全是没必要的。 9 | 10 | 我打算结合我的经历,写一个一般人能够学以致用的东西。 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /draft/2_0_计算器.md: -------------------------------------------------------------------------------- 1 | 计算器大家都很熟悉。计算机即可粗略的理解为一个超级的计算器。 2 | 我们先从计算机最基本的功能学起,把计算机当成一个计算器。 3 | 4 | 5 | 6 | 7 | ## 加减乘除 8 | 9 | 10 | ## 更复杂的数学运算 11 | 12 | ## 位运算 13 | 14 | # 用到的概念 15 | 16 | ## 优先级 (Precedence) 17 | 18 | ## 关联性 (Associativity) 19 | 20 | 21 | 22 | 曾经有人问我有没有计算器,我指着他面前的笔记本,说“你不是有电脑么”,回答说,“计算器更方便”。 23 | 24 | 希望你现在明白,计算机可以当计算器来用,你会用计算器,其实已经会一部分编程了。 25 | 26 | 27 | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math -------------------------------------------------------------------------------- /draft/1_第一个程序.md: -------------------------------------------------------------------------------- 1 | ## Hello World 2 | 3 | 学语言从“Hello World” 开始!就是写一个程序,输出 “Hello World". 这个传统,从70年代就开始了。 4 | 5 | 有人甚至写了个段子。 6 | 7 | 某程序员退休后决定练习书法,于是重金购买文房四宝。一日,饭后突生雅兴,一番研墨拟纸, 8 | 并点上上好檀香。 定神片刻,泼墨挥毫,郑重地写下一行字:hello world! 9 | 10 | Python 中怎么写呢? 11 | 12 | ```{python} 13 | print("Hello World") 14 | ``` 15 | 16 | 当然,可以输出中文。 17 | 18 | ```{python} 19 | print("你好,世界!") 20 | ``` 21 | # Python 执行环境 22 | 23 | ## SPYDER 24 | 25 | https://pythonhosted.org/spyder/installation.html 26 | 27 | video or scrennshot 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /编程语言概览.md: -------------------------------------------------------------------------------- 1 | # 编程语言概览 2 | 3 | ## 什么是编程语言 4 | 5 | 人与人之间的交流靠语言。人与计算机的交流就靠编程语言。 6 | 7 | ## 目前主流的编程语言 8 | 9 | ### C/C++ 10 | 11 | 很多人都学过,不过很少人在工作中自己写C/C++。根本原因是太难写。 12 | 13 | ### java 14 | 15 | 可能多数人学了C/C++ 之后,工作中并用不到,而是用Java,目前最主流的编程语言。 16 | 17 | Java语言比较规范,但写起来比较罗嗦,因此又有不少语言建立在Java的基础上的语言被推出来。 18 | 19 | 比如Scala, Spark 就是Scala 写的。 20 | 21 | ### Python,PHP, Perl,Ruby,Javascript 22 | 23 | Java 之外的市场份额主演被这几个语言占据。这些语言比较类似,大同小异。 24 | 25 | Javascript 因为有浏览器的支持,非常流行。 26 | 27 | # 更多 28 | 29 | go,rust,lisp,ocaml,haskell 30 | 31 | ## 我该选哪一门语言入门 32 | 33 | 你应该在 Python,javascript 中选择一个. 34 | 35 | 36 | -------------------------------------------------------------------------------- /draft/dual.py: -------------------------------------------------------------------------------- 1 | class Dual(object): 2 | def __init__(self, x, a=0): 3 | self.x = x 4 | self.a = a 5 | 6 | def __add__(self, other): 7 | return Dual(self.x + other.x, self.a + other.a) 8 | 9 | def __mul__(self, other): 10 | return Dual(self.x * other.x, 11 | other.x * self.a + self.x * other.a) 12 | 13 | def __truediv__(self, other): 14 | return Dual(self.x / other.x, 15 | (other.x * self.a - self.x * other.a)/other.x**2) 16 | 17 | 18 | def f(x): 19 | return x*x 20 | 21 | 22 | def babylonia(x, N=10): 23 | t = (Dual(1)+x)/Dual(2) 24 | for i in range(1, N): 25 | t = (t+x/t)/Dual(2) 26 | return t 27 | 28 | 29 | if __name__ == "__main__": 30 | x = f(Dual(5, 1)).x 31 | a = f(Dual(5, 1)).a 32 | print(x, a) 33 | 34 | #print(babylonia(2, 10)) 35 | x = babylonia(Dual(49, 1), 10).x 36 | a = babylonia(Dual(49, 1), 10).a 37 | print(x, a) 38 | -------------------------------------------------------------------------------- /draft/application/books.md: -------------------------------------------------------------------------------- 1 | # Books 2 | 3 | ### Programming language 4 | 5 | ### Python 6 | 7 | __Learning Python__ 8 | 9 | 10 | ### Javascript 11 | 12 | __Javascript the missing manual__ 13 | 14 | 15 | ## Database 16 | 17 | ## linux command line 18 | 19 | cd,ls,mv,rm 20 | 21 | this is enough to begin with and then learn by using. 22 | 23 | if you want more, 24 | 25 | __Learning the Bash Shell__ is a good book 26 | 27 | 28 | ## Web specific 29 | 30 | ### HTML, CSS 31 | 32 | easy enough to learn very quickly for baic use. 33 | 34 | __Learning Web Design__ 35 | 36 | ### HTTP 37 | 38 | __HTTP: The Definitive Guide__ 39 | 40 | 41 | # Your Task: 42 | 43 | find all the book in the library nearby. 44 | 45 | at least, you should find the pdf copy from the internet very easily. 46 | 47 | if you like owning books, you can buy the used book from Amazon very easily, 48 | the version of the book does *not* matter. 49 | 50 | read *all* of them when you have time 51 | 52 | -------------------------------------------------------------------------------- /draft/8_算法.md: -------------------------------------------------------------------------------- 1 | 以上就是一个语言的核心,无论多么复杂的软件都离不开以上这些。 2 | 3 | 看到这里,基本知识已经够刷题用的了。leetcode上所有的题都可以用这里介绍的知识解决。 4 | 5 | 刷题的题目更像数学,或者几个题。我称之为数学问题。 6 | 7 | 如果要解决实际问题,需要进一步学习相关的知识,我称之为应用题。 8 | 9 | 联系数学题当然有益于解决实际问题,但是大部分应用问题并不需要太复杂的数学。这两着直间的平衡请根据目标来调整。 10 | 11 | 我们来看一些刷题的题目,之后再看一些实际问题。 12 | 13 | # 数学题 14 | 15 | ## Add Digits 16 | 17 | Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. 18 | 19 | For example: 20 | 21 | Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. 22 | 23 | ## Hamming distance 24 | 25 | The Hamming distance between two integers is the number of positions at which the corresponding bits are different. 26 | 27 | Given two integers x and y, calculate the Hamming distance. 28 | 29 | ## "All edits that are one edit away from `word`." 30 | 31 | 32 | # 实际问题 33 | 34 | ## spell checker 35 | 36 | http://norvig.com/spell-correct.html 37 | 38 | 39 | ### 自动更正文件中的拼写错误 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /draft/application/web_programming.md: -------------------------------------------------------------------------------- 1 | # 举例说各个语言间的关系 2 | 3 | 举我最近做的一个东西。就是我们做了个调查问卷,期中有个问题是让用户回答自己的 4 | 年龄。分析人员想在网页是输入 5 | 问题的编号,要能把这个问题的答案以boxplot的形式显示出来。 6 | 7 | 大致流程是这样的: 8 | 9 | 当用户输入这个问题的ID之后,浏览器回向服务器发信息。 10 | 服务器得到信息后,进行预处理,把问题的ID告诉你预先写好的程序。 11 | 12 | 这个程序做的是什么呢? 13 | 14 | 显然,要从数据库中调数据,数据拿出来之后,要算百分位数,然后把这些信息,交给 15 | 服务器, 16 | 服务器再发给浏览器。 浏览器拿到数据之后,再开始画图,如果处理得当,你就能看 17 | 到boxplot。 18 | 19 | 大致的信息流是这样的, 20 | 21 | 浏览器 <---> 服务器 <---> 主程序 <---> 数据库 22 | 23 | 服务器,数据库,浏览器,都是大牛们写好的了。一般程序员做的就是与你公司业务相 24 | 关的主程序。 25 | 26 | 浏览器对于做web 的人来说就是前端,浏览器只认三样东西,(HTML,CSS, 27 | JavaScript),所以,要做web developer,必须懂这个。 28 | 29 | 数据库处于最后端,多数数据库只认SQL,你必须得会,至少得懂。 30 | 31 | 任何编程语言都可以写主程序,但不同编程语言有差别,用的人多少有很多的差别,你 32 | 用什么呢?公司决定。 33 | 34 | 主要是(Java,Python,Javascript,Ruby, Perl)。 35 | 36 | 37 | # 找工作要会哪个? 38 | 39 | 很多人说,你那个0基础怎么又要学个编程语言,又要学SQL,还得学个网络框架(web 40 | framework)。 41 | 42 | 顺便说下web framework。程序员写了很多程序,觉得这么多程序都很像啊。把每个程 43 | 序都想似的骨架提取出来。就成了web framework。 44 | 45 | 这么说吧,任何一点你学精都行。关键是你很难学精。另一方面,这样的工作职位很有 46 | 限。 47 | 48 | 反而多学几个东西容易些。个人估计 10个 web developer 大约需要一个 dba,一个运 49 | 维。这个比例会越来越少。 50 | 51 | 又有人会问,根据你前面说的,html,css,JavaScript 也得学啊。这个肯定。 52 | 之所以没说,是因为只要你学通了一个主要的编程语言, 再学这些就容易了。 53 | 54 | 有个人提问说,SQL 要学三个月? 没个项目我都说的三个月,大致的时间。你一星期 55 | 学个差不多了,就学下一个。 56 | 57 | 重中之重,是懂一门编程语言。我工作之前,是不会JavaScript,现在也不少写,原因 58 | 是我已经懂一个编程语言了。我看看文档就知道怎么写了。 59 | 60 | ## 关于提问 61 | 62 | 很多人转行心切,这个可以理解。但是如果你想要做web developer,0 基础的起码要 63 | 学个差不多。 64 | 65 | 不能再少了。静下来,学个半年,再做打算。关键是要学,越学你越知道要学什么。 66 | 67 | 我也不是啥能人,能帮得就是呼吁大家转,想办法,不要坐以待毙。然后你想转,甘心 68 | 做个码农, 69 | 跟着我指的大致方向。 努力加机遇找个工作糊口问题不大。 70 | 71 | 真正要学习,还是靠你自己。如果你不差钱,可以找个班,依赖下他人。 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /零基础转行指南.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | God gives every bird its food, but He does not throw it into its nest. 5 | 6 | 如果你是博士前三四年,转CS 比之前的人容易太多,从今天开始着手申请geogia tech的 online ms。 7 | 8 | 这个项目不要G,要T,没有硬性的prequisite 的课程要求,但是需要你有相关背景。 9 | 据我个人观察,比一般的州立大学要求略低,但也不是你交钱就上。 10 | 11 | 根据reddit/OMSCS的一个帖子,官方的数据显示大致60%的录取率。 12 | 13 | 这个比例很高了,如果你有本科以上学历,再学个编程语言,基本上就可以录取。 14 | 15 | 我觉得如果你处于博士第一,二年,如果不争取上这个硕士,可以说是对自己不负责任。 16 | 17 | 争取在博士毕业前拿到CS MS。 这个成本不到1万倒,不需要家庭支持,用RA/TA 工资就可以支付。 18 | 19 | 20 | 如果你想到转行比较晚了,就比较麻烦,下面的是暴力转的途径。 21 | 22 | 23 | # 从0开始 24 | 25 | ## 1. 会不会Python? 26 | 27 | 或者至少一们编程语言。不会? 你可以去学Python了, 28 | 29 | udacity,cousera 上上课。 30 | 31 | 三个月后,觉得入门了再来看。 32 | 33 | ## 2. 会不会 sql, 34 | 35 | 不会? 三个月后,学会了再来。 36 | 37 | stanford db class, 最经典的课程。 38 | 39 | ## 3. 会不会,web framework? 40 | 41 | 再花三个月,学个mvc web framework。 42 | 43 | ## 4. 可以做找工作的准备了。 44 | 45 | 46 | 写写基本的算法题,网上找职位,投简历,等面试,去工作。 47 | 48 | ## 觉得不可能? 49 | 50 | 花钱读cs master。 前面的三步是你读master得基础,如果你没有这几 51 | 个月的准备,你cs master读起来会很痛苦。 52 | 没条件读cs master? 看1-4. 53 | ## 身份问题怎么解决? 54 | 55 | ### a. 在读博士 ,毕业还早着呢。 56 | 57 | 先1-4,然后拿master 走人,用master的opt找cs的工作。 58 | 59 | 说的简单? 我读博,变态老板整天催着做实验,还要门门拿A,怎么有可能学1-3? 那 60 | 就耗到毕业做postdoc吧。你当初选了生物,现在多努力,亡羊补牢吧。 61 | 62 | 据说,必须拿本专业的offer才能有opt啊? 不是的。 63 | 64 | ### b. postdoc, 65 | 66 | 拿到绿卡为先,有时间先学着. 67 | 68 | ### c. 有身份的大叔大妈。 69 | 70 | 年龄大,找到找不到啊? 你学会东西就行,公司当然想要年轻的,生物PI找postdoc都 71 | 知道要找年轻力状的,公司也不傻。但是,你学会了东西,能完成任务,公司又招不够 72 | 人。机会还是有的。(这个我身边没有具体的例子,不敢肯定)。 73 | 74 | 反正,越年轻转越好,如果你没有希望拿到faculty,a的时候不转,一转眼,就到 b, 75 | c了。 76 | 77 | 78 | ## 编程的谣传 79 | 80 | 编程很难啊,编程对数学的要求高么?我学的会吗? 81 | 82 | 一般的程序员,如果用到数学的话,就是高中第一个月,学的集合的东西。有人怎么给 83 | 我说要学微积分,线性代数?那个人不是程序员, 或者是搞cs的scientist。 84 | 85 | cs 和程序员的关系,与经济学和商人的关系可以类比。 86 | 87 | 你做个商人,根本不需要多少经济学的知识,更多的需要的时常识。 88 | 做程序员也类似,也不需要太多的cs的理论知识,但毕竟是技术性的工作,编程要通。 89 | (就像你做生意,基本的加减乘除总得会) 90 | 91 | # 还有比CS 更好转的专业? 92 | 93 | 我不想转cs,还有那个行业好找工作? 94 | 95 | 基本好找工作的就是cs,不信你看看job hunting版,基本就是马工找工作版。 96 | 97 | 那个job hunting版不能代表全部吧? 很多别的专业找到工作了,连mitbbs都不一定上 98 | 。这个是对的,但大致的趋势是这样的。 99 | 100 | 101 | # 工资问题 102 | 103 | 工资问题。你说的这些都太简单了,找到工作了,能有多少薪水? 5,6万的样子。 104 | jobhunting版那些晒offter的,多是cs科班,本科加硕士六年,10万左右正常。 105 | 你学一年5,6万,那个行业还能这样? 106 | 107 | 108 | # FAQ: 109 | 110 | 111 | ## 从0开始 112 | 113 | Q:我该学那个语言好? 114 | - A:Python。 115 | 116 | Q:我听说过很多语言,人家不都是学C,C++,java 么? 117 | - A: 如果你觉得好,就去学好了。争哪个语言好,可以争个半年。你不确定,就Python. 118 | 119 | Q:我是不是该学C++? 120 | - A:不要再问我任何语言选择的问题! 121 | 122 | 123 | Q: 我学Python,也想上online 课程,有没有推荐? 124 | - A:coursera 上的intro to computer science 之类的课程。这类课程一般是cs 的入门课,也就是说正常的高中毕业生都应该能跟的上。 125 | 126 | 127 | Q:我听说两本关于Python的书,A 和B, 哪个好?该看哪一本? 128 | - A:amazon 看书评就知道哪个好了。两本都要看。一般说来,我不犹豫哪个书好,反 129 | 正就那么点东西。就好比,一个橘子和一个苹果,吃哪一个好呢?都吃。 130 | 131 | 132 | ## CS Master 相关 133 | 134 | 135 | Q:我想上个master,上哪个好? 136 | - A: 我知道的有三个选择,Geogia Tech 的online cs, ITU,还有个East ..待补充。 137 | 138 | Q: Geogia Tech online cs? 139 | - A: http://www.omscs.gatech.edu/ 140 | 141 | 这个项目不要G,要T,没有硬性的prequisite 的课程要求,但是需要你有相关背景。 142 | 据我个人观察,比一般的州立大学要求略低,但也不是你交钱就上。 143 | 144 | 根据reddit/OMSCS的一个帖子,官方的数据显示大致60%的录取率。 145 | 146 | 这个比例很高了,如果你有本科以上学历,再学个编程语言,基本上就可以录取。 147 | 148 | 我觉得如果你处于博士第一,二年,如果不争取上这个硕士,可以说是对自己不负责任。 149 | 150 | Q: ITU? 151 | - A: http://itu.edu/ 152 | 153 | 这个是一个老中办的大学。据wiki上说,频临破产,后因为入学就给full time cpt, 154 | 而起死回生。 155 | 不管怎样,还是希望老中办的大学越来越好。目前,这个学校只要你有本科学位,基本 156 | 就可以了。不要G,T 只要61分,如果你有美国学位,T 不要。 157 | 158 | 159 | 160 | 161 | Q: East Stroudsburg Univ 162 | - A: 参考 http://www.mitbbs.com/clubarticle_t/biojailbreak/128875.html 163 | 164 | Q: 还有别的性价比较好的ms program么? 165 | - A: 肯定是有的,这个就得靠你去搜索了,如果你找到了,请分享。 166 | 167 | 168 | ### 课程选择 169 | 170 | Q: 哪些免费课程可以上? 171 | - A: Coursera,Edx, Udacity. 172 | 173 | Q: Coursera 上有门课,要什么基础?我学的会么? 174 | - A: 这个去那个课程网页看,不管什么基础,你注册,听课看看再说。课程的论坛 175 | 会有详细的说明。那里的同学会给出更详细的说明。 176 | 177 | Q: 该上免费版,还是付费版。 178 | - A: 我没有上过付费的,所以不好说。 179 | 180 | 181 | 182 | # 后记 183 | 184 | Q: 我看了你写的东西,仍然一头雾水。 185 | 186 | - A:你不可能在短短几个小时内,了解我自己摸索了几年的东西。 187 | 188 | 你要做的就是去coursera, edX, Udacity, 注册一门最基本的课。 189 | 入门课的要求就是初中生的水平。 190 | 191 | 同时看这两本书, 192 | 193 | Learning Python 194 | 195 | Flask Web Development: Developing Web Applications with Python 196 | 197 | 看完了,看Flask的代码。 198 | 199 | 然后,有空的时候在来看,把我写的这些东西看明白。就可以去找工作了。 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /draft/application/case_study.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 买面包 (if) 4 | 5 | 一个女人让他的程序员丈夫去商店买东西:你去附近的商店买些面包,如果有鸡蛋的话,买6个回来,这个丈夫买了6个面包回来,他的妻子大吃一惊:你为什么买了6个面包?! 程序员丈夫回答:因为他们有鸡蛋。 6 | 7 | ```{javascript } 8 | bread_price = 2 9 | 10 | total = bread_price * bread_number 11 | 12 | if (egg_availabe) { 13 | egg_number = 6 14 | } 15 | 16 | ``` 17 | 18 | ```{javascript } 19 | bread_price = 2 20 | 21 | if (egg_availabe) { 22 | bread_number = 6 23 | } 24 | 25 | total = bread_price * bread_number 26 | ``` 27 | 28 | 29 | ## 99 bottle of beers (for loop, array) 30 | 31 | Lyrics of the song 99 Bottles of Beer[1](#99beer) 32 | 33 | 34 | ```{} 35 | 99 bottles of beer on the wall, 99 bottles of beer. 36 | Take one down and pass it around, 98 bottles of beer on the wall. 37 | 98 bottles of beer on the wall, 98 bottles of beer. 38 | Take one down and pass it around, 97 bottles of beer on the wall. 39 | 97 bottles of beer on the wall, 97 bottles of beer. 40 | Take one down and pass it around, 96 bottles of beer on the wall. 41 | 96 bottles of beer on the wall, 96 bottles of beer. 42 | Take one down and pass it around, 95 bottles of beer on the wall. 43 | 95 bottles of beer on the wall, 95 bottles of beer. 44 | Take one down and pass it around, 94 bottles of beer on the wall. 45 | 94 bottles of beer on the wall, 94 bottles of beer. 46 | Take one down and pass it around, 93 bottles of beer on the wall. 47 | 93 bottles of beer on the wall, 93 bottles of beer. 48 | Take one down and pass it around, 92 bottles of beer on the wall. 49 | 92 bottles of beer on the wall, 92 bottles of beer. 50 | Take one down and pass it around, 91 bottles of beer on the wall. 51 | 91 bottles of beer on the wall, 91 bottles of beer. 52 | Take one down and pass it around, 90 bottles of beer on the wall. 53 | 90 bottles of beer on the wall, 90 bottles of beer. 54 | Take one down and pass it around, 89 bottles of beer on the wall. 55 | 89 bottles of beer on the wall, 89 bottles of beer. 56 | Take one down and pass it around, 88 bottles of beer on the wall. 57 | 88 bottles of beer on the wall, 88 bottles of beer. 58 | Take one down and pass it around, 87 bottles of beer on the wall. 59 | 87 bottles of beer on the wall, 87 bottles of beer. 60 | Take one down and pass it around, 86 bottles of beer on the wall. 61 | 86 bottles of beer on the wall, 86 bottles of beer. 62 | Take one down and pass it around, 85 bottles of beer on the wall. 63 | 85 bottles of beer on the wall, 85 bottles of beer. 64 | Take one down and pass it around, 84 bottles of beer on the wall. 65 | 84 bottles of beer on the wall, 84 bottles of beer. 66 | Take one down and pass it around, 83 bottles of beer on the wall. 67 | 83 bottles of beer on the wall, 83 bottles of beer. 68 | Take one down and pass it around, 82 bottles of beer on the wall. 69 | 82 bottles of beer on the wall, 82 bottles of beer. 70 | Take one down and pass it around, 81 bottles of beer on the wall. 71 | 81 bottles of beer on the wall, 81 bottles of beer. 72 | Take one down and pass it around, 80 bottles of beer on the wall. 73 | 80 bottles of beer on the wall, 80 bottles of beer. 74 | Take one down and pass it around, 79 bottles of beer on the wall. 75 | 79 bottles of beer on the wall, 79 bottles of beer. 76 | Take one down and pass it around, 78 bottles of beer on the wall. 77 | 78 bottles of beer on the wall, 78 bottles of beer. 78 | Take one down and pass it around, 77 bottles of beer on the wall. 79 | 77 bottles of beer on the wall, 77 bottles of beer. 80 | Take one down and pass it around, 76 bottles of beer on the wall. 81 | 76 bottles of beer on the wall, 76 bottles of beer. 82 | Take one down and pass it around, 75 bottles of beer on the wall. 83 | 75 bottles of beer on the wall, 75 bottles of beer. 84 | Take one down and pass it around, 74 bottles of beer on the wall. 85 | 74 bottles of beer on the wall, 74 bottles of beer. 86 | Take one down and pass it around, 73 bottles of beer on the wall. 87 | 73 bottles of beer on the wall, 73 bottles of beer. 88 | Take one down and pass it around, 72 bottles of beer on the wall. 89 | 72 bottles of beer on the wall, 72 bottles of beer. 90 | Take one down and pass it around, 71 bottles of beer on the wall. 91 | 71 bottles of beer on the wall, 71 bottles of beer. 92 | Take one down and pass it around, 70 bottles of beer on the wall. 93 | 70 bottles of beer on the wall, 70 bottles of beer. 94 | Take one down and pass it around, 69 bottles of beer on the wall. 95 | 69 bottles of beer on the wall, 69 bottles of beer. 96 | Take one down and pass it around, 68 bottles of beer on the wall. 97 | 68 bottles of beer on the wall, 68 bottles of beer. 98 | Take one down and pass it around, 67 bottles of beer on the wall. 99 | 67 bottles of beer on the wall, 67 bottles of beer. 100 | Take one down and pass it around, 66 bottles of beer on the wall. 101 | 66 bottles of beer on the wall, 66 bottles of beer. 102 | Take one down and pass it around, 65 bottles of beer on the wall. 103 | 65 bottles of beer on the wall, 65 bottles of beer. 104 | Take one down and pass it around, 64 bottles of beer on the wall. 105 | 64 bottles of beer on the wall, 64 bottles of beer. 106 | Take one down and pass it around, 63 bottles of beer on the wall. 107 | 63 bottles of beer on the wall, 63 bottles of beer. 108 | Take one down and pass it around, 62 bottles of beer on the wall. 109 | 62 bottles of beer on the wall, 62 bottles of beer. 110 | Take one down and pass it around, 61 bottles of beer on the wall. 111 | 61 bottles of beer on the wall, 61 bottles of beer. 112 | Take one down and pass it around, 60 bottles of beer on the wall. 113 | 60 bottles of beer on the wall, 60 bottles of beer. 114 | Take one down and pass it around, 59 bottles of beer on the wall. 115 | 59 bottles of beer on the wall, 59 bottles of beer. 116 | Take one down and pass it around, 58 bottles of beer on the wall. 117 | 58 bottles of beer on the wall, 58 bottles of beer. 118 | Take one down and pass it around, 57 bottles of beer on the wall. 119 | 57 bottles of beer on the wall, 57 bottles of beer. 120 | Take one down and pass it around, 56 bottles of beer on the wall. 121 | 56 bottles of beer on the wall, 56 bottles of beer. 122 | Take one down and pass it around, 55 bottles of beer on the wall. 123 | 55 bottles of beer on the wall, 55 bottles of beer. 124 | Take one down and pass it around, 54 bottles of beer on the wall. 125 | 54 bottles of beer on the wall, 54 bottles of beer. 126 | Take one down and pass it around, 53 bottles of beer on the wall. 127 | 53 bottles of beer on the wall, 53 bottles of beer. 128 | Take one down and pass it around, 52 bottles of beer on the wall. 129 | 52 bottles of beer on the wall, 52 bottles of beer. 130 | Take one down and pass it around, 51 bottles of beer on the wall. 131 | 51 bottles of beer on the wall, 51 bottles of beer. 132 | Take one down and pass it around, 50 bottles of beer on the wall. 133 | 50 bottles of beer on the wall, 50 bottles of beer. 134 | Take one down and pass it around, 49 bottles of beer on the wall. 135 | 49 bottles of beer on the wall, 49 bottles of beer. 136 | Take one down and pass it around, 48 bottles of beer on the wall. 137 | 48 bottles of beer on the wall, 48 bottles of beer. 138 | Take one down and pass it around, 47 bottles of beer on the wall. 139 | 47 bottles of beer on the wall, 47 bottles of beer. 140 | Take one down and pass it around, 46 bottles of beer on the wall. 141 | 46 bottles of beer on the wall, 46 bottles of beer. 142 | Take one down and pass it around, 45 bottles of beer on the wall. 143 | 45 bottles of beer on the wall, 45 bottles of beer. 144 | Take one down and pass it around, 44 bottles of beer on the wall. 145 | 44 bottles of beer on the wall, 44 bottles of beer. 146 | Take one down and pass it around, 43 bottles of beer on the wall. 147 | 43 bottles of beer on the wall, 43 bottles of beer. 148 | Take one down and pass it around, 42 bottles of beer on the wall. 149 | 42 bottles of beer on the wall, 42 bottles of beer. 150 | Take one down and pass it around, 41 bottles of beer on the wall. 151 | 41 bottles of beer on the wall, 41 bottles of beer. 152 | Take one down and pass it around, 40 bottles of beer on the wall. 153 | 40 bottles of beer on the wall, 40 bottles of beer. 154 | Take one down and pass it around, 39 bottles of beer on the wall. 155 | 39 bottles of beer on the wall, 39 bottles of beer. 156 | Take one down and pass it around, 38 bottles of beer on the wall. 157 | 38 bottles of beer on the wall, 38 bottles of beer. 158 | Take one down and pass it around, 37 bottles of beer on the wall. 159 | 37 bottles of beer on the wall, 37 bottles of beer. 160 | Take one down and pass it around, 36 bottles of beer on the wall. 161 | 36 bottles of beer on the wall, 36 bottles of beer. 162 | Take one down and pass it around, 35 bottles of beer on the wall. 163 | 35 bottles of beer on the wall, 35 bottles of beer. 164 | Take one down and pass it around, 34 bottles of beer on the wall. 165 | 34 bottles of beer on the wall, 34 bottles of beer. 166 | Take one down and pass it around, 33 bottles of beer on the wall. 167 | 33 bottles of beer on the wall, 33 bottles of beer. 168 | Take one down and pass it around, 32 bottles of beer on the wall. 169 | 32 bottles of beer on the wall, 32 bottles of beer. 170 | Take one down and pass it around, 31 bottles of beer on the wall. 171 | 31 bottles of beer on the wall, 31 bottles of beer. 172 | Take one down and pass it around, 30 bottles of beer on the wall. 173 | 30 bottles of beer on the wall, 30 bottles of beer. 174 | Take one down and pass it around, 29 bottles of beer on the wall. 175 | 29 bottles of beer on the wall, 29 bottles of beer. 176 | Take one down and pass it around, 28 bottles of beer on the wall. 177 | 28 bottles of beer on the wall, 28 bottles of beer. 178 | Take one down and pass it around, 27 bottles of beer on the wall. 179 | 27 bottles of beer on the wall, 27 bottles of beer. 180 | Take one down and pass it around, 26 bottles of beer on the wall. 181 | 26 bottles of beer on the wall, 26 bottles of beer. 182 | Take one down and pass it around, 25 bottles of beer on the wall. 183 | 25 bottles of beer on the wall, 25 bottles of beer. 184 | Take one down and pass it around, 24 bottles of beer on the wall. 185 | 24 bottles of beer on the wall, 24 bottles of beer. 186 | Take one down and pass it around, 23 bottles of beer on the wall. 187 | 23 bottles of beer on the wall, 23 bottles of beer. 188 | Take one down and pass it around, 22 bottles of beer on the wall. 189 | 22 bottles of beer on the wall, 22 bottles of beer. 190 | Take one down and pass it around, 21 bottles of beer on the wall. 191 | 21 bottles of beer on the wall, 21 bottles of beer. 192 | Take one down and pass it around, 20 bottles of beer on the wall. 193 | 20 bottles of beer on the wall, 20 bottles of beer. 194 | Take one down and pass it around, 19 bottles of beer on the wall. 195 | 19 bottles of beer on the wall, 19 bottles of beer. 196 | Take one down and pass it around, 18 bottles of beer on the wall. 197 | 18 bottles of beer on the wall, 18 bottles of beer. 198 | Take one down and pass it around, 17 bottles of beer on the wall. 199 | 17 bottles of beer on the wall, 17 bottles of beer. 200 | Take one down and pass it around, 16 bottles of beer on the wall. 201 | 16 bottles of beer on the wall, 16 bottles of beer. 202 | Take one down and pass it around, 15 bottles of beer on the wall. 203 | 15 bottles of beer on the wall, 15 bottles of beer. 204 | Take one down and pass it around, 14 bottles of beer on the wall. 205 | 14 bottles of beer on the wall, 14 bottles of beer. 206 | Take one down and pass it around, 13 bottles of beer on the wall. 207 | 13 bottles of beer on the wall, 13 bottles of beer. 208 | Take one down and pass it around, 12 bottles of beer on the wall. 209 | 12 bottles of beer on the wall, 12 bottles of beer. 210 | Take one down and pass it around, 11 bottles of beer on the wall. 211 | 11 bottles of beer on the wall, 11 bottles of beer. 212 | Take one down and pass it around, 10 bottles of beer on the wall. 213 | 10 bottles of beer on the wall, 10 bottles of beer. 214 | Take one down and pass it around, 9 bottles of beer on the wall. 215 | 9 bottles of beer on the wall, 9 bottles of beer. 216 | Take one down and pass it around, 8 bottles of beer on the wall. 217 | 8 bottles of beer on the wall, 8 bottles of beer. 218 | Take one down and pass it around, 7 bottles of beer on the wall. 219 | 7 bottles of beer on the wall, 7 bottles of beer. 220 | Take one down and pass it around, 6 bottles of beer on the wall. 221 | 6 bottles of beer on the wall, 6 bottles of beer. 222 | Take one down and pass it around, 5 bottles of beer on the wall. 223 | 5 bottles of beer on the wall, 5 bottles of beer. 224 | Take one down and pass it around, 4 bottles of beer on the wall. 225 | 4 bottles of beer on the wall, 4 bottles of beer. 226 | Take one down and pass it around, 3 bottles of beer on the wall. 227 | 3 bottles of beer on the wall, 3 bottles of beer. 228 | Take one down and pass it around, 2 bottles of beer on the wall. 229 | 2 bottles of beer on the wall, 2 bottles of beer. 230 | Take one down and pass it around, 1 bottle of beer on the wall. 231 | 1 bottle of beer on the wall, 1 bottle of beer. 232 | Take one down and pass it around, no more bottles of beer on the wall. 233 | No more bottles of beer on the wall, no more bottles of beer. 234 | Go to the store and buy some more, 99 bottles of beer on the wall. 235 | ``` 236 | 237 | 1: http://www.99-bottles-of-beer.net/info.html --------------------------------------------------------------------------------