自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 Python 的日志学习——logger模块

转自:https://www.cnblogs.com/yyds/p/6901864.htmlPython之日志处理(logging模块)本节内容日志相关概念 logging模块简介 使用logging提供的模块级别的函数记录日志 logging模块日志流处理流程 使用logging四大组件记录日志 配置logging的几种方式 向日志输出中添加上下文信息 参考文档一、日...

2019-11-18 11:59:36 544

原创 mac安装phpunit

1. 找到自己php版本对应的phpunit:终端输入下面命令,打印php版本信息:php -i将打印的信息粘贴到https://xdebug.org/wizard.php,得到对应的phpunit版本和安装信息。2. 下载phpunit按照上述步骤安装,有一些坑:(1)Downloadxdebug-2.7.2.tgz(2)解压:tar -xvzf xdebug-...

2019-08-20 10:15:31 543 1

转载 C/C++ 回调函数 讲解

原文链接:http://www.cnblogs.com/chenyuming507950417/

2019-08-19 10:55:07 219

转载 linux安装pywt模块

最近刚好用到pywt模块,看到网上的方法很多都不能使用,查看了官方文档之后,最终成功在python中成功导入pywt模块,因此在此记录安装过程,希望能够给有需要的人提供一些帮助!如果问题,欢迎私信讨论。第一步、安装wxpython在终端下输入下面的命令:sudo apt-get install python-wxgtk2.8第二步、安装PyWavele...

2019-05-20 22:01:13 1335

转载 pip已经安装,但是/usr/bin/pip: No such file or directory

解决方法1.which pip /usr/local/bin/pip 2.pip -su: /usr/bin/pip: No such file or directory 3.type pip pip is hashed (/usr/bin/pip) So pip is definintely in /usr/local/bin/pip but it is bee...

2019-05-16 10:53:41 3206

原创 TCP中Go Back N 重传和选择重传(SR协议)

理论:https://blog.csdn.net/qq_22238021/article/details/80325285SR协议理论上使用对于每个分组都使用一个计时器,但实际中在传输层只使用一个计时器来完成,需要一个ack数组记录窗口大小内分组是否被确认。...

2019-04-24 10:51:38 6581

原创 LeetCode: 521 Longest Uncommon Subsequence I(easy)

题目:anysubsequence of the other strings.Asubsequenceis a sequence that can be derived from one sequence by deleting some characters without changing the order of the remaining elements. Trivially...

2019-04-18 10:20:44 97

原创 LeetCode: 292 Nim Game(easy)

题目:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will b...

2019-04-18 10:20:38 119

原创 LeetCode: 136 Single Number(easy)

题目:Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using e...

2019-04-18 10:20:30 111

原创 LeetCode: 485 Max Consecutive Ones(easy)

题目:Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits are consecut...

2019-04-18 10:20:22 202

原创 LeetCode: 520 Detect Capital(easy)

题目:Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in ...

2019-04-18 10:20:14 119

原创 LeetCode: 371 Sum of Two Integers(easy)

题目:Calculate the sum of two integersaandb, but you arenot allowedto use the operator+and-.Example:Givena= 1 andb= 2, return 3.代码:使用移位来计算,用异或求不带进位的和,用与并左移1位来算进位,然后将两者相加。class S...

2019-04-18 10:20:04 102

原创 LeetCode: 258 Add Digits(easy)

题目:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + 8 = 11,1 + 1 = 2. Since2has only on...

2019-04-18 10:19:58 109

原创 LeetCode: 226 Invert Binary Tree(easy)

题目:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1代码:自己的(递归实现):/** * Definition for a binary tree node. * str...

2019-04-18 10:19:50 119

原创 LeetCode: 448 Find All Numbers Disappeared in an Array(easy)

题目:Given an array of integers where 1 ≤ a[i] ≤n(n= size of array), some elements appear twice and others appear once.Find all the elements of [1,n] inclusive that do not appear in this array....

2019-04-18 10:19:44 101

原创 LeetCode: 500 Keyboard Row (easy)

题目:Given a List of words, return the words that can be typed using letters ofalphabeton only one row's of American keyboard like the image below.Example 1:Input: ["Hello", "Alaska", "Dad", ...

2019-04-17 14:25:19 107

原创 LeetCode: 557Reverse Words in a String III(easy)

题目:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode cont...

2019-04-17 14:25:13 131

原创 LeetCode: 575 Distribute Candies(easy)

题目:Given an integer array withevenlength, where different numbers in this array represent differentkindsof candies. Each number means one candy of the corresponding kind. You need to distribute ...

2019-04-17 14:24:47 206

原创 LeetCode: 566 Reshape the Matrix

题目:In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.You're given a matrix represented by a two-...

2019-04-17 14:24:36 188

原创 LeetCode: 344 Reverse String

题目:Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".代码:自己的:class Solution {public: string reverseString(string...

2019-04-17 14:24:13 138

原创 LeetCode: 412 Fizz Buzz(easy)

题目:Write a program that outputs the string representation of numbers from 1 ton.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz...

2019-04-17 14:24:05 116

原创 LeetCode: 620 Not Boring Movies(easy)

题目:X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descriptions.Please write a SQL query to output mo...

2019-04-17 14:23:55 110

原创 LeetCode: 463 Island Perimeter(easy)

题目:You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is comple...

2019-04-17 14:23:42 103

原创 LeetCode: 496 Next Greater Element I(easy)

题目:You are given two arrays(without duplicates)nums1andnums2wherenums1’s elements are subset ofnums2. Find all the next greater numbers fornums1's elements in the corresponding places ofnum...

2019-04-17 14:23:35 100

原创 LeetCode: 637 Average of Levels in Binary Tree

题目:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Example 1:Input: 3 / \ 9 20 / \ 15 7Output: [3, 14.5, 1...

2019-04-17 14:23:24 90

原创 LeetCode: 476 Number Complement(easy)

题目:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note:The given integer is guaranteed to fit within the range ...

2019-04-16 13:09:10 118

原创 C++面试总结之数据库(二)

1.数据库优化实践中,MySQL的优化主要涉及SQL语句及索引的优化、数据表结构的优化、系统配置的优化和硬件的优化四个方面,如下图所示:(1)SQL语句及索引的优化<1>SQL语句的优化  SQL语句的优化主要包括三个问题,即如何发现有问题SQL、如何分析SQL的执行计划以及如何优化SQL。a.怎么发现有问题的SQL?(通过MySQL慢查询日志对有效率问题的...

2019-04-16 11:05:56 825

原创 C++面试总结之数据库(一)

1.数据库范式第一范式:列不可分,eg:【联系人】(姓名,性别,电话),一个联系人有家庭电话和公司电话,那么这种表结构设计就没有达到1NF;第二范式:有主键,保证完全依赖。eg:订单明细表【OrderDetail】(OrderID,ProductID,UnitPrice,Discount,Quantity,ProductName),Discount,Quantity完全依赖(取...

2019-04-16 10:51:03 3561

原创 C++面试总结之操作系统(二):内存管理

1.伙伴系统SLAB算法伙伴系统,其思想是:把内存块分成不同的组(1,2,4,8,16,32....);分配内存时找到能够满足条件的最小的块;如果找不到,就找大的块,然后一分为2,分配一块,留一块;回收时:如果有相邻的同样大小的块,则合并。Malloc实现原理:可以基于伙伴系统实现,也可以使用基于链表的实现•将所有空闲内存块连成链表,每个节点记录空闲内存块的地址、大小等信息...

2019-04-16 10:12:58 540

原创 C++面试总结之linux(三):select和epoll(重要)

1. 5种IO模型:(1)blockingIO-阻塞IO(2)nonblockingIO-非阻塞IO(3)IOmultiplexing-IO多路复用(4)signaldrivenIO-信号驱动IO(5)asynchronousIO-异步IO其中前面4种IO都可以归类为synchronousIO-同步IO,signaldrivenI...

2019-04-16 10:04:02 3703 1

原创 C++面试总结之网络(一)

1.HTTP协议HTTP:超文本传输协议,基于TCP/IP主要特点:(1)简单快速:客户向服务器请求服务时,只需要传递请求方法和路径(2)灵活:允许传输任意类型的数据对象(3)无连接:每次连接只处理一个请求,服务器处理完客户端请求并收到客户端应答后立即断开(4)无状态协议:协议对事物处理没有记忆能力(5)支持B/S和C/S模式HTTP1.0的请求方法:GETP...

2019-04-16 10:03:52 603

原创 C++面试总结之网络(二)

1.TCP中time_wait作用主动关闭的Socket端会进入TIME_WAIT状态,并且持续2MSL时间长度,MSL就是maximumsegmentlifetime(最大分节生命期),这是一个IP数据包能在互联网上生存的最长时间,超过这个时间将在网络中消失。MSL在RFC1122上建议是2分钟,而源自berkeley的TCP实现传统上使用30秒,因而,TIME_WAIT状态一般维持在...

2019-04-16 10:03:45 610

原创 C++面试总结之网络(三)

1.TIME_WAIT状态的产生、危害、如何避免?【答】TCP协议在关闭连接的四次挥手中,为了应对最后一个ACK丢失的情况,Client(即主动关闭连接的一方)需要维持time_wait状态并停留2个MSL的时间。危害:Linux分配给一个用户的文件句柄是有限的,如果系统中存在大量的time_wait状态,一旦达到句柄数上限,新的请求就无法被处理了,而且大量time_w...

2019-04-16 10:03:38 530

原创 C++面试总结之操作系统(一):进程与线程

同步机制:进程的同步:信号量、管程、互斥线程的同步:信号量、互斥量、消息、条件变量通信机制:进程的通信:管道、FIFO、消息队列、信号量、共享内存、SOCKET1.进程和线程的基本概念(1)进程(process):狭义定义:进程就是一段程序的执行过程。广义定义:进程是一个具有独立功能的程序关于某个数据集合的一次运行活动。进程是系统进行资源分配和调度的一个独立单元。...

2019-04-16 10:03:30 1202

原创 C++面试总结之操作系统(三):死锁

死锁、死锁产生的条件、怎么处理死锁、怎么预防死锁死锁:在两个或者多个并发进程中,如果每个进程持有某种资源而又等待其它进程释放它或它们现在保持着的资源,在未改变这种状态之前都不能向前推进,称这一组进程产生了死锁。通俗的讲就是两个或多个进程无限期的阻塞、相互等待的一种状态。1. 产生死锁的原因主要:(1)因为系统资源不足。(2)进程运行推进的顺序不合适。(3)资源分配不当等。...

2019-04-16 10:02:50 1118

原创 C++面试总结之linux(二)

1.指针的寻址过程数组是相同数据类型的数据集合,以线性方式连续存储在内存中,而指针只是保存一个地址值的4字节变量。在使用中,数组名是一个地址常量值,保存数据首元素地址,不可修改,因此只能以基地址访问内存数据。指针是一个变量,可以修改,随意访问内存数据。数组作为参数和返回值,都是将数组的首地址以指针的方式进行传递,但是它们也有不同。将数组作为参数时,其定义所在的作用域必然在函数调用以外,在调...

2019-04-15 15:26:32 205

原创 C++面试总结之linux(一):命令

1.linux如何查cpu使用率a.方法一:top命令在终端中直接执行top命令,即可看到cpu的使用率。(h查看命令帮助,q退出top).如果是多核CPU,希望查询每个CPU的使用率,可以在top命令的界面,按数字键1,即可看到其它CPU的使用率Top–H–p1003//查看线程b.方法二:vmstat命令vmstat是一个虚拟内存命令,但是本身也可以看到cpu...

2019-04-15 15:24:03 652

原创 C++面试总结之STL(一)

1.什么是STL?标准模板库(STL),它的基本概念就是把数据和操作分离,含有容器、算法、迭代器组件等。迭代器是容器和算法之间的粘合剂,使任何算法都可以和任何容器进行交互操作。在STL中体现了泛型程序设计的思想,是以类型参数化的方式实现的(模板)。STL中的容器:序列容器:vectorstringdequelist关联容器:setmapmulti...

2019-04-15 14:58:12 3404 1

原创 C++面试总结之C++语言特性(二)

1. New和malloc都能创建新的对象,区别在哪?哪个效率高(1)malloc/free是C++的标准库函数,new/delete是运算符(2)不能将执行构造函数和析构函数的任务强加给malloc/free,只能用new/delete(3)New返回指定类型的指针,malloc返回空指针再进行类型转换(4)new操作符从自由存储区(freestore)上为对象动态分配...

2019-04-15 14:45:00 237

原创 C++面试总结之C++语言特性(一)

1.Volatile提醒编译器它后面所定义的变量随时都可能改变,因此编译后的程序每次需要存储或读取该变量时,都从变量地址中读取数据。Volatile的作用:(1)阻止编译器为了提高速度将一个变量缓存到寄存器内不写回(2)阻止编译器调整操作volatile变量的指令顺序但是volatile能够阻止编译器调整顺序,也无法阻止CPU动态调度换序,例如:解决...

2019-04-15 12:00:39 1061

空空如也

空空如也

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

TA关注的人

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