自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Quartz

定时任务框架Quartz-(一)Quartz入门与Demo搭建_noaman_wgs的博客-CSDN博客_quartzQuartz.Net的基础使用方法,多任务执行 - 畅饮无绪 - 博客园

2022-01-20 10:19:35 272

原创 Leetcode ​437. Path Sum III

You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at the root or a leaf, but it must go downwards (traveling only from parent nodes to chil

2020-06-28 18:31:37 214

原创 Leetcode 405. Convert a Number to Hexadecimal

405.Convert a Number to HexadecimalEasy379102Add to ListShareGiven an integer, write an algorithm to convert it to hexadecimal. For negative integer,two’s complementmethod is used.Note:...

2020-04-27 18:28:40 228

原创 利用namespace修改主机名后的问题

1 背景学习docker隔离机制的过程中完成一个uts隔离的demo,程序运行状态良好,之后关掉了执行程序的终端,新开了终端,主机名仍然没变,通过exit无法退出程序了。2 namespace实现主机名隔离参考:https://blog.csdn.net/weixin_34273046/article/details/92464192#define _GNU_SOURCE#include...

2019-12-19 16:01:05 215

原创 temp

docker pull amouat/identidock:unsignedexport DOCKER_CONTENT_TRUST=1docker pull debian:wheezydocker run -d --name influxdb -p 8086:8086 tutum/influxdbcreate database "cadvisor...

2019-12-17 11:26:24 198

原创 可信计算参考文章

信任链设计:http://www.xjishu.com/zhuanli/62/201811035759.html

2019-10-27 22:44:55 314

原创 Leetcode 257. Binary Tree Paths

257.Binary Tree PathsEasy108579FavoriteShareGiven a binary tree, return all root-to-leaf paths.Note:A leaf is a node with no children.Example:Input: 1 / \2 3 \ 5Output:...

2019-10-23 16:08:15 136

原创 Leetcode 226. Invert Binary Tree

homebrew作者都不会的题目Invert a binary tree.Example:Input: 4 / \ 2 7 / \ / \1 3 6 9Output: 4 / \ 7 2 / \ / \9 6 3 1/** * Definition for a binar...

2019-10-23 11:19:32 124

转载 关于C++中的虚拟继承的一些总结

1.为什么要引入虚拟继承虚拟继承是多重继承中特有的概念。虚拟基类是为解决多重继承而出现的。如:类D继承自类B1、B2,而类B1、B2都继承自类A,因此在类D中两次出现类A中的变量和函数。为了节省内存空间,可以将B1、B2对A的继承定义为虚拟继承,而A就成了虚拟基类。实现的代码如下:class Aclass B1:public virtual A;class B2:public vi...

2019-10-22 14:27:41 278

原创 定时器设计

参考https://www.hifreud.com/2015/04/30/timer-design/https://zhuanlan.zhihu.com/p/38408679http://www.cppblog.com/expter/archive/2010/03/05/108977.aspxhttps://baijiahao.baidu.com/s?id=164682969779...

2019-10-20 14:07:20 568

原创 docker可信

https://segmentfault.com/a/1190000005794220#articleHeader18https://www.hacking8.com/MiscSecNotes/26.html评估Docker安全性 http://www.dockerinfo.net/693.htmlDocker容器监控系统平台 https://segmentfault.com/a...

2019-10-14 16:07:56 208

原创 golang 实现聊天室 bluecat‘s chat

目前字符串无法加入空格,如果想添加的话,在客户端把空格处理成特殊字符处理。文件名为chat.go ,测试方法见注释。参考:https://blog.csdn.net/ygrx/article/details/11773151package mainimport ( "fmt" "net" "os")//客户端连接信息type client struct { na...

2019-10-12 15:37:41 233

转载 Docker容器实现原理及容器隔离性踩坑介绍

Docker容器实现原理及容器隔离性踩坑介绍正如Docker官方的口号:“Build once,Run anywhere,Configure once,Run anything”,Docker被贴上了如下标签:轻巧、秒级启动、版本管理、可移植性等等,这些优点让它出现之初就收到极大的关注。现在,Docker已经不仅仅是开发测试阶段使用的工具,大家已经在生产环境中大量使用。今天我们给大家介...

2019-10-08 23:11:40 293

转载 Top-K问题

面试中,TopK,是问得比较多的几个问题之一,到底有几种方法,这些方案里蕴含的优化思路究竟是怎么样的,今天和大家聊一聊。画外音:除非校招,我在面试过程中从不问TopK这个问题,默认大家都知道。问题描述:从arr[1, n]这n个数中,找出最大的k个数,这就是经典的TopK问题。栗子:从arr[1, 12]={5,3,7,1,8,2,9,4,7,2,6,6}这n=12个数中,找...

2019-08-09 15:28:19 192

原创 Leetcode 1116. 打印零与奇偶数

控制台没问题,不知道为啥没ac 模版里面基数偶数写反了class ZeroEvenOdd {private: int n; mutex mu; condition_variable cond; bool is0,is1,is2;public: ZeroEvenOdd(int n) { this->n = n; ...

2019-07-31 16:41:29 365

原创 Leetcode 1115. 交替打印FooBar

class FooBar {private: int n; std::mutex mutex_t; std::condition_variable cond; bool isfoo;public: FooBar(int n):isfoo(true){ this->n = n; } void fo...

2019-07-31 14:40:25 389

原创 Leetcode 1114. 按序打印

我们提供了一个类:public class Foo {public void one() { print("one"); }public void two() { print("two"); }public void three() { print("three"); }}三个不同的线程将会共用一个Foo实例。线程 A 将会调用 one() 方法线程 B 将会调...

2019-07-31 14:30:53 182

转载 move语义移动后的状态

https://blog.csdn.net/gg_18826075157/article/details/71889042移动之后的状态?如果要找出十分准确的答案,其实是挺麻烦的。C++11的标准类库的说法就是——“仍然有效,但状态不明”,实际上一般情况下为空,但并不能保证。以string为例说明。std::string t = "xmas", u;u = std::move(t)...

2019-07-30 09:54:11 165

原创 链表中倒数第k个结点

#include <iostream>#include <memory>using namespace std;typedef struct LinkList{ int val; shared_ptr<LinkList> next;//智能指针和普通指针不要混合使用 https://blog.csdn.net/flowing_wind/articl...

2019-07-25 16:35:41 128

原创 结构体排序

postgres中,需要修改一个sort方法,把源码中的快速排序改成能够加速的版本,把结构体中的key值搞出来,并且记录下标,把原来的sorttuple数组拷贝,然后按照排序过后的下标进行重新拷贝。// qsort 的魔派、.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。//#include "pch.h"#include <iostream>...

2019-07-09 15:57:54 138

转载 io

include <stdio.h>#include <unistd.h>#include <sys/time.h> int play_select(){ fd_set rfds; FD_ZERO(&rfds); FD_SET(STDIN_FILENO, &rfds); fd_set wfds; FD_ZERO(&...

2019-07-07 20:23:46 117

原创 可信镜像

//// main.cpp// sha256//// Created by 蓝猫 on 2019/4/29.// Copyright © 2019年 蓝猫. All rights reserved.//#include <iostream>// 文件操作.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。//#include &l...

2019-06-25 23:47:42 166

原创 整型转字符串

项目中要用到文件操作输出一些结构体信息,包括一些int型的数字,为了直观,需要转换成字符串,虽然c语言提供了这种函数,但还是想自己从底层造个轮子。思路:把int的位数记住,申请位数加1的内存(多一个存'\0')。把每一个数字转换成字符存入。// 整型转字符串.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。//#include "pch.h"#include ...

2019-06-25 16:45:12 782

原创 线程安全队列

//// main.cpp// threadsafe_queue//// Created by 蓝猫 on 2019/6/24.// Copyright © 2019年 蓝猫. All rights reserved.//#include <iostream>#include <queue>#include <mutex>#inc...

2019-06-24 18:45:39 224

原创 Leetcode 32. Longest Valid Parentheses

Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: "(()"Output: 2Explanation: The longest valid...

2019-06-19 16:17:12 147

转载 虚函数表和内存布局

https://bbs.csdn.net/topics/280004030子类继承父类是否含有虚函数表派生类对象包含一个基类对象区域和派生类特有对象区域,基类是派生类的一部分。从这个意义上讲,派生类是包含虚表的,但是这个虚表是派生类对象中基类对象的那个部分,实际上,派生类对象和其内含的基类对象共享一个虚表,且虚表包含的是派生类对象的函数偏移,这就是为什么你无论用基类还是派生类指针,都调用派生...

2019-06-18 16:23:15 493

原创 Leetcode 289. Game of Life

According to theWikipedia's article: "TheGame of Life, also known simply asLife, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."Given aboardwithmbyn...

2019-06-18 15:48:38 202

原创 leetcode 290. Word Pattern

Given apatternand a stringstr, find ifstrfollows the same pattern.Herefollowmeans a full match, such that there is a bijection between a letter inpatternand anon-emptyword instr.Exampl...

2019-06-18 14:13:24 113

原创 Leetcode 284. Peeking Iterator

Given an Iterator class interface with methods:next()andhasNext(), design and implement a PeekingIterator that support thepeek()operation -- it essentially peek() at the element that will be retu...

2019-06-17 17:21:23 161

原创 strcpy和memcpy

参考:https://www.cnblogs.com/huanzxj/p/3522595.html#include <iostream>void *stringcpy(char *str1, const char *str2){ if (str1 == NULL || str2 == NULL) { return NULL; } char *temp = str1...

2019-06-17 10:54:46 236

原创 c++ 实现docker容器(namespace隔离)

参考https://www.cnblogs.com/luosongchao/p/3680312.htmlhttps://blog.csdn.net/yangkuanqaz85988/article/details/52403726进程栈https://blog.csdn.net/hty46565/article/details/79934205namespace参考实验楼...

2019-06-16 23:57:37 2316 3

原创 给二维数组指针扩容

参考:https://blog.csdn.net/u012199908/article/details/79185921参考:https://bbs.csdn.net/topics/391936871?page=1参考:https://zhidao.baidu.com/question/140600641317526125.htmlpostgres全部由纯C编写,现在要给一个指针数组赋...

2019-06-12 15:57:13 631

原创 指针赋值(深拷贝 浅拷贝)

当我申请了一个char型指针,想给另一个指针用等于号赋值时,这两个指针将指向同一块内存,如果我把第一个指针释放,那么另一个指针指向的数据也没有了。for (int i = 0; i < 3; i++) { Node *n = new Node(i+'0',i); char *c = (char*)malloc(sizeof(Node)); memcpy(c,...

2019-06-12 13:56:45 8159

转载 define和const区别

https://www.jb51.net/article/139225.htmhttps://blog.csdn.net/weibo1230123/article/details/81981384用#define MAX 255定义的常量是没有类型的,所给出的是一个立即数,编译器只是把所定义的常量值与所定义的常量的名字联系起来,define所定义的宏变量在预处理的时候进行替换,在程序中使用...

2019-06-12 09:44:17 1083

原创 镜像扫描器

https://blog.csdn.net/liumiaocn/article/details/81813707集成clairhttps://www.jianshu.com/p/447e22ce947c使用clair扫描Docker镜像漏洞https://www.freebuf.com/column/157784.htmlDocker镜像扫描器的实现https://blog.csdn....

2019-06-04 15:31:36 402

原创 结构体和字符流的相互转换

参考:https://blog.csdn.net/qq_31094099/article/details/80790346https://www.cnblogs.com/qicosmos/p/3601737.htmlhttps://bbs.csdn.net/topics/390382122?page=1https://blog.csdn.net/qq_29757283/article/...

2019-06-03 15:03:03 840

原创 c++11 原子操作实现自旋锁

参考:https://www.cnblogs.com/ittinybird/p/4830834.htmlhttps://blog.csdn.net/sharemyfree/article/details/47338001https://blog.csdn.net/qccz123456/article/details/81329261自旋锁是一种非阻塞锁,也就是说,如果某线程需要获...

2019-05-17 17:52:08 742

原创 Leetcode 236. Lowest Common Ancestor of a Binary Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */cla...

2019-05-17 15:58:31 162

原创 Leetcode 235. Lowest Common Ancestor of a Binary Search Tree

235.Lowest Common Ancestor of a Binary Search TreeEasy100079FavoriteShareGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the...

2019-05-17 14:27:00 114

原创 Leetcode 228. Summary Ranges

class Solution {public: vector<string> summaryRanges(vector<int>& nums) { vector<string> ans; if (nums.empty())return ans; string temp = ""; for (int i = 0...

2019-05-17 11:10:41 149

空空如也

空空如也

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

TA关注的人

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