[整理]用CSS自动缩小过宽图片
简单说,如果要全局改,就是:
img { max-width: 600px; width: expression(this.width > 600 ? 600: true); height: auto; }
对WP的主题,就是改style.css。
阅读全文…
简单说,如果要全局改,就是:
img { max-width: 600px; width: expression(this.width > 600 ? 600: true); height: auto; }
对WP的主题,就是改style.css。
阅读全文…
性能测试, 数据库
http://obmem.com/?p=317
TNND,今天浪费了一天的时间在Mysql上面,先是改代码,然后是转换sqlite3数据库到mysql,然后发现原来好好的网站跑不起来了。 @。@ 然后就这么折腾了半天,基本上确定了,在select语句上,mysql的性能平均落后sqlite十倍左右,内存消耗超过sqlite则是三倍左右。
-
实际上mysql更灵活点,我的意思是:给mysql三倍的内存,那么他的表现只比sqlite慢十倍而已,如果你给他很抠门的内存?那么超时是唯一的结果。就像我一开始网站挂掉那样。
-
阅读全文…
http://stackoverflow.com/questions/1592859/how-to-supply-many-argv-and-outputredirection-with-one-bash-var
How to supply many argv and outputredirection with one bash var ?
In file a.lst:
in1.a in1.b > out1.a 2> out1.b in2.a in2.b > out2.a 2> out2.b
In do.sh:
CLI=$(sed -n -e "1 p" a.lst) perl a.pl $CLI
I want to run like perl a.pl in1.a in1.b > out1.a 2> out1.b, how can I make it work ?
I can’t test it here, but it looks like using eval will work, so:
eval perl a.pl $CLI
http://www.gnu.org/s/libc/manual/html_node/Line-Input.html
12.9 Line-Oriented Input
Since many programs interpret input on the basis of lines, it is convenient to have functions to read a line of text from a stream.
Standard C has functions to do this, but they aren’t very safe: null characters and even (for gets) long lines can confuse them. So the GNU library provides the nonstandard getline function that makes it easy to read lines reliably.
Another GNU extension, getdelim, generalizes getline. It reads a delimited record, defined as everything through the next occurrence of a specified delimiter character.
All these functions are declared in stdio.h.
#define _GNU_SOURCE // 没这个编译时会有warning, 详见下文 #include <stdio .h> ssize_t getline(char **lineptr, size_t *n, FILE *stream); ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream); </stdio>
读到的字符串,当然也是包括结尾的\n的;行末没\n的也不会加\n。delim也是类似。
阅读全文…
http://stackoverflow.com/questions/137038/how-do-you-get-assembler-output-from-c-c-source-in-gcc
http://www.delorie.com/djgpp/v2faq/faq8_20.html
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html#s3
gcc -S -o my_asm_output.s helloworld.c
gcc -c -g -Wa,-a,-ad [other GCC options] foo.c > foo.lst
file helloworld
objdump -s --disassemble helloworld > helloworld.dump
-masm=dialect
Output asm instructions using selected dialect. Supported choices
are intel or att (the default one).
阅读全文…
TRE基本就是把GNU C library那个给抠出来了,能查找匹配的起止位置。说简单还是要自己写代码取具体字符,感觉用处不大。
PCRE是Perl Compatible Regular Expressions,功能上比较接近Perl的,作为Perl程序员,首选之。
regex嘛,不知道……
看到2008年的alpha就懒得试。难道已经终止开发了?
boost
Linux下搞C++不用boost,那基本就白活了,大概……
我可没说C++下不能用PCRE。
http://www.dmoz.org/Computers/Programming/Languages/Regular_Expressions/C_and_C%2b%2b/
http://hi.baidu.com/pigfanfan/blog/item/e4f884a4e9484ef09152ee42.html
Static library & dynamic library — linux系统下的静态库与动态库
2008-12-01 18:17
写这篇文章主要是由于昨天心心同学问了个关于实现动态库链接的makefile。然后我囧了,没能解答=,=
然后今天把《Advanced Linux Programming》看了下,把笔记写下来。。。
难免回有错误,还忘不吝指正:)
我们知道,几乎所有的程序在运行时都会链接到一个或多个库。比如C语言的printf函数,调用此函数时就会用到c的标准输入输出库;而在GUI下面,会用到对应的图形库;调用数据库时,会用到数据库系统提供的相应的库,等等。
最近评论