定制 xmlbeans 所生成的 package

xmlbeans 也是 XML binding 工具之一,不了解的同学可以去了解一下,是这方面比较流行的框架之一。本篇不会长篇累牍的去介绍如何使用,相信在这方面,官方文档已足够。

我们知道,xmlbeans 提供了命令行工具,同时也有 ant task,支持把 xsd 生成 Java class 这一功能。xmlbeans 所生成的这些 classes 的 package 其实是有一定规律的。默认情况下,package 是根据 namespace 和元素类型而定。在某些情况下,特别是这个 xsd 并不是我们所能控制的情形下,我们需要生成不同于 namespace 的 package,这时就需要我们做出一些特殊处理。

命令行:scomp -d ..\classes -src ..\src -javasource 1.5 EasyPO.xsd po.xsdconfig

ant task:




注意,在 ant task 下,只需要把 po.xsdconfig 放在与 EasyPO.xsd 同一目录即可。

By javafuns on August 15, 2010 at 17:29 · Views: 53 · Permalink · RSS · Leave a comment
Categorized in: Java, SOA · Tagged with: , ,

卜算子 七夕

清晨被一群喜鹊吵醒了,一想这不是到七夕了吗,遂有感而发,也将这首词送与普天下的有情人。
同时祝愿舟曲的人们早日找到自己的家人和朋友,重建生活,也愿逝者安息。

窗外鹊群聊,
缘是七夕到。
织女天河欲见郎,
犹待天桥造。

桌角企鹅弹,
情侣来相叫。
纵使相隔万里遥,
仍见(现)情人笑。

附上:
* (仄)仄仄平平,(仄)仄平平仄。(仄)仄平平仄仄平,(仄)仄平平仄。
* (仄)仄仄平平,(仄)仄平平仄。(仄)仄平平仄仄平,(仄)仄平平仄。

By javafuns on August 15, 2010 at 10:25 · Views: 33 · Permalink · RSS · Leave a comment
Categorized in: My Life · Tagged with: 

Get the fast mirror of ubuntu server

摘自:http://wowubuntu.com/get_fast_apt.html

目前只支持 Ubuntu 10.04 LTS (Lucid Lynx ) 。

# 命令:

选择最快的镜像服务器

sudo wget -O /etc/apt/sources.list http://ubuntu9.com/topmirror/sourceslist/topfast

选择你地域内 (国家) 的最快的镜像服务器

sudo wget -O /etc/apt/sources.list http://ubuntu9.com/topmirror/sourceslist/topnear

选择最稳定的镜像服务器

sudo wget -O /etc/apt/sources.list http://ubuntu9.com/topmirror/sourceslist/topstable

By javafuns on August 9, 2010 at 17:58 · Views: 56 · Permalink · RSS · Leave a comment
Categorized in: Operation Systems · Tagged with: ,

Integrate your shell with your nautilus

今天在安装反编译工具 JD-GUI 时,发现 ubuntu 提供了这样一个好玩的小玩意儿,可以将 shell 集成到 nautilus 中,这样可以随时随地在 nautilus 中右键打开 shell。

将 shell 脚本如 hello.sh 放到 ~/.gnome2/nautilus-scripts/ 目录下,然后你随意打开一个文件夹,展开右键菜单,赫然发现菜单中多了个 “脚本” 菜单项,其下一级菜单项就包含了刚才的 “hello.sh”。

好玩吧? 那就赶紧动手试试吧!

By javafuns on August 5, 2010 at 21:32 · Views: 56 · Permalink · RSS · Leave a comment
Categorized in: Operation Systems · Tagged with: ,

A brief introduction of what is RDF

The Resource Description Framework (RDF) is a language for representing information about resources in the World Wide Web. It provides a graph structure for making statements about things. RDF is designed to be read and understood by computers. It is not designed to be displayed to people. RDF is the W3C standard for encoding knowledge. It is a specification that fills a particular niche for decentralized, distributed knowledge and provides a framework to enable computer applications to handle data.

RDF was originally created in 1999 as a standard on top of XML for encoding metadata, e.g. data about data. It is a foundation for processing metadata.

RDF specifies the data model and syntax for sharing knowledge about concepts on the Web. It does not specify how concepts may relate to one another.

RDF has a simple data model, based on triples:

subject predicate object

It is a graph-based formalism for representing metadata, where the subject and the object are things (entities), and the predicate denotes the relationship between them. Each triple represents a fact. The figure below shows Peter to be the subject of the triple, Sofia to be the object, and lives into be the predicate describing the relationship between Peter, the subject, and Sofia, the object of the triple.

RDF triple

RDF triple

The subject and object are nodes and the predicate (e.g. the property) – an arc. Properties are represented as a directed arc, so they are only valid from subject to object. Read more »

By javafuns on August 4, 2010 at 14:25 · Views: 50 · Permalink · RSS · Leave a comment
Categorized in: HTTP / WEB · Tagged with: , ,

Linux批量删除文件

以删除令人厌恶的 .DS_Store 文件为例:
find . -name .DS_Store -exec rm -f {} \;
该 find 命令查找文件名为 .DS_Store 的文件,并将这些文件替换到 {} 部分从而进行删除。
‘;’ 前的参数都作为 rm 的参数, ‘\’ 则是对 ‘;’ 进行 escape。

xargs 也挺不错的:find . -name .DS_Store | xargs -i rm -rf {}

再看一个例子,查找并打开一个文件:
find . -name HttpServletRequest.java -exec vi {} +

By javafuns on July 26, 2010 at 21:25 · Views: 83 · Permalink · RSS · Leave a comment
Categorized in: Operation Systems · Tagged with: , ,

wait and notifyAll in Java multi-threading

wait:当线程进入wait()时,会马上释放锁,并进入到wait状态。当该线程被再次唤醒时,继续从等待处往下执行。

notifyAll:当线程执行完notifyAll(),会继续执行剩下的代码,直至退出同步区域,此时才会释放锁。

By javafuns on July 16, 2010 at 11:22 · Views: 115 · Permalink · RSS · Leave a comment
Categorized in: Java · Tagged with: ,

关于 java.util.concurrent 您不知道的 5 件事(转载)

通过并发 Collections 进行多线程编程

Ted Neward, 总裁,ThoughtWorks, ThoughtWorks

简介: 编写能够良好执行,防止应用程序受损的多线程代码是很艰巨的任务 — 这也是为什么我们需要 java.util.concurrent 的原因。Ted Neward 会向您说明并发 Collections 类,比如CopyOnWriteArrayListBlockingQueue,还有 ConcurrentMap,如何针对您的并发编程需求改进标准 Collections 类。
除了具有很好的并发性的 Collections,java.util.concurrent 还引入了其他一些预先构建的组件,它们可帮助您调整和执行多线程应用程序中的线程。Ted Neward 介绍在 Java™ 编程过程中使用 java.util.concurrent 包要注意的 5 点。

第一部分

Concurrent Collections 是 Java™ 5 的巨大附加产品,但是在关于注释和泛型的争执中很多 Java 开发人员忽视了它们。此外(或者更老实地说),许多开发人员避免使用这个数据包,因为他们认为它一定很复杂,就像它所要解决的问题一样。

事实上,java.util.concurrent 包含许多类,能够有效解决普通的并发问题,无需复杂工序。阅读本文,了解 java.util.concurrent 类,比如 CopyOnWriteArrayListBlockingQueue 如何帮助您解决多线程编程的棘手问题。

1. TimeUnit

尽管本质上 不是 Collections 类,但 java.util.concurrent.TimeUnit 枚举让代码更易读懂。使用 TimeUnit 将使用您的方法或 API 的开发人员从毫秒的 “暴政” 中解放出来。
Read more »

By javafuns on July 13, 2010 at 11:09 · Views: 156 · Permalink · RSS · Leave a comment
Categorized in: Java · Tagged with: 
  • Highest Rated

  • My PicasaPhotos

    A father cries next to the recovered body of his son (R) that is laid out with other bodies at the playground of a school at the earthquake-hit Hanwang Town of Mianzhu County, May 14, 2008. China poured more troops into the earthquake-ravaged province of Sichuan on Wednesday to quicken a search for survivors as time ran out for thousands of people still buried under rubble and mud.  REUTERS/Jason Lee (CHINA)

    IMG_0684.JPG

    IMG_0679.JPG

  • RSS My del.icio.us

  • My RSS