自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(67)
  • 资源 (22)
  • 收藏
  • 关注

原创 Good habit to read something every night The linux command line

alt+? list all the possible expansealt+* insert all the possible expanseuniq -D output all the duplicated contentwhich  us

2011-09-22 21:47:43 604

原创 awk 初步

FS: field seperatorOFS: output field seperatorNF: number of fieldsRS (ORS): recorder seperator. To define a logic line!!! When RS = ""

2011-08-28 23:03:57 579

原创 code reading by gtags and m4 step zero

1 Jump in C/C++ function code,   a, match () or {}, C-M-p or C-M-n  b, gtags-find-tag == M-.  c, gtags-pop-stack == M-*  d, gtags-find-rtag

2011-07-11 22:10:55 569

原创 EMACS EVERYDAY

From today on, I will learn emacs everyday.The sum of little thing could be a big one!M-x toggle-readonly:  Convert current buffer to be rea

2011-07-07 17:04:00 562

原创 A Thinker's Diary

<br />I didn't write blog so many days.<br /> <br />Today, I saw a blog wrote how one guy learning Java from zero. That remind me a lot.<br /> <br />I want to learn Java when I'm freshman in college.<br />I remember that's so frastrution I feeled in the be

2011-06-01 17:38:00 700

原创 2011 5-9 生成N个不重复的 (0<x<N) 随机数

<br />问题的提出是在编程珠玑,第二版,中文版(:-)别鄙视我看中文版)第三题,第四题。<br /> <br />我们如何能生成在(0<x<N)范围内的N个数?保证这些数只出现一次?<br /> <br />我想到的比较好的方法是 Merge排序的逆运算。<br /> <br />我们可以先顺序填充数组, 再逐断随机merge(保证随机),<br /> <br />返回一个【start, end) 中的随机数。<br />int GetRandom(int start, int end);<br /> 

2011-05-09 21:27:00 753

原创 2011 4-27 KMP 算法

核心就是两步1 计算next数组,对pattern串进行分析。 复杂度为o(n)2 对target串进行查找。复杂度为 o(m+n)所以总共的复杂度为 o(m+n)#include #include #include using namespace std;int *GetNextArray(const char *const pattern, size_t length) {  // Create next array in heap and initialize its value to zero  i

2011-04-27 22:30:00 559

原创 2011 4-26 Google Coding style 1

<br />1 能用前置声明的地方尽量不使用 #include.<br />前向声明有效:<br />函数的参数或返回值<br />成员变量为该类的引用或指针<br />静态成员变量<br /> <br />无效:<br />继承关系<br />含有该类型的非静态数据成员<br /> <br />2 内联函数<br />谨慎对待析构函数, 析构函数的内联<br />内联那些包含循环或 switch 语句的函数常常是得不偿失<br />虚函数和递归函数就不会被正常内联.<br /> <br />2 #incl

2011-04-27 22:25:00 927

原创 2011 4-25 计数排序

<br /><br />#pragma once<br /> <br />#include <iostream><br />// #include <utility><br />using std::cout;<br />using std::endl;<br />using std::pair;<br /> <br />template<typename value_type><br />void counterSortImp(const value_type *const array, const pa

2011-04-26 10:31:00 605

原创 2011-4-15 堆排算法

<br /><br />I made a promise, <br />I keep my promise.<br /> <br />Wish my best wish,<br />to come true.<br /> <br />// We do not use the first element of the array.<br />// It's more easy to calculate the child index.<br /> <br />// every time this functi

2011-04-15 07:22:00 594

原创 2011-4-15 快排算法,堆排算法

<br />一下是我写的快排的源码,欢迎指正:<br /> <br /><br />template<typename value_type><br />int get_pivot_index(value_type * array, int start, int end) <br />{<br />value_type pivot = array[start];<br /> <br />while (start < end)<br />{<br />while( (start<end) && (array[

2011-04-15 00:07:00 661

原创 2011 4-13 A strange link error 2001 about inline function

<br />VS 中今天遇到一个奇怪的问题:<br />在头文件中声明inline函数, 源文件中实现,结果在使用时会产生lnk2001错误。<br /> <br />通过网络搜到的关于lnk2001的较为全面的解释:<br /> <br />  以下是可能产生LNK2001错误的原因: <br />  一.由于编码错误导致的LNK2001。 <br />  1.不相匹配的程序代码或模块定义(.DEF)文件能导致LNK2001。例如,   <br />如果在C++   源文件内声明了一变量“var1”,却试

2011-04-13 14:36:00 694

原创 2011 4-12 boost source code reading -

STL容器对元素的要求:1) 必须是可拷贝的,也就是有一个拷贝构造函数。       有些类就不适合作为容器的元素,例如:auto_ptr2) 必须是可赋值的,也就是说=操作符。3)必须有析构函数而且不能是私有的。*********************************************************************************************template inline void checked_delete(T * x){    // intent

2011-04-12 16:09:00 847

原创 Sun Apr 10 The help system of Emacs

<br />I have found a very useful web-sit to learn Emacs:<br />http://www.ibm.com/developerworks/cn/aix/lp/emacsnew.html<br />which is a tutor material of Emacs editing environment.<br /> <br />To use the help system of emacs, pay attention of C-h<br /> <br

2011-04-10 17:59:00 618

原创 Thu Apr 7 using cscope in emacs

<br />1 How to install cscope to emacs in Ubuntu?<br /> <br />sudo apt-get install cscope-el cscope<br /> <br />NOTICE: Do not forget cscope-el<br /> <br /> <br /> <br />2 How to use cscope in emacs<br /> <br />After cscope installed, it will add a menu to

2011-04-07 16:44:00 477

原创 Thu Apr 7 using cscope in emacs

<br />1 How to install cscope to emacs in Ubuntu?<br /> <br />sudo apt-get install cscope-el cscope<br /> <br />NOTICE: Do not forget cscope-el<br /> <br /> <br /> <br />2 How to use cscope in emacs<br /> <br />After cscope installed, it will add a menu to

2011-04-07 16:43:00 524

原创 2011 4-6 fatal error LNK1169: one or more multiply defined symbols found

<br />今天工程出现了这个问题,<br />经检查,是关于callback函数的问题。<br /> <br />我分别在两个不同的cpp文件里同时实现了两个callback函数,<br />结果就出现了这个链接错误。<br /> <br />一般情况下,出现这个错误是因为在头文件里定义了变量或函数。<br /> <br />正确的做法是将定义写在cpp源文件中,在头文件中 extern 出想在别处使用的函数。<br /> <br />即使是源文件内部使用的函数,也要保证有不同的函数名称,以免出现符号重复

2011-04-06 16:36:00 827

原创 Macro expand in C programming language

<br /><br />Just yesterday, a question came into my mind:<br />When a C compiler preprocess the macro define?<br /> <br />So comes a test in Ubuntu 10.10<br />gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5<br /> <br />// Header file<br />#ifndef TEST_H__<br />#

2011-03-24 10:34:00 654

原创 Mon Mar 21, 2011

<br />$* 表示shell文件的所有参数及其空格连在一起作为单个词处理<br />$@ 表示与shell文件接收的参数等价,参数中的空格被忽略,其结果等同与原来参数的一个单词列表。<br /> <br />$# shell文件的参数个数。<br /> <br /> 

2011-03-21 21:50:00 666

原创 Mon Mar 21, 2011

<br />$* 表示shell文件的所有参数及其空格连在一起作为单个词处理<br />$@ 表示与shell文件接收的参数等价,参数中的空格被忽略,其结果等同与原来参数的一个单词列表。<br /> <br />$# shell文件的参数个数。<br /> <br /> 

2011-03-21 21:49:00 609

原创 Sun Mar 20, 2011

<br />Today, I wanna borrow <br /><Structure and Interpretation of Computer Programs><br />           from National library.<br /> <br />And continue to learn Unix programming environment.<br /> <br />The following is a shell script partly.<br /> <br />cat

2011-03-20 22:04:00 413

原创 2011 3-15 读http://dreamhead.blogbus.com/ 有感

<br />凡事贵在坚持。<br /> <br />动手实践要远比光说不做强很多。<br /> <br />文章不怕短,就怕长。<br />短小的文章即使很烂,也烂得清楚,别人可以喽一眼就走。<br /> <br />如果是很长的文章,即使很好,等人看到最后,却忘记了前面讲的啥了。

2011-03-15 17:39:00 603

转载 彻底解密C++宽字符:4、利用codecvt和use_facet转换

<br />原文链接: http://www.cppblog.com/lf426/archive/2010/06/26/118772.html<br /> <br />locale和facet<br /><br />C++的locale框架比C更完备。C++除了一个笼统本地策略集locale,还可以为locale指定具体的策略facet,甚至可以用自己定义的facet去改造一个现有的locale产生一个新的locale。如果有一个facet类NewFacet需要添加到某个old_loc中形成新new_loc

2011-03-11 11:09:00 1062

原创 2011 3-1 Abstract of

<br /><br />********************************************************************************<br />General Principles<br /> <br />1 Adhere to the style of the original<br />2 Adhere to the Principle of Least Astonishment<br />    Simplicity Clarity Complete

2011-03-01 18:02:00 521

原创 2011 2-25

6, 自动生成依赖性编译器的 -M 选项,gnu compiler则要 -MM %d: %.c@set -e; rm -f $@ /$(CC) -MM $(CPPFLAGS) $ $@.$$$$;/sed 's, /($*/)/.o[ :]*,/1.o $@ : ,g' $@; /rm -f $@.$$$$# $$$$ 自动生成的四位随机数********************************************************************************WRIT

2011-02-25 17:49:00 552

原创 2011 2-22 Tuesday

<br /><br />6, makefile name: GNUmakefile makefile Makefile or<br />   any name you could specified : make -f XXmakefile.name<br /> <br /> 7, include foo.make *.mk $(bar)<br /> make just expend the makefile content to the position of include xx.make<br /> 

2011-02-22 16:02:00 470

原创 2011 2-21

<br /><br />0, The basic formula: <br />Target: prerequisites<br />command to use prerequisites to generate target.<br />(cc -c xx.c -o xx.o, cc -o executable objects)<br /> <br />1, using  '/' to add two line together.<br /> <br />2, 伪目标文件 .PHONY标识<br /> 

2011-02-21 18:45:00 412

原创 2011 2-15

<br />flyweight 享元模式<br />重点在共享,封装共享元素的创建,节省内存占用。<br />对非共享元素,可以特殊处理。<br /> <br />共享内部状态,外部状态可单独创建对象。使用decoration模式。<br /> <br />*************************************************<br /> <br />解释器模式<br /> <br />针对context,不同解释器可以进行不同的解释。<br /> <br /><br />***

2011-02-16 16:34:00 368

原创 2011 2-14

<br />状态模式,<br />将与状态有关的代码封装在类里面,并且将状态的转移设置为状态内在的方法<br /> <br />state.change(context)<br /> <br />*************************************************************<br /> <br />迭代器模式,<br />迭代器与容器捆绑,对外暴露对容器内元素的访问,从而封装了访问的细节。<br /> <br />iterator.setContainer(con

2011-02-15 10:00:00 351

原创 2011 2-12

<br />builder, strategy, 一种方法,应用的目的不同<br /> <br />proxy 和 facade 有天然的包含关系<br /> <br />composite 和 decoration 是一种扩展<br /> <br />里氏代换原则,开闭原则, 正交原则<br /> <br /> <br /> <br /> 

2011-02-12 18:46:00 384

原创 Janu. 26

<br />很多天没写了。<br />今天,郑重记录下新年的希望:<br /> <br />学会python。<br /> <br />学会 lisp。<br /> <br />掌握游戏开发。<br /> <br />开发出本人这辈子的第一款游戏。<br /> <br />读完code complete。<br /> <br />完成夙愿。<br /> <br /> <br />一年以后的今天,我一定会再回来,检查我这一年的收获。

2011-01-26 19:45:00 439

原创 Janu. 11

<br /> // use counted handle class for the T hierarchytemplate <typename T>class Handle {public:// default constructor: unbound handleHandle(): p(0), use(new std::size_t(1)) { }// attaches a handle to a copy of the T object//Handle(const T& ref): p(new T(r

2011-01-11 19:19:00 411

原创 Jan 10

<br />通过using 关键字重新声明基类成员的访问控制属性<br /> <br />能从子类赋值向基类,反之则不行,即使是指针或者引用也不行。<br /> <br />基类中定义的static成员,共享于基类和子类。<br /> <br />贴一段检查身份证号码的C代码,绝对原创,至于算法,那是copy别处的,呵呵。<br /> <br /> <br />bool CheckID(string ID) {<br />const int auxiliary_array[] = {<br />7,9,10

2011-01-10 23:32:00 549

原创 Janu. 7

<br />先记录一下一些奇思妙想:<br /> <br />1 Kindle皮套在背面加上手指套,方面单手拿。<br />老外为啥没想到呢? 可能他们手大,单手很方便拿吧。<br /> <br />2 智能交通之三层引导,由公交车想到的。类似于火车头牵引的智能交通方案。<br /> <br />*****************************************************<br />************************************************

2011-01-07 19:08:00 9120

原创 Janu. 6

<br />static<br />初始化与定义的位置<br />const static 初始化与定义的位置<br />static 函数<br /> <br />friend<br />类,函数,类的函数。要注意重载问题<br /> <br />类的作用域<br />在类外定义的类的成员函数的返回值不在类的作用域内。<br /> <br /> <br />类的声明与定义<br />类定义最后的分号 ;<br />类声明后,使用的注意事项: 函数的形参和返回值, 成员变量只能是指针或引用。<br /> <

2011-01-06 18:09:00 1851

原创 Janu. 5

<br />今天看新闻,中国首次对“强奸”男性者究刑责<br />http://msn.ynet.com/view.jsp?oid=75894261<br /> <br />顿时菊花一紧,莫非我党变聪明了?今后如果有哪位敢<br />告官强奸,牛逼些的就能反告:当时是你Y强奸我!<br /> <br />对于国家的公仆,我一向以最坏的打算来预计,但现实<br />往往依然超出我的预计:<br /> <br />居民阻止强制施工被碾死 执法者视而不见|强制施工|碾压_新浪视频<br />http://vide

2011-01-05 19:38:00 394

原创 Janu. 4

<br />新年新气象,哈哈。<br /> <br />继续C++ primer的学习。<br /> <br />relative container<br />map             set<br />multimap      multiset<br /> <br />按索引访问,不同于sequence container<br /> <br />function:<br />find;  count; <br />for multi** specified:<br />upper_bound

2011-01-04 19:35:00 338

原创 Dec, 27

<br />重用fstream必须注意 clear和close函数的调用。<br />不然会导致无法复用。<br /> <br />文件模式<br />ate append to end 打开即定位到尾部<br />app append 写之前定位到尾部<br />in<br />out<br />trunc 打开并清空已经存在的文件流。<br /> <br />stringstream<br />decUse decimal base (manipulator function)hexUse hexade

2010-12-27 19:35:00 589

原创 Sat Dec 25

<br />注意,以下声明是不同的哦<br />int *matrix[10]; // array of 10 pointers<br />int (*matrix)[10]; // pointer to an array of 10 ints<br /> <br />因为[]的优先级要比*的优先级高。<br /> <br />***************************************<br />***************************************<br /> 

2010-12-25 23:51:00 856

原创 Dec, 22

<br />函数的参数定义多文章<br /> <br />形参为引用或者指针的,不能传递表达式。因为表达式没地址<br /> <br /> <br />形参为非const的,不能传递const参数给函数。<br />因此,要尽量将参数定义为const的。<br /> <br /> <br />C++中数组作为函数参数,<br />形参为非引用形式时,实际传递的参数是指针。<br />形参为引用时,实际传递的是实际的数组。该参数包含有数组的大小等信息。<br />void printArray(int (*a

2010-12-23 11:45:00 494

Asimov, Isaac - Foundation 1-7

Asimov, Isaac Foundation 1-7 English version txt file

2009-12-26

王泛森:如果让我重做一次研究生

王泛森:如果让我重做一次研究生 王泛森:如果让我重做一次研究生 王泛森:如果让我重做一次研究生

2009-12-01

高级bash脚本编程指南 6.0 最新版

高级 bash 脚本 编程指南 6.0 最新版 2009 高级 bash 脚本 编程指南 6.0 最新版 2009 高级 bash 脚本 编程指南 6.0 最新版 2009

2009-11-02

make 中文手册,徐海斌 v3.8

make 中文手册 徐海斌 v3.8 make 中文手册 徐海斌 v3.8 make 中文手册 徐海斌 v3.8

2009-11-02

Learning Mutt

Learning Mutt 基础教材 开源 Learning Mutt 基础教材 开源 Learning Mutt 基础教材 开源 Learning Mutt 基础教材 开源

2009-10-28

Mutt windows 版本

Mutt windows 邮件客户端 内涵中文 配置文档 linux下的牛B邮件客户端 移植到了windows了! 无法打开的可以下载7zip来打开。 7zip是夸平台压缩解压缩软件。

2009-10-27

c 编程艺术 第二章

c 编程艺术 第二章 c 编程艺术 第二章 c 编程艺术 第二章 c 编程艺术 第二章 c 编程艺术 第二章

2009-10-25

nachos 芝加哥大学 计算机系 代码阅读 指导

nachos 芝加哥大学 计算机系 代码阅读 指导 nachos 芝加哥大学 计算机系 代码阅读 指导 nachos 芝加哥大学 计算机系 代码阅读 指导

2009-10-02

gvim 7 彩色主题包

gvim 7 彩色主题包 gvim 7 彩色主题包 gvim 7 彩色主题包

2009-09-24

c vim 插件 强烈推荐

c vim 插件 强烈推荐 c vim 插件 强烈推荐 c vim 插件 强烈推荐

2009-09-24

北航 《编译技术》课程设计

《编译技术》课程设计 《编译技术》课程设计 《编译技术》课程设计

2009-09-17

北航《编译原理》课程学习实践包 《编译原理》课程学习实践包

《编译原理》课程学习实践包 《编译原理》课程学习实践包 《编译原理》课程学习实践包

2009-09-17

图灵奖大师讲座之二_The Future of Computer Science[090616]

图灵奖大师讲座之二_The Future of Computer Science[090616] 图灵奖大师讲座之二_The Future of Computer Science[090616]

2009-09-17

Algorithms Design and Analysis

Algorithms Design and Analysis Algorithms Design and Analysis Algorithms Design and Analysis

2009-09-17

Addison-Wesley.Professional-Programming.in.Python. .A.Complete.Introduction.to.the.Python.Language.

This book's coverage includes Developing in Python using procedural, object-oriented, and functional programming paradigms Creating custom packages and modules Writing and reading binary, text, and XML files, including optional compression, random access, and text and XML parsing Leveraging advanced data types, collections, control structures, and functions Spreading program workloads across multiple processes and threads Programming SQL databases and key-value DBM files Utilizing Python's regular expression mini-language and module Building usable, efficient, GUI-based applications Advanced programming techniques, including generators, function and class decorators, context managers, descriptors, abstract base classes, metaclasses, and more

2009-04-15

visemacs文档

emacs 模拟器 在visual studio 2003 以上版本

2008-10-14

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除