自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(27)
  • 资源 (1)
  • 收藏
  • 关注

原创 九 IO复用

九 I/O复用9.1 select系统调用select系统的用途: 在一段指定的时间内,监听用户感兴趣的文件描述符上的可读、可写、异常事件select API#include <sys/select.h>int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout);参数含义:???? nfds 指定监听文件描述符的总数,通常设置为最大监听文件描述

2021-12-02 00:15:00 344

原创 八 高性能服务器程序框架

八 高性能服务器程序框架按照服务器的一般原理。可以将服务器结构为三个主要模块:????I/O处理单元????逻辑单元✴️存储单元8.1 服务器模型C/S模型:服务器启动后,首先创建一个或者多个监听socket, 并调用bind函数将其绑定到服务器感兴趣的端口上, 然后调用listen函数等待连接。等待服务器稳定运行后就可以调用connect函数向服务器发起连接了。注意: 客户连接请求是随机到达的异步事件, 所以服务器需要某种IO模型来监听这一事件, IO模型有多种, 比如select系统调用留

2021-12-01 19:38:30 323

原创 论我为什么要在win10家庭版上憨憨的安装docker-desktop并导致vmware不能用这件事。

为了部署一个数据增强的项目,我阴差阳错的安装了docker-desktop,最后也没用上。。。然后我的虚拟机出现了这个错误:VMware Workstation和Device / Credential Guard不兼容。禁用Device / Credential Guard后,可以运行VMware Workstation。找了很多教程,一个也没用上,具体总结就是docker-desktop是不能共存的,安装docker-desktop的时候回自动启动Hyper-V,这个服务在win10家庭版上是

2021-11-24 21:57:56 675

原创 (七)linux服务器程序规范

七 linux服务器程序规范7.1 日志linux提供了一个守护进程来处理系统日志–syslogd,不过现在的linux系统使用的都是他的升级版rsyslogd。rsyslogd守护进程既能接收用户进程输出的日志,又能接收内核的日志。用户进程通过syslog函数生成系统日志。syslog函数将日志输出到一个UNIX本地域socket类型的文件/dev/log中。rsyslogd则监听该文件来获取用户进程的输出。内核日志由printk等函数打印至内核的环装缓存中,环装缓存中的内容直接映射到/proc

2021-11-17 16:41:22 260

原创 (六)高级IO函数

六 高级IO函数6.1略6.2 dup函数和dup2函数dup函数和dup2函数可以将标准输入重定向到一个文件,或者重定向到一个网络连接(CGI编程),dup与dup2的作用就是用于复制文件描述符头文件: <unistd.h>调用方法:int dup(int file_descriptor);int dup2(int file_descriptor_one, int file_descriptor_two)dup函数创建一个新的文件描述符,与原有文件描述符指向相同的文件,管道,网

2021-11-15 19:35:23 806

原创 execve调用二进制文件

Linux系统提供了environ指针,通过其可以查看在程序中访问环境变量,在使用environ之前需要提前声明:extern char** environ;main(){ char** env=environ; while(*env){ printf("%s\n", *env++); } return;}运行结果是系统中的环境变量execve可以为程序指定新的运行环境,execve所在的头文件在unistd.h中,其函数原型为:int execve (const ch

2021-11-09 19:46:02 253

原创 访问github加速

windows: 首先访问最优IP地址 分别输入查看github.global.ssl.fastly.net和github.com对应的ip地址140.82.114.3 github.com199.232.69.194 github.global.ssl.fastly.net以管理员身份打开C:\Windows\System32\drivers\etc\ host文件,在最后写入上述内容,然后在命令行窗口中使用ipconfig /flushdns 刷新DNSLinu...

2021-10-26 20:43:14 176

原创 数据增强(python)(镜像)

import cv2import numpy as npfrom matplotlib import pyplot as pltimport osimport jsondef save(name, img): cv2.imwrite(name, img, [int(cv2.IMWRITE_PNG_COMPRESSION), 9])def create_newpic(oldname, newname): img = cv2.imread(oldname,cv2.IMREA.

2021-10-11 19:01:21 430

原创 检测文件夹中图片变动并添加同名json文件

import os, time, jsonpath_to_watch = "C:/Users/liuta/Desktop/jiancebianhua"before = dict ([(f, None) for f in os.listdir (path_to_watch)])while 1: time.sleep (5) after = dict ([(f, None) for f in os.listdir (path_to_watch)]) added = [f for f in a.

2021-09-29 10:18:19 98

原创 函数调用运算符

函数调用运算符1示例代码#include <iostream>using namespace std;class add {public: add(int x) : _x(x){} operator int() { return _x; }//类类型转换,将一个类转换为一个int值 add operator() (int y) { return add(_x + y); }//函数调用运算符 friend bool operator==(const int& a,

2021-09-23 21:50:38 445

原创 解决jupyter远程访问不了的情况

ssh -N -f -L localhost:本地端口:localhost:远程端口 hostname@ip地址

2021-09-23 11:14:43 641

原创 python处理json字符串之剔除某些label值

import osimport jsonfor file in os.listdir("./"): if file.endswith(".json"): with open(file,'rb') as load_f: load_dict = json.load(load_f) temp = load_dict['shapes'] for i in reversed(range(len(temp))): .

2021-09-19 21:16:04 415

原创 cv2 给图片加框框

##导包import cv2import numpy as npfrom PIL import Image, ImageDraw, ImageFont##读取图片img = cv2.imread('12323.bmp',cv2.IMREAD_GRAYSCALE)##显示函数def show(img): cv2.namedWindow('name',cv2.WINDOW_NORMAL) cv2.imshow('name',img) cv2.waitKey.

2021-09-19 21:12:27 853

原创 C++ Beeramid 啤酒金字塔

问题是:给定钱数,和啤酒单价格,可以摆几层啤酒金字塔,规律是每一层从头层开始数量为层数的平方数;解法一:#include <iostream>#include <cmath>using namespace std;int beeramid(int bonus, double price){ if (bonus < price) return 0; auto count = (bonus / price); int i = 0; while ((

2021-09-19 20:54:07 167

原创 C++ RGB To Hex Conversion(RGB转换16进制)(No.11)

要求:rgb(255, 255, 255) # returns FFFFFFrgb(255, 255, 300) # returns FFFFFFrgb(0,0,0) # returns 000000rgb(148, 0, 211) # returns 9400D3解法一:#include <iostream>#include <string>#include <sstream>#include <cctype>using

2021-09-13 22:15:02 1058

原创 python统计json文件中标签个数

list_label = []for file in os.listdir("./"): if file.endswith(".json"): with open(file,'rb') as load_f: load_dict = json.load(load_f) temp = load_dict['shapes'] for i in range(len(temp)):.

2021-09-06 13:30:09 1356

原创 C++ Tribonacci Sequence(前三个数之和)(No.10)

要求:返回类似斐波那契数列数列的数组。只是元素为前三个数之和解法一:#include <iostream>#include <vector>using namespace std;std::vector<int> tribonacci(std::vector<int> signature, int n) { vector<int> result; if (n <= signature.size()) { f

2021-09-02 21:47:56 140

原创 C++ Bouncing Balls(妈妈会看到球多少次)(No.9)

要求: 一个孩子正在一座高楼的 n 层玩球。该楼层的高度h是已知的。他把球扔出窗外。球反弹(例如)到其高度的三分之二(反弹 0.66)。他的母亲从离地面 1.5 米的窗户向外望去。妈妈会看到球在她的窗前经过多少次(包括它掉落和弹跳的时候)?解法一:#include <iostream>#include <cmath>using namespace std;class Bouncingball{public: static int boun...

2021-09-01 21:51:20 150

原创 C++ Moving Zeros To The End(将数字0移动到后边而不改变元素的相对位置)(No.8)

要求:move_zeros({1, 0, 1, 2, 0, 1, 3}) // returns {1, 1, 2, 1, 3, 0, 0}解法一:#include <iostream>#include <vector>#include <algorithm>using namespace std;std::vector<int> move_zeroes(const std::vector<int>& input.

2021-08-31 21:45:41 170

原创 C++ Number of trailing zeros of N!(计算尾随零数)(No.7)

要求:Exampleszeros(6) = 1# 6! = 1 * 2 * 3 * 4 * 5 * 6 = 720 --> 1 trailing zerozeros(12) = 2# 12! = 479001600 --> 2 trailing zeros解法一:#include <iostream>#include <cmath>using namespace std;long zeros(long n) { double kp.

2021-08-30 21:25:54 240

原创 C++ Stop gninnipS My sdroW!(字符数大于五的翻转)(No.6)

要求:Examples:spinWords("Hey fellow warriors") => "Hey wollef sroirraw" spinWords("This is a test") => "This is a test" spinWords("This is another test") => "This is rehtona test"Write a function that takes in a string of one or more words

2021-08-28 21:52:59 206

原创 C++ Convert string to camel case(No.5)

Examples"the-stealth-warrior" gets converted to "theStealthWarrior""The_Stealth_Warrior" gets converted to "TheStealthWarrior"解法一:#include <string>std::string to_camel_case(std::string text) { // TODO: Your code goes here! int l = text.s.

2021-08-28 21:10:10 145

原创 C++ Printer Errors (No.4)

class Printer{public: static std::string printerError(const std::string &s);};std::string Printer::printerError(const std::string& s) { vector<string> my_vec; int l = s.size(); for (int i = 0; i < l; i++) { ...

2021-08-25 21:31:35 120

原创 C++ 任意位整数提取数字,Playing with digits(No.3)

如上规律,提供初始幂次,返回倍数,如1、2、51.class DigPow{public: static int digPow(int n, int p);};int DigPow::digPow(int n, int p) { vector<int> my_array; int temp = n; int yushu; while (n >= 10) { yushu = n % 10; n = n / 10; my_array.push_bac...

2021-08-24 20:19:14 138

原创 C++拆分字符串,两两输出(No.2)

Complete the solution so that it splits the string into pairs of two characters. If the string contains an odd number of characters then it should replace the missing second character of the final pair with an underscore ('_').将字符串拆分为两个字符为一对,不足两个字符的,补齐一个

2021-08-20 21:54:12 341

转载 C++ 字符串string 转换成数字格式(No.1)

sstream头文件的作用:常用于字符串类型与数值的相互转换存在一字符串,内容为数字,相互之间以空格隔开,如何取出其中的最值#include <sstream>#include <vector>using namespace std;string highAndLow(const string& numbers){ int num; stringstream iss(numbers); vector<int> nums; w

2021-08-17 23:15:34 584

原创 信道与多径效应基础知识总结

信道的分类根据分类方法的不同,根据信道的组成,信道可分为狭义信道(是指信道的传输媒质)和广义信道(除了信道的传输媒质外还包括通信系统的某些设备),其中由调制器,传输媒质,解调器组成的广义信道称为编码信道,由发射机,传输媒质,接收机组成的广义信道称为调制信道。按照信号输入输出端类型可将信道分为连续信道(模拟信道)和离散信道(数字信道)。按照信道的物理性质可将信道分为无线信道,有线信道,光信道等。...

2020-04-03 23:52:22 7522

MSP430单片机常用模块与综合系统实例精讲

MSP430单片机常用模块与综合系统实例精讲

2018-07-15

空空如也

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

TA关注的人

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