- 浏览: 208110 次
- 性别:
- 来自: 北京
最新评论
-
fuliang:
more cleanner than before
Big Integer Arithmetic -
yaojingguo:
Hi, Liang LiangThanks for the i ...
Redirect and restore stdout in C -
fuliang:
使用gcc编译.cpp,可以使用-lstdc++选项,这样gc ...
Redirect and restore stdout in C
文章列表
A example is static_assert.
#include <stdio.h>
#define static_assert(x) switch (x) case 0: case (x):
int main(int argc, const char *argv[]) {
static_assert(1 == 1);
static_assert(1 == 2); // compile error
int i = 10;
switch (i)
printf("go\n");
}
Refe ...
First create a mirror with
git clone --mirror git@somewhere.com:repo.git
then setup a cron job like this:
*/1 * * * * gitbackup cd /backup/repo.git && git fetch -q
This will backup the changesets every minute. Maybe you want to do this less frequently.
Refer to http://stackoverflo ...
https://github.com/hpcc-systems/HPCC-Platform/wiki/Git-commit-message-guidelines
Install vsftp useing `yum install vsftpd.x86_64`.
Run vsftpd_virtual_config.sh to configure vsftpd.
Run vsftpd_virtualuser_add.sh to add a user such as tiftp.
Remove guest_username and nopriv_user in /etc/vsftpd/vsftpd.conf.
Make a directory as specified by local_root in
/etc/vsftpd ...
https://gist.github.com/1921701
Sample code:
#include <stdio.h>
#define INIT do { \
printf("line1\n"); \
} while (0)
#define INIT_ { \
printf("line1\n"); \
}
void correct() {
if (1)
INIT;
else
printf("here is the else\n");
}
void wrong() {
if (1)
INIT_; ...
Sections in ELF
- 博客分类:
- C/C++
The following little code shows the effects of .rodata, .data and .bss sections.
#include <stdio.h>
// y_readonly is in data seciton. "123" is in rodata section.
// y_readonly is a poniter variable. And compiler sets the value of y_readonly
// to the address "123&quo ...
Anything from `/*' through the next `*/' is a comment.
For x86, # starts a line comment. / also starts a line comment. / can also start a line comment.
But / must be the first non-whitespace character.
For details, refero to
1 http://sourceware.org/binutils/docs/as/Comments.html#Comment ...
String Literals in C
- 博客分类:
- C/C++
Refer to 6.4.5 String literals in C99 standard.
Sample code:
#include <stdio.h>
int main(int argc, const char *argv[]) {
char val[] = "one" "two";
printf("part1\n"
"part2\n");
printf("val: %s\n", val);
return 0;
}
...
Start at the variable name (or innermost construct if no identifier
is present. Look right without jumping over a right parenthesis; say
what you see. Look left again without jumping over a parenthesis; say
what you see. Jump out a level of parentheses if any. Look right;
say what you see. Look left; ...
http://www.techpulp.com/blog/2009/01/how-to-embed-binary-data-in-an-elf-file/
KMP Algorithm
- 博客分类:
- C/C++
#include <stdio.h>
#define MAX_LEN 100
int f[MAX_LEN];
// Compute failure function
void compute_failure_function(char* b, int n) {
int t, s;
t = 0;
f[0] = 0;
for (s = 0; s < n -1; s++) {
while (t > 0 && b[s+1] != b[t])
t = f[t-1];
if (b[s+1] == b[t] ...
http://superuser.com/questions/44827/how-do-i-get-java-support-on-google-chrome-in-linux
sudo vim /etc/init/mysql.confEdit it to say the following (I move the 2 from the first set of numbers to the second):start on (net-device-up and local-filesystems and runlevel [345])stop on runlevel[0126]
For details, refer to http://ubuntuforums.org/showthread.php?t=1475460&page=2
Signal Handling in Java
- 博客分类:
- java
class Hook1 extends Thread {
@Override
public void run() {
System.out.println("hook1");
}
}
class Hook2 extends Thread {
@Override
public void run() {
System.out.println("hook2");
}
}
public class HookDemo {
public static void main ( ...