1. Install mysql
2. Install mysqlpp-3.0 from source
http://tangentsoft.net/mysql++/releases/mysql++-3.0.0.tar.gz.
Don't use apt-get to install libmysqlpp-dev if you are using old version of ubuntu. It would give you outdated version of mysql++.
Generally it would be install in /usr/local/include and the libs would appear in /usr/lib/ or /usr/local/lib.
3. include mysql++.h in your program.
4. in your make file, put the following flags when you compile and build:
//include the header files
-I/usr/local/include/mysql++ -I/usr/include/mysql
//load the libraries. otherwise you are gonna get undefined reference error during linking stage.
-L/usr/local/lib -lmysqlpp (-lmysqlclient)
The path might differ from different linux distributions. Look for the lib named libmysqlpp.so* and libmysqlclient.so*.
5. remember to put the library path in /etc/ld.so.conf, and sudo ldconfig
Saturday, March 8, 2008
Sunday, January 13, 2008
Integer Division by 7 Trick
Q:How to make an integer division by 7 faster?
No closed discussion found so far.
As I was wondering: the following pieces of pseudo codes might perform well
x = x>>3 + x>> 6 + x>> 9 + x>>12 + x >> 15 .....+ (increase i by 3 until x >> i becomes zero)
since it is an integer operation, we are not really looking at the exact value. The logic behind this is approximation.
To notice: x/7 = x/8 + x /7*8 = x/8 + x/8*8 + x/7*8*8 = x /8 + x/8*8 + x/8*8*8 + x/7*8*8*8......
No closed discussion found so far.
As I was wondering: the following pieces of pseudo codes might perform well
x = x>>3 + x>> 6 + x>> 9 + x>>12 + x >> 15 .....+ (increase i by 3 until x >> i becomes zero)
since it is an integer operation, we are not really looking at the exact value. The logic behind this is approximation.
To notice: x/7 = x/8 + x /7*8 = x/8 + x/8*8 + x/7*8*8 = x /8 + x/8*8 + x/8*8*8 + x/7*8*8*8......
Subscribe to:
Posts (Atom)