自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 download sources报错:Cannot connect to the Maven process.

报错:Cannot connect to the Maven process. Try again later. If the problem persists, check the Maven Importing JDK settings and restart IntelliJ IDEA可能的原因:项目的jdk和jdk for importer版本不一致改成与项目所用jdk版本一致...

2021-10-31 11:16:43 4423 8

原创 Spring实战运行第六章代码笔记(1)

一、连表查询时Unknown column ‘ingredient0_.taco_id’ in 'field list’错误Taco类中有Ingredient相关字段: @ManyToMany(targetEntity=Ingredient.class) @Size(min=1, message="You must choose at least 1 ingredient") private List<Ingredient> ingredients;依据Taco_Ingredie

2021-10-30 23:26:13 279

原创 ERROR 2002: Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2)

一个可能的原因是本地mysql server未开启解决方案:查找mysql位置(base) dingguoming@dingguomingdeMacBook-Air ~ % which mysql/Library/mysql-8.0.26-macos11-arm64/bin/mysql2.开启server(base) dingguoming@dingguomingdeMacBook-Air mysql-8.0.26-macos11-arm64 % cd /Library/mysql-8.0

2021-10-19 23:22:59 145

原创 macOS终端中python和conda中python版本不一致

问题描述在mac系统终端中执行conda activate MYENV(版本为python3.7)之后,再输入python -V,结果显示python3.9原因在安装conda之前,因为不想用mac自带的python2.7,所以在~/.bash_profile中更改默认python命令的位置:alias python="/Library/Frameworks/Python.framework/Versions/3.9/bin/python3",conda执行activate指令后,会在环境变量中动

2021-08-06 19:04:05 1377

原创 java并发编程实战程序5-19

验证Java并发编程实战程序清单5-19中memorizer.compute对于相同参数的请求只有一个能进Mapimport org.junit.Test;import java.util.concurrent.*;public class LearnFutureTask { @Test public void test() throws InterruptedException { Memorizer<String, Integer> memoriz

2021-06-14 16:03:20 1097 1

原创 Java对象引用按值传递

一个casepublic class dd { @Test public void testSwap(){ Person dgm = new Person("dgm"); Person noob = new Person("noob"); Util.swap(dgm,noob); System.out.println(dgm.toString()); System.out.println(noob.toStri

2021-05-22 11:25:04 213

原创 java正则表达式的简单用法

规则正则表达式规则可以匹配A指定字符A\u548c指定Unicode字符和.除\n外的任意字符a,b,&,0\d数字0~90~9\w大小写字母,数字和下划线a~z,A~Z,0~9,_\s空格、Tab键空格,Tab\D非数字a,A,&,_,……\W非\w&,@,中,……\S非\sa,A,&,_,……正则表达式规则可以匹配A*任意个数字符空,

2021-05-21 10:34:02 87

原创 在外部js中对vue内容进行修改

问题描述在某个js文件中定义了一个函数func,并export,在vue中import func,在func中有一个监听器,需要在click事件发生时执行某个操作,但是这个操作是在vue中执行的,也就是说监听器定义在外部js的函数中,而触发的操作需要在vue中完成。解决一开始是想用一个全局变量(例如window.localStroage.setItem)在click事件触发时存储相关参数,然后在vue中监听这个参数,发生改变时,执行vue中的处理函数。但是遇到了一些问题,并且最后也没有成功。后来想到

2021-03-08 11:54:53 2989

原创 实例化Servlet类异常

如果用的是tomcat10版本的话,可能是因为tomcat/lib中的servlet-api.jar与maven中导入的servlet包不兼容。可以把tomcat降级为9版本,或者在项目中手动导入tomcat安装目录下lib中的servlet-api包

2021-02-23 15:50:26 6848 8

原创 支持向量机详解及代码(SMO算法)

基本上相当于把课本内容又整理了一遍,当然有些地方理解的不够清楚,可能有错误,看到了请指正_。因为不太会markdown的语法,所以直接用word写了截的图,doc文件和代码在这里C = 1threshold = 1e-8 # 确保选择的a2使得损失函数有足够的下降eps = 1e-30# 参数顺序:K,b,alpha,ydef getL(K, alpha, y): # 获取当前损失函数值 l = 0 for i in range(le

2020-11-14 16:09:48 1801

原创 决策树实现(CART生成及剪枝)

这个代码是可以直接运行的,数据集在github链接下的breast_cancer.csv,把代码和数据集放到同一目录下就好了或者:百度云链接,提取码:eu8q详细分析和完善下周日再写吧,感觉复杂度好高啊。。。。。。import numpy as npimport copy as copyclass Node(object): def __init__(self): self.left = None self.right = None self

2020-10-25 19:01:40 793

原创 31. 下一个排列

挖坑class Solution { public void nextPermutation(int[] nums) { int i = nums.length - 1; for(;i > 0; i--){ if(nums[i] > nums[i - 1])break; } int pos = i; if(i > 0){ for(int j = i +

2020-10-20 23:47:22 78

原创 33. 搜索旋转排序数组

class Solution { public int search(int[] nums, int target) { int left = 0,right = nums.length - 1; int pos = -1; while(left < right){ int mid = (left + right) / 2; if(mid == left){ //此时right = left + 1

2020-10-20 23:40:12 67

原创 KNN

理论知识是参考的《统计学习方法》代码基本上是参考别人写的,然后整理的。先占个位置,周日写,别忘了。

2020-10-13 15:32:23 82

原创 朴素贝叶斯

理论知识是参考的《统计学习方法》第四章def bayes(X,y,y_set,xi): #X是训练数据的输入,y是训练数据的分类,y_set是所有的分类,xi是预测数据的输入 dictY = {} #记录每一个类的输入 dictY[Ck]包含了所有分类为Ck的输入数据 pY = {} #记录每一个类的出现次数 ∑I(y=Ck) maxP = 0 pred = 0 #预测值 #依据不同的概率模型,P(x|y)的计算方式也不同,这里与书上的计算方法相同

2020-10-13 15:30:29 86

原创 感知机

理论知识是参考的《统计学习方法》代码需要用到numpy和matplotlib.pyplotimport numpy as npimport matplotlib.pyplot as pltdef perceptron_v2(x,y,mu): omg = np.zeros((1,x.shape[1])) #omg与x维度相同 b = 0 finish_flag = False while finish_flag == False: finish_fla

2020-10-08 15:51:28 95

原创 梯度下降法

目标:在无约束条件下求解minf(x),注意这里的x不一定表示一个数,也可能是向量。方法:由高等数学的知识,沿着梯度方向函数值增长最快,那么沿负梯度方向函数值减少最快。选择合适的初值x0,每次都沿当前位置的负梯度方向更新变量的值,产生新的x,直到相邻两次迭代的f(x)值足够接近。算法:输入:f(x)表达式,计算精度ε输出:满足精度要求的x值步骤1、选择初值x0,计算x0处的梯度值▽f(x0)2、计算x1的值,x1 = x0 -λ*▽f(x0),其中λ>=0,并且λ取使f(x1)的值最

2020-09-17 15:58:17 261

原创 js在ie中正常而在edge中不执行

在学习《JavaScript DOM编程艺术》第11章时遇到的问题。一开始项目的结构是这样的:用到的modernizr.custom.72105.js在day11文件夹的上层的上层。运行时在ie里可以正常实现灰度和彩图的切换,而在edge和firefox里则一直显示彩图。后来将modernizr.custom.72105.js添加到项目中:这时在edge、firefox、Google浏览器中都可以正常运行了。但是这是为什么呢???...

2020-07-20 17:51:07 1386

原创 《python数据分析与挖掘实战》第五章syntax error in line 1 near

用记事本打开dot文件并修改,不要用word

2020-07-08 09:18:13 1346

原创 《Python数据挖掘入门与实践》学习笔记-第1章

根据植物的特征预测其属于哪一种这个例子是要干什么?对于里面的各种数据关系,我看好几遍才搞明白。我觉得先理解原理,再去看具体的代码会比较容易一点。  iris的数据集里有三类花(标记为0,1,2),每一类花都有四个特征项(萼片、花瓣的长和宽,标记为0,1,2,3),原始数据中,每一个特征项有多个不同的取值(特征值)。这里要先提一下预处理或者说离散化,目的就是将这些特征值离散为两个值:0和1,方法就是将每一个特征值与该特征项所有值的平均数attribute_mean比较,小于的设为0,大于等于的设为1。

2020-05-31 17:05:16 491

原创 python中round()函数的进位规则

帮助文档里说了,当向上取整与向下取整的距离一样时(就是x.5的情况),向偶数方向取整。但是接下来又出现了一个反例:这因为2.68、2.67不能用二进制数准确表示,所以在round的过程中会有截断,具体的截断机制就不清楚了,但是知道round(2.675,2)为什么不是2.68就行了。...

2020-05-23 09:02:57 1638

原创 CAD图纸打印不出来

cad图纸打印不出来是怎么回事呢?cad图纸相信大家都很熟悉,但是cad图纸打印不出来是怎么回事呢,下面就让小编带大家一起了解吧。  cad图纸打印不出来,其实就是cad图有些图层打印不出来,大家可能会很惊讶cad图纸怎么会打印不出来呢?但事实就是这样,小编也感到非常惊讶。  这就是关于cad图纸打印不出来的事情了,大家有什么想法呢,欢迎在评论区告诉小编一起讨论哦!  我遇到的情况是,有一个图层的名字是Defpoints,这个图层上的东西是打印不出来的。解决方法:重命名该图层。...

2020-05-21 10:29:11 1396

原创 万花尺轨迹性质研究

因为快毕业了,把本科期间做过的一些有意思的小作业整理一下1、轨迹方程将万花尺简化为下图:笔尖位于A点,子尺(动系)的圆心为C(动点),半径为b,母尺的圆心位于O点,半径为a,显然万花尺画出的图案与笔尖的运动速度无关,故设副尺以恒定角速度ω(设为顺时针方向)转动。设C点坐标为(Xc,Yc),A点相对于C点的坐标为(Xr,Yr),A点在XOY在坐标系中坐标为(X,Y),子尺,母尺及笔落点的位置关系如下图所示。由于子尺与母尺接触点是瞬心,所以C点的运动速度为ωb,方向与OC连线垂直,则C绕O点转动的角速度

2020-05-13 16:24:35 2102

原创 1067 Sort with Swap(0, i) (25分)运行超时

Given any permutation of the numbers {0, 1, 2,…, N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, 0, 2...

2020-04-29 11:48:32 191

原创 1054 The Dominant Color (20分)

Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the d...

2020-04-22 11:10:45 90

原创 1044 Shopping in Mars (25分)

Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can be cut at any position ...

2020-04-17 11:00:12 195

原创 1038 Recover the Smallest Number (30分)cmp函数

Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recover many numbers such like 32-321-3214-0229...

2020-04-16 12:17:15 88

原创 1034 Head of a Gang (30 分)dfs或并查集

One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be t...

2020-04-12 21:47:23 129

原创 1014 Waiting in Line (30分)队列的应用

Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:The space ...

2020-04-03 11:53:42 270

原创 1013 Battle Over Cities (25分)连通分量

It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we nee...

2020-04-02 21:27:47 128

原创 1012 The Best Rank (25分)

To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - Eng...

2020-04-02 15:14:15 216

原创 记一次华为面试

一、本人:某985工科学校机械工程专业。大学之前没接触过编程,本科必修课里有C,低配数据结构(树和图不学编程),微机原理,遂准备转计算机。大三下自学408相关内容,考研报的浙大,初始分数还不错(?),目前正在为机试发愁。二、找工作缘由:因为疫情原因,学校参加了空中双选会,本人担心考研失败,遂做两手准备,但只是在智联上填了简历,并未投递。第二天收到家乡(三到四线城市)某机械企业邀请面试的电话,当时...

2020-03-31 11:26:28 1682 2

原创 1135 Is It A Red-Black Tree (30分)

There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either red or black.(2) The root is black.(3) Every le...

2020-03-27 22:19:53 173

原创 1087 All Roads Lead to Rome (30分)

Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness.Input Specification:Each in...

2020-03-26 12:09:08 100

原创 1068 Find More Coins (30分)

Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,...

2020-03-25 17:10:06 148

原创 1123 Is It a Complete AVL Tree (30分)

An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is...

2020-03-25 15:48:16 162

原创 1018 Public Bike Management (30分)

There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to any other stations in the ...

2020-03-24 22:25:41 129

原创 1017 Queueing at Bank (25分)

Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow li...

2020-03-24 11:55:39 95

原创 1111 Online Map (30分)

Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other is the fastest. It is g...

2020-03-23 18:35:48 158

原创 1110 Complete Binary Tree (25分)

Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gives a positive integer N (≤20) whic...

2020-03-23 16:22:32 182

空空如也

空空如也

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

TA关注的人

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