09 2013 档案

摘要:在写代码的过程中,我们会发现有些对象,其实我们只需要一个实例,比方说:线程池(threadpool)、日志对象等,这时候就需要用到“单例模式”,可以创建唯一的实例。 阅读全文
posted @ 2013-09-15 22:31 geeky_jane 阅读(200) 评论(0) 推荐(0)
摘要:写代码时,为了更方便地查看代码用时,通常会在方法开始和结束的地方分别用System.nanoTime取时并计算差值,但是输出结果却看得很别扭,查了下,System.nanoTime()返回的是nanoSeconds,而我们一般都是看的分啊秒啊什么的,可以通过TimeUnit来做nanoSeconds和seconds之间的转换,方便快捷。 阅读全文
posted @ 2013-09-11 22:19 geeky_jane 阅读(10163) 评论(0) 推荐(0)
摘要:查看文件可以说是最常用的功能之一了,比如我们的程序出现问题,经常要检查log文件,这时候就要用到查看文件的功能了,经常用到的有以下这几个命令: cat:由第一行开始显示文件内容 tac:从最后一行还是显示内容 nl:显示行号 more:翻页显示 less:翻页显示,并且可以向前翻页 head:只看头几行 tail:只看结尾几行 阅读全文
posted @ 2013-09-08 20:49 geeky_jane 阅读(898) 评论(0) 推荐(0)
摘要:Description: Less is a program similar to more, but which allows backward movement in the file as well as forward movement. Also, less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like vi. Less uses termcap (or terminfo on some systems), so it can run on a variety of terminals. There is even limited support for hardcopy terminals. (On a hardcopy terminal, lines which should be printed at the top of the screen are pre 阅读全文
posted @ 2013-09-08 20:35 geeky_jane 阅读(2052) 评论(0) 推荐(0)
摘要:垃圾回收器工作时,将一面回收空间,一面使堆中的对象紧凑排列,也就尽量避免了页面错误。通过垃圾回收器对对象重新排列,实现了一种高速的、有无限空间可供分配的堆模型。 阅读全文
posted @ 2013-09-07 23:21 geeky_jane 阅读(260) 评论(0) 推荐(0)