Laravel Redis分布式锁的使用 创建锁 use Illuminate\Support\Facades\Cache; $lock = Cache::lock('foo', 10); if ($lock->get()) { // 处理业务逻辑 sleep(3); $lock->release( ...
分类:
其他好文 时间:
2020-07-09 22:22:13
阅读次数:
117
Description Given an array of integers A, find the number of triples of indices (i, j, k) such that: 0 <= i < A.length 0 <= j < A.length 0 <= k < A.le ...
分类:
其他好文 时间:
2020-07-09 19:24:31
阅读次数:
58
功能描述: 查找:查找指定字符串是否存在 替换:在指定的位置替换字符串 函数原型: int find(const string& str,int pos = 0) const; //查找str第一次出现位置,从pos开始查找 int find(const char* s,int pos = 0) c ...
分类:
其他好文 时间:
2020-07-09 12:28:37
阅读次数:
72
一、类及对象 1. 类的组成成分 属性(成员变量,Field) 方法(成员方法,函数,Method) 2. 属性 成员变量 vs 局部变量 相同点: 遵循变量声明的格式: 数据类型 变量名 = 初始化值 都有作用域 不同点: 声明的位置的不同 :成员变量:声明在类里,方法外, 局部变量:声明在方法内 ...
分类:
编程语言 时间:
2020-07-08 22:58:36
阅读次数:
57
from functools import reduce import re def remove_addsub(exp): s=re.findall("[+-]?\d+(?:\.\d+)?",exp) return reduce(lambda a,b:float(a)+float(b),s) s= ...
分类:
其他好文 时间:
2020-07-08 22:51:48
阅读次数:
68
laravel 关联模型 多态关系 一对一(多态) note 1个关联上从属于多个模型,如:博客post和用户user共享1个关联图片image。 1篇博客拥有1张主图 1个用户拥有1个头像 graph LR image(图片) image --> |imageable_id=post.id<br> ...
分类:
其他好文 时间:
2020-07-08 19:57:33
阅读次数:
52
1.Cannot find module 'swiper' 我也就试了下github上的demo啊,哪错了?? 好的,再去下载swiper,轮播图能显示了 让我们再来试试下面的小点点 不管是 pagination: { el: '.swiper-pagination' } 还是 pagination ...
分类:
其他好文 时间:
2020-07-08 19:31:13
阅读次数:
118
1压缩图片使用ImageMagick的convert命令进行压缩图片,一般只需要一个指定压缩质量的参数,比如:convert-quality751.jpg1_compress.jpg可以支持压缩jpg/png/jpeg。2递归压缩递归压缩使用find配合grep列出所有的图片,接着通过一个循环传递给convert进行压缩。originalPic=`find$compressDir|grep-iE"
分类:
系统相关 时间:
2020-07-08 18:06:22
阅读次数:
55
Maximum Gap Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains le ...
分类:
其他好文 时间:
2020-07-08 15:25:35
阅读次数:
52
ctrl+alt+T #打开终端 sudo halt #关机 sudo reboot #重启 软件信息: cat /etc/issue #查看linux内核版本 cat /proc/version lsb_release -a #查看ubuntu发行信息 硬件信息: cat /proc/cpuinf ...
分类:
系统相关 时间:
2020-07-08 15:00:39
阅读次数:
84