03 2015 档案

google protobuf 使用示例
摘要:1 定义.proto接口文件package tutorial;message Person { required string name = 1; required int32 id = 2; //unique ID number for this person optional ... 阅读全文

posted @ 2015-03-31 16:48 雨渐渐 阅读(4132) 评论(0) 推荐(0) 编辑

c++ 虚方法
摘要:#include #include using namespace std;class Pet{public: Pet(string theName); void eat(); void sleep(); virtual void play();protected: s... 阅读全文

posted @ 2015-03-31 13:15 雨渐渐 阅读(260) 评论(0) 推荐(0) 编辑

c++ 链接
摘要:header.h#ifndef HEADER_H#define HEADER_Hunsigned long getFac(unsigned short num);static const unsigned short headerNum = 5;#endif // HEADER_H_INCLUDED... 阅读全文

posted @ 2015-03-30 13:18 雨渐渐 阅读(191) 评论(0) 推荐(0) 编辑

c++ 异常处理 assert | try
摘要:#include #include using namespace std;int main(){ int i = 1; assert(i == 65); cout #includeusing namespace std;unsigned long getFact(unsigned... 阅读全文

posted @ 2015-03-29 21:32 雨渐渐 阅读(930) 评论(0) 推荐(0) 编辑

c++ 容器类
摘要:#include #include #include #include using namespace std;void test_map();struct Person{ string name; int age;};int main(){ vector vs; //lis... 阅读全文

posted @ 2015-03-24 15:49 雨渐渐 阅读(197) 评论(0) 推荐(0) 编辑

protobuf 向前兼容向后兼容
摘要:http://blog.163.com/jiang_tao_2010/blog/static/12112689020114305013458/ 不错的protobuf、、protobuf的编码方式:http://wangjunle23.blog.163.com/blog/static/1178... 阅读全文

posted @ 2015-03-24 14:33 雨渐渐 阅读(30542) 评论(0) 推荐(0) 编辑

命名空间和模块化编程,头文件
摘要:#include #include #include "dynamic_memory.h"Company::Company(std::string theName){ name = theName;};void Company::printInfo(){ std::cout printI... 阅读全文

posted @ 2015-03-22 22:33 雨渐渐 阅读(186) 评论(0) 推荐(0) 编辑

对象3:继承
摘要:#include #include using namespace std;class Animal{public: string mouth; void eat(); void sleep(); void drool();};class Pig : public Anima... 阅读全文

posted @ 2015-03-22 15:16 雨渐渐 阅读(138) 评论(0) 推荐(0) 编辑

动态内存 this指针
摘要:#include #include class Company{public: Company(std::string theName); virtual void printInfo();protected: std::string name;};class TechCompan... 阅读全文

posted @ 2015-03-22 11:17 雨渐渐 阅读(210) 评论(0) 推荐(0) 编辑

对象2 构造,析构
摘要:#include #include #include class StoreQuote{public: std::string quote, speaker; std::ofstream fileOutput; StoreQuote(); ~StoreQuote(); ... 阅读全文

posted @ 2015-03-21 23:42 雨渐渐 阅读(207) 评论(0) 推荐(0) 编辑

对象 1 作用域解析符 ::
摘要:1 对象举例#include using namespace std;class Car {public: string color; string engine; float gas_tank; unsigned int wheel; void running(voi... 阅读全文

posted @ 2015-03-21 22:10 雨渐渐 阅读(317) 评论(0) 推荐(0) 编辑

结构体 typedef关键字
摘要:1 结构体#include #include using namespace std;void printBook( struct Book book );struct Book{ char title[50]; char author[50]; char subject[100]... 阅读全文

posted @ 2015-03-21 21:43 雨渐渐 阅读(174) 评论(0) 推荐(0) 编辑

c++ 文件读写
摘要:1 文件写#includeusing namespace std;int main(){ ofstream out("w.txt"); if(out.is_open()) { out #includeusing namespace std;int main(){ char buff[256];... 阅读全文

posted @ 2015-03-21 21:15 雨渐渐 阅读(181) 评论(0) 推荐(0) 编辑

指针的详解
摘要:1 NULL指针2 指针的算数运算3 指针 VS 数组4 指针数组5 指向指针的指针6 传递指针给函数7 从函数返回指针1 NULL 指针#include using namespace std;int main(){ //如果没有确切的地址可以赋值,为指针变量赋一个 NULL 值是一个良好的... 阅读全文

posted @ 2015-03-20 18:35 雨渐渐 阅读(253) 评论(0) 推荐(0) 编辑

有意思
摘要:公式为:(id = crc32(key) % 1024),其中key是url字符串,比如:"http://www.baidu.com",问id=?id = CRC32(key) % 1024,来自豌豆荚codis中设置 server group 服务的 slot id 的选举公式:(Slot Id ... 阅读全文

posted @ 2015-03-20 15:51 雨渐渐 阅读(160) 评论(0) 推荐(0) 编辑

函数 传值调用 指针调用 引用调用
摘要:#include using namespace std;int max(int num1, int num2);void swap(int *x, int *y);void swap(int &x, int &y);int main(){ cout num2) return ... 阅读全文

posted @ 2015-03-19 17:09 雨渐渐 阅读(257) 评论(0) 推荐(0) 编辑

python 装饰器
摘要:http://www.cnblogs.com/rhcad/archive/2011/12/21/2295507.html 阅读全文

posted @ 2015-03-19 16:52 雨渐渐 阅读(83) 评论(0) 推荐(0) 编辑

对象
摘要::: 作用域解析符,告诉方法属于哪一个类 阅读全文

posted @ 2015-03-18 23:38 雨渐渐 阅读(83) 评论(0) 推荐(0) 编辑

指针 取地址& 解引用 *
摘要:#includeusing namespace std;int main(){ int a = 123; float b = 3.14; char c = 'C'; unsigned long d = 19880808; string e = "i love fishc... 阅读全文

posted @ 2015-03-18 22:48 雨渐渐 阅读(429) 评论(0) 推荐(0) 编辑

awk 的一个奇怪异常
摘要:awk: cmd. line:1: (FILENAME=- FNR=192) fatal: print to "standard output" failed (No space left on device)1045827 awk: cmd. line:1: (FILENAME=- FNR=218... 阅读全文

posted @ 2015-03-11 10:34 雨渐渐 阅读(1346) 评论(0) 推荐(0) 编辑

kill 进程卡住,超时kill方法
摘要:还是有漏洞 ,万一 working.py未超时, kill_job.sh 会不会杀死别人的进程啊start.sh#!/bin/bashpython working.py &python working.py &python working.py &pids=$(jobs -p)echo $pids... 阅读全文

posted @ 2015-03-10 17:10 雨渐渐 阅读(636) 评论(0) 推荐(0) 编辑

mapreduce 多路输出
摘要:Streaming支持多路输出(SuffixMultipleTextOutputFormat)如下示例:hadoop streaming \-input /home/mr/data/test_tab/ \-output /home/mr/output/tab_test/out19 \-outputf... 阅读全文

posted @ 2015-03-10 00:01 雨渐渐 阅读(782) 评论(0) 推荐(0) 编辑

stdout 编码 vim 删除左边,右边
摘要:sys.stdout = codecs.getwriter('utf8')(sys.stdout)vimdic['kkkk'] = qqqqqdic['bbbb'] = aaaaaadic['kkkk'] = qqqqqdic['bbbb'] = aaaaaadic['kkkk'] = qqqqqd... 阅读全文

posted @ 2015-03-08 14:24 雨渐渐 阅读(171) 评论(0) 推荐(0) 编辑

积累碎片shell
摘要:date -d next-day +%Y%m%d 阅读全文

posted @ 2015-03-03 23:31 雨渐渐 阅读(96) 评论(0) 推荐(0) 编辑

导航