Welcome to My Great Book’s documentation!

OGLP 学习文档

_images/proj_depends.svg

Grapher 学习文档

Grapher 介绍

相关文件介绍

${ROOT}\phplibs\generalLibs\code01.php

基本信息配置文件,包含:数据库连接信息。

phplibs/userManage/swtUserManager.php

用户及管理员信息类型。调试阶段,建议将 isManager() 设为始终返回 true

调试报告生成时,需要将服务器上的 logStore 目录下该批次的目录,复制到本机的 logStore 目录下,以进行调试。 “目录名称”与“批次号”的对应关系如下:

select *
from mis_table_batch_list b left join mis_table_path_info p on b.path_id = p.path_id
where b.batch_id = 1071;

Microbench 学习文档

_images/microbench_report.svg

Shaderbench 学习文档

Framebench 学习文档

CMake 经验技巧

target 的 TYPE 属性

target 的 TYPE 属性为“只读”,不可以更改。

参考:

CMAKE_TOOLCHAIN_FILE was not used by the project

用 CMake 构建工程文件时,会出现如下警告信息:

CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_TOOLCHAIN_FILE

This is the standard warning gives you when you’re giving it a command line option it’s not using. That is giving -DFOO=bar to cmake when the CMakeLists.txt doesn’t use FOO variable.

Now, that’s a bit of a special case here: CMAKE_TOOLCHAIN_FILE is used by CMake the first time you’re configuring your build, but as you can’t change the toolchain for an already configured build, it’s ignored every other time, thus the warning.

add_custom_target 的技巧

自定义 target 被认为总是过期,即使它有生成文件。因此,自定义 target 总是会被生成。

自定义 targetTYPEUTILITY ,无法将其做为某个应用的依赖库,如: target_link_libraries(target <user_defined_target>)

Microsoft VC++ 经验技巧

Linker Tools Warning LNK4221

有如下两个 C++ 源文件:

a.cpp

// a.cpp
#include <atlbase.h>

b.cpp

// b.cpp
#include <atlbase.h>
int func1()
{
    return 0;
}

先将源文件编译成目标文件:

cl /c a.cpp b.cpp

当用如下命令行构建库的时候,会出现警告:

link /lib /out:test.lib a.obj b.obj

当 a.cpp 与 b.cpp 中的 public symbol 有重复时,有下例 4 种情况,对构建库及应用的影响如下:

  1. a.cpp 中的 public symbol 多于 b.cpp 中的,优先 b.obj 时:

    a
    a b
    a b
    

    链接库时,出现的警告信息如下:

    link /lib /out:test.lib a.obj b.obj
    a.obj : warning LNK4006: "int __cdecl func1(void)" (?func1@@YAHXZ) already defined in b.obj; second definition ignored
    

    当应用仅引用 a.cpp 和 b.cpp 中共同的符号时,将使用 b.cpp 中的符号,链接成功。

    link main.obj test.lib
    

    当应用引用 a.cpp 有而 b.cpp 中没有符号时,将引发如下错误:

    test.lib(a.obj) : error LNK2005: "int __cdecl func1(void)" (?func1@@YAHXZ) already defined in test.lib(b.obj)
    main.exe : fatal error LNK1169: one or more multiply defined symbols found
    
  2. a.cpp 中的 public symbol 多于 b.cpp 中的,优先使用 a.obj 时:

      a
    b a
    b a
    

    链接库时,出现的警告信息如下:

    b.obj : warning LNK4006: "int __cdecl func1(void)" (?func1@@YAHXZ) already defined in a.obj; second definition ignored
    b.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
    

    应用将使用 a.cpp 中的符号,链接成功。

合并两个静态库

命令行如下:

lib /OUT:filename.lib input1.lib input2.lib ...

Example reST 文档

The function spam() does a similar thing.

静态网页生成器

常用的静态网页生成器有如下几个:

jellky:基于 Ruby 开发,是 github pages 的默认页面生成器。
Hugo:基于 Go 语言开发,生成页面速度较快。
Hexo:生成页面速度较快,支持 Markdown 和 Octopress 插件。
pelican:基于 Python 开发,默认支持 reStructuredText ,通过插件支持 Markdown 。
Hyde:基于 Python 开发,有评论说文档支持不够友好。

C++ 经验技巧

C++ 读写二进制文件

读取一个二进制文件,并写入另外一个二进制文件:

#include <fstream>
#include <iterator>
#include <algorithm>

int main()
{
    std::ifstream input( "C:\\Final.gif", std::ios::binary );
    std::ofstream output( "C:\\myfile.gif", std::ios::binary );

    std::copy(
        std::istreambuf_iterator<char>(input),
        std::istreambuf_iterator<char>( ),
        std::ostreambuf_iterator<char>(output));
}

将二进制文件读入内存,用于后续处理:

#include <fstream>
#include <iterator>
#include <vector>

int main()
{
    std::ifstream input( "C:\\Final.gif", std::ios::binary );
    // copies all data into buffer
    std::vector<char> buffer((
            std::istreambuf_iterator<char>(input)),
            (std::istreambuf_iterator<char>()));
}

typedef 定长数组

想定义一个 3 字节的数组为一个新的类型,方法如下:

typedef char[3] type24;

但编译不通过。

正确的做法如下:

typedef char type24[3];

However, this is probably a very bad idea, because the resulting type is an array type, but users of it won’t see that it’s an array type. If used as a function argument, it will be passed by reference, not by value, and the sizeof for it will then be wrong.

A better solution would be

typedef struct type24 { char x[3]; } type24;

You probably also want to be using unsigned char instead of char, since the latter has implementation-defined signedness.

Vulkan 学习文档

Vulkan Cube 学习文档

demo_build_image_ownership_cmd 函数

VkCommandBufferUsageFlags
  • VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT specifies that each recording of the command buffer will only be submitted once, and the command buffer will be reset and recorded again between each submission.

    指定 command buffer 中的每个 recording 只会被提交一次,在每个提交之间 command buffer 会重置并重新记录。

  • VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT specifies that a secondary command buffer is considered to be entirely inside a render pass. If this is a primary command buffer, then this bit is ignored.

    指定 secondary command buffer 被认为完全位于 render pass 中。如果这是一个 primary command buffer ,那么这个标志位被忽略。

  • VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT specifies that a command buffer can be resubmitted to a queue while it is in the pending state, and recorded into multiple primary command buffers.

Vulkan Cube 学习文档

Vulkan Cube 简介

Vulkan cube 是 Vulkan SDK 中附带的示例程序,用来演示 Vulkan SDK 的使用方法。

Host Access to Device Memory Objects

Memory objects created with vkAllocateMemory are not directly host accessible.

vkAllocateMemory 创建的 Memory object 并不是直接 host accessiable 。

Memory objects created with the memory property VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT are considered mappable. Memory objects must be mappable in order to be successfully mapped on the host.

创建 Memory objects 时指定了 memory 属性 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT 被认为是可映射的( mappable )。要能够成功映射到 host , Memory object 必须是可映射的。

To retrieve a host virtual address pointer to a region of a mappable memory object, call

要获取一个指向可映射 memory object 的 host 虚拟地址指针,调用:

VkResult vkMapMemory(
    VkDevice          device,
    VkDeviceMemory    memory,
    VkDeviceSize      offset,
    VkDeviceSize        size,
    VkMemoryMapFlags   flags,
    void**           ppData);

vkMapMemory does not check whether the device memory is currently in use before returning the host-accessible pointer. The application must guarantee that any previously submitted command that writes to this range has completed before the host reads from or writes to that range, and that any previously submitted command that reads from that range has completed before the host writes to that region (see here for details on fulfilling such a guarantee). If the device memory was allocated without the VK_MEMORY_PROPERTY_HOST_COHERENT_BIT set, these guarantees must be made for an extended range: the application must round down the start of the range to the nearest multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize, and round the end of the range up to the nearest multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize.

While a range of device memory is mapped for host access, the application is responsible for synchronizing both device and host access to that memory range.

void vkGetImageSubresourceLayout(
    VkDevice                        device,
    VkImage                          image,
    const VkImageSubresource* pSubresource,
    VkSubresourceLayout*           pLayout);

typedef struct VkImageSubresource {
    VkImageAspectFlags aspectMask;
    uint32_t             mipLevel;
    uint32_t           arrayLayer;
} VkImageSubresource;

typedef struct VkSubresourceLayout {
    VkDeviceSize     offset;
    VkDeviceSize       size;
    VkDeviceSize   rowPitch;
    VkDeviceSize arrayPitch;
    VkDeviceSize depthPitch;
} VkSubresourceLayout;

WinDbg 经验技巧

LOG 文件设置

  • .logopen

    打开一个日志文件,语法如下:

.logopen [\t] [\u] [FileName]

\t 附加进程 ID 和当前的日期、时间到日志文件名。这部分插入在文件名之后及文件名扩展之前。

\u 用 Unicode 格式写入日志文件。如果省略该选项,调试器用 ASCII(ANSI) 格式写入日志文件。

我是一级标题

我是正文。添加一些描述性的文字。

Welcome to My Great Book’s documentation!

我是二级标题

Welcome to My Great Book’s documentation!

欢迎光临 网易新闻

A欢迎光临 网易新闻 ! A欢迎光临 网易新闻 ! b欢迎光临网易新闻

this is a paragraph that contains a link.

Welcome to My Great Book’s documentation!

goto Welcome to My Great Book’s documentation!.

跳转到一个文件:Microsoft VC++ 经验技巧 ,点击试一试。

See This is an example

ENVAR DK_ROOT

Since Pythagoras, we know that \(a^2 + b^2 = c^2\).

Control-x Control-f

Start ‣ Programs

Release

Version

Today is Jul 18, 2019

Danger

Beware killer rabbits!

Danger

Beware killer rabbits!

Attention

Beware killer rabbits!

Caution

Beware killer rabbits!

Note

Beware killer rabbits!

Hint

Beware killer rabbits!

Important

Beware killer rabbits!

Tip

Beware killer rabbits!

Warning

Beware killer rabbits!

New in version 1.1.0: Beware killer rabbits!

Changed in version 1.2.0: Beware killer rabbits!

Deprecated since version 1.3.0: Beware killer rabbits!

See also

Module zipfile
Documentation of the zipfile standard module.
GNU tar manual, Basic Tar Format
Documentation for tar archive files, including GNU tar extensions.

LICENSE AGREEMENT

Running the program needs a license.

spam(eggs)
ham(eggs)

Spam or ham the foo.

filterwarnings(action, message='', category=Warning, module='', lineno=0, append=False)

Indices and tables