2009年3月27日星期五

VMWare Server 2.0 install Debian 5 Linux

vmware server 2.0提供了web管理界面来管理虚机,令人印象深刻。在Debian5上安装vmware server 2.0非常的简单,只要注意几个地方即可:
  1. 使用root用户;
  2. apt-get update,并且install linux-headers-`uname -r`,与内容相同的版本;
  3. debian默认安装了perl,你只需要记住安装gcc 4.1.3,因为vmware需要这个版本的gcc;如果机器上已经有,请ln -s gcc gcc-4.1.3;
  4. 执行./installVmware.pl,即可进行安装,安装过程中需要填的内容,一般缺省即可;
  5. vmware server 2.0需要设置一个datastore path,即存储虚机文件的地方,在web管理界面中,引导iso文件时,只能从该目录中读取;
  6. 安装完成后,通过https://127.0.0.1:8333/来访问,登录用户名使用系统的root帐号。
web管理界面还是比较简洁美观的,vmware的配置、启动都可以实现。但是我没有发现如何安装vmware tool,这是鼠标操作起来就不太方便了,而且好像无法全屏。

2009年3月25日星期三

Mule IDE 2.0的几个问题

    目前,Mule IDE 2.0发布了。试用了一下,总体上来说非常的好使,配置完MULE_HOME,可以创建mule project和mule config file,然后可以在IDE中直接运行起来。不过,也发现了IDE上的几个问题。

    这几天,在了解Mule与Smooks集成方面的东西,在MuleForge上有一个项目:Smooks for Mule,现在已经可以支持Mule 2.1.X了。测试了一下,还不支持最新发布的Mule 2.2版本。

    在Mule 2.1.2 上跑 Smooks for Mule 2.1.x的例子非常的顺畅,但是当使用Mule IDE 2.0来运行同样的例子,就报如下异常:

ERROR 2009-03-26 11:21:03,312 [main] org.mule.config.spring.SpringXmlConfigurationBuilder: Configuration with "org.mule.config.spring.SpringXmlConfigurationBuilder" failed.

org.mule.api.lifecycle.InitialisationException: Initialisation Failure: Error creating bean with name 'BasicService': Cannot create inner bean '(inner bean)' of type [org.mule.routing.outbound.DefaultOutboundRouterCollection] while setting bean property 'outboundRouter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot create inner bean '(inner bean)' of type [org.milyn.smooks.mule.Router] while setting bean property 'routers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: IOException while trying to get smooks instance:


   没有仔细的查,初步怀疑这是Mule IDE的bug。

   还有一个问题是,Mule IDE指定MULE_HOME以后,它只找到lib目录下的mule和opt目录中jar,而不去寻找user目录下的jar文件。这样,要运行一些其他的应用,必须要把相应的jar文件copy到opt目录中。

2009年3月22日星期日

HTML Select's scrollbars

IE6浏览器中,select中默认是没有horizontal scrollbar,如果option中的文字太长,就没法完整显示;而且option的title属性也不支持。

要实现horizontal scrollbar的效果,可以用DIV来进行模拟。要注意的是select不要设置width。代码示例如下:

<div style="overflow-x:scroll; width:100px; overflow: -moz-scrollbars-horizontal;">
<select size="3">
<option>horizontal scrollbar test example 1</option>
<option>horizontal scrollbar test example 10</option>
<option>horizontal scrollbar test example 100</option>
<option>horizontal scrollbar test example 1000</option>
<option>horizontal scrollbar test example 10000</option>
<select>
</div>


2009年3月20日星期五

一些常用的小工具

列一下自己常用的工具包:
  1. FScapture:抓图工具,比较亮点的是抓完图后,还可对图片做编辑,比如加一个矩形框等;
  2. AdsClrPicker:取色工具,可以取屏幕上任何地方的色彩;
  3. IconWorkshop:图标编辑工具;
  4. FeiQ:即时通讯工具,局域网中的QQ;
  5. Filezilla:FTP工具,包括客户端和服务器;
  6. 7z:压缩工具;
  7. RocketDock:dock条工具,类似于Mac上的Dock;
  8. TortoiseSVN:Subversion客户端;
  9. Google Pinyin:Google拼音输入法;
  10. Evernote:日常记事工具;
  11. HttpWatch:Http查看工具;
  12. FileFox:火狐浏览器,装上插件,功能无限;
  13. UltraEdit:文本编辑器



2009年3月12日星期四

XOM利器:Simple-Xml

一直以来,对XML文件的操作都让我恐惧。所以,一般在项目中,我都不主动引入XML配置文件。有一个项目里,我还用yaml来代替了xml作为配置文件。可以,yml文件对空格、位置排列限制比较严格,用起来不是很好。

这几天,找到了一个新的XOM工具:Simple-Xml。可以通过annotation将xml直接转换为pojo,十分的方便。将一些使用心得整理一下:

  1. 安装设置简单,只需要3个jar包:simple-xml-2.0.3.jar,stax-1.2.0.jar和stax-api-1.0.1.jar;
  2. Annotation使用简单,最常用的有:@Root, @Attribute, @Text, @Element, @ElementList, @ElementMap等;
  3. 可以设置annotation的name属性来匹配xml文件中元素名词,譬如:@Element(name="simple-xml");
  4. 可以使用inline=true来内联数组、列表和Map等;
  5. 可以通过${var}来共享变量,但必须用@Commit提交后方可使用。譬如:<property name="host.name">qdlake</property> <host>${host.name}</host>;
  6. 支持nested object;
  7. 如果有对象继承,根对象上不要使用@Root注解;
  8. @ElementMap注解使用时,会将此元素下的所有属性放入到map中,非常的方便。但切记,需要指定entry和key,并且value必须放置在<property key="k1">VALUE</property>两标签之中位置,不能使用value="v1"的方式;
  9. 不加annotation的字段将不会被处理;
  10. 支持callback,譬如:@Validate,@Commit等。
先写这么多,以后用到其他功能时再补充。

2009年3月10日星期二

Hooking into Equinox: The Hookable Adaptor

前几天正在摆弄equinox的插件体系,模仿equinox的插件,做了相应的简化。今天,看到了EclipseCon 2007上的一篇slide:【Equinox Framework: How to get Hooked】。自己的很多思路与这个有些相像。感觉是个不错的东东,以后有时间再好好看看。

需要了解相关内容,可以参考:Adaptor Hooks

2009年3月6日星期五

Extension-Point和Extension

Eclipse的插件体系设计的非常精到,extension point和extension令人映像深刻。Extension-Point是指系统定义好的,想让别人来扩展的地方,有点类似于电脑主板上的各种插槽,可以插Cpu、内存条等。而Extension是指你根据提供的Extension-Point来进行的扩展实现,类似于你往主板上插上了不同Cpu、内存条。
在自己开发的插件中,可以自己灵活的定义Extension-Point,允许别人来进行扩展。譬如开发一个菜单的插件,然后提供扩展点,允许别人来往菜单上增加菜单项。
这几天,正在了解这方面的知识,Eclipse中的Extension-Point和Extension比较的复杂,自己想“山寨”一个简单一点的。不需要在写.exsd,而是只需要定义OSGI-INF/plugin/ext.xml,在ext.xml来定义extension-point、extension、param-def(name,type[string,class],optional)、param等元素,然后通过各元素的URI来进行绑定。

2009年3月5日星期四

Annotations for OSGi Declarative Services (A4DS)

在OSGi中,涉及到依赖注入的方法有:Declarative Services (DS),Spring DM,iPOJO,Peaberry Guice等。iPOJO本人没有接触过,其它都略有了解。DS和DM都需要写component.xml;Peaberry虽然不需要xml文件,但是需要一些辅助代码,感觉都有些麻烦。

今天,发现一个挺有意思的东西:Annotations for OSGi Declarative Services (A4DS) 。可以通过annotation来生产xml,比较方便。

2009年3月2日星期一

Embedding Equinox in Apusic 5.1

今天测试了一下,Equinox ServletBridge嵌入到Apusic中运行起来,在dos console界面中可输入OSGi的命令。我用的是(wicket + guice + hibernate) in OSGi的方式,访问的URL:http://localhost:6888/bridge/wicket/

servletbridge的目录布局如下:
WEB-INF/
      /web.xml
      /lib/servletbridge.jar
      /eclipse
          /configuration/config.ini
          /features
          /plugins
只要将打好包的jar文件,放入到plugins目录中,并在config.ini中注明@start即可。

Hibernate-OSGi打包

把Hibernate打成符合OSGi规范的包,支持EJB3和annotation,则需要包含以下类包:
antlr.jar
asm.jar
asm-attrs.jar
cglib.jar
dom4j.jar
commons-collections.jar
javassist.jar
jta.jar
log4j.jar
slf4j-log4j12.jar
slf4j-api.jar
ejb3-persistence.jar
hibernate-commons-annotations.jar
hibernate-core.jar
hibernate-annotations.jar