- 博客(17)
- 收藏
- 关注
原创 Mysql的锁。
乐观锁线程在读取数据时对读取数据不进行加锁,在准备写会数据时,会先查询原值,操作的时候比较原值是否修改,若违背其他线程修改则写回,若已被修改,则重新执行读取流程。悲观锁悲观锁从宏观的角度,就是认为你是个渣男时刻会绿她,所以时刻防止你做坏事。(意思上是在字面意义上,只要有读取数据就会加锁)...
2020-05-18 22:27:07
165
原创 gorm的自定义主外键连接
package mainimport ( "fmt" _ "github.com/go-sql-driver/mysql" "github.com/jinzhu/gorm")//type PackageManagement struct {// Name string// Age int//}//////type ListNode struct {//...
2020-04-14 15:40:47
1553
原创 容器核心技术知识点整理
容器本身就是一个进程,通过Namespace、Cgroups和rootfs组成。namespace:对容器进行隔离,让他活在自己的世界 cgroups:在linux内核提供的一种可以限制单个进程的或者多个进程所使用资源的限制。 rootfs: 文件系统隔离,生产的镜像就是为容器提供的文件系统的根文件系统1. NamespaceNamespace是Linux内核从版本2.4.19开始陆...
2020-04-01 10:58:10
460
原创 基于Golang编写的词法分析
package mainimport ( "bufio" "fmt" "io" "os")var key = make(map[string]int)var ( FileName = "main.cpp" InputFile *os.File InputError error status = false)//初始化...
2019-11-17 23:04:26
695
2
原创 y=ax+b最小二乘c++实现
#include<iostream>#include<vector>typedef std::vector<std::vector<double>> Matrix;typedef std::vector<double> Line;Matrix getLsf(Matrix A, Matrix B);Matrix T(Matri...
2019-08-03 17:03:32
1314
原创 c++ socket 入门练手
#include<iostream>#include "winsock2.h"#pragma comment(lib,"ws2_32.lib")using namespace std;int main(){ int RetVal; WORD SocketVersion = MAKEWORD(2, 2); WSADATA wsd; if (WSAStartup(Soc...
2019-05-31 22:15:13
378
原创 八数码非优化版本的A*算法
#include<iostream>#include<queue>#include<cmath>#include<string>#include<utility>#include<vector>#include<time.h>#include<set>#include<map&g...
2019-05-19 16:12:06
194
原创 cifar的图像分类
import os#图像读取库from PIL import Image#矩阵运算库import numpy as npimport kerasfrom keras.layers import Dense,Dropout,Flattenfrom sklearn.preprocessing import LabelEncoderfrom keras.utils import np_...
2019-05-18 01:06:33
578
原创 VS2019+Opencv4.0+Win10配置
一.下载OpenCV4.0的安装文件:OpenCV官网然后安装到你想要的地方二.添加到Path里面:并且把文件opencv_world400.dll和opencv_world400d.dll文件复制到C:\Windows\SysWOW64这个文件夹;三.配置Vs2019环境(OpenCV4.0只能用x64配置)1.在把opencv的include添加到Inc...
2019-04-08 18:14:12
7002
8
原创 Win10系统安装Torch的方法
我选择的是Win10+Cuda9.0+Python3.7的安装conda install pytorch torchvision cudatoolkit=9.0 -c pytorch如果想选择pip3下载的话pip3 install https://download.pytorch.org/whl/cu90/torch-1.0.1-cp37-cp37m-win_amd64.whl...
2019-04-01 22:38:38
4003
2
原创 线段树
#include<iostream>const int MAX_LEN = 1000;void build_tree(int arr[], int tree[], int node, int start, int end) { if (start == end) { tree[node] = arr[start]; } else { int ...
2019-03-26 11:08:05
126
原创 Python用matplotlib绘制3D图片
from matplotlib import pyplot as pltimport numpy as npfrom mpl_toolkits.mplot3d import Axes3Ddef gauss(x, y, c1, c2): return np.exp(-1 * ((x - c1) ** 2 + (y - c2) ** 2) / 2)fig = plt.figure...
2019-03-15 12:23:21
848
原创 golang的append
package mainimport "fmt"func main(){ a:=make([]int,1) fmt.Println(a) a=append(a,2)//len=2,cap=2 fmt.Println(a) a=append(a,3)//len=3,cap=4 b:=append(a,4)//len=4,cap=4 a=append(a,3)//len=4,c...
2018-08-31 22:44:07
1449
原创 判断链表是否有闭环,并且出现了,得到闭环位置
用快慢指针判断是否有;慢指针每次都slow=slow->next;而快指针每次都quick=quick->next->next;如果slow==quick;则得到有闭环存在着;设x为在闭环里面走的步数,c为闭环的长度,a链表头部到闭环入口点假设慢指针走的步数为slow=x+m*c+a假设快指针走的步数为quick=x+n*c+a又因为2*slow=...
2018-07-17 11:47:30
3978
原创 简单用golang实现链表
package mainimport "fmt"type Node struct{ key interface{} next *Node}type Link struct { root *Node}type linkMethod interface { addValue(value interface{}) findValue(value interface{})*N...
2018-07-16 13:49:52
536
原创 快排写法
#include<algorithm>#include<functional>void f(int start, int end, int *num) { if (start >= end)return; int point = start; for (int i = start; i < end; i++) { if (point == -1 &...
2018-05-18 00:52:49
244
原创 POJ 1837-Balance
http://blog.csdn.net/lyy289065406/article/details/6648094(参考此人代码和思路)#include <iostream> #include <cstdio> #include <cstring>using namespace std;int weightNum;int hookNum;in...
2018-03-10 11:24:08
194
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人