随笔-10  评论-3  文章-0  trackbacks-0
  2010年10月10日
最近有customer说收不到我们系统发的email,查了一段时间,总算有所收获,对SMTP也有了些许了解。

一开始以为是我们邮件服务器IP被blacklist了或对方把我们的IP给禁了。于是就试了下用telnet SMTP测试下:

telnet #customer.domain.com# 25

EHCO sdfa

MAIL FROM: <from@xxx.com>
RCPT TO: <to@xxxxxx.com>
DATA

.
QUIT

结果测试我们是可以telnet到对方的SMTP server的,这样发是可以发送成功的,即排除了对方把我们禁了的可能。可如果telnet到我们自己的SMTP server的话,就失败了。

telnet #own.domain.com# 25
...

后来查了很久,原来是因为timeout的原因:我们用的IMSS gateway有timeout机制。查Log发现,连接对方SMTP SERVER无问题,MAIL FROM command也无问题,可就在RCPT TO 这个command超时了,超过30s都没有response从对方SMTP SERVER回来,估计对方的SMTP SERVER不怎么好,parse和查找个email address (end user: to@xxxx.com)都要花很长时间。后来我们就timeout的参数,从30s调到60s,果然就可以了,估计对方SMTP server之行RCPT TO这个命令都花了30-40s。

问题解决
posted @ 2011-12-30 00:24 li40204 阅读(183) | 评论 (0)编辑 收藏
Ubuntu vi 默认不支持键盘的方向键和Backspace键,很不方便,可以修改/etc/vim下面动vimrc.tiny,使其支持。

vi /etc/vim/vimrc.tiny
set compatible -> change to set nocompatible
And add set backspace=2


posted @ 2011-04-20 00:06 li40204 阅读(337) | 评论 (1)编辑 收藏

1. Always keep data private.


2. Always initialize data.

3.
Don't use too many basic types in a class.

4.
Not all fields need individual field accessors and mutators.

5.
Use a standard form for class definitions.

6. Break up classes with too many responsibilities.


7. Make the names of your classes and methods reflect their responsibilities.
posted @ 2010-12-10 13:41 li40204 阅读(163) | 评论 (0)编辑 收藏
    不知不觉又停了N天学习,看来坚持对偶来说真是难于登天啊。。。

The javac compiler always looks for files in the current directory, but the java interpreter only looks into the current directory if the "." directory is on the class path. If you have no class path set, this is not a problem—the default class path consists of the "." directory. But if you have set the class path and forgot to include the "." directory, then your programs will compile without error, but they won't run.

Features tagged as public can be used by any class. Private features can be used only by the class that defines them. If you don't specify either public or private, then the feature (that is, the class, method, or variable) can be accessed by all methods in the same package.

Comment Extraction

Here, docDirectory is the name of the directory where you want the HTML files to go. Follow these steps:

1.
Change to the directory that contains the source files you want to document. If you have nested packages to document, such as com.horstmann.corejava, you must be working in the directory that contains the subdirectory com. (This is the directory that contains the overview.html file if you supplied one.)

2.
Run the command


javadoc -d docDirectory nameOfPackage

for a single package. Or run


javadoc -d docDirectory nameOfPackage1 nameOfPackage2...

to document multiple packages. If your files are in the default package, then instead run


javadoc -d docDirectory *.java





posted @ 2010-12-10 12:00 li40204 阅读(152) | 评论 (0)编辑 收藏
用System.out.printf方法进行格式化输出;也可用String.format方法创建一个格式化的String, 而不需要打印输出。

日期格式设置参考Core Java, Volumn 1的P55页,许多格式化规则与本地环境有关。

java.util.Arrays类包含了用来操作数组(例如排序与搜索)的各种方法,常用方法如下:

static String toString(type[] a)

static void sort(type[] a)   //Quick Sort

static int binarySearcch(type[] a, type v)

static void fill(type[] a, type v)   //将数组的所有数据元素值设为v

....

End of Chapter 3






posted @ 2010-10-10 18:10 li40204 阅读(156) | 评论 (0)编辑 收藏