
C++
文章平均质量分 88
hemmingway
该家伙很懒。
展开
-
SKF密码设备研究
密码设备mToken GM3000 国密身份认证锁是龙脉科技自主研发设计支持国密算法、完全遵照国家密码管理局颁布的《智能IC卡及智能密码钥匙密码应用接口规范》要求设计的USB Key,采用国产高性能智能卡芯片,内置SSF33、SM1、SM2、SM3、SM4等国产算法,支持高速数据国密算法加解密,提供CSP以及PKCS11和国密接口,完全符合国家密码管理局关于“密钥不落地”的技术规范要求,是电子政务、电子军务、CA厂商首选的USB Key产品。适用范围:主要是用作基于公钥体系PKI的数字证书和私钥的安全载原创 2021-07-15 14:04:31 · 3944 阅读 · 0 评论 -
pthread 线程退出时自动释放资源
线程退出时自动释放资源今天碰到一个问题:主线程pthread_create一个子线程A,子线程pthread_mutex_lock,然后调用其他的函数fun,最后从fun返回后再pthread_mutex_unlock.但是如果在fun中调用了pthread_exit异常退出,那么岂不是没释放锁就退出了,这肯定会引起死锁.解决办法一:在fun中调用pthread_exit之前都先调用pth...原创 2019-12-09 17:27:50 · 1396 阅读 · 0 评论 -
Heap与Stack的区别- -
一、预备知识—程序的内存分配一个由c/C++编译的程序占用的内存分为以下几个部分1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。2、堆区(heap) — 一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回收 。注意它与数据结构中的堆是两回事,分配方式倒是类似于链表,呵呵。3、全局区(静态区)(static)—,...转载 2019-12-03 15:08:42 · 457 阅读 · 0 评论 -
人脸识别数据库
作者:许小平 链接:https://www.zhihu.com/question/33505655/answer/67492825 来源:知乎 著作权归作者所有,转载请联系作者获得授权。用CNN train model 数据很重要很重要很重要,我就来分享一些公开的数据。 1. 李子青组的 CASIA-WebFace(50万,1万个人). 需申请.Center for Biometrics a转载 2016-12-26 21:09:08 · 5215 阅读 · 0 评论 -
Ubuntu 14.04 LTS 下升级 gcc 到 gcc-4.9、gcc-5 版本
转载: http://www.cnblogs.com/BlackStorm/p/5183490.htmlUbuntu 14.04 LTS 下升级 gcc 到 gcc-4.9、gcc-5 版本 如果没记错的话,阿里云ECS上的Ubuntu也是LTS版本。如果还在使用较旧版本的Ubuntu,或者是Ubuntu LTS,那么我们是很难体验新版gcc的。怎么办呢?我们或许可以自己去编译用旧版本的gcc去编转载 2016-09-11 09:50:53 · 809 阅读 · 0 评论 -
a.out、coff、elf三种文件格式
转自:http://blog.chinaunix.net/uid-11469366-id-1747286.html补充:a.out早期并不是elf格式的,而是unix下另一种可执行格式,新的a.out是本文讨论了 UNIX/LINUX 平台下三种主要的可执行文件格式:a.out(assembler and link editor output 汇编器和链接编辑器的输出)、COFF(Common Ob转载 2016-09-09 22:31:35 · 3413 阅读 · 0 评论 -
387. First Unique Character in a String QuestionEditorial Solution
Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.Examples:s = “leetcode” return 0.s = “loveleetcode”, return 2. Note: You may assume原创 2016-08-29 23:48:10 · 608 阅读 · 0 评论 -
使用有限状态机(FSM)解释shell 命令
一、有限状态机(Finite State Machine,FSM)是表示有限个状态及在这些状态之间的转移和动作等行为的数学模型,在计算机领域有着广泛的应用。FSM一个常见的应用就是用来负责Parser复杂的数据结构,比如解释URI协议(uri-rfc239、uri-rfc3986)(注释:统一资源标识符(Uniform Resource Identifier,或URI)),在这里以Linux下she原创 2016-08-19 00:03:26 · 1716 阅读 · 0 评论 -
X86 CMOS
1、cmos简介。 cmos是主板上一块可读写的RAM芯片。用途:主要用来保存当前系统的硬件配置和操作人员对某些参数的设定。cmos芯片是由一块纽扣电池供电。因此在关机状态内部信息也不会丢失。2、cmos所在的端口。 cmos芯片是挂在cpu的io空间上的.(x86体系是独立编址的)。cmos拥有两个端口号分别是70h和71h端口号 权限原创 2016-08-06 09:41:08 · 1685 阅读 · 0 评论 -
Add Digits
https://leetcode.com/problems/add-digits/Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11,原创 2016-07-22 00:35:07 · 326 阅读 · 0 评论 -
reverse string
https://leetcode.com/problems/reverse-string/Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”.1.char* reverseString(char* s) {原创 2016-07-21 23:09:37 · 296 阅读 · 0 评论 -
现代C++函数式编程
链接 http://geek.youkuaiyun.com/news/detail/96636概述 函数式编程是一种编程范式,它有下面的一些特征:函数是一等公民,可以像数据一样传来传去。 高阶函数 递归 pipeline 惰性求值 柯里化 偏应用函数 C++98/03中的函数对象,和C++11中的Lambda表达式、std::function和std::bind让C++的函数式编程变得容易。我们转载 2016-09-04 21:14:29 · 908 阅读 · 0 评论 -
正则表达式练习笔记
下面的内容是一个 data1.txt 文本内容,里面记录了一些正则表达式的笔记long long ago there is girl, she's name is little redhat..long_long_long#long;long:longThis is a test txt...my phone number is 18621735531There are a lot of g原创 2016-09-26 21:14:46 · 586 阅读 · 0 评论 -
VS2015编译boost 1.62.0
参考链接: http://blog.chinaunix.net/uid-22301538-id-3158997.htmlD:\boost_1_62_0>bjam –toolset=msvc-14.0 –prefix=D:/boost_1_62_0/output –without-python –build-type=complete link=shared threading=multi ins原创 2016-12-08 22:36:37 · 1039 阅读 · 0 评论 -
VS2015 + CUDA 8.0 配置GTX1070的OpenCL 开发环境
一、查看计算机对OpenCL异构计算的支持情况使用 GPU Caps Viewer 查看计算机对OpenCL的支持情况,目前最新的版本是 gpu-caps-viewer-1-32-0, 下载地址:http://www.geeks3d.com/20161107/gpu-caps-viewer-1-32-0-released/ 从上面两个图可以看到目前的计算机上有2个OpenCL platform,原创 2016-12-20 22:11:11 · 5241 阅读 · 1 评论 -
奇异递归模板模式(Curiously Recurring Template Pattern,CRTP)
The Curiously Recurring Template Pattern (CRTP) is a C++ idiom whose name was coined by James Coplien in 1995, in early C++ template code.The “C” in CRTP made it travel the years in the C++ community b转载 2017-05-13 10:17:42 · 969 阅读 · 0 评论 -
解决Win10下_findnext()异常
在win10中,使用文件遍历函数_findnext会报0xC0000005错误 原因: _findnext()第一个参数”路径句柄”,返回的类型为intptr_t(long long),如果定义为long,在win7中是没有问题,但是在win10中就要改为long long或者intptr_t下面是示例代码:/* Get all files in a folder specified by原创 2017-06-25 14:39:09 · 7105 阅读 · 23 评论 -
计算机原码、反码、补码详解
标签: 计算机原码反码补码大数溢出 2016-04-29 12:33 4190人阅读 评论(1) 收藏 举报 分类: 计算机基础 目录(?)[+] 注:之前查找了关于原码、反码、补码的相关资料,张子秋的博客:原码, 反码, 补码 详解讲的比较透彻。为了方便,现将其转载至此,版权归原作者所有。更加深入的分析,可以参考作者的原文。本文大部分内容来源于此。后面有小部分关于“大数溢出”的问题为本人转载 2017-07-30 12:20:32 · 1351 阅读 · 0 评论 -
C++ 字节顺序
//// ByteOrder.h//// Library: Engine// Package: Core// Module: ByteOrder////#ifndef WISHBONE_BYTEORDER_H_#define WISHBONE_BYTEORDER_H_#include "Wishbone/Foundation.h"#include "Wishbone...原创 2018-03-30 08:43:01 · 1390 阅读 · 0 评论 -
ByteOrder 大小端字节翻转
//// ByteOrder.h//// Library: Engine// Package: Core// Module: ByteOrder////#ifndef WISHBONE_BYTEORDER_H_#define WISHBONE_BYTEORDER_H_#include "Wishbone/Foundation.h"#include "Wishbone...原创 2018-03-31 15:47:57 · 1258 阅读 · 0 评论 -
C++之RAII机制
1.什么是RAII?RAII(Resource Acquisition Is Initialization)机制是Bjarne Stroustrup首先提出的,也称直译为“资源获取就是初始化”,是C++语言的一种管理资源、避免泄漏的机制。 C++标准保证任何情况下,已构造的对象最终会销毁,即它的析构函数最终会被调用。 RAII 机制就是利用了C++的上述特性,在需要获取使用资源RES的...原创 2018-04-02 08:52:43 · 1882 阅读 · 0 评论 -
Reverse Integer
https://leetcode.com/problems/reverse-integer/Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Have you thought about this? Here are some good questions to as原创 2016-07-28 22:51:45 · 358 阅读 · 0 评论 -
String to Integer (atoi)
https://leetcode.com/problems/string-to-integer-atoi/Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below原创 2016-07-28 22:37:11 · 525 阅读 · 0 评论 -
Missing Number
https://leetcode.com/problems/missing-number/Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.For example, Given nums = [0, 1, 3] retu原创 2016-07-27 00:42:33 · 355 阅读 · 0 评论 -
Intersection of Two Arrays
https://leetcode.com/problems/intersection-of-two-arrays/Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note: Each el原创 2016-07-23 11:44:46 · 366 阅读 · 0 评论 -
Move Zeroes
https://leetcode.com/problems/move-zeroes/Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums =原创 2016-07-23 00:24:56 · 299 阅读 · 0 评论 -
Invert Binary Tree
https://leetcode.com/problems/invert-binary-tree/Invert a binary tree.4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1给出一棵二叉树,求这棵二叉树的镜像。搬运九章上的实现原创 2016-07-22 23:46:38 · 313 阅读 · 0 评论 -
Maximum Depth of Binary Tree
https://leetcode.com/problems/maximum-depth-of-binary-tree/Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the far原创 2016-07-22 23:21:30 · 411 阅读 · 0 评论 -
GNU编译优化级别-O -O1 -O2 -O3
最近做一个算法的GPU加速,发现实际上使用gcc的-O3(最高级编译优化)选项,可以获得很高的加速比,我的程序里达到了3倍的样子,有时效果甚至比GPU加速好。因此小小学习了下GNU的编译优化。附言一句,在进行调试的时候,最好关闭编译优化,不然程序自动优化,执行的步骤可能稍有变化。GNU编译器提供-O选项供程序优化使用:-O 提供基础级别的优化-O2 提供更加高级的代转载 2016-05-21 14:56:48 · 2926 阅读 · 0 评论 -
你应该知道的浮点数基础知识
本文从一个有趣而又令人意外的实验展开,介绍一些关于浮点数你应该知道的基础知识文章欢迎转载,但转载时请保留本段文字,并置于文章的顶部 作者:卢钧轶(cenalulu) 本文原文地址:http://cenalulu.github.io/linux/about-denormalized-float-number/一个有趣的实验本文从一个有趣而诡异的实验开始。最早这个例子博转载 2016-05-21 14:48:04 · 1281 阅读 · 0 评论 -
Qt5 中的 signal/slot 新语法
Qt 5 Alpha 已经发布。我们会在后面的文章中看到 Qt 5 的新变化。今天,我们先来看一下 Qt 5 带来的一个最主要的变化:signal/slot 机制的改变。Qt 5 之前的语法在 Qt 5 之前,我们需要使用下面的语句来链接 signal 和 slot:转载 2015-12-25 13:38:47 · 4519 阅读 · 0 评论 -
C++ 11 在 Qt 5 中的应用
C++ 11 现在已经是 C++ 标准,也就没有理由不在新的应用中使用。Qt 4.8 是第一个支持 C++ 11 特性的 Qt 版本,不过这里,我们首先介绍的是,Qt 5 中如何结合使用 C++ 11。至于 Qt 4.8,我们会在后续文章中进行阐述。显而易见的是,比起 Qt 4.8,Qt 5 利用了更多的 C++ 11 新特性。下面我们来一个个见识一下:slot 中使用 L转载 2015-12-25 15:03:57 · 1851 阅读 · 0 评论 -
【C++设计技巧】C++中的RAII机制
随笔- 427 文章- 0 评论- 4作者:gnuhpc 出处:http://www.cnblogs.com/gnuhpc/1.概念Resource Acquisition Is Initialization 机制是Bjarne Stroustrup首先提出的。要解决的是这样一个问题:在C++中,如果在这个程序段结束时需要完成转载 2015-11-21 13:34:11 · 580 阅读 · 0 评论 -
Contains Duplicate
https://leetcode.com/problems/contains-duplicate/Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array原创 2016-07-23 12:24:23 · 365 阅读 · 0 评论 -
Contains Duplicate II
https://leetcode.com/problems/contains-duplicate-ii/Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the原创 2016-07-23 14:05:53 · 366 阅读 · 0 评论 -
Power of Two
https://leetcode.com/problems/power-of-two/Given an integer, write a function to determine if it is a power of two.数字 2^n 是大于0的,而且等于1左移n位得到的数字,所以2^n与2^n-1 相与运算得到0.bool isPowerOfTwo(int n) { if(n <=原创 2016-07-23 14:37:52 · 287 阅读 · 0 评论 -
Single Number
https://leetcode.com/problems/single-number/Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. C原创 2016-07-27 00:28:02 · 320 阅读 · 0 评论 -
Reverse Bits
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110原创 2016-07-24 22:31:40 · 458 阅读 · 0 评论 -
Ugly Number
https://leetcode.com/problems/ugly-number/Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8原创 2016-07-24 10:44:42 · 302 阅读 · 0 评论 -
Power of Three
https://leetcode.com/problems/power-of-three/Given an integer, write a function to determine if it is a power of three.Follow up: Could you do it without using any loop / recursion?3的次方数没有显著的特点,最直接的方法原创 2016-07-24 10:25:35 · 278 阅读 · 0 评论