发表于2008年12月的文章

从Google Docs发布到WordPress

发表于2008年12月26日

之前我在Google Docs里维护了几篇技术文档,正想迁移到Wordpress里来。Google Docs原生支持Blogger,按照其一贯作风,也应该直接或间接的支持其他应用。果然,可以通过xmlrpc的方式支持发布到Wordpress

用Freemind做会议记录,并导出成Wikipedia格式

发表于2008年12月26日

1. Compile a minutes in freemind like the structure below.

2. You can format your mind map with a default fancy theme (just like the picture
above)

Format > Automatic Layout

3. Export your mind map to a mediawiki markup format.

File > Export > Using XSLT…

Choose the XSL file in the attachment, and the export file path.

Then click Export.

4. Copy the text in the file on your export file path to the editor on mediawiki. Like
below.

5. Click Show Preview button to see if the page is correct and polish it accordingly.

Limitation:

We only support plain text node in freemind.

Download:

http://code.google.com/p/zhimaowan/
Download directly

Good luck!

单元测试相关视频和播客

发表于2008年12月26日

StackOverflow的关于单元测试的讨论中看到了如下资源,列出备查

At Dnr TV there are two episodes with JP Boodhoo, where he gives an introduction to test driven development:

If you want to see unit testing and TDD used together with a whole bunch of other agile practices, I would recommend watching the sceencast series Autumn of Agile. This series shows the development of a fully unit tested application from start to finish.

As for podcasts, check out the following:

Since mock objects are a quite important part of unit testing, these podcast episodes might be of interest as well:

Java与.NET集合框架的比较

发表于2008年12月23日
Java 中的实现
Hash Table Resizable Array Balanced Tree Linked List Hash Table + Linked List
Interfaces Set HashSet TreeSet LinkedHashSet
List ArrayList LinkedList
Map HashMap TreeMap LinkedHashMap

与之对比

C5中的实现
Hash Table Resizable Array Balanced Tree Linked List Hash Table + Linked List
Interfaces ICollection HashSet TreeSet HashedLinkedList
IList ArrayList LinkedList
IDictionary HashDictionary TreeDictionary LinkedHashMap

java.util.Collection<T>对应 C5中的C5.ICollection

C5只读模式的集合

GuardedCollection<T>
GuardedList<T>
GuardedDictionary<K,V>

C5在线文档,其中有很好的注释讲解各种数据结构。在线版本可能不完整,但很方便。更多信息请参见C5项目主页

使用.NET泛型集合(Generic Collection)

发表于2008年12月23日

StackOverflow上看到一个关于泛型类型检查的问题
定义一个泛型类时,可以使用where关键字对初始化时用做类型参数(type arguments)的类型加以约束(constraints )。如果不符合约束则抛出编译时错误(compile-time error)。
支持的约束有:

约束 描述
where T : struct 类型参数必须是值类型。除了Nullable
where T : class 类型参数必须是引用类型,包括类、接口、委托和数组。
where T : new() 类型参数必须包含一个公共的无参构造函数,这个约束必须放在所有的其他约束之后。
where T : <base_class_name> 类型参数必须是此基类或者此基类的派生类
where T : <interface_name> 类型参数必须实现指定接口,可以指定多接口,或者泛型接口。
where T : U T的类型参数必须是U,或者U的类型参数派生类。所谓裸类型约束(naked type constraint)。

.NET泛型支持,泛型参数,泛型接口,泛型方法等。Code Project上一篇讲解.Net泛型集合的文章

C5项目
CollectionBase应该是Java中的Set,是众多集合的基类。

Java集合与C5集合对比

Java中的 C5中的
java.util.Set C5.CollectionBase
java.util.HashSet C5.HashSet
java.util.List C5.IList
java.util.TreeSet C5.TreeSet
java.util.Collection C5.ICollection
java.util.Map C5.IDictionary

使用1:

Set newHead = new HashSet();

使用2:

Map head = new HashMap();
for (Collection entries : head.values())
{
    // ...
}

使用3:

public static  List asList(T... a) {
    return new ArrayList(a);
}