9910

单飞

   :: 首页 :: 联系 :: 聚合  :: 管理

2007年4月11日 #

https://github.com/FedoraQt/MediaWriter/releases/download/4.1.4/FedoraMediaWriter-win32-4.1.4.exe

http://ap.stykers.moe/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso


http://ap.stykers.moe/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso


UltraISO 无法制作磁盘镜像文件,需要使用FedoraMediaWriter-win32-4.1.4 ,选择下载的iso文件,然后自定义镜像,再选U盘,就可以了,iso文件不能放到U盘上 U盘上的数据会都丢失。
posted @ 2019-07-08 09:22 单飞 阅读(184) | 评论 (0)编辑 收藏

微同商城 搭建私服
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy (default-deploy) on project platform: Failed to deploy artifacts: Could n
ot find artifact com.platform:platform:pom:1.0.0 in releases(http://nkf:
8081/repository/xiaowang-host/) -> [Help 1]

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.platform</groupId>
    <artifactId>platform</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>
    <description>platform</description>
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy (default-deploy) on project platform: Deployment failed: repository eleme
nt was not specified in the POM inside distributionManagement element or in -Dal
tDeploymentRepository=id::layout::url parameter -> [Help 1]
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy (default-deploy) on project platform-mp: Failed to deploy artifacts: Coul
d not find artifact com.platform:platform-mp:jar:1.0.0 in releases (http:
//nkf:8081/repository/xiaowang-host/) -> [Help 1]
搭建私服
D:\public\mvn\apache-maven-3.2.2\conf\settings.xml
<mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>central</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
阿里仓库改为中央仓库

N:\JetBrains\platform\pom.xml

解决上传第二方jar文件和下载第二方jar文件问题:

<distributionManagement>
      <repository>
        <id>releases.xiaowang</id>
        <name>Releases</name>
        <url>http://server2:8081/repository/xiaowang-host/</url>
      </repository>
      <snapshotRepository>
        <id>snapshots.xiaowang</id>
        <name>Snapshot</name>
        <url>http://server2:8081/repository/xiaowang-host/</url>
      </snapshotRepository>
    </distributionManagement>
    <repositories>
        <repository>
          <id>releases.xiaowang</id>
          <url>http://server2:8081/repository/xiaowang-host/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </repository>
    </repositories>


其它pom.xml文件无需做改变,就可以使用mvn deploy 上传和下载第二方jar文件
然后使用mvn package 就没有问题了。
posted @ 2019-04-04 09:36 单飞 阅读(321) | 评论 (0)编辑 收藏

could not obtain connection to any of these urls localhost 1099 jboss

修改
run.bat

-Djnp.host=172.16.0.128 -Dhornetq.remoting.netty.host=172.16.0.23
-Djava.rmi.server.hostname=172.16.0.23修改后:

REM set CLUSTER_PROPS="-Djnp.port=1099 -Djnp.rmiPort=1098 -Djnp.host=172.16.0.23 -Dhornetq.remoting.netty.host=172.16.0.23 -Dhornetq.remoting.netty.port=5445"
set JVM_ARGS=%CLUSTER_PROPS% -XX:+UseParallelGC  -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=%CONFIG_DIR%  -Djava.util.logging.config.file=%CONFIG_DIR%\logging.properties -Djava.library.path=. -Djava.rmi.server.hostname=172.16.0.23
run.sh

export CLUSTER_PROPS="-Djnp.port=6099 -Djnp.rmiPort=6098 -Djnp.host=server23 -Dhornetq.remoting.netty.host=server23 -Dhornetq.remoting.netty.port=6445"
export JVM_ARGS="$CLUSTER_PROPS  -Xms512M -Xmx4096M -Dhornetq.config.dir=$CONFIG_DIR -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Djava.library.path=. -Dcom.sun.management.jmxre
mote -Dcom.sun.management.jmxremote.port=4000 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=server23"
posted @ 2015-08-05 09:15 单飞 阅读(449) | 评论 (2)编辑 收藏

ObjectSerializationCodecFactory objSFactory = new ObjectSerializationCodecFactory();
objSFactory.setDecoderMaxObjectSize(MAX_OBJECT_SIZE);

objSFactory.setEncoderMaxObjectSize(MAX_OBJECT_SIZE);

int maxNioCache = 100 * 1024 * 1024;

log.info("设置NIO最大网络传输对象大小为:100M");

因为通过nio发送的对象超过限定大小了。。​

15/03/19 17:35:13 ERROR search.InfoCallable: org.apache.mina.filter.codec.ProtocolDecoderException: org.apache.mina.core.buffer.BufferDataException: dataLength: 1175869 (Hexdump: 00 11 F1 3D AC ED 00 05 75 72 01 00 13 5B 4C 6A 61 76 61 2E 6C 61 6E 67 2E 4F 62 6A 65 63 74 3B 78 70 00 00 00 02 73 72 01 00 11 6A 61 76 61 2E 6C 61 6E 67 2E 49 6E 74 65 67 65 72 78 72 01 00 10 6A 61 76 61 2E 6C 61 6E 67 2E 4E 75 6D 62 65 72 78 70 00 00 44 9B 73 72 01 00 13 6A 61 76 61 2E 75 74 69 6C 2E 41 72 72 61 79 4C 69 73 74 78 70 00 00 00 C8 77 04 00 00 00 C8 73 72 01 00 26 63 6E 2E 62 65 6E 67 75 6F 2E 70 6C 61 74 66 6F 72 6D 2E 6E 75 74 2E 63 6F 72 65 2E 75 74 69 6C 2E 53 63 6F 72 65 78 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 AA A4 C4 00 00 03 E8 00 00 00 01 40 32 2D 0B 96 B4 2A 9E 00 00 00 00 00 00 00 00 53 A6 18 B1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 45 61 C6 3D D5 B3 00 00 00 00 00 00 00 00 74 00 01 30 74 0A A5 3C 64 69 76 20 63 6C 61 73 73 3D 22 62 6C 6B 43 6F 6E 74 61 69 6E 65 72 53 62 6C 6B 43 6F 6E 20 42 53 48 41 52 45 5F 50 4F 50 22 20 69 64 3D 22 61 72 74 69 62 6F 64 79 22 3E 20 0A 20 3C 64 69 76 20 63 6C 61 73 73 3D 22 6D 6F 64 75 6C 65 53 69 6E 67 6C 65 49 6D 67 30 31 22 3E 20 0A 20 20 3C 64 69 76 20 63 6C 61 73 73 3D 22 63 74 5F 68 71 69 6D 67 22 3E 20 0A 20 20 20 3C 64 69 76 20 73 74 79 6C 65 3D 22 70 61 64 64 69 6E 67 3A 35 70 78 3B 22 20 69 64 3D 22 72 65 61 6C 73 74 6F 63 6B 22 3E 20 0A 20 20 20 3C 2F 64 69 76 3E 20 0A 20 20 20 3C 63 65 6E 74 65 72 3E 20 0A 20 20 20 20 3C 64 69 76 20 73 74 79 6C 65 3D 22 68 65 69 67 68 74 3A 31 30 70 78 22 3E 3C 2F 64 69 76 3E 20 0A 20 20 20 20 3C 64 69 76 3E 20 0A 20 20 20 20 20 3C 61 20 68 72 65 66 3D 22 68 74 74 70 3A 2F 2F 73 74 6F 63 6B 2E 66 69 6E 61 6E 63 65 2E 73 69 6E 61 2E 63 6F 6D 2E 63 6E 2F 68 6B 73 74 6F 63 6B 2F 71 75 6F 74 65 73 2F 68 73 69 2E 68 74 6D 6C 22 20 74 61 72 67 65 74 3D 22 5F 62 6C 61 6E 6B 22 3E 3C 69 6D 67 20 73 72 63 3D 22 68 74 74 70 3A 2F 2F 69 6D 61 67 65 2E 73 69 6E 61 6A 73 2E 63 6E 2F 6E 65 77 63 68 61 72 74 2F 70 6E 67 2F 6D 69 6E 2F 68 6B 2F 68 73 69 2E 70 6E 67 22 20 2F 3E 3C 2F 61 3E 20 0A 20 20 20 20 3C 2F 64 69 76 3E 20 0A 20 20 20 20 3C 64 69 76 20 63 6C 61 73 73 3D 22 74 6F 5F 70 61 67 65 22 20 73 74 79 6C 65 3D 22 70 61 64 64 69 6E 67 3A 30 20 31 35 70 78 3B 22 3E 20 0A 20 20 20 20 20 3C 73 70 61 6E 20 73 74 79 6C 65 3D 22 66 6C 6F 61 74 3A 72 69 67 68 74 3B 22 3E 3C 61 20 73 74 79 6C 65 3D 22 62 61 63 6B 67 72 6F 75 6E 64 3A 75 72 6C 28 68 74 74 70 3A 2F 2F 69 33 2E 73 69 6E 61 69 6D 67 2E 63 6E 2F 63 6A 2F 32 30 31 33 2F 30 38 32 32 2F 55 32 35 30 38 50 33 31 44 54 32 30 31 33 30 38 32 32 31 31 30 34 33 30 2E 70 6E 67 29 20 6E 6F 2D 72 65 70 65 61 74 20 31 35 70 78 20 30 70 78 3B 22 20 73 75 64 61 2D 75 61 74 72 61 63 6B 3D 22 6B 65 79 3D 66 69 6E 61 6E 63 65 5F 73 74 6F 63 6B 5F 68 6F 74 63 6F 6C 26 61 6D 70 3B 76 61 6C 75 65 3D 36 22 20 74 61 72 67 65 74 3D 22 5F 62 6C 61 6E 6B 22 20 68 72 65 66 3D 22 68 74 74 70 3A 2F 2F 6D 2E 73 69 6E 61 2E 63 6F 6D 2E 63 6E 2F 6D 2F 66 69 6E 61 6E 63 65 2E 68 74 6D 6C 22 3E E5 AE A2 E6 88 B7 E7 AB AF 3C 2F 61 3E 3C 2F 73 70 61 6E 3E 20 0A 20 20 20 20 20 3C 61 20 68 72 65 66 3D 22 68 74 74 70 3A 2F 2F 73 74 6F 63 6B 2E 66 69 6E 61 6E 63 65 2E 73 69 6E 61 2E 63 6F 6D 2E 63 6E 2F 68 6B 73 74 6F 63 6B 2F 76 69 65 77 2F 73 74 6F 63 6B 2E 70 68 70 3F 63 6F 64 65 3D 68 73 69 26 61 6D 70 3B 6C 65 76 65 6C 32 3D 31 22 20 63 6C 61 73 73 3D 22 68 6B 5F 6C 65 76 65 6C 32 22 20 74 61 72 67 65 74 3D 22 5F 62 6C 61 6E 6B 22 3E E6 9F A5 E7 9C 8B E5 85 8D E8 B4 B9 4C 65 76 65 6C 32 E5 8D 81 E6 A1 A3 E8 A1 8C E6 83 85 26 67 74 3B 26 67 74 3B 3C 2F 61 3E 20 0A 20 20 20 20 3C 2F 64 69 76 3E 20 0A 20 20 20 3C 2F 63 65 6E 74 65 72 3E 20 0A 20 20 3C 2F 64 69 76 3E 20 0A 20 20 3C 64 69 76 20 73 74 79 6C 65 3D 22 68 65 69 67 68 74 3A 31 30 70 78 22 3E 3C 2F 64 69 76 3E 20 0A 20 3C 2F 64 69 76 3E 20 0A 20 3C 70 3E E6 96 B0 E6 B5 AA E8 B4 A2 E7 BB 8F E8 AE AF 20 33 E6 9C 88 31 39 E6 97 A5 E6 B6 88 E6 81 AF EF BC 8C E6 8D AE E8 B4 A2 E5 8D 8E E7 A4 BE E6 8A A5 E9 81 93 EF BC 8C E7 BE 8E E5 9B BD E8 81 94 E5 82 A8 E5 B1 80 E4 BC 9A E5 90 8E E5 A3 B0 E6 98 8E E4 B8 80 E5 A6 82 E9 A2 84 E6 9C 9F E5 89 94 E9 99 A4 E4 BF 9D E6 8C 81 E2 80 9C E8 80 90 E6 80 A7 E2 80 9D E4 B8 80 E8 AF 8D EF BC 8C E5 B8 82 E5 9C BA E6 86 A7 E6 86 AC E7 BE 8E E5 9B BD E7 A8 8D E4 B8 BA E5 BB B6 E8 BF 9F E5 8A A0 E6 81 AF E6 AD A5 E4 BC 90 EF BC 8C E6 B8 AF E8 82 A1 E9 AB 98 E5 BC 80 32 30 35 E7 82 B9 EF BC 8C E6 8A A5 32 34 2C 33 32 35 E7 82 B9 EF BC 8C E5 85 B6 E5 90 8E E5 8F 8D E5 A4 8D E5 90 91 E4 B8 8A EF BC 8C E6 9C 80 E5 90 8E E4 B8 94 E8 B7 91 E8 B5 A2 E5 9B BD E6 8C 87 E3 80 82 E6 81 92 E6 8C 87 E6 94 B6 E6 8A A5 32 34 2C 34 36 38 E7 82 B9 EF BC 8C E5 8D 87 33 34 38 2E 38 31 E7 82 B9 EF BC 8C E5 8D 87 31 2E 34 35 25 EF BC 9B E5 9B BD E6 8C 87 E6 8A A5 31 32 2C 31 32 32 E7 82 B9 EF BC 8C E5 8D 87 31 34 30 2E 32 33 E7 82 B9 EF BC 8C E5 8D 87 31 2E 31 37 25 E3 80 82 E6 88 90 E4 BA A4 31 2C 30 32 35 2E 36 39 E4 BA BF E5 85 83 E3 80 82 3C 2F 70 3E 20 0A 20 3C 70 3E 3C 73 70 61 6E 20 69 64 3D 22 68 6B 73 74 6F 63 6B 5F 68 6B 30 30 37 30 30 22 3E 3C 2F 73 70 61 6E 3E 3C 73 70 61 6E 20 69 64 3D 22 71 75 6F 74 65 5F 68 6B 30 30 37 30 30 22 3E 3C 2F 73 70 61 6E 3E 28 30 30 37 30 30 2D 48 4B 29 E4 B8 8E E5 8F 8B E9 82 A6 28 30 31 32 39 39 2D 48 4B 29 E4 B8 BA E6 92 91 E8 B5 B7 E5 A4 A7 E5 B8 82 E5 8A 9F E8 87 A3 EF BC 8C E7 BB A9 E4 BC 98 E7 9A 84 E8 85 BE E8 AE AF E8 8E B7 E5 A4 9A E9 97 B4 E5 A4 A7 E8 A1 8C E5 94 B1 E5 A5 BD EF BC 8C E8 82 A1 E4 BB B7 E5 88 9B 35 32 E5 91 A8 E9 AB 98 E4 BD 8D EF BC 8C E6 94 B6 E6 8A A5 31 34 35 E5 85 83 EF BC 8C E5 8D 87 36 2E 36 39 25 EF BC 8C E6 88 90 E8 BF 91 E9 80 BE 39 30 E4 BA BF E5 85 83 EF BC 9B E5 8F 8B E9 82 A6 E4 BF 9D E9 99 A9 E6 94 B6 E6 8A A5 34 38 2E 32 E5 85 83 EF BC 8C E5 8D 87 33 2E 31 30 32 25 EF BC 8C E6 88 90 E4 BA A4 E9 80 BE 31 36 E4 BA BF E5 85 83 E3 80 82 20 E8 85 BE E8 AE AF E7 BB A9 E4 BC 98 E5 8D B3 E8 A2 AB E8 B5 84 E9 87 91 E7 8B AC E6 8A A2 E3 80 82 3C 2F 70 3E 20 0A 20 3C 70 3E E5 8F A6 E4 B8 80 E8 BE B9 E5 8E A2 EF BC 8C E4 B8 AD E7 A7 BB E5 8A A8 28 30 30 39 34 31 2D 48 4B 29 E4 B8 9A E7)


        at org.apache.mina.core.future.DefaultReadFuture.getMessage(DefaultReadFuture.java:60)
        at cn.benguo.platform.nut.client.search.InfoCallable.call(InfoCallable.java:114)
        at cn.benguo.platform.nut.client.search.InfoCallable.call(InfoCallable.java:24)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:139)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:139)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:909)
        at java.lang.Thread.run(Thread.java:662)


posted @ 2015-03-19 17:50 单飞 阅读(1273) | 评论 (0)编辑 收藏

严重: Error deploying web application directory news
java.lang.ClassFormatError: com/sun/faces/config/ConfigureListener : illegal LocalVariableTable missing: LVT
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1814)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:868)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1321)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1200)
        at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:144)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:72)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:55)
        at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:296)
        at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1061)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:260)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4237)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:919)
        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:882)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1137)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
        at org.apache.catalina.core.StandardService.start(StandardService.java:450)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
2014-12-4 16:09:00 org.apache.coyote.http11.Http11NioProtocol start
 

[data@server7 tomcat-news]$ vi bin/catalina.sh             
export LANG=zh_CN.GBK
 
-Dfile.encoding=GBK
vi  /etc/profile
#export JAVA_HOME=/opt/java/jrockit-jdk
export JAVA_HOME=/opt/datam/java/jdk1.8.0_25

jrockit-jdk 存在这个问题,换成sun jdk

https://community.oracle.com/thread/2213951?tstart=0
posted @ 2014-12-04 16:37 单飞 阅读(955) | 评论 (0)编辑 收藏

JuiceSSH - SSH Client
支持ssh2 协议,支持使用key文件。

把下面的网址:
https://play.google.com/store/apps/details?id=com.sonelli.juicessh
拷贝到
就可以从google app 下载apk文件了,然后使用360手机助手安装到手机里面
posted @ 2013-11-20 17:52 单飞 阅读(833) | 评论 (0)编辑 收藏

写正则式挺好用的一个elcipse插件:
http://myregexp.com/eclipsePlugin.html

内容拷贝如下:

Screenshot:
Screenshot of eclipse plugin

Features

  • Full highlighting of regular expression syntax for an easy visual clue
    (including bracket matching , ; error detecting , , , )
  • Tooltips will be shown when the mouse is over a part of the regex. , , ,
  • Evaluates your regular expression while you are typing;
  • 4 distinct match modes:
    • Find a sequence of characters ;
    • Match a complete text , ;
    • Split text (see java.lang.String.split(String regex)) ;
    • Replace ;
  • Support for pattern flags (e.g. Pattern.CASE_INSENSITIVE, Pattern.DOTALL, ...);
  • Generation of java source string literals based on the regexp, (escape slash, e.g. "\(x\)" becomes "\\(x\\)")
  • Synchronized selection of regular expression and text: Just select part of the regexp to see which part of the text is matched by this part. .
Functionality of this plugin is available as java-applet

Demo of Regular Expression Hilighting

Move mouse to regex to see example of tooltips and brackets matching
(19|20)\d\d([- /.])(0[1-9]|1[012])\2(0[1-9]|[12][0-9]|3[01])

Opening in eclipse

In Eclipse choose Window -> Show View -> Other -> Regex Util

License

This programm is free and is distributed under the GPL. All funds for developement come from advertisement on this page.

Download the plugin

Last version: Download
posted @ 2013-06-27 10:49 单飞 阅读(642) | 评论 (1)编辑 收藏

http://blog.csdn.net/babyfacer/article/details/3081818

http://driver.sis.com/download/download_step2.php?id=155884&country=&Image791.x=73&Image791.y=9
posted @ 2013-02-15 22:40 单飞 阅读(338) | 评论 (0)编辑 收藏

1. run.sh

export JVM_ARGS="$CLUSTER_PROPS  -Xms512M -Xmx1024M -Dhornetq.config.dir=$CONFIG_DIR -Djava.util.logging.config.file=$CONFIG_DIR/loggin
g.properties -Djava.library.path=. -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=4000 -Dcom.sun.management.jmxremo
te.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=hadoop119"
#export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Djava.libra
ry.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"

2.hornetq-configuration.xml
 
[hadoop@server119 hornetq-2.2.14.Final]$ cd config/stand-alone/non-clustered/
[hadoop@server119 non-clustered]$ vi hornetq-configuration.xml
 
 <message-counter-enabled>true</message-counter-enabled>
3.配置jmx

jnp=jnp://192.168.0.119:1099
jmx_url=service:jmx:rmi:///jndi/rmi://192.168.0.119:4000/jmxrmi


3.
https://code.google.com/p/jms-monitor



public class Task implements Runnable {
    
private static Log log = LogFactory.getLog(Main.class);
 
    @Override
    
public void run() {
        Context initialContext 
= null;
        JMXConnector connector 
= null;
 
        
try {
            initialContext 
= new InitialContext(Service.getEnv());
            String queueName 
= "/queue/" + Service.getProperties().getProperty("queue.name");
            Queue queue 
= (Queue) initialContext.lookup(queueName);
            ObjectName on 
= ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queue.getQueueName());
            connector 
= JMXConnectorFactory.connect(new JMXServiceURL(Service.getProperties().getProperty("jmx_url")), new HashMap());
            MBeanServerConnection mbsc 
= connector.getMBeanServerConnection();
            JMSQueueControl queueControl 
= MBeanServerInvocationHandler.newProxyInstance(mbsc, on, JMSQueueControl.classfalse);
 
            String counters 
= queueControl.listMessageCounter();
            MessageCounterInfo messageCounter 
= MessageCounterInfo.fromJSON(counters);
 
            
int count = messageCounter.getDepth();
            
if (count < Integer.valueOf(Service.getProperties().getProperty("warning_msg_count"))) {
                log.info(
"jms queue length is " + count + ". Additional info: " + new Gson().toJson(messageCounter));
            }
 
            
if (count >= Integer.valueOf(Service.getProperties().getProperty("warning_msg_count"))
                    
&& count < Integer.valueOf(Service.getProperties().getProperty("fatal_msg_count"))) {
                log.warn(
"jms queue length is " + count + ". Additional info: " + new Gson().toJson(messageCounter));
            }
 
            
if (count >= Integer.valueOf(Service.getProperties().getProperty("fatal_msg_count"))) {
                log.fatal(
"jms queue length is " + count + ". Additional info: " + new Gson().toJson(messageCounter));
            }
        } 
catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        } 
finally {
            
try {
                connector.close();
                initialContext.close();
            } 
catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        }
    }
}


4.查看结果

25:01:2013 17:16:18.891  INFO pool-1-thread-1 Main:run:50 - jms queue length is 0. Additional info: {"name":"DLQ","subscription":"null","durable":true,"count":0,"countDelta":0,"depth":0,"depthDelta":0,"lastAddTimestamp":"70-1-1 8:00:00","udpateTimestamp":"13-1-25 17:16:05"}
25:01:2013 17:16:19.891  INFO pool-1-thread-1 Main:run:50 - jms queue length is 0. Additional info: {"name":"DLQ","subscription":"null","durable":true,"count":0,"countDelta":0,"depth":0,"depthDelta":0,"lastAddTimestamp":"70-1-1 8:00:00","udpateTimestamp":"13-1-25 17:16:15"}

posted @ 2013-01-25 17:34 单飞 阅读(1447) | 评论 (0)编辑 收藏

获取页面请求基础地址:

#set( $basePath = "$!{request.scheme}://$!{request.serverName}:$!{request.serverPort}$!{request.contextPath}/" )
String Literals
当你使用#set directive,String literal 封闭在一对双引号内。象下面:
#set( $directoryRoot = "www" )
#set( $templateName = "index.vm" )
#set( $template = "$directoryRoot/$templateName" )
$template
上面这段代码的输出结果为:
www/index.vm
但是,当string literal 被封装在单引号内时,它将不被解析:
#set( $foo = "bar" )
$foo
#set( $blargh = '$foo' )
$blargh
输出为:
bar $foo
上面这个特性可以通过修改 velocity.properties 文件的 stringliterals.interpolate = false 的
值来改变上面的特性是否有效。
posted @ 2012-12-12 14:44 单飞 阅读(606) | 评论 (0)编辑 收藏

     摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><script type="text/javascript">/**  * 时间对象的格式化;  */  Dat...  阅读全文
posted @ 2012-12-06 11:36 单飞 阅读(8518) | 评论 (2)编辑 收藏

/db/flare/flare/bin/flared --daemonize --data-dir /db/flare/data/proxy/ --index-server-name 127.0.0.1 --index-server-port 12120 --server-name 127.0.0.1 --server-port 11211
/db/flare/flare/bin/flared --daemonize --data-dir /db/flare/data/master1/ --index-server-name 127.0.0.1 --index-server-port 12120 --server-name 127.0.0.1 --server-port 11212  
/db/flare/flare/bin/flared --daemonize -f /db/flare/flare/etc/flare-proxy.conf
 
data-dir = /db/flare/data/proxy
index-server-name = localhost
index-server-port = 12120
log-facility = local1
server-name = localhost
server-port = 11211
 
1.查看flare日志:
[flare@server logs]# vi /etc/syslog.conf

# falre logs
local0.*                                                /opt/logs/flare-index.log
local2.*                                               /opt/logs/flare-master.log
local1.*                                               /opt/logs/flare-proxy.log
 
 
[flare@server flare]$ cd /opt/logs/
[flare@server logs]$ ll
总计 15836
-rw------- 1 flare flare 11889779 09-10 10:16 flare-index.log
-rw------- 1 flare flare    23490 09-04 17:15 flare-master.log
-rw------- 1 flare flare  4270801 09-10 09:55 flare-proxy.log
 
 
分析日志查询为啥起不起来。

[flare@server logs]# tail -f flare-proxy.log
 
2.查看端口是否被占用
[flare@server logs]# lsof -i:11212
[flare@server logs]# lsof -i:11211
[flare@server logs]# lsof -i:11210

3.查看tmp临时目录文件是否正常
vi /db/flare/tmp/flare.xml
发现改文件损坏,从备份程序拷贝
cp /opt/flare/tmp/flare.xml /db/flare/tmp/


启动成功
posted @ 2012-11-21 10:40 单飞 阅读(413) | 评论 (0)编辑 收藏

cccccccccccccccccccccccccccccccccccccc
posted @ 2012-11-20 13:52 单飞 阅读(698) | 评论 (0)编辑 收藏

《蔡康永的说话之道》
《内向者的无敌》
《餐巾纸的背面》
《笔仙》
《寻人启事》
《你的知识需要管理》
《内向者的优势》
《把时间当做朋友》
《气场》
《如何消除内心的恐惧》
《哪来的天才》
《一万小时理论》
《番茄工作法》
《淡定的力量》
《Your money brother》
《思考的技术》
《暗时间》
posted @ 2012-11-20 09:15 单飞 阅读(351) | 评论 (0)编辑 收藏

1 private static String getMethodName(String fildeName){
2 byte[] items = fildeName.getBytes();
3 items[0= (byte)((char)items[0]-'a'+'A');;
4 return new String(items);
5 }


效率是最高的.
posted @ 2012-03-20 17:15 单飞 阅读(2868) | 评论 (1)编辑 收藏

在开发环境,只能用localhost (本机机器名) 来访问站点,因为在DotNet环境下,
域名的设置不能单单通过设置hosts文件实现,必须在IIS里面配置。
另外:
 <casClientConfig
        casServerLoginUrl="https://××××.net:8443/cas/login"
        casServerUrlPrefix="https://××××.net:8443/cas/"
        serverName="http://localhost:1054/CasTest"

如果serverName 配置不当也会导致循环重定向。
在确定

<sessionState mode="StateServer" cookieless="UseCookies" timeout="36000"></sessionState>

配置没有问题的时候,可能因为serverName 的配置问题导致循环重定向。
CasAuthentication.cs
   internal static void ProcessRequestAuthentication()
        {
            HttpContext context = HttpContext.Current;

            // Look for a valid FormsAuthenticationTicket encrypted in a cookie.
            CasAuthenticationTicket casTicket = null;
            FormsAuthenticationTicket formsAuthenticationTicket = GetFormsAuthenticationTicket();
            if (formsAuthenticationTicket != null)
            {
                ICasPrincipal principal;
                if (ServiceTicketManager != null)
                {
                    string serviceTicket = formsAuthenticationTicket.UserData;
                    casTicket = ServiceTicketManager.GetTicket(serviceTicket);
                    if (casTicket != null)
                    {
                        IAssertion assertion = casTicket.Assertion;

                        if (!ServiceTicketManager.VerifyClientTicket(casTicket))
                        {
                            Trace.WriteLine(String.Format("{0}:Ticket failed verification." + Environment.NewLine, CommonUtils.MethodName));

这里是调试的断点设置。
posted @ 2012-03-13 14:26 单飞 阅读(3193) | 评论 (1)编辑 收藏

catalina.sh

JAVA_OPTS="$JAVA_OPTS
-server -Xverify:none -XX:+UseParallelGC -XX:PermSize=20M -Xms2200m
-Djava.rmi.server.hostname=172.16.4.200
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9004
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false"

增加一行配置.
可以使用jconsole 来远程连接,查看内存使用.服务器端,应用所需的内存,最好一次申请到位,即使不用也要占着
posted @ 2012-02-23 12:52 单飞 阅读(358) | 评论 (0)编辑 收藏

参考
http://gwt-ext.com/forum/viewtopic.php?t=1682


import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("sessout")
public interface MyService extends RemoteService {
    public Integer getUserSessionTimeoutMillis();
}


import com.google.gwt.user.client.rpc.AsyncCallback;

public interface MyServiceAsync {
    void getUserSessionTimeoutMillis(AsyncCallback async);
}



import com.google.gwt.user.server.rpc.RemoteServiceServlet;

@SuppressWarnings("serial")
public class MyServiceImpl extends RemoteServiceServlet implements MyService {

    public Object getLoggedInUser() {
        return getThreadLocalRequest().getSession().getAttribute(EConstants.USER);
    }

    /**
     * Should be the first RPC call from all UIDef*.onModuleLoad()
     *
     * @return java.lang.Integer (-1 if the user session has already timed out,
     *         otherwise, the number of milliseconds)
     */
    public Integer getUserSessionTimeoutMillis() {
        Integer returnObj = null;
        if (getLoggedInUser() != null) {
            returnObj = new Integer(EduConstants.SESSION_TIMEOUT_MILLIS); // milliseconds
        } else {
            returnObj = new Integer(-1);
        }
        return returnObj;
    }
}

public class EConstants {

    public static final String USER = "sessuser";

    public static final int SESSION_TIMEOUT_MILLIS = 1800; // 30 minute
}


web.xml

  <servlet>
    <servlet-name>sessServlet</servlet-name>
    <servlet-class>com.chinaedu.edupass.server.MyServiceImpl</servlet-class>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>sessServlet</servlet-name>
    <url-pattern>/ldapmanager/sessout</url-pattern>
  </servlet-mapping>


public class LManager implements EntryPoint {


    private Timer sessionTimeoutTimer = null;
private MyServiceAsync service;
public void onModuleLoad() {

service = (MyServiceAsync) GWT.create(MyService.class);

        showLogin();
}

private void showLogin() {
        final LoginDialog dialog = new LoginDialog() {
            protected void showMainView() {
                super.showMainView();
                doShowMainView();
                // 登录后开始计时
                initSessionTimers();
            }

        };
        dialog.setAutoCenter(true);
        dialog.setIsModal(true);
        dialog.setShowHeader(false);
        dialog.setShowToolbar(false);
        dialog.setEdgeSize(10);
        dialog.setWidth(300);
        dialog.setHeight(180);

        dialog.show();
    }


    private void doShowMainView() {


/**
     * 客户端在超时后执行跳转登录
     *
     * @sessionTimeInMillis Integer
     */
    private void initSessionTimers() {
        // Allow 30 seconds to get the RPC call constructed and called.
        sessionTimeoutTimer = new Timer() {
            public void run() {
                service.getUserSessionTimeoutMillis(new AsyncCallback() {
                    public void onSuccess(Object result) {
                        int sessionTimeMillis = ((Integer) result).intValue();
                        if (sessionTimeMillis == -1) {
                            // 超时后执行跳转到登录窗口
                            displaySessionTimedOut();
                        } else {
                            sessionTimeoutTimer.cancel();
                            initSessionTimers();
                        }
                    }

                    public void onFailure(final Throwable caught) {
                        SC.say(LdapI18N.ldapMessages().failed());
                    }
                });
            }
        };
        // 31 minutes 服务器端设置为30分钟超时,如果30分钟没有操作
        // 就会返回超时,如果期间有操作,则在等31分钟后再轮询
        sessionTimeoutTimer.schedule(31*60*1000);

    }

    private void displaySessionTimedOut() {
        SC.say(LI18N.ldapMessages().sessionTimeOut(), new BooleanCallback() {
            public void execute(Boolean value) {
                showLogin();
            }
        });
    }
posted @ 2011-08-03 18:18 单飞 阅读(684) | 评论 (0)编辑 收藏

GWT SmartGWT
1.发布到Tomcat/Jetty.
    在发布之前需要使用Eclipse中的GWT-Compile
    选中工程->右键菜单-Google-GWT Comile
    编译后的文件在/war 目录下面,拷贝此文件到Tomcat的Webapp下面就可以访问了。


2.SmartGWT的可用性和GXT相比,差别巨大。
    GXT前端展示非常成熟,具体表现:a.Grid 控件、表单。而SmartGWT 的GridList控件非常简单,甚至不支持分页,要自己DIY。
    不推荐使用SmartGWT做项目。

3.开发上可以只用GWT做前端,使用Hessian来调用另外一个工程的Service,Hessian调用servlet已经封装的很好。
    在开发上要分为两个工程:Project-webapp Project-GWT.


4.编译后的文件体积有点庞大,至少50M。

5.具体开发细节可以参<<GWT揭秘>>,里面有很多最佳实践,另外不要吝啬银子,最好使用GXT。
posted @ 2011-07-27 10:48 单飞 阅读(775) | 评论 (0)编辑 收藏

安装Maven后每次启动出现警告信息:

Eclipse is running in a JRE, but a JDK is required
Some Maven plugins may not work when importing projects or updating source folders.



直接创建一个快捷方式,加入启动参数
-vm D:\server\jdk1.6.0_21\bin\javaw

修改eclipse.ini好多次都不成功。

参考帮助文档:
eclipse -vm c:\jdk1.4.2\jre\bin\javaw

终于解决问题了。
posted @ 2011-07-05 10:12 单飞 阅读(1212) | 评论 (0)编辑 收藏

1 打开VMWare界面,选择菜单VM–Settings,在对话框中选择CDROM,设置参数为Use ISO image,选择CentOS镜像安装文件;

2 启动虚拟机中的CentOS系统,用root登录,在桌面上用鼠标右键新建一终端窗口;

3 在终端中输入 cd /media/CentOS_5.2_Final/CentOS 回车



[root@localhost CentOS]# rpm -ivh cpp-4.1.2-48.el5.i386.rpm
[root@localhost CentOS]# rpm -ivh kernel-headers-2.6.18-194.el5.i386.rpm
[root@localhost CentOS]# rpm -ivh glibc-headers-2.5-49.i386.rpm
[root@localhost CentOS]# rpm -ivh glibc-devel-2.5-49.i386.rpm
[root@localhost CentOS]# rpm -ivh libgomp-4.4.0-6.el5.i386.rpm
[root@localhost CentOS]# rpm -ivh gcc-4.1.2-48.el5.i386.rpm

[root@localhost CentOS]# gcc -v
posted @ 2011-06-19 19:11 单飞 阅读(423) | 评论 (0)编辑 收藏

10:32:54,936 FIN | [SQL]
    select
        deployment0_.DBID_ as DBID1_0_0_,
        deployment0_.NAME_ as NAME2_0_0_,
        deployment0_.TIMESTAMP_ as TIMESTAMP3_0_0_,
        deployment0_.STATE_ as STATE4_0_0_
    from
        JBPM4_DEPLOYMENT deployment0_
    where
        deployment0_.DBID_=?
10:32:54,936 FST | [LongType] binding '1' to parameter: 1
10:32:54,941 FST | [TextType] returning 'uploadProcess' as column: NAME2_0_0_
10:32:54,941 FST | [LongType] returning '1294327812018' as column: TIMESTAMP3_0_0_
10:32:54,941 FST | [StringType] returning 'active' as column: STATE4_0_0_
10:32:54,945 FIN | [SQL]
    select
        resources0_.DEPLOYMENT_ as DEPLOYMENT4_0_1_,
        resources0_.DBID_ as DBID1_1_,
        resources0_.NAME_ as NAME5_1_,
        resources0_.DBID_ as DBID1_5_0_,
        resources0_.DBVERSION_ as DBVERSION2_5_0_,
        resources0_.BLOB_VALUE_ as BLOB3_5_0_
    from
        JBPM4_LOB resources0_
    where
        resources0_.DEPLOYMENT_=?
10:32:54,945 FST | [LongType] binding '1' to parameter: 1
10:32:54,948 FST | [LongType] returning '2' as column: DBID1_5_0_
10:32:54,949 FST | [IntegerType] returning '0' as column: DBVERSION2_5_0_
10:32:54,958 FST | [LongType] returning '1' as column: DEPLOYMENT4_0_1_
10:32:54,958 FST | [LongType] returning '2' as column: DBID1_1_
10:32:54,981 INF | [TextType] could not read column value from result set: NAME5_1_; 流已被关闭
10:32:54,985 WRN | [JDBCExceptionReporter] SQL Error: 17027, SQLState: null
10:32:54,985 SEV | [JDBCExceptionReporter] 流已被关闭
### EXCEPTION ###########################################
10:32:54,985 INF | [DefaultCommandService] exception while executing command org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl@59a331
org.hibernate.exception.GenericJDBCException: could not initialize a collection: [org.jbpm.pvm.internal.repository.DeploymentImpl.resources#1]
 at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 at org.hibernate.loader.Loader.loadCollection(Loader.java:2089)
 at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:62)
 at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:628)
 at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
 at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1853)
 at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:369)
 at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:111)
 at org.hibernate.collection.PersistentMap.keySet(PersistentMap.java:249)
 at org.jbpm.pvm.internal.repository.DeploymentImpl.getResourceNames(DeploymentImpl.java:166)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:198)
 at org.jbpm.pvm.internal.repository.DeploymentImpl_$$_javassist_43.getResourceNames(DeploymentImpl_$$_javassist_43.java)
 at org.jbpm.pvm.internal.repository.ProcessDeployer.deploy(ProcessDeployer.java:59)
 at org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java:46)
 at org.jbpm.pvm.internal.repository.RepositorySessionImpl.getObject(RepositorySessionImpl.java:130)
 at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.getProcessDefinition(ProcessDefinitionQueryImpl.java:92)
 at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java:72)
 at org.jbpm.pvm.internal.query.AbstractQuery.execute(AbstractQuery.java:83)
 at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
 at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)
 at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
 at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:49)
 at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
 at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
 at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)
 at org.jbpm.pvm.internal.query.AbstractQuery.untypedUniqueResult(AbstractQuery.java:74)
 at org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.uniqueResult(ProcessDefinitionQueryImpl.java:161)
 at com.smapp.service.workflow.business.core.impl.CoreServiceWorkflowImpl.listProcess(CoreServiceWorkflowImpl.java:823)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
 at $Proxy5.listProcess(Unknown Source)
 at com.smapp.service.workflow.core.CoreServiceWorkflowProcessTest.testGetActiveRectangle(CoreServiceWorkflowProcessTest.java:94)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at junit.framework.TestCase.runTest(TestCase.java:164)
 at junit.framework.TestCase.runBare(TestCase.java:130)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:120)
 at junit.framework.TestSuite.runTest(TestSuite.java:230)
 at junit.framework.TestSuite.run(TestSuite.java:225)
 at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.SQLException: 流已被关闭
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
 at oracle.jdbc.driver.LongAccessor.getCharacterStream(LongAccessor.java:340)
 at oracle.jdbc.driver.OracleResultSetImpl.getCharacterStream(OracleResultSetImpl.java:1519)
 at oracle.jdbc.driver.OracleResultSet.getCharacterStream(OracleResultSet.java:2007)
 at org.hibernate.type.AbstractLongStringType.get(AbstractLongStringType.java:54)
 at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:186)
 at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:175)
 at org.hibernate.persister.collection.AbstractCollectionPersister.readIndex(AbstractCollectionPersister.java:769)
 at org.hibernate.collection.PersistentMap.readFrom(PersistentMap.java:281)
 at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1072)
 at org.hibernate.loader.Loader.readCollectionElements(Loader.java:690)
 at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:630)
 at org.hibernate.loader.Loader.doQuery(Loader.java:745)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
 at org.hibernate.loader.Loader.loadCollection(Loader.java:2082)
 ... 62 more
### EXCEPTION ###########################################
10:32:54,989 WRN | [LoadContexts] fail-safe cleanup (collections) : org.hibernate.engine.loading.CollectionLoadContext@17ae020<rs=oracle.jdbc.driver.OracleResultSetImpl@1c2ab6c>
10:32:54,989 WRN | [CollectionLoadContext] On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained [1] entries


jbpm4_lob 表NAME_ HIBERNATE类型为TEXT ,Hibernate自动创建的类型为long。导致10:32:54,981 INF | [TextType] could not read column value from result set: NAME5_1_; 流已被关闭

确保生成的字段类型为clob
posted @ 2011-01-07 14:39 单飞 阅读(3493) | 评论 (1)编辑 收藏

数据处理流程.jpdl.xml
数据处理流程.png
<process name="数据处理流程"

但是,在部署流程的时候,因为
import java.util.zip.ZipEntry;
ZipEntry zipEntry = zipInputStream.getNextEntry();

不支持中文,所以除非修改DeploymentImpl的源代码,否则不成。
最好使用英文,然后建立一张自己的部署流程表。


posted @ 2010-12-24 11:19 单飞 阅读(189) | 评论 (0)编辑 收藏

因为jre1.6u22安装程序的策略文件没有

    permission java.util.PropertyPermission "file.encoding", "read";
所以封装了一下jre安装程序
文件准备:
D:"svn1.3"setup"jre-6u22-windows-i586.exe
D:"svn1.3"setup"java.policy


java.policy

这个文件包含了permission java.util.PropertyPermission "file.encoding", "read" 修改后的结果。

使用setupfactory制作安装脚本:

http://www.blogjava.net/Files/sdyjmc/setupJRE.sf7.zip

下载后,去掉.zip后缀使用setupfactory 7导入即可制作自己的jre安装程序。
posted @ 2010-12-17 13:28 单飞 阅读(261) | 评论 (0)编辑 收藏

因为jre1.6u22安装程序的策略文件没有

    permission java.util.PropertyPermission "file.encoding", "read";
所以封装了一下jre安装程序
文件准备:
D:\svn1.3\setup\jre-6u22-windows-i586.exe
D:\svn1.3\setup\java.policy


java.policy

这个文件包含了permission java.util.PropertyPermission "file.encoding", "read" 修改后的结果。

使用setupfactory制作安装脚本:

http://www.blogjava.net/Files/sdyjmc/setupJRE.sf7.zip

下载后,去掉.zip后缀使用setupfactory 7导入即可制作自己的jre安装程序。
posted @ 2010-12-15 11:49 单飞 阅读(265) | 评论 (0)编辑 收藏

Java Plug-in 1.6.0_22
使用 JRE 版本 1.6.0_22-b04 Java HotSpot(TM) Client VM
用户主目录 = C:\Documents and Settings\Administrator
----------------------------------------------------
c:   清除控制台窗口
f:   终结在结束队列上的对象
g:   垃圾收集
h:   显示此帮助消息
l:   转储类载入程序列表
m:   打印内存使用
o:   触发日志记录
q:   隐藏控制台
r:   重新载入策略配置
s:   转储系统和部署属性
t:   转储线程列表
v:   转储线程堆栈
x:   清除类载入程序高速缓存
0-5: 设置跟踪级别为<n>
----------------------------------------------------


java.security.AccessControlException: access denied (java.util.PropertyPermission file.encoding read)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
    at java.lang.System.getProperty(Unknown Source)
    at org.apache.tools.zip.ZipEncodingHelper.isUTF8(ZipEncodingHelper.java:246)
    at org.apache.tools.zip.ZipEncodingHelper.getZipEncoding(ZipEncodingHelper.java:214)
    at org.apache.tools.zip.ZipOutputStream.<init>(ZipOutputStream.java:236)
    at com.smapp.service.exchange.web.upload.zip.ZipBean.<init>(ZipBean.java:39)
    at com.smapp.service.exchange.web.upload.MainPanel$3.<init>(MainPanel.java:443)
    at com.smapp.service.exchange.web.upload.MainPanel.zipFile(MainPanel.java:443)
    at com.smapp.service.exchange.web.upload.MainPanel.access$3(MainPanel.java:440)
    at com.smapp.service.exchange.web.upload.MainPanel$2.run(MainPanel.java:364)
java.lang.NullPointerException
    at com.smapp.service.exchange.web.upload.zip.ZipBean.makeZipSize(ZipBean.java:87)
    at com.smapp.service.exchange.web.upload.zip.ZipBean.getMaxProcessValue(ZipBean.java:108)
    at com.smapp.service.exchange.web.upload.MainPanel.zipFile(MainPanel.java:450)
    at com.smapp.service.exchange.web.upload.MainPanel.access$3(MainPanel.java:440)
    at com.smapp.service.exchange.web.upload.MainPanel$2.run(MainPanel.java:364)
2010-12-14 16:51:59 com.smapp.service.exchange.web.upload.zip.ZipBean getMaxProcessValue
信息: 总体进度:0
java.lang.NullPointerException
    at com.smapp.service.exchange.web.upload.zip.ZipBean.closeZip(ZipBean.java:57)
    at com.smapp.service.exchange.web.upload.MainPanel.zipFile(MainPanel.java:455)
    at com.smapp.service.exchange.web.upload.MainPanel.access$3(MainPanel.java:440)
    at com.smapp.service.exchange.web.upload.MainPanel$2.run(MainPanel.java:364)

xp、win7系统下面会出现改问题,修改
c:\Program Files\Java\jdk1.6.0_21\jre\lib\security\java.policy
最后增加一行代码:
permission java.util.PropertyPermission "file.encoding", "read";
};




posted @ 2010-12-14 17:16 单飞 阅读(2453) | 评论 (0)编辑 收藏

portal 工程依赖于dao、model、workflow、util工程,通过增加依赖工程能解决编译问题。
但是使用tomcat调试的时候,会找不到其它工程的class。
在工程名上右击,选 Properties,找到 Java Build Path,选第二个选项卡“Projects”,点“Add...”按钮,
会弹出“Required Project Selection”框,里面会出现这个工作区中除了当前工程之外的其他工程,把需要链
接的工程勾选上点“OK”就可以了

右击工程名,选择Properties,选择libraries Tab,点Add External Class Folder...,
选择你lib工程的目标输出文件夹,添加进去应该就可以

这样可以解决多个依赖工程自动输出class的问题。

    <classpathentry combineaccessrules="false" kind="src" path="/business"/>
    <classpathentry combineaccessrules="false" kind="src" path="/dao"/>
    <classpathentry combineaccessrules="false" kind="src" path="/datamodel"/>



posted @ 2010-12-09 10:21 单飞 阅读(2724) | 评论 (0)编辑 收藏

// 创建一个FormPanel组件实例
    var loginForm = new Ext.FormPanel({
                    id:'loginForm',// formPanel组件的ID
                    width:600,// 组件宽度
                    height:300,// 组件高度
                    frame:true,
                    fileUpload: true,
                    enctype:'multipart/form-data',
                    //实现非AJAX提交表单一定要加下面的两行!
                    onSubmit: Ext.emptyFn,
                    method:'POST',
                    align:'center',// 组件居左布局,还有right和center两个值可以选择
                    name: 'loginForm', //组件名称
                    labelAlign:"left",//让label居右
                    labelWidth:120,//定义label的宽度
                    items:[{

xtype: "textfield",
                            inputType:'file',
                            name: 'processFile',
                            fieldLabel: '文件',
                            allowBlank:false,
                            anchor:'95%'


public void deploy(HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        request.setCharacterEncoding("utf-8");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");  
        String tmpDir = getServletContext().getRealPath("/temp");// 初始化上传文件的临时寄放目录
        String uploadPath = getServletContext().getRealPath("/upload");// 初始化上传文件后的保存
        try {
            if (ServletFileUpload.isMultipartContent(request)) {
                 DiskFileItemFactory factory = new DiskFileItemFactory();
                 //指定在内存中缓存数据大小,单位为byte,这里设为1Mb  
                factory.setSizeThreshold(1 * 1024 * 1024);   
                //设置一旦文件大小超过getSizeThreshold()的值时数据存放在硬盘的目录  
                factory.setRepository(new File(tmpDir));   
                ServletFileUpload sfu = new ServletFileUpload(factory);  
                 // 指定单个上传文件的最大尺寸,单位:字节,这里设为5Mb  
                sfu.setFileSizeMax(100 * 1024 * 1024);  
                //指定一次上传多个文件的总尺寸,单位:字节,这里设为10Mb  
                sfu.setSizeMax(100 * 1024 * 1024);   
                sfu.setHeaderEncoding("UTF-8"); //设置编码,因为我的jsp页面的编码是utf-8的  
                FileItemIterator fii = sfu.getItemIterator(request);// 解析request请求  
                uploadPath = uploadPath + "\\jbpm\\"; // 选定上传的目录此处为当前目录  
                if (!new File(uploadPath).isDirectory()){  
                    new File(uploadPath).mkdirs(); //选定上传的目录此处为当前目录,没有则创建  
                }  
                  
                int index = 0;  
                while (fii.hasNext()) {  
                    FileItemStream fis = fii.next();// 从集合中获得一个文件流  
                    if (!fis.isFormField() && fis.getName().length() > 0) {// 过滤掉表单中非文件域  
                        String fileName = fis.getName();// 获得上传文件的文件名                        
                        BufferedInputStream in = new BufferedInputStream(fis.openStream());   
                        BufferedOutputStream out = new BufferedOutputStream(  
                                new FileOutputStream(new File(uploadPath + "\\" + fileName)));  
                        Streams.copy(in, out, true); // 开始把文件写到你指定的上传文件夹  
                        index++;  
                    }  
                }  
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        response.setContentType("text/html");
        response.getWriter().print("{success:true}");
    }

上传文件为空:因为:
    <filter-mapping>
        <!--拦截所有的URL请求-->
        <filter-name>struts2</filter-name>
        <!--上传文件会不起作用-->
        <!-- url-pattern>/*</url-pattern -->
        <url-pattern>*.action</url-pattern>
    </filter-mapping>

原因就是因为在web.xml中配置了Struts的filter
<filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

改成

<filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>*.action</url-pattern>
</filter-mapping>

就可以了


posted @ 2010-12-04 11:33 单飞 阅读(838) | 评论 (0)编辑 收藏

h name 'processEngine' defined in ServletContext resource [/WEB-INF/classes/appl
icationContext.xml]: Instantiation of bean failed; nested exception is org.sprin
gframework.beans.factory.BeanDefinitionStoreException: Factory method [public or
g.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.create
ProcessEngine()] threw exception; nested exception is org.springframework.beans.
factory.BeanCreationException: Error creating bean with name 'sessionFactory' de
fined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invo
cation of init method failed; nested exception is org.hibernate.HibernateExcepti
on: Errors in named queries: findTasks, findMessages, findTimers, findGroupsByUs
erAndGroupType, findProcessInstanceIds, findJobsWithException, findProcessInstan
ceById, findExecutionById, findProcessInstanceByIdIgnoreSuspended, findGroupsByU
ser, findFirstDueJob, findExclusiveJobs, findFirstAcquirableJob
        at org.springframework.beans.factory.support.ConstructorResolver.instant
iateUsingFactoryMethod(ConstructorResolver.java:572)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:97
3)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:879)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        Truncated. see log file for complete stacktrace

Caused By: org.springframework.beans.factory.BeanDefinitionStoreException: Facto
ry method [public org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine
.SpringHelper.createProcessEngine()] threw exception; nested exception is org.sp
ringframework.beans.factory.BeanCreationException: Error creating bean with name
 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicati
onContext.xml]: Invocation of init method failed; nested exception is org.hibern
ate.HibernateException: Errors in named queries: findTasks, findMessages, findTi
mers, findGroupsByUserAndGroupType, findProcessInstanceIds, findJobsWithExceptio
n, findProcessInstanceById, findExecutionById, findProcessInstanceByIdIgnoreSusp
ended, findGroupsByUser, findFirstDueJob, findExclusiveJobs, findFirstAcquirable
Job
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy
.instantiate(SimpleInstantiationStrategy.java:154)
        at org.springframework.beans.factory.support.ConstructorResolver.instant
iateUsingFactoryMethod(ConstructorResolver.java:561)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:97
3)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:879)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        Truncated. see log file for complete stacktrace

Caused By: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/
classes/applicationContext.xml]: Invocation of init method failed; nested except
ion is org.hibernate.HibernateException: Errors in named queries: findTasks, fin
dMessages, findTimers, findGroupsByUserAndGroupType, findProcessInstanceIds, fin
dJobsWithException, findProcessInstanceById, findExecutionById, findProcessInsta
nceByIdIgnoreSuspended, findGroupsByUser, findFirstDueJob, findExclusiveJobs, fi
ndFirstAcquirableJob
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        Truncated. see log file for complete stacktrace

Caused By: org.hibernate.HibernateException: Errors in named queries: findTasks,
 findMessages, findTimers, findGroupsByUserAndGroupType, findProcessInstanceIds,
 findJobsWithException, findProcessInstanceById, findExecutionById, findProcessI
nstanceByIdIgnoreSuspended, findGroupsByUser, findFirstDueJob, findExclusiveJobs
, findFirstAcquirableJob
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
397)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1327)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession
Factory(LocalSessionFactoryBean.java:855)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessi
onFactory(LocalSessionFactoryBean.java:774)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPr
opertiesSet(AbstractSessionFactoryBean.java:211)
        Truncated. see log file for complete stacktrace
>
<2010-11-24 下午08时13分23秒 CST> <Error> <Deployer> <BEA-149265> <Failure occur
red in the execution of deployment request with ID '1290600743834' for task '4'.
 Error is: 'weblogic.application.ModuleException: '
weblogic.application.ModuleException:
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.jav
a:1514)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:41)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:119)
        Truncated. see log file for complete stacktrace

Caused By: org.hibernate.HibernateException: Errors in named queries: findTasks,
 findMessages, findTimers, findGroupsByUserAndGroupType, findProcessInstanceIds,
 findJobsWithException, findProcessInstanceById, findExecutionById, findProcessI
nstanceByIdIgnoreSuspended, findGroupsByUser, findFirstDueJob, findExclusiveJobs
, findFirstAcquirableJob
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
397)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1327)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession
Factory(LocalSessionFactoryBean.java:855)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessi
onFactory(LocalSessionFactoryBean.java:774)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPr
opertiesSet(AbstractSessionFactoryBean.java:211)
        Truncated. see log file for complete stacktrace
>
<2010-11-24 下午08时13分23秒 CST> <Error> <Deployer> <BEA-149202> <Encountered a
n exception while attempting to commit the 1 task for the application 'oa'.>
<2010-11-24 下午08时13分23秒 CST> <Warning> <Deployer> <BEA-149004> <Failures we
re detected while initiating deploy task for application 'oa'.>
<2010-11-24 下午08时13分23秒 CST> <Warning> <Deployer> <BEA-149078> <Stack trace
 for message 149004
weblogic.application.ModuleException: :org.hibernate.HibernateException:Errors i
n named queries: findTasks, findMessages, findTimers, findGroupsByUserAndGroupTy
pe, findProcessInstanceIds, findJobsWithException, findProcessInstanceById, find
ExecutionById, findProcessInstanceByIdIgnoreSuspended, findGroupsByUser, findFir
stDueJob, findExclusiveJobs, findFirstAcquirableJob
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
397)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1327)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession
Factory(LocalSessionFactoryBean.java:855)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessi
onFactory(LocalSessionFactoryBean.java:774)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPr
opertiesSet(AbstractSessionFactoryBean.java:211)
        Truncated. see log file for complete stacktrace
>
<2010-11-24 下午08时13分23秒 CST> <Error> <Console> <BEA-240003> <Console encoun
tered the following error weblogic.application.ModuleException: :org.hibernate.H
ibernateException:Errors in named queries: findTasks, findMessages, findTimers,
findGroupsByUserAndGroupType, findProcessInstanceIds, findJobsWithException, fin
dProcessInstanceById, findExecutionById, findProcessInstanceByIdIgnoreSuspended,
 findGroupsByUser, findFirstDueJob, findExclusiveJobs, findFirstAcquirableJob
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
397)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1327)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession
Factory(LocalSessionFactoryBean.java:855)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessi
onFactory(LocalSessionFactoryBean.java:774)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPr
opertiesSet(AbstractSessionFactoryBean.java:211)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:190)
        at org.springframework.context.support.AbstractApplicationContext.getBea
n(AbstractApplicationContext.java:1075)
        at org.jbpm.pvm.internal.processengine.SpringProcessEngine.get(SpringPro
cessEngine.java:116)
        at org.jbpm.pvm.internal.processengine.SpringProcessEngine.create(Spring
ProcessEngine.java:64)
        at org.jbpm.pvm.internal.cfg.ConfigurationImpl.buildProcessEngine(Config
urationImpl.java:90)
        at org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine(
SpringHelper.java:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy
.instantiate(SimpleInstantiationStrategy.java:142)
        at org.springframework.beans.factory.support.ConstructorResolver.instant
iateUsingFactoryMethod(ConstructorResolver.java:561)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:97
3)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:879)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:574)
        at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:425)
        at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:276)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:197)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:47)
        at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run
(EventsManager.java:481)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
        at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(Eve
ntsManager.java:181)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:1863)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletCon
text.java:3126)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.jav
a:1512)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:41)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:119)
        at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedMod
uleDriver.java:200)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(Module
ListenerInvoker.java:247)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:41)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:119)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartMod
ulesFlow.java:27)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.ja
va:1267)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:41)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.
java:409)
        at weblogic.application.internal.SingleModuleDeployment.activate(SingleM
oduleDeployment.java:43)
        at weblogic.application.internal.DeploymentStateChecker.activate(Deploym
entStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(Ap
pContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.ac
tivate(AbstractOperation.java:569)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.ac
tivateDeployment(ActivateOperation.java:150)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.do
Commit(ActivateOperation.java:116)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.co
mmit(AbstractOperation.java:323)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploym
entCommit(DeploymentManager.java:844)
        at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeplo
ymentList(DeploymentManager.java:1253)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(
DeploymentManager.java:440)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.com
mit(DeploymentServiceDispatcher.java:163)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
gWorkManagerImpl.java:528)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>
<2010-11-24 下午08时13分44秒 CST> <Warning> <netuix> <BEA-423420> <Redirect is e
xecuted in begin or refresh action. Redirect url is /console/console.portal?_nfp
b=true&_pageLabel=WebAppApplicationOverviewPage&WebAppApplicationOverviewPortlet
handle=com.bea.console.handles.AppDeploymentHandle%28%22com.bea%3AName%3Doa%2CTy
pe%3DAppDeployment%22%29.>


posted @ 2010-11-24 20:56 单飞 阅读(4618) | 评论 (1)编辑 收藏

     摘要: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->sheldon.xml /*!  * Ext JS Library 3.3.0  * Copyright(c)&...  阅读全文
posted @ 2010-11-22 20:29 单飞 阅读(588) | 评论 (0)编辑 收藏

Programmer's Friend

Class Dependency Analyzer (CDA) V1.13.1


http://www.dependency-analyzer.org/

posted @ 2010-08-30 14:02 单飞 阅读(252) | 评论 (0)编辑 收藏

private Label doneLabel;
private Timer timer;

    public class ATask extends TimerTask {
        @Override
        public void run() {
            showScrollText(doneLabel);
           

        }
    }

    /**
     * 滚动显示字幕
     *
     * @param toDoLabel
     */
    private void showScrollText(final Label toDoLabel) {
        if (toDoLabel != null) {
            if (toDoLabel.isDisposed()) {
                timer.cancel();
                return;
            }
            shell.getDisplay().asyncExec(new Runnable() {
                // @Override
                public void run() {
                    String txt = toDoLabel.getText();
                    if (txt != null && txt.length() > 50) {
                        txt = txt.substring(1, txt.length())
                                + txt.substring(0, 1);
                        toDoLabel.setText(txt);
                    }
                }

            });

        }
    }
构造的时候
// 滚动显示字幕
        timer = new Timer();
        timer.schedule(new ATask(), 0, 500);

        //
    }

    // @Override
    public void dispose() {
        timer.cancel();
        super.dispose();
    }
private Timer timer;

    public class ATask extends TimerTask {
        @Override
        public void run() {
            showScrollText(doneLabel);
           

        }
    }


    /**
     * 滚动显示字幕
     *
     * @param toDoLabel
     */
    private void showScrollText(final Label toDoLabel) {
        if (toDoLabel != null) {
            if (toDoLabel.isDisposed()) {
                timer.cancel();
                return;
            }
            shell.getDisplay().asyncExec(new Runnable() {
                // @Override
                public void run() {
                    String txt = toDoLabel.getText();
                    if (txt != null && txt.length() > 50) {
                        txt = txt.substring(1, txt.length())
                                + txt.substring(0, 1);
                        toDoLabel.setText(txt);
                    }
                }

            });

        }
    }


构造的时候
// 滚动显示字幕
        timer = new Timer();
        timer.schedule(new ATask(), 0, 500);

// @Override
    public void dispose() {
        timer.cancel();
        super.dispose();
    }



posted @ 2010-08-06 16:47 单飞 阅读(927) | 评论 (1)编辑 收藏

What the Job Post Says What it Really Means
Standard work hours are 40-50 hours a week We expect developers to live in their tiny tiny cubes 24-7
我们希望程序员7*24小时工作在自己的小隔间里面
This is a support position We don’t allow our developers to have a life outside of work
我们不希望员工有工作之外的生活
You will work closely with the PM, DBA and QA Our environment is highly political, riddled with ridiculous rules made by people who don’t understand software, and we get very little done
我们的环境是高政治的,由很多不懂软件的人制定了很多荒谬的制度。我们还有很多没有达标。
This position involves working with our real-time application I don’t know what real-time means but it sounds good
Great opportunity for growth Only a desperate person would deal with this shit
只有绝望的人才会做这种狗屎的工作。
Job candidate must be resourceful, responsible and able to work well under pressure. Our corporate culture is basically the ‘Lord of the Flies
我们的管理方式就是“蚁王和工蚁”的方式。
posted @ 2010-05-12 10:35 单飞 阅读(175) | 评论 (0)编辑 收藏

http://blog.csdn.net/xiaxiaorui2003/archive/2009/07/29/4390401.aspx

我现在在编写一个JAVA工程,是提供给客户调用的API,但是我的API中大约需要依赖10个.JAR,

以前我都是使用ECLIPSE 的 EXPORT  JAR file功能导出 JAR,这样的JAR可以使用,但是我的API种依赖的包客户还是需要导入,这样一共就需要导入11个包了,太麻烦了,现在就是想包括API和依赖的JAR打成一个JAR,这样子就方便多了,

现在找到了,使用ECLIPSE3.4的EXPORT Runnable JAR file功能导出的JAR就是包含了依赖的JAR,导入这一个JAR就可以了,具体操作如下,

1. 先找到你的工程中提供接口的类(要包含MAIN方法),

2. 在该类中右键选择 RUN as

3. 选择 Run configurations

4. 在main窗口中选择main class为本类

5. 点击RUN

6. 选择你的工程,右键选择 EXPORT

7. 在弹出的窗口中选择 runnable jar file

8. 在弹出的 runnable jar file export窗口中第一个launch configuration 中选择你刚才配置的类,

     第二个窗口中选择你要导出的路径

9. 然后选择下一步就OK了


posted @ 2010-02-04 13:58 单飞 阅读(1291) | 评论 (0)编辑 收藏

http://extjs2.javaeye.com/blog/394128

正则表达式在字符串处理中经常使用,关于正则简单的用法相信有一点程序基础的人都懂得一些,这里就不介绍简单基础了。这里主要讲解一下在JAVA中实现了的正则的高级用法-分组与捕获。

    对于要重复单个字符,非常简单,直接在字符后卖弄加上限定符即可,例如 a+ 表示匹配1个或一个以上的a,a?表示匹配0个或1个a。这些限定符如下所示:

  X? X,一次或一次也没有
X* X,零次或多次
X+ X,一次或多次
X{n} X,恰好 n 次
X{n,} X,至少 n 次
X{n,m} X,至少 n 次,但是不超过 m 次





但是我们如果要对多个字符进行重复怎么办呢?此时我们就要用到分组,我们可以使用小括号"()"来指定要重复的子表达式,然后对这个子表达式进行重复,例如:(abc)? 表示0个或1个abc 这里一个括号的表达式就表示一个分组。



   分组可以分为两种形式,捕获组和非捕获组。



捕获组

捕获组可以通过从左到右计算其开括号来编号。例如,在表达式 ((A)(B(C))) 中,存在四个这样的组:

1     ((A)(B(C)))
2     "A
3     (B(C))
4     (C)

组零始终代表整个表达式

之所以这样命名捕获组是因为在匹配中,保存了与这些组匹配的输入序列的每个子序列。捕获的子序列稍后可以通过 Back 引用在表达式中使用,也可以在匹配操作完成后从匹配器检索。



Back 引用 是说在后面的表达式中我们可以使用组的编号来引用前面的表达式所捕获到的文本序列(是文本不是正则)。



例如 ([" ']).* "1   其中使用了分组,"1就是对引号这个分组的引用,它匹配包含在两个引号或者两个单引号中的所有字符串,如,"abc" 或 " ' " 或 ' " '  ,但是请注意,它并不会对" a'或者 'a"匹配。原因上面已经说明,Back引用只是引用文本而不是表达式。



非捕获组

      以 (?) 开头的组是纯的非捕获 组,它不捕获文本,也不针对组合计进行计数。就是说,如果小括号中以?号开头,那么这个分组就不会捕获文本,当然也不会有组的编号,因此也不存在Back 引用。

      在Java中,支持的非捕获组,有如下几种:

 
   
  
(?=X)     X,通过零宽度的正 lookahead
(?!X)     X,通过零宽度的负 lookahead
(?<=X)     X,通过零宽度的正 lookbehind
(?<!X)     X,通过零宽度的负 lookbehind
 




这四个非捕获组用于匹配表达式X,但是不包含表达式的文本。

(?=X ) 零宽度正先行断言。仅当子表达式 X 在 此位置的右侧匹配时才继续匹配。例如,"w+(?="d) 与后跟数字的单词匹配,而不与该数字匹配。此构造不会回溯。
(?!X) 零宽度负先行断言。仅当子表达式 X 不在 此位置的右侧匹配时才继续匹配。例如,例如,"w+(?!"d) 与后不跟数字的单词匹配,而不与该数字匹配。
(?<=X) 零宽度正后发断言。仅当子表达式 X 在 此位置的左侧匹配时才继续匹配。例如,(?<=19)99 与跟在 19 后面的 99 的实例匹配。此构造不会回溯。
(?<!X) 零宽度负后发断言。仅当子表达式 X 不在此位置的左侧匹配时才继续匹配。例如,(?<!19)99 与不跟在 19 后面的 99 的实例匹配






举例:



上面都是理论性的介绍,这里就使用一些例子来说明一下问题:

   1、测试匹配性   (?<!4)56(?=9) 这里的含义就是匹配后面的文本56前面不能是4,后面必须是9组成。因此,可以匹配如下文本 5569  ,与4569不匹配。



  2 、提取字符串   提取 da12bka3434bdca4343bdca234bm   提取包含在字符a和b之间的数字,但是这个a之前的字符不能是c,b后面的字符必须是d才能提取。



        例如这里就只有3434这个数字满足要求。那么我们怎么提取呢?

       首先我们写出提取这个字符串的表达式: (?<!c)a("d+)bd  这里就只有一个捕获组("d+)

       JAVA代码片段如下:

Pattern p = Pattern.compile("(?<!c)a(""d+)bd");
Matcher m = p.matcher("da12bca3434bdca4343bdca234bm");
while(m.find()){
   System.out.println(m.group(1)); //我们只要捕获组1的数字即可。结果 3434
   System.out.println(m.group(0)); // 0组是整个表达式,看这里,并没有提炼出(?<!c)的字符 。结果 a3434bd
}
    可以看到,非捕获组,最后是不会返回结果的,因为它本身并不捕获文本。



正则表达式功能其实非常强大,这里只是对高级用法的简单探讨。有兴趣的朋友和本人共同讨论。
posted @ 2010-01-06 10:14 单飞 阅读(1117) | 评论 (0)编辑 收藏

 众所周知,在程序开发中,难免会遇到需要匹配、查找、替换、判断字符串的情况发生,而这些情况有时又比较复杂,如果用纯编码方式解决,往往会浪费程序员的时间及精力。因此,学习及使用正则表达式,便成了解决这一矛盾的主要手段。
 大 家都知道,正则表达式是一种可以用于模式匹配和替换的规范,一个正则表达式就是由普通的字符(例如字符a到z)以及特殊字符(元字符)组成的文字模式,它 用以描述在查找文字主体时待匹配的一个或多个字符串。正则表达式作为一个模板,将某个字符模式与所搜索的字符串进行匹配。
  自从jdk1.4推出java.util.regex包,就为我们提供了很好的JAVA正则表达式应用平台。
 
 因为正则表达式是一个很庞杂的体系,所以我仅例举些入门的概念,更多的请参阅相关书籍及自行摸索。

\\ 反斜杠
\t 间隔 ('\u0009')
\n 换行 ('\u000A')
\r 回车 ('\u000D')
\d 数字 等价于[0-9]
\D 非数字 等价于[^0-9]
\s 空白符号 [\t\n\x0B\f\r]
\S 非空白符号 [^\t\n\x0B\f\r]
\w 单独字符 [a-zA-Z_0-9]
\W 非单独字符 [^a-zA-Z_0-9]
\f 换页符
\e Escape
\b 一个单词的边界
\B 一个非单词的边界
\G 前一个匹配的结束

^为限制开头
^java     条件限制为以Java为开头字符
$为限制结尾
java$     条件限制为以java为结尾字符
.  条件限制除\n以外任意一个单独字符
java..     条件限制为java后除换行外任意两个字符


加入特定限制条件「[]」
[a-z]     条件限制在小写a to z范围中一个字符
[A-Z]     条件限制在大写A to Z范围中一个字符
[a-zA-Z] 条件限制在小写a to z或大写A to Z范围中一个字符
[0-9]     条件限制在小写0 to 9范围中一个字符
[0-9a-z] 条件限制在小写0 to 9或a to z范围中一个字符
[0-9[a-z]] 条件限制在小写0 to 9或a to z范围中一个字符(交集)

[]中加入^后加再次限制条件「[^]」
[^a-z]     条件限制在非小写a to z范围中一个字符
[^A-Z]     条件限制在非大写A to Z范围中一个字符
[^a-zA-Z] 条件限制在非小写a to z或大写A to Z范围中一个字符
[^0-9]     条件限制在非小写0 to 9范围中一个字符
[^0-9a-z] 条件限制在非小写0 to 9或a to z范围中一个字符
[^0-9[a-z]] 条件限制在非小写0 to 9或a to z范围中一个字符(交集)

在限制条件为特定字符出现0次以上时,可以使用「*」
J*     0个以上J
.*     0个以上任意字符
J.*D     J与D之间0个以上任意字符

在限制条件为特定字符出现1次以上时,可以使用「+」
J+     1个以上J
.+     1个以上任意字符
J.+D     J与D之间1个以上任意字符

在限制条件为特定字符出现有0或1次以上时,可以使用「?」
JA?     J或者JA出现

限制为连续出现指定次数字符「{a}」
J{2}     JJ
J{3}     JJJ
文字a个以上,并且「{a,}」
J{3,}     JJJ,JJJJ,JJJJJ,???(3次以上J并存)
文字个以上,b个以下「{a,b}」
J{3,5}     JJJ或JJJJ或JJJJJ
两者取一「|」
J|A     J或A
Java|Hello     Java或Hello
 
「()」中规定一个组合类型
比如,我查询<a href=\"index.html\">index</a>中<a href></a>间的数据,可写作<a.*href=\".*\">(.+?)</a>

在使用Pattern.compile函数时,可以加入控制正则表达式的匹配行为的参数:
Pattern Pattern.compile(String regex, int flag)

flag的取值范围如下:
Pattern.CANON_EQ     当且仅当两个字符的"正规分解(canonical decomposition)"都完全相同的情况下,才认定匹配。比如用了这个标志之后,表达式"a\u030A"会匹配"?"。默认情况下,不考虑"规 范相等性(canonical equivalence)"。
Pattern.CASE_INSENSITIVE(?i)     默认情况下,大小写不明感的匹配只适用于US-ASCII字符集。这个标志能让表达式忽略大小写进行匹配。要想对Unicode字符进行大小不明感的匹 配,只要将UNICODE_CASE与这个标志合起来就行了。
Pattern.COMMENTS(?x)     在这种模式下,匹配时会忽略(正则表达式里的)空格字符(译者注:不是指表达式里的"\\s",而是指表达式里的空格,tab,回车之类)。注释从#开始,一直到这行结束。可以通过嵌入式的标志来启用Unix行模式。
Pattern.DOTALL(?s)     在这种模式下,表达式'.'可以匹配任意字符,包括表示一行的结束符。默认情况下,表达式'.'不匹配行的结束符。
Pattern.MULTILINE
(?m)     在这种模式下,'^'和'$'分别匹配一行的开始和结束。此外,'^'仍然匹配字符串的开始,'$'也匹配字符串的结束。默认情况下,这两个表达式仅仅匹配字符串的开始和结束。
Pattern.UNICODE_CASE
(?u)     在这个模式下,如果你还启用了CASE_INSENSITIVE标志,那么它会对Unicode字符进行大小写不明感的匹配。默认情况下,大小写不敏感的匹配只适用于US-ASCII字符集。
Pattern.UNIX_LINES(?d)     在这个模式下,只有'\n'才被认作一行的中止,并且与'.','^',以及'$'进行匹配。


抛开空泛的概念,下面写出几个简单的Java正则用例:

◆比如,在字符串包含验证时

//查找以Java开头,任意结尾的字符串
  Pattern pattern = Pattern.compile("^Java.*");
  Matcher matcher = pattern.matcher("Java不是人");
  boolean b= matcher.matches();
  //当条件满足时,将返回true,否则返回false
  System.out.println(b);


◆以多条件分割字符串时
Pattern pattern = Pattern.compile("[, |]+");
String[] strs = pattern.split("Java Hello World  Java,Hello,,World|Sun");
for (int i=0;i<strs.length;i++) {
    System.out.println(strs[i]);
}

◆文字替换(首次出现字符)
Pattern pattern = Pattern.compile("正则表达式");
Matcher matcher = pattern.matcher("正则表达式 Hello World,正则表达式 Hello World");
//替换第一个符合正则的数据
System.out.println(matcher.replaceFirst("Java"));

◆文字替换(全部)
Pattern pattern = Pattern.compile("正则表达式");
Matcher matcher = pattern.matcher("正则表达式 Hello World,正则表达式 Hello World");
//替换第一个符合正则的数据
System.out.println(matcher.replaceAll("Java"));


◆文字替换(置换字符)
Pattern pattern = Pattern.compile("正则表达式");
Matcher matcher = pattern.matcher("正则表达式 Hello World,正则表达式 Hello World ");
StringBuffer sbr = new StringBuffer();
while (matcher.find()) {
    matcher.appendReplacement(sbr, "Java");
}
matcher.appendTail(sbr);
System.out.println(sbr.toString());

◆验证是否为邮箱地址

String str="ceponline@yahoo.com.cn";
Pattern pattern = Pattern.compile("[\\w\\.\\-]+@([\\w\\-]+\\.)+[\\w\\-]+",Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(str);
System.out.println(matcher.matches());

◆去除html标记
Pattern pattern = Pattern.compile("<.+?>", Pattern.DOTALL);
Matcher matcher = pattern.matcher("<a href=\"index.html\">主页</a>");
String string = matcher.replaceAll("");
System.out.println(string);

◆查找html中对应条件字符串
Pattern pattern = Pattern.compile("href=\"(.+?)\"");
Matcher matcher = pattern.matcher("<a href=\"index.html\">主页</a>");
if(matcher.find())
  System.out.println(matcher.group(1));
}

◆截取http://地址
//截取url
Pattern pattern = Pattern.compile("(http://|https://){1}[\\w\\.\\-/:]+");
Matcher matcher = pattern.matcher("dsdsds<http://dsds//gfgffdfd>fdf");
StringBuffer buffer = new StringBuffer();
while(matcher.find()){             
    buffer.append(matcher.group());       
    buffer.append("\r\n");             
System.out.println(buffer.toString());
}
       
◆替换指定{}中文字

String str = "Java目前的发展史是由{0}年-{1}年";
String[][] object={new String[]{"\\{0\\}","1995"},new String[]{"\\{1\\}","2007"}};
System.out.println(replace(str,object));

public static String replace(final String sourceString,Object[] object) {
            String temp=sourceString;   
            for(int i=0;i<object.length;i++){
                      String[] result=(String[])object[i];
               Pattern    pattern = Pattern.compile(result[0]);
               Matcher matcher = pattern.matcher(temp);
               temp=matcher.replaceAll(result[1]);
            }
            return temp;
}


◆以正则条件查询指定目录下文件

 //用于缓存文件列表
        private ArrayList files = new ArrayList();
        //用于承载文件路径
        private String _path;
        //用于承载未合并的正则公式
        private String _regexp;
       
        class MyFileFilter implements FileFilter {

              /**
               * 匹配文件名称
               */
              public boolean accept(File file) {
                try {
                  Pattern pattern = Pattern.compile(_regexp);
                  Matcher match = pattern.matcher(file.getName());               
                  return match.matches();
                } catch (Exception e) {
                  return true;
                }
              }
            }
       
        /**
         * 解析输入流
         * @param inputs
         */
        FilesAnalyze (String path,String regexp){
            getFileName(path,regexp);
        }
       
        /**
         * 分析文件名并加入files
         * @param input
         */
        private void getFileName(String path,String regexp) {
            //目录
              _path=path;
              _regexp=regexp;
              File directory = new File(_path);
              File[] filesFile = directory.listFiles(new MyFileFilter());
              if (filesFile == null) return;
              for (int j = 0; j < filesFile.length; j++) {
                files.add(filesFile[j]);
              }
              return;
            }
   
        /**
         * 显示输出信息
         * @param out
         */
        public void print (PrintStream out) {
            Iterator elements = files.iterator();
            while (elements.hasNext()) {
                File file=(File) elements.next();
                    out.println(file.getPath());   
            }
        }

        public static void output(String path,String regexp) {

            FilesAnalyze fileGroup1 = new FilesAnalyze(path,regexp);
            fileGroup1.print(System.out);
        }
   
        public static void main (String[] args) {
            output("C:\\","[A-z|.]*");
        }

Java正则的功用还有很多,事实上只要是字符处理,就没有正则做不到的事情存在。(当然,正则解释时较耗时间就是了|||……)
posted @ 2009-12-29 10:34 单飞 阅读(193) | 评论 (0)编辑 收藏

1byte = 8 bit

一比特 bit

4

低四位

R

G

B

R

G

B

posted @ 2009-11-27 10:07 单飞 阅读(172) | 评论 (0)编辑 收藏

1.jhttp
2.javanetlib

在看源代码的时候,看到一个设计简单的线程池
package cs519.proxy.tpool;

import java.util.*;

/**
 * Thread Pool Manager.
 *
 * Use a fixed number of threads and process requests.
 */
public class ThreadPool
{
    /**
     * @param    nThread
     *        number of threads to create.
     */
    public ThreadPool( int nThread ) {
        for( int i=0; i<nThread; i++ )
            new WorkerThread().start();
    }
    
    /** list of tasks waiting for execution */
    private final List tasks = new LinkedList();
    
    /** list of lower-priority tasks waiting for execution */
    private final List backgroundTasks = new LinkedList();
    
    /**
     * Adds a new 'task' to the pool.
     * Assigned task will be eventually processed by one of the threads
     * in the pool.
     */
    public synchronized void addTask( Runnable task ) {
        tasks.add(task);
        notify();   // notify any thread waiting for a task
    }
    
    /**
     * Adds a new low-priority 'task' to the pool.
     * Assigned task will be eventually processed by one of the threads
     * in the pool.
     */
    public synchronized void addBackgroundTask( Runnable task ) {
        backgroundTasks.add(task);
    }
    
    /**
     * Obtains a task from the queue.
     */
    private synchronized Runnable getTask() {
        while(true) {
            if(!tasks.isEmpty())
                return (Runnable)tasks.remove(0);
            
            if(!backgroundTasks.isEmpty())
                return (Runnable)backgroundTasks.remove(0);
            
            try {
                wait(); // wait for a new task
            } catch( InterruptedException e ) {
                System.err.println("thread interrupted");
                throw new InternalError();
            }
        }
    }

    
    /** destructs the pool. */
    public void dispose() {
        suicideSignal = true;
    }
    private boolean suicideSignal = false;
    
    private class WorkerThread extends Thread {
        public void run() {
            while(!suicideSignal)
                getTask().run();
        }
    }
}

并且提供了缓存管理
package cs519.proxy.cache;

import java.io.*;
import java.util.*;
import java.text.ParseException;
import cs519.proxy.http.*;

public class CacheManagerImpl implements CacheManager
{
    /**
     * Set to non-null to see debug traces.
     */
    private PrintStream debug = System.out;

    /**
     * The number of bytes in the cache.
     * This field is accessed by the Janitor.
     */
    long usedCacheSize = 0;
    
    private Object usedCacheSizeLock = new Object();
        
    /** Atomically modify the value of usedCacheSize. */
    private void modifyUsedCacheSize( long offset ) {
        synchronized(usedCacheSizeLock) {
            usedCacheSize += offset;
        }
    }
        
    private final long cacheLimit;
    protected final TreeMap map=new TreeMap();
    protected final TreeSet fileSet=new TreeSet();
    
    /** The directory in which all cached objects are placed. */
    private final File dir = new File("cache");
    public final File getCacheDir() { return dir; }
    
      
    private final CachePolicy policy;

    /**
     * Constructor:
     *   Load cache file information into CacheFileInfo objects.
     *   Include: filename, lastModified time, file length in byte.
     *   Add these objects to a TreeSet object, make them ordered
     *   by lastModified time.
     *   get current used cache size (in Bytes)
     */
    public CacheManagerImpl(long limit, CachePolicy _policy) throws IOException
    {
        this.policy = _policy;
        this.cacheLimit=limit;  //in bytes

        if(!dir.exists())
            dir.mkdir();
                  
        String[] files=dir.list();

        for(int i=0;i<files.length;i++)
        {
            //System.out.println(files[i].getName());
            File f=new File(dir,files[i]);
            CacheFileInfo cfi = new CacheFileInfo(f);
            fileSet.add(cfi);
            
            map.put( files[i], cfi );
            
            modifyUsedCacheSize(cfi.fsize);
        }
        
        // launch the janitor
        new Thread(new CacheJanitor(this)).start();
    }

  /**
   * Put HttpResponse object into proxy cache.
   * Write HttpResponse to a cache file if it is "toBeCached":
   * 1. use request URL as a base of filename
   * 2. the structure of the cache file contains two parts
   *   a. Request URL (String)
   *   b. HttpResponse object
   */
    public void put( HttpRequest request, HttpResponse response ) {

        long reservedSize;
        
        try {
            
//            if(debug!=null)
//                debug.println("trying to store:"+request.getPath());

            if(policy.toBeCached(request,response))
            {
                
                reservedSize = response.getBodySize()+2000;
                
                // TODO: check if this object fits into the memory
//                if(...)
//                    return;
                
                
                // allocate the space before we actually use it
                modifyUsedCacheSize(reservedSize);
                
                // allocate physical space if it's necessary
                if(!compactCache()) {
            
                    if(debug!=null)
                        debug.println("cache compacting failure:"+request.getPath());
                    
                    // we can't store this object.
                    // cancel this reservation
                    modifyUsedCacheSize(-reservedSize);
                    return;
                }
                
//                if(debug!=null)
//                    debug.println("storing "+request.getPath());

                File f = getCacheFileName(request);
                ObjectOutputStream fileOut=new ObjectOutputStream(
                        new FileOutputStream(f));
                fileOut.writeObject(request.getPath());
                try {
                    fileOut.writeObject(response.getHeaderAsDate("Expires"));
                } catch( java.text.ParseException e ) {
                    fileOut.writeObject(null);  // write a dummy
                }
                fileOut.writeObject(response);
                fileOut.close();
                
                long actualSize = f.length();
                
                synchronized(fileSet) { // use one lock for both objects
                    CacheFileInfo cfi = new CacheFileInfo(f);
                    fileSet.add( cfi );
                    map.put( cfi.fname, cfi );
                }
                
                modifyUsedCacheSize(actualSize-reservedSize);

                if(debug!=null)
                    debug.println("stored  :"+request.getPath());
            }
        } catch( IOException e ) {
            // TODO: possibly return the reservedSize.
            reservedSize=-0;
            modifyUsedCacheSize(reservedSize);
            e.printStackTrace();
            // TODO: remove any corrupted file

        }
    }

    /**
     * Get requested object from proxy cache.
     * if (URL in file)==(request URL), and object not expired, then
     * return object to callee. else return null
     */
    public HttpResponse get( HttpRequest request )
    {
        try {
            File f = getCacheFileName(request);
    
            if(f.exists()) {
                ObjectInputStream oi=new ObjectInputStream(
                                          new FileInputStream(f));
                String fURL=(String)oi.readObject();
                
                if(fURL.equals(request.getPath())) {
                    Date now = new Date();
                    
                    // we won't use it, but we need to read this object
                    // to get to the body
                    Date expires = (Date)oi.readObject();
                
                    // parse the body
                    HttpResponse resp=(HttpResponse)oi.readObject();
                    oi.close();
                    
                    if(debug!=null)
                        debug.println("hit     :"+request.getPath());
                    
                    //check if the object expired
                    try {
                        Date d = resp.getHeaderAsDate("Expires");

                        if(d==null || d.after(now)) {
                            // not expired. use this object.
                            
                            // touch this file for LRU purpose, and
                            // modify fileSet and map content
                            Util.setLastModified(f,now.getTime());
                    
                            // maintain the control data structure
                            synchronized(fileSet) {
                                //remove this object first
                                fileSet.remove(map.get(f.getName()));
                                map.remove(f.getName());
                                
                                //add this object with current attributes
                                CacheFileInfo new_cfi=new CacheFileInfo(f);
                                fileSet.add(new_cfi);
                                map.put(f.getName(),new_cfi);
                            }
                            
                            return resp;
                        }
                    } catch( ParseException e ) { ; }
                    
                    // we'll return null, so the caller will go ahead
                    // and fetch a new one, then store that new object
                    // into the cache.
                    // so we don't need to remove the old item now.
                }
                oi.close();
            }
        } catch( IOException e ) {
            e.printStackTrace();
        } catch( ClassNotFoundException e ) {
            e.printStackTrace();
        }
        if(debug!=null)
            debug.println("miss    :"+request.getPath());
        return null;
    }
    
    public boolean contains( HttpRequest request ) {
        try {
            File f = getCacheFileName(request);
    
            if(!f.exists()) return false;
            
            ObjectInputStream oi=new ObjectInputStream(
                                      new FileInputStream(f));
            String fURL=(String)oi.readObject();
            boolean r = fURL.equals(request.getPath());
            oi.close();
            return r;
        } catch( Exception e ) {
            return false;
        }
    }
    
 
    private File getCacheFileName( HttpRequest msg ) {
        return new File( dir, Integer.toHexString( msg.getPath().hashCode() ) );
    }
 

    /**
     * Compacts the cache so that the total size fell below the limit.
     *
     * @return
     *      true if the operation is successful and our used size is
     *      now lower then the limit.
     */
    public boolean compactCache() {
        synchronized(fileSet) {
            /**
            * Remove LRU cache file until get enough free space
            * LRU strategy
            */
            CacheFileInfo cFile;

            while(cacheLimit<usedCacheSize && !fileSet.isEmpty()) {
                cFile=(CacheFileInfo)fileSet.first();   //the LRU cache file
                
                removeCacheItem(cFile);
            }
            
            return cacheLimit>=usedCacheSize;
        }
    }

    /**
     * Deletes the object represented by a given CacheFileInfo.
     *
     * To remove something from the cache, you need to call this method
     * so that the cache manager can maintain the proper data structure.
     */
    protected void removeCacheItem( CacheFileInfo cfi ) {
        
        synchronized(fileSet) {
            fileSet.remove(cfi);
            map.remove(cfi.fname);
        }
        
        File tmp = new File(dir,"_"+cfi.fname);
        new File(dir,cfi.fname).renameTo(tmp);
        
        if(debug!=null) {
            try {
                // open the file just to print the name of URL
                ObjectInputStream ois = new ObjectInputStream(new FileInputStream(tmp));
                debug.println("delete  :"+ois.readObject());
                ois.close();
            } catch( Exception e ) {
                // it's OK if we fail to print the debug message.
                // so just ignore the error
            }
        }
        
        tmp.delete();
                        
        modifyUsedCacheSize(-cfi.fsize);
    }
}



posted @ 2009-11-25 14:09 单飞 阅读(931) | 评论 (0)编辑 收藏

     摘要: rfc2616 对于返回是chunked格式的字节流的处理 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> import java.io.IOException; import java.io.In...  阅读全文
posted @ 2009-11-05 14:45 单飞 阅读(318) | 评论 (0)编辑 收藏

String cmd = "ping 127.0.0.1 -t";
        Runtime rt 
= Runtime.getRuntime();
        System.out.println(
""+cmd );
        Process process 
= rt.exec(cmd );
        InputStream stdin 
= process.getInputStream();
        InputStreamReader isr 
= new InputStreamReader(stdin);
        BufferedReader br 
= new BufferedReader(isr);
        String line;
        StringBuffer buf 
= new StringBuffer();
        
while ((line = br.readLine()) != null) {
            buf.append(line);
            System.out.println(line);
        }
        
int exitVal = process.waitFor();
        System.out.println(
"Process exitValue: " + exitVal);
posted @ 2009-10-30 17:24 单飞 阅读(303) | 评论 (0)编辑 收藏

<extension
         
id="product"
         point
="org.eclipse.core.runtime.products">
      
<product
            
application="org.test.a.application"
            name
="%productName">
         
<property
               
name="windowImages"
               value
="icons/a.16.gif"/>
         
<property
               
name="appName"
               value
="Test">
         
</property>
         
<property
               
name="preferenceCustomization"
               value
="plugin_customization.ini">
         
</property>


plugin_customization.ini
# new-style tabs by default
org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false

# put the perspective switcher on the top right
org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight

# show progress on startup
org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP=false
org.eclipse.ui/SHOW_TEXT_ON_PERSPECTIVE_BAR=true

   1public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {  
   
2.     /* (non-Javadoc) 
   3.      * @see org.eclipse.ui.application.WorkbenchAdvisor#initialize(org.eclipse.ui.application.IWorkbenchConfigurer) 
   4.      
*/  
   
5.     public void initialize(IWorkbenchConfigurer configurer) {  
   
6.         PlatformUI.getPreferenceStore().setDefault(  
   
7.             IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP, true);  
   
8.         PlatformUI.getPreferenceStore().setDefault(  
   
9.             IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, false);  
  
10.     }  
  
11. } 

  1. SHOW_PROGRESS_ON_STARTUP           在splash的画面中, 是否显示进度条
  2. DISABLE_NEW_FAST_VIEW                   是否禁止左下角的Show View As a Fast View按钮
  3. SHOW_MEMORY_MONITOR                    是否显示内存情况, 并可进行GC操作, 这个比较有意思
  4. SHOW_OPEN_ON_PERSPECTIVE_BAR    在PerspectiveBar上,是否显示New Perspective按钮
  5. SHOW_TEXT_ON_PERSPECTIVE_BAR     在PerspectiveBar上,是否显示Perspective的名称
  6. SHOW_TRADITIONAL_STYLE_TABS         Editor或ViewPart是否使用传统的Tab的样式. 这个肯定用true, false的太老土了.
  7. DOCK_PERSPECTIVE_BAR                      PerspectiveBar的显示位置, 左上 还是 右上.



posted @ 2009-10-14 15:13 单飞 阅读(403) | 评论 (0)编辑 收藏

Bundle-NativeCode: lib/ICE_JNIRegistry.dll;osname=win32;processor=x86

Bundle-NativeCode manifest allows you to use native libraries (DLLs) without having to set the java.library.path system property

#Processor Aliases                      Description

68k                                     # Motorola 68000 and up
ARM                                     # Intel Strong ARM
Alpha                                   # Compaq (ex DEC)
Ignite psc1k                            # PTSC
Mips                                    # SGI
PArisc                                  # Hewlett Packard PA Risc
PowerPC power ppc                       # Motorola/IBM Power PC
Sparc                                   # SUN
x86 pentium i386 i486 i586 i686         # Intel
s390                                    # IBM System 390
s390x                                  # IBM System 390 (64-bit)
v850e                                   # NEC V850E
x86-64 amd64 em64t x86_64               # 64 bit x86 architecture

#OS Aliases                             Description

AIX                                      # IBM
DigitalUnix                              # Compaq
embos                                    # Segger Embedded Software Solutions
Epoc32 SymbianOS                         # Symbian OS
FreeBSD                                  # Free BSD
HPUX                                     # Hewlett Packard
IRIX                                     # Sillicon Graphics
Linux                                    # Open source
MacOS "Mac OS"                   # Apple
MacOSX "Mac OS X"              # Apple
NetBSD                                   # Open source
Netware                                  # Novell
OpenBSD                                  # Open source
OS2 OS/2                                 # IBM
QNX procnto                              # QNX Neutrino 2.1
Solaris                                  # Sun
SunOS                                    # Sun
VxWorks                                  # WindRiver Systems
Windows95 "Windows 95" Win95 Win32       # Microsoft
Windows98 "Windows 98" Win98 Win32       # Microsoft
WindowsNT "Windows NT" WinNT Win32       # Microsoft
WindowsCE "Windows CE" WinCE             # Microsoft
Windows2000 "Windows 2000" Win2000 Win32 # Microsoft
WindowsXP "Windows XP" WinXP Win32       # Microsoft
Windows2003 "Windows 2003" "Windows Server 2003" Win2003 Win32 # Microsoft
WindowsVista WinVista "Windows Vista" Win32 # Microsoft


posted @ 2009-09-22 10:05 单飞 阅读(323) | 评论 (0)编辑 收藏

<#if num?exists>
 <#assign ndex = 1>
<#else>
 <#assign index = 0>
 </#if>
<u>${address?if_exists}</u>
<n>${n?default('')}</n>
posted @ 2009-09-21 13:53 单飞 阅读(221) | 评论 (0)编辑 收藏

 
MenuManager menuMgr = new MenuManager();
        menuMgr.setRemoveAllWhenShown(
true);
        menuMgr.addMenuListener(
new IMenuListener() {
            
public void menuAboutToShow(IMenuManager manager) {
                manager.add(
new Action("删除"){
                    
public void run(){
                        
boolean flag = MessageDialog.openConfirm(parentComposite.getShell(), "确认删除吗?""你确认要删除吗?");
                        
if(flag){
                            removeSelectPage();    
                        }

                        
                    }

                }
);
            }

        }
);
        
final Menu menu = menuMgr.createContextMenu(this);
        
this.setMenu(menu);
        
        tabFolder.addMenuDetectListener(
new MenuDetectListener(){

            
public void menuDetected(MenuDetectEvent arg0) {
                menu.setVisible(
true);
            }

            
        }
);
        tabFolder.addMouseListener(
new MouseAdapter(){
            
public void mouseDown(MouseEvent mouseevent)
            
{
                TabItem selectItem 
= tabFolder.getItem(new Point(mouseevent.x,mouseevent.y));
                tabFolder.setSelection(selectItem);
            }

        }
);
Unfortunately, there is no way to get the bounds of a TabItem on every
platform (specifically, the Mac does not support it).  Therefore, at the
lowest level, we can't get what you want.
"Stéphane Fournier" <stephane.fournier@xxxxxxxxxxxxxxx> wrote in message
news:dgdg2j$5p4$1@xxxxxxxxxxxxxxxxxxx
> Hi,
>
> Does anyone know how to set a Popup Menu on a TabItem.
> I found how to set a Menu on the TabFolder but in my case I need a popup
> menu with a content related to the TabItem when right mouse click is
> triggered (the TabItem could not be the selected tabItem for the
TabFolder).
>
> Another way is to get a dynamic content for the Menu  set on the
> TabFolder, but I need to listen to an event when mouse is moving over
> the TabItems without selecting them....
> My need is something close to the behavior of the CTabItem when the
> mouse is over a not selected CTabItem ,a cross is displayed to close the
> CTabItem without activating it...
>
> Which event can I listen to ?
>
> Thanks in advance,
> Stephane.
posted @ 2009-09-21 13:48 单飞 阅读(639) | 评论 (0)编辑 收藏

     摘要: 前边实现了一个表格的基本功能,但这并不够好,能否为表格实现一些更好的功能呢?答案是肯定的。下边我们来加入直接编辑的功能。 一、要实现这个功能必须提供一个实现ICellModifier的类。内容如下 import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.Table...  阅读全文
posted @ 2009-08-27 14:54 单飞 阅读(543) | 评论 (0)编辑 收藏

    public static void hidePropertiesView() {
        hideView("org.eclipse.ui.views.PropertySheet");
    }

    public static void hideView(final String theViewId) {
        invokeOnDisplayThread(new Runnable() {
            public void run() {
                try {
                    IWorkbenchPage activePage = getActivePage();
                    IViewPart iviewpart = activePage.findView(theViewId);
                    activePage.hideView(iviewpart);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        });
    }

    public static void invokeOnDisplayThread(Runnable runnable) {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IWorkbenchWindow windows[] = workbench.getWorkbenchWindows();
        if (windows != null && windows.length > 0) {
            Display display = windows[0].getShell().getDisplay();
            display.syncExec(runnable);
        } else {
            runnable.run();
        }
    }


posted @ 2009-08-03 11:29 单飞 阅读(653) | 评论 (0)编辑 收藏

方法1:
重写创建按钮的方法createButtonFromButtonBar

方法2:
等待窗口open()后调用:

getButton(0).setText("确定");
getButton(1).setText("取消");

方法3:
国际化操作:
new Fragment Project;

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Fragement Fragment
Bundle-SymbolicName: org.eclipse.jface.fragement
Bundle-Version: 1.0.0
Fragment-Host: org.eclipse.jface;bundle-version="3.2.2"
Bundle-Localization: plugin


new org.eclipse.jface.fragment/src/org/eclipse/jface/messages_zh_CN.properties Files.

cancel = \u53D6\u6D88
ok = \u786E\u5B9A
posted @ 2009-07-28 09:34 单飞 阅读(778) | 评论 (0)编辑 收藏

http://www.trustice.com/java/jnireg/index.shtml registry-3.1.3.zip

public
 static void setProxy(String ip, int port) {
        String topKeyName 
= "HKCU";
        String keyName 
= "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
        RegistryKey topKey 
= Registry.getTopLevelKey(topKeyName);
        RegistryUtil.setDWordCommand(topKey, keyName, 
"ProxyEnable""1");
        RegistryUtil.setStringCommand(topKey, keyName, 
"ProxyServer", ip + ":" + port);
    }

    
public static boolean isProxy() {
        
try {
            RegistryKey registryKey 
= Registry.openSubkey(Registry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", RegistryKey.ACCESS_READ);
            RegistryValue registryValue 
= registryKey.getValue("ProxyEnable");
            
boolean proxyEnable = ((RegDWordValue) registryValue).getData() != 0;

            System.out.println(
"IE 是否启用了代理设置: " + proxyEnable);

            
if (proxyEnable) {
                registryValue 
= registryKey.getValue("ProxyServer");
                System.out.println(
"IE 代理服务器是: " + new String(registryValue.getByteData()));
                
return true;
            }

        } 
catch (NoSuchKeyException ne) {
            ne.printStackTrace();
        } 
catch (RegistryException re) {
            re.printStackTrace();
        }
        
return false;
    }
posted @ 2009-07-08 13:27 单飞 阅读(242) | 评论 (0)编辑 收藏

Bundle-NativeCode: lib/ICE_JNIRegistry.dll;osname=Win32;processor=x86


posted @ 2009-07-08 10:07 单飞 阅读(206) | 评论 (0)编辑 收藏

for (int i = 0; i < COLUMNS.length; i++) {
                TableColumn idColumn 
= new TableColumn(table, SWT.LEFT);
                cName 
= StringUtils.getNotEmpty(COLUMNS[i]);
                ColumnPixelData columnpixeldata 
= new ColumnPixelData(COLUMNS_WIDTH[i]);
                tableLayout.addColumnData(columnpixeldata);
                idColumn.setText(cName);
                idColumn.setResizable(
true);
                
final String columnName = cName;
                
final Collator collator = Collator.getInstance();
                idColumn.addSelectionListener(
new SelectionListener() {
                    
private boolean sortType = true;

                    
public void widgetDefaultSelected(SelectionEvent e) {

                    }

                    
public void widgetSelected(SelectionEvent e) {
                        sortType 
= !sortType;
                        java.util.Collections.sort(input, 
new Comparator<FElement>() {

                            
public int compare(FElement entry1, FElement entry2) {
                                
int rt = -1;
                                
if (COLUMNS[1].equals(columnName)) {
                                    rt 
= collator.compare(entry1.getName(), entry2.getName());
                                } 
else if (COLUMNS[2].equals(columnName)) {
                                    rt 
= collator.compare(StringUtils.getNotEmpty(entry1.getValueTxt()), StringUtils.getNotEmpty(entry2.getValueTxt()));
                                } 
else if (COLUMNS[3].equals(columnName)) {
                                    rt 
= collator.compare(StringUtils.getNotEmpty(entry1.getDescription()), StringUtils.getNotEmpty(entry2.getDescription()));
                                }
                                
if (sortType) {
                                    
return (-1* rt;
                                }

                                
return rt;
                            }

                        });
                        options.setInput(input);
                        options.refresh();

                    }

                });
            }

这种方法的好处是短小精悍
如果做架构设计就不如使用Annotation封装一下,如果是刚入门就不妨每列增加一个Sorter而且还要增加正反两个.
posted @ 2009-07-07 14:45 单飞 阅读(991) | 评论 (0)编辑 收藏

扩展Editor的Configuration
   <extension
         
point="org.eclipse.wst.sse.ui.editorConfiguration">
  
<!-- associating an outline configuration to an input's content type -->
      
<contentOutlineConfiguration
          
class="com.test.outline.OutlineConfiguration"
          target
="org.eclipse.core.runtime.xml,org.eclipse.wst.html.core.htmlsource"/>        
   
</extension>
OutlineConfiguration.java

import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.ui.internal.IReleasable;
import org.eclipse.wst.xml.ui.internal.contentoutline.XMLNodeActionManager;
import org.eclipse.wst.xml.ui.views.contentoutline.XMLContentOutlineConfiguration;

public class OutlineConfiguration extends XMLContentOutlineConfiguration {
    
    
private class ActionManagerMenuListener implements IMenuListener, IReleasable {

        
public void menuAboutToShow(IMenuManager imenumanager) {
            TestAction action 
= new TestAction();
            imenumanager.add(action);
        }

        
public void release() {
            fTreeViewer 
= null;
            
if (fActionManager != null)
                fActionManager.setModel(
null);
        }

        
private XMLNodeActionManager fActionManager;

        
private TreeViewer fTreeViewer;

        
public ActionManagerMenuListener(TreeViewer treeviewer) {
            
super();
            fTreeViewer 
= treeviewer;
        }
    }

    
private ActionManagerMenuListener fContextMenuFiller;

    
public OutlineConfiguration() {
        
super();
    }
    @Override
    
public IMenuListener getMenuListener(TreeViewer treeviewer) {
        
if (fContextMenuFiller == null)
            fContextMenuFiller 
= new ActionManagerMenuListener(treeviewer);
        
return fContextMenuFiller;
    }
}


import org.eclipse.jface.action.Action;

public class TestAction extends Action {
    
public TestAction(){
        
super("Test");
    }
}

这样Outline的Menu就是你自己定义的了.


参考资料:
http://www.eclipse.org/webtools/wst/components/sse/designs/EditorConfiguration.html



posted @ 2009-06-03 10:04 单飞 阅读(282) | 评论 (0)编辑 收藏

MultiPageEditorPart 的addPage方法
public int addPage(Control control)
    {
        
int i = getPageCount();
        addPage(i, control);
        
return i;
    }

    
public void addPage(int i, IEditorPart ieditorpart, IEditorInput ieditorinput)
        
throws PartInitException
    {
        IEditorSite ieditorsite 
= createSite(ieditorpart);
        ieditorpart.init(ieditorsite, ieditorinput);
        Composite composite 
= new Composite(getContainer(), getOrientation(ieditorpart));
        composite.setLayout(
new FillLayout());
        ieditorpart.createPartControl(composite);
        ieditorpart.addPropertyListener(
new IPropertyListener() {

            
public void propertyChanged(Object obj, int j)
            {
                handlePropertyChange(j);
            }

        }
);
        CTabItem ctabitem 
= createItem(i, composite);
        ctabitem.setData(ieditorpart);
        nestedEditors.add(ieditorpart);
    }

那么有办法把一个EditorPart 加入Composite再放到Page里面呢?
public void addHtmlPage(IEditorPart ieditorpart, IEditorInput ieditorinput) throws PartInitException {
        
final SashForm sashForm = new SashForm(getContainer(), SWT.NONE);
        
        
final Composite pageContainer = new Composite(sashForm, SWT.NONE);
        sashForm.setSashWidth(
1);
        
        
final Composite resultContainer = new Composite(sashForm, SWT.NONE);
        resultContainer.setLayout(
new FillLayout());
        
        sashForm.setWeights(
new int[] {11 });        
        createAnalyzePage(resultContainer);
        
        IEditorSite ieditorsite 
= createSite(ieditorpart);
        ieditorpart.init(ieditorsite, ieditorinput);

        pageContainer.setLayout(
new FillLayout());
        ieditorpart.createPartControl(pageContainer);
        ieditorpart.addPropertyListener(
new IPropertyListener() {

            
public void propertyChanged(Object obj, int j) {
                handlePropertyChange(j);
            }

        });
        
        
        
int index = addPage(sashForm);
        setPageText(index, 
"html");
    }
视乎这样就可以了,但是问题出现了.缺少了父类nestedEditors.add(ieditorpart);对editor生命周期的管理.导致属性编辑器出问题.怎么解决呢?
    private CTabFolder container;
    
private ArrayList nestedEditors;

MultiPageEditorPart 声明的都是私有的属性,按照面向对象的设计是不能被继承者访问的.
那怎么办呢?这时候就该使用锤子了."Reflect"

CTabFolder container = (CTabFolder) getParentFileValue(MultiPageEditorPart.class,(MultiPageEditorPart)this"container");
        CTabItem ctabitem 
= new CTabItem(container, 0, i);
        ctabitem.setControl(composite);
        ctabitem.setData(ieditorpart);
        ArrayList nestedEditors 
= (ArrayList) getParentFileValue(MultiPageEditorPart.class,(MultiPageEditorPart)this"nestedEditors");
        nestedEditors.add(ieditorpart);

public static Object getParentFileValue(Class parentClassType,Object object, String filedName) {
        Field fild = null;
        Object fildValue = null;
        try {
            fild = parentClassType.getDeclaredField(filedName);
            fild.setAccessible(true);// 设置安全检查,访问私有成员变量必须
            fildValue = fild.get(object);

        } catch (NoSuchFieldException ex) {
            ex.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return fildValue;
    }

呵呵,问题解决了.

posted @ 2009-05-27 10:31 单飞 阅读(345) | 评论 (0)编辑 收藏

日本程序员: 非常仔细。我认为很主要的一个原因是日本公司的需求非常细致。细致到在网页上,连一个像素都不能偏差的地步。另外,日本人的执行力非常强,对老板的承诺比 命还重要。一个项目可以做到连续3个月天天加班,每天只睡4个小时。然而,高执行力背后的代价是低创造力。在日新月异的互联网今天,很少听说日本工程师发 明了哪些重要的技术。善于做领导想做的事.
印度程序员: 流程做得好,文档写得好。但是他们写代码的能力,我个人的观点是一般般。我想这里面有两层原因。一是有相当一部分在美国工作的印度程序员是半路出家。转行 做程序员是为了生存而已。二是印度程序员在算法,数据机构等基本功方面的水平明显低于中国程序员的。这就导致他们写的很多代码逻辑性不强和性能不优(以我 的标准来看)。不过这两个问题在一定程度上被大量的文档和高性能的硬件设备弥补和掩盖了。善于说领导想听的话.
美国程序员: 美国程序员千奇百怪,好像很难只用几个词来定义他们。喜欢技术,甚至崇尚技术。这点在硅谷尤为突出。这就导致每个技术领域中都有一些人会废寝忘食地钻研。其实这和打游戏一样,如果你着了迷,自然会忘了吃,忘了喝,拼命地玩。我所认识的美国程序员还有一个特点,才艺能力都不错。这会让老板有时候很头疼,因为程序员不那么“听话”。他们不是给老板交差,而是要实现自己的想法,自己的设计,自己的完美。说白了,就是美国程序员有时候想法多了点。
中国的程序员: 比较注重理论知识。反过来,实践能力就相对差些。我们的程序员执行能力并不差,但在解决问题的能力上明显不足。往往需要把任务分解得很细以后才能完成,独立解决问题的能力不够。另外在表达能力上也相对差些。比较浮躁和急功近利。真正能够沉下心来钻研技术,热爱技术的是凤毛麟角。我在面试的时候,常常发现工程师知识面还挺广,但深度几乎没有。这样的人很难在技术领域有所作为。

在技术管理上,很多国内的公司把工程师简单地作为资源,过于强调流程管理和资源管理。我的观点是:工程师不是高级蓝领,不能以管理生产线的方式来进行管理。优良的环境只有靠大家一起来创造。

对于程序员来讲,也不要过分的去区分彼此的不同,天道酬勤,一份耕耘一份收获.不论是做开发,还是做管理工作.


posted @ 2009-05-21 16:09 单飞| 编辑 收藏

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    
<mx:Script>
        
<![CDATA[
            import mx.graphics.codec.PNGEncoder;
            import mx.graphics.codec.JPEGEncoder;
            import mx.utils.Base64Encoder;
            private var encoder:Base64Encoder;
            private var encodeTarget:ByteArray;
            
            private function loadImage():void
            {
                indentityImg.load(imageSrc.text);
            }
            
            private function encodeImage():void
            {                
                var bmp:Bitmap = indentityImg.content as Bitmap;
                var bmpData:BitmapData = bmp.bitmapData;
                switch("jpg"){
                    case "bmp":
                        encodeTarget = bmpData.getPixels(bmpData.rect);
                        break;
                    case "jpg":
                        var jpg:JPEGEncoder = new JPEGEncoder(100);
                        encodeTarget = jpg.encode(bmpData);
                        break;
                    case "png":
                        var png:PNGEncoder = new PNGEncoder();
                        encodeTarget = png.encode(bmpData);
                        break;
                }
                
                encodeTarget.position = 0;
                
                encoder = new Base64Encoder();
                encoder.insertNewLines = false;
                encoder.reset();
                encoder.encodeBytes(encodeTarget,0,encodeTarget.length);
                resultTxt.text = encoder.flush();
            }
        
]]>
    
</mx:Script>
    
<mx:Image id="indentityImg" x="10" y="64" width="187" height="112" source="image2.jpg"/>
    
<mx:Button x="458" y="5" label="fetch" click="loadImage()"/>
    
<mx:Button x="260" y="169" label="encode" click="encodeImage()"/>
    
<mx:TextArea x="10" y="210" width="317" height="158" id="resultTxt" wordWrap="true" editable="false"/>
    
<mx:Label x="10" y="184" text="result" width="115"/>
    
<mx:TextInput id="imageSrc" x="10" y="5" width="425" editable="true">
        
<mx:text>http://avatar.profile.csdn.net/7/B/4/1_remote_roamer.jpg</mx:text>
    
</mx:TextInput>    
    
</mx:Application>
posted @ 2009-04-28 11:29 单飞 阅读(384) | 评论 (0)编辑 收藏

System.loadLibary()

The parameter to System.loadLibrary() should be the name of the libary, without path, extension or "lib":

1: System.loadLibrary("payment");

Depending on your platform, this will load libpayment.so or payment.dll.

Although it is not an error to call System.loadLibrary() multiple times, loading the libraries is often done in a static code block:

1: class Test {
2: static {
3: System.loadLibrary("payment");
4: }
5: }

java.library.path



Java searches several directories for this libary file. The directories to search are specified in the property java.library.path. On Linux, this is a copy of the environment variable LD_LIBRARY_PATH. On Windows, it is a copy of the PATH variable.

Although changing the java.library.path has influence on how Java loads its libraries, it has no effect on Windows. When your library depends on other DLLs, these are loaded without taking java.library.path into account. If the library you load needs another library, which can not be found, you get an UnsatisfiedLinkError with the message "Can't find dependent libraries". To solve this, you can load the dependant libraries yourself using multiple calls to System.loadLibrary(), loading all libaries one by one.


就是说假如你要加载的Dll依赖其它dll那你就要自己手工加载在Windows平台。


posted @ 2009-04-27 12:10 单飞 阅读(1461) | 评论 (0)编辑 收藏

util.js工具包包含了一些实用函数来帮助你用javascript操作从服务器返回的数据数据,以便来更新web页面。 也可以在DWR以外使用它,因为它不依赖于DWR的其他部分。下面介绍这个工具的主要函数。
7.13.1 $()函数
$() 函数实现的功能相当于 document.getElementById方法。 因为在Ajax程序中,经常需要写很多这样的语句,所以使用 $() 会更简洁。它通过指定的id来查找当前HTML文档中的元素,如果传递给它多个参数,它会返回找到的元素的数组。所有非String类型的参数会被原封不 动的返回。这个函数的灵感来至于prototype库,但是它可以在更多的浏览器上运行。
$() 函数的使用方法为:
var searchexp = $("searchbox").value
<!—对应HTML表单的ID-->
<input id="searchbox"/>
7.12.2 addOptions与 removeAllOptions函数
在DWR项目应用中,经常需要根据所选项来填充选择列表。这现这种功能可能通过调用addOptions与 removeAllOptions函数来填充或移除列表。例如,如果希望在更新了select以后,它仍然保持更新前的选择项,实现方法如下:
var sel = dwr.util.getValue(id);
dwr.util.removeAllOptions(id);
Array array = new Array[ 'Africa', 'America', 'Asia', 'Australasia', 'Europe' ];   
dwr.util.addOptions("id ",array);  
dwr.util.setValue(id, sel);
如果想加入一个初始的"请选择..." 选项,那么可以直接加入下面的语句:
dwr.util.addOptions(id, \["请选择 ..."]);
dwr.util.addOptions有5种模式,分别为:
 数组模式:dwr.util.addOptions(selectid, array) 会创建多个option,每个option的文字和值都是数组元素中的值。
 对象数组模式:(指定text): dwr.util.addOptions(selectid, data, prop) 用数组中的每个元素创造一个option,option的值和文字都是在prop中指定的对象的属性。例如:  
dwr.util.addOptions( "demo",   
                 [{ name:'Africa', id:'AF' },   
                  { name:'America', id:'AM' },   
                  { name:'Asia', id:'AS' },   
                  { name:'Australasia', id:'AU' },   
                  { name:'Europe', id:'EU' } ],'id','name');  
 对象数组模式: (指定text和value值): dwr.util.addOptions(selectid, array, valueprop, textprop) 用数组中的每个元素创造一个option,option的值是对象的valueprop属性,option的文字是对象的textprop属性。 这种情况下,你需要指定要显示 beans 的 property 以及 对应的 bean 值,例如:  
public class Person {   
      private String name;   
      private Integer id;   
      public void set(){……}   
      public String get(){……}   
   }   
dwr.util.addOptions("demo",array,'id','name');   
其中id指向及bean的id属性,在optiong中对应value,name指向bean的name属性,对应下拉框中显示的哪个值。
 对象模式: dwr.util.addOptions(selectid, map, reverse)用每个属性创建一个option。对象的属性名用来作为option的值,对象的属性值用来作为属性的文字,如果reverse参数被设 置为true,那么对象的属性值用来作为选项的值。
 对象的Map模式:dwr.util.addOptions(selectid, map, valueprop, textprop) 用map中的每一个对象创建一个option。用对象的valueprop属性做为option的value,用对象的textprop属性做为 option的文字。
 ol 或 ul 列表模式:dwr.util.addOptions(ulid, array) 用数组中的元素创建多个li元素,它们的innerHTML是数组元素中的值。这种模式可以用来创建ul和ol列表。
7.13.3 addRows与 removeAllRows函数
在 DWR应用中,通过addRows与 removeAllRows这两个函数来操作table表格,这个函数的第一个参数都是table、tbody、thead、tfoot的id。一般来说 最好使用tbody,因为这样可以保持header和footer行不变。它们的用法如下:
 dwr.util.removeAllRows()
dwr.util.removeAllRows(id);
通过table元素的id删除table中所有行。
如果要删除表格中的某一行,则可用如下方法:
function deleteRows(id)
{
var tbody=document.getElementById("tb1");// tbody 的id
var trow=document.getElementById(id);//要删除的行号
if(confirm("确定删除?"))
{
    tbody.removeChild(trow);
}
}
 dwr.util.addRows()
dwr.util.addRows(id, array, cellfuncs, [options]);
这行语句向指定id的table元素添加行。它使用数组中的每一个元素在table中创建一行。然后用cellfuncs从传递过来的行数据中提取单元格数据。其中参数:
 id: table元素的id(最好是tbody元素的id)
 array:数组或对象,做为更新表格数据。
 cellfuncs: 函数数组,从传递过来的行数据中提取单元格数据。
 options: 一个包含选项的对象,选项包括一个用来创建行的函数rowCreator(例如希望给tr加上css), 默认值是返回一个document.createElement("tr")。一个用来创建单元格的函数cellCreator(例如用th代替td)。 默认返回一个document.createElement("td")。下面就是一个向table元素添加行的应用例子,代码如下:
var cellFuncs = [
function(data) { return data; },
function(data) { return data.toUpperCase(); },
function(data) {
    return "<input type='button' value='提交' onclick='alert(\"测试\");'/>";
},
function(data) { return count++; }
];
var count = 1;
dwr.util.addRows( "t1", , cellFuncs, { escapeHtml:false });
<!—对应的HTML内容-->
<table border="1" width="110%"   id="table17" name="table17" height="27">
<tbody id="t1" name="t1">
</tbody>
</table>
7.13.4 getText函数
getText(id)和getValue(id)相似。用它可以得到select列表项目的显示的文本,而不是当前选项的值。
7.13.5 getValue函数
dwr.util.getValue(id) 可以从HTML元素中取出其中的值,这个函数能操作大多数HTML元素,其中包括select(去处当前选项的值而不是文字)、input元素(包括 textarea)、div和span。下面就是一个getValue函数的应用例子,实现代码如下:
<html>
<head>
   <title></title>
   <script type="text/javascript" src="dwr/util.js"></script>
   <script type="text/javascript" src="dwr/engine.js"></script>
   <script>
function getValue()
{
var cnId = dwr.util.getValue("myId");
var cnValue = dwr.util.getValue("myValue");
alert(dwr.util.getValue("myId"));
}
</script>
</head>
<body>
   <input type="text" value="" id="myId" />,
   <input type="text" value="" id="myValue" />
   <input type="button" value="setValue" onclick="getValue();" />
</body>
</html>
7.13.6 getValues函数
getValues() 得到的是包含name/value对的javascript对象。name是HTML元素的ID,value会被更改为这些ID对象元素的内容。 getValues()可以传入一个HTML元素(一个DOM对象或者id字符串)象。这个函数不会返回对象,它只更改传递给它的值。下面就是一个 getValues函数的应用例子,实现代码如下:
var person = { id:1, name:'tfnew21', address:'北京', salary:10000 };  
dwr.util.getValues(person);  
alert(person.name); //访问person对象的属于,运行后会在窗口中显示’tfnew21’字符串
dwr.util.getValues({textarea:null,select:null,text:null,password:null,button:null})   
alert(textarea.value);// 执行后textarea.value的值为"test"
//HTML中的代码
<input type="textarea" id="textarea" value="test" />
<input type="text" id="text" value="tfnew21" />
<input type="password" id="password" value="12345" />
<select id="select">
<option value="1" select>
香蕉
</option>
</select>
7.13.7 onReturn函数
定 义在输入框中按回车的响应,防止执行submit。当使用Ajax时,往往需要的触发一些Javscript。 不幸的是不同的浏览器处理这个事件的方式不一样。所以dwr.util.onReturn修复了这个差异。如果需要在一个表单元素中按回车时触发一些 Javscript,实现代码如下:
<input type="text" onkeypress="dwr.util.onReturn(event,submitFunction)"/>
<input type="button" onclick="submitFunction()"/>
这个函数的工作原理与onSubmit()事件相似,只能存在于<FORM >元素中。
7.13.8 selectRange函数
selectRange用于选择一个输入框中的一定范围的文字。 调用方法如下:
dwr.util.selectRange(ele, start, end)//ele输入ID,start开始位置,end结尾位置
例如:<input type="text" id="sel-test" value="0123456">   
dwr.util.selectRange("sel-test", 2, 5);  
7.13.9 setValue函数
dwr.util.setValue(id, value)根据第一个参数中指定的id找到相应元素,并根据第二个参数改变其中的值。 这个函数能操作大多数HTML元素,包括select、input元素(包括textarea)、div和span。例如:下面就是一个getValue 函数的应用例子,实现代码如下:
<html>
<head>
   <title></title>
   <script type="text/javascript" src="dwr/util.js"></script>
   <script type="text/javascript" src="dwr/engine.js"></script>
   <script>
function setValue()
{
var cnId = dwr.util.getValue("myId");
var cnValue = dwr.util.getValue("myValue");
dwr.util.setValue(cnId, cnValue);
alert(dwr.util.getValue("myId"));
}
</script>
</head>
<body>
   dwr.util.setValue(
   <input type="text" value="" id="myId" />,
   <input type="text" value="" id="myValue" />
   )
   <input type="button" value="setValue" onclick="setValue();" />
</body>
</html>
7.13.10 setValues函数
setValues() 和setValue()非常相似,但它传入的参数是一个拥有多个属性的javascript object,属性名称是html页面元素的id,属性value为html页面元素的value。下面就是一个setValues函数的应用例子,实现 代码如下:
<html>
<head>
   <title></title>
   <script type="text/javascript" src="dwr/util.js"></script>
   <script type="text/javascript" src="dwr/engine.js"></script>
   <script>
function setValue()
{
var cnId = {myAreaText:"tfnew21",myDiv:"ddr"};
dwr.util.setValues(cnId);

}
</script>
</head>
<body>
   <input type="button" value="setValue" onclick="setValue();" />
   <br />
   id=myAreaText
   <textarea id="myAreaText" value=""></textarea>
   <br />
   id=myDiv
   <div id="myDiv"></div>
</body>
</html>
7.13.11 toDescriptiveString函数
toDescriptiveString函数是带debug信息的toString,第一个为将要debug的对象,第二个参数为处理等级。等级如下:
0:单行调试
1:不分析子元素的多行调试
2: 最多分析到第二层子元素的多行调试
调用方法如下:
<input type="text" id="text">
dwr.util.toDescriptiveString("text",0);
7.13.12 useLoadingMessage函数
useLoadingMessage函数作用是当发出ajax请求后,页面显示的提示等待信息,调用方法如下:
function searchUser(){   
var loadinfo = "loading....."  
try{   
     regUser.queryAllUser(userList);   
     dwr.util.useLoadingMessage(loadinfo);           
}catch(e){   
  
}   
}

以上介绍了DWR的工用原理就实现方法,同时介绍了两个工具包的常用函数的用法,有关DWR的在项目中的具体应用,将在后面的在线书店电子商务系统中详细介绍,本节不在介绍。

posted @ 2009-04-22 15:13 单飞 阅读(866) | 评论 (0)编辑 收藏

String strResource = ((IResource)o).getLocation().makeAbsolute().toFile().getAbsolutePath();

这样才能获取到磁盘路径
posted @ 2009-04-21 16:27 单飞 阅读(229) | 评论 (0)编辑 收藏


import java.awt.Robot;
import java.awt.event.KeyEvent;

public class RobotUtil {
    
/**
     * path 不支持汉字
     * 
@param robot
     * 
@param line
     
*/
    
public static void printString(Robot robot, String line) {
        
char[] keys = line.toUpperCase().toCharArray();
        
for (char c : keys) {
            pressKey(robot, c);
        }
    }

    
public static void pressKey(Robot robot, char c) {
        
if (c == ':') {
            robot.keyPress(KeyEvent.VK_SHIFT);
            robot.keyPress(KeyEvent.VK_SEMICOLON);
            robot.keyRelease(KeyEvent.VK_SEMICOLON);
            robot.keyRelease(KeyEvent.VK_SHIFT);
        } 
else {
            
int k = (int) c;
            robot.keyPress(k);
            robot.keyRelease(k);
        }
    }

    
/**
     * 
@param args
     
*/
    
public static void main(String[] args) {
        
try {
            String path 
= "c:/temp/form/a.html";
            Robot robot;
            robot 
= new Robot();
            robot.delay(
1000);
            printString(robot, path);
        } 
catch (Exception e1) {
            
// TODO Auto-generated catch block
            e1.printStackTrace();
        }
    }
}
posted @ 2009-04-21 14:33 单飞 阅读(166) | 评论 (0)编辑 收藏

Eclipse Plugin]ResourceBundle Editor(国际化资源文件编辑器

http://sourceforge.net/projects/eclipse-rbe


posted @ 2009-04-15 15:51 单飞 阅读(231) | 评论 (0)编辑 收藏

1.JNorm 能够帮助你分析代码中那些可以使用开源的项目代替。
  http://www.jnorm.org/
2.NWire 分析类之间的继承关系
  http://www.nwiresoftware.com
3.FindBugs 找到bug
  http://findbugs.sourceforge.net




posted @ 2009-04-15 09:27 单飞 阅读(158) | 评论 (0)编辑 收藏

    public static void setProxy(String ip,int port) throws RegistryErrorException{
        Regor reg 
= new Regor();
        Key ie 
= reg.openKey(Regor.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
        
if(ie!=null){
            reg.setValue(ie, 
"ProxyServer", ip+":"+port);
            reg.saveDword(ie, 
"ProxyEnable", Integer.toHexString(1));            
        }
    }
    
    
public static void disableProxy() throws RegistryErrorException{
        Regor reg 
= new Regor();
        Key ie 
= reg.openKey(Regor.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
        
if(ie!=null){
            reg.saveDword(ie, 
"ProxyEnable", Integer.toHexString(0));
            reg.setValue(ie, 
"ProxyServer""");
        }
    }
posted @ 2009-04-14 13:53 单飞 阅读(401) | 评论 (0)编辑 收藏

    public static ToolsProject getDefaultProject()throws Exception{
        
if(instance!= null){
            
return instance;
        }

        IWorkspaceRoot root 
= ResourcesPlugin.getWorkspace().getRoot();
        IProject prj 
= root.getProject("DefaultProject");
        
if (!prj.exists()) {
            
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
            
final IProjectDescription desc = workspace.newProjectDescription(prj.getName());
            desc.setNatureIds(
new String[] "com.test.tools" });
            desc.setComment(
"TOOLS");
            prj.create(desc, 
null);
            prj.open(IResource.BACKGROUND_REFRESH, 
null);
        }

        ToolsProject prject 
= new ToolsProject();
        prject.setPrject(prj);
        
return prject;
    }

IContainer container = (IContainer) resource;
            
final IFile file = container.getFile(new Path(sName + "/" + "s" + ".xml"));
            ensureFolder((IFolder) file.getParent());


InputStream stream 
= openContentStream(siteName);
            
if (file.exists()) {
                file.setContents(stream, 
truetrue, monitor);
            }
 else {
                file.create(stream, 
true, monitor);
            }


stream.close();

private InputStream openContentStream(String siteName) {
        Site site 
= new Site();
        site.setName(siteName);
        XStream xstream 
= new XStream(new DomDriver());
                String xml 
= xstream.toXML(site);
        
return new ByteArrayInputStream(xml.getBytes());
    }

创建目录 mkdirs
public static void ensureFolder(IFolder folder) throws CoreException {
        IContainer parent 
= folder.getParent();
        
if (parent instanceof IFolder) {
            ensureFolder((IFolder) parent);
        }

        
if (!folder.exists()) {
            folder.create(
truefalsenull);
        }


    }



删除目录
dFolder.delete(
truenull);


监听到资源发生变化

private void hookResourceListener() {
        IWorkspace workspace 
= ResourcesPlugin.getWorkspace();
        IResourceChangeListener listener 
= new IResourceChangeListener() {
            
public void resourceChanged(IResourceChangeEvent event) {
                viewer.refresh();
            }

        }
;
        workspace.addResourceChangeListener(listener);
    }
posted @ 2009-04-02 13:49 单飞 阅读(705) | 评论 (0)编辑 收藏

验证代理是否可以使用
package src;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.SocketAddress;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class TestProxy {
    
public boolean doTest(String proxyIP, int port) throws Exception {
        URL url 
= new URL("http://www.g.cn/");
        
//URL url = new URL("http://www.g.cn/");
        SocketAddress addr = new InetSocketAddress(proxyIP, port);
        Proxy typeProxy 
= new Proxy(Proxy.Type.HTTP, addr);
        URLConnection conn 
= url.openConnection(typeProxy);
        
if (conn == null)
            
return false;

        conn.setConnectTimeout(
1000);
        InputStream in 
= conn.getInputStream();
        
byte[] b = new byte[1024];
        
while (in.read(b) > 0{
            System.out.print(
new String(b));
        }

        System.out.println();
        
return true;

    }


    
public String[] getProxyIp() throws Exception {
        FileReader fr 
= new FileReader("c://ip.txt");
        BufferedReader br 
= new BufferedReader(fr);
        String line;
        List
<String> rt = new ArrayList<String>();
        String ip, port;
        
while ((line = br.readLine()) != null{
            rt.add(line.trim());
        }

        fr.close();
        String[] aa 
= new String[rt.size()];
        rt.toArray(aa);
        
return aa;
    }


    
/**
     * 
@param args
     * 
@throws IOException
     
*/

    
public static void main(String[] args) {
        TestProxy test 
= new TestProxy();
        String[] items;
        
try {
            items 
= test.getProxyIp();
            
for (String proxy : items) {
                
try {
                    StringTokenizer st 
= new StringTokenizer(proxy, ":");
                    String ip 
= st.nextToken();
                    String port 
= st.nextToken();
                    
if (test.doTest(ip, Integer.parseInt(port))) {
                        System.err.println(proxy);
                    }
 else {
                        System.out.println(proxy);
                    }

                }
 catch (Exception ex) {
                    
// ex.printStackTrace();
                    System.out.println(proxy + ":" + ex.toString());
                }

            }

        }
 catch (Exception e) {
            
// TODO Auto-generated catch block
            e.printStackTrace();
        }

    }


}



ip.txt
125.245.196.194:8080   
203.110.240.22:80       
77.240.82.6:80         
71.5.68.4:3128         
213.41.71.164:80       
203.160.1.103:80       
200.174.85.195:3128     
60.28.194.172:80       
148.233.159.58:8080     
207.248.228.166:80     
203.162.183.222:80     
60.218.99.18:8080       
203.160.1.112:80       
193.93.112.33:8080     
222.134.58.246:3128     
121.57.4.17:8080       
221.214.220.228:3128   
20.132.16.22:80         
121.12.249.207:3128     
219.80.28.24:80         
200.174.85.193:3128     
posted @ 2009-04-01 08:59 单飞 阅读(270) | 评论 (0)编辑 收藏

http://www.cnblogs.com/zephyr/archive/2008/05/30/1210960.html

使用Eclipse RCP创建视图并实现视图间消息传递(二)



posted @ 2009-03-26 13:36 单飞 阅读(122) | 评论 (0)编辑 收藏

public class FMultiPageEditor extends MultiPageEditorPart implements IResourceChangeListener{

/**
     * Creates page f of the multi-page editor,
     * which contains a text editor.
     
*/
    
void createHPage() {
        FEditorInput fInput 
= (FEditorInput) getEditorInput();
        
// h file
        IFile hFile  = formInput.getHFile();
        
try {
            FileEditorInput fed 
= new FileEditorInput(hFile);
            htmlEditorPart 
= makeDefaultEditorFor("default" + ".html");
            
int index = addPage(htmlEditorPart, fed);
            setPageText(index, 
"");
            setPageImage(index, fed.getImageDescriptor().createImage());
        } 
catch (PartInitException e) {
            ErrorDialog.openError(getSite().getShell(),
                    
"r"null, e.getStatus());
        } 
catch (Exception e) {
            e.printStackTrace();
        }
    }

private IEditorPart makeDefaultEditorFor(String name) {
        IEditorDescriptor editorDescriptor 
= getSite().getWorkbenchWindow()
                .getWorkbench().getEditorRegistry().getDefaultEditor(name);
        IEditorRegistry reg 
= WorkbenchPlugin.getDefault().getEditorRegistry();
        EditorDescriptor desc 
= (EditorDescriptor) reg
                .findEditor(editorDescriptor.getId());

        
if (desc == null)
            
return /*new TextEditor()*/null;

        IEditorPart part 
= null;
        
try {
            
if (desc.getClassName() != null
                    
&& desc.getClassName().equals(getClass().getName())) {
                IEditorDescriptor[] editors 
= getSite().getWorkbenchWindow()
                        .getWorkbench().getEditorRegistry().getEditors(name);
                
for (int i = 0; i < editors.length; i++) {
                    
if (editors[i].getId() != editorDescriptor.getId()) {
                        editorDescriptor 
= editors[i];
                        desc 
= (EditorDescriptor) reg
                                .findEditor(editorDescriptor.getId());
                        
if (desc.getClassName() != null
                                
&& !desc.getClassName().equals(
                                        getClass().getName()))
                            
break;
                    }
                }
            }
            
if (desc.getClassName() == null
                    
|| desc.getClassName().equals(getClass().getName()))
                part 
= new TextEditor();
            
else
                part 
= desc.createEditor();

        } 
catch (CoreException e) {
            e.printStackTrace();
            part 
= new TextEditor();
        }
        
return part;
    }
posted @ 2009-03-26 11:04 单飞 阅读(851) | 评论 (0)编辑 收藏

1.图像处理
2.bp神经网络
3.matlab
4.模式识别

posted @ 2009-03-21 14:13 单飞 阅读(129) | 评论 (0)编辑 收藏

public class HtmlEditor extends MultiPageEditorPart
public
 void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {

   initResourceChangeListener();
}
    
    
private IWorkspace getWorkspace() {
        
return ((IFileEditorInput) getEditorInput()).getFile().getWorkspace();
    }
    
    
private void initResourceChangeListener() {
        IResourceChangeListener resourceChangeListener 
= new IResourceChangeListener() {
            
public void resourceChanged(IResourceChangeEvent event) {
                handleResourceChange(event);
            }
        };
        getWorkspace().addResourceChangeListener(resourceChangeListener);
    }

    
private void handleResourceChange(IResourceChangeEvent event) {
        
if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
            IFile file 
= ((IFileEditorInput) getEditorInput()).getFile();
            
// update editor
            
        }
    }
/**
 *当更新或者删除文件的时候
**/
public void resourceChanged(final IResourceChangeEvent event) {
        if (event.getType() == IResourceChangeEvent.POST_CHANGE)
            Display.getDefault().asyncExec(new Runnable() {

                public void run() {
                    IResourceDelta rootDelta = event.getDelta();
                    if(rootDelta ==null){
                        return;
                    }
                    IResourceDelta htmlDelta = rootDelta.findMember(new Path("DefaultProject/t.html"));
                    if(htmlDelta == null){
                        return;
                    }
                }
            });
        if (event.getType() == IResourceChangeEvent.PRE_CLOSE) {
            Display.getDefault().asyncExec(new Runnable() {
                public void run() {
                    IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
                    for (int i = 0; i < pages.length; i++) {
                        if (((FileEditorInput) getSourceEditor().getEditorInput()).getFile().getProject().equals(event.getResource())) {
                            IEditorPart editorPart = pages[i].findEditor(getSourceEditor().getEditorInput());
                            pages[i].closeEditor(editorPart, true);
                        }
                    }
                }
            });
        }
    }

posted @ 2009-03-20 10:07 单飞 阅读(449) | 评论 (0)编辑 收藏

     摘要: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> import java.util.ArrayList; public final class StringUtils { &n...  阅读全文
posted @ 2009-03-18 15:12 单飞 阅读(222) | 评论 (0)编辑 收藏

     摘要: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->    public static String convertRGB2HexString(RGB theRGB...  阅读全文
posted @ 2009-03-18 15:02 单飞 阅读(383) | 评论 (0)编辑 收藏

为了便于管理,先引入个基础类:
package algorithms;

/**
 * 
@author yovn
 *
 
*/
public abstract class Sorter<extends Comparable<E>> {
    
    
public abstract void sort(E[] array,int from ,int len);
    
    
public final void sort(E[] array)
    {
        sort(array,
0,array.length);
    }
    
protected final void swap(E[] array,int from ,int to)
    {
        E tmp
=array[from];
        array[from]
=array[to];
        array[to]
=tmp;
    }

}
一 插入排序
该算法在数据规模小的时候十分高效,该算法每次插入第K+1到前K个有序数组中一个合适位置,K从0开始到N-1,从而完成排序:
package algorithms;
/**
 * 
@author yovn
 
*/
public class InsertSorter<extends Comparable<E>> extends Sorter<E> {

    
/* (non-Javadoc)
     * @see algorithms.Sorter#sort(E[], int, int)
     
*/
    
public void sort(E[] array, int from, int len) {
         E tmp
=null;
          
for(int i=from+1;i<from+len;i++)
          {
              tmp
=array[i];
              
int j=i;
              
for(;j>from;j--)
              {
                  
if(tmp.compareTo(array[j-1])<0)
                  {
                      array[j]
=array[j-1];
                  }
                  
else break;
              }
              array[j]
=tmp;
          }
    }
        
    

}

二 冒泡排序
这可能是最简单的排序算法了,算法思想是每次从数组末端开始比较相邻两元素,把第i小的冒泡到数组的第i个位置。i从0一直到N-1从而完成排序。(当然也可以从数组开始端开始比较相邻两元素,把第i大的冒泡到数组的第N-i个位置。i从0一直到N-1从而完成排序。)

package algorithms;

/**
 * 
@author yovn
 *
 
*/
public class BubbleSorter<extends Comparable<E>> extends Sorter<E> {

    
private static  boolean DWON=true;
    
    
public final void bubble_down(E[] array, int from, int len)
    {
        
for(int i=from;i<from+len;i++)
        {
            
for(int j=from+len-1;j>i;j--)
            {
                
if(array[j].compareTo(array[j-1])<0)
                {
                    swap(array,j
-1,j);
                }
            }
        }
    }
    
    
public final void bubble_up(E[] array, int from, int len)
    {
        
for(int i=from+len-1;i>=from;i--)
        {
            
for(int j=from;j<i;j++)
            {
                
if(array[j].compareTo(array[j+1])>0)
                {
                    swap(array,j,j
+1);
                }
            }
        }
    }
    @Override
    
public void sort(E[] array, int from, int len) {
        
        
if(DWON)
        {
            bubble_down(array,from,len);
        }
        
else
        {
            bubble_up(array,from,len);
        }
    }
    
}

三,选择排序
选择排序相对于冒泡来说,它不是每次发现逆序都交换,而是在找到全局第i小的时候记下该元素位置,最后跟第i个元素交换,从而保证数组最终的有序。
相对与插入排序来说,选择排序每次选出的都是全局第i小的,不会调整前i个元素了。
package algorithms;
/**
 * 
@author yovn
 *
 
*/
public class SelectSorter<extends Comparable<E>> extends Sorter<E> {

    
/* (non-Javadoc)
     * @see algorithms.Sorter#sort(E[], int, int)
     
*/
    @Override
    
public void sort(E[] array, int from, int len) {
        
for(int i=0;i<len;i++)
        {
            
int smallest=i;
            
int j=i+from;
            
for(;j<from+len;j++)
            {
                
if(array[j].compareTo(array[smallest])<0)
                {
                    smallest
=j;
                }
            }
            swap(array,i,smallest);
                   
        }

    }
 
}
四 Shell排序
Shell排序可以理解为插入排序的变种,它充分利用了插入排序的两个特点:
1)当数据规模小的时候非常高效
2)当给定数据已经有序时的时间代价为O(N)
所以,Shell排序每次把数据分成若个小块,来使用插入排序,而且之后在这若个小块排好序的情况下把它们合成大一点的小块,继续使用插入排序,不停的合并小块,知道最后成一个块,并使用插入排序。

这里每次分成若干小块是通过“增量” 来控制的,开始时增量交大,接近N/2,从而使得分割出来接近N/2个小块,逐渐的减小“增量“最终到减小到1。

一直较好的增量序列是2^k-1,2^(k-1)-1,.....7,3,1,这样可使Shell排序时间复杂度达到O(N^1.5)
所以我在实现Shell排序的时候采用该增量序列
package algorithms;

/**
 * 
@author yovn
 
*/
public class ShellSorter<extends Comparable<E>> extends Sorter<E>  {

    
/* (non-Javadoc)
     * Our delta value choose 2^k-1,2^(k-1)-1,.7,3,1.
     * complexity is O(n^1.5)
     * @see algorithms.Sorter#sort(E[], int, int)
     
*/
    @Override
    
public void sort(E[] array, int from, int len) {
        
        
//1.calculate  the first delta value;
        int value=1;
        
while((value+1)*2<len)
        {
            value
=(value+1)*2-1;
        
        }
    
        
for(int delta=value;delta>=1;delta=(delta+1)/2-1)
        {
            
for(int i=0;i<delta;i++)
            {
                modify_insert_sort(array,from
+i,len-i,delta);
            }
        }

    }
    
    
private final  void modify_insert_sort(E[] array, int from, int len,int delta) {
          
if(len<=1)return;
          E tmp
=null;
          
for(int i=from+delta;i<from+len;i+=delta)
          {
              tmp
=array[i];
              
int j=i;
              
for(;j>from;j-=delta)
              {
                  
if(tmp.compareTo(array[j-delta])<0)
                  {
                      array[j]
=array[j-delta];
                  }
                  
else break;
              }
              array[j]
=tmp;
          }

    }
}

五 快速排序
快速排序是目前使用可能最广泛的排序算法了。
一般分如下步骤:
1)选择一个枢纽元素(有很对选法,我的实现里采用去中间元素的简单方法)
2)使用该枢纽元素分割数组,使得比该元素小的元素在它的左边,比它大的在右边。并把枢纽元素放在合适的位置。
3)根据枢纽元素最后确定的位置,把数组分成三部分,左边的,右边的,枢纽元素自己,对左边的,右边的分别递归调用快速排序算法即可。
快速排序的核心在于分割算法,也可以说是最有技巧的部分。
package algorithms;

/**
 * 
@author yovn
 *
 
*/
public class QuickSorter<extends Comparable<E>> extends Sorter<E> {

    
/* (non-Javadoc)
     * @see algorithms.Sorter#sort(E[], int, int)
     
*/
    @Override
    
public void sort(E[] array, int from, int len) {
        q_sort(array,from,from
+len-1);
    }

    
    
private final void q_sort(E[] array, int from, int to) {
        
if(to-from<1)return;
        
int pivot=selectPivot(array,from,to);

        
        
        pivot
=partion(array,from,to,pivot);
        
        q_sort(array,from,pivot
-1);
        q_sort(array,pivot
+1,to);
        
    }


    
private int partion(E[] array, int from, int to, int pivot) {
        E tmp
=array[pivot];
        array[pivot]
=array[to];//now to's position is available
        
        
while(from!=to)
        {
            
while(from<to&&array[from].compareTo(tmp)<=0)from++;
            
if(from<to)
            {
                array[to]
=array[from];//now from's position is available
                to--;
            }
            
while(from<to&&array[to].compareTo(tmp)>=0)to--;
            
if(from<to)
            {
                array[from]
=array[to];//now to's position is available now 
                from++;
            }
        }
        array[from]
=tmp;
        
return from;
    }


    
private int selectPivot(E[] array, int from, int to) {
    
        
return (from+to)/2;
    }

}

还有归并排序,堆排序,桶式排序,基数排序,下次在归纳。
posted @ 2009-03-09 08:44 单飞 阅读(146) | 评论 (0)编辑 收藏

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown table engine 'InnoDB'
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1026)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
原来我使用了绿色版的mysql,以前能用是因为my.ini文件已经存在了。而我重新ghost一下,就没有这个文件了。

默认情况下配置文件可以放在以下目录中(假定我的mysql安装在d:\server\mysql下):
C:\my.ini C:\my.cnf C:\WINDOWS\my.ini C:\WINDOWS\my.cnf D:\server\mysql\my.ini D:\server\mysql\my.cnf

你可以用mysqld-nt.exe --install,把mysql添加到系统服务中,然后就可以了。

另外我发现原来可以指定表的engine



MySQL两种表存储结构MyISAM和InnoDB

MySQL支持的两种主要表存储 格式MyISAM,InnoDB,上个月做个项目时,先使用了InnoDB,结果速度特别慢,1秒钟只能插入10几条。后来换成MyISAM格式,一秒钟 插入上万条。当时决定这两个表的性能也差别太大了吧。后来自己推测,不应该差别这么慢,估计是写的插入语句有问题,决定做个测试:
测试环境:Redhat Linux9,4CPU,内存2G,MySQL版本为4.1.6-gamma-standard
测试程序:Python+Python-MySQL模块。
测试方案:
1、MyISAM格式分别测试,事务和不用事务两种情况:
2、InnoDB格式分别测试AutoCommit=1(不用begin transaction和用begin transaction模式),
     AutoCommit=0 (不用begin transaction和用begin transaction模式)四种情况。

测试方法为插入10000条记录。为了测试不互相影响,单独建立了专用的测试表,建表语句如下:

1、MyISAM不用事务表:
CREATE TABLE `MyISAM_NT` (
  `TableId` int(11) NOT NULL default '0',
  `TableString` varchar(21) NOT NULL default ''
) ENGINE=MyISAM;

2、MyISAM用事务表:
CREATE TABLE `MyISAM_TS` (
  `TableId` int(11) NOT NULL default '0',
  `TableString` varchar(21) NOT NULL default ''
) ENGINE=MyISAM;

3、InnoDB关闭AutoCommit,不用事务:
CREATE TABLE `INNODB_NA_NB` (
  `TableId` int(11) NOT NULL default '0',
  `TableString` varchar(21) NOT NULL default ''
) ENGINE=InnoDB;




posted @ 2009-02-13 09:49 单飞 阅读(3287) | 评论 (0)编辑 收藏

插件依赖只能是单向的关系,比如说PluginA依赖于PluginB,那么A中能引用B中的类,但是B就不能引用A中的 ,否则就是双向依赖。在使用XStream这个包的时候,如果是不可能单独封装为一个插件的。这就造成了多个插件含有不同版本的Stream类。

posted @ 2009-01-25 10:27 单飞 阅读(192) | 评论 (0)编辑 收藏

Plugin.properties放在plugin.xml的相同目录下, Eclipse里面看国际化也是非常正确, 但是运行以后就是只显示"%XXXX"这样的字符串原来是因为

Localization in RCP plugins is usually done by including translations in a property file and using their id in plugin.xml.

I spend some time lately trying to understand why some translations were not used in my application although they were correctly displayed in PDE.

Answer : when using plugin.properties, you MUST include the following line in the plugin manifest :

Bundle-Localization: plugin

Otherwise, PDE will show the translated text, but your app won’t.

Strangely, I had to edit the manifest manually because I couldn’t find a way to enable plugin localization in PDE. Some other plugins of my application already had this line, but I don’t remember adding it. Maybe Eclipse templates have changed since I created my first plugins (using Eclipse 3.1).


记得以前插件开发也有这个问题,不过忘记了。
真是记性越来越差了。
这个问题竟然困扰了我两个星期。还好可以google到别人的解决办法,今天在这里留个脚印。
posted @ 2009-01-23 11:42 单飞| 编辑 收藏

1.关于接口中声明的变量

public interface In {
/*public static final*/ int a = 0;
}
public class TestIn implements In{

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int i=0;
        TestIn t = new TestIn();
        i = t.a;
        i = In.a;
        i = TestIn.a;
    }

}

2.Exception
public class LException extends Exception{

}

public class HException extends LException{

}
public class TestException {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        try{
            throw new HException();
        }catch(HException ex){
           
        }catch(LException e){
           
        }
    }

}



posted @ 2009-01-19 23:54 单飞 阅读(137) | 评论 (0)编辑 收藏

如果在插件MANIFEST.MF中的Bundle-ClassPath设置了 “.”那就会导出生成为一个jar 文件。否则就是目录形式。

posted @ 2008-10-08 11:36 单飞 阅读(226) | 评论 (0)编辑 收藏

 

打包好的程序,发现在运行的时候和开发时候的表现不一致,仅仅靠推理很难发现问题,有没有办法调试呢?记得以前曾经做过远程调试Jboss,大致原理应该相通的,照样做了一下,果然行的通.

 

首先需要在运行RCP程序的时候增加如下参数:

-Xdebug

-Xnoagent 

-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

运行RCP程序.

然后再使用Eclipse的远程应用程序调试方式运行:

设置好断点后

就可以像开发时候一样来进行跟踪调试.很容易找出问题来.


 

posted @ 2008-10-07 19:46 单飞 阅读(442) | 评论 (0)编辑 收藏

// 用泛型实现通用数组的删除操作
package test;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

public class Test1 {
     
public static <T> T[] deleteArray(T[] items,int index) {
        
if (items == null || items.length == 0 || index < 0
                
|| index > items.length - 1) {
            
return items;
        }
        T[] newItems 
= (T[]) Array.newInstance(items.getClass().getComponentType(), items.length - 1);
        
if(index == 0){
            
// first
            System.arraycopy(items, 1, newItems, 0, newItems.length);    
        }
else if(index == items.length - 1){
            
// end
            System.arraycopy(items, 0, newItems, 0, newItems.length);
        }
else{
            
// middle
            System.arraycopy(items, 0, newItems, 0, index);
            System.arraycopy(items, index
+1, newItems, index, items.length - index -1);            
        }
        
        
return newItems;
        
    }
    
/**
     * 
@param args
     
*/
    
public static void main(String[] args) {
        
// TODO Auto-generated method stub
        
// first
        String[] first = new String[]{"0","1","2"};
        String[] rt 
= deleteArray(first,0);
        printArray(rt);
        
// end
        Integer[] end = new Integer[]{0,1,2};
        Integer[]  rt1 
= deleteArray(end,2);
        printIntegerArray(rt1);
    }
    
    
public static void printArray(String[] array){
        System.out.println(
"start ====================");
        
for(String s:array){
            System.out.println(s);
        }
        System.out.println(
"end ====================");
        
        List
<String> a = new ArrayList<String>();
        
    }
    
    
public static void printIntegerArray(Integer[] array){
        System.out.println(
"start ====================");
        
for(Integer s:array){
            System.out.println(s);
        }
        System.out.println(
"end ====================");
        
        List
<String> a = new ArrayList<String>();
        
    }

}
posted @ 2008-09-23 21:44 单飞 阅读(480) | 评论 (0)编辑 收藏

我经常发现代码里面充次着一些“画蛇添足”的想法,尤其是MM写的代码,这好像就是因为思考停留在表面,不能深入到事物的本质造成的。因为她们在考虑问题的时候会将80%的精力放在表面,而用20%的精力来思考低层的实现。奥萨姆剃刀可以解决这个问题。

奥卡姆剃刀(Occam's Razor, Ockham's Razor),又称“奥康的剃刀”,是由14世纪逻辑学家、圣方济各会修士奥卡姆的威廉(William of Occam,约1285年至1349年)提出。奥卡姆(Ockham)在英格兰的萨里郡,那是他出生的地方。他在《箴言书注》2卷15题说“切勿浪费较多 东西去做用较少的东西同样可以做好的事情。”

这个原理称为“如无必要,勿增实体”(Entities should not be multiplied unnecessarily)。有时为了显示其权威性,人们也使用它原始的拉丁文形式:

Pluralitas non est ponenda sine necessitate.
Frustra fit per plura quod potest fieri per pauciora.
Entia non sunt multiplicanda praeter necessitatem.

事实上,只有前两种形式见于他现存的著作中,而第三种形式则由后来的一位学者撰写。威廉使用这个原理证明了许多结论,包括“通过思辨不能得出上帝存在的结论”。这使他不受罗马教皇的欢迎。

许多科学家接受或者(独立的)提出了奥卡姆剃刀原理,例如莱布尼兹的“不可观测事物的同一性原理”和牛顿提出的一个原则:如果某一原因既真又足以解释自然事物的特性,则我们不应当接受比这更多的原因。

对于科学家,这一原理最常见的形式是:

当你有两个处于竞争地位的理论能得出同样的结论,那么简单的那个更好。

在物理学中我们使用奥卡姆剃刀切掉形而上学的概念。爱因斯坦的狭义相对论与洛仑兹的理论就是一个范例。洛仑兹的理论认为在以太中运动的尺收缩、钟 变慢。爱因斯坦关于空—时变换的方程与洛仑兹方程在钟慢尺短效应上一致,但是爱因斯坦和庞加莱认为以太不能根据洛仑兹和麦克斯韦方程组检测到。根据奥卡姆 剃刀,以太就被排除了。

这一原理也被用来证明量子力学的不确定性。海森堡从光的量子本性和测量效应中推出了不确定原理。

史蒂芬·霍金在他的《时间简史》中解释说:我们仍然可以想像,对于一些超自然的生物,存在一组完全地决定事件的定律,它们能够观测宇宙现在的状态 而不必干扰它。然而,我们人类对于这样的宇宙模型并没有太大的兴趣。看来,最好是采用称为奥卡姆剃刀的原理,将理论中不能被观测到的所有特征都割除掉。

但是“不能确定以太的存在”和“以太的不存在”都不能仅仅根据奥卡姆剃刀推出。它可以区分两个能做出同样结论的理论,但是不能区分其他可能做出不同结论的理论。实验的证据仍然是必需的,并且奥卡姆本人支持经验主义,而不是反对。

厄恩斯特·马赫提倡奥卡姆剃刀的一个版本,他称作“经济原理”,表述为:“科学家应该使用最简单的手段达到他们的结论,并排除一切不能被认识到的 事物”。把它引入哲学就形成了实证主义哲学,即认为某物存在但无法观测与根本不存在是一码事。马赫影响了爱因斯坦关于时空不是绝对的论述,但是他(马赫) 也把实证主义应用到分子的概念。马赫和他的追随者认为分子是形而上学的概念,因为它们太小而不能被直接探测到。这种主张不顾分子论在解释化学反应和热力学 上的成功。具有讽刺意味的是,当使用经济原理抛弃了以太和绝对参照系的时候,爱因斯坦几乎同时发表了一篇关于布朗运动的论文,它证实了分子的实在性,这就 打击了实证主义的使用。这个故事意味着,我们不能盲目使用奥卡姆剃刀。正如爱因斯坦在他的《自传笔记》中写道:

即使是大胆而天才的学者也会因为哲学上的偏见而妨碍他认清事实,这是一个很有趣的例子。

人们常常引用奥卡姆剃刀的一个强形式,叙述如下:

如果你有两个原理,它们都能解释观测到的事实,那么你应该使用简单的那个,直到发现更多的证据。 对于现象最简单的解释往往比较复杂的解释更正确。 如果你有两个类似的解决方案,选择最简单的。 需要最少假设的解释最有可能是正确的。

……或者以这种自我肯定的形式出现:

让事情保持简单!

注意到这个原理是如何在上述形式中被加强的。严格的说,它们应该被称为吝啬定律,或者称为朴素原则。最开始的时候我们使用奥卡姆剃刀区分能够做出 相似结论的理论。现在我们试图选择做出不同结论的理论。这不是奥卡姆剃刀的本意。我们不用检验这些结论吗?显然最终不是这样,除非我们处于理论的早期阶 段,并且还没有为实验做好准备。我们只是为理论的发展寻求一种指导。

这个原理最早至少能追溯到亚里士多德的“自然界选择最短的道路”。亚里士多德在相信实验和观测并无必要上走得太远。朴素原理是一个启发式的经验规 则,但是有些人引用它,仿佛它是一条物理学公理。它不是。它在哲学和粒子物理中使用的很好,但是在宇宙学和心理学中就不是特别好,这些领域中的事务往往比 你想象的还要复杂。或许引用莎士比亚的一句话要胜过引用奥卡姆剃刀:“天地之大, 赫瑞修, 比你所能梦想到的多出更多”

朴素是主观的,宇宙并不总是像我们认为的那样简单。成功的理论往往涉及到对称、美与简单。1939年保罗·狄拉克写道:

研究者在把自然法则转变为数学形式的时候,应该为数学的美而努力。对于简单和美的需求往往是等价的,然而当它们发生冲突的时候,后者应该优先。

吝啬原理不能取代洞察力、逻辑和科学方法。永远也不能依靠它创造或者维护一个理论。作为正确性的判别方法,只有逻辑上的连贯性和实验的证据才是绝 对的。狄拉克的理论很成功,他构造了电子的相对论场方程,并用它预言了正电子。但是他并没有主张物理学仅仅应该基于数学的美。他完全赞同实验检验的必要 性。

最后的结论来自爱因斯坦,他本身也是一位格言大师。他警告说:

“万事万物应该尽量简单,而不是更简单。”

作为著名的唯名论者,奥卡姆以此反对实在论,认为没有必要在个别事物之外设立普遍的实体,因为这些实体既无逻辑自明性,又缺乏经验证据。

这一观点促进了经验科学摆脱神学的束缚,并为后来的逻辑经验主义,特别是外延论者所重视。


posted @ 2008-08-13 09:49 单飞 阅读(254) | 评论 (0)编辑 收藏

我只知道它属于org.eclipse.pde.ui的扩展点org.eclipse.ui.perspectives,看来要好好研究一下这部分的代码,才能解决隐藏Perspective,实现权限管理。

参考了别人的代码:
看了看eclipse的源代码,终于知道怎么关闭了:

IWorkbench w=PlatformUI.getWorkbench();
IPerspectiveRegistry pr=w.getPerspectiveRegistry() ;
IPerspectiveDescriptor persdes=pr.findPerspectiveWithId("perspectiveID");

WorkbenchPage p=(WorkbenchPage)w.getActiveWorkbenchWindow().getActivePage();
Perspective persp = p.getActivePerspective();
p.closePerspective(persdes,false,false);

try {
w.showPerspective("nextperspectiveID", w.getActiveWorkbenchWindow());
} catch (WorkbenchException e) {
e.printStackTrace();
}

关闭当前perspective,并打开一个新的perspective:

IWorkbench w=PlatformUI.getWorkbench();

ActionFactory.IWorkbenchAction closePerspectiveAction
= ActionFactory.CLOSE_PERSPECTIVE.create(w.getActiveWorkbenchWindow());
closePerspectiveAction.run();

try {
PlatformUI.getWorkbench().showPerspective("com.ibm.demo.saic.ui.views.NextPerspective", w.getActiveWorkbenchWindow());
} catch (WorkbenchException e) {
e.printStackTrace();
}


posted @ 2008-08-12 22:37 单飞 阅读(187) | 评论 (0)编辑 收藏

IBM Container for ActiveX Documents - Eclipse Version

但是我发现如果使用它打开含有中文名称的文档,就会抛异常,看了它的代码,发现

JNIEXPORT jint JNICALL Java_com_ibm_rcp_activex_ActivexDocumentWidget_createControl
    (JNIEnv 
* env, jclass that, jint hwndParent, jstring filename, jstring progid, jint hwndShell,
    jintArray fileMenu, jintArray containerMenu, jintArray windowMenu,
    jint indexHelpMenu, jstring helpMenuItemPrefix)
{
    ADD_TO_TRACE();
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    
if (NULL == progid)
    {
        
return 0;
    }

    
const char * lpszProgid = env->GetStringUTFChars(progid, 0);

    
const char * lpszFileName = NULL;

    
if (NULL != filename)
    {
        lpszFileName 
= env->GetStringUTFChars(filename, 0);
    }

这样会引发jni的字符乱码问题,在参考了《〈Java与C之间通过JNI传递中文字符串〉》的解决方案后
做了如下的改写:
char* jstringToWindows( JNIEnv *env, jstring jstr );


if (NULL != filename)
    {
        lpszFileName 
= jstringToWindows( env, filename );
        
//lpszFileName = env->GetStringUTFChars(filename, 0);
    }


char* jstringToWindows(JNIEnv* env,jstring jstr)
{
    
int length=(env)->GetStringLength(jstr);
    
const jchar* jcstr=(env)->GetStringChars(jstr,0);
    
char* rtn=(char*)malloc(length*2+1);
    
int size=0;
    size
=WideCharToMultiByte(CP_ACP,0,(LPCWSTR)jcstr,length,rtn,(length*2+1),NULL,NULL);
    
if(size<=0)
    
return NULL;
    (env)
->ReleaseStringChars(jstr,jcstr);
    rtn[size]
=0;
    
return rtn;
}

成功编译后,可以正常使用了。


posted @ 2008-08-09 22:52 单飞 阅读(333) | 评论 (0)编辑 收藏

xlst ? 怎么玩啊?

This won't delete the perspective if it is defined in an extension.
The perspective defined in an extension can't be deleted in Eclipse 3.2.
In Eclipse 3.3, it is possible to delete it using xslt, see http://wiki.eclipse.org/Product_Customization


Snjeza

Hiamansu S Swain wrote:
Hi Ajay,

Create this class in any package of your application and make some action on your UI side and run call this class....

import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IPerspectiveRegistry;
import org.eclipse.ui.PlatformUI;

public class DeleteUserPerspective {

/**The Constructor**/
public DeleteUserPerspective () {
IPerspectiveRegistry iPerspectiveRegistry = PlatformUI.getWorkbench).getPerspectiveRegistry();
IPerspectiveDescriptor perspectiveDescriptor = iPerspectiveRegistry.findPerspectiveWithLabel("<perpsectiveName>");
try {
iPerspectiveRegistry.deletePerspective(perspectiveDescriptor);
} catch (Exception e) {
System.out.println("=====DELETED=====");
}
}
}


Thanks
Himansu


posted @ 2008-08-01 15:56 单飞 阅读(465) | 评论 (0)编辑 收藏

发现有一些令人讨厌的菜单存在自己的RCP程序,我想到的是应该能拿到MenuManager类,然后遍历一下,去掉Search 菜单,可惜实在脑袋木了,就google了一下,找到解决的代码:
最近越来越懒了,自我批评一下: 平时不练功,关键的时候就只能靠Google这根救命草了。


http://www.richclient2.eu/2006_03_20/getting-rid-of-convert-line-delimiters-to/

Getting rid of “Convert Line Delimiters to”


20. March 2006
Tom Seidel @ 09:42

If you're having dependencies to org.eclipse.ui.ide and you launch your RCP you'll automatically get an entry in the menu-bar that is called "Convert Line Delimiters to" and also "Last Edit Location", although you don't need it. To remove this entries place the following lines in your ApplicationActionBarAdvisor

JAVA:
  1. ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
  2. IActionSetDescriptor[] actionSets = reg.getActionSets();
  3. // removing annoying gotoLastPosition Message.
  4. String actionSetId = "org.eclipse.ui.edit.text.actionSet.navigation"; //$NON-NLS-1$
  5. for (int i = 0; i <actionSets.length; i++)
  6. {
  7.     if (!actionSets[i].getId().equals(actionSetId))
  8.         continue;
  9.         IExtension ext = actionSets[i].getConfigurationElement()
  10.             .getDeclaringExtension();
  11.         reg.removeExtension(ext, new Object[] { actionSets[i] });
  12. }
  13. // Removing convert line delimiters menu.
  14. actionSetId = "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo"; //$NON-NLS-1$
  15. for (int i = 0; i <actionSets.length; i++)
  16. {
  17.     if (!actionSets[i].getId().equals(actionSetId))
  18.         continue;
  19.     IExtension ext = actionSets[i].getConfigurationElement()
  20.             .getDeclaringExtension();
  21.    reg.removeExtension(ext, new Object[] { actionSets[i] });
  22. }
  • thanks Tom Seidel

    we tried it and , its working fine..great job

    thanks again

    Comment by biju — 29. September 2006 @ 09:09

  • Hi,

    thanks for this one - worked great. I enhanced it to get rid of “open file” as well and changed it so that walked only once through the loop. Takes about 15 millisec for three ids - so I think its quite fast :)

    And it seems to work in Eclipse 3.2 as well.

    Cheers,
    Christoph

    Comment by Christoph — 29. September 2006 @ 15:38

  • thanks.
    your tips really help me!
    finally I could remove “org.eclipse.ui.WorkingSetActionSet”

    Comment by aki — 9. April 2007 @ 16:12

  • This was very helpful thanks.

    I refactored it to avoid the duplication (DRY) as follows:

    private void removeExtraneousActions() {

    ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();

    // removing gotoLastPosition message
    removeStandardAction(reg, “org.eclipse.ui.edit.text.actionSet.navigation”);

    // Removing “Convert Line Delimiters To” menu
    removeStandardAction(reg, “org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo”);
    }

    private void removeStandardAction(ActionSetRegistry reg, String actionSetId) {

    IActionSetDescriptor[] actionSets = reg.getActionSets();

    for (int i = 0; i

    Comment by Edward Garson — 23. April 2007 @ 15:37

  • Ah, there is some filtering going on.

    The implementationof “removeStandardAction” is like the original for loop.

    Have fun

    Comment by Edward Garson — 23. April 2007 @ 15:38

  • Great Job Thanks!!!

    Comment by GC — 9. July 2007 @ 17:18

  • Thanks a lot.

    Comment by Thanker — 28. December 2007 @ 21:08

  • Hi, i try to get rid of the”Open File” menu in the menubar which appeared with the “Convert Line Delimiters to”, how can i do this??
    I can’t fing the “actionSetId”

    Comment by cansen — 5. March 2008 @ 08:49

  • cool site man

    Comment by ben — 6. March 2008 @ 20:44

  • The actionsetid can be found in the plugin “org.eclipse.ui.ide” as extension at the “org.eclipse.ui.actionSets” extensionpoint. Its id is “org.eclipse.ui.actionSet.openFiles”

    Greets, Mike

     

  • posted @ 2008-08-01 13:50 单飞 阅读(779) | 评论 (0)编辑 收藏

    没有高质量的设计,一切都是在表演.
    放弃对品质的追求,无疑是在自杀.
    posted @ 2008-07-04 11:16 单飞 阅读(275) | 评论 (0)编辑 收藏

    用mysql-connector-java-3.1.2stable-bin.jar 连接mysql 5.0的时候会抛这个异常,改用mysql-connector-java-5.1.6stable-bin.jar后就没问题了.
    posted @ 2008-07-04 11:13 单飞 阅读(794) | 评论 (0)编辑 收藏

    public void toImage(Control composiste ,File file)throws Excepton{
    Display display 
    = PlatformUI.getWorkbench().getDisplay();
    Point size 
    = composite.getSize();
    final Image image = new Image(display,size.x,size.y);
    GC gc 
    = new GC(Composite);
    gc.copyArea(image,
    0,0);
    gc.dispose();
    // save image to file;
    ImageData imageData = image.getImageData();
    ImageLoader imageLoader 
    = new ImageLoader();
    imageLoader.data 
    = new  ImageData[1];
    FileOutputStream fos 
    = new FileOutputStream(file);
    iamgeLoader.save(fos,SWT.IMAGE_JPEG);
    image.dispose();
    fos.close();
    }


    posted @ 2008-04-22 17:49 单飞 阅读(275) | 评论 (0)编辑 收藏

    因为TreeView要增加一个弹出菜单来
    Java代码
     1 private void createContextMenu(Composite parent) {
     2         MenuManager mgr = new MenuManager();
     3         mgr.setRemoveAllWhenShown(true);
     4         final EntityTreeView tree = this;
     5         mgr.addMenuListener(new IMenuListener() {
     6             public void menuAboutToShow(IMenuManager manager) {
     7                 // TODO Auto-generated method stub
     8                 ISelection selection = tree.getSelection();
     9                 if(selection instanceof IStructuredSelection){
    10                     IStructuredSelection incoming = (IStructuredSelection)selection;
    11                     if(incoming.size() >0 && incoming.getFirstElement() instanceof AbstractEntity){    
    12                         selectedEntity = (AbstractEntity)incoming.getFirstElement();
    13                         fillContextMenu(manager,selectedEntity);        
    14                     }
    15                 }
    16                 
    17             }
    18 
    19         });
    20 
    21         org.eclipse.swt.widgets.Menu menu = mgr.createContextMenu(this.getControl());
    22         this.getControl().setMenu(menu);
    23         getViewSite().registerContextMenu(mgr, this);
    24     }
    25 
    26     private void fillContextMenu(IMenuManager manager,AbstractEntity selectedEntity) {
    27         org.eclipse.jface.action.IContributionItem items[] = getViewSite().getActionBars().getMenuManager().getItems();
    28         for (IContributionItem item : items) {
    29             if(item instanceof PluginActionContributionItem){
    30                 PluginActionContributionItem pitem = (PluginActionContributionItem)item;
    31                 if(selectedEntity instanceof CategoryModel){
    32                     if ("com.test.actions.RefreshViewActionDelegate".equals(pitem.getAction().getId())){
    33                         manager.add(item);
    34                         continue;
    35                     }
    36                 }                
    37     
    38             }
    39             
    40             
    41         }
    42     }

    plugin.xml

    <extension
             
    point="org.eclipse.ui.viewActions">
          
    <viewContribution
                
    id="com.test.EntityContribution"
                targetID
    ="com.test.View">
             
    <action
                   
    class="com.etest.actions.AddActionDelegate"
                   icon
    ="icons/action.gif"
                   id
    ="com.etest.actions.AddActionDelegate"
                   label
    ="Add"
                   menubarPath
    ="category"
                   style
    ="push">
             
    </action>
    targetID指定那个View会获取到这些action
    如果指定一个toolbarPath
    就会在NavigatorBar显示这些action
    posted @ 2008-04-20 10:24 单飞 阅读(751) | 评论 (0)编辑 收藏


    由于中国式管理对中国现代化的本质缺乏深刻的洞悉,因而错误地判断了中国当前的历史形势。中国当前现代化的本质是“第二次现代化”或“后现代化”,而中国式管理却以“第一次现代化”的眼光来看问题。

    尽管中国式管理也谈全球化,但由于缺少正确的视角,因此,它对全球化的理解是片面和不深入的。这决定了不论何种形式的中国式管理,都是在一个错误的方向上指点中国的未来。

    从全球化和后现代管理的角度,我们认为,目前出现的中国式管理理论,至少存在以下十大糟粕:

    中国式管理糟粕之一:“中国中心论”

    不论何种形式的中国式管理理论,都是“中国中心论”的体现。所谓“以我为主、博采众长……”,不过是“洋为中用”思想的翻版。这些都是近代中国,在面临“第一次现代化”时不成熟的思想。但是直到今天,我们还摆脱不了这种误区,实在是一个大国的悲哀。

    “第二次现代化”或“后现代化”的本质,将是以“大我”观念代替“小我”观念,以世界的眼光来看中国。也就是,首先要认识到中国是世界的中国,而且中国与世界已不可区分。因此,刻意强调“中国式”是一种新形式的“闭关锁国”。它的危险是,将再一次把中国隔离于世界之外。

    尽管一些相对理性的中国式管理言论认为,中国式管理需要具备与国际管理学对话的能力,但全球化背景下,实际上已经无法区分国内与国际。所谓国际或跨国,已经不是一个地理概念,而是一个文化概念。

    从文化的角度来说,跨国文化交流是不需要走出国门的。也就是说,跨国管理学也是不需要走出国门的。任何一门学术,特别是管理学,不出国门就已经是国际的了。在此种状况之下,所谓“以我为主,自成一家”,已经是落伍的思想。因为,所谓的“我”已经是“你中有我”、“我中有你”的“大我”了。强调 “自成一家”的结果,是自决于“大我”的非理性行为。

    可以说,隐藏在“地方特色”背后的“中国中心论”,是中国式管理最能蛊惑人心的思想。它甚至会以理性的名义,将民族主义包装起来,从而使全球化时代的中国管理走入歧途。

    中国式管理糟粕之二:包装的权谋

    中国式管理声称,凡谈权谋乃是没有领会中国式管理的真谛。然而,中国式管理反对的只是赤裸裸的争权夺利,却推崇真正的权谋。因为真正的权谋,正是马基雅弗利所说的“伟大的假好人”式的狡黠。请看中国式管理的“经典”言论:

    “表面上看来,中国人喜欢争权夺利,实际上我们真正开心的,是塑造对自己更加有利的形势。大势所趋,权和利都成为囊中物,高明的中国人,口口声声不为权不谋利,却善于‘造势’,因为形势比人强,可以决定一切”。

    以上所谓的“造势”是什么?一种真正的权谋术,却非要起一个好听的名字叫“造势”!这无非是一种包装,甚至是强词夺理。这种文字游戏实在是没有什么意义。

    其它诸如以下的言论:

    “希望在圆满中分是非,最好把握下述三大原则:第一,平时要以广结善缘的态度,结识各种关系的重要人士,以便必要时商请助一臂之力;第二,任何时候,都不要随便得罪人,以免山不转水转,有一天发生‘不是冤家不聚首’的痛苦场面;第三,要慎重考虑,自己需不需要加入某种党派或势力圈?”
    以上则是赤裸裸地教唆中国人玩弄古代权谋。尽管它所说的是一种中国人生活中的现实,但体现的是一种市侩哲学,而不是致力于改造中国人国民性的正直的学术。

    也许你会说,改造国民性是一种不切实际的乌托邦。但近代以来,我们实际上一直在改造国民性。改革开放以来,中国人的性格也已经变化了许多。

    事实上,明目张胆地教唆人权谋之术,即使在古代也是难登大雅之堂的。而这种“旁门左道”却能在国际化时代的中国,成为一种打着“中国”旗号的“显学”,这本质上还是反映了当今中国人思想上的迷茫。

    放眼西方,也许只有马基雅弗利曾经公然鼓吹过权谋之术。其他无论西方哲学还是基督教信仰,都教导人正直、坦诚、纯洁的高尚品格。西方并没有嘲笑这些高尚的品格是“幼稚”。中国的圣人孔子、孟子等,也无不教导人树立高尚的品格。

    从中国企业目前的状况来看,“办公室政治”的泛滥堪称是一大难题。身在职场的中国人大多都对“办公室政治”深有体会。可以肯定是,没有人真正喜欢“办公室”政治,有的话也是“人在江湖,身不由己”。而中国式管理公然教唆权谋之术的做法,无疑会助长“办公室政治”之风,让中国人活得更累。

    中国式管理糟粕之三:伪装的仁爱

    中国式管理在鼓吹“人性化管理”是自身核心特色的同时,在具体的管理手段上却又完全违背人性。我们来看一看中国式管理的“手段”:

    “中国人当然深知‘向上管理’的奥妙,在于‘能做不能说’……向下管理尚属不可明言,何况是向上管理?上级觉得好笑:‘我都不想管你,想不到你还想来管我!’不免下定决心,先下手为强,整整你,看你敢不敢来管我?心想,‘老子不发威,被部属当成病猫’,干脆发发威风,看谁来向上管理?’
    “‘人在屋檐下,不得不低头’,规定中国人鞠躬,还不如把屋檐压低,让他自然非鞠躬不可。”

    “上司所说的,永远都对,有意见很可能被当作叛逆。……现在不能杀人,却也有一大套整人的办法,令人比死还要难过,何苦以身相试!不如明哲保身,牢牢记住这一条准则。就算老板叫我去死,我也要答应‘好’,反正不去死他也没有办法,何必嘴硬,跟老板逞强!”

    以上这些做法,岂止是远离人性化的管理?完全是压制人性的宫廷之术!那么,中国式管理所鼓吹的爱心又如何体现呢?

    看来,无论是“人性化”还是“爱心”,对于中国式管理来说,都是言不由衷的。中国式管理在客观上只能把中国人个个塑造成奴才,让中国回归专制的古代社会。

    中国式管理糟粕之四:疲劳的人际技巧

    中国式管理自称通过一套“圆通”的沟通艺术,可以使管理轻松愉快。而实际上,按照中国式管理的沟通技巧,只会使人更加沉重痛苦。

    中国式管理所推崇的沟通艺术核心是“不明言”,即深藏不露。这种古代官场文化,在瞬息万变的现代商业社会,特别是在企业内部对话中,如果成为一种规则,其巨大的破坏力是不可想象的。我们来看中国式管理的“三大沟通特色”:

    “中国人沟通有三大特色,一是有话不一定说出来;二是说出来可能含含糊糊;三是就算说得相当肯定,也不一定是真的。”

    现实中确实有很多中国老板是这样的。但这并非大家喜欢的风格,而是为经理人所深恶痛绝。很多经理人就是因为无法承受老板的这种风格而离开公司。如果说是正当的沟通艺术,无论在中国还是西方,都是成年人必备的技能。但中国式管理显然扭曲了人与人之间正常的沟通艺术,而使之变成一种搀杂着权谋和不轨之心的厚黑学。即使中国式管理的动机是好的,客观上也会造成此种后果。这种不透明的文化,并不是中国文化的优秀传统,而是不折不扣的中国文化糟粕。它只能助长中国人的虚伪之风和争斗之风,实在是一种自私自利的个人主义。因为,它把所有人都视为敌对者,为了自己的利益挖空心思。中国式管理批评西方个人主义,它自己却是真正的个人主义鼓动者。

    我们来看看下面这段话:

    “不明言有什么好处?分析起来真的是好处多多:第一,不明言才不致使自己站在亮处,暴光太多,让人家一目了然,很容易加以掌握,甚至抓住弱点;第二,不明言才有回旋的余地,不至于逼死自己。反正话还没有说出嘴,怎么改都可以,才够灵活;第三,不明言才能够引出对方的本意,因为他搞不清楚底细,才肯原原本本地说出来。啊,原来如此!”

    看来,中国式管理所说的“不明言”,目的是让别人“明言”。而如果人人不明言,大家都互相猜测,那将是一种什么样的气氛?竞争激烈、变动迅速的商场,允许此种风气存在吗?大家都把时间浪费在互相猜测和斗法上,企业绩效如何保证?

    中国式管理还主张“会而不议”,就是开会时不进行实质性讨论。请看下面阐述:

    “支持人希望大家‘会而议’,大家会前就心怀鬼胎,秘而不宣,彼此互不沟通,以期会议中各显神通,让主持人刮目相看而视为杰出人才。‘会而议 ’演变成为大家互相攀比、各争功劳的局面,就会引起恶性竞争,造成同归与尽的凄惨结果。……历史上大鸣大放的结局,在主持人下不了台阶或者恼羞成怒的紧束政策下,不知道增添多少冤魂!‘会而议’产生许多‘一开口便成烈士’的教训”。

    原来“会而不议”的目的是明哲保身。中国企业原本就大多缺乏优秀的企业文化,缺乏强大的凝聚力。如果按照中国式管理的做法,只会使企业内部人际关系更加复杂。因为中国式管理的做法,根本上是一种斗争哲学。

    “先说为什么会先死呢?道理几乎都是相对的,所谓仁者见仁,智者见智。先说的人说出这一方面的道理,后说的人很容易站在相反的立场,说出另一方面的道理。虽然双方面都说得头头是道,毕竟后说的人,可以针对先说的人,做一番整理和修补,甚至大挖其漏洞,弄得先说的人,好象相当没有学问。”

    上面这段话,十分清楚地暴露了中国式管理缺乏仁厚之心。开会不先发言,其目的原来就是为了整别人。这实在是令人不寒而栗。

    中国式管理糟粕之五:助长趋炎附势之风

    中国式管理还助长趋炎附势之风。请看下面这段话:

    “我们受到指责和批评的时候,首先要先认清对象,搞清楚‘指责我的人究竟是谁’。

    指责的人职位比我高,形势比我强,或者声望比我隆,最好的因应方式,便是‘做错了,赶快向他道歉,并且设法获得谅解;没有错,则保持沉默,不说话。’

    指责的人职位和我一般高,形势和我差不多,声望也隆不到哪里去,常见的反应是:‘好,我承认我有错,你难道一点错误都没有吗?’于是毫不保留地把对方的错误,也宣扬开来,弄得对方下不了台。

    指责的人职位比我低,形势比我差,声望不如我,这时候首先要考虑一下,他是不是有人在后面撑腰?不然怎么会如此这般?如果是,要特别小心,不理会指责的人,却直探后面那位撑腰的高手,以便适时化解,他自然会制止指责的人,甚至叫他道歉了事。

    若是背后并无高人,那么本着‘不教训你不行,否则别人可能学样’的精神,一定要把脚伸出去,踩得他永远不能超生。”

    打着复兴中国的堂皇旗号,中国式管理给国人开出的却是如此“药方”。

    这种瘪三式的行为难道也是管理学的创新吗?大街上随便找一个没文化的流浪汉也会啊?若中国式管理就是这种面目的话,那真是国人的耻辱!
    再看看下面这段话:

    “总经理从外面回来,嘴角上粘着一颗米饭,职员们看到了,敢不敢说:‘总经理,你怎么带便当?’答案是有人敢,有人不敢。敢说的人并不是勇敢、坦诚、率真,而是料定总经理不会把他怎么样。不敢说的人也不是胆小、阴沉、世故,而是没有把握,究竟会有什么后果。”

    这是典型的太监文化。可总经理并不是皇上。如果按照中国式管理的金科玉律,我们却可以把任何一个总经理培养成“皇上”。难道这样的管理,可以拯救21世纪、塑造“和平的地球村”吗?

    中国式管理糟粕之六:降低效率

    再看看中国式管理的低效性:

    “中国人的化解问题的方法,其实也是推、拖、拉的配合,虚虚实实,真真假假,让人摸不着头脑。”

    如此一来,不知道中国企业何时能走向世界?

    再看一下中国式管理关于会议的观点:

    “我们的建议,中国式会议最好以‘3:1:3’的过程来进行。意思是会议如果预订一个小时,大家就要在会前花三个小时来充分沟通,会议时获得一个富于弹性的共识,会后再花费三个小时,依据这个共识来进一步沟通,寻找可行的途径。”(曾仕强《中国式管理》177页)

    以上做法实在远离管理实践。在瞬息万变的市场中,恐怕没有哪一家企业有这么多时间,去开会前讨论三个小时,开会后再沟通三个小时。

    再看下面的说法:

    “上司‘深藏不露’,部属‘揣摩上意’,看起来好象‘含含糊糊’却绝对不是‘糊里糊涂’。

    通过这种‘含含糊糊’的猜测、模拟过程,寻找出‘清清楚楚’的结果,才是自动建立共识的精神。

    上级‘不明言’底下人自动猜测,是一种历久常新的游戏规则,也是凝聚共识的最有效途径。”
    如果以上原则真的成为企业的游戏规则,不仅不可能成为凝聚共识的有效途径,反而一定会把企业拖入深渊。

    中国式管理糟粕之七:践踏规则

    中国式管理对规则的践踏,更是到了随心所欲的地步,而且以此为荣、为自己的特色。请看下面的言论:

    “中国人呢?‘目标’可以达成也可能不敢达成。因为我们心理最清楚:一旦达成目标,下一次目标就会提高,结果必然逼死自己,何苦来哉!”

    “中国人可以实施目标管理,也可以搞得它名存实亡。对于成果管理,中国人同样具有这样的本领。”

    中国式管理的践踏规则甚至达到了使人怀疑其别有用心的程度。请看以下观点:

    “仔细观察中国人的习性,不难发现‘当一个中国人有道理的时候,他喜欢讲道理,而不提法律条文;当一个中国人觉得自己没有什么道理的时候,他就开始引用法律条文,企图以合法来掩饰自己的无理或不合理;当一个中国人知道自己既不合理又不合法的时候,他便胡乱骂人,想要以泼妇骂街的方式,来获得同情或乡愿式的和稀泥以求自保。’

    过去我们一直以为如此行为,根本不合乎“现代化”的要求,既然和西方人不一样,就应该赶快加以改变。现在我们经济发展恢复自信心,是不是应该重新来思考自己的传统呢?”

    中国经济发展与践踏规则有什么逻辑关系?难道中国现代化的成就都是因为我们不遵守规则才取得的吗?这是何等的逻辑错乱?

    再看下面的观点:

    “个人与个人之间,契约既没有太大的功能,规定也常常形同虚设,因为‘人肉咸咸’,遇到存心抵赖的人,契约和规定,好象永远使不上力。结果只能够约束好人,却任由坏人逍遥法外,产生不了什么管理效果。

    一切具体化、透明化、明确化、成文化,最大的隐患还是把自己缚得完全没有回旋的空间,不是弄得自己诚信有问题,便是被讥讽为‘朝令夕改’。”

    中国的法制建设和规则建立方面只会远远不够,而不会已经过度。反对中国管理的规则化,是一种彻底的反现代行为。再看一段文字:

    “西方人蒙受不白之冤,喜欢依法申诉。中国人则心里明白,法只能保护一时,得罪了人,却会引来长远的报复。息事宁人,表面上看起来很懦弱,实际上往往是根本化解之道。……诉诸于法,原本是不得以才用,中国人常常透过法庭外的和解,用意即在避免或减轻因申诉产生的后遗症。”

    以上这种腐朽的观点,活脱脱是为中国农村学校乱收费、贪官横行等现象作辩护。本文作者之一张羿去年春节回山东老家,就听亲戚说过这样的事情:一家农村小学收了学生的暖气费,却根本不给学生安装暖气。家长人人敢怒而不敢言,没有一个人举报,原因都是害怕得罪了学校,孩子没地方上学。这种懦弱是怎么产生的?这不正是息事宁人思想的恶劣后果吗?

    中国式管理这种与现代化唱反调的观点,究竟属于什么伟大的创新?

    中国式管理糟粕之八:扼杀创造力

    中国式管理还企图让中国人回到“万马齐喑”的时代。请看下面的言论:

    “今日社会动荡不安,追究起来,有些人轻视伦理,鼓励‘有话就要说’;电视上常常出现‘我有话要说’的字幕或声音,都将难辞其咎。”

    今日中国只是价值混乱,何曾动荡不安?“有话就要说”,难道有什么不对吗?改革开放使中国人的创造力得到了很大的发挥。如今缔造创新型国家、发展创新型企业又是我们全民族的历史使命,而创新首先需要的就是解放个性。中国式管理扼杀创造力的观点实在是让人看不懂。

    中国式管理还公然倡导侍奉主子的奴才哲学,与后现代管理的管理主体观完全背道而驰。

    “事情顺利成功,是领导者正确方针的功劳;事情失败,那是推动者的过失,与领导者无关。此时推动者为了表示负责,可以请求辞职;而领导者则视情况,予以慰留或照准。这种领导者有权无责、推动者有责无权的现象,西方管理学者,或许会嗤之以鼻,但就大易管理而言,只要大公无私,有什么不可以?”

    责权不明原本就是中国企业的通病,中国式管理倡导使责权更加不明的做法,只会使中国管理更加混乱。

    而自卡西尔发表人是“符号的动物”观点,德鲁克提出“知识工作者”概念,以及知识经济的兴起以来,世界管理革命突破现代管理范式而进入后现代管理阶段。后现代管理的核心思想就是通过产权模式、组织架构等的变革,使每一名员工都成为企业的主人。在这种人人为管理主体的情况下,每个人的创造力得到最大限度的发挥,同时也产生最强大的团队力量。尊重个体与团队精神,对于后现代管理并不矛盾。这早已为微软、GE等众多世界优秀企业的实践所证明。

    但中国式管理为了标新立异,完全不顾后现代管理时代的管理实际,执意抹杀员工的个体价值。请看下面的观点:

    “管理者最好明白,个人的力量,一定不如众人的力量那么强大。标榜自己的创见,强调个人的贡献,不但不能够汇集众人的意志和力量,而且容易引起大家的嫉妒和打击。我们比较喜欢用延伸的方式,把自己的意见溶入上级的意见,使其内容更加充实。组织成员,每一个人都把自己的部分意见,集中到上级的意见里面,便成为众志成城的好意见。现代人受到西方的影响,开口闭口就说什么个人的意见,实在是不智的举动,破坏组织的凝聚力,也造成各人坚持己见,不肯让步的僵局。不如以上级意见为主轴,融入大家的看法,汇合成大家的意见,更为可行。”

    通过以上阐述,不难看出,中国式管理的抹杀个性,原因是害怕嫉妒,目的是为了息事宁人。这决不是一个坦荡的中国人所应秉持的行为。当我们人人都追求坦荡无私,个体价值与集体利益就不会有什么矛盾。

    中国式管理糟粕之九:助长迷信之风

    更为严重的是,中国式管理还假借科学之名,而行迷信之实。说中国式管理公然宣扬迷信,并不为过。

    “何况大易哲学,从历史渊源来考察,最早都具有明显的卜筮作用,不宜完全加以忽视。”(

    “占卜到底是不是迷信?我们不赞成用‘是’或‘不是’来回答。正确的占卜,不是迷信;不按理出牌的占卜,当然是迷信。”

    我们承认《易经》的价值,但不等于毫不批判地接受。但中国式管理却连其糟粕也照单全收,甚至特别重视其糟粕部分。中国式管理不好好研究现代决策科学,却号召中国企业用占卜来辅助决策,并怂恿大家烧香拜佛,实在是不明智之举。

    由于局限于中国的某些封建文化,中国式管理并未清楚地界定迷信与信仰之间的巨大界限。因而,在信仰方面又给中国人开出了糊涂的药方。神秘主义主导下的中国式管理是异常危险的。

    中国式管理糟粕之十:助长人性之邪恶

    中国式管理还有助长人性邪恶之嫌。请看以下的描述:

    “中国人的警觉性普遍很高,因此有人怀疑脸部的表情可以隐藏起来,而说话方式的表情也可以做假。至少中国人对眼睛的故意麻木没有表情,乃是众所周知的事。老于世故的人,很难从他的眼睛看出任何表征。所以若非经过多次观察,最好不要轻率地加以判断。”
    以上固然是对中国人的真实描述,但中国式管理并未开出改变国民性的药方。而是倡导中国人以毒攻毒,使自己也变得高深莫测。

    再看以下言论:

    “西方人多半嘲笑那些骗人的人,却十分同情那些被骗的人。中国人不是这样,可以说相反。

    我们对那些骗人的人,心里似乎有一些羡慕:‘真有办法,一下子骗走那么多钱!’我们极力嘲笑那些被骗的人:‘你看,叫你要小心,你偏不听,现在上当了吧?损失惨重,对不对?’”

    这是什么样的国民性?不同情被骗的人,却羡慕骗人者,意即尊崇邪恶而嘲笑无辜。但中国式管理不仅没有批评这种现象,反倒以此为荣,并且认为是中国优于西方的特色。凡是中国有而西方没有的,就算是错误的、甚至是腐朽、邪恶的,对于中国式管理而言,都是可以拿来到世界上炫耀的资本。这堪称是中国式管理的一惯作风。

    中国式管理还倡导假仁假义。不信请看以下言论:

    “大家都企求富贵,却不知道富贵集于一身的时候,就成为众矢之的了。如果想要安全,便应该将自己的富分享给天下的穷人,以自己的贵去礼待天下的贱人。”

    这是中国式管理在讲易卦中和道德有关的“谦”卦时所表达的观点。原来某些中国富人的慷慨不过是因为怕穷人攻击。这是十足的伪善和邪恶。

    有些中国学者针对中国企业家不太热衷公益活动的现象指出,这是因为中国企业家不象西方企业家那样善于宣传。而事实上西方企业家的热衷公益,大多不是为了宣传自己,而是在信仰上帝的前提下向社会奉献爱心的结果。从老一辈的资本家亨利·福特、洛克菲勒,到新一代企业比尔·盖茨莫不如此。相反,中国企业家是最擅长炒作的,但却惟独缺乏爱心。
    posted @ 2008-04-20 10:15 单飞 阅读(207) | 评论 (0)编辑 收藏

    InputStream in = getClass().getResourceAsStream('/'+"spring-beans.dtd"); 表示从classs目录下面的找文件,文件放在src下面就可以了.
    InputStream in = getClass().getResourceAsStream("spring-beans.dtd"); 表示从当前classs下面的路径找文件
    如果是在com.a.b.c.d.Test这个class就表示spring-beans.dtd要放在目录src\com\a\b\c\d下.

    SAXBuilder builder = new SAXBuilder();
                EntityResolver resolver = new EntityResolver() {

                    public InputSource resolveEntity(String publicId,
                            String systemId) {
                        if (publicId.equals("-//SPRING//DTD BEAN//EN")) {
                            InputStream in = getClass().getResourceAsStream(
                                    '/'+"spring-beans.dtd");
                            return new InputSource(in);
                        } else {
                            return null;
                        }
                    }

                };
                builder.setEntityResolver(resolver);

    这样才能解决dtd的本地查找问题.

    posted @ 2007-04-26 13:54 单飞 阅读(4771) | 评论 (0)编辑 收藏

    重载getAdapter方法:
    public Object getAdapter(Class required) {
            if (org.eclipse.ui.views.properties.IPropertySheetPage.class
                    .equals(required){
              org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration cfg = createPropertySheetConfiguration();
                    if (cfg != null) {
                        PropertySheet propertySheetPage = new PropertySheet(
                                this);
                        propertySheetPage.setConfiguration(cfg);
                    }
               
            }

    public class PropertySheet extends Page implements
            IPropertySheetPage {
    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
        //change form part
    }

    posted @ 2007-04-24 15:17 单飞 阅读(419) | 评论 (0)编辑 收藏

    在试用Tapestry5.0.3的时候发现这个问题:
    WARN [(jetty.servlet.ServletHandler)] Error for /wfmanager/
    java.lang.NoSuchMethodError: java.lang.Class.getSimpleName()Ljava/lang/String;
        at org.apache.tapestry.ioc.internal.util.InternalUtils.asString(InternalUtils.java:91)
        at org.apache.tapestry.ioc.services.MethodLocation.toString(MethodLocation.java:50)
        at org.apache.tapestry.ioc.internal.util.InternalUtils.asString(InternalUtils.java:67)
        at org.apache.tapestry.ioc.internal.ServiceBuilderMethodInvoker.methodId(ServiceBuilderMethodInvoker.java:82)
    我的jdk是J2sdk1.5.0的后来换成j2sdk1.5.10就可以了.所以说j2sdk.15不全是都支持getSimpleName()这个方法的.


    posted @ 2007-04-11 11:21 单飞 阅读(1416) | 评论 (0)编辑 收藏