JiaHe's Blog

读万卷书,行万里路

!/bin/bash

function timediff() {
# time format:date +"%s.%N", such as 1502758855.907197692
start_time=$1
end_time=$2

start_s=${start_time%.*}
start_nanos=${start_time#*.}
end_s=${end_time%.*}
end_nanos=${end_time#*.}

# end_nanos > start_nanos?
# Another way, the time part may start with 0, which means
# it will be regarded as oct format, use "10#" to ensure
# calculateing with decimal
if [ "$end_nanos" -lt "$start_nanos" ];then
end_s=$(( 10#$end_s - 1 ))
end_nanos=$(( 10#$end_nanos + 10**9 ))
fi

# get timediff
time=$(( 10#$end_s - 10#$start_s )).`printf "%03d\n" $(( (10#$end_nanos - 10#$start_nanos)/10**6 ))`
echo $time
}

# 退出时清空屏幕
trap "clear;exit" 2
# 清空首屏
clear
# 隐藏光标
echo -e "\033[?25l"

diff=0
str=`date +'%Y / %m / %d %H : %M : %S'`
while true
do
figlet -w 120 -f big -c "${str}"

start=$(date +'%s.%N')
str=`date +'%Y . %m . %d - %H : %M : %S'`
echo -ne "$report"
echo -ne "\033[1;1H"
a=`timediff $start $end`
b=1
end=$(date +'%s.%N')

sleep `awk 'BEGIN{print "'$end'" - "'$start'"}'`
done

非常强大的对齐格式化插件; 对于编辑 Markdowntable 来说简直就是量身定制神器
支持的分隔符: <Space> = : . | & # ,

安装

vundle` 方式安装: `vim ~/.vimrc
" 找到 call vundle#begin() 和 call vundle#end() 之间插入
plugin 'junegunn/vim-easy-align'


" 然后直接在 vim 里用命令方式安装
:source %
:plugininstall


" 文件末尾增加配置
" start interactive easyalign in visual mode (e.g. vipga)
xmap ga <plug>(easyalign)

" start interactive easyalign for a motion/text object (e.g. gaip)
nmap ga <plug>(easyalign)
阅读全文 »

This is a complete guide to Java 8 features, enhancements, date and time API, and coding examples. The examples from this tutorial are tested in our local development environment. You can simply clone from Github and try to use it in your projects or practice.

New Tutorials added (2020)

Key Features of Java 8

In this tutorial, we will learn the following important keys features that came in Java 8:

img

阅读全文 »

https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Maven 中的依赖作用范围概述

Maven中使用 scope 来指定当前包的依赖范围和依赖的传递性。常见的可选值有:compile, provided, runtime, test, system 等。scope 主要是用在 pom.xml 文件中的依赖定义部分,例如:

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.2.1.RELEASE</version>
<scope>test</scope>
</dependency>

scope 各种取值详解

scope 取值有效范围(compile, runtime, test)依赖传递例子
compileallspring-core
providedcompile, testservlet-api
runtimeruntime, testJDBC 驱动
testtestJUnit
system(弃用)compile, test
阅读全文 »