自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

余生愿你常欢笑

一起学习一起闹

  • 博客(76)
  • 收藏
  • 关注

原创 java版仿qq简易聊天程序

项目全部文件(包括素材和源码)已上传到githubhttps://github.com/yushengww/MyQqChat有帮助的话点个star吧,哈哈。(注:原账号已注销,去访问可以看到已注销,此处重新发布,并非抄袭!) qq聊天项目使用简介:项目环境配置软件开发工具:IntelliJ IDEA 2018(刚开始在eclipse,中途移过来了,现在不确定能不能在ec...

2019-12-13 16:12:43 1680

原创 交叉熵损失函数

说明关于分类问题的交叉熵损失函数,博客交叉熵介绍的非常清楚。我这里补充一点笔记,给自己看的。前文结论在这篇博文中,关于 KL 散度部分,已得到:KL散度越小,表示P(x)和Q(x)越接近,所以可以通过反复训练,来使Q(x)逼近P(x),但KL散度有个特点,就是不对称,就是用P来拟合Q和用Q来拟合P的KL散度(相对熵)是不一样的,但是P和Q的距离是不变的。那KL散度(相对熵)和交叉熵有什么联系呢?所以可以看到:KL散度 = 交叉熵 - 信息熵。从信息熵的公式,我们知道,对于同一个数

2021-09-08 17:42:58 201

原创 VUE动态组件区分路由链接或外部链接

这是从 vue-element-ui 项目中学习到的很独特的写法。我们在写前后端分离+权限控制的项目时,常常会使用后端返回的数据来渲染出侧边菜单结构,通常点击最后一级菜单进行路由跳转,但是有时候我这个是一个外部链接,当然可以使用 v-if 进行判断,但是 v-if 写的太多就很繁琐,而且人家这个新写法真的很好,所以在此记录一下!先定义一个动态组件[官方文档],Link.vue<template><!-- 这里用v-bind主要是为了接收父组件传值后进行动态处理,否则无法主动进行判断

2021-08-03 20:20:00 1200 1

原创 关于自己实现的 UserDetailsService 中 loadUserByUsername() 方法中抛出的异常被隐藏

问题自己实现的 UserDetailsService 中 loadUserByUsername() 方法中抛出了 UsernameNotFoundException,在全局异常处理器中进行了捕获和处理,但是为什么没有用自定义 UserDetailsService@Slf4j@Servicepublic class UserDetailsServiceImpl implements UserDetailsService { @Autowired SysUserService us

2021-07-26 14:23:12 6285 1

原创 AuthenticationManager 的 authentication 过程

1. 结论// 调用链AuthenticationManager.authenticate() --> ProviderManager.authenticate() --> DaoAuthenticationProvider(AbstractUserDetailsAuthenticationProvider).authenticate()// 处理在最后的 authenticate() 方法中,调用了 UserDetailsService.loadUserByUsername() 并进

2021-07-26 13:08:29 13276 4

原创 什么是JWT(来自官网)

官网:JSON Web Token Introduction - jwt.io什么是 JWTJSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and.

2021-07-23 18:29:02 435

原创 CentOS7安装docker19.03.4

一、更换CentOS YUM源为阿里云yum源# 安装wget(有则不必安装)yum install wget -y# 备份mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup# 获取阿里云yum源wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo# 获取阿里云epel源

2021-02-08 10:31:43 511 1

原创 feign远程调用丢失请求头源码分析与解决

前言我们在写服务端项目的时候,总会限制对某些资源的访问,最常见的就是要求用户先登录才能访问资源,当用户登录后就会将此次会话信息保存进session,同时返回给浏览器指定的cookie键值,下次浏览器再次访问,请求头中就会携带这个cookie,我们也以次来识别用户的登录状态,做出正确响应。问题有时候,我们先行登录,然后访问服务A的某个方法,请求头中携带cookie,标识我们已经登录。但若是我们访问的目标方法在执行过程中使用feign进行原程调用服务B(假设不存在跨域),而服务B也要先判断登录状态,我们可

2021-01-19 18:44:59 248

原创 Rabbitmq可靠消息投递,消息确认机制

前言我们知道,消息从发送到签收的整个过程是Producer-->Broker/Exchange-->Broker/Queue-->Consumer,因此如果只是要保证消息的可靠投递,我们需要考虑的仅是前两个阶段,因为消息只要成功到达队列,就算投递成功。比如投递消息时指定的Exchange不存在,那么阶段一就会失败如果投递到Exchange成功,但是指定的路由件错误或者别的原因,消息没有从Exchange到达Queue,那就是第二阶段出错。而从生产者和消费者角度来看,消息成功

2021-01-18 12:36:34 307

原创 微博登录接入出现错误码21322(重定向地址不匹配),其他解决方法

看到大多数博客都说的是没有在应用设置回调地址,但是我再三确认我的回调地址已填写,并且跳转连接中的地址与其一直,就像下面<a href="https://api.weibo.com/oauth2/authorize?client_id=3661722387&response_type=code&redirect_uri=http://auth.gulimall.com/oauth2/weibo/return">但是还是这个结果直到我终于看到了这篇博客,它里面提到一句

2021-01-15 12:17:47 3257 7

原创 JSR303校验+统一异常处理细节+同一字段多个校验注解的结果如何处理

JSR3031)、导入 javax.validation、hibernate-validator依赖,尤其是第二个,在springboot应用中使用校验,必须导入2)、给Bean的字段添加校验注解:javax.validation.constraints,并定义自己的message提示@NotNull: CharSequence, Collection, Map 和 Array 对象不能是 null, 但可以是空集(size = 0)。@NotEmpty: CharSequence, Colle

2021-01-13 20:33:24 663

原创 ElasticSearch7.8.0Docker安装及入门最基本操作

Docker 安装 ElasticSearch拉取镜像# 最新版本7,8.0docker pull elasticsearch:7.8.0启动集群# 基本启动命令# -e "discovery.type=single-node" \ 单节点集群# -e ES_JAVA_OPTS="-Xms512m -Xmx512m" \ 制定运行参数,不然如果机器内存太小,启动后会非常卡顿# --name 起个别名docker run -p 9200:9200 -p 9300:9300 --name

2020-07-10 22:37:50 780 1

原创 ElasticSearch入门项目--仿京东搜索(关键字高亮)

ElasticSearch入门,仿京东搜索实战项目介绍此项目是跟随狂神ES课程入门所做的SpringBoot+ES+Vue实战项目,在视频的基础上,已实现前后端分离。功能比较简单,实现的基本的爬取+储存+搜索+高亮,未实现分页,若对ES已有一定的基础,可自己改进,也可发起PR,若发现问题,望及时提醒。此项目涉及以下功能ES创建索引ES删除索引ES批量插入文档ES查询并高亮显示最基础的JAVA爬虫(Jsoup)Vue基本操作运行环境ElasticSearch 7.8.0kiban

2020-07-10 15:47:26 746 1

原创 MybatisGenerator配置文件模板最全解释+使用指南

配置文件编写为了提高工作效率,我们经常使用MybatisGenerator逆向工程为数据库表生成对应的实体类、DAO接口、Mapper映射文件,最重要的一个步骤就是编写generatorConfig.xml,这个文件有很多配置,今天就给大家一个最详细的模板,自己取其中必要部分即可,这个模板可当作参考手册,若有更新,请以官网为准。<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE generatorConfiguration PUBLIC

2020-07-05 00:00:58 815 1

原创 PAT 1052 Linked List Sorting (25分) 结构体排序而已

题目A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked list, you are supposed to sort the structu

2020-07-04 08:32:37 149

原创 PAT1051 Pop Sequence (25分) 模拟入栈

题目Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, if M is 5 and N is 7, we can obt

2020-07-03 21:32:13 154

原创 PAT1050 String Subtraction (20分) 用数组即可

题目Given two strings S​1​​ and S​2​​ , S=S​1​​ −S​2​​ is defined to be the remaining string after taking all the characters in S​2​​ from S​1​​ . Your task is simply to calculate S1​​​ −S​2​​ for any given strings. However, it might not be that simple

2020-07-03 19:23:57 122

原创 PAT 1049 Counting Ones (30分) 编程之美--1的个数

题目The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1’s in 1, 10, 11, and 12.Input Specification:Each input

2020-07-03 17:31:15 174

原创 PAT 1048 Find Coins (25分) 硬币面值做数组下标即排序

题目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, there was a special requirement of the payment: for

2020-07-03 11:22:58 2642

原创 PAT1047 Student List for Course (25分)避免运行超时(内存溢出)

题目Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.Input Specification:Each input file contains one test case.

2020-07-03 08:46:59 1112

原创 PAT 1046 Shortest Distance (20分)

题目The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input file contains one test case. For each case, the first line contai

2020-07-02 22:06:05 92

原创 PAT1045 Favorite Color Stripe (30分) 动态规划

题目Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining parts together to form her favorite color stripe.It is sa

2020-07-02 19:12:29 128

原创 PAT 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 for only once and some of the diamonds are taken off

2020-07-02 10:40:57 153

原创 PAT 1043 Is It a Binary Search Tree (25分) 由前序遍历得到二叉搜索树的后序遍历

题目A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right subtree of a node contains only nodes with keys greater

2020-06-14 18:42:35 210 1

原创 PAT1042 Shuffling Machine (20分) 用1-54代替点数更方便哦

题目Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid “inside jobs” where employees collaborate with gamblers by performing inadequate shuffles, many casinos emp

2020-06-11 15:34:37 92

原创 PAT 1041 Be Unique (20分)利用数组找出只出现一次的数字

题目Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10​4 ]. The first one who bets on a unique number wins. For example, if there are 7 pe

2020-06-11 13:26:52 122

原创 PAT1040 Longest Symmetric String (25分) 中心扩展法+动态规划

题目Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence you must output 11.Input Specification:Each input file

2020-06-10 23:13:05 108

原创 PAT 1039 Course List for Student (25分) 使用map(string, vector(int))

题目Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who comes for a query.Input Specification:Each input file con

2020-06-10 22:37:30 168

原创 PAT 1038 Recover the Smallest Number (30分) string巧排序

题目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-87 or 0229-32-87-321-3214 with respect to different

2020-06-10 21:23:27 90

原创 PAT 1037 Magic Coupon (25分) 贪心+排序+负负/正正得正

题目The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that product back! What is more, the shop also offers some bonus pr

2020-06-10 16:34:05 123

原创 PAT 1036 Boys vs Girls (25分) 比大小而已

题目This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one test case. Each case contains a positive integer N, foll

2020-06-02 16:36:33 533

原创 PAT 1035 Password (20分) 字符替换

题目To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (o in uppercase). O

2020-06-01 13:53:25 110

原创 PAT 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 the total time length of all the phone calls made betw

2020-05-31 13:25:14 192

原创 PAT 1033 To Fill or Not to Fill (25分)

题目With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different gas station may give different price. You are asked to

2020-05-30 16:51:55 174

原创 PAT 1032 Sharing (25分) 从自信到自闭

题目To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example, loading and being are stored as showed in Figure 1.

2020-05-28 18:41:30 159 1

原创 PAT 1031 Hello World for U (20分) 找规律按行输出即可

题目Given any string of N (≥5) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as:h de ll rlowoThat is, the characters must be printed in the original order, starting top-down from the le

2020-05-28 13:23:02 151

原创 PAT 1030 Travel Plan (30分) Dijstra +Dfs

题目A traveler’s map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path between his/her starting city and the destination. If

2020-05-27 18:10:13 107

原创 PAT 1029 Median (25分) 有序数组合并与防坑指南

题目Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9, 10, 15, 16, 17 } is 15. The median of two sequences is defined to be the

2020-05-27 13:18:25 124

原创 PAT 1016 Phone Bills (25分) 逻辑较为复杂 sort() + map

题目A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. When a customer starts connecting a long-distance call, th

2020-05-19 16:46:02 188

原创 PAT 1015 Reversible Primes (20分) 谜一般的题目,不就是个进制转换+素数判断

题目A reversible prime in any number system is a prime whose “reverse” in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime.Now given any two positive integers N (<105​​

2020-05-19 15:52:33 250

空空如也

空空如也

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

TA关注的人

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