From 6a95adbf42beca5c8456dc4ef557657e96f6f76e Mon Sep 17 00:00:00 2001 From: Huweicai Date: Sat, 30 Mar 2024 18:27:10 +0800 Subject: [PATCH] feat: add c & python intercall --- 404.html | 2 +- about/index.html | 2 +- archives/index.html | 42 +- c-with-python-intercall/index.html | 881 ++++++++++++++++++ categories/english/index.html | 2 +- categories/go/index.html | 2 +- categories/index.html | 2 +- chubaofs-csi/index.html | 9 +- cilium-config/index.html | 2 +- cilium-container-datapath/index.html | 2 +- computer-encodings/index.html | 2 +- confusion-betwwen-forwhiletrue/index.html | 2 +- cubefs-with-kubernetes/index.html | 2 +- elf/index.html | 9 +- fluent-bit/index.html | 2 +- git-implementation/index.html | 2 +- go-knowledge-points/index.html | 2 +- go-linux-get-cpu-usage/index.html | 2 +- go-package-sync/index.html | 2 +- go-switch/index.html | 2 +- harbor-pull-principle/index.html | 4 +- how-color-present/index.html | 2 +- how-vpn-works/index.html | 2 +- index.html | 122 +-- index.xml | 20 +- java-platforms/index.html | 2 +- kernel-debug-tips/index.html | 2 +- kernel-debug-tips_en/index.html | 2 +- kubectl-concepts-and-commands/index.html | 2 +- kubernetes-permissions-overview/index.html | 2 +- minikube-install-tutorial/index.html | 2 +- most-frequently-command/index.html | 2 +- mysql-create-options/index.html | 2 +- page/2/index.html | 125 +-- page/3/index.html | 131 +-- page/4/index.html | 131 +-- page/5/index.html | 108 ++- page/6/index.html | 88 +- .../index.html" | 2 +- personal/index.html | 2 +- .../index.html" | 2 +- process-thread-goroutine/index.html | 2 +- redis-faq/index.html | 2 +- run-linux-container-manual/index.html | 2 +- run-openwrt-on-xiaomi4a100m/index.html | 2 +- series/index.html | 2 +- shared-memory/index.html | 2 +- sitemap.xml | 33 +- something-about-disk/index.html | 2 +- tags/cilium/index.html | 2 +- tags/cloudnative/index.html | 2 +- tags/cpp/index.html | 489 ++++++++++ tags/cpp/index.xml | 20 + tags/cpu/index.html | 2 +- tags/docker/index.html | 2 +- tags/ebpf/index.html | 2 +- tags/en/index.html | 2 +- tags/ethernet/index.html | 2 +- tags/git/index.html | 2 +- tags/go/index.html | 2 +- tags/harbor/index.html | 2 +- tags/http/index.html | 2 +- tags/index.html | 29 +- tags/index.xml | 29 +- tags/innodb/index.html | 2 +- tags/ip/index.html | 2 +- tags/java/index.html | 2 +- tags/jvm/index.html | 2 +- tags/kernel/index.html | 2 +- tags/kubernetes/index.html | 2 +- tags/linux/index.html | 2 +- tags/mysql/index.html | 2 +- tags/pprof/index.html | 2 +- tags/programing/index.html | 489 ++++++++++ tags/programing/index.xml | 20 + tags/python/index.html | 489 ++++++++++ tags/python/index.xml | 20 + tags/redis/index.html | 2 +- tags/shell/index.html | 2 +- tags/tcp/index.html | 2 +- tags/yuv/index.html | 2 +- .../index.html" | 2 +- .../index.html" | 2 +- "tags/\345\233\276\345\203\217/index.html" | 2 +- "tags/\345\255\230\345\202\250/index.html" | 2 +- "tags/\345\256\271\345\231\250/index.html" | 2 +- "tags/\345\271\266\345\217\221/index.html" | 2 +- .../index.html" | 2 +- .../index.html" | 2 +- .../index.html" | 2 +- "tags/\346\227\245\345\277\227/index.html" | 2 +- .../index.html" | 2 +- "tags/\347\241\254\344\273\266/index.html" | 2 +- "tags/\347\243\201\347\233\230/index.html" | 2 +- .../index.html" | 2 +- .../index.html" | 2 +- "tags/\351\225\234\345\203\217/index.html" | 2 +- .../index.html" | 2 +- troubleshotting-goroutine-leeking/index.html | 2 +- untitled/index.html | 467 ++++++++++ upgrade-centos-kernel-version/index.html | 2 +- weave-scope/index.html | 2 +- web-markdown-to-pdf-utils/index.html | 2 +- who-network-capture-analysis/index.html | 2 +- 104 files changed, 3543 insertions(+), 376 deletions(-) create mode 100644 c-with-python-intercall/index.html create mode 100644 tags/cpp/index.html create mode 100644 tags/cpp/index.xml create mode 100644 tags/programing/index.html create mode 100644 tags/programing/index.xml create mode 100644 tags/python/index.html create mode 100644 tags/python/index.xml create mode 100644 untitled/index.html diff --git a/404.html b/404.html index a1e2582..997237f 100644 --- a/404.html +++ b/404.html @@ -323,7 +323,7 @@

diff --git a/about/index.html b/about/index.html index 8e400d7..777e698 100644 --- a/about/index.html +++ b/about/index.html @@ -358,7 +358,7 @@

Huweicai

diff --git a/archives/index.html b/archives/index.html index 39267a4..5039f1f 100644 --- a/archives/index.html +++ b/archives/index.html @@ -286,6 +286,44 @@

+
+ ——2024—— +
+ +
+ + + + + + 2024-01-29 + C/C++ & Python 融合之道 + 3933 Words + + + + + + + + + + + + + + + +
+ + + + + + +
——2023—— @@ -1377,6 +1415,8 @@

+ +

@@ -1440,7 +1480,7 @@

diff --git a/c-with-python-intercall/index.html b/c-with-python-intercall/index.html new file mode 100644 index 0000000..db6b8dc --- /dev/null +++ b/c-with-python-intercall/index.html @@ -0,0 +1,881 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + C/C++ & Python 融合之道 | Anonymous' Blog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+ + + +
+ +
+ + +
C/C++ & Python 融合之道
+ + + + +
+ + +
+

Python 解释器

+

正如软件系统通常分为定义与实现两部分,编程语言也是。

+
    +
  • +

    比如 C++ 标准是由国际标准化组织 ( ISO ) 下属的 ISO/IEC JTC1/SC22/WG21特别工作组制定的,最新标准为 C++ 20 (ISO/IEC 14882:2020),这是定义;而其实现则有 GNU 的 gcc、微软的 visual c++、Apple 发起的 clang 等等,任何人都可以按照定义去实现自己的实现。

    +
  • +
  • +

    Java 规范则是由 Oracle 主导的 JCP 所制定,有 Oracle Java SE、OpenJDK、Corretto、AdoptOpen 等大量不同的实现。

    +
  • +
  • +

    更别论应用更为广泛的 JavaScript 语言,ECMAScript 的实现者至少有两位数。

    +
  • +
  • +

    Python 作为一门广泛使用坐拥庞大社区支持的编程语言,更是如此。

    +
  • +
+

Python 的语言规范是由 Python 软件基金会(PSF)负责制定的。

+

不同于 ISO(国际标准化组织)或 ECMA(欧洲计算机制造商协会)这些更为正式的标准化机构,Python 的规范制定过程相对非正式,主要由社区驱动。

+

与严格的书面标准相比,Python 标准给实现者留下了更多的灵活性和创造空间。

+

Python 编程语言的“实现” 通常被称为解释器,由 PSF 官方维护的基于 C 语言实现解释器 CPython 是使用最为广泛的解释器,也是大家默认 Python 实现。

+

除此之外,还有:

+
    +
  • 基于 JVM 实现的 Jython graalpython,方便与 Java 编程语言集成
  • +
  • 基于 .NET 框架实现的Python.NET IronPython
  • +
  • 基于 Python ( RPython,Python 语法子集)自举实现的 JIT 解释器PyPy
  • +
  • 适合于 IOT 场景的 MicroPython,裁减了部分标准库优化了其资源占用
  • +
  • 哪里有 C 代码,哪里就有人在用 Rust 重写:RustPython
  • +
+

回到正题,由于我们默认的 Python 解释器 CPython 就是基于 C 语言实现的,所以其与 C/C++ 系语言天然就具有较高的亲和性,这正是我们能顺畅地在 C++ 中调用 Python 的理论基础所在。

+

在本文的后续部分,除非另有说明,提及的“解释器”均指的是由 Python 软件基金会官方维护的 CPython 解释器。

+

Python Extension Module

+

具体到 Python 是如何与 C++ 集成的,这就不得不提到 Extension Module 机制了。

+

众所周知,模块是 Python 代码组织中的一个重要单元,用于封装和重用代码,我们会通过 import关键字引入一个模块从而可以调用外部的代码。

+

而 Python 的 Extension Module 机制则允许我们利用 C/C++ 去实现 Python module,C/C++ 中的函数会按照约定的签名映射成 Python 中的函数。

+

代码开发完成之后,我们需要将之编译成一个动态链接库,Python 解释器在 import的时候会在PYTHONPATH以及一些约定的目录下,按照约定的名称进行搜索,解释器导入模块的查找顺序如下,以 import foo 为例:

+
    +
  1. foo.py
  2. +
  3. foo.pyc (如果有编译过的字节码文件存在)
  4. +
  5. foo.so (在 Unix-like 系统)
  6. +
  7. foo.pyd (在 Windows 系统,相当于 DLL)
  8. +
  9. _foo.so (可能的 C 扩展模块名字)
  10. +
  11. foo.cpython-36m-x86_64-linux-gnu.so (可能的带有版本号和架构的 C 扩展文件名)
  12. +
+

import之后,在 Python 代码中,我们就可以像调用普通 Python 模块一样调用我们的 C/C++ 代码了。

+

举个完整的例子,假设我们想要实现一个加法模块,以下是相关操作步骤。

+

编辑 add_module.c文件:

+
// 必须要 include python.h 头文件
+#include <Python.h>
+
+// C 函数实现加法
+static PyObject* add(PyObject* self, PyObject* args) {
+    double a, b;
+    // 解析传入的Python参数为C类型变量,dd 表示两个 double 类型变量
+    if (!PyArg_ParseTuple(args, "dd", &a, &b)) {
+        return NULL;
+    }
+    // 返回计算结果,d 表示返回一个 double 类型的变量
+    return Py_BuildValue("d", a + b);
+}
+
+// 定义模块要导出的方法列表
+static PyMethodDef AddMethods[] = {
+    {"add",  add, METH_VARARGS, "Add two numbers"},
+    {NULL, NULL, 0, NULL}        // Sentinel,标记数组的结束(C 数组无法直接获取长度,解释器会通过 Sentinel 来判断数组结尾)
+};
+
+// 定义模块
+static struct PyModuleDef addmodule = {
+    PyModuleDef_HEAD_INIT,
+    "add_module",   // 模块名
+    NULL, // 模块文档,可以设置为 NULL
+    -1,       // 模块保留大小,-1 表示模块保持全局状态
+    AddMethods // 方法列表
+};
+
+// 初始化模块
+PyMODINIT_FUNC PyInit_add_module(void) {
+    return PyModule_Create(&addmodule);
+}
+

为了让这个 C 代码可以被 Python 解释器识别,我们需要将其编译成一个动态链接库:

+
gcc -Wall -shared -fPIC -I/usr/include/python3.9 -L/usr/lib/python3.9/config-x86_64-linux-gnu -lpython3.9 add_module.c -o add_module.so
+

此时我们就得到了一个 add_module.so文件,直接在 Python 代码中 import即可使用:

+
root@ubuntu:/ # python3.9
+Python 3.9.18 (main, Feb 26 2024, 01:38:59)
+[GCC 11.4.0] on linux
+Type "help", "copyright", "credits" or "license" for more information.
+>>> import add_module
+>>> print(add_module.add(6.6, 6.6))
+13.2
+>>>
+

在科学计算和人工智能领域,大量的 Python 库都在通过这种方式兼顾效率与性能,如:NumPyPandasTensorflowPyTorch 等等。

+

C++ -> Python

+

将 C++ 代码按照约定的方式编译即能让 Python 解释器识别,实现 Python 对于 C++ 代码的调用,那么反过来 C++ 该如何调用 Python 代码呢?

+

在 C/C++ 中调用 Python 解释器运行,这种机制被称为 Embedding Python,其实运作原理也是和 Extension Module 非常类似的。

+

Python 解释器提供了一套 API ( Python/C API ),供 C/C++ 代码调用,C/C++ 可以借由这套 API 实现对于解释器的高效集成与复杂交互操作,包括导入模块、创建和操作 Python 对象、函数调用、传输与转换数据等等,几乎所有 Python 代码能实现的操作,也能通过这套代码在 C/C++ 中实现。

+

举个例子,科学计算正是 Python 语言的强项之一,而 NumPy 是一个非常著名的 Python 科学计算库,我们可以尝试通过 Python/C API 将这种能力导入到 C/C++ 程序中,numpy.linalg.norm 函数可以计算一个一维数组对应的欧几里得范数,下文将介绍如何将该函数封装到 C/C++ 程序中;

+

由于在复杂场景下 C 代码可读性要弱于 C++ 代码,下文案例采用 C++ 实现:

+
#include <Python.h> // Python 头文件
+#include <vector>
+#include <iostream>
+#include <stdexcept>
+
+// C++ 包装函数
+double numpy_linalg_norm(const std::vector<double> &in_array) {
+    Py_Initialize(); // 初始化 Python 解释器
+
+    PyObject *pName = PyUnicode_FromString("numpy.linalg"); // 加载 NumPy 模块
+    PyObject *pModule = PyImport_Import(pName);
+    Py_DECREF(pName); // 释放 pName(Python 引用计数 -1)
+
+    if (pModule == NULL) {
+        PyErr_Print();
+        Py_Finalize();
+        throw std::runtime_error("Failed to load numpy.linalg module");
+    }
+
+    PyObject *pFunc = PyObject_GetAttrString(pModule, "norm"); // 获取 norm 函数
+    if (!pFunc || !PyCallable_Check(pFunc)) {
+        PyErr_Print();
+        Py_Finalize();
+        throw std::runtime_error("Failed to retrieve norm function");
+    }
+
+    PyObject *pList = PyList_New(in_array.size()); // 创建一个 Python 列表
+    for (size_t i = 0; i < in_array.size(); ++i) { // 将 C++ 数组转换为 Python 列表
+        PyList_SetItem(pList, i, PyFloat_FromDouble(in_array[i]));
+    }
+
+    PyObject *pArgs = PyTuple_New(1); // 创建参数元组
+    PyTuple_SetItem(pArgs, 0, pList);
+
+    PyObject *pValue = PyObject_CallObject(pFunc, pArgs); // 调用函数
+    Py_DECREF(pArgs);
+    if (pValue == NULL) { // 判断是否成功调用
+        PyErr_Print();
+        Py_Finalize();
+        throw std::runtime_error("Failed to call norm function");
+    }
+
+    double result = PyFloat_AsDouble(pValue); // 处理返回值
+
+    Py_DECREF(pValue);
+    Py_DECREF(pFunc);
+    Py_DECREF(pModule);
+
+    Py_Finalize();     // 关闭 Python 解释器
+
+    return result;
+}
+
+int main() {
+    try {
+        std::vector<double> in_array = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
+        double norm = numpy_linalg_norm(in_array);
+        std::cout << "L2 Norm of the array is: " << norm << std::endl;
+    } catch (const std::exception &e) {
+        std::cerr << "An error occurred: " << e.what() << std::endl;
+        return 1;
+    }
+
+    return 0;
+}
+

这里由于依赖到了 numpy库,所以我们需要事先通过 Python 的包管理程序安装它:

+
python3.9 -m pip install numpy
+

然后保存这段代码,编译运行就能在标准输出中看到这个数组对应的欧几里得范数了:

+
g++ -o cpp_call_python_demo main.cpp -I/usr/include/python3.9 -lpython3.9
+

Cython

+

尽管 Python/C API为 C/C++ 调用 Python 提供了理论上的可行性,但是我们通过上方的案例也不难看出,其复杂程度是相当高的,即使 Python 中诸如赋值、初始化这样简单的操作都需要映射成 C/C++ 中的一个函数,另外还需要进行相当频繁地错误判断与处理,手动引用释放等逻辑,复杂程序不亚于在二十一世纪手写汇编程序。

+

为了实现 numpy.linalg.norm([1, 2, 3, 4, 5, 6])这一行代码,我们总共写了整整五十行代码,如果再多几行 Python 代码想必 C/C++ 程序的复杂度更是指数级爆炸增长。

+

Obviously,我们还需要一层”抽象“,而 Cython 可能正是我们寻找的答案。

+
+

The most widely used Python to C compiler.

+
+

在 Cython 的 Github 主页,它是这么介绍自己的。

+

让我们来分析一下这句话,compiler 是宾语,意味着 Cython 本质上是一个编译器,而这个编译器的定语Python to C 则表明它这个编译器的输入是 Python 语言,而输出是 C 语言,这句话向我们精炼地概括了 Cython 的核心特性。

+

Cython 官网首页的这一段话,则是其更加详细地介绍:

+
+

The Cython language is a superset of the Python language that additionally supports calling C functions and declaring C types on variables and class attributes.

+
+

这句话中的宾语则是”编程语言“,可能会让人有点困惑,不过正如第一节中所描述的: +”编程语言也是由定义与实现两部分组成的“,Cython 也是。

+

Cython 本质上是一门编程语言,在 Python 语法的基础上,加入了对于 C 语法的支持,使得它能非常恰当的胜任两门语言中的那一层胶水,不管是通过 Cython 开发 Extension Module,或者是 Embedding 到 C/C++ 程序中,都能省事很多。

+

Cython 代码通常是以 .pyx结尾,.pxd文件则类比于 C 语言中的 .h头文件,用于存放结构定义,前面提到 Cython 是一个编译器,所以这门编程语言是一门编译型语言,Cython 编译器会每一个源代码文件编译成一个 C 或者 C++ 文件,这取决于我们的配置;

+

然后我们需要再借助 C/C++ 编译器的帮助,将它们进一步编译成包含机器码指令的动态链接库,这就是我们最终的产物了,这个动态链接库是一个非常神奇的东西,胶水两边的语言都能无缝调用。

+

首先它是符合 Python Extension Module 规范的,所以能被纯 Python 代码 import,其次它还能暴露 public 的 C/C++ 函数,所以也能在 C/C++ 程序中被调用,在两边代码的调用者视角中,就是简简单单引了个库,调个函数它就能把事给办了,不论在哪一边都是妥妥的一等公民。

+

作为一门编程语言其语法细节当然也不是简单几笔就能概括完的,这里就不展开了,我们还是通过一个程序案例的方式来直观地感受一下。

+

这里我们直接将上文基于 Python/C API 实现的 demo,转换成用 Cython 实现:

+

首先我们需要安装 Cython 编译器:

+
python3.9 -m pip install cython
+

编辑文件 numpy_wrapper.pyx:

+
# distutils: language = c++
+
+import numpy
+from libcpp.vector cimport vector  # Cython 内置了对于部分 C++ STL 结构的封装
+
+# 申明为 public 表明该函数需要被导出
+cdef public double numpy_linalg_norm(const vector[double] & in_array):
+    cdef tuple py_tuple = tuple()  # 将 C++ vector 转换为 Python tuple
+    cdef int i
+    for i in range(in_array.size()):
+        py_tuple += (in_array[i],)
+
+    return numpy.linalg.norm(py_tuple)  # Python 调用
+

这就是我们 cython 版本的代码了,可以看到其语法风格和 Python 基本差不多。

+

然后我们需要配置一下构建逻辑 setup.py

+
from Cython.Build import cythonize
+from setuptools import setup
+from setuptools.extension import Extension
+
+extensions = [
+    Extension(
+        "numpy_wrapper",
+        ["numpy_wrapper.pyx"],
+        language="c++",  # 使用 C++ 语言特性编译成 C++ 源文件
+        extra_compile_args=["-std=c++20"],  # 指示编译器使用 C++20 标准
+        extra_link_args=["-std=c++20"],
+    )
+]
+
+setup(
+    name='numpy_wrapper',
+    ext_modules=cythonize(
+        extensions,
+        language_level=3,  # 指定 Cython 编译器使用 Python 3 语法
+    )
+)
+

编译之后:python3.9 setup.py build_ext --inplace,我们就能看到在当前文件夹下方多出来了几个文件:

+
root@ubuntu# ls -1
+build
+numpy_wrapper.cpp
+numpy_wrapper.cpython-39-x86_64-linux-gnu.so
+numpy_wrapper.h
+numpy_wrapper.pyx
+setup.py
+

.cpp 和 .h 是 Cython 编译的产物,这两个文件进一步调用 gcc 编译就生成了我们上文提到的动态链接库:numpy_wrapper.cpython-39-x86_64-linux-gnu.so

+

然后我们就能像 C++ 程序调用常规第三方库的方式去开发了:

+
    +
  • include 这个头文件
  • +
  • 链接这个动态链接库,不过在这之前需要按照标准的动态链接库文件名格式重命名一下
  • +
  • libpython 库也还是照样需要引用的
  • +
+

组合一下编译命令就长这样了:

+
 g++ -o cpp_call_python_demo main.cpp -I/usr/include/python3.9 -lpython3.9 -L. -lnumpy_wrapper
+

然后再简单修改一下我们的 C++ 代码就能得到同样的输出:

+
#include <Python.h>
+#include <vector>
+#include <iostream>
+#include <stdexcept>
+#include "numpy_wrapper.h"
+
+// 初始化 Python 解释器,导入模块
+void initialize_py_interpreter() {
+    PyImport_AppendInittab("numpy_wrapper", PyInit_numpy_wrapper);
+    Py_Initialize();
+    PyImport_ImportModule("numpy_wrapper");
+}
+
+
+int main() {
+    initialize_py_interpreter();
+
+    try {
+        std::vector<double> in_array = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
+        double norm = numpy_linalg_norm(in_array);
+        std::cout << "L2 Norm of the array is: " << norm << std::endl;
+    } catch (const std::exception &e) {
+        std::cerr << "An error occurred: " << e.what() << std::endl;
+        return 1;
+    }
+
+    return 0;
+}
+

而当我们反过来需要在 Python 中调用 C++ 的时候,Cython 也可以帮我们免去按照约定的 Python Extension Module 开发的中间层,C++ 代码还是按照正常流程开发就行,Cython 中可以直接 include 对应的 C++ 头文件,链接对应的动态链接库,然后再暴露给纯 Python 模块调用。

+ +
+ + +
+
+ +
+ + +
+ +
+ +
+ + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+ + +
+ + +
+ + +
+ + + +
+ + + +
+ + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/categories/english/index.html b/categories/english/index.html index eefc81e..153534a 100644 --- a/categories/english/index.html +++ b/categories/english/index.html @@ -467,7 +467,7 @@

diff --git a/categories/go/index.html b/categories/go/index.html index d20d536..5f97d26 100644 --- a/categories/go/index.html +++ b/categories/go/index.html @@ -499,7 +499,7 @@

diff --git a/categories/index.html b/categories/index.html index a5112f3..8230979 100644 --- a/categories/index.html +++ b/categories/index.html @@ -387,7 +387,7 @@

diff --git a/chubaofs-csi/index.html b/chubaofs-csi/index.html index bf49326..9af3e52 100644 --- a/chubaofs-csi/index.html +++ b/chubaofs-csi/index.html @@ -322,6 +322,13 @@

ChubaoFS CSI

@@ -404,7 +411,7 @@

ChubaoFS CSI

diff --git a/cilium-config/index.html b/cilium-config/index.html index 6424d61..c1f034e 100644 --- a/cilium-config/index.html +++ b/cilium-config/index.html @@ -1168,7 +1168,7 @@

Cilium Config

diff --git a/cilium-container-datapath/index.html b/cilium-container-datapath/index.html index 6d1abd0..26a0dfc 100644 --- a/cilium-container-datapath/index.html +++ b/cilium-container-datapath/index.html @@ -824,7 +824,7 @@

NAT

diff --git a/computer-encodings/index.html b/computer-encodings/index.html index 08b7a56..c6af563 100644 --- a/computer-encodings/index.html +++ b/computer-encodings/index.html @@ -464,7 +464,7 @@

diff --git a/confusion-betwwen-forwhiletrue/index.html b/confusion-betwwen-forwhiletrue/index.html index 0302e68..2769e02 100644 --- a/confusion-betwwen-forwhiletrue/index.html +++ b/confusion-betwwen-forwhiletrue/index.html @@ -449,7 +449,7 @@

diff --git a/cubefs-with-kubernetes/index.html b/cubefs-with-kubernetes/index.html index 98a60b2..d701ad2 100644 --- a/cubefs-with-kubernetes/index.html +++ b/cubefs-with-kubernetes/index.html @@ -1390,7 +1390,7 @@

风险

diff --git a/elf/index.html b/elf/index.html index 14a7993..f098460 100644 --- a/elf/index.html +++ b/elf/index.html @@ -681,6 +681,13 @@

References

@@ -1800,7 +1807,7 @@

References

diff --git a/fluent-bit/index.html b/fluent-bit/index.html index f2f77b8..727f334 100644 --- a/fluent-bit/index.html +++ b/fluent-bit/index.html @@ -1219,7 +1219,7 @@

参考

diff --git a/git-implementation/index.html b/git-implementation/index.html index 9113cca..3d84ea3 100644 --- a/git-implementation/index.html +++ b/git-implementation/index.html @@ -1183,7 +1183,7 @@

示意图

diff --git a/go-knowledge-points/index.html b/go-knowledge-points/index.html index 5087672..1871976 100644 --- a/go-knowledge-points/index.html +++ b/go-knowledge-points/index.html @@ -1631,7 +1631,7 @@

待更新

diff --git a/go-linux-get-cpu-usage/index.html b/go-linux-get-cpu-usage/index.html index 2c3b87c..2ab1c28 100644 --- a/go-linux-get-cpu-usage/index.html +++ b/go-linux-get-cpu-usage/index.html @@ -856,7 +856,7 @@

验证

diff --git a/go-package-sync/index.html b/go-package-sync/index.html index 1157058..a4c5c3a 100644 --- a/go-package-sync/index.html +++ b/go-package-sync/index.html @@ -1143,7 +1143,7 @@

获取对象流程

diff --git a/go-switch/index.html b/go-switch/index.html index cf428ce..ea57713 100644 --- a/go-switch/index.html +++ b/go-switch/index.html @@ -584,7 +584,7 @@

case 条件合并

diff --git a/harbor-pull-principle/index.html b/harbor-pull-principle/index.html index 5d74002..41bb4b9 100644 --- a/harbor-pull-principle/index.html +++ b/harbor-pull-principle/index.html @@ -693,7 +693,7 @@

/v2/*/blobs/*接口

return nil }

总结

-

到这里服务端视角的镜像拉取流程我们就分析完了,客户端( docker )拿到这些文件之后,就可以根据 manifest 中配置的命令和参数,然后再将下载到的镜像层通过 overlay 等uino file system 合并成一个文件系统,就可以将这些文件 run 起来了~

+

到这里服务端视角的镜像拉取流程我们就分析完了,客户端( docker )拿到这些文件之后,就可以根据 manifest 中配置的命令和参数,然后再将下载到的镜像层通过 overlay 等uino file system 合并成一个文件系统,就可以将这些文件 run 起来了。

@@ -1136,7 +1136,7 @@

/v2/*/blobs/*接口

diff --git a/how-color-present/index.html b/how-color-present/index.html index 9e7ff12..1cda5be 100644 --- a/how-color-present/index.html +++ b/how-color-present/index.html @@ -784,7 +784,7 @@

总结

diff --git a/how-vpn-works/index.html b/how-vpn-works/index.html index 39485e4..20b7af2 100644 --- a/how-vpn-works/index.html +++ b/how-vpn-works/index.html @@ -604,7 +604,7 @@

网络传输

diff --git a/index.html b/index.html index a2fe2e6..275f679 100644 --- a/index.html +++ b/index.html @@ -422,6 +422,8 @@

Hello, World!

+ + @@ -476,6 +478,8 @@

Hello, World!

  • 命令行 (2)
  • +
  • cpp (1)
  • +
  • cpu (1)
  • en (1)
  • @@ -496,6 +500,10 @@

    Hello, World!

  • pprof (1)
  • +
  • programing (1)
  • + +
  • python (1)
  • +
  • redis (1)
  • shell (1)
  • @@ -588,6 +596,62 @@

    Hello, World!

    +
    + + +
    +
    C/C++ & Python 融合之道
    + +
    + + + + Python 解释器 正如软件系统通常分为定义与实现两部分,编程语言也是。 比如 C++ 标准是由国际标准化组织 ( ISO ) 下属的 ISO/IEC JTC1/SC22/WG21特别工作组制定的,最新标准为 C++ 20 (ISO/IEC 14882:2020),这是定义;而其实现则有 GNU 的 gcc、微软的 visual c++、Apple 发起的 clang 等等,任何人都可以按照定义去实现自己的实现。 Java 规范则是由 Oracle 主导的 JCP 所制定,有 Oracle Java SE、OpenJDK、Corretto、AdoptOpen 等大量...... + +
    + + + + + +
    + +
    @@ -923,62 +987,6 @@

    Hello, World!

    -
    - - -
    -
    Linux 内核轻量级调试小技巧
    - -
    - - - - Kernel 内核承担了核心的操作系统工作,是当今软件生态的基石,因此了解内核是如何工作的能极大的帮助我们更好地构建用户态系统。 学习软件源代码最好的方式就是边看边 DEBUG,软件 = 代码 + 数据,看代码的同时了解其运行时数据能让我们更好的理解整体逻辑。 但内核毕竟不是普通的软件系统,并不是简单的在 IDE 里面一点就能断点调试的,虽然也可以通过 kgdb + qemu 实现在 IDE 中的断点调式,不过这样实在是太重了,而且也不能分析正在运行中的线上...... - -
    - - - - - -
    - - +
    + + +
    +
    Linux 内核轻量级调试小技巧
    + +
    + + + + Kernel 内核承担了核心的操作系统工作,是当今软件生态的基石,因此了解内核是如何工作的能极大的帮助我们更好地构建用户态系统。 学习软件源代码最好的方式就是边看边 DEBUG,软件 = 代码 + 数据,看代码的同时了解其运行时数据能让我们更好的理解整体逻辑。 但内核毕竟不是普通的软件系统,并不是简单的在 IDE 里面一点就能断点调试的,虽然也可以通过 kgdb + qemu 实现在 IDE 中的断点调式,不过这样实在是太重了,而且也不能分析正在运行中的线上...... + +
    + + + + + +
    + +
    @@ -930,65 +994,6 @@

    Hello, World!

    -
    - - -
    -
    Kubernetes权限管理概述
    - -
    - - - - 对于一个多用户系统而言,权限管理始终是无法忽略的一环,系统规模越大,权限管理就越重要。 以 Git 系统为例,你有一个代码仓库,你是这个仓库的管理员,你们组的同学具有提交代码的权限,你们部门的同学具有只读权限,公司的其他人全部无法查看,这就是一个典型的权限管理场景。 通常在校验权限中分为两个流程,认证和鉴权。 即先判断你是谁:认证,然后再鉴权,判断你有没有这个资源的权限。 毫无疑问,复杂的Kubernetes也具...... - -
    - - - - - -
    - - +
    + + +
    +
    Kubernetes权限管理概述
    + +
    + + + + 对于一个多用户系统而言,权限管理始终是无法忽略的一环,系统规模越大,权限管理就越重要。 以 Git 系统为例,你有一个代码仓库,你是这个仓库的管理员,你们组的同学具有提交代码的权限,你们部门的同学具有只读权限,公司的其他人全部无法查看,这就是一个典型的权限管理场景。 通常在校验权限中分为两个流程,认证和鉴权。 即先判断你是谁:认证,然后再鉴权,判断你有没有这个资源的权限。 毫无疑问,复杂的Kubernetes也具...... + +
    + + + + + +
    + +
    @@ -907,68 +974,6 @@

    Hello, World!

    -
    - - -
    -
    完整网络请求包自底向上分析
    - -
    - - - - 我们都知道网络是分层的,国际标准化组织将网络划分了七层,定义于 ISO/IEC 7498-1,也就是我们所熟知的 ISO 七层模型。 自底向上分别是:物理层、数据链路层、网络层、传输层、会话层、表示层、应用层。 而我们所熟知的超文本传输协议(HTTP: HyperText Transfer Protocol)便位于这个模型中的第七层,HTTP 请求包发出的时候会一层一层往下叠加头部知道最终变成最底层的物理信号在网线上传输,那么最终的网络包到底是长什么样呢?我们今...... - -
    - - - - - -
    - - +
    + + +
    +
    完整网络请求包自底向上分析
    + +
    + + + + 我们都知道网络是分层的,国际标准化组织将网络划分了七层,定义于 ISO/IEC 7498-1,也就是我们所熟知的 ISO 七层模型。 自底向上分别是:物理层、数据链路层、网络层、传输层、会话层、表示层、应用层。 而我们所熟知的超文本传输协议(HTTP: HyperText Transfer Protocol)便位于这个模型中的第七层,HTTP 请求包发出的时候会一层一层往下叠加头部知道最终变成最底层的物理信号在网线上传输,那么最终的网络包到底是长什么样呢?我们今...... + +
    + + + + + +
    + +
    @@ -926,65 +996,6 @@

    Hello, World!

    -
    - - -
    -
    MySQL建表选项
    - -
    - - - - 这是一个很常见的 SQL 建表语句: CREATETABLE`people`(`id`intNOTNULLAUTO_INCREMENT,`name`varchar(40)DEFAULTNULL,PRIMARYKEY(`id`))ENGINE=InnoDBDEFAULTCHARSET=utf8SQL 建表语句结构如下: CREATE[TEMPORARY]TABLE[IFNOTEXISTS]tbl_name(create_definition,...)[table_options]我们对照结构可以看到我们的建表语句最后一部分是表选项,而在这里我们指定了两个选项:引擎和字符集,那么总共都有哪些选项可以设置呢?参照MySQL官方文档,我们一起来看看。 AUTO_INCREMENT MySQL 一张表中可以指定一...... - -
    - - - - - -
    - - +
    + + +
    +
    MySQL建表选项
    + +
    + + + + 这是一个很常见的 SQL 建表语句: CREATETABLE`people`(`id`intNOTNULLAUTO_INCREMENT,`name`varchar(40)DEFAULTNULL,PRIMARYKEY(`id`))ENGINE=InnoDBDEFAULTCHARSET=utf8SQL 建表语句结构如下: CREATE[TEMPORARY]TABLE[IFNOTEXISTS]tbl_name(create_definition,...)[table_options]我们对照结构可以看到我们的建表语句最后一部分是表选项,而在这里我们指定了两个选项:引擎和字符集,那么总共都有哪些选项可以设置呢?参照MySQL官方文档,我们一起来看看。 AUTO_INCREMENT MySQL 一张表中可以指定一...... + +
    + + + + + +
    + +
    @@ -904,45 +971,6 @@

    Hello, World!

    -
    - - -
    -
    Personals
    - -
    - - - - ...... - -
    - - - - - -
    - - +
    + + +
    +
    Personals
    + +
    + + + + ...... + +
    + + + + + +
    + + +
    + + +
    +
    + +
    + + + + ...... + +
    + + + + + +
    + +
    @@ -808,7 +894,7 @@

    Hello, World!

    diff --git "a/personal/go\345\206\205\345\255\230\346\250\241\345\236\213/index.html" "b/personal/go\345\206\205\345\255\230\346\250\241\345\236\213/index.html" index 2871068..d88efe8 100644 --- "a/personal/go\345\206\205\345\255\230\346\250\241\345\236\213/index.html" +++ "b/personal/go\345\206\205\345\255\230\346\250\241\345\236\213/index.html" @@ -448,7 +448,7 @@

    mheap

    diff --git a/personal/index.html b/personal/index.html index b7a6fbf..30280f5 100644 --- a/personal/index.html +++ b/personal/index.html @@ -431,7 +431,7 @@

    diff --git "a/personal/\345\215\225\346\234\272\345\256\271\345\231\250\347\275\221\347\273\234\346\250\241\345\236\213/index.html" "b/personal/\345\215\225\346\234\272\345\256\271\345\231\250\347\275\221\347\273\234\346\250\241\345\236\213/index.html" index 34fdf2f..0dc3e59 100644 --- "a/personal/\345\215\225\346\234\272\345\256\271\345\231\250\347\275\221\347\273\234\346\250\241\345\236\213/index.html" +++ "b/personal/\345\215\225\346\234\272\345\256\271\345\231\250\347\275\221\347\273\234\346\250\241\345\236\213/index.html" @@ -413,7 +413,7 @@

    diff --git a/process-thread-goroutine/index.html b/process-thread-goroutine/index.html index 4a59c9c..d97aab3 100644 --- a/process-thread-goroutine/index.html +++ b/process-thread-goroutine/index.html @@ -1169,7 +1169,7 @@

    总结

    diff --git a/redis-faq/index.html b/redis-faq/index.html index f9493a1..df0d999 100644 --- a/redis-faq/index.html +++ b/redis-faq/index.html @@ -562,7 +562,7 @@

    Redis 有哪些数据结构

    diff --git a/run-linux-container-manual/index.html b/run-linux-container-manual/index.html index 45dd803..e6c32d8 100644 --- a/run-linux-container-manual/index.html +++ b/run-linux-container-manual/index.html @@ -1145,7 +1145,7 @@

    资源限制

    diff --git a/run-openwrt-on-xiaomi4a100m/index.html b/run-openwrt-on-xiaomi4a100m/index.html index 4b17d40..8111720 100644 --- a/run-openwrt-on-xiaomi4a100m/index.html +++ b/run-openwrt-on-xiaomi4a100m/index.html @@ -788,7 +788,7 @@

    扩展OpenWRT

    diff --git a/series/index.html b/series/index.html index 0baf459..1a3279e 100644 --- a/series/index.html +++ b/series/index.html @@ -369,7 +369,7 @@

    diff --git a/shared-memory/index.html b/shared-memory/index.html index ca358cb..f59974f 100644 --- a/shared-memory/index.html +++ b/shared-memory/index.html @@ -1070,7 +1070,7 @@

    参考文档

    diff --git a/sitemap.xml b/sitemap.xml index e443bac..f707ce9 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -3,21 +3,41 @@ xmlns:xhtml="http://www.w3.org/1999/xhtml"> https://huweicai.com/ - 2023-10-07T13:58:00+08:00 + 2024-01-29T09:50:00+08:00 daily 0.5 - https://huweicai.com/elf/ - 2023-10-07T13:58:00+08:00 + https://huweicai.com/c-with-python-intercall/ + 2024-01-29T09:50:00+08:00 daily 0.5 - https://huweicai.com/tags/linux/ - 2023-10-07T13:58:00+08:00 + https://huweicai.com/tags/cpp/ + 2024-01-29T09:50:00+08:00 + daily + 0.5 + + https://huweicai.com/tags/programing/ + 2024-01-29T09:50:00+08:00 + daily + 0.5 + + https://huweicai.com/tags/python/ + 2024-01-29T09:50:00+08:00 daily 0.5 https://huweicai.com/tags/ + 2024-01-29T09:50:00+08:00 + daily + 0.5 + + https://huweicai.com/elf/ + 2023-10-07T13:58:00+08:00 + daily + 0.5 + + https://huweicai.com/tags/linux/ 2023-10-07T13:58:00+08:00 daily 0.5 @@ -419,6 +439,9 @@ https://huweicai.com/personal/%E5%8D%95%E6%9C%BA%E5%AE%B9%E5%99%A8%E7%BD%91%E7%BB%9C%E6%A8%A1%E5%9E%8B/ daily 0.5 + + https://huweicai.com/untitled/ + 0 https://huweicai.com/personal/ daily diff --git a/something-about-disk/index.html b/something-about-disk/index.html index cc190da..1b9f261 100644 --- a/something-about-disk/index.html +++ b/something-about-disk/index.html @@ -2125,7 +2125,7 @@

    node-exporter

    diff --git a/tags/cilium/index.html b/tags/cilium/index.html index aadccdc..2221c2d 100644 --- a/tags/cilium/index.html +++ b/tags/cilium/index.html @@ -436,7 +436,7 @@

    diff --git a/tags/cloudnative/index.html b/tags/cloudnative/index.html index b5fbe25..505b9c6 100644 --- a/tags/cloudnative/index.html +++ b/tags/cloudnative/index.html @@ -481,7 +481,7 @@

    diff --git a/tags/cpp/index.html b/tags/cpp/index.html new file mode 100644 index 0000000..6376079 --- /dev/null +++ b/tags/cpp/index.html @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cpp | Anonymous' Blog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    + + + + +
    +
      +
      +
      + + cpp + +
      + + + +
      +
      + One post +
      + +
      + + +
    + +
    + + +
    +
    + + + + +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/cpp/index.xml b/tags/cpp/index.xml new file mode 100644 index 0000000..9c4da18 --- /dev/null +++ b/tags/cpp/index.xml @@ -0,0 +1,20 @@ + + + + cpp on Anonymous' Blog + https://huweicai.com/tags/cpp/ + Recent content in cpp on Anonymous' Blog + Hugo -- gohugo.io + zn-Hans + Mon, 29 Jan 2024 09:50:00 +0800 + + C/C++ & Python 融合之道 + https://huweicai.com/c-with-python-intercall/ + Mon, 29 Jan 2024 09:50:00 +0800 + + https://huweicai.com/c-with-python-intercall/ + Python 解释器 正如软件系统通常分为定义与实现两部分,编程语言也是。 比如 C++ 标准是由国际标准化组织 ( ISO ) 下属的 ISO/IEC JTC1/SC22/WG21特别工作组制定的,最新标准为 C++ 20 (ISO/IEC 14882:2020),这是定义;而其实现则有 GNU 的 gcc、微软的 visual c++、Apple 发起的 clang 等等,任何人都可以按照定义去实现自己的实现。 Java 规范则是由 Oracle 主导的 JCP 所制定,有 Oracle Java SE、OpenJDK、Corretto、AdoptOpen 等大量 + + + + diff --git a/tags/cpu/index.html b/tags/cpu/index.html index 27bd73e..1930bf4 100644 --- a/tags/cpu/index.html +++ b/tags/cpu/index.html @@ -428,7 +428,7 @@

    diff --git a/tags/docker/index.html b/tags/docker/index.html index 23ea1a6..3c8e100 100644 --- a/tags/docker/index.html +++ b/tags/docker/index.html @@ -449,7 +449,7 @@

    diff --git a/tags/ebpf/index.html b/tags/ebpf/index.html index 142af12..aa97f56 100644 --- a/tags/ebpf/index.html +++ b/tags/ebpf/index.html @@ -482,7 +482,7 @@

    diff --git a/tags/en/index.html b/tags/en/index.html index 20ef546..76781cd 100644 --- a/tags/en/index.html +++ b/tags/en/index.html @@ -467,7 +467,7 @@

    diff --git a/tags/ethernet/index.html b/tags/ethernet/index.html index 4f574b1..73fcad5 100644 --- a/tags/ethernet/index.html +++ b/tags/ethernet/index.html @@ -428,7 +428,7 @@

    diff --git a/tags/git/index.html b/tags/git/index.html index 823c08b..6629673 100644 --- a/tags/git/index.html +++ b/tags/git/index.html @@ -422,7 +422,7 @@

    diff --git a/tags/go/index.html b/tags/go/index.html index 6ea8da5..1615137 100644 --- a/tags/go/index.html +++ b/tags/go/index.html @@ -547,7 +547,7 @@

    diff --git a/tags/harbor/index.html b/tags/harbor/index.html index d48b885..e314b0e 100644 --- a/tags/harbor/index.html +++ b/tags/harbor/index.html @@ -428,7 +428,7 @@

    diff --git a/tags/http/index.html b/tags/http/index.html index 50324af..4a01db9 100644 --- a/tags/http/index.html +++ b/tags/http/index.html @@ -428,7 +428,7 @@

    diff --git a/tags/index.html b/tags/index.html index 962e1c4..8ac83a5 100644 --- a/tags/index.html +++ b/tags/index.html @@ -457,6 +457,15 @@

    +
  • + + cpp + + +
  • + + +
  • cpu @@ -547,6 +556,24 @@

    +
  • + + programing + + +
  • + + + +
  • + + python + + +
  • + + +
  • redis @@ -738,7 +765,7 @@

    diff --git a/tags/index.xml b/tags/index.xml index 6fb0720..0c89dbf 100644 --- a/tags/index.xml +++ b/tags/index.xml @@ -6,7 +6,34 @@ Recent content in Tags on Anonymous' Blog Hugo -- gohugo.io zn-Hans - Sat, 07 Oct 2023 13:58:00 +0800 + Mon, 29 Jan 2024 09:50:00 +0800 + + cpp + https://huweicai.com/tags/cpp/ + Mon, 29 Jan 2024 09:50:00 +0800 + + https://huweicai.com/tags/cpp/ + + + + + programing + https://huweicai.com/tags/programing/ + Mon, 29 Jan 2024 09:50:00 +0800 + + https://huweicai.com/tags/programing/ + + + + + python + https://huweicai.com/tags/python/ + Mon, 29 Jan 2024 09:50:00 +0800 + + https://huweicai.com/tags/python/ + + + linux https://huweicai.com/tags/linux/ diff --git a/tags/innodb/index.html b/tags/innodb/index.html index ce343d4..1244da7 100644 --- a/tags/innodb/index.html +++ b/tags/innodb/index.html @@ -426,7 +426,7 @@

    diff --git a/tags/ip/index.html b/tags/ip/index.html index 5bc332f..a6ddd69 100644 --- a/tags/ip/index.html +++ b/tags/ip/index.html @@ -443,7 +443,7 @@

    diff --git a/tags/java/index.html b/tags/java/index.html index 3e3c2dc..39aa5f7 100644 --- a/tags/java/index.html +++ b/tags/java/index.html @@ -439,7 +439,7 @@

    diff --git a/tags/jvm/index.html b/tags/jvm/index.html index c78525e..83113e8 100644 --- a/tags/jvm/index.html +++ b/tags/jvm/index.html @@ -422,7 +422,7 @@

    diff --git a/tags/kernel/index.html b/tags/kernel/index.html index 7f801df..26fc95b 100644 --- a/tags/kernel/index.html +++ b/tags/kernel/index.html @@ -482,7 +482,7 @@

    diff --git a/tags/kubernetes/index.html b/tags/kubernetes/index.html index 6ae81b8..45177c6 100644 --- a/tags/kubernetes/index.html +++ b/tags/kubernetes/index.html @@ -472,7 +472,7 @@

    diff --git a/tags/linux/index.html b/tags/linux/index.html index a1935de..bf50a96 100644 --- a/tags/linux/index.html +++ b/tags/linux/index.html @@ -621,7 +621,7 @@

    diff --git a/tags/mysql/index.html b/tags/mysql/index.html index 19a71e4..258bd8c 100644 --- a/tags/mysql/index.html +++ b/tags/mysql/index.html @@ -426,7 +426,7 @@

    diff --git a/tags/pprof/index.html b/tags/pprof/index.html index cddd53b..fd51128 100644 --- a/tags/pprof/index.html +++ b/tags/pprof/index.html @@ -465,7 +465,7 @@

    diff --git a/tags/programing/index.html b/tags/programing/index.html new file mode 100644 index 0000000..ef993a2 --- /dev/null +++ b/tags/programing/index.html @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + programing | Anonymous' Blog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    + + + + +
    +
      +
      +
      + + programing + +
      + + + +
      +
      + One post +
      + +
      + + +
    + +
    + + +
    +
    + + + + +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/programing/index.xml b/tags/programing/index.xml new file mode 100644 index 0000000..9c25c6e --- /dev/null +++ b/tags/programing/index.xml @@ -0,0 +1,20 @@ + + + + programing on Anonymous' Blog + https://huweicai.com/tags/programing/ + Recent content in programing on Anonymous' Blog + Hugo -- gohugo.io + zn-Hans + Mon, 29 Jan 2024 09:50:00 +0800 + + C/C++ & Python 融合之道 + https://huweicai.com/c-with-python-intercall/ + Mon, 29 Jan 2024 09:50:00 +0800 + + https://huweicai.com/c-with-python-intercall/ + Python 解释器 正如软件系统通常分为定义与实现两部分,编程语言也是。 比如 C++ 标准是由国际标准化组织 ( ISO ) 下属的 ISO/IEC JTC1/SC22/WG21特别工作组制定的,最新标准为 C++ 20 (ISO/IEC 14882:2020),这是定义;而其实现则有 GNU 的 gcc、微软的 visual c++、Apple 发起的 clang 等等,任何人都可以按照定义去实现自己的实现。 Java 规范则是由 Oracle 主导的 JCP 所制定,有 Oracle Java SE、OpenJDK、Corretto、AdoptOpen 等大量 + + + + diff --git a/tags/python/index.html b/tags/python/index.html new file mode 100644 index 0000000..565896a --- /dev/null +++ b/tags/python/index.html @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + python | Anonymous' Blog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    + + + + +
    +
      +
      +
      + + python + +
      + + + +
      +
      + One post +
      + +
      + + +
    + +
    + + +
    +
    + + + + +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/python/index.xml b/tags/python/index.xml new file mode 100644 index 0000000..eb0f3af --- /dev/null +++ b/tags/python/index.xml @@ -0,0 +1,20 @@ + + + + python on Anonymous' Blog + https://huweicai.com/tags/python/ + Recent content in python on Anonymous' Blog + Hugo -- gohugo.io + zn-Hans + Mon, 29 Jan 2024 09:50:00 +0800 + + C/C++ & Python 融合之道 + https://huweicai.com/c-with-python-intercall/ + Mon, 29 Jan 2024 09:50:00 +0800 + + https://huweicai.com/c-with-python-intercall/ + Python 解释器 正如软件系统通常分为定义与实现两部分,编程语言也是。 比如 C++ 标准是由国际标准化组织 ( ISO ) 下属的 ISO/IEC JTC1/SC22/WG21特别工作组制定的,最新标准为 C++ 20 (ISO/IEC 14882:2020),这是定义;而其实现则有 GNU 的 gcc、微软的 visual c++、Apple 发起的 clang 等等,任何人都可以按照定义去实现自己的实现。 Java 规范则是由 Oracle 主导的 JCP 所制定,有 Oracle Java SE、OpenJDK、Corretto、AdoptOpen 等大量 + + + + diff --git a/tags/redis/index.html b/tags/redis/index.html index fa6da71..202ff36 100644 --- a/tags/redis/index.html +++ b/tags/redis/index.html @@ -422,7 +422,7 @@

    diff --git a/tags/shell/index.html b/tags/shell/index.html index 61f1767..fef005d 100644 --- a/tags/shell/index.html +++ b/tags/shell/index.html @@ -422,7 +422,7 @@

    diff --git a/tags/tcp/index.html b/tags/tcp/index.html index 7898712..8e28502 100644 --- a/tags/tcp/index.html +++ b/tags/tcp/index.html @@ -428,7 +428,7 @@

    diff --git a/tags/yuv/index.html b/tags/yuv/index.html index c41fc47..1a382e9 100644 --- a/tags/yuv/index.html +++ b/tags/yuv/index.html @@ -424,7 +424,7 @@

    diff --git "a/tags/\345\212\236\345\205\254\346\225\210\347\216\207/index.html" "b/tags/\345\212\236\345\205\254\346\225\210\347\216\207/index.html" index d5a8a07..5061b00 100644 --- "a/tags/\345\212\236\345\205\254\346\225\210\347\216\207/index.html" +++ "b/tags/\345\212\236\345\205\254\346\225\210\347\216\207/index.html" @@ -420,7 +420,7 @@

    diff --git "a/tags/\345\221\275\344\273\244\350\241\214/index.html" "b/tags/\345\221\275\344\273\244\350\241\214/index.html" index c0a786d..25361cf 100644 --- "a/tags/\345\221\275\344\273\244\350\241\214/index.html" +++ "b/tags/\345\221\275\344\273\244\350\241\214/index.html" @@ -447,7 +447,7 @@

    diff --git "a/tags/\345\233\276\345\203\217/index.html" "b/tags/\345\233\276\345\203\217/index.html" index d4b832d..6cbfc1b 100644 --- "a/tags/\345\233\276\345\203\217/index.html" +++ "b/tags/\345\233\276\345\203\217/index.html" @@ -424,7 +424,7 @@

    diff --git "a/tags/\345\255\230\345\202\250/index.html" "b/tags/\345\255\230\345\202\250/index.html" index 9526687..2ca5f3a 100644 --- "a/tags/\345\255\230\345\202\250/index.html" +++ "b/tags/\345\255\230\345\202\250/index.html" @@ -496,7 +496,7 @@

    diff --git "a/tags/\345\256\271\345\231\250/index.html" "b/tags/\345\256\271\345\231\250/index.html" index 21fa008..7597c4c 100644 --- "a/tags/\345\256\271\345\231\250/index.html" +++ "b/tags/\345\256\271\345\231\250/index.html" @@ -517,7 +517,7 @@

    diff --git "a/tags/\345\271\266\345\217\221/index.html" "b/tags/\345\271\266\345\217\221/index.html" index 170d916..65fc075 100644 --- "a/tags/\345\271\266\345\217\221/index.html" +++ "b/tags/\345\271\266\345\217\221/index.html" @@ -424,7 +424,7 @@

    diff --git "a/tags/\346\223\215\344\275\234\347\263\273\347\273\237/index.html" "b/tags/\346\223\215\344\275\234\347\263\273\347\273\237/index.html" index 8169287..a55c4ab 100644 --- "a/tags/\346\223\215\344\275\234\347\263\273\347\273\237/index.html" +++ "b/tags/\346\223\215\344\275\234\347\263\273\347\273\237/index.html" @@ -505,7 +505,7 @@

    diff --git "a/tags/\346\225\260\346\215\256\345\272\223/index.html" "b/tags/\346\225\260\346\215\256\345\272\223/index.html" index f976be7..e69547f 100644 --- "a/tags/\346\225\260\346\215\256\345\272\223/index.html" +++ "b/tags/\346\225\260\346\215\256\345\272\223/index.html" @@ -426,7 +426,7 @@

    diff --git "a/tags/\346\226\207\344\273\266\347\263\273\347\273\237/index.html" "b/tags/\346\226\207\344\273\266\347\263\273\347\273\237/index.html" index c44cfb6..eee1cdd 100644 --- "a/tags/\346\226\207\344\273\266\347\263\273\347\273\237/index.html" +++ "b/tags/\346\226\207\344\273\266\347\263\273\347\273\237/index.html" @@ -422,7 +422,7 @@

    diff --git "a/tags/\346\227\245\345\277\227/index.html" "b/tags/\346\227\245\345\277\227/index.html" index 99f4cd0..cfe98ac 100644 --- "a/tags/\346\227\245\345\277\227/index.html" +++ "b/tags/\346\227\245\345\277\227/index.html" @@ -424,7 +424,7 @@

    diff --git "a/tags/\346\235\203\351\231\220\347\256\241\347\220\206/index.html" "b/tags/\346\235\203\351\231\220\347\256\241\347\220\206/index.html" index a6a8c5a..d6a6b08 100644 --- "a/tags/\346\235\203\351\231\220\347\256\241\347\220\206/index.html" +++ "b/tags/\346\235\203\351\231\220\347\256\241\347\220\206/index.html" @@ -426,7 +426,7 @@

    diff --git "a/tags/\347\241\254\344\273\266/index.html" "b/tags/\347\241\254\344\273\266/index.html" index db8a9ed..9afdbc7 100644 --- "a/tags/\347\241\254\344\273\266/index.html" +++ "b/tags/\347\241\254\344\273\266/index.html" @@ -424,7 +424,7 @@

    diff --git "a/tags/\347\243\201\347\233\230/index.html" "b/tags/\347\243\201\347\233\230/index.html" index 4fadf80..98e9002 100644 --- "a/tags/\347\243\201\347\233\230/index.html" +++ "b/tags/\347\243\201\347\233\230/index.html" @@ -424,7 +424,7 @@

    diff --git "a/tags/\347\274\226\347\250\213\350\257\255\350\250\200/index.html" "b/tags/\347\274\226\347\250\213\350\257\255\350\250\200/index.html" index 51b8925..0764154 100644 --- "a/tags/\347\274\226\347\250\213\350\257\255\350\250\200/index.html" +++ "b/tags/\347\274\226\347\250\213\350\257\255\350\250\200/index.html" @@ -549,7 +549,7 @@

    diff --git "a/tags/\350\256\241\347\256\227\346\234\272\347\275\221\347\273\234/index.html" "b/tags/\350\256\241\347\256\227\346\234\272\347\275\221\347\273\234/index.html" index 2274505..88d9874 100644 --- "a/tags/\350\256\241\347\256\227\346\234\272\347\275\221\347\273\234/index.html" +++ "b/tags/\350\256\241\347\256\227\346\234\272\347\275\221\347\273\234/index.html" @@ -500,7 +500,7 @@

    diff --git "a/tags/\351\225\234\345\203\217/index.html" "b/tags/\351\225\234\345\203\217/index.html" index ca9ce88..615e760 100644 --- "a/tags/\351\225\234\345\203\217/index.html" +++ "b/tags/\351\225\234\345\203\217/index.html" @@ -428,7 +428,7 @@

    diff --git "a/tags/\351\237\263\350\247\206\351\242\221/index.html" "b/tags/\351\237\263\350\247\206\351\242\221/index.html" index 22f14ea..65701bc 100644 --- "a/tags/\351\237\263\350\247\206\351\242\221/index.html" +++ "b/tags/\351\237\263\350\247\206\351\242\221/index.html" @@ -424,7 +424,7 @@

    diff --git a/troubleshotting-goroutine-leeking/index.html b/troubleshotting-goroutine-leeking/index.html index acc3c8c..f91a1a4 100644 --- a/troubleshotting-goroutine-leeking/index.html +++ b/troubleshotting-goroutine-leeking/index.html @@ -620,7 +620,7 @@

    总结

    diff --git a/untitled/index.html b/untitled/index.html new file mode 100644 index 0000000..1af1bd2 --- /dev/null +++ b/untitled/index.html @@ -0,0 +1,467 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | Anonymous' Blog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + +
    + + + +
    + +
    + + +
    + + + + +
    + + +
    + +
    + + +
    +
    + +
    + +
    + + + +
    +
    + +
    + + +
    + + + +
    + + +
    + + + + +
    + + + +
    + + + + + + +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/upgrade-centos-kernel-version/index.html b/upgrade-centos-kernel-version/index.html index a4c0312..ec9f2c0 100644 --- a/upgrade-centos-kernel-version/index.html +++ b/upgrade-centos-kernel-version/index.html @@ -750,7 +750,7 @@

    重启

    diff --git a/weave-scope/index.html b/weave-scope/index.html index f987d0a..45f19b8 100644 --- a/weave-scope/index.html +++ b/weave-scope/index.html @@ -789,7 +789,7 @@

    Agent

    diff --git a/web-markdown-to-pdf-utils/index.html b/web-markdown-to-pdf-utils/index.html index 3caf860..bbe456f 100644 --- a/web-markdown-to-pdf-utils/index.html +++ b/web-markdown-to-pdf-utils/index.html @@ -652,7 +652,7 @@

    总结

    diff --git a/who-network-capture-analysis/index.html b/who-network-capture-analysis/index.html index b5c3281..4c7ec68 100644 --- a/who-network-capture-analysis/index.html +++ b/who-network-capture-analysis/index.html @@ -905,7 +905,7 @@

    TCP