自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 链表环路判断(Floyd判圈算法)

如何判断一个单链表是否有环?如果有环找到环路入口。第一个问题对应LeetCode的141题。给你一个链表的头节点 head ,判断链表中是否有环。 如果链表中有某个节点,可以通过连续跟踪 next 指针再次到达,则链表中存在环。 为了表示给定链表中的环,评测系统内部使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。注意:pos 不作为参数进行传递 。仅仅是为了标识链表的实际情况。 如果链表中存在环 ,则返回 true 。 否则,返回 false 。 找两个

2022-03-18 09:50:28 704

原创 Unboxing of ‘redisTemplate.hasKey(xx)’ may produce ‘NullPointerException’的处理

idea对下边的代码做出了一个提示:redisTemplate.hasKey(key)提示说 Unboxing of redisTemplate.hasKey(key)may produce NullPointerException.网上搜了下,参考了博文Unboxing of ‘stringRedisTemplate.hasKey(xx)‘ may produce ‘NullPointerException‘ 警告_初级码农-CSDN博客先看下hasKey的代码:public Bo

2021-12-22 09:16:12 6399 4

原创 记一次因地球自转导致的数据库异常

  最近遇到一个Error:Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect).  看字面意思是要更新的这一行记录已经被其他更新或者删除了。网上查了很多大家世代相传的资料。一般认为并发或者当前数据版本小于数据库数据的版本。但是我想了想,自己单机测试咋会出现这个问题。于是根据报错信息开始了漫长的调试研究过程。  由于研究过程太长,在这里直接放出研究结果。  开发环境:spri

2021-07-17 10:08:46 288 2

原创 Kubernetes权威指南(纪念版)踩坑勘误记录

目录前言第二章 Kubernetes实践指南2.1Kubernetes安装与配置前言最近在对着《Kubernetes权威指南(纪念版)》学习,但是这本书用的k8s是1.6版,作者用的是1.8版,中间产生了一些不一致的地方,为此开贴记录持续更新。第二章 Kubernetes实践指南2.1Kubernetes安装与配置作者用的二进制安装方式。2.1.3节(57页) kubelet的配置参数书中有一项是–api-servers,但是这个参数在1.8以后已经去掉了,改成–address2.1.4节(

2020-12-21 15:20:24 501

原创 Ubuntu安装k8s的一些坑

参考博客:Ubuntu16.04安装K8s步骤和踩坑记录【k8s】2-安装部署 以及flannel访问失败问题 The connection to the server raw.githubusercontent.com was refused - did you specify the right host or port?K8S集群 NOT READY的解决办法 1.13 错误信息:cni config uninitialized本次搭建用了三台机器,修改/etc/hosts文件添.

2020-09-21 12:25:35 1059 1

原创 命令行安装的python包不被pycharm识别

参考链接:https://www.zhihu.com/question/373781465/answer/1034511974命令行装了个MySQLdb,但是PyCharm似乎不识别。去file->setting->interpreter看看,发现project下有这个包:根据知乎大佬指引,需要修改下项目配置文件。打开venv下的pyvenv.cfg文件...

2020-05-03 10:46:10 690 1

原创 Ubuntu 指令源码获取

需要研究下ping指令的源码实现,于是先获取下指令的源码。1.查看指令所属的包dpkg -S $(which ping)得到结果,ping指令在iputils-ping包中iputils-ping: /bin/ping2.获取包的源码(root权限):sudo apt-get source iputils-ping最后报了一个错误:W: Download...

2020-03-04 12:21:49 449

原创 ip最长匹配原则的一种实现

路由转发时需要根据最长原则进行转发,但是RFC并没有给出算法具体是如何实现的,为此自己胡乱想了个算法。首先定义两个数据结构class IP: ipArr,mask = [0,0,0,0],0 def __init__(self,ipStr): self.ipArr,self.mask = tranStrIP(ipStr) def ipToNumbe...

2019-12-03 22:47:20 903

原创 前缀表达式,中缀表达式,后缀表达式的一点微小理解

文章目录中缀表达式前缀表达式前缀求值中缀变前缀前缀变中缀后缀表达式中缀变后缀后缀变中缀后缀求值中缀表达式    中缀即我们平时用的数学表达式,其递归定义为中缀表达式 运算符 中缀表达式。举例:1+2,(1+2)*(3+4).这种表达式便于直观理解但是不方便计算机计算。后来有波兰人发明了前缀,后缀表达式。前缀表达式也叫波兰式,后缀表达式也叫逆波兰式。前后缀表达式经常作为栈在优先级的应用的例题。...

2019-05-11 18:53:13 1926 2

原创 《汇编语言》 王爽 第三版 习题答案

目录第一章检查点1.1第一章检查点1.1131024,0-10238192(8K),1024(1K)230,220,21064,1,16,41,1,2,2,4512(8086有16根线,每次2B),256二进制

2019-04-15 19:30:57 6064 1

原创 error while loading shared libraries: ***.so: cannot open shared object file

这个问题具有一定的代表性,不仅仅我遇到的场景出现了这个错误,别的场景也可能。编译intel sgx的示例代码时候出现了这样的错误编译的时候找不到这个so文件,但事实上是存在的。于是做两个操作① 把缺失的so文件拷贝到/usr/local/lib ② 编辑 /etc/ld.so/conf,把/usr/local/lib路径加进去保存后运行ldconfig即可...

2019-04-13 16:20:36 1191

原创 Ubuntu版Navicat出现乱码问题的方法

参考博客:https://blog.csdn.net/sinat_26546385/article/details/80381282#commentsedit,但是原博客有一点没说清楚。首先进去是乱码,原因是字体问题选择选项,最上边第五个然后选择选项,也就是最后一个中间蓝色那里是字体,需要修改成Noto Sans mono CJK SC Regular,注意还有个字体是...

2019-03-20 11:23:34 236

原创 怎样部署Hyperledger Fabric多节点(二)

在各众多学弟和作者的一通瞎捣鼓下,我们又做了一点微小的工作。现在记录下多节点部署的一些事情。本文主要参考http://www.cnblogs.com/studyzy/p/7237287.html这次瞎捣鼓一共用了5台服务器,具体参数如下,具体ip地址以ip0,ip1……代替:ip 节点标志 hostname organization ip0 orderer...

2018-12-05 18:59:39 632

原创 怎样部署Hyperledger Fabric多节点(一)

 北冥有鱼,其名为鲲。鲲之大,不知其几千里也;化而为鸟,其名为鹏。鹏之背,不知其几千里也;怒而飞,其翼若垂天之云。——《庄子·逍遥游》既然要部署多节点,那么首先就要部署单节点。作者同某个师弟胡乱捣鼓了一通,在本地虚拟机,腾讯云,阿里云,vultr(都是ubuntu,有16也有18)上都已经完成了部署,为了方便后人写下此文。git安装       略    golang安装     ...

2018-12-03 18:53:17 1098 4

原创 LeetCode 698 Partition to K Equal Sum Subsets

Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal.Example 1:Input: nums = [4, 3, 2, 3, 5,...

2018-08-21 00:09:51 180

原创 以太坊源码学习

https://github.com/hilbert25/EthereumAnalysis直接放到git上了,不定期更新。

2018-04-23 20:36:25 338

原创 以太坊智能合约开发(truffle box pet-shop为例)

开发环境    我在ubuntu环境下开发的,建议装好vscode,nodejs 。选用别的编译器也可以。    装好nodejs后装一下truffle。    npm install -g truffletruffle version    可以看到版本号,说明安装成功。开发语言    本文选用solidity,现在以太坊智能合约开发主流语言,不过比较新东西,和c...

2018-03-17 11:49:08 3883 4

原创 LeetCode 496 Next Greater Element I

You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2. T...

2018-02-18 18:31:18 176

原创 LeetCode 153 Find Minimum in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate exis...

2018-02-15 11:23:17 150

原创 LeetCode 689 Maximum Sum of 3 Non-Overlapping Subarrays

In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum.Each subarray will be of size k, and we want to maximize the sum of all 3*k entries.Return the result ...

2018-02-15 10:24:21 298

原创 LeetCode 621 Task Scheduler

Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original order. Each task could b...

2018-02-15 10:08:10 170

原创 LeetCode 287 Find the Duplicate Number

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, fi...

2018-02-15 09:58:47 162

原创 LeetCode 718 Maximum Length of Repeated Subarray

Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1:Input:A: [1,2,3,2,1]B: [3,2,1,4,7]Output: 3Explanation: The repeated sub

2018-01-28 23:32:54 212

原创 LeetCode 122 Best Time to Buy and Sell Stock II

这个题和Best Time to Buy and Sell Stock 是有关的。先看下Best Time to Buy and Sell Stock II:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitt

2018-01-23 14:56:35 131

原创 LeetCode 532 K-diff Pairs in an Array

Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers in

2018-01-23 14:38:58 175

原创 LeetCode 169 Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2018-01-21 16:36:30 177

原创 LeetCode 667 Beautiful Arrangement II

Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requirement: Suppose this list is [a1, a2, a3,

2018-01-21 00:05:38 183

原创 LeetCode 541 Reverse String II

Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of th

2018-01-14 17:08:10 206

原创 LeetCode 448 Find All Numbers Disappeared in an Array

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.

2017-12-23 22:45:14 132

原创 堆排序(Python)

堆排序的Python实现

2017-12-11 11:50:39 339

原创 两个版本的快速排序

算法导论版和严蔚敏版

2017-12-11 10:45:30 336

原创 Bash Shell

alias:命令别名设置,如:alias lm='ls -al' ,等号两侧不能有空格。在终端里使用的话只对本次登录有效,~/.bashrc里可以永久设置。此时可以用lm 代替 ls -al变量显示与设置:echo变量显示,echo $HOME或echo ${HOME}。  设置变量直接用等号,

2017-12-05 23:05:31 159

原创 Linux文件权限

chgrp的组名必须在 /etc/group有chown的组名必须在/etc/passwd有能不能进入一个目录只与x权限有关,必须有x权限才能进入目录(r w都不行)只有r权限可以读取目录的文件名列表,但是详细信息读取不到w和删除更新创建有关系/dev下是与系统外设存储有关的文件Linux默认Ext2/Ext3文件系统,单一文件名或者目录名长度255字符,包含路径的完整文件

2017-11-21 00:21:46 194

原创 记一次坑爹的爬虫经历

需求:有这样一个网站:http://www.5er0.com/.网站可以搜索有关电影电视剧有关的信息或者下载链接。现在要输入一个video name,爬到其下载链接。首先我们打开网站首页:看到有个搜索框,我们尝试输入战狼并点击搜索,得到结果如下:既然爬虫我们就要看一下数据是如何请求的,回到首页,审查元素查看搜索框的元素:看到这是一个post表单。再看搜索结果页...

2017-11-06 18:40:02 3892 2

原创 Python基础教程(6)抽象

文档化函数:def f(): 'print hello' print "hello"print f.__doc__

2017-10-17 22:48:00 211

原创 Python基础教程(5)条件、循环和其他语句

for遍历字典:d={'x':1,'y':2,'z':3}for k,v in d.items(): print k,v并行迭代:a=[1,2,3]b=[4,5,6]for x,y in zip(a,b): print (x,y)zip是把list压缩到一起enumerate。对于一个可迭代的(iterable)/可遍历的对象(如列表、字符串),enumerate将其组成一个索引序列

2017-10-17 22:17:25 259

原创 Python基础教程(4)字典

关键字方式创建字典d=dict(name='tom',age=20)d{'age': 20, 'name': 'tom'}key必须是不可变类型,数字字符串元组字典格式化字符串d={'a':123}print '%(a)d'%d123copy:返回一个相同键值对的新字典,但是这个是浅拷贝。如果对副本值进行替换,原字典不受影响:a=dict(name='jzm',age=90)b=a.co

2017-10-17 20:49:55 297

原创 Python基础教程(3)字符串

字符串不可变,因此不可分片赋值转换说明符%:>>> a='a%sb'>>> a%'b''abb'>>> find:子串查找:>>> a='fdfadsafd'>>> a.find('fd')0>>> 连接序列中的元素:join:>>> a=['1','2','3']>>> '.'.join(a)'1.2.3'#必须是str不能是int替换单个字符 translate

2017-10-16 22:57:31 489

原创 Python基础教程(2)列表和元组

列表可修改,元组不可修改,因此列表不可做字典的键序列(列表和元组)、映射(字典)都属于容器通用序列操作:索引,分片,加,乘,判断元素是否属于序列等删除>>> name=['a','b','b']>>> del name[2]>>> name['a', 'b']分片:>>> list("naive")['n', 'a', 'i', 'v', 'e']append:在列表尾部加元素co

2017-10-16 21:46:01 199

原创 Python基础教程(1)

python3普通除法:1/2=0.5(python2 是0)整除:1//2=0十六进制表示:0xAf(175)八进制表示:0o10(0o开头,十进制的8)获取输入:x=input("x:")raw_inpurt()#string四舍五入:roundround的坑:python2中round(0.5)=1,python3中round(0.5)=0.p

2017-10-16 21:19:43 604

空空如也

空空如也

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

TA关注的人

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