自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(61)
  • 资源 (3)
  • 收藏
  • 关注

转载 lucene与fst

lucene字典实现原理http://blog.jobbole.com/80669/

2015-07-16 09:27:22 614

转载 gdb 调试命令

http://blog.chinaunix.net/uid-9525959-id-2001805.html

2015-04-17 17:08:43 400

转载 stl map vector的删除

http://blog.chinaunix.net/uid-630435-id-88932.html      std::list List;      std::list::iterator itList;      for( itList = List.begin(); itList != List.end(); )      {            if( Wi

2015-04-03 11:50:11 405

转载 为什么一般hashtable的桶数会取一个素数

http://blog.sina.com.cn/s/blog_8e9c63c70101g3ep.html我个人认为更普遍意义的理解,如果不取素数的话是会有一定危险的,危险出现在当假设所选非素数m=x*y,如果需要hash的key正好跟这个约数x存在关系就惨了,最坏情况假设都为x的倍数,那么可以想象hash的结果为:1~y,而不是1~m。但是如果选桶的大小为素数是不会有这个问

2015-02-06 10:52:07 1634

原创 用objgraph定位python内存泄漏

http://www.lshift.net/blog/2008/11/14/tracing-python-memory-leaks/http://mg.pov.lt/objgraph/http://mg.pov.lt/blog/python-object-graphs.html注:要生成对象引用图片,不一定要安装xdot,也可以用graphviz。yum -y instal

2015-02-02 09:27:15 2346

转载 C++ 拷贝构造函数 赋值构造函数

http://blog.chinaunix.net/uid-25808509-id-354211.html拷贝构造函数和赋值构造函数的异同由于并非所有的对象都会使用拷贝构造函数和赋值函数,程序员可能对这两个函数有些轻视。请先记住以下的警告,在阅读正文时就会多心:如果不主动编写拷贝构造函数和赋值函数,编译器将以“位拷贝”的方式自动生成缺省的函数。倘若类中含有指针变量,那么这两个缺

2015-01-09 17:27:23 345

转载 auto_ptr

http://blog.csdn.net/weiwenhp/article/details/8706864

2014-10-30 17:07:51 412

转载 unique_ptr

http://blog.csdn.net/weiwenhp/article/details/8708281

2014-10-30 17:02:18 357

转载 LSM-Tree 相关

海量存储系列之八  http://qing.blog.sina.com.cn/1765738567/693f0847330008ii.html

2014-10-22 15:47:51 346

转载 memcached的线程模型

http://blog.csdn.net/tenfyguo/article/details/5274435

2014-08-31 18:29:26 411

转载 内存泄露定位 - MEMWATCH

4.   容易出现的问题4.1 在memwatch.h之后包含string.h时,编译时提示strdup()出错!    解决办法:可以将string.h放置在memwatch.h之前;也可以修改memwatch.h,使其包含string.h.

2014-08-18 10:24:36 694

转载 ev.c

# 1 "ev.c"# 1 ""# 1 ""# 1 "ev.c"# 45 "ev.c"# 1 "config.h" 1# 46 "ev.c" 2# 167 "ev.c"# 1 "/usr/include/stdlib.h" 1 3 4# 25 "/usr/include/stdlib.h" 3 4# 1 "/usr/include/features.h" 1 3 4# 361

2014-07-19 10:10:10 2619

原创 ev.h

g++ -E ev.h

2014-07-18 16:13:17 3564

转载 浅谈过载保护

http://djt.qq.com/article/view/156

2014-07-18 14:11:48 441

转载 安装完 MySQL 后必须调整的 10 项配置

http://weibo.com/2712374873/BdkNaaWyQ

2014-07-16 10:23:48 320

转载 pthread_cond_wait与signal

http://www.domaigne.com/blog/computing/condvars-signal-with-mutex-locked-or-not/Signal with Mutex Locked On some platforms, the OS performs a context switch to the woken thread right after

2014-07-15 07:57:55 492

转载 线程局部变量与 __thread

http://www.searchtb.com/2012/09/tls.html个人

2014-07-15 07:55:55 375

转载 pthread_once

如果希望多个线程里面某些部分只是执行一次的话,可以使用下面这个接口:pthread_once_t initflag=PTHREAD_ONCE_INIT;int pthread_once(pthread_once_t* initflag,void (*initfn)(void));然后再每个线程里面调用pthread_once.下面是一个例子:#include #include #

2014-07-03 09:45:02 527

转载 可重入函数

假设我们正在执行函数A,而正在这个时候出发了信号处理函数,里面也调用了A.我们必须确保两次调用A的结果都完全正确。如果保证调用完全正确的话,那么这个函数就是可重入函数。很明显可重入函数,对应着就是没有使用全局变量的函数。这里我们需要区分可重入函数和线程安全函数。如果某个函数使用了全局变量,但是在全局变量访问部分保证串行访问的话,那么这个函数就是线程安全函数。可重入函数必然是线程安全函数,而线程

2014-07-03 09:29:01 463

原创 C++内部类

内部类可以访问外部类的private方法。#include #include using namespace std;template class MyList {  public:    MyList(vector* list): v_(list) {    }     class Iterator {      public: 

2014-06-30 14:05:35 788

原创 c++迭代器

有两种实现方式,将迭代器定义在内部(STL方式):http://blog.csdn.net/lonelywinter340/article/details/3327700将迭代器定义在外部:http://blog.csdn.net/lcl_data/article/details/9310313殊途同归,都是在调用begin(

2014-06-30 11:37:12 314

原创 lower_bound

#include using namespace std;template size_t find_lower_bound(size_t i, size_t j, T* data, const T& key, bool (*les)(const T&, const T&)) { if (les(key, data[i])) { return i; } while (i

2014-06-29 22:47:49 441

原创 int与int*之间的转换

void test_cast() {  int* pa = reinterpret_cast(1);  cout   pa++;  cout   cout (pa) }

2014-06-27 18:17:48 2319

原创 将数字序列化到内存

void test_memcpy() { uint32 a = 1235439534; char buf[1024]; memset(buf, 0 , sizeof(buf)); memcpy(buf, &a, sizeof(a)); cout << buf << endl; uint32 b = 0; memcpy(&b, buf, sizeof(b)); cou

2014-06-18 16:19:29 516

原创 测试Std:heap

void test1() { vector va; int a[] = {1,3,5,3,6,4,7,4,9}; for (int i = 0; i < sizeof(a)/sizeof(int); i++) { va.push_back(a[i]); } cout << va.size() << endl; make_heap(va.begin(), va.en

2014-06-18 16:13:50 1018

原创 测试friend成员

#include using namespace std;class A {public: A(string name):name_(name) {}private: friend class B; void Print() { cout << "A" << endl; } string name_;};class B {public: B(A* a): a_(

2014-06-18 16:12:05 420

原创 归一化

n e w V a l u e  =  { o l d V a l u e - m i n ) / (max-min)

2014-04-13 09:39:23 442

原创 vector里元素的地址会改变

void PrintVectorAddr(vector& v) {  for (size_t i = 0; i     cout   }  cout }void test() {  vector v;  int a = 1;  v.push_back(a);  PrintVectorAddr(v);  int b = 2;  v.push_b

2014-04-11 11:43:44 2845

转载 screen

http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

2014-03-26 17:46:50 401

转载 堆排序

#include void shift(int a[] , int i , int m){int k , t; t = a[i]; k = 2 * i + 1; while (k < m) { if ((k < m - 1) && (a[k] < a[k+1])) k ++; if (t < a[k]) {a[i] = a[k];

2014-02-21 09:32:12 376

原创 map析构类的问题

http://bbs.csdn.net/topics/390692287?page=1class A { private: int a_; public: A():a_(0) { cout << "create A(" << a_ <<")" << endl;} A(int a):a_(a) { cout << "create A(" << a_<< ")" << en

2014-01-16 10:19:31 2262

原创 C++链接时出现”multiple definition of“错误,或者undefined reference的问题

可能是.h文件里包含了对变量的定义(初始化)导致。应该把变量定义(初始化)放于.cpp文件。

2014-01-13 18:42:11 950

转载 thrift找不到包含的类

http://blog.csdn.net/shenchen8274/article/details/7285687

2014-01-08 18:42:41 781

原创 epoll初步使用2

上一篇中client用的是 发送->等待->接收 模式,如果把client也改为异步,既

2013-12-30 11:46:53 440

原创 epoll初步使用

最近准备学习一下epoll,就写了一个小程序做测试。把中间遇到的问题记录下来,请大家多多指正。代码很简单:一个服务端,接收请求,将接收到的内容再返回给客户端。一个客户端,多线程的发送请求再接收。server.cc#include #include #include #include #include #include #include #include

2013-12-29 09:57:34 578

转载 extern作用详解

http://blog.csdn.net/songjinshi/article/details/6785267

2013-12-23 19:17:14 366

转载 "undefined reference to" 问题解决方法

http://yiluohuanghun.blog.51cto.com/3407300/1181380

2013-12-23 13:50:33 752

转载 pthread_cond_wait()使用注意点

http://www.cnblogs.com/diyingyun/archive/2011/11/25/2263164.htmlThe mutex passed to pthread_cond_wait protects the condition.The caller passes it locked to the function, which then ato

2013-12-23 10:41:01 933

原创 用epoll实现毫秒sleep

#include #include #include #include int test(){ struct epoll_event; int epfd; struct timeval tv; epfd=epoll_create(1); while(1){ int nfds =

2013-12-20 16:42:06 844

转载 valgrind

http://hi.baidu.com/timegoneby/item/18faad28a0cafc85af48f59d

2013-11-20 09:51:04 560

java常见面试题

java常见面试题

2013-09-30

空空如也

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

TA关注的人

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