posts - 25,  comments - 0,  trackbacks - 0
export LD_LIBRARY_PATH=/usr/local/lib64
即可就是把libSlice.so.34库的位置找出来
posted @ 2012-07-05 17:26 nk_ysg 阅读(551) | 评论 (0)编辑 收藏
C++的编译
1.svn checkout http://protobuf.googlecode.com/svn/trunk/ protobuf
2.cd protobuf
3../autogen.sh
4.autoconf产生configure脚本
5../configure
6.make && make check && make install

Python Install
1.python setup.py test
2.python setup.py install
posted @ 2012-07-05 11:11 nk_ysg 阅读(345) | 评论 (0)编辑 收藏
参考如下文章
http://blog.csdn.net/hbhhww/article/details/7168507
http://rdc.taobao.com/blog/cs/?p=455
posted @ 2012-07-03 17:49 nk_ysg 阅读(136) | 评论 (0)编辑 收藏
1.yy复制当前行
2.yw复制单词
3.
v字元選擇,會將游標經過的地方反白選擇!
V行選擇,會將游標經過的行反白選擇!
[Ctrl]+v區塊選擇,可以用長方形的方式選擇資料
y將反白的地方複製起來
d將反白的地方刪除掉

块注释

#用v进入virtual模式
#用上下键选中需要注释的行数

1.插入注释:
按Control+v进入列模式
按大些“I”进入插入模式,输入注释符“#”,然后立刻按下ESC

2.删除注释
先按Control+v进入列模式
选中要删除的注释符,然后按d ,进行删除
3.加入python.vim 这些东西存放在/usr/share/vim/vim72/syntax/里面


posted @ 2012-07-02 10:24 nk_ysg 阅读(173) | 评论 (0)编辑 收藏

http://blog.csdn.net/hjmhjms/article/details/1521357 
ACE的安装是一件比较麻烦的事情,这里简单的记录了我在VS2008下安装ACE的过程,希望能给大家一个参考。

  1. 安装环境:
    1. 操作系统:Win 7旗舰版
    2. 编译环境:VS2008中文版
    3. ACE版本:ACE-5.5.1
  2. 安装过程:
    1. 下载安装包。
      1. Ace的安装文件可以在http://download.dre.vanderbilt.edu/中下载到,由于我是在windows环境下安装并且不需要TAO等其它库,便下载了ACE-5.5.1.zip。
      2. 下载完成后将其解压。我的解压路径为D:\Develop\ACE_wrappers。
    2. 设置环境变量
      1. 在操作系统添加一个名为ACE_ROOT的用户环境变量,值为刚才ace的解压路径D:\Develop\ACE_wrappers
      2. 添加用户的Path环境变量,值为%ACE_ROOT%\lib,这样才能保证系统能找到ace生成的动态连接库。
      3. 设置VS2005的C++开发项目信息,依次打开菜单 工具-选项-项目和解决方案-VC++目录 ,在右侧目录列表中选择"包含目录",添加$(ACE_ROOT),在右侧目录列表中选择"库文件",添加$(ACE_ROOT)\lib
    3. 编译ACE
      1. ACE_ROOT\ace目录创建一个名为 config.h的文件。编辑文件并加入以下内容
        #include "ace/config-win32.h"
        表明当前是在win32的环境下进行ace的项目。
      2. 进入ACE_ROOT\ace目录中,能发现ACE现在已经带VS2005的编译项目了,直接打开ace_vc9.sln,直接生成ACE项目的Debug版和Release版,编译过程还比较快,大概就几分钟的样子。编译链接完成后,在ACE_ROOT\lib中一共生成了四个文件,分别是"ACE.dll","ACE.lib", "ACEd.dll","ACEd.lib",其中带"d"表示的是Debug版本。
posted @ 2012-06-26 11:32 nk_ysg 阅读(520) | 评论 (0)编辑 收藏
gdb 打印数组s的i到j之间的内容,假设s的元素类型为T
p *(s+i)@(j-i+1)*sizeof(T)

也就是print *name@len
posted @ 2012-06-06 10:43 nk_ysg 阅读(1523) | 评论 (0)编辑 收藏
/*
*/
#include <iostream>
using namespace std;

/*
注意到对于gcd(a,b) = d 我们对(a, b)用欧几里德辗转相除会最终得到
(d, 0)此时对于把a =d, b = 0 带入a*x + b*y = d,显然x = 1,y可以为任意值,
这里y可以为任意值就意味着解会有无数个。我们可以用a = d, b = 0的情况逆推出来
任何gcd(a, b) = d 满足a*x + b*y = d的解。如果x0, y0是b*x + (a%b)*y = d 的解,
那么对于a*x + b*y = d的解呢?
b*x0 + (a%b)*y0 = d => b*x0 + (a - [a/b]*b)*y0 = a*y0 + b*(x0 - [a/b]*y0),
所以a*x + b*y = d的解x1 = y0, y1 = x0 - [a/b]*y0; 这样我们可以程序迭带了。
*/
int extEuclid(int a, int b, int &x, int &y)
{
    if (b == 0)
    {
        x = 1;
        y = 0;
        return a;
    }
    int d = extEuclid(b, a % b, x, y);
    int iTemp = x;
    x = y;
    y = iTemp - (a / b)* y;
    return d;
}
//解同余方程ax = b(mod n) (返回最小的正数x)

int modularLinearEquation(int a, int b, int n)
{
    //等价于求ax + cn = b;
    
//先求a*x1 + c1*n = gcd(a, n)
    int x, y, d;
    d = extEuclid(a, n, x, y);
    if (b % d != 0)
       return -1;
    x = x * (b / d);
    x = (( x % n) + n) % n;
    return x;
}

//中国剩余定理,推导都是数学
int solModularEquations(int b[], int m[], int k)
{

    int iTemp;
    int y;
    int result;

    int M = 1;
    for (int i = 0; i < k; i++)
      M *= m[i];

    result = 0;
    for (int i = 0; i < k; i++)
    {
      iTemp = M / m[i];
      y = modularLinearEquation(iTemp, 1, m[i]);
      result = (result + b[i] * iTemp * y) % M;
    }
    return result;
}

int main()
{
    int x, y , d;
    d = extEuclid(1001, 767, x, y);
    cout << x << endl;
    cout << y << endl;
    cout << d << endl;
    cout << "1001 * x + 767 * y = " << (1001 * x + 767 * y) << endl;
    cout << modularLinearEquation(3, 2, 100) << endl;
    return 0;
}
posted @ 2012-06-02 14:31 nk_ysg 阅读(447) | 评论 (0)编辑 收藏

set fileencodings=ucs-bom,utf-8,GB18030,gbk

ucs- bom是unicode编码的一种,类似utf8,将其和utf8放在最前面是因为,vim在试图用ucs-bom或utf-8来读文件的时候,如果发现错误则选用后续编码来读文件,而vim却不能根据gbk和gb18030进行错误识别。没有gb2312?因为在vimrc中设置gb2312根本没用。基于这个设置,来操作下;

posted @ 2012-05-09 10:00 nk_ysg 阅读(446) | 评论 (0)编辑 收藏
find . -name "*.h" -o -name "*.c" -o -name "*.cc" > cscope.files
cscope -bkq -i cscope.files
posted @ 2012-05-08 15:13 nk_ysg 阅读(235) | 评论 (0)编辑 收藏
mysql> desc tb_user_anonymous_history;
+----------------+---------------------+------+-----+---------+-------+
| Field          | Type                | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+---------+-------+
| u              | char(64)            | NO   | PRI | NULL    |       |
| day_index      | int(10) unsigned    | NO   | PRI | 0       |       |
| last_fight_day | int(10) unsigned    | NO   |     | 0       |       |
| fight_win      | tinyint(3) unsigned | NO   |     | 0       |       |
| fight_total    | tinyint(3) unsigned | NO   |     | 0       |       |
+----------------+---------------------+------+-----+---------+-------+
select u,sum(fight_total) as total from tb_user_anonymous_history  where last_fight_day>=20120423 and last_fight_day <=20120424  group by u having total >= 12;
posted @ 2012-05-02 10:56 nk_ysg 阅读(268) | 评论 (0)编辑 收藏
仅列出标题
共3页: 1 2 3