strncpy 的用法

在官方的文档中,http://www.cplusplus.com/refer…,例程的 strncpy 的用法是: /* strncpy example */ #include <stdio.h> #include <string.h> int main () { char str1[]= "To be or not to be"; char str2[40]; char str3[40]; /* copy to sized buffer (overflo……

阅读全文

GCC “-fomit-frame-pointer”编译选项的含义

在 makefile 中看到这个编译选项,不太理解于是查了一下,相关的东西还不多,抄一下放在这里 首先这个文章,http://blog.csdn.net/byzs/arti…,讲的不错,挺清晰的: 优化你的软件时,发觉”-fomit-frame-pointer”这个选项还是蛮有用的。 GCC手册上面这么说: Don’t keep the frame pointer in a……

阅读全文

使用 gperftools 分析 cpp 程序性能

首先从这里,https://code.google.com/p/gper…,下载 gperftools-2.1.tar.gz 接下来的操作教程主要参看这篇文章,http://www.searchtb.com/2012/1…,Google CPU Profiler使用指南及小工具,已经写的很好了,其中需要注意的问题有几个: 原文的 Makefile 没有排版,需要自己去 tab 缩进,不然在 make 的时候……

阅读全文

Python 的一个 Bug

今天要写一个统计脚本,于是打开 Aptana,建了一个文件叫 stat.py,取的 statistics 的缩写,但是一直报错如下 Traceback (most recent call last): File "C:\Python27\lib\site.py", line 62, in <module> import os File "C:\Python27\lib\os.py", line 63, in <module>……

阅读全文

Hadoop 1.1.2 安装(集群版)

首先还是安装必须的 jdk,看到这里,http://os.51cto.com/art/201003… 终端下进入你存放jdk-6u12-linux-i586.bin,例如我的位置是:/home/liangshihong $ sudo -s ./jdk-6u12-linux-i586.bin 一路回车,直到询问是否安装,输入yes回车 ok,安装完毕,下面配置环境变量 配置classpath,修改所有用户的环境变量 $ sud……

阅读全文

Hadoop 1.1.2 安装(单机版)

操作的环境是阿里云的服务器,http://www.aliyun.com/,还不错,按时间收费,一个小时 0.28 块钱,操作系统是 Ubuntu 10.10 64 位,单核 CPU,内存 512 首先上来先修改主机名 hostname cluster-1 然后开始按照这里,http://hadoop.apache.org/docs/…,的教程安装 Hadoop 1.1.2 首先看到 Prerequisites,需要 j……

阅读全文