ruby安装mysql2插件出错

ruby1.92安装mysql2插件出错,mysql是5.5.11

提示:
cannot find -lprobes_mysql

解决:
禁用mysql的DTRACE 重新编译mysql,cmake 选项加上 -DENABLE_DTRACE=OFF

more ...

使用google-perftools的tcmalloc加速

1、安装libunwind(仅64位操作系统需要)

cd /usr/local/src/
wget http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99.tar.gz
tar zxvf libunwind-0.99.tar.gz
cd libunwind-0.99
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install

2、安装google-perftools

cd /usr/local/src/
wget http://google-perftools.googlecode.com/files ...
more ...

在python 中 简单使用 mongodb

1、安装

wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sudo sh setuptools-0.6c11-py2.7.egg
git clone git://github.com/mongodb/mongo-python-driver.git pymongo
cd pymongo/
sudo python setup.py install

2、引入驱动

import pymongo
from pymongo import Connection

3、建立连接

connection = Connection ...
more ...

Java 中的异常

透过JVM看Exception本质
http://www.javaeye.com/topic/857722

Java Exception性能问题
http://www.blogjava.net/stone2083/archive/2010/07/09/325649.html

JAVA异常设计原则
http://www.javaeye.com/topic/857443

more ...

Java Map的测试

主要是为了选择快速的Map类库,系统自带的貌似很慢

测试代码

import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import javolution.util.FastMap;
import org.junit.Test;
import com.alisoft.nano.bench.Nano;
public class MapBenchTest {
    private static int measurements = 100000 ...
more ...

看到有人说JAVA System.nanoTime()很慢

javaeye上看到wenshao说System.nanoTime()很慢,比new Object()和System.currentTimeMillis()都慢很多。

我也测试了一把,测试环境:
OS
fedora 14 64位
CPU
I3 530
JAVA 版本
java version “1.6.0_22″ Java(TM) SE Runtime Environment (build 1.6.0_22-b04) Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

代码:

public class TimeTest {
    public static ...
more ...

PostgreSQL 修改字段类型的一则问题

PostgreSQL 9下有个表中的字段需要修改类型,从smallint改为integer 执行SQL语句出错:

alter table player_street alter column people_cap type integer;
ERROR:  cannot alter type of a column used by a view or rule
DETAIL:  rule _RETURN on view player_street_v depends on column “people_cap”
********** Error **********
ERROR: cannot alter type of a column used by a view or rule
SQL ...
more ...

几个测试相关的网址

http://www.overclockers.com/forums/showthread.php?t=486495

http://niyunjiu.javaeye.com/blog/319319

http://www.phoronix-test-suite.com/

http://oprofile.sourceforge.net/news/

more ...