export LD_LIBRARY_PATH=/usr/local/lib64
即可就是把libSlice.so.34庫的位置找出來
posted @
2012-07-05 17:26 nk_ysg 閱讀(574) |
評論 (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 閱讀(357) |
評論 (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 閱讀(150) |
評論 (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 閱讀(188) |
評論 (0) |
編輯 收藏
http://blog.csdn.net/hjmhjms/article/details/1521357
ACE的安裝是一件比較麻煩的事情,這里簡單的記錄了我在VS2008下安裝ACE的過程,希望能給大家一個參考。
安裝環境:
- 操作系統:Win 7旗艦版
- 編譯環境:VS2008中文版
- ACE版本:ACE-5.5.1
安裝過程:
下載安裝包。
- Ace的安裝文件可以在http://download.dre.vanderbilt.edu/中下載到,由于我是在windows環境下安裝并且不需要TAO等其它庫,便下載了ACE-5.5.1.zip。
- 下載完成后將其解壓。我的解壓路徑為D:\Develop\ACE_wrappers。
設置環境變量
- 在操作系統添加一個名為ACE_ROOT的用戶環境變量,值為剛才ace的解壓路徑D:\Develop\ACE_wrappers。
- 添加用戶的Path環境變量,值為%ACE_ROOT%\lib,這樣才能保證系統能找到ace生成的動態連接庫。
- 設置VS2005的C++開發項目信息,依次打開菜單 工具-選項-項目和解決方案-VC++目錄 ,在右側目錄列表中選擇"包含目錄",添加$(ACE_ROOT),在右側目錄列表中選擇"庫文件",添加$(ACE_ROOT)\lib。
編譯ACE
- 在ACE_ROOT\ace目錄創建一個名為 config.h的文件。編輯文件并加入以下內容
#include "ace/config-win32.h"
表明當前是在win32的環境下進行ace的項目。 - 進入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 閱讀(559) |
評論 (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 閱讀(1574) |
評論 (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 閱讀(468) |
評論 (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 閱讀(469) |
評論 (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 閱讀(258) |
評論 (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 閱讀(289) |
評論 (0) |
編輯 收藏