Build protobuf in Windows

git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive

mkdir bld
cd bld
cmake -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=%CD%/installed -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=ON ../cmake/

If the project which we link with the protobuf.so complains "libprotobuf.so.22 is not found", it means we build protobuf in another way, through ./configure.

Cpu Affinity

from 宋宝华:
https://www.toutiao.com/article/6937097613720191520/

1
2
3
4
5
6
7
8
9
10
11
12
# grub.cfg, cpu order number starts from 0.
	linux ... isolcpus=2
 
# bash
taskset -cp 2 662
cat /proc/interrupts
cat /proc/irq/44/smp_affinity
 
# make menuconfig
NO_HZ_FULL
NO_HZ_IDLE
Documentation/timers/no_hz.rst

Could NOT find CARES

When I built wireshark in ubuntu, it emitted this error.

The correct packages to install are

1
2
3
4
5
sudo apt install libgcrypt20-dev libc-ares-dev libpcap-dev
mkdir bld
cd bld
cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/installed -DCMAKE_PREFIX_PATH=/home/work/3rdParty/qt/5.15.2/gcc_64
#.

转载:日语口语中常用省略形式介绍

一、日语口语省略形

1「い」

在口语中,接在「て」之后的「い」音常会被省略掉。

~ている→てる
~ていられない→てられない
~ていく→てく

2ちゃ/じゃ/きゃ

~ではない→じゃない
~なければならない→なきゃならない
ちゃった→てしまった
じゃった→でしまった
ちゃう→てしまう

3「りゃ」

これは→こりゃ
すれば→すりゃ
闻いていれば→闻いてりゃ

4「形容词~くって」

形容词~くって其后省略了「たまらない(非常)」。为口语强调型。

忙しくてたまらない→忙しくって忙死了

5「とく」

「とく」是「ておく预先、保持某种状态」的口语简略形

ておく→とく
ておいて→といて
ておけば→とけば

二、口语中的拨音便

1ら行常会音变成「ん」音。

信じられない→信じらんない
~てる→てん
ふざけるな→ふざけんな
なってるの→なってんの
分からなくて→分かんなくて

【注意】

「の」之前所接若为「る」时,此时的「る」通常会发「ん」音。

2「の」口语形式也常会发「ん」音。

~のだ→んだ
~ので→んで
~もの→もん

refer to:
http://www.wushiyintu.com/kouyu-1116.html

C++ memo

Terms,

1
2
RTTI: Runtime Type Identification		// typeid
RAII: Resource Acquisition Is Initialization	// std::mutex

VS Code memo

launch.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "dbg a.out",
			"type": "cppdbg",
			"request": "launch",
			"program": "${workspaceRoot}/path/to/a.out",
			"args": [
				"-b",
				"sim"
			],
			"stopAtEntry": false,
			"cwd": "${workspaceRoot}/path/to/",
			"environment": [
				{
					"name": "LD_LIBRARY_PATH",
					"value": "./:${workspaceRoot}/path/to/:/usr/local/cuda-11.1/lib64"
				},
				{
					"name": "GST_DEBUG_DUMP_DOT_DIR",
					"value": "/home/work/tmp"
				}
			],
			"externalConsole": false,
			"MIMode": "gdb",
			"setupCommands": [
				{
					"description": "Enable pretty-printing for gdb",
					"text": "-enable-pretty-printing",
					"ignoreFailures": true
				}
			]
		},
		{
			"name": "C++ Attach (GDB)",
			"type": "cppdbg",
			"request": "attach",
			"targetArchitecture": "x64",
			"program": "${workspaceRoot}/path/to/a.out",
			"processId": "${command:pickProcess}"
		}
	]
}

Don't translate tab to spaces,

1
File -> Preferences -> Settings -> Text Editor -> Insert Spaces / Detect Indentation

Display std::string or std::vector content

1
-exec -enable-pretty-printing

Blender source memo

1
2
3
4
5
6
7
8
9
10
#blender\source\blender\editors
ED_region_do_draw editors\screen\area.c
	outliner_main_region_draw editors\space_outliner\space_outliner.cc
		draw_outliner editors\space_outliner\outliner_draw.cc
			outliner_buttons
				UI_but_active_only editors\interface\interface.cc
					UI_but_active_only_ex
						ui_but_activate_event editors\interface\interface_handlers.c
							ui_do_button
								ui_do_but_TEX

Python Operator Precedence

The upper operators have higher precedence than the lower.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Grouping			()
Function call			f()
Slicing				[index:index]
Array subscription		[]
Bitwise NOT			~x
Unary plus/minus		+, -
Mul/Div/Mod			*, /, %
Add/Sub				+, -
Bitwise shift			<<, >>
Bitwise AND			&
Bitwise XOR			^
Bitwise OR			|
Relation			==, !=, >, >=, <, <=, is, is not, in, not in
				not
				and
				or
				lambda

refer to:
https://discuss.codechef.com/t/operator-precedence-table/14545

Stunning forbidden keyword about QSettings

1
2
3
4
5
    QSettings cfg(CONFIG_INI_PATH, QSettings::IniFormat);
    cfg.beginGroup("general"); // <-- other keywords are all ok.
    std::string val = cfg.value("itemCount").toString().toStdString();
    int video_count = cfg.value("itemCount").toInt();
    cfg.endGroup();

'general' keyword will lead 'val' to output empty in Qt5.15.2.