- 博客(29)
- 资源 (3)
- 收藏
- 关注
原创 C++ vector 效率之capacity()、resize()、reserve()
capacity表示容器内可以容纳多少个对象,表示的是能,不代表容器内就有这么多个对象。size表示的是实实在在有多少个对象。
2022-07-29 17:55:39
969
1
原创 代码演示:float 是如何存储的,2进制如何还原为float
代码#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>/**演示float是如何存储的*/void float_to_bits(float f_num, char bits[]){ int *f = (int*)(&f_num); for (int i=0; i<32; i++) { bits
2021-08-25 08:48:40
247
原创 Linux下如何校验用户名和密码(使用crypt函数)
#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <sys/types.h>#include <pwd.h>#include <shadow.h>#include <string.h>#define _XOPEN_SOURCE //using crypt function,we need define this// The
2021-03-03 13:49:46
1310
原创 为什么需要会话(session)和进程组(process group)?怎样安全的在后台运行程序?
WhatA process group is a collection of related processes which can all be signalled at once.A session is a collection of process groups, which are either attached to a single terminal device (known as the controlling terminal) or not attached to any term
2021-01-19 14:06:29
657
原创 Ubuntu 18.04 LNMP环境 搭建WordPress站点
搭建LNMP环境是什么?LNMP = linux + nginx + mysql + php-fpm。怎么安装?nginxsudo apt-get install nginxmysqlsudo apt-get install mysql-serverphp-fpmsudo apt-get install php-fpm php-mysqlsudo apt-get install php-gd php-curl搭建WordPress配置mysqlWordpress中需要使用到
2020-11-09 17:57:47
673
原创 Linux (syscall)系统调用& (mutex)锁的开销
环境采用虚拟机Intel® Core™ i5-3470 CPU @ 3.20GHzLinux Jimmy 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:06:37 UTC 2016 i686 i686 i686 GNU/Linux目的测试系统调用、线程调度、进程调度等操作耗时。目的只是给出耗时在哪个量级的概念。数据操作耗时syscall600nsclock_gettime600nsmalloc(b
2020-09-03 17:25:08
693
原创 C++ format string (格式化字符串)
为什么要单独做C++字符串格式化?C++中可以使用stringstream来格式化字符串如下:stringstream sstream;sstream << "I have made " << 500 << " dollars on this product.";string formated_str = sstream.str();但是,这种方式并不好用。有没有类似printf操作的方式呢?在opencv中有类似的封装。怎么做?怎么用?string f
2020-09-03 17:23:05
7994
1
原创 C++ 容器&Move&各种构造函数
目的研究在容器相关操作中,类的各种构造函数的调用时机。试验采用c++11编译#include <vector>#include <iostream>#include <algorithm>using namespace std;class A{private: int m_a;public: A(int a):m_a(a){cout << "Construct" << m_a << endl;}; A(co
2020-08-18 08:38:02
579
原创 从clock_gettime和gettimeofday开始谈linux下函数耗时计算
从clock_gettime和gettimeofday开始谈linux下函数耗时计算引言在OpenCV中有如下的两个函数用来获取当前时间。static long long getTickCount(void){#if defined _WIN32 || defined WINCE LARGE_INTEGER counter; QueryPerformanceCounter( &counter ); return (long long)counter.QuadPart
2020-08-07 14:50:57
4316
原创 OpenCV中为什么要实现InputArray和OutputArray
引言在使用OpenCV API 的时候,我们经常遇到如下形式的函数。那么究竟为什么要使用InputArray,OutputArray等类型的参数呢?void cv::transform(InputArray src, OutputArray dst, InputArray m) 经过我的分析,有以下三种好处:InputArray,OutputArray可以接收cv::Mat,std::Vector等类型的参数。InputArray,OutputArray可以以统一的接口来操作输入,输出参数。
2020-07-24 12:32:37
1213
原创 Introduction to Scrum - 7 Minutes
敏捷的价值观个体和交互胜过过程和工具可以工作的软件胜过面面俱到的文档客户合作胜过合同谈判响应变化胜过遵循计划虽然右项有价值,但我们更重视左项敏捷的原则我们最优先要做的是通过尽早的、持续的交付有价值的软件来使客户满意。即使到了开发的后期,也欢迎改变需求。敏捷过程利用变化来为客户创造竞争优势。经常性地交付可以工作的软件,交付的间隔可以从几个星期到几个月,交付的时间间隔越短越好。在整个项目开发期间,业务人员和开发人员必须天天都在一起工作。围绕被激励起来的个体来构建项目。给他们提供所需的
2020-07-18 11:25:04
241
原创 OpenCV编译全解析
some exampleswith cuda & python3 bindcmake \-D CMAKE_BUILD_TYPE=RELEASE \-D BUILD_EXAMPLES=OFF \-D BUILD_opencv_apps=OFF \-D BUILD_DOCS=OFF \-D BUILD_PERF_TESTS=OFF \-D BUILD_TESTS=OFF \-D WITH_CUDA=ON \-D CUDA_GENERATION=Pascal \-D ENABL
2020-07-03 13:28:08
801
原创 BSD LGPL GPL License综合使用
严格排序BSD < LGPL < GPL如果一个项目中即有BSD的库,也有LGPL的库,那么这个项目整体的限制是LGPL的。如果一个项目中既有LGPL的库,也有GPL的库,那么这个项目整体的限制是GPL的。也就是说,整体是以最严格的License来定的。说明拿opencv来举例,opencv是BSD的。但是opencv有使用到ffmpeg,ffmpeg是LGPL的。ffmp...
2019-11-12 08:59:08
1057
原创 c++ 构造函数执行顺序
#include <iostream>using namespace std;class A {public: A() {cout << "now initialize A.\n";}};class B{public: B(A _a = A()) : a(_a) { cout << "now initialize B." <...
2019-11-07 09:00:34
562
原创 c++ template
#include <iostream>using namespace std;//Template1template <typename _T1>class Scaler{private: _T1 mValue;public: Scaler<_T1> operator+(Scaler<_T1> rVin);//...
2019-11-06 08:59:29
235
原创 C++ functional callable lambda algorithm
callable#include <iostream>#include <sys/types.h>using std::cout;using std::endl;class Callable{private: int32_t m_id;public: void operator()(int32_t id) { m_...
2019-11-06 08:51:15
136
原创 C++ 4种构造函数被调用时机
#include <iostream>#include <vector>#include <map>#include <algorithm>using namespace std;class A{public: A() { cout << "construct a" << en...
2019-11-04 17:17:52
1616
原创 ethtool修改永久修改eeprom(MAC)地址
背景项目中移植DM9621网卡的时候,发现eth网络接口正常出现,但是不能配置MAC地址。只要通过“ifconfig eth0 hw ether“”指令配置了MAC地址,就不再能够PING通其他主机。后分析发现内核驱动加载为cdc_ether,而不是dm9621。经分析发现应是我们自己做的硬件的eeprom内无配置内容,故dm9621芯片的工作模式不对。所以,我们需要刷写eeprom。工具刷...
2019-08-06 08:46:43
4759
原创 IMX6Q 升级交叉编译工具链从4.6到4.9.4
平台IMX6Q 32-bit Armv7 Cortex-A升级步骤下载对应的工具链工具链下载地址为https://www.linaro.org/downloads/。由于我的平台是Armv7a的,所以我选择下载了gcc-linaro-4.9.4-2017.01-i686_arm-linux-gnueabi工具链。在该网站上还可以下载目标板上的运行环境:sysroot-eglibc-li...
2019-04-19 11:05:15
1739
原创 nginx+uwsgi+flask
nginx uwsgi flask 之间的关系nginx 负责TCP/UDP连接、收发数据uwsgi 负责解析HTTP协议,并将解析结果通过WSG协议传递给flask应用flask web应用框架,负责业务代码(产生响应)sequenceDiagramwebbrowser->>nginx:tcp/udpnginx->>uwsgi:uwsgi(http...
2019-04-13 15:21:36
189
原创 中庸之道,物极必反
乱用的abstruction比不用abstruction更可怕软件是需要频繁变动的,与其说把软件设计的完美,不如说把软件设计的更加易于修改good enought,not perfect
2019-02-12 09:54:07
513
转载 11 ways to be proficient
11 ways to be proficientpractiseunit testsbe honestcontribute to open sourcebe open to helppick a personal projectlower your egounderstand the “why”don’t be lazysolve coding challengeencou...
2019-02-11 10:03:47
116
原创 《Just for fun》-Linus 传记 读书笔记
一、介绍书的封面上写着“Entertaining ... Insights into how the mind of a creative developer works.”,探索以为充满创意的开发者的大脑是什么样的。本书讲了Linus Torvalds从出生到上学到工作,Linux的诞生,Linux的发展,Git的诞生,同软件领域各位大佬的趣事,以及Linus对生活的态度、对开源的见解。...
2018-09-06 11:34:11
860
原创 《软技能:代码之外的生存指南》读书笔记
------------------------------------------Get到的点------------------------------------把自己的职业生涯当做一个企业来经营“十步学习法“,大结构-->范围---->目标---->筛选资料---->学习-------->实践----------->分享自我营销,博客、演讲、内部分享------
2017-10-16 15:03:05
385
原创 《大话设计模式》学习总结
法则单一职责法则单一职责原则就是一个类只负责做一件事件,只有一个功能。比较于功能比较多的类,面对功能实现修改的时候,只需要修改一个类,而不会对其他的功能造成影响。比如说界面显示和游戏逻辑分开,只要不该接口,界面与逻辑的具体实现都可以单独修改而不会对彼此造成影响。开放封闭法则开放封闭原则指的是,应对需求变更,代码对修改是封闭,对增加是开放的。当然应对需求的变更,代码肯
2017-07-15 10:46:02
473
1
《微服务设计中文完整版.pdf》带书签
2018-04-04
《敏捷软件开发:原则、模式与实践.pdf》带书签版
2018-04-04
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人