2018 年文章归档
共 34 篇文章
Java 8 获取当前日期
原创转载请注明出处: https://agilestyle.iteye.com/blog/2435106 Code Demo public static String getCurrentDateTime() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); return LocalDateTime.now().format(formatter); } public static String getCurrentDateTime(String format) { DateT…
2018-12-12 14:38 · Java
MySQL索引最左匹配原则
原创转载请注明出处: http://agilestyle.iteye.com/blog/2433805 创建一个测试表 CREATE TABLE `test` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `a` varchar(32) NOT NULL, `b` varchar(32) NOT NULL, `c` varchar(64) NOT NULL, `d` varchar(128) NOT NULL, `e` varchar(256) NOT NULL, `create_time` timestamp(3) NOT NULL DE…
2018-11-14 12:44 · RDBMS
log4j log level
Log4J Levels: ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
2018-10-24 13:25 · CommonUtils
MySQL SQL Create demo
ddl demo CREATE TABLE IF NOT EXISTS user ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(32) NOT NULL, `password` varchar(32) NOT NULL, `status` tinyint(4) unsigned NOT NULL DEFAULT '1', `is_deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', `create_time` timestamp(3) NOT NULL D…
2018-10-22 15:10 · RDBMS
Jackson PropertyNamingStrategy
KebabCase: 肉串策略 - 单词小写,使用连字符'-'连接 SnakeCase: 蛇形策略 - 单词小写,使用下划线'_'连接;即老版本中的LowerCaseWithUnderscoresStrategy LowerCase: 小写策略 - 简单的把所有字母全部转为小写,不添加连接符 UpperCamelCase: 驼峰策略 - 单词首字母大写其它小写,不添加连接符;即老版本中的PascalCaseStrategy
2018-10-12 14:37 · JSON
(转)MySQL Explain详解
作者:陆炫志 出处:xuanzhi的博客 http://www.cnblogs.com/xuanzhi201111 在日常工作中,我们会有时会开慢查询去记录一些执行时间比较久的SQL语句,找出这些SQL语句并不意味着完事了,些时我们常常用到explain这个命令来查看一个这些SQL语句的执行计划,查看该SQL语句有没有使用上了索引,有没有做全表扫描,这都可以通过explain命令来查看。所以我们深入了解MySQL的基于开销的优化器,还可以获得很多可能被优化器考虑到的访问策略的细节,以及当运行SQL语句时哪种策略预计会被优化器采用。(QEP:sql生成一个执行计划query Execution…
2018-09-30 13:16 · RDBMS
homebrew源更新
替换brew.git: cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.git 替换homebrew-core.git: cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git 重置brew.git: cd "$(brew --repo)" git remote set-url orig…
2018-09-18 09:27 · IDE
shell、vim常用密令
截取日志文件中指定行数日志到一个新文件,比如截取783687, 783688行 sed -n '783687, 783688p' xxx.log > xxx.txt 截取一个格式规整的文件中的字段,比如截取 , 后第二个字段 awk -F"," '{print $2}' ./test.txt 压缩 tar -format=gnu -zcvf helloworld.tar.gz helloworld/ 解压 tar zxvf helloworld.tar.gz -C ./
2018-08-28 19:38 · Linux
springboot mybatis crud
原创转载请注明出处: http://agilestyle.iteye.com/blog/2429411 Project Directory Maven Dependency <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.a…
2018-08-26 14:55 · spring.io
Mac上安装MySQL后zsh: command not found: mysql
原创转载请注明出处: http://agilestyle.iteye.com/blog/2428950 check mysql service solution cd /usr/local/bin ln -fs /usr/local/mysql/bin/mysql mysql mysql -uroot -p
2018-08-19 21:20 · RDBMS
CompletableFuture - 常用API( 下)
原创转载请注明出处: http://agilestyle.iteye.com/blog/2427515 runAfterBoth private static void testRunAfterBoth() { CompletableFuture.supplyAsync(() -> { System.out.println(Thread.currentThread().getName() + " is running"); return 1; }).runAfterBoth(CompletableFuture.supplyAsync(() -> { System.out.println(Th…
2018-07-25 22:03 · Concurrent
CompletableFuture - 常用API(上)
原创转载请注明出处: http://agilestyle.iteye.com/blog/2427512 先看一个简单的例子 package org.fool.java8.completable; import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.Execu…
2018-07-25 21:21 · Concurrent
CompletableFuture - Hello World
原创转载请注明出处: http://agilestyle.iteye.com/blog/2427053 completableFuture.get() package org.fool.java8.completable; import java.util.Optional; import java.util.Random; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; public class CompletableFutureTest0 { pr…
2018-07-17 23:27 · Concurrent
Collectors - The Collector interface
原创转载请注明出处: http://agilestyle.iteye.com/blog/2425967 The Collector Interface public interface Collector<T, A, R> { Supplier<A> supplier(); BiConsumer<A, T> accumulator(); BinaryOperator<A> combiner(); Function<A, R> finisher(); Set<Collector.Characteristics> characteristics(); } Note: T is the gener…
2018-07-01 22:53 · FP
Collectors - Demo4
原创转载请注明出处: http://agilestyle.iteye.com/blog/2425966 Outline testSummingDouble(); testSummingLong(); testSummingInt(); testToCollection(); testToConcurrentMap(); testToConcurrentMapWithBinaryOperator(); testToConcurrentMapWithBinaryOperatorAndSupplier(); testToList(); testToSet(); testToMap(); testT…
2018-07-01 22:40 · FP
Collectors - Demo3
原创转载请注明出处: http://agilestyle.iteye.com/blog/2425965 Outline testPartitioningByWithPredicate(); testPartitionByWithPredicateAndCollector(); testReducingBinaryOperator(); testReducingBinaryOperatorAndIdentity(); testReducingBinaryOperatorAndIdentityAndFunction(); testSummarizingInt(); testSummarizing…
2018-07-01 22:32 · FP
Collectors - Demo2
原创转载请注明出处: http://agilestyle.iteye.com/blog/2425963 Outline testAveragingDouble(); testAveragingInt(); testAveragingLong(); testCollectingAndThen1(); testCollectingAndThen2(); testCounting(); testGroupingByFunction1(); testGroupingByFunction2(); testGroupingByFunction3(); testSummarizingInt(); SRC …
2018-07-01 22:32 · FP
Collectors - Demo1
原创转载请注明出处: http://agilestyle.iteye.com/blog/2425964 Outline testGroupingByConcurrent(); testGroupingByConcurrentWithFunctionAndCollector(); testGroupingByConcurrentWithFunctionAndSupplierAndCollector(); testJoining(); testJoiningWithDelimiter(); testJoiningWithDelimiterAndPrefixAndSuffix(); testMap…
2018-07-01 22:26 · FP
Stream - Reduce
原创转载请注明出处: http://agilestyle.iteye.com/blog/2425206 reduce sum private static void reduceSumTest1() { Stream<Integer> stream = Arrays.stream(new Integer[]{1, 2, 3, 4, 5, 6, 7}); Integer reduce = stream.reduce(0, (i, j) -> i + j); System.out.println(reduce); } private static void reduceSumTest2() { …
2018-06-19 22:21 · FP
Stream - Match
原创转载请注明出处: http://agilestyle.iteye.com/blog/2425204 allMatch private static void allMatch() { Stream<Integer> stream = Arrays.stream(new Integer[]{1, 2, 3, 4, 5, 6, 7}); boolean result = stream.allMatch(i -> i > 0); System.out.println(result); } anyMatch private static void anyMatch() { Stream<Inte…
2018-06-19 21:52 · FP