Hello World
该文件是 hexo 中默认生成第一篇文章,在此我进行了升级,用该文章记录一些 hexo 使用的笔记。 Quick StartCreate a new post1$ hexo new "My New Post" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generate More info: Generating Deploy to remote sites1$hexo deploy More info: Deployment 关于搜索https://butterfly.js.org/posts/ceeb73f/#%E6%90%9C%E7%B4%A2 我用的hexo主题是 buterfly 该主题支持几种搜索,这里我选用了最简单的 local_search 具体的配置是: 安装 hexo-generator-searchdb 配置主题的 search use 为: `local_search’...
C++ 中的构造函数
构造函数C++ 构造函数就是创建类对象时自动执行的函数,编译器会默认提供3给默认构造函数,一个构造函数,一个拷贝构造函数,一个移动构造函数。 例子: 1234class A{}; 类 A 的3给默认构造函数为: 123A(); // 构造函数A(const A&); // 拷贝构造函数A(A&&) // 移动构造函数 构造函数初始化列表构造函数初始化列表的语法: 1234567class A{private: int m_a, m_b, m_c;public: A(int _a, int _b, int _c);}; 构造函数定义: 123456789A::A(int _a, int _b, int _c) : m_a(_a), m_b(_b), m_c(_c){ std::cout << "a: " << m_a << std::endl; std::cout << "b: " << m_b...
Rust 中的宏分类
Rust中的宏可以按照不同的标准进行分类,以下是一些常见的分类方式及具体介绍: 按功能用途分类 声明宏:用于定义新的语法结构或对已有语法进行扩展,通过macro_rules!关键字定义。例如,vec!宏用于方便地创建Vec类型的数组,println!宏用于格式化输出到控制台。 过程宏:在编译时对代码进行操作和转换,比声明宏更强大,可以访问更多的编译器内部信息。包括以下三种类型: 自定义派生宏:允许为结构体和枚举自动实现特定的 trait。比如,为一个结构体派生Debug trait时,使用#[derive(Debug)],编译器会在编译阶段自动为该结构体生成Debug...
Tauri 从前端访问后端 Rust
Tauri 提供了从前端访问后端 rust 函数的功能,这篇文章就来了解下如何使用该功能。 首先看下 rust 后端函数如何定义,以下是 tauri 初始项目中的代码片段: 123456789101112131415// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/#[tauri::command]fn greet(name: &str) -> String { format!("Hello, {}! You've been greeted from Rust!", name)}#[cfg_attr(mobile, tauri::mobile_entry_point)]pub fn run() { tauri::Builder::default() .plugin(tauri_plugin_opener::init()) ...
AT32 单片机简单按键程序
今天写了一下简单的按键程序,单片机是 AT32F437ZGT7 ,按键消抖用的是阻塞延时函数。下面列出代码: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152/* add user code begin Header *//**...
clang-format 格式化工具
在格式化 c/c++ 代码时会用到 clang-format 这个工具,在此做个简短的记录。 clang-format 下载地址:https://llvm.org/builds/ .clang-format123456BasedOnStyle: LLVM # LLVM, GoogleIndentWidth: 4ColumnLimit: 81BreakBeforeBraces: LinuxAllowShortLoopsOnASingleLine: trueAllowShortBlocksOnASingleLine: true BreakBeforeBraces: Linux 设置为 Linux 则函数的大括号单独一行,if for 等的开始大括号不会单独一行。 IndentWidth: 4 缩进设为4个空格 BasedOnStyle 设置基础样式,选择LLVM比较好
Tauri 在 Linux 下运行出错解决办法
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364╭─zsf@xiaotupo ~/learn/learn-projects/tauri-learn/learn-01 ╰─➤ pnpm tauri dev 101 ↵> learn-01@0.1.0 tauri /home/zsf/learn/learn-projects/tauri-learn/learn-01> tauri "dev" Running BeforeDevCommand (`pnpm dev`)> learn-01@0.1.0 dev...
Linux 内核链表学习笔记
在此记录下Linux 下的链表笔记,首先看一下链表的结构体定义: 123struct list_head { struct list_head *next, *prev;}; list_head 结构体里面只有两个指向自己的指针,接下来看看怎么创建一个头指针。 创建头节点Linux 内核提供了 LIST_HEAD() 宏,宏可以方便的创建一个 next 和 prev 都指向自己的头节点。 1234#define LIST_HEAD_INIT(name) { &(name), &(name) }#define LIST_HEAD(name) \ struct list_head name = LIST_HEAD_INIT(name) 例子: 1LIST_HEAD(my_list); 上面宏展开后的样子: 1struct list_head my_list = { &(my_list), &(my_list) }; 将 list_head...
不同数据库中的 SQL 自增字段类型
有时我们会用到不同的数据库,每种数据库中的 自增字段 SQL 可能不同,在此记录一下不同数据库中的自增字段。 MySQL 中的自增字段MySQL 中的自增字段可以用 AUTO_INCREMENT 关键字,例子: 123456CREATE table student( student_id INT NOT NULL AUTO_INCREMENT, name VARCHAR(50), email VARCHAR(100), PRIMARY KEY (student_id)); PostgreSQL 中的自增字段在 PostgreSQL 中可以使用 SERIAL 或 BIGSERIAL 类型来定义自增字段。例子: 12345CREATE TABLE student( id SERIAL PRIMARY KEY, name VARCHAR(50), email VARCHAR(100)); SQLite 中的自增字段SQLite 中可以用 AUTOINCREMENT 来创建自增字段: 12345CREATE TABLE student( ...
Linux find 命令笔记
一. 基本查找查找指定目录中的所有文件和目录12find /home/usersudo find /usr/share 查找指定目录中的指定文件查找 /etc 目录下的 hosts 文件。 1find /etc -name "hosts" 12345╭─zsf@xiaotupo ~/hexo_blog ‹main*› ╰─➤ sudo find /etc -name "hosts" 1 ↵[sudo] zsf 的密码:/etc/hosts/etc/avahi/hosts 按文件类型查找 查找指定目录中的所有目录:find /var -type d 查找指定目录中的所有普通文件:find /tmp -type f 按文件大小查找 查找指定目录下大于某个大小的文件 语法: 1find...