Blog

提问五要素

Content #

主题:是什么 / 做什么 #

什么是凯利判据

主题还有很多常用的提问方式,围绕内核“是什么 / 做什么”,用自然语言发挥就是:XX 是什么?我们来谈谈 XX。为什么 XX?你怎么看 XX?如果 XX 会怎样?写 1 份 XX。而 ChatGPT 倾向于使用“总 - 分 - 总”的结构来分析。

数量:要多少个参考? #

在主题要素的基础上,你既可以加入数量要求,也可以分拆多次来提问。为何需要数量?因为不指定,那就只有一个参考。

什么是凯利判据,请提供 3 个应用实例

细节:具体说 #

只要你不提期望的细节,结果必然泛泛而谈。

凯利判据是什么?
需要极简洁的背景故事和 (信息源链接)[link]
给出 1 个应用指导
重点部分加粗强调

方式:怎么来? #

三种ChatGPT提问的修正方式

格式:怎么秀? #

  1. 日常办公

PPT、脑图、流程图,通通要求输出 markdown,自己再转换一下,就可以曲线救国了。(例:GPT 生成脑图的 markdown 代码 在支持 markdown 的脑图工具中粘贴代码生成。)

Make a mindmap in markdown format, based on the video: https://xxxx
  1. 数据可视化

让 GPT 联动 Python 或者 Excel,可生成专业级的可视化图表。(例:GPT 生成 csv 数据 Excel 中将数据转换成图表。)

...

Generating a sample ansible.cfg file

Content #

You can generate a fully commented-out example ansible.cfg file, for example:

$ ansible-config init --disabled > ansible.cfg

You can also have a more complete file that includes existing plugins:

$ ansible-config init --disabled -t all > ansible.cfg

From #

target_compile_definitions

Content #

target_compile_definitions(<source> <INTERFACE|PUBLIC|PRIVATE> [items1...])

This target command will populate the COMPILE_DEFINITIONS property of a <source> target. Compile definitions are simply -Dname=definition flags passed to the compiler that configure the C++ preprocessor definitions.

We need to specify one of three values, INTERFACE, PUBLIC, or PRIVATE, to control which targets the property should be passed to. • PRIVATE sets the property of the source target. • INTERFACE sets the property of the destination targets. • PUBLIC sets the property of the source and destination targets.

...

Transitive usage requirements

Content #

Requirements means target properties or dependencies. CMake appends some properties/requirements of used targets to properties of targets using them. Some properties can transition(or simply propagate) across targets implicitly.

The whole concept means propagated properties between the source target(targets that gets used) and destination targets(targets that use other targets).

From #

Modern CMake for C++

target_compile_definitions

Dependency graph(CMake)

Content #

cmake_minimum_required(VERSION 3.19.2)
project(BankApp CXX)

add_executable(terminal_app terminal_app.cpp)
add_executable(gui_app gui_app.cpp)

target_link_libraries(terminal_app calculations)
target_link_libraries(gui_app calculations drawing)

add_library(calculations calculations.cpp)
add_library(drawing drawing.cpp)
    add_custom_target(checksum ALL
    COMMAND sh -c "cksum terminal_app>terminal.ck"
    COMMAND sh -c "cksum gui_app>gui.ck"
    BYPRODUCTS terminal.ck gui.ck
    COMMENT "Checking the sums..."
)

add_dependencies(checksum terminal_app gui_app)

Note: Connect libraries with executable by using target_link_libraries is before actually declaring any of the libraries.

target_link_libraries() is intended to be used with actual libraries and allows you to control property propagation.

...

add_custom_target

Content #

add_custom_target(Name [ALL] [command1 [args1...]]
    [COMMAND command2 [args2...] ...]
    [DEPENDS depend depend depend ... ]
    [BYPRODUCTS [files...]]
    [WORKING_DIRECTORY dir]
    [COMMENT comment]
    [JOB_POOL job_pool]
    [VERBATIM] [USES_TERMINAL]
    [COMMAND_EXPAND_LISTS]
    [SOURCES src1 [src2...]])

They allow you to specify your own command line that will be executed without checking whether the produced output is up to date, for example: • Calculate the checksums of other binaries. • Run the code-sanitizer and collect the results. • Send a compilation report to the data processing pipeline.

...

Setting the C++ Standard(CMake)

Setting the C++ Standard #

Treated as a preference, not enforced.

set_property(TARGET <target> PROPERTY CXX_STANDARD <standard>)

Explicitly require the standard.

set(CMAKE_CXX_STANDARD_REQUIRED ON)

From #

add_subdirectory

Content #

add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL])

This command will look for a CMakeLists.txt file in the source_dir path (evaluated relative to the current directory).

• Variable changes are isolated to the nested scope. • You’re free to configure the nested artifacts however you like. • Changing the nested CMakeLists.txt file doesn’t require building unrelated targets. • Paths are local to the directory, and they can even be added to the parent include path if desired.

...

cmake_policy

Content #

cmake_minimum_rquired() will also call another command:

cmake_policy(VERSION)

which will tell CMake what the right policies are to use for this project.

Whenever a backward-incompatible change was introduced, it came with a policy that enabled the new behavior.

Policies can affect every single aspect of CMake, including other important commands like project().

From #

Syntax for conditional commands

Content #

CMake will try to evaluate unquoted arguments as if they are variable references. In other words, using a plain variable name inside a condition is equal to writing ${VAR}.

set(VAR1 FALSE)
set(VAR2 "VAR1")
if(${VAR2})

The if() condition works in a bit of a convoluted way here –

  1. it will evaluate ${VAR2} to VAR1, which is a recognized variable
  2. and this in turn is evaluated to the FALSE string.

Strings are considered Boolean true only if they equal any of the following constants (these comparisons are case insensitive):

...