- 博客(12)
- 收藏
- 关注
原创 centOS下安装redis、docker
1. 将Redis上传到 /tmp 文件下首先在自己电脑上下载好最新版redis,然后上传到服务器的/tmp文件夹下,执行如下操作cd /tmp/tar -zvxf redis-6.2.5.tar.gz 将完全解压缩mv redis-6.2.5 /usr/local/redis 将解压后的文件夹移动到这个文件夹并重命名cd /usr/local/redis/ 切到这个文件夹make -j 4 使用4个cpu编译redismake install 将编译完成的可执行文件添加到系统目录
2021-08-14 13:00:08
357
原创 Java实现生产者消费者的几种方法
目录信号量实现(Semaphore)管程实现(Synchronized)JUC实现(ReentrantLock + Condition)Condition实现按序消费信号量实现(Semaphore)public class DemoSemaphore { public static void main(String[] args) { Item item = new Item(); ExecutorService threadPool = Executors.ne
2021-08-02 20:47:57
289
原创 Java并发编程中的虚假唤醒后果演示以及避免方法
虚假唤醒,就是线程在争夺物品合法性操作时选择了 if 进行判断,出现了消费了没有的物品的现象。演示如下我们假设一共有三个线程A、B、CA 是生产线程,靠condition1(见代码)控制B、C 是消费线程,靠condition2(见代码)控制执行的代码如下所示public class Demo { public static void main(String[] args) { Data data = new Data(); new Thread(()
2021-08-02 12:09:35
193
原创 常用编程软件下载安装使用精品教程汇总
softwareIDEAMySQL5IDEAIDEA卸载安装使用MySQL5MySQL5.7下载、安装和配置
2021-04-10 11:36:27
823
原创 IDEA卸载安装使用
文章目录1. 卸载2. 安装2.1 maven设置2.2 其他设置快捷键很全面的设置1. 卸载直接从系统卸载删除C:\software\IntelliJ IDEA 2020.2.1C:\Users\94122\AppData\Roaming\JetBrains2. 安装官网下载:地址安装:只需要选择此选项C:\software\IntelliJ IDEA\bin\idea.properties修改配置位置idea.config.path=F:/software/.I
2020-10-19 21:21:25
1114
原创 通过数据结构实现对队列的一般操作
队列1. 静态循环队列2. 链式队列1. 静态循环队列代码:# include <stdio.h># include <malloc.h># include <stdlib.h># include <stdbool.h>typedef struct Queue { int *pBase; int front; ...
2020-03-11 19:14:31
150
原创 python中继承的关于构造函数问题
子类继承父类后,可以选择是否调用父类的构造函数(即__init__函数)。1. 不调用父类构造函数如果子类不想调用父类的构造函数,就需要写出自己的构造函数:class Parent(object): def __init__(self, number): self._number = str(number) self.call_number() ...
2020-03-11 14:30:46
1130
2
原创 通过数据结构实现对栈的一般操作
代码:# include <stdio.h># include <malloc.h># include <stdlib.h># include <stdbool.h>typedef struct Node{ int data; struct Node * pNext;}NODE, * PNODE;typedef struct ...
2020-03-11 11:28:23
96
原创 通过数据结构实现对链表的一般操作
代码:# include <stdio.h># include <malloc.h># include <stdlib.h># include <stdbool.h>typedef struct Node{ int data; //数据域 struct Node * pNext; //指针域}NODE, *PNODE; //NOD...
2020-03-10 16:01:04
127
原创 通过数据结构实现对数组的一般操作
代码:# include <stdio.h># include <malloc.h># include <stdlib.h># include <stdbool.h>struct Arr{ int *pBase; int len; int cnt;};void init_arr(struct Arr *, ...
2020-03-09 14:34:01
145
原创 装完win10和ubuntu双系统后要做的事
文章目录1. 双系统时间同步调整2. 开机默认启动项调整1. 双系统时间同步调整在ubuntu下更新一下时间:sudo apt-get install ntpdatesudo ntpdate time.windows.com然后将时间更新到硬件上:sudo hwclock --localtime --systohc完成。2. 开机默认启动项调整sudo gedit /etc/...
2020-02-29 22:56:40
358
原创 JavaScript中的this指针
文章目录1. 全局对象2. this3. apply和call1. 全局对象在说this之前,首先要知道,在JavaScript中,有一个默认是全局对象window。例如,我们定义了一个全局作用域的变量x:var x = 'hello javascript';那么我们所定义的x实际为window.x。JavaScript中函数也是变量的一种。2. this如果在一个对象中,将对象中...
2020-02-26 20:01:22
305
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人