自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Destiny awaits us all.The road is endless.

  • 博客(86)
  • 问答 (1)
  • 收藏
  • 关注

原创 facebook/zstd 1.54及以上版本编译问题

不能使用 gcc4.4.7编译, 运行时会在 MEM_write64 处 crash。编译时使用的时 ${CC} ,注意修改。

2024-08-16 10:35:30 95

原创 go-sql-driver/mysql 查询 latin1 中文字符集

table是 latin1 编码, 返回后查询结果后,即使将 name 转为 utf-8,日志输出中文仍然乱码。连接数据库时指定 charset=latin1 ,按照实际存储的字符集转换。

2024-07-29 19:03:34 223

原创 std::map<int, std::string, std::greater<int>> myMap; lower_bound 理解

lower_bound : 返回第一个不大于的元素。若传入0, 输出 not found ,因为没有不大于0的值。

2023-12-27 18:29:39 462

原创 lua_next

循环内 pop 后,将value弹出, 下次调用 lua_next时,将 key 弹出,再压入一对 kv。lua_next 先弹出一个值, 再放一对pair 到栈上, 参数 index 是表的位置。因为会先弹出一个值,需要先pushnil ,用于弹出。调用后: -1:value -2:key。

2023-11-29 12:07:21 688

原创 lua loadfile package.path 无效

loadfile需要传入 以执行程序exe的相对路径 或者 绝对路径, require 才使用 package.path。

2023-11-29 11:56:02 394

原创 c++ 遍历 lua 表 类型错误 导致 PANIC: unprotected error in call to Lua API (invalid key to ‘next‘)

PANIC: unprotected error in call to Lua API (invalid key to ‘next‘)

2023-11-29 11:54:20 558

原创 Makefile 变量值

函数会在Makefile加载时执行一次,而不是在每次执行规则时执行。总结来说,当您需要在Makefile加载时执行shell命令并获取输出结果,或者在规则中需要使用shell命令的输出结果时,可以使用。请注意,在Makefile中编写条件语句时,需要使用Tab键进行缩进,并确保条件和命令之间的空格正确。使用这种方式,可以在规则中使用条件语句来执行shell if命令,并根据条件的结果执行相应的命令。如果想在每次执行规则时都执行条件语句和命令,可以将它们直接写在规则中,而不是放在变量中。

2023-10-23 16:30:41 242

原创 GetCachedSize() 需要 ByteSize()后有效

若 进行序列化 SerializeToArray 或 SerializeToString 等调用后, GetCachedSize() 不为 0, 因为这些序列化函数中调用了 ByteSize(), _cached_size_ 被赋值。protobufer 中, 假设 repeated 字段 msg。GetCachedSize() == 0, 仍为0;

2023-10-08 16:24:17 83

原创 c++ chrono 获取当前时间

【代码】c++ chrono 获取当前时间。

2023-07-06 17:57:24 1449

原创 concept logger

【代码】concept logger。

2023-07-05 17:54:26 66

原创 C++ Format

C++ Format

2023-07-05 11:50:16 239

原创 Coroutines

Coroutines

2023-06-30 18:59:25 174

原创 C++ 模板 using, Concept

c++ 模板 using

2023-06-30 14:49:11 218

原创 Concept

c++ concept

2023-06-29 19:12:39 283

原创 goland github提交失败

goland github提交失败

2022-12-11 17:09:31 220 1

原创 vue.js axios 数据不刷新

vue.js axios 数据不刷新

2022-12-05 11:41:32 666

原创 go gin 静态资源 设置

go gin 静态资源

2022-12-02 18:17:49 648

原创 golang 修改 http request body

golang 修改 http request body

2022-11-25 18:42:17 1534

原创 rhel6.8 安装 yum ,2022

rhel6.8 yum源

2022-10-16 12:10:14 541

原创 Linux高性能网络编程(二)

Linux高性能网络编程(二) 7-17章

2022-07-21 23:02:53 104

原创 Linux高性能网络编程(一)

Linux高性能网络编程 1-6章总结

2022-07-10 17:25:35 122

原创 GCC编译优化应用预编译头(二)

工具:https://github.com/wangxiaobai-dd/GccPrecompiledHeader对原先的工具进行了更新可以将包含预编译头文件(如inc.h)的 cpp 文件替换还原若 inc.h 包含 a.h、b.h,使用工具后 目录下 *.cpp 中 inc.h 都被替换为 a.h b.h[unified] 可选参数,指包含多个 cpp 文件的 unified cpp进行递归检查头文件包含, 若 a.cpp 包含 a.h ,而 a.h 中还包含其他头文件,并且在 FindDir

2022-06-12 19:42:57 247

原创 GCC编译优化应用预编译头

服务器编译优化记录 对项目编译优化过程中一些思路和脚本工具实现。对内存受限的编译环境有一些帮助。环境 32G内存,16核,Makefile,gcc9.2效果 选择了代码比较多的三个目录进行预编译头优化,进行下述操作。另外: 将小的编译单元合并成大的编译单元也是有效的,如 com.cpp 包含 a.cpp b.cpp , 在com.cpp 中首行也需要 #include "inc.h" ),编译时间从 24min30s左右 降到 14min 左右 ,节省 40%以上编译时间方法 .

2022-03-19 17:32:52 5728

原创 误删libcrypto.so.1.0.0

sudo locate libcrypto.so.1.0.0sudo cp xxxx/libcrypto.so.1.0.0 /usr/lib/开启ssh服务:sudo /etc/init.d/ssh start

2022-03-16 21:44:50 1127

原创 C++模版依赖型基类中的 this 作用

依赖型基类基类依赖模版参数template <typename T>class BBB{ public: void one(int ){}};template <typename T>class DDD : public BBB<T>{ public: void f() { one(1); // 依赖型名称实例化时查找 }};编译时会有警告:/

2022-03-05 19:12:17 511

原创 & 等价于 bitand

#include <iostream>#include <string>using namespace std;class A{ public: operator int bitand(){ return i; } int i;};int main(){ A a; std::cin >> a; std::cout << a; return 0;}.

2022-03-04 16:05:08 233

原创 使用mold链接器

使用超级快的链接器: https://github.com/rui314/mold更有效的算法和数据结构, 高度并行安装git clone https://github.com/rui314/mold.gitcd moldgit checkout v1.0.1make -j$(nproc) CXX=clang++或者GCC,需要支持c++20的编译器sudo make installMakefile:PREFIX ?= /usr/localBINDIR ?= $(PREFIX)/bi

2022-01-18 14:30:42 1101

原创 每日自动调用Tscancode, 服务器代码检查,Web 查看结果

每日自动调用Tscancode, Web 查看结果1 Runrun Source/BackEnd/bin/EveryDayScan using rootorrun Source/BackEnd/src/build.shWe can get results by visiting http://yourip:port2 See Source/BackEnd/bin/config.ini[Project]Path: Scan path of projectDirs: Project’s dir

2021-12-04 17:50:22 824

原创 C++ 同时 override == 和 访问运算符 易错点

class A{ public: std::string mStr; bool operator == (const char* s) const { return 0 == strcmp(mStr.c_str(), s); } operator const char* () const { return mStr.c_str(); }.

2021-09-14 11:48:48 121

原创 LuaIntf - addProperty

class Test{ public: Test(){ cout << "construct test" << endl; } int a = 1; void set(int n){ a += n; }; int get(){ return a; } void func(){ cout << "func" << endl; }};void registerClass(LuaIntf::LuaCo.

2021-08-27 12:14:31 177

原创 lua 基础

表 tablet = {}t[i]t.i -- 当索引为字符串类型时的一种简化写法gettable_event(t,i) -- 采用索引访问本质上是一个类似这样的函数调用通过table来解决模块(module)、包(package)和对象(Object)的移除引用mytable = nil-- lua 垃圾回收会释放内存函数function test(xx, xx)end可以将函数作为参数传递给函数TABLE:proper...

2021-08-27 11:34:39 195

原创 libevent 接口函数 event, bufferevent

event_base : 跟踪事件event_new() : 监听描述符 fdevent_add() :添加事件监听event_base_dispatch() : 循环 分发事件event_enable_debug_mode () : 开启debugevent_assign : 自定义结构 控制描述符编译:Setting up the Libevent libraryevent_set_log_callback : 重写 logevent_set_mem_functio..

2021-07-08 11:42:23 368

原创 epoll 服务器实现 reactor模式

epoll 服务器基于reactor 模式,主线程acceptor监听连接非阻塞多线程,每个线程可携带多个监听事件语言:c++log:使用spdlog 增加了protobuf 自描述消息机制客户端测试:telnet 127.0.0.1 8800或者 Client/BowClient...

2021-06-10 14:29:53 134

原创 mysqld got signal 11

pkill mysqld后,重启mysql服务每次进行mysql操作, mysql crash,内存、硬盘空间足够,binlog 看不出异常重装解决问题 ,可能链接的库异常?mysql 4.1 ,gcc 9.2 版本过高,会有编译错误 , 需要使用低版本的gcc编译...

2021-05-06 16:51:01 309

原创 vim json文件格式化

.vimrc 中添加 快捷键映射map <F4> <Esc>:%!python -m json.tool<CR> :w<CR>json文件有中文时 异常 : 'ascii' codec can't encode charactersfind / -name tool.py/usr/lib64/python2.7/json/tool.py修改这个文件:vim/usr/lib64/python2.7/json/tool.py...

2021-04-20 11:00:24 422

原创 const auto 与 auto 返回值

class A{};const auto getConfig(){ return new A(); } 返回值类型: const A* constauto getConfig() { return new A() ; }返回值类型:const A*

2021-01-19 18:05:13 336

原创 C++ 提高编译速度(三) 友好的编译信息输出

C++ 提高编译速度(三) 友好的编译信息输出

2021-01-16 14:39:58 352

原创 C++ 提高编译速度 (二) 解决方案实现 | 预编译头 多核编译

C++ 提高编译速度 (二) 解决方案实现 | 预编译头 多核编译

2021-01-16 13:04:20 1383

原创 cgo c++

testcgo.go:package main// #include "hello.h"import "C"func main() { C.SayHello(C.CString("Hello, World\n"))}~// #include "hello.h" 需要放在import上面hello.h:// hello.hvoid SayHello(const char* s);hello.cpp:// hello.cpp#include &l..

2021-01-10 10:50:41 251

原创 gRPC HelloWorld GreeterClient

GreeterClientGreeterClient greeter(grpc::CreateChannel(target_str, grpc::InsecureChannelCredentials()));target_str :目标 ip 和 端口 target_str = "localhost:50051";grpc::InsecureChannelCredentials: GrpcLibraryCodegen 需要 grpc 服务的都需要继承这个类,构造函数里对...

2020-12-27 21:57:48 726

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除