Notes on Programming in C by Rob Pike

Notes on Programming in C

    Rob Pike                  
February 21, 1989

Introduction

     Kernighan and Plauger’s The Elements of Programming Style was an important and rightly influential book.  But sometimes I feel its concise rules were taken as a cookbook approach to good style instead of the succinct expression of a philosophy they were meant to be.  If the book claims that variable names should be chosen meaningfully, doesn’t it then follow that variables whose names are small essays on their use are even better?  Isn’t MaximumValueUntilOverflow a better name than maxval I don’t think so.
Continue reading Notes on Programming in C by Rob Pike

Django notes

1. create a new directory and start a project by run: django-admin.py startproject lsite
2. Running the development server: python manage.py runserver (just local)
3. start the interactive interpreter: python manage.py shell
4. setup TEMPLATE DIR  inside settings.py
 

Kill the annoying "downloading" process

If you failed at download one package in “apt-get install” commands. it’ll keep downloading it if you run “apt-get install” next time. it is really annoying.
you should kill the downloading process by check string related in the following dir or files:
“/usr/share/package-data-downloads/”
“/var/lib/update-notifier/package-data-downloads/”
“/usr/share/update-notifier/package-data-downloads-failed”
“/var/lib/update-notifier/user.d/data-downloads-failed”
“/usr/share/update-notifier/package-data-downloads-failed-permanently”
“/var/lib/update-notifier/user.d/data-downloads-failed-permanently”
and deleted the string or file related.
 

emacs editor

emacs file.txt 创建或查看file.txt
帮助——Ctrl+h
中止——Ctrl+g
移动——Ctrl+b, Ctrl+n, Ctrl+f, Ctrl+p (左,下,右,上)
删除字符——Ctrl+d
删除行——Ctrl+k
到达行首,到达行尾——Ctrl+a,Ctrl+e
停止——Ctrl+x,Ctrl+c
另存为——Ctrl+x,Ctrl+w
保存文件——Ctrl+x,Ctrl+s
向前搜索,向后搜索——Ctrl+r,Ctrl+s
启动指南——Ctrl+h,t
撤销——Ctrl+x,u

vi editor

vi file.txt: 创建或查看file.txt; 按i插入文本,按a添加文本。
光标移动——h、j、k、l(左、下、上、右)
删除字符——x
删除行——dd
模式切换——esc
退出不保存——:q!
强制推出并保存——:wq!
文本搜索——/