export LD_LIBRARY_PATH=/usr/local/lib64
即可就是把libSlice.so.34庫的位置找出來
posted @
2012-07-05 17:26 nk_ysg 閱讀(569) |
評論 (0) |
編輯 收藏
C++的編譯
1.
svn checkout http://protobuf.googlecode.com/svn/trunk/ protobuf
2.cd protobuf
3../autogen.sh
4.autoconf產(chǎn)生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 閱讀(355) |
評論 (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 閱讀(147) |
評論 (0) |
編輯 收藏
1.yy復(fù)制當(dāng)前行
2.yw復(fù)制單詞
3.
v | 字元選擇,會將游標(biāo)經(jīng)過的地方反白選擇! |
V | 行選擇,會將游標(biāo)經(jīng)過的行反白選擇! |
[Ctrl]+v | 區(qū)塊選擇,可以用長方形的方式選擇資料 |
y | 將反白的地方複製起來 |
d | 將反白的地方刪除掉 |
塊注釋
#用v進(jìn)入virtual模式
#用上下鍵選中需要注釋的行數(shù)
1.插入注釋:
按Control+v進(jìn)入列模式
按大些“I”進(jìn)入插入模式,輸入注釋符“#”,然后立刻按下ESC
2.刪除注釋
先按Control+v進(jìn)入列模式
選中要?jiǎng)h除的注釋符,然后按d ,進(jìn)行刪除
3.加入python.vim 這些東西存放在/usr/share/vim/vim72/syntax/里面
posted @
2012-07-02 10:24 nk_ysg 閱讀(184) |
評論 (0) |
編輯 收藏
http://blog.csdn.net/hjmhjms/article/details/1521357
ACE的安裝是一件比較麻煩的事情,這里簡單的記錄了我在VS2008下安裝ACE的過程,希望能給大家一個(gè)參考。
安裝環(huán)境:
- 操作系統(tǒng):Win 7旗艦版
- 編譯環(huán)境:VS2008中文版
- ACE版本:ACE-5.5.1
安裝過程:
下載安裝包。
- Ace的安裝文件可以在http://download.dre.vanderbilt.edu/中下載到,由于我是在windows環(huán)境下安裝并且不需要TAO等其它庫,便下載了ACE-5.5.1.zip。
- 下載完成后將其解壓。我的解壓路徑為D:\Develop\ACE_wrappers。
設(shè)置環(huán)境變量
- 在操作系統(tǒng)添加一個(gè)名為ACE_ROOT的用戶環(huán)境變量,值為剛才ace的解壓路徑D:\Develop\ACE_wrappers。
- 添加用戶的Path環(huán)境變量,值為%ACE_ROOT%\lib,這樣才能保證系統(tǒng)能找到ace生成的動(dòng)態(tài)連接庫。
- 設(shè)置VS2005的C++開發(fā)項(xiàng)目信息,依次打開菜單 工具-選項(xiàng)-項(xiàng)目和解決方案-VC++目錄 ,在右側(cè)目錄列表中選擇"包含目錄",添加$(ACE_ROOT),在右側(cè)目錄列表中選擇"庫文件",添加$(ACE_ROOT)\lib。
編譯ACE
- 在ACE_ROOT\ace目錄創(chuàng)建一個(gè)名為 config.h的文件。編輯文件并加入以下內(nèi)容
#include "ace/config-win32.h"
表明當(dāng)前是在win32的環(huán)境下進(jìn)行ace的項(xiàng)目。 - 進(jìn)入ACE_ROOT\ace目錄中,能發(fā)現(xiàn)ACE現(xiàn)在已經(jīng)帶VS2005的編譯項(xiàng)目了,直接打開ace_vc9.sln,直接生成ACE項(xiàng)目的Debug版和Release版,編譯過程還比較快,大概就幾分鐘的樣子。編譯鏈接完成后,在ACE_ROOT\lib中一共生成了四個(gè)文件,分別是"ACE.dll","ACE.lib", "ACEd.dll","ACEd.lib",其中帶"d"表示的是Debug版本。
posted @
2012-06-26 11:32 nk_ysg 閱讀(555) |
評論 (0) |
編輯 收藏
gdb 打印數(shù)組s的i到j(luò)之間的內(nèi)容,假設(shè)s的元素類型為T
p *(s+i)@(j-i+1)*sizeof(T)
也就是
print *name@len
posted @
2012-06-06 10:43 nk_ysg 閱讀(1567) |
評論 (0) |
編輯 收藏
/*
*/
#include <iostream>
using namespace std;
/*
注意到對于gcd(a,b) = d 我們對(a, b)用歐幾里德輾轉(zhuǎn)相除會最終得到
(d, 0)此時(shí)對于把a(bǔ) =d, b = 0 帶入a*x + b*y = d,顯然x = 1,y可以為任意值,
這里y可以為任意值就意味著解會有無數(shù)個(gè)。我們可以用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) (返回最小的正數(shù)x)
int modularLinearEquation(int a, int b, int n)
{
//等價(jià)于求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;
}
//中國剩余定理,推導(dǎo)都是數(shù)學(xué)
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 閱讀(464) |
評論 (0) |
編輯 收藏
set fileencodings=ucs-bom,utf-8,GB18030,gbk
ucs- bom是unicode編碼的一種,類似utf8,將其和utf8放在最前面是因?yàn)椋瑅im在試圖用ucs-bom或utf-8來讀文件的時(shí)候,如果發(fā)現(xiàn)錯(cuò)誤則選用后續(xù)編碼來讀文件,而vim卻不能根據(jù)gbk和gb18030進(jìn)行錯(cuò)誤識別。沒有g(shù)b2312?因?yàn)樵趘imrc中設(shè)置gb2312根本沒用。基于這個(gè)設(shè)置,來操作下;
posted @
2012-05-09 10:00 nk_ysg 閱讀(465) |
評論 (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 閱讀(254) |
評論 (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 閱讀(286) |
評論 (0) |
編輯 收藏