自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 Linux中源码安装protocbuf 和protobuf-c

首先安装protocbuf protocbuf下载路径:https://github.com/protocolbuffers/protobuf/releases 按照下面步骤安装: #解压 tar xzf protobuf-all-3.11.4.tar.gz #编译并安装 cd protobuf-all-3.11.4 ./configure --prefix=/usr/local/protobu...

2020-03-19 11:21:52 468

原创 C/C++中typedef的使用(类似C++前向声明)

平时开发过程中使用typedef时,该类型(struct class)的变量都已经定义了,所以再使用时无论初始化对象还是指针 引用,都可以正常使用。 但是当使用typedef定义一个只有声明没有定义的一个类型的别名时,我们可以定义这个类型的指针和引用,但是不能定义这个类型的变量,因为定义变量时,会去分配内存,而此时该类型只有声明没有定义,编译时会报错。 这里的使用方式和c++中的前向声明类似 #i...

2020-03-06 11:55:20 415

原创 共享内存中不能存储---类中有申请空间的类对象

背景 有一个需求,作为客户端需要从redis集群中获取数据。出于性能的考虑,再客户端初始化阶段,初始化了一个redis连接,后续在连接redis时,可以直接使用该连接,不用再去重新连接redis了。(这里指的连接其实就是初始化一个类对象,然后根据ip+prot连接redis集群) 但是这样的操作有一个问题就是,当有多个客户端连接redis集群时,由于连接数过多,达到redis节点连接数的限制(默认...

2019-12-31 10:16:12 306

原创 c语言中atoi函数的使用

函数功能 扫描一个字符串的字符,直到第一个不为数字的字符为止,扫描到的字符串转换为数字。若字符串首字母不是数字字符,则返回0 测试程序 #include <iostream> #include <stdlib.h> using namespace std; int main() { cout<<atoi("123456")<<endl; ...

2019-12-23 11:46:36 796

原创 linux中通过信号实现定时操作

#include <stdio.h> #include <string.h> #include <unistd.h> #include <signal.h> void test() { printf("this is a test\n"); } void func(int a) { test(); alarm(5);//5s后...

2019-12-19 15:49:56 289

原创 strptime和strftime互转时间

strptime :将格式化的字符串解析存储到struct tm结构中去 strftime :将struct tm结构格式化为指定字符串 代码示例 #include <iostream> #include <time.h> #include <string.h> using namespace std; int main() { const char *...

2019-12-19 11:38:00 249

转载 解决git pull/push每次都需要输入密码问题(转载)

原文链接:https://blog.csdn.net/m0_37633370/article/details/90439113

2019-12-19 09:36:52 146

原创 shell DIY配置

一些快捷的操作 alias l=‘ls -alF’ alias …=‘cd …’ alias …=‘cd …/…’ alias rm=‘rm -f’ 实时显示当前操作的路径 cd - vim .bashrc #添加下面这一行,然后保存,然后执行 source .bashrc #使之生效 export PS1='\[\e[35;40m\][\u@:$PWD]\$: \[\e[m\]' 配置示例 ...

2019-12-19 09:11:06 116

原创 VIM编辑器的简单配置及使用

这里写自定义目录标题vim配置配置vim使用批量替换字符串 vim配置 配置 vim /etc/vimrc set nu set smartindent set tabstop=4 set shiftwidth=4 set expandtab set softtabstop=4 vim使用 批量替换字符串 :%s/源字符串/目的字符串/g ...

2019-12-18 20:52:58 74

原创 使用boost库获取线程id

在C语言中打印 #include <boost/thread.hpp> const char* getThreadId() { std::string threadId=boost::lexical_caststd::string(boost::this_thread::get_id()); return threadId.c_str(); } C++中直接使用cout输出即可 #in...

2019-12-18 18:02:49 1164

原创 使用mqopen mq_receive mq_close和sem_open sem_wait sem_post给不同进程发送任务去执行

mqopen mq_receive mq_close和sem_open sem_wait sem_post联合使用 #include <stdio.h> #include <semaphore.h> #include <mqueue.h> #include <unistd.h> #include <string.h> #include "...

2019-11-26 11:23:00 280

原创 boost::function参数为空时,可以接收boost::bind有参数的函数

代码示例: #include<boost/function.hpp> #include<boost/bind.hpp> #include<iostream> typedef boost::function<int(int)> Func; int test(int num,char ch) { std::cout<<num<&...

2019-08-06 11:23:56 265

转载 源码安装git-2.20.1版本

参考这个链接 https://www.cnblogs.com/gsliuruigang/p/7899803.html 这里有可能找不到configure这个文件, 这里我们需要再解压的路径下执行make configure这个命令,执行后,再继续执行 ./configure --prefix=/usr/local/git 后面就按照链接里面说的来即可! ...

2019-07-24 09:19:35 134

原创 分级别打印日志

#文件log.h 该文件中定义了打印日志的接口。 #ifndef _LOG_H_ #define _LOG_H_ #define INFO_OUTPUT 3 #define WARNING_OUTPUT 2 #define DEBUG_OUTPUT 1 #define ERROR_OUTPUT 0 #define LOG_INFO(args,...)\ do{\ ...

2019-05-23 14:29:01 592

转载 github 上传以及git push代码遇到:refusing to merge unrelated histories

git push代码遇到:fatal: refusing to merge unrelated histories 则直接运行以下步骤:  (原因在于你github上有README 而本地没有,导致远程分支和本地分支不一样)  git pull --rebase origin master(这样会在本地仓库新建一个readme文件这样就可以了)  git push -u origin master...

2018-11-22 20:54:07 147

空空如也

空空如也

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

TA关注的人

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