To successfully set up RMI communications, you need three components: rmiregistry, a server, and a client. Once rmiregistry and the server are running, the client should be able to connect to the server successfully. See generic RMI server-client implementations on how to connect a client to a server. This tutorial helps you set up such necessary components in Eclipse. Read More
在写代码的过程中,我们会发现有些对象,其实我们只需要一个实例,比方说:线程池(threadpool)、日志对象等,这时候就需要用到“单例模式”,可以创建唯一的实例。 Read More
写代码时,为了更方便地查看代码用时,通常会在方法开始和结束的地方分别用System.nanoTime取时并计算差值,但是输出结果却看得很别扭,查了下,System.nanoTime()返回的是nanoSeconds,而我们一般都是看的分啊秒啊什么的,可以通过TimeUnit来做nanoSeconds和seconds之间的转换,方便快捷。 Read More
查看文件可以说是最常用的功能之一了,比如我们的程序出现问题,经常要检查log文件,这时候就要用到查看文件的功能了,经常用到的有以下这几个命令:
cat:由第一行开始显示文件内容
tac:从最后一行还是显示内容
nl:显示行号
more:翻页显示
less:翻页显示,并且可以向前翻页
head:只看头几行
tail:只看结尾几行 Read More
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 Read More
垃圾回收器工作时,将一面回收空间,一面使堆中的对象紧凑排列,也就尽量避免了页面错误。通过垃圾回收器对对象重新排列,实现了一种高速的、有无限空间可供分配的堆模型。 Read More
ls是最常用的Linux命令之一,man方法很容易查到其功能和用法了,网上一搜也一大把,这篇随笔主要记录了ls -l 输出结果中各列的含义: Read More
Linux和Windows比起来一个显著的特点就是多用户、多任务,在这样一个相对较复杂的使用环境中,保护好自己的文件就显得尤其重要了,这时就需要了解怎么控制一个文件的读、写、执行的权限啦... Read More