自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(1153)
  • 问答 (3)
  • 收藏
  • 关注

原创 Jedis set 方法参数的含义

String redis.clients.jedis.Jedis.set(String key, String value, String nxxx, String expx, long time)Set the string value as value of the key. The string can’t be longer than 1073741824 bytes (1 G...

2018-05-28 18:42:43 18927 2

原创 一个相对正确的的基于 Redis 的分布式锁

public class RedisTool { private static final String LOCK_SUCCESS = "OK"; private static final String SET_IF_NOT_EXIST = "NX"; private static final String SET_WITH_EXPIRE_TIME = "PX"; ...

2018-05-28 18:41:37 915

转载 Intellij IDEA 调试功能使用总结

在Intellij IDEA中使用DebugIntellij IDEA调试功能使用总结 在Intellij IDEA中使用Debug 目录一、Debug开篇二、基本用法&快捷键三、变量查看四、计算表达式五、智能步入六、断点条件设置七、多线程调试八、回退断点九、中断Debug十、附:JRebel激活   Debug用来追踪...

2018-05-25 18:39:25 4399 1

原创 一个搞了一小半个下午的 Shell 脚本

#!/bin/sh# ==============================# 填补历史缺失数据# ==============================datebeg="20180427"dateend="20180523"hour_arr=("00" "01" "02" "03&

2018-05-25 08:56:34 830

原创 Hive 删除分区的方法

ALTER TABLE table_name DROP IF EXISTS PARTITION(year = 2015, month = 10, day = 1);1、HIVE表中分区的删除 https://blog.csdn.net/sparkexpert/article/details/510243922、hive如何删除分区一天的数据 http://www.about...

2018-05-25 08:56:23 59382

原创 Shell 字符串拼接的方法

value1=homevalue2=${value1}"="echo $value2简单粗暴…居然直接怼在一起就好了。。。资料:1、Linux Shell 脚本中字符串的连接方法 https://blog.csdn.net/ysdaniel/article/details/69208662、请教:如何把两个字符串连接后赋给一个变量 http://bbs.chin...

2018-05-24 17:40:48 30538 1

原创 Shell for 循环嵌套的写法

#!/bin/bashfor num in 1 2 3 4 5 do for char in "a b c d e" do echo $num $char donedone如上

2018-05-24 17:39:00 29365

原创 Shell 遍历数组的方法

数组的申明方式array=(element1 element2 element3 .... elementN) 数据读取#echo ${array[0]} #echo ${array[index]} 数据遍历for data in ${array[@]} do echo ${data} done 参考资料:1、Linux She...

2018-05-24 17:38:20 5742

转载 Hive Shell 常用操作

Hive Shell常用操作 Hive Shell常用操作 1.Hive非交互模式常用命令:  1) hive -e:从命令行执行指定的HQL,不需要分号:% hive -e 'select * from dummy' > a.txt...

2018-05-24 17:33:38 1124

转载 Shell 中使用 echo 将数据写入文件

Shell脚本入门(十二) - 将数据写入文件Linux学习笔记——如何使用echo指令向文件写入内容 今天我们来看一下怎样将数据写入文件中,还记得前面输出信息使用的echo命令吗?输出到文件同样使用这个命令:1. 写入文件示例:[java] view plain copy...

2018-05-24 17:30:01 78871

原创 MyBatis 输出日志到控制台和输出日志到 slf4j 的方法(sql语句)

在 MyBatis.xml 配置文件中加上:<settings> <setting name="logImpl" value="STDOUT_LOGGING"/></settings>这个是打印到 控制台<settings> <setting name="logImpl" value="S

2018-05-24 17:01:20 8672 1

转载 Sublime 替换和查找的方法

查找&替换(Finding&Replacing)查找&替换(Finding&Replacing)Sublime Text提供了强大的查找(和替换)功能,为了提供一个清晰的介绍,我将Sublime Text的查找功能分为快速查找、标准查找和多文件查找三种类型。快速查找&替换多数情况下,我们需要查找文中某个关键字出现的其它位置,这时并不需要重新将该...

2018-05-24 16:58:56 16903

原创 Shell 获取系统当前时间戳

current=`date "+%Y-%m-%d %H:%M:%S"` timeStamp=`date -d "$current" +%s` #将current转换为时间戳,精确到毫秒 currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000)) echo $currentTimeStamp常用shell(1):shell获...

2018-05-24 16:55:48 5586

原创 Hive 修改表、分区、列

参考资料:1、Hive 修改table、column https://www.jianshu.com/p/9088fe002e2a2、Hive学习之修改表、分区、列 https://blog.csdn.net/skywalker_only/article/details/30224309

2018-05-24 16:49:40 6786

原创 MySQL alter table 的使用方法

ALTER TABLE table_nameALTER COLUMN column_name datatype1、SQL ALTER TABLE 语句 http://www.runoob.com/sql/sql-alter.html

2018-05-24 16:44:33 2377

原创 SpringMVC 上传文件到指定路径

@RestController@RequestMapping(value = "/uploadFile")public class UploadFileController { @RequestMapping(value = "/upload", method = RequestMethod.POST) @ResponseBody public String quer...

2018-05-22 14:41:25 12094

原创 Dubbo 接收用户上传文件的方法(resteasy)

dubbox怎样上传文件?建议放弃!!! <p><a class="user-mention" data-hovercard-user-id="5186526" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://git

2018-05-21 18:53:25 2110

原创 新建 SpringBoot 项目, maven 不通过继承 parent 的方式

将<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.2.RELEASE</version>&

2018-05-21 17:28:06 2372

原创 SpringMVC 实现 文件上传功能

web.xml 不用特殊配置spring-context.xml 需要加上一个 bean <!-- 配置MultipartResolver 用于文件上传 使用spring的CommosMultipartResolver --> <bean id="multipartResolver" class="org.springframework.web.mu...

2018-05-21 17:24:35 639

原创 java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactorySpringMVC 上传文件<dependency> <groupId>commons-io</groupId> <artifactId>commons-io<...

2018-05-21 17:10:01 765

原创 基于枚举类 Enum 实现的单例模式

参考资料:1、https://www.cnblogs.com/cielosun/p/6596475.html Java枚举enum以及应用:枚举实现单例模式2、https://blog.csdn.net/yy254117440/article/details/52305175 Java 利用枚举实现单例模式public enum Singleton_3 { INST...

2018-05-20 14:37:38 3470

原创 利用 Docker 在一台机器上部署多个 Redis 实例

docker run -p 20001:6379 -d redis redis-server --appendonly yesdocker run -p 20002:6379 -d redis redis-server --appendonly yesdocker run -p 20003:6379 -d redis redis-server --appendonly yesdocker r...

2018-05-18 14:49:16 6076

原创 MySQL 1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

1235 - This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’MySQL5.1中子查询是不能使用LIMIT的, 会报错: “This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME sub...

2018-05-18 11:43:16 1122

原创 Docker 报错 error during connect: Get pipe/docker_engine: The system cannot find the file specified.

error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows...

2018-05-17 10:23:42 17660 4

原创 Docker 报错 Error with pre-create check: "Get https://github-production-release-asset-2e

1、关闭 Hyper-V2、忘了…参考资料:1、error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.28/version: open //./pipe/docker_https://blog.csdn.net/fanfan4569/article/details/713405562、Inval...

2018-05-16 20:00:41 9064

原创 DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class

DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class今天写了一个小的 SpringBoot 的 DEMO 启动的时候报错如上解决办法,在 yml 文件里增加 数据库的相关配置参考资料:1。Spring boot 启动报错 ...

2018-05-16 17:17:05 48618 4

原创 在切面处获取 HttpServletRequest 的方法

切面处获取 RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttribut...

2018-05-16 16:34:14 5480

原创 使用 HttpServletRequestWrapper 重复读取 HttpServletRequest(多次读取 request 请求)

今天尝试在切面中读取 request 请求,校验请求的参数,解析异常则报错但是,在 切面读取了一次 request 后,再到 controller 的时候,request 就变成了空的找了一圈找到这种方法,通过继承 HttpServletRequestWrapper ,来操作 HttpServletRequestpackage xxxxx;import org.apache.comm...

2018-05-16 15:44:57 6234 2

转载 Spring AOP @Before @Around @After 等 advice 的执行顺序

Spring AOP @Before @Around @After 等 advice 的执行顺序 用过spring框架进行开发的人,多多少少会使用过它的AOP功能,都知道有@Before、@Around和@After等advice。最近,为了实现项目中的输出日志和权限控制这两个需求,我也使用到...

2018-05-16 15:04:26 462

转载 解决 web.xml 报错The content of element type "web-app" must match

解决web.xml 报错The content of element type “web-app” must match 解决:The content of element type “web-app” must match “(icon ,display-  错误:The content of ...

2018-05-15 15:17:55 1462

转载 Linux 下 MySQL 的常用命令

启动数据库设置初始密码启动数据库设置初始密码这一小节介绍在Mac OS、Linux、Windows上启动关闭重启MySQL服务,以及部分图形化界面对服务的操控。安装完成后,可以使用 service 命令启动 mysql 服务,在Mac上service命令不存在。命令行启动关闭重启MySQL服务在命令行终端启动 MySQL 非常方便,下面大概介绍几个平台通过命令启动服务的方法。...

2018-05-14 17:11:12 570

原创 Data source rejected establishment of connection, message from server: "Too many connections"

Data source rejected establishment of connection, message from server: “Too many connections”数据库连接不够用的解决办法;1、mysql 最大链接数 max_connections 设置 http://blog.51cto.com/12927979/20475372、MySQL Da...

2018-05-14 17:10:01 1384

原创 一致性哈希算法的原理与实现

1、聊聊一致性哈希 https://zhuanlan.zhihu.com/p/244400592、我的JAVA日记(十)关于TreeMap和一致性hash https://zhuanlan.zhihu.com/p/202704353、简单hash算法和一致性hash算法 https://zhuanlan.zhihu.com/p/349683284、一致性hash算法的简单实现 ...

2018-05-13 21:56:36 269

原创 TreeMap 的 tailMap()、headMap()、firstKey() 方法使用

import java.util.SortedMap;import java.util.TreeMap;/** * Author: heatdeath * Date: 2018/5/13 * Desc: */public class TreeMapDemo { public static void main(String[] args) { // c...

2018-05-13 21:28:29 11321

原创 Hash 哈希与加盐哈希、常用的哈希算法

1、常见hash算法的原理 http://blog.jobbole.com/106733/2、到底什么是hash? https://www.zhihu.com/question/267627073、加盐密码保存的最通用方法是? https://www.zhihu.com/question/202993844、加盐密码哈希:如何正确使用 http://blog.jobbole.c...

2018-05-13 16:06:39 4328 1

转载 MySQL 几种日期时间类型之间的区别

Mysql 建表时,日期时间类型选择mysql(5.5)所支持的日期时间类型有:DATETIME、 TIMESTAMP、DATE、TIME、YEAR。几种类型比较如下:日期时间类型占用空间日期格式最小值最大值零值表示 DATETIME 8 bytes YYYY-MM-DD HH:MM:SS 1000-01-...

2018-05-13 14:34:16 2178

原创 通过 pom 设置 Maven 通过 JDK 1.8 进行编译

<properties> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> </properties> <...

2018-05-13 13:53:20 16818

转载 pdf 阅读,保存上次阅读位置

pdf 阅读,保存上次阅读位置 windows下装了两个pdf阅读器,一个是adobe reader 9.0中文简体版,一个是foxit阅读器 ubuntu系统自带的pdf阅读软件就有一个不错的功能:它会保存上次阅读的位置,下次打开,自动跳转到上次阅...

2018-05-13 11:10:18 5004

转载 Throwable、Error、Exception、RuntimeException 的区别

详解Java异常Throwable、Error、Exception、RuntimeException的区别在Java中,根据错误性质将运行错误分为两类:错误和异常。在Java程序的执行过程中,如果出现了异常事件,就会生成一个异常对象。生成的异常对象将传递Java运行时系统,这一异常的产生和提交过程称为抛弃(throw)异常。当Java运行时系统得到一个异常对象时,它将会沿着方法的调...

2018-05-11 20:18:13 973

转载 SpringBoot 加载复杂的 yml 文件

**package com.boot.config;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;import org.springframework.beans.factory.annotation.Value;import org.spr...

2018-05-11 20:15:43 1763 2

空空如也

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

TA关注的人

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