自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

九遍斋的专栏

行成于思

  • 博客(22)
  • 资源 (9)
  • 收藏
  • 关注

原创 使用muduo编译链接错误 undefined reference to `muduo::ThreadPool::run(boost::function<void ()()>&&)'

用nm查看引用的libmuduo_base.a里面,发现确实没有这个函数,连ThreadPool类都没有编译进来。不过在libmuduo_base_cpp11.a里面,nm查看是有这个ThreadPool的。将Makefile的链接库改为-lmuduo_base_cpp11,编译通过。遇到问题要冷静思考,运用合适的工具去分析解决。

2016-08-11 10:49:06 2907

原创 C++11 牛逼新特性——Alias declaration template

C++11的一个牛逼特性,记住备忘:templatetypename T>struct A {};templatetypename T>using APtr = boost::shared_ptrAT>>; // int main() { APtr foo;}

2016-08-10 07:56:39 2331

原创 golang的垃圾回收与Finalizer——tcp连接是如何被自动关闭的

最近在做一个golang的连接池。测试过程中发现一个有趣的现象,获取的连接没有归还给连接池,那么过一段时间后该连接会自动关闭掉。猜测这跟连接池应该是没有关系的,于是再用普通的连接做了实验,即dial一个tcp连接,发送请求,然后程序进入sleep,一段时间后该连接还是会自动关闭。对这个过程进行抓包分析,发现主动关闭连接的是client端,即client端主动向服务端发送了FIN包。

2016-07-24 12:11:21 3551

原创 GCC 4.8编译程序抛出Error: no such instruction: `某某汇编指令`

用gcc 4.8编译RocksDB时,抛出如下错误,如图:查了许久,不得正确的解决办法。最终,在Intel的网页上看到“Write Your First Program with Haswell New Instructions”看到,这是一类新的Intel指令。我们需要能够支持这类新指令的汇编器,即binutils。我的CentOS上已经用yum安装了binutils,然而并不管

2015-07-29 15:36:49 7990 1

原创 编译GCC-4.8出现的错误 —— Linux gnu/stubs-32.h: No such file or directory

GCC: Linux gnu/stubs-32.h: No such file or directory错误的解决办法

2015-07-29 15:25:08 15085 2

原创 pthread_cond_wait/pthread_cond_timedwait使用注意

今天在阅读Linux Device Drivers时,读到了如下一段话:Another thing to remember with sleeping is that, when you wake up, you never know how long your process may have been out of the CPU or what may have changed in

2015-07-21 10:35:04 6582

原创 /etc/profile与/etc/bashrc、交互式与非交互式、login与non-login shell的区别

线上的memcached又挂了,仍然没有得到core文件。排查原因,同事发现启动memcached的脚本存在可疑问题。问题一:没有设置memcached工作目录,有可能core dump时没有工作目录写权限这些脚本由crontab启动。脚本中没有设置工作目录,而这是非root用户的crontab。启动memcached时,工作目录不是memcached可执行文件所在目录。实验证明,这个是用

2015-07-09 17:56:55 3282

原创 RocksDB写入数据过程DBImpl::Write()源代码分析

Status DBImpl::Write(const WriteOptions& write_options, WriteBatch* my_batch) { if (my_batch == nullptr) { return Status::Corruption("Batch is nullptr!"); } PERF_TIMER_GUARD(write_pre_and_po

2015-06-16 18:08:34 6393

原创 使用maven shade plugin打包uber jar包

最近项目需要,在使用spark编写Java应用时,最终编写的程序必须打包成一个jar包才能提交到spark集群运行。由于spark是一个分布式系统,提交的程序最终将分散到许多节点上运行,如果程序依赖其他jar包,那么运行环境的部署将会非常头痛。为此,spark使用文档里建议将应用打包成assembly jar或者uber jar再提交。经查,assembly jar包似乎比uber j

2015-04-15 17:04:37 8135

原创 Difference between maven scope compile and provided for JAR packaging

compile This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.

2015-04-15 14:47:05 677

原创 OpenStack VM + UnknownHostException Kafka Deploy

Solution:When you run > bin/kafka-console-consumer.sh command kafka loads aConsoleConsumer, which will attempt to create a consumer with an auto generated consumer id. The way Kafka generates the

2015-03-26 14:37:38 902

转载 grub手动引导、修复win7 Mbr

一、引导Linux重启进入到grub菜单界面时,按“c”键进入grub命令模式。1、指定/boot所在的分区,比如分区是第一块硬盘第一分区,即hd0,0      grub> root (hd0,0) 2、指定kernel,主要是找到vmlinuz文件。      grub> kernel /vmlinuz  www.2cto.com        注意:如果文件不

2014-08-15 16:34:05 11505

转载 编译OpenCV出现“freak.cpp找不到可舍出的寄存器”解决办法

mkdir opencv2cd opencv2cmake ../opencv-2.4.5make编译freak.cpp时出现问题:31)错误:在类 ‘GENERAL_REGS’ 中找不到可舍出的寄存器经查,与编译优化参数有关,找到编译freak.cpp的编译控制文件flags.make与link.txt,将编译优化选项从-O3 改为-O0该错误解决。

2014-08-15 16:26:17 968

原创 GRUB修复

最近装CentOS的时候用的是u盘安装,不过安装过程中不小心把grub装在了u盘上,然后就悲剧的每次都要从u盘启动,当然不能容忍这样子,以下就是修复grub的过程:u盘引导进入系统后[root@localhost /]#sbin/grub   #进入grub命令行模式grub> find /boot/grub/stage1    find /grub/stage1      find

2014-08-15 15:53:59 988

转载 使用pthread_cond_timedwait()超时时间设置问题

最近在使用pthread_cond_timedwait的时候,发现当超时时间设置成1秒以下的值时,无法得到想要的效果,具体表现为,没有wait足够的时间就被唤醒,且返回值正确。首先来看一下pthread_cond_timedwait的原型:#include int pthread_cond_timedwait(pthread_cond_t *restrict cond,pthrea

2014-06-17 14:05:34 17159

转载 C++虚析构函数

通常,一个实现了析构函数的类型同时也需要实现拷贝构造函数与拷贝复制函数。作为一个经验法则,如果你有一个带有虚函数功能的类,则它需要一个虚析构函数,原因如下: 1. 如果一个类有虚函数功能,它经常作为一个基类使用。2.如果它是一个基类,它的派生类经常使用new来分配。3.如果一个派生类对象使用new来分配,并且通过一个指向它的基类的指针来控制,那么它经常通过一个指向它的基类的指针

2014-01-03 17:53:03 704

原创 Ubuntu双显示器分辨率问题

1)$xrandr得到显示器名称,我的为 VGA1,笔记本为LVDS1,大家以此类推,不一定都一样2)$sudo xrandr --newmode "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync参数就是cvt结果中Modeline后面的那一堆,根据自己的参数调整。3)

2013-12-02 13:59:26 3819

原创 报错:error: must install xorg-macros 1.15 or later before blabla...

报错:error: must install xorg-macros 1.15 or later before  blabla...安装依赖包:util-macros-1.16.0.tar.gz  (--prefix=/usr)注意--prefix选项必须是/usr报错:No package 'xproto' foundNo package 'x11' foundNo pa

2013-10-28 16:03:04 5365

原创 Linux配置无线网卡

#启用无线网卡的网络,必须先用ifconfig命令打开wlan,否则接下来的iwconfig操作会出现“SET failed on device wlan0 ; Operation not permitted.”的错误。ifconfig wlan0 up#打开无线网卡电源iwconfig wlan0 txpower on #列出区域内的无线网络iwlist wlan0 scan #

2013-04-25 17:52:08 2613

原创 移植DHCP-4.1到ARM平台(交叉编译)

一、从https://www.isc.org/software/dhcp/下载最新的dhcp源码包。二、解压源码包,进入解压后的目录,输入./configure命令。三、输入make "CC=/usr/local/arm/4.3.2/bin/arm-linux-gcc -static"命令,编译后在client目录下可得到dhclient可执行文件。四、将client目录下编译好的dh

2013-04-25 10:04:20 4625

原创 Linux交叉编译rtl8192se驱动的Makefile

KDIR := /home/wangxijue/Downloads/linux-3.0.1/obj-m += rtl8192se.ortl8192se-objs := dm.o fw.o hw.o led.o phy.o rf.o sw.o table.o trx.oall:make -C $(KDIR) M=$(PWD) modules ARCH=arm CROSS_

2013-03-17 14:10:53 1326 1

原创 Ubuntu下安装最新版本的CMake

Ubuntu自带的apt-get install方式安装的CMake版本有点老。项目中需要最新版本的CMake 2.8.9, 这个版本还是采用CPack打包的,为了体验一把CPack的发布的便利性,就试用一下。首先卸载已经安装的旧版的CMakeapt-get autoremove cmake然后下载:cd /usrwget http://www.cmake.org/files/

2013-02-24 16:57:44 772

Linux USB drivers

Linux USB驱动开发技术,国外的资料,比较新,很实用。

2013-03-24

Using the POSIX API - Threads, real-time and IPC

In Linux, when a new process is created, it already contains a thread, used to execute the main() function Additional threads can be created using the pthread library, which is part of the C library Of course all threads inside a given process will share the same address space, the same set of open files, etc. The pthread library also provide thread synchronization primitives: mutexes and conditions This pthread library has its own header : pthread.h Applications using pthread function calls should be explicitly linked with the pthread library gcc ­o app app.c ­lpthread

2013-03-24

The GRUB Bootloader

全面讲述Grub引导Linux原理,国外的资料,值得一读。

2013-03-24

New features in Linux-2.6

虽然Linux早已到了3.8时代,但是2.6内核非常经典,在嵌入式行业依然被广泛应用。这部slides专为嵌入式开发人员而写。

2013-03-24

Embedded Linux System Development

嵌入式Linux经典培训教材,国外的资料,非常受用。

2013-03-24

Embedded Linux Driver Development

嵌入式Linux驱动开发,英文版,极好的slides。例子精简,条理分明,对于Linux驱动开发者十分受用。 Headers specific to the Linux kernel: <linux/xxx.h> No access to the usual C library, we're doing kernel programming An initialization function Called when the module is loaded, returns an error code (0 on success, negative value on failure) Declared by the module_init() macro: the name of the function doesn't matter, even though modulename_init() is a convention. A cleanup function Called when the module is unloaded Declared by the module_exit() macro. Metadata informations declared using MODULE_LICENSE(), MODULE_DESCRIPTION() and MODULE_AUTHOR()

2013-03-23

《架构之美》

架构师必备!比如facebook的架构设计

2012-02-20

Linux内核源代码情景分析

极力推荐的一本书,1500页的深入源码分析!

2012-02-20

《游戏编程指南》---包含各种游戏编程技术,快来下载吧

《游戏编程指南》 导 读 在开始阅读全文之前,希望你能抽出一些时间阅读这里的内容… 一、你想编一个怎样的游戏? (1)星际争霸,帝国时代,英雄无敌,大富翁4,轩辕剑3,传奇,石器时代… 这些都是正宗的2D游戏,其标志是:视角完全固定或只有四个观察方向。这些游戏中特效不多,即使有也不需要使用汇编进行加速。 推荐阅读:第1、2、3、4、5章及第12章的相关部分。 可选阅读:第7、8章。如果需要网络功能,需阅读第11章。 (2)暗黑2,秦殇… 这是一类比较特殊的2D游戏,其特点在于各种特效(半透明,光影效果等)的大规模使用。有的此类游戏还可以使用3D加速卡来加速2D特效。 推荐阅读:第1、2、3、4、5、6章及第12章的相关部分。 可选阅读:第7、8、9、10章。如果需要网络功能,需阅读第11章。 由于现在的显卡几乎都能很好地支持3D加速功能,所以如果你打算放弃对没有3D加速卡的计算机的支持,可不阅读第4、5、6章,而推荐阅读第9章和第10章的第1、2节。 (3)反恐精英,雷神,魔兽争霸3,地牢围攻,FIFA,极品飞车,MU… 这些都是纯3D游戏,也代表了目前游戏的发展趋势。 推荐阅读:第1、2、3、7、9、10章及第12章的相关部分。 可选阅读:第8章。如果需要网络功能,需阅读第11章。

2011-05-17

空空如也

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

TA关注的人

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