Showing posts with label My Indexs. Show all posts
Showing posts with label My Indexs. Show all posts
04 March, 2010
Build 32-bits RPM under 64-bits enviroment
rpmbuild --target=i386 -bb your.spec
Extract RPM file
rpm2cpio your.rpm | cpio -idmv
22 January, 2010
Specified the .so file path you want to link to
-Wl,-rpath,./lib
11 December, 2009
The fastest way to get time in millisecond on linux
"gettimeofday()" is a great function to get time in millisecond.
printf("%ld milliseconds\n", ((end.tv_sec-start.tv_sec) * 1000 + (end.tv_usec-start.tv_usec)/1000.0));
Sample usage:
struct timeval start, end;
gettimeofday(&start, NULL);
usleep(2000);
gettimeofday(&end, NULL);
usleep(2000);
gettimeofday(&end, NULL);
printf("%ld milliseconds\n", ((end.tv_sec-start.tv_sec) * 1000 + (end.tv_usec-start.tv_usec)/1000.0));
Moreover, we can even speed up this function!
According to this post, we can enable Virtual Dynamic Shared Object to speed things up.
# echo 2 > /proc/sys/kernel/vsyscall64
25 November, 2009
FastCGI: non-blocking FCGI_Accept_r
1. FCGX_InitRequest(&request, 0, FCGI_FAIL_ACCEPT_ON_INTR)
2.
int flags = fcntl(0, F_GETFL, 0);
fcntl(0, F_SETFL, flags | O_NONBLOCK);
3. sigaction
"We intentionally try to set the SA_RESTART flag for all signals other than SIGALRM, so that any system call interrupted by these other signals is automatically restarted. The reason we don't want SIGALRM restarted is to allow us to set a timeout for I/O operations."
18 November, 2009
Today: Terms to remember
c++: const reference is your friend
12 November, 2009
Terms to remember
C++ exception safe:
Copy-and-Swap trick
Subscribe to:
Posts (Atom)