Recent Posts

Use txt2tags in Pelican

1. txt2tags

MarkdownPelican 默认支持的标记语言。其语法简洁,功能实用,多数情况下,可以满足实际的使用需求。

txt2tags 是一个类似的项目:

  Txt2tags is …

Pelican 使用记录


  1. Why Here?
  2. Why Pelican?
  3. Use Pelican
  4. Publish


1. Why Here?

之前博客搭在 Baidu Hi 上面,前后 …

GCC Linker Order

※ 问题

在程序开发过程中遇到了这样的问题:

程序比较大,因而拆分成了若干个静态库:

  1. 编译:OK!
  2. 链接:把静态库链接到可执行 …

同名全局变量造成的冲突

0x0 问题

程序运行时崩溃。

0x1 调试

经过调试发现,程序本身、和它所依赖的动态库里,有同名的全局变量,Loader 表示很凌乱。。

0x2 解决 …

redefinition of typedef error

又是一个坑。。啥也别说了。。

http://stackoverflow.com/questions/6526322/why-redefinition-of-typedef-error-with-gcc-4-3-but-not-gcc-4-6

gcc reverse_iterator comparison operators missing?

I get a compile error of the iterator when porting an application which is based on the C++ standard library. Someone get the same issue before, and there is already an answer at http://stackoverflow.com/questions/2135094/gcc-reverse-iterator-comparison-operators-missing.

栈溢出的调试及解决办法

※ 问题:

栈上消耗的内存太多,导致溢出,程序崩溃。

※ 程序崩溃的过程是怎样的?

1. CPU 执行代码时,反复地压栈;
2. 访问栈上内存时 …

保持 grep 的输出重定向到 less 时的颜色高亮

问题

使用 grep 搜索,比如:

$ cat a.txt | grep -a "word"

在输出结果里,匹配到的字符会通过颜色高亮显示,方便定位;

但如果输出结果比较多 …

读写锁 rwlock 实现里的避免写锁饥饿问题

使用读写锁时,同一时刻可以有多个读锁占用,但只能有一个写锁占用。

使用 pthread 多线程时,需要考虑如果持续地有多个线程 …

vim 里插入列表编号

0x00

markdown 里的 Ordered Lists 语法是这样的:

1. First item
2. Second item
3. Third item
4. Fourth item

虽然以下写法也是允许的,并且渲染的结果是一样的:

1. First item
1 …