码迷,mamicode.com
首页 > 编程语言 > 详细

Java

时间:2015-12-11 20:31:27      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:

pom.xml报错:

ArtifactTransferException: Failure to transfer... from.... cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.

解决:

Go directly to the local warehouse, put the 1.1.1 directory deleted (since packet not download), again refresh your project on to, or on your project right click, select maven---> update can be, let Maven to download.

 

log4j配置:

  • rollingfile

log4j.rootCategory=INFO,rollingfile

log4j.appender.rollingfile=org.apache.log4j.RollingFileAppender

log4j.appender.rollingfile.file=logs/app.log

log4j.appender.rollingfile.layout=org.apache.log4j.PatternLayout

log4j.appender.rollingfile.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n

  • console

log4j.rootCategory=INFO, console

log4j.appender.console=org.apache.log4j.ConsoleAppender

log4j.appender.console.target=System.err

后面的layout和layout.ConversionPattern相同

 

  • The literal of int xxxxx is out of range
1 //Otherwise, the compiler will try to parse the literal as an int
2 long value = 9223372036854775807L;

 

  • Time

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,S");

try {
Date date = sdf.parse(dateStr);
long d = date.getTime();//dateString to long
} catch (Exception e) {
e.printStackTrace();
}

SimpleDateFormat函数语法:
         G 年代标志符
         y 年
         M 月
         d 日
         h 时 在上午或下午 (1~12)
         H 时 在一天中 (0~23)
         m 分
         s 秒
         S 毫秒
         E 星期
         D 一年中的第几天
         F 一月中第几个星期几
         w 一年中第几个星期
         W 一月中第几个星期
         a 上午 / 下午 标记符
         k 时 在一天中 (1~24)
         K 时 在上午或下午 (0~11)
         z 时区

Optional

http://www.importnew.com/6675.html

程序中模块划分:

main主类启动程序,工具类utils,配置文件config,IO/DB

类名不能太长(两层),太长用包名提供一层划分

包名/类名不能限定死,利于以后扩展

handle类时具体的业务逻辑

通过包名/类名/方法名就可以知道包/类/方法的作用

参考类似的开源代码:netty,voldemort

Java

标签:

原文地址:http://www.cnblogs.com/wenxuanguan/p/4975154.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!