- 博客(31)
- 资源 (22)
- 收藏
- 关注
原创 C++获取zip文件列表
// ZipFile.h//#ifndef ZIPFILE_H#define ZIPFILE_H#include #include #define ZIP_OK 0#define ZIP_ERR_OPEN 1#define ZIP_ERR_WRONG_FILE 2#define ZIP_ERR_WRONG_HEADER 3#define BYT
2012-12-04 21:39:18
2087
原创 用 __attribute__ 将函数注册到.ctors段 使接口在main之前执行
#include void my_init(){ printf("Hello ");}typedef void (*ctor_t)(void);ctor_t __attribute__ ((section(".ctors"))) my_init_p = my_init;int main(){ printf("world \n");
2012-11-25 22:49:10
1257
原创 linux获取文件类型
#include #include #include #include int main(int argc, char *argv[]){ int i; struct stat buf; char *ptr; for(i = 1; i { printf("%s: ", argv[i]);
2012-11-21 20:02:22
499
原创 python读取excel表格统计不同网段IP个数
import xlrdfile = xlrd.open_workbook('demo.xls') #打开表格sheet1 = file.sheet_by_name(u'hhc') #获取表格nrows = sheet1.nrowsdirt = {} #用于保存统计结果#统计不同for i in range(0, nrows): tempCell =
2012-11-16 22:39:16
1160
原创 python SQlite数据库操作
# coding:utf-8# Practice of oprating SQLite with Python# by redice 2010.11.09 import sysreload(sys) sys.setdefaultencoding('utf-8') import sqlite3 # 连接数据库,数据库文件不存在则创建conn = sqlit
2012-11-02 21:15:59
410
原创 libevent简单示例
#include #include #include #include #include int lasttime;static void timeout_cb(int fd, short event, void *arg){ struct timeval tv; struct event *timeout = (struct event *)arg;
2012-10-31 22:21:54
437
转载 boost线程池简单示例
threadPool.cpp:#include #include #include using namespace boost;using namespace std;void runChild(const int n){ cout sleep(1); cout }int main(int argc, char** argv)
2012-10-29 22:58:39
763
原创 boost::asio server编程实例
// boost.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include #include using boost::asio::ip::tcp;#define max_len 1024class clientSession :public
2012-09-20 23:58:04
1474
转载 mount命令(用来挂载硬盘或镜像等)
一 mount命令(用来挂载硬盘或镜像等)用法:mount [-t vfstype] [-o options] device dir1.-t vfstype 指定文件系统的类型,通常不必指定。mount 会自动选择正确的类型。常用类型有:DOS fat16文件系统:msdosWindows 9x fat32文件系统:vfatWindows NT ntfs文件系统:ntfsW
2012-09-14 00:15:32
881
转载 ubuntu开启SSH服务
SSH分客户端openssh-client和openssh-server如果你只是想登陆别的机器的SSH只需要安装openssh-client(ubuntu有默认安装,如果没有则sudo apt-get install openssh-client),如果要使本机开放SSH服务就需要安装openssh-serversudo apt-get install openssh-server
2012-09-13 23:45:34
338
原创 虚拟机ubuntu 怎么开启samba服务
vim /etc/samba/smb.conf添加[root] comment = root path = / writable = yes valid users = root在命令行输入:smbpasswd -a root (会提示输入密码)service smb restartserviceiptables stopchkconfig iptables off
2012-09-13 23:44:11
769
转载 Windows 上静态编译 Libevent 2.0.10 并实现一个简单 HTTP 服务器
文章作者:张宴 本文版本:v1.0 最后修改:2011.03.30 转载请注明原文链接:http://blog.s135.com/libevent_windows/] 本文介绍了如何在 Windows 操作系统中,利用微软 Visual Studio 2005 编译生成 Libevent 2.0.10 静态链接库,并利用 Libevent 静态链接库,实现一个简单的 HTTP W
2012-06-19 23:34:43
440
转载 CPPUNIT基本原理
一、CPPUNIT概念 CPPUNIT是一个测试驱动开发的测试框架。所谓测试驱动开发(TDD)是一种可以在开发过程中控制忧虑感的开发方法,它坚持以测试作为开发过程的中心,在开发前根据对将要开发的程序的要求,先写好所有测试代码,并且在开发过程中不断地通过运行测试代码来获得所开发的代码与所要求的结果之间的差距。CPPUNIT是XUNIT的一部分,它是由JUNIT演变过来的,专门针对C/C++
2012-06-11 23:24:46
575
转载 利用cppunit框架进行单元测试的例子,结合gcov,lcov实现对测试覆盖情况的统计
下面是一个利用cppunit框架进行单元测试的例子,结合gcov,lcov实现对 测试覆盖情况的统计测试部分 由两部分组成:testfixture, main ;用两种颜色分开以示区别。原理:在 CppUnit 中,一个或一组测试用例的测试对象被称为 Fixture(设施,下文为方便理解尽量使用英文名称)。Fixture 就是被测试的目标,可能是一个对象或者一组相关的对象
2012-06-11 23:21:49
1454
原创 注册消息码
// exception.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include #include #include #include using namespace std;typedef struct client_t{ int fd;
2012-06-06 23:20:20
562
转载 安装libmemcached遇到的问题
安装要注意的问题:(1)安装过程中不要忘了,--with-memcached,不然会提示你checking for memcached… noconfigure: error: “could not find memcached binary”(2)你的memcached是不是1.2.4以上的,64位系统,如果不是会提示你clients/ms_thread.o:
2012-05-23 00:22:06
1572
转载 libmemcached 安装报错 解决
clients/ms_conn.o: In function `ms_get_udp_request_id’:/root/soft/phpmodel/libmemcached-0.42/clients/ms_conn.c:194: undefined reference to `__sync_fetch_and_add_4′clients/ms_conn.o: In function `m
2012-05-23 00:21:10
1261
转载 使用源码升级至glibc-2.7
用的redhat版本太老,而安装mentohust,需要glibc-2.7版本以上,所以从GNU的官网 上下载了glibc-2.7的源码,将原有的glibc-2.5升级到2.7。必须注意的是,几乎所有的应用程序都依赖于glibc的动态库,重新编译安装glibc必须非常谨慎,一旦出错可能导致系统无法继续使用。所以强烈建议阅读源码目录下的INSTALL和FAQ文档。1 ../glibc-2.7/c
2012-05-23 00:19:51
5296
转载 Bug 28671 - [4.2 regression] undefined reference to `__sync_fetch_and_add_4'
Bug 28671 -[4.2 regression] undefined reference to `__sync_fetch_and_add_4' Summary:[4.2 regression] undefined reference to `__sync_fetch_and_add_4'Stat
2012-05-23 00:17:43
2129
转载 freebsd7安装ASTERISK,编译出错,求助
FREEBSD7R,内核级IPFW,准备做NAT,用ports(已经更新到最新)安装asterisk 1.4.18只选了ogg支持。没有安装APACHE,MYSQL,PHP,ZEND。编译到下面步骤出错,不知道是有没有经历过这种状况并解决了的高人(COPY别人的出错信息,他的情况和我一样)astobj2.o(.text+0x98b):/usr/ports/net/asteris
2012-05-23 00:16:41
734
转载 libmemcached 编译错误
今天在一台主机上编译 memcached 的客户端库 libmemcached,./configure 配置结果如下---Configuration summary for libmemcached version 0.40 * Installation prefix: /usr/local * System type: pc-l
2012-05-23 00:12:14
750
转载 muc.lists.freebsd.current
Hi I was wondering if anyone else is having this problem building asterisk on -CURRENT. The problem may not be with FreeBSD - it looks like gnu configure is incorrectly detecting the CPU as "i3
2012-05-23 00:10:26
602
转载 undefined references: __sync_fetch_and_add_4 and __sync_val_compare_and_swap_4
From: root To: libc-alpha at sourceware dot org Date: Tue, 6 Feb 2007 15:57:20 -0600 (CST) Subject: undefined references: __sync_fetch_and_add_4 and __sync_val_compare_and_swap_4Upon attempting
2012-05-23 00:08:59
1807
转载 mailing.freebsd.current
来自 Building asterisk - undefined reference to `__sync_fetch_and_add_4' 讨论的消息浏览解析项 -仅显示帖子内容Path: g2news2.google.com!news2.google.com!newshub.sdsu.edu!ctu-peer!news.nctu.edu.tw!netnews.c
2012-05-23 00:07:43
641
转载 libmemcached安装undefined reference to `__sync_fetch_and_add_4'
安装libmemcached安装时出错:----------------------------------------------------------------------------------------------------------CC clients/ms_stats.oCC clients/ms_task.oCC clients/ms_thread.oC
2012-05-23 00:07:01
669
转载 使用isolinux制作Linux启动光盘
以前我们很多启动盘采用的是loadlin引导linux内核的模式进行的(比如早期的slackware)。也就是采用win98的dos启动,然后通过loadlin工具引导我们的自己的linux内核,解开我们的安装文件系统。 但是,随着我们接触的硬件机型多样化,目前部分新设备不能采用dos(或win98)引导。 这个时候很多人会采用syslinux来制作启动盘,但是syslinux一般都需
2012-03-08 00:45:36
732
原创 STL中map用法详解
Map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据处理能力,由于这个特性,它完成有可能在我们处理一对一数据的时候,在编程上提供快速通道。这里说下map内部数据的组织,map内部自建一颗红黑树(
2011-09-15 00:09:29
630
原创 C程序中头文件相互包含精华
C程序中头文件相互包含精华(网摘小结) 收藏.h中一般放的是同名.c文件中定义的变量、数组、函数的声明,需要让.c外部使用的声明。1)h文件作用1 方便开发:包含一些文件需要的共同的常量,结构,类型定义,函数,变量申明;2 提供接口:对一个软件包来说可以提供一个给
2011-08-30 00:25:19
1834
原创 C++中头文件相互包含的几点问题
一、类嵌套的疑问 C++头文件重复包含实在是一个令人头痛的问题,前一段时间在做一个简单的数据结构演示程序的时候,不只一次的遇到这种问题。假设我们有两个类A和B,分别定义在各自的有文件A.h和B.h中,但是在A中要用到B,B中也要用到A,但是这样的写法当然是错误的:
2011-08-30 00:24:15
675
原创 UML类图关系全面剖析
UML的类图关系分为: 关联、聚合/组合、依赖、泛化(继承)。而其中关联又分为双向关联、单向关联、自身关联;下面就让我们一起来看看这些关系究竟是什么,以及它们的区别在哪里。1、关联双向关联:C1-C2:指双方都知道对方的存在,都可以调用对方的公共属性和方法
2011-08-30 00:21:59
412
原创 ADSL拨号连接提示错误详解
拨号不成功,根据返回错误信息确定故障: <br />1、ror 602 The port is already open <br />问题:拨号网络网络由于设备安装错误或正在使用,不能进行连接 <br />原因:RasPPPoE没有完全和正确的安装 <br />解决:卸载干净任何PPPoE软件,重新安装 <br />2、Error 605 Cannot set port information <br />问题:拨号网络网络由于设备安装错误不能设定使用端口 <br />原因:RasPPPoE没有完全和正确的
2011-01-02 19:14:00
547
libevent-2.1.1-alpha.tar.gz
2012-06-19
跟我一起学Makefile
2011-12-09
C++_标准模板库(STL).pdf
2011-11-12
SQLite权威指南
2011-09-22
UML基础教程_(老师的课件)很好.ppt
2011-09-12
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人