Filed under Misc

CouchDB初次体验

我是在Ubuntu上面安装的,还算顺利,几个命令行就搞定,Windows下面可能得花些功夫。
启动Server后,它有个控制台,Web界面的,功能虽不多,但是界面做的很专业,不知道采用的那个theme,看了下web的代码,用了不少jquery的东西。
对数据库的管理方式让人很容易联想到Google App Base,可以自由的添加新的field。访问客户端的语言有很多种选择,我用java试了下,没遇到什么困难。
乍看这东西没啥神秘,不过是一个大的hashmap,每个条目是一个document。有什么用途呢?
SimpleDB也是采用类似的方式,这些大厂商这样做应该有自己的目的吧。

test code and use Microsoft Writer

test code
if (component instanceof ValueHolder && (null != (converter = ((ValueHolder)

the css please refers here. make sure that css code block should be placed in <head> and started with .post.

  In your blog, you should enbrace your code with <code> tag in HTML view.  And in your code block, you cann’t use <> these simble. You change it into HTML code by some tools like phpfi. It also provides highlighting feature.

  But this approach is some boring. Later I found M$ Live Writer. It is cool. You can edit blog on offline mode and post it when online. You also can download blog item, modify it, and update it to Blogger. You also can delete blog by Writer although Writer didn’t remind you. The editor is css-enable. And more interesting it is extensible.

  It’s disadvantage I found until now is that it cann’t upload image file(Blogger does not support it). It can just add a image link.

  (6.4 add)Today Writer beta2 is released. It has many nice feature. The biggest imprement is that my article can use tag. Well Done! It looks really cool! I think Microsoft will let it more powerful.

  The reason of Writer’s existen is:1)It provide offline edit mode; 2)It is WYEIWYS editor; 3) web editor is not so much convenient until now. You will find these problem specially when the article is some long.

MDB应用实例

Message Drive Bean据说是EJB 2.0规范里面最有好的一个特性,可惜一般应用和项目中鲜有EJB的使用,更不谈MDB了。
应用中需要将一些消息发送email到主机,为此配置服务器jms,建立消息的queue和factory(使用工具如WSAD可快速的配置,可以参考developerworks的这篇文章这篇)。创建一SLSB AlertsService,该bean作为jms的工具类bean,提供接口将消息发送到队列。该EJB有对queue和factory的resource-ref。
在EJB中建立jms监听端口(在queue, factory上),创建一MDB OutboundAlerts监听该端口,在onMessage()中处理消息:send emails to host。MDB的目标类型为Queue(只有一个消息接受者)。
这里用jms的原因是:发送email可能延误时间,必须为异步的。相对用多线程的实现异步方法,MDB提供了持久性(只有Topic才有这个功能),更稳定。
这里MDB的onMessage的事务类型为:NotSupported,一般消息的发送者和接受者分别在各自的事务中,不可能在一个事务中。