posts - 37,comments - 7,trackbacks - 0
http://www-128.ibm.com/developerworks/cn/opensource/os-ecl-ajax/index.html?S_TACT=105AGX52&S_CMP=techcsdn
posted @ 2006-09-07 13:42 Dave 阅读(156) | 评论 (0)编辑 收藏
http://www.sergiopereira.com/articles/prototype.js.html
posted @ 2006-08-10 15:06 Dave 阅读(205) | 评论 (0)编辑 收藏
http://blog.csdn.net/calvinxiu/archive/2006/08/08/1036306.aspx
posted @ 2006-08-10 13:02 Dave 阅读(170) | 评论 (0)编辑 收藏
http://java.csdn.net/n/20060807/93375.html
posted @ 2006-08-10 13:01 Dave 阅读(182) | 评论 (0)编辑 收藏
http://java.csdn.net/n/20060808/93473.html
posted @ 2006-08-10 12:59 Dave 阅读(265) | 评论 (0)编辑 收藏
https://compdoc2cn.dev.java.net/prototype/html/prototype.js.cn.html
posted @ 2006-08-10 12:50 Dave 阅读(191) | 评论 (0)编辑 收藏
定义:一个正则表达式,就是用某种模式去匹配一类字符串的一个公式。
正则表达式由一些普通字符和一些元字符(metacharacters)组成。普通字符包括大小写的字母和数字,而元字符则具有特殊的含义,我们下面会给予解释。

元字符 描述


.
匹配任何单个字符。例如正则表达式r.t匹配这些字符串:ratrutr t,但是不匹配root。 
$
匹配行结束符。例如正则表达式weasel$ 能够匹配字符串"He's a weasel"的末尾,但是不能匹配字符串"They are a bunch of weasels."。 
^
匹配一行的开始。例如正则表达式^When in能够匹配字符串"When in the course of human events"的开始,但是不能匹配"What and When in the"。
*
匹配0或多个正好在它之前的那个字符。例如正则表达式.*意味着能够匹配任意数量的任何字符。
\
这是引用府,用来将这里列出的这些元字符当作普通的字符来进行匹配。例如正则表达式\$被用来匹配美元符号,而不是行尾,类似的,正则表达式\.用来匹配点字符,而不是任何字符的通配符。
[ ] 
[c1-c2]
[^c1-c2]
匹配括号中的任何一个字符。例如正则表达式r[aou]t匹配ratrotrut,但是不匹配ret。可以在括号中使用连字符-来指定字符的区间,例如正则表达式[0-9]可以匹配任何数字字符;还可以制定多个区间,例如正则表达式[A-Za-z]可以匹配任何大小写字母。另一个重要的用法是“排除”,要想匹配除了指定区间之外的字符——也就是所谓的补集——在左边的括号和第一个字符之间使用^字符,例如正则表达式[^269A-Z] 将匹配除了2、6、9和所有大写字母之外的任何字符。
\< \>
匹配词(word)的开始(\<)和结束(\>)。例如正则表达式\<the能够匹配字符串"for the wise"中的"the",但是不能匹配字符串"otherwise"中的"the"。注意:这个元字符不是所有的软件都支持的。
\( \)
将 \( 和 \) 之间的表达式定义为“组”(group),并且将匹配这个表达式的字符保存到一个临时区域(一个正则表达式中最多可以保存9个),它们可以用 \1\9 的符号来引用。
|
将两个匹配条件进行逻辑“或”(Or)运算。例如正则表达式(him|her) 匹配"it belongs to him"和"it belongs to her",但是不能匹配"it belongs to them."。注意:这个元字符不是所有的软件都支持的。
+
匹配1或多个正好在它之前的那个字符。例如正则表达式9+匹配9、99、999等。注意:这个元字符不是所有的软件都支持的。
?
匹配0或1个正好在它之前的那个字符。注意:这个元字符不是所有的软件都支持的。
\{i\}
\{i,j\}
匹配指定数目的字符,这些字符是在它之前的表达式定义的。例如正则表达式A[0-9]\{3\} 能够匹配字符"A"后面跟着正好3个数字字符的串,例如A123、A348等,但是不匹配A1234。而正则表达式[0-9]\{4,6\} 匹配连续的任意4个、5个或者6个数字字符。注意:这个元字符不是所有的软件都支持的。


posted @ 2006-08-07 17:06 Dave 阅读(157) | 评论 (0)编辑 收藏
public aspect TraceAspect{
   private Logger _logger = Logger.getLogger("trace");
   pointcut traceMethods(): execution(* *.*(..))&&!within(TraceAsptect);
   before() : traceMethods(){
      Signature sig = thisJoinPointStaticPart.getSignature();
      _logger.logp(Level.INFO, sig.getDeclaringType().getName(), sig.getName(), "Entering");
  }
}

What’s wrong with conventional logging ?

When a new module is added to the system, all of its methods that need logging must be instrumented. Such instrumentation is invasive, causing the tangling of the core concerns with the logging concern. Further, if you ever happen to change the logging toolkit to a different API, you need to revisit every logging statement and modify it.

Consistency is the single most important requirement of logging. It means that if the logging specification requires that certain kinds of operations be logged, then the implementation must log every invocation of those operations. When things go wrong in a system, doubting the logging consistency is probably the last thing you want to do. Missed logging calls can make output hard to understand and sometimes useless. Achieving consistency using conventional logging is a lofty goal, and while systems can attain it initially, it requires continuing vigilance to keep it so. For example, if you add new classes to the system or new methods in existing classes, you must ensure that they implement logging that matches the current logging strategy.

The beauty of AspectJ-based logging

The limitations are not a result of the logging APIs or their implementations; rather, they stem from the fundamental limitations of objectoriented programming, which require embedding the logging invocations in each module. AOP and AspectJ overcome those limitations. AspectJ easily implements the invocation of logging statements from all the log points. The beauty is that you do not need to actually instrument any log points; writing an aspect does it automatically. Further, since there is a central place to control logging operations, you achieve consistency easily.

The most fundamental difference between conventional logging and AspectJbased logging is modularization of the logging concern. Instead of writing modules that implement core concepts in addition to invoking logging operations, with AspectJ you write a few aspects that advise the execution of the operations in the core modules to perform the logging. That way, the core modules do not carry any logging-related code. By modularizing, you separate the logging concern
from the core concerns.

With AspectJ-based logging, the logger aspect separates the core modules and the logger object. Instead of the core modules’ embedding the log() method invocations in their source code, the logger aspect weaves the logging invocations into the core modules when they are needed. AspectJ-based logging reverses the dependency between the core modules and the logger; it is the aspect that encodes how the operations in the core modules are logged instead
of each core module deciding for itself.
posted @ 2005-08-29 10:52 Dave 阅读(781) | 评论 (2)编辑 收藏
 

泛型的引入使得 Java 语言中的类型系统更加复杂。以前,该语言具有两种类型 —— 引用类型和基本类型。对于引用类型,类型 的概念基本上可以互换,术语子类型子类 也可以互换。

随着泛型的引入,类型和类之间的关系变得更加复杂。List<Integer>List<Object> 是不同的类型,但是却是相同的类。尽管 Integer 扩展 Object,但是 List<Integer> 不是 List<Object>,并且不能赋给 List<Object> 或者强制转换成 List<Object>

另一方面,现在有了一个新的古怪的类型叫做 List<?>,它是 List<Integer>List<Object> 的父类。并且有一个更加古怪的 List<? extends Number>。类型层次的结构和形状也变得复杂得多。类型和类不再几乎是相同的东西了。

extends 的新含意 

在 Java 语言引入泛型之前,extends 关键字总是意味着创建一个新的继承自另一个类或接口的类或接口。

引入泛型之后,extends 关键字有了另一个含意。将 extends 用在类型参数的定义中(Collection<T extends Number>)或者通配符类型参数中(Collection<? extends Number>)。

当使用 extends 来指示类型参数限制时,不需要子类-父类关系,只需要子类型-父类型关系。还要记住,有限制类型不需要是该限制的严格子类型;也可以 该限制。换句话说,对于 Collection<? extends Number>,您可以赋给它 Collection<Number>(尽管 Number 不是 Number 的严格子类型)和 Collection<Integer>Collection<Long>Collection<Float> 等等。

在任何这些含意中,extends 右边的类型都可以是参数化类型(Set<V> extends Collection<V>)。

posted @ 2005-08-24 11:36 Dave 阅读(179) | 评论 (0)编辑 收藏