邋遢居

我的Java天堂

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  61 Posts :: 2 Stories :: 90 Comments :: 0 Trackbacks

#

在看《卓有成效的程序员》 迷你书的时候,发现gant这个小东西。一下子就被他镇住了。心想原来还可以通过这种方式来使用ant。

随后在ibm的技术网站上找到了用Gant构建软件 这个在线教程。简单的过了一下,发现还真的好用。还有因为工作原因经常需要写一点测试用的web service。而我对这个又不是特别属性,想用Java来写有怕太麻烦。所以想找一找有没有什么动态语言很方便的能够实现web service(其实重点是找python的)。最后还是发现GroovyWS. 通过这样两个小东西,我发现groovy真的很不错。特别是对于java程序员来说。所以准备系统的学习一下他。特此记下。

posted @ 2009-11-07 22:38 Jet Geng 阅读(226) | 评论 (0)编辑 收藏

删除空行

g/^\s*$/d                  : delete all blank lines

 

这个里面使用了“:g”命令,Google了一下,找到了如下描述:

:g is something very old and which is very powerful. I just wanted to illustrate the use of it
with some examples. Hope, it will be useful for someone.
Brief explanation for ":g"
-------------------------
Syntax is:
    :[range]:g/<pattern>/[cmd]
You can think the working as, for the range (default whole file), execute
the colon command(ex) "cmd" for the lines matching <pattern>. Also, for all
lines that matched the pattern, "." is set to that particular line (for
certain commands if line is not specified "." (current line) is assumed).
Some examples
-------------
Display context (5 lines) for all occurences of a pattern
    :g/<pattern>/z#.5
    :g/<pattern>/z#.5|echo "=========="
    << same as first, but with some beautification >>
Delete all lines matching a pattern
    :g/<pattern>/d
Delete all blank lines (just an example for above)
    :g/^\s*$/d
Double space the file
    :g/^/pu =\"\n\"
    :g/^/pu _
    << the above one also works >>
Copy all lines matching a pattern to end of file
    :g/<pattern>/t$
Yank all lines matching a pattern to register 'a'
    0"ay0:g/<pattern>/y A
Increment the number items from current line to end-of-document by one
    :.,$g/^\d/exe "normal! \<c-a>"
Comment (C) lines containing "DEBUG" statements
    g/^\s*DEBUG/exe "norm! I/* \<Esc>A */\<Esc>"
A Reverse lookup for records
(eg: An address book, with Name on start-of-line and fields after a space)
    :g/<patern>?^\w?p               "if only name is interested
    :g/<patern>/ka|?^\w?p|'ap       "if name and the lookup-line is interested
    :g/<patern>/?^\w?|+,/^[^ ]/-1p  "if entire record is interested
Reverse a file (just to show the power of 'g')
    :g/^/m0
Foot note 1: use :v to negate the search pattern
Foot note 2: Some explanation of commonly used commands with :g
:2,8co15 => Copy lines 2 through 8 after line 15
:4,15t$  => Copy linesa 4 through 15 towards end of document (t == co)
    :-t$  => Copy previous line to end of document
     :m0  => Move current line to the top of the document
:.,+3m$-1 => Move current line through cur-line+3 to the last but one line
             of the document
Foot note 3: Commands used with :g are ex commands, so a help search should
             be,
                :help :<help-topic>
                eg. :help :k

尝试翻译如下

:g是一个非常老且很强的的命令。我只想通过一些例子来演示他的用法。希望对被人有用。

“:g”的概述

         语法::[rang]:g/<pattern>/[cmd]

你可以认为他是这么工作,在特定的范围内([rang]确定,默认是整个文件)。他逐行逐行的用<pattern>去匹配,如果匹配成功就执行 冒号命令 (“cmd”来指定)。另外,如果<pattern>匹配所有行,那么只有对当前行执行 冒号命令。

 

今后会不断更新……

 

--------------------------

:%s/^\(.*\)\n\1/\1$/        : 删除重复行 # 非贪婪匹配,\{-}

一会来分析

posted @ 2008-05-28 10:55 Jet Geng 阅读(2462) | 评论 (3)编辑 收藏

今天遇到了点事情,无法入眠。起来写点小东西吧,突然想起前几天就说的好好了解一下java中的Date这件事情来。刚好就这么顺手做了吧!

 

首先java.sql.Date是java.util.Date的一个子类。他拥有java.sql.Date的所有功能,他只是做了点扩展。这点扩展是为了让JDBC能够识别成date类型。就是这样子的。

image

其实也真的没什么好写的。就这样吧,作为一个记录!

posted @ 2008-05-27 00:43 Jet Geng 阅读(503) | 评论 (1)编辑 收藏

       Birt这个项目开始已经很久了。先前一直没有使用表报的需求,所以也就没有对这个项目做太多的关注。就在前一段时间突然有了这一方面的需求,所以就开始在网上疯狂的Google和Birt相关的信息。因为这个项目开始时间挺长了,而且越来越成熟。所以和他相关的资料挺多。efa在他的《[JAVA - BIRT]Birt 学习资料》已经给出了很多内容。

      除了这些内容外我还找到了三本书:

  1. BIRT: A Field Guide to Reporting
  2. Integrating and Extending BIRT
  3. Packt.Publishing.Practical.Data.Analysis.and.Reporting.with.BIRT

     第一本和第二本是在是基于 Birt 2.1。

      第三本书是基于Birt 2.2

    有了这些东西基本就可以上路了。但是我又一想,如果有点例子就更好了。例子肯定是有的。官方就有,还等什么呢还不赶紧去拿。

 

birt

到里面随便找吧。肯定有你合适的。

下面要做的事情就是分析好你的需求,好好用birt来表现你的内容了。

posted @ 2008-04-04 10:01 Jet Geng 阅读(1198) | 评论 (0)编辑 收藏

关于《Developing Eclipse/OSGi Web Applications Part》一文中的例子

近来看看点OSGIWeb开发中的应用。看到这个方面的东西肯定会搜到EclipseZone上面的一篇文章,他叫《Developing Eclipse/OSGI Web Application》。说实话这个文章写的真的没说的,浅入浅出的同时还给你真正带来不少好东西。他的所有的内容是围绕着一个叫Rsp的例子进行的。这个例子在http://sourceforge.net/project/showfiles.php?group_id=122298 处可以下载到。


这里我下载了rspDemo-0.2.zip这个包。按照要求把包打开,并且运行。果然可以运行,并且能够得到文中所说的结果。

下面我们就来看看解压后的文件夹:

这个里面不光包括了示例代码还包含了一个tomcat-5.5.15生怕被人机器上没有装tomcat。好了,把我自己的eclipseworkspace设置成c:\rsp\workspace。这样我就得到了一个如下图的工作界面:

这个时候我不想使用rsp中自己带的那个tomcat,我想自己已经有的tomcat。就在这个时候我遇到问题了。什么问题呢,我们来看看启动时的log

严重: Servlet.service() for servlet jsp threw exception

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

    很明显是没有找到urihttp://java.sun.com/jsp/jstl/core tld文件。不对啊,这个应该都是在web应用程序里面的啊。但是他自己带的tomcat就可以。肯定是他自己加了。我找了好大一会儿终于在C:\rsp\apache-tomcat-5.5.15\common\lib多出两个包他们分别是jstl.jarstandard.jar。查看了一下standard.jar所有真相大白。他包含了一个c.tld的文件。其中有这么一段

<description>JSTL 1.1 core library</description>

<display-name>JSTL core</display-name>

<tlib-version>1.1</tlib-version>

<short-name>c</short-name>

<uri>http://java.sun.com/jsp/jstl/core</uri>

好了,把这两个包放入到我自己的tomcat中,所有问题都解决了。终于顺畅的跑起来了。


posted @ 2008-03-15 15:33 Jet Geng 阅读(2438) | 评论 (1)编辑 收藏

问题一:

问:项目图标报错,Problems 试图有一条错误显示“Java compiler level does not match the version of the installed Java project facet.”

答:这个是因为Facted Project中的Java版本设定与项目的Java版本设定不一致。

Drawing 1: Modify: Modify Faceted Project中所示,这个时候项目的Java的版本为5.0。如果项目的Java Compiler的设置如Drawing 2: Java C: Java Compiler中所示的设置。就是会出现问题中所述的错误。修改的方式很简单,只要统一一下他们的设置。让他们保持一致就OK了。


posted @ 2007-10-15 14:26 Jet Geng 阅读(3858) | 评论 (2)编辑 收藏

使用DTP时遇到一个很奇怪的问题。

我所使用的DTP的版本是dtp-sdk_1.0_200612211。我通过Data Source Explorer来浏览数据库是发现有的字段的类型不能正确显示。


这个数据库是Mysql 5.0.

这个数据表在Navicat中的设计视图如下图。


这种问题不光出现在mysql数据库中,在oracle 10g的数据库中我也发现了类似的情况。

发现他不能正常的显示Clob和Blob这两种类型。



在Sql plus中这个表的描述为:


知道怎么回事的兄弟们,帮忙告诉我一声。先谢谢了。

posted @ 2007-06-22 14:39 Jet Geng 阅读(599) | 评论 (2)编辑 收藏

这几天在resin跑一个taglibcommon-controls http://www.common-controls.com/en/index.php)库。发现很多东西不能用。下图中的菜单全部变成了“logout”。其他的全部没有了。


这个页面在tomcat下跑起来的效果是:

怎么会是这样。看上去是不是很奇怪啊。

后来查看了一下cc-samples\WEB-INF\work\_jsp\_jsp\_template下的_header__jsp.java

发现

com.cc.framework.taglib.menu.MenuItemTag这个类只被创建了一次。而且在重复使用。

if (_jsp_MenuItemTag_3 == null) {

        _jsp_MenuItemTag_3 = new com.cc.framework.taglib.menu.MenuItemTag();

        _jsp_MenuItemTag_3.setPageContext(pageContext);

        _jsp_MenuItemTag_3.setParent((javax.servlet.jsp.tagext.Tag) _jsp_MenuTag_2);

}

于是我就在猜想啊向com.cc.framework.taglib.menu.MenuTag这个类的实例中添加了那么多MenuItem肯定就只加了这么一个实例了。所以在最后显示的只显示出最后设置的参数了。

 

最后查看有一个仁兄也遭遇了类是的情况。也用blog记录下来了。下面的话就是他的结论:

于同名标签,引用10,Tomcat就会创建10个方法和标签对象来做对应的处理。而Resin只会创建1个对应的标签实例,如果后面再 引用,则不会创建新的,只操纵唯一的一个实例。所以在标签的逻辑处理中,要注意属性释放和还原的情况。我犯的错误就是因为其中的一个属性一直保存在该实例 中并没有销毁,导致后面再处理的时候发生冲突。

 

http://b0r0j0.blogbus.com/logs/4028462.html


posted @ 2007-04-05 16:36 Jet Geng 阅读(1439) | 评论 (1)编辑 收藏

今天终于把solaris的环境变量搞明白了。
Solaris中设置环境变量和你当前采用的Shell有关,不同的Shell需要写入到不同的文件中。

如果你是Bourne Shell
PATH=$PATH:/usr/bin; export PATH
环境文件为.profile

如果你是 C shell
变量设置
路径变量:set path=($path /usr/bin)
 环境文件
.login .cshrc

这里有个问题是我如何能够知道我自己用的是那种类型的shell呢?
有办法 使用cat /etc/passwd

solaris-path.jpg

你会得到如上图所示的内容,看看你自己的那一行。在上面的文件中,我是有下划线的那一行。后面的/bin/sh就表示我使用的是Bourne Shell。我只需要按照那个来设置就好了。

 

有一点就是如果PATH已经被export过了,那么你就可以把“export PATH ”这一段省略调了。

solaris 9上跑通过了。
在solaris上我还完全是一个新手,如果有什么说的不对的地方欢迎指正。谢谢了先。
posted @ 2007-03-26 16:12 Jet Geng 阅读(3976) | 评论 (2)编辑 收藏

今天看到了Eclipse AspectJ这本书,小试了一下这个东西还真的不错。
posted @ 2007-03-06 14:48 Jet Geng 阅读(438) | 评论 (0)编辑 收藏

仅列出标题
共7页: 上一页 1 2 3 4 5 6 7 下一页