2019-05-05

strsep和strtok
extract token from string, 功能都是对一个string进行分词处理,

1
2
char *strsep(char **stringp, const char *delim);
char *strtok( char *restrict str, const char *restrict delim );

两者都会原地修改输入的字符串,strsep是glibc的函数,非C标准,strtok是C标准, The strsep() function was introduced as a replacement for strtok(3), since the latter cannot handle empty fields. However, strtok(3) conforms to C89/C99 and hence is more portable

看看多久能忘记这个知识点

2019-05-11

免费开源的pdf合并软件
https://github.com/schourode/pdfbinder

2019-05-13

发现一款Windows上面可以快速打开和搜索超大文本文件的利器,glogg
http://glogg.bonnefon.org/

2019-05-17

/proc是个虚拟文档系统,我们能够通过对他的读写操作做为和kernel实体间进行通信的一种手段
/proc 文件系统是一个虚拟文件系统,通过它可以使用一种新的方法在 Linux 内核空间和用户空间之间进行通信

2019-05-18

查看glibc的版本号,直接执行/lib/libc.so.6

1
2
3
4
5
6
void __libc_main (void)
{
__libc_print_version ();
_exit (0);
}

或者ldd –version, ldd属于glibc的提供的工具

2019-06-03

https://stackoverflow.com/questions/228908/is-listsize-really-on
You are correct that the standard does not state what the complexity of list::size() must be - however, it does recommend that it “should have constant complexity” (Note A in Table 65).

In C++11 it is required that for any standard container the .size() operation must be complete in “constant” complexity (O(1)). (Table 96 — Container requirements). Previously in C++03 .size() should have constant complexity, but is not required (see Is std::string size() a O(1) operation?).

The change in standard is introduced by n2923: Specifying the complexity of size() (Revision 1).

However, the implementation of .size() in libstdc++ still uses an O(N) algorithm in gcc up to 4.8:

1
2
3
4
/** Returns the number of elements in the %list. */
size_type
size() const _GLIBCXX_NOEXCEPT
{ return std::distance(begin(), end()); }

See also Why is std::list bigger on c++11? for detail why it is kept this way.

Update: std::list::size() is properly O(1) when using gcc 5.0 in C++11 mode (or above).

shell 函数只能返回整数,不能返回字符串,只能用echo来取巧的返回字符串,但如果函数本身有echo就没有办法了

2019-06-23

熟悉读取大文件
http://www.voidcn.com/article/p-bjyjeaoq-vr.html
https://www.zhihu.com/question/36675524

python http client的库
https://www.cnblogs.com/miqi1992/p/7841599.html
https://my.oschina.net/sukai/blog/611451