解决CentOS7虚拟机连不上网络的办法 查看网卡配置 vi /etc/sysconfig/network-scripts/ifcfg-ens33。发现上边配置上不了网,对比了另一台机机可以上网的配置。我修改为跟99IP一样的配置就可以了。
c++mongdb忽略大小写询查方法 做下笔记,mongdb忽略大小写询查方法mongdb js写法:db.getCollection('user').find({ "account" : { "$regex" : "yhzCAIabc", "$options" : "i" }, "orderid" : 123456789 });c++版代码写法:int32_t orderid = 123456789;string dbaccount = "yhzCAIabc";bsoncxx::document::value fi..
error: No rule to make target `..defines.h‘, needed by `RegisteServer.o‘. Stop. :-1: error: No rule to make target `../include/cpr/defines.h', needed by `RegisteServer.o'. Stop.
c++加载json文件中double类型精度丢失解决方法 项目中需要把conf.json文件中的浮点类型加载出来并放大100倍使用,但实际项目中遇到精度丢失的问题,比如浮点数是1078.60,加载出来后按常规逻辑 * 100实际得到结果为107859。精确度丢失了,为解决问题,我使用了下面简单方法避免了这种情况,而不需要使用类似GMP等高精度库。代码如下:using namespace std;//截取double小数点后2位,直接截断并乘以100转int64_tint64_t getDouble100(std::string const &..
CMakeList编译解决undefined reference to pthread_atfork SET(LIBRARIESpthread #错误原因是这里没有加-横线)TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBRARIES}) 正确写法:SET(LIBRARIES-pthread #记得加-横线)
MongoDB查询一段时间数据(c++) int main(){ mongocxx::instance instance{}; // This should be done only once. mongocxx::client client(mongocxx::uri("mongodb://192.168.1.100:37017")); mongocxx::database db = client["logDB"]; mongocxx::collection coll = db["order_record"];.
boost::regex_replace 过滤特定字符 std::string str ="sdfklsd l;sdfsdfsdfsdf s\t\t\t\t sddsf111{ sdf} f s "; boost::regex pattern(" ||\r|\t"); std::string fmt = ""; std::string ret = boost::regex_replace(str, pa...
error: No rule to make target `../../proto/xxxx.pb.cc', needed by `xxxx.pb.o'. S 清理一次目录下的"*.o.d"文件,重新编译就好了。
获取该虚拟机的所有权失败。主机上的某个应用程序正在使用该虚拟机。 解决办法:1、进入到存放此台Vmware虚拟机虚拟磁盘文件及配置文件存放的位置,找到后缀为.lck文件夹。2、将后缀为.lck的文件夹删除,或者直接重命名此文件夹,在这里我将文件夹CentOS 7 的克隆 的克隆.vmx.lck改为CentOS 7 的克隆 的克隆.vmx.lck.bak。3、重新打开虚拟机,此虚拟机可以正常打开了,这样就成功的解决了问题。...
c 11使用for_each遍历数组 #include<iostream> #include<algorithm>using namespace std; int action1(int &e ){ e *= 2; }int action2(int &e ){ cout << e << endl; } int main(int argc,ch...
g++ 使用c++11编译选项设置 #include<iostream>#include<typeinfo>using namespace std;int main(){ int arr[] = {14,15,7,2,4,78}; decltype(arr) newArr; cout << "sizeof newArr " << siz...
c++ 模板函数带数组参数 #include<stdio.h>#include<malloc.h>#include<iostream>using namespace std;//模板特化template<>int compare<const char*>(const char* const p1, const char* const p2){...
模板带参数实现队列 #include <iostream>#include <stdio.h>using namespace std;template<class T,int _size> class MyQueue{public: MyQueue(); ~MyQueue(); void push(T item); T pop();...