Lifecycle
There are same built-in build lifecycles: default, clean and site. The default lifecycle handles your project deployment, the clean lifecycle handles project cleaning, while the site lifecycle handles the creation of your project’s site documentation.
the default lifecycle includes many phases, e.g: validate, initialize…compile, test, package, integration-test, verify, install and deploy. check Maven 3 components.xml;
If you run one phase, e.g. install, it will execute not only that phase (install), but also every phase prior to the install phase;
Phases
A Build Phase is Made Up of Plugin Goals;
for maven 3.1, compile phase is using: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile; get more details from default-bindings.xml
Plugin Goal
A plugin may have one or more goals wherein each goal represents a capability of that plugin.
plugins can contain information that indicates which lifecycle phase to bind a goal to. Note that adding the plugin on its own is not enough information – you must also specify the goals you want to run as part of your build. A plugin goal may be bound to zero or more build phases. A goal not bound to any build phase could be executed outside of the build lifecycle by direct invocation.
pom configuration examples:
maven compile: http://maven.apache.org/plugins/maven-compiler-plugin/usage.html
maven javadoc: http://maven.apache.org/plugins/maven-javadoc-plugin/usage.html
在过去的几年里,每到年底,我总是希望旧的一年赶紧结束,新的一年快点到来。 这并不是因为我对新的一年充满希望,而是因为我又荒废了一年的时间,希望尽快重启 —- 虽然我很清楚,重启并不能从根本上解决问题。
2014是充实的一年, 人到三十,我还是第一次觉得过去的一年“充实”
1月1日凌晨从台湾回来后就连滚带爬的忙工作
2月回家过年,路过上海跟同学(天文台测天气的那位)/ 同事吃喝两天; 回来后跑了我的第一个半马,耗时2:45 (Marina Run);
3月去了珠海 港澳,跟阿达西.fan吃了大盘鸡还在伶仃岛上过了一晚;
4月去了泰国,在Ayutthaya骑自行车被群狗追;
5月去了云南,洱海骑了电瓶车,泸沽湖骑了摩托车(第一次);
6月买了Garmin Forerunner 220, 开始记录跑步, 并把数据同步到Strava;
7月用Python写了一个小工具下载Youtube指定用户的所有video;
8月去呼和浩特跟大学时猥琐而亲切的朋友们(Boss, 狗顺, 恐龙)吃肉喝酒,聊人生 撒野尿,在草原上骑马开车, 半夜冻的牙齿打架。回北京时还坐了号称”我们不是卖座,我们是为人民服务“的餐车,在车站外把啤酒喝完后鸟兽散。 赶早晨飞机回家呆了一周, 父亲六十了。
11月去了巴里岛,热;
12月去了马六甲,吃; USS玩一天(HSBC办卡送的票,坐埃及那个ride时吓的叫出来了), 跑完渣打马拉松,4:32;
跑步 骑车
跑步: 1000+KM
自行车:680+KM (11月起开始骑自行车上下班)
14年竟然有150个小时花在运动上 -> Strava生成的2014 story(cycling)。
书 电影 播客
年初翻过几本: 《人子》, 《1980年代的爱情》,《月亮和六便士》,《白鹿原》,《梁羽生散文》,《送你一颗子弹》,《知青变形记》, 《夹边沟记事》,《拖拉机简史》,《雪国》, 《一个人的村庄》,《烽火岛》; 粗体的几本值得花时间好好看;
这一年看了太多电影, 喜欢的:
《亲爱的》,《无物申报》, 动画片《超能陆战队 Big Hero 6 》, 《狂怒》(Fury), 《杀死一只知更鸟》, 《美国丽人》,《偷自行车的人》
中文常听的:“李峙的不老歌”“新闻酸菜馆”“东吴相对论“;
想感谢很多应该感谢的人,但似乎这些应该感谢的人都不需要感谢。 不论你是谁, 当你看到这里,我想说声: 谢谢, 新年快乐。
Solution:
1). generate random string using java.util.Random; or
2). Use Apache commons lang;
public void testRandomString() { System.out.println("RandomStringGenerator.getRandomString(5): " + RandomStringGenerator.getRandomString(5)); System.out.println("RandomStringUtils.random(5): " + RandomStringUtils.random(5)); System.out.println("RandomStringUtils.randomAlphabetic(5): " + RandomStringUtils.randomAlphabetic(5)); System.out.println("RandomStringUtils.randomNumeric(5): " + RandomStringUtils.randomNumeric(5)); }
output:
RandomStringGenerator.getRandomString(5): r2irv
RandomStringUtils.random(5): 㩩ﻰ뒛ţ䍋
RandomStringUtils.randomAlphabetic(5): Nhnfe
RandomStringUtils.randomNumeric(5): 51685
1. Random String Generator:
package com.liguoliang.java.utils; import java.util.Random; /** * Created by Guoliang, Li on 12/22/2014. */ public class RandomStringGenerator { private static char[] repo; static { StringBuilder tmp = new StringBuilder(); for (char ch = '0'; ch <= '9'; ++ch) tmp.append(ch); for (char ch = 'a'; ch <= 'z'; ++ch) tmp.append(ch); repo = tmp.toString().toCharArray(); } public static String getRandomString(int length) { char[] buf = new char[length]; Random random = new Random(); if (length < 1) { throw new IllegalArgumentException("length < 1: " + length); } for (int i = 0; i < buf.length; i++) { buf[i] = repo[random.nextInt(repo.length)]; } return new String(buf); } }
Apache commons lang:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
SELECT (CONVERT(NUMERIC(20, 0), '100') + 1)
>> 101
SELECT (CONVERT(VARCHAR(3), 100) + 'ABC')
>> 100ABC
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.