Tag Archives: tutorial

How to Think Like a Computer Scientist 学习笔记(二)

Chapter 2. Variables, expressions and statements
值(Value)与类型(Type)
每个值属于不同的类型,如整形(int),字符串(str),浮点型(float)
变量(Variable)
变量是代表一个值的名称。(assignment statement)新建了一个变量,并为其赋值。(assignment operator)即“=”
变量名与关键字(Keyword)
变量名有一定的要求,并不是每个名称都可用。
关键字是编程语言用来表述规则或结构的名称,变量名不能是关键字。
python有31个关键字。
声明(Statement)
声明是python可以解释执行的一条指令。
操作符(Operator)
包括+ – * / **以及括号。一般的编程语言在计算时采用普通的计算顺序,括号>成方>乘除>加减。
其他
python的输入函数
raw_input(“Please enter your name: “)
input(“Enter a numerical expression: “)
注释(Comment)
用#进行注释

How to Think Like a Computer Scientist 学习笔记(一)

How to think like a computer scientist : Learning with Python v2nd edition
很不错的一个教程,不仅仅从头讲解了Python,更重要的是帮助我把计算机编程知识进行了一次梳理。
学习笔记(一)针对的是第一章 The way of the program
作为一名计算机科学家,最重要的是解决问题的能力。(Problem solving)
Python
编程语言可以分为高层语言(High-level language)和低层语言(Low-level language)。高层语言,比如c++,java,python,需要先转换成低层语言,比如汇编,因此会花费一些时间,这也是高层语言的缺陷。但是高层语言有很大优势

编程方便,容易理解
更加轻便(portable),可移植性更好,底层语言需要针对不同平台进行修改

高层语言转换为地层语言的程序有两种:解释器(interpreter)和编译器(compiler)。解释器读取代码,一步步执行代码。编译器把源代码 (Source code)编译为对象码(Object code),然后再执行。
现代的编程语言普遍采用了这两种方式,先把源代码编译为字节码(Byte code),然后在虚拟机(Virtual machine)中解释执行。
Python也采用了这两种方式,但是由于程序员编程的方式,一般把python看做解释性语言。Python有两种解释方式:shell mode和script mode。
什么是程序
程序是顺序的计算指令。它包含了input, output, math, conditional execution, repetition,任何程序都是由这几个要素组成的。
什么是Debug
程序的错误就是bug,解决bug就是debug。
程序的错误分为三种:语法错误(syntax error),运行时错误(runtime error),语意错误(semantic error)。
对于一些人,编程和debug是同时进行的,可以保证程序的可运行性。
形式语言和自然语言
自然语言(Natural language)就是世界上的语言,英语法语等
形式语言(Formal language)是人们为了某个目的设计的,比如数学和化学中语言
形式语言有两个要素:token和structure。分析语言的过程就是parsing。
相比于形式语言,自然语言不明确(ambiguity),重复(redundancy),literalness。

Intro to Distributed Version Control (Illustrated)

上篇介绍版本控制,这篇介绍了分布式的版本控制,与集中式vc相比,分布式vc有很多好处。

Traditional version control helps you backup, track and synchronize files. Distributed version control makes it easy to share changes. Done right, you can get the best of both worlds: simple merging and centralized releases.
Distributed? What’s wrong with regular version control?

A Visual Guide to Version Control

这篇文章介绍了Version Control版本控制的一些基本概念。

Version Control (aka Revision Control aka Source Control) lets you track your files over time. Why do you care? So when you mess up you can easily get back to a previous working version.
You’ve probably cooked up your own version control system without realizing it had such a geeky name. Got any files like [...]

Getting Started with Parallel Programming

自我感觉很不错的一篇文章,介绍并行计算的。
Multi-core computers have shifted the burden of software performance from chip designers to software architects and developers. In order to gain the full benefits of this new hardware, we need to parallelize our code. The goal of this article is to introduce you to parallelism, its different types and to help you understand when  to [...]