随笔 - 16, 文章 - 0, 评论 - 0, 引用 - 0
数据加载中……

2011年12月19日

springJDBCTemple能查询不能更新

这个问题实在是太sui了,就因为不知道什么时候把dataSource的配置写成<property name="defaultAutoCommit" value="false" />
所以,所以,,妈的,改true就好了。。。

posted @ 2012-03-21 11:38 yita 阅读(289) | 评论 (0)编辑 收藏

mysql insert时报Duplicate entry...for key..

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); Duplicate entry...for key..的意思时重复的键值,检查主键或者其他唯一键值重复。

posted @ 2012-03-20 20:08 yita 阅读(313) | 评论 (0)编辑 收藏

Install DB2 on LION


先下载DB2 Express-c for mac 

下载地址:

https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source=swg-db2expressc&S_PKG=dlmacosx&S_TACT=100KG31W&lang=en_US&cp=UTF-8


有两个文件,一个是Express-C free db,一个是 Client。最好选择直接下载而不要使用download director,ibm这个下载器真心一个烂。

下载的时候顺手搜了下,stackoverflow上有说lion下安装有问题,原因是db2setup无法正确识别出系统构架x86_64

解决方法是先使用uname -m 查系统构架。

再修改db2setup脚本如下

"Darwin")

    case ${OSM?} in

      i*86)

          INSTALLDIR="${PROGDIR?}/db2/macos/install"

          PLATNAME="MacOS" ;;

      x86_64)

          INSTALLDIR="${PROGDIR?}/db2/macos/install"

          PLATNAME="MacOS/x86_64" ;;

    esac ;;

"HP-UX")

原文地址 http://stackoverflow.com/questions/7072871/how-do-i-install-ibm-db2-express-c-on-mac-os-x-10-7-lion


不过我下载下来的并没有这个问题,i*86默认改为*86*了,不知道是我只安装client还是ibm已经修正这个bug了?
但是安装的时候乱码,我就直接执行db2install,很快就安装结束,提示

必须设置 DB2 实例环境

      ,其方法是:在 sqllib 目录中查找 db2profile 或 db2cshrc,也可以对 

      DB2 实例用户打开新的登录窗口。



未完待许。。



posted @ 2012-03-08 14:28 yita 阅读(510) | 评论 (0)编辑 收藏

泛型方法

public static <T> void add(Info<T> i1, Info<T> i2){
返回值前的<T>是泛型方法的声明方式,不加编译错误。

posted @ 2012-02-28 22:50 yita 阅读(188) | 评论 (0)编辑 收藏

mac快捷键以及增加桌面

 ⌘=CMD;⌥=OPT;^=Ctrl;⇧=Shift; ⎋=Esc;⌫=Del 

新增桌面 ,触控板四指向下,或者按F3 打开Mission Control 点右上角点击+号。
然后把不同程序按需要拖动到不同桌面即可。

mac里command与win得ctrl功能差不多。不少快捷键也相似可以尝试。

posted @ 2012-02-13 11:23 yita 阅读(2584) | 评论 (0)编辑 收藏

mac下使用eclipse的svn报错问题

 Failed to load JavaHL Library.
    These are the errors that were encountered:
    no libsvnjavahl-1 in java.library.path
    no svnjavahl-1 in java.library.path
    no svnjavahl in java.library.path
    java.library.path = ********

 eclipse装好svn插件之后报加载JavaHL libary错误,看了一对说是要加参数指定 java.library.path。加了之后发现没用,又搜了搜找到这个

  http://subclipse.tigris.org/wiki/JavaHL

其中mac os 里有段写到

The easiest thing to do is download and install the OSX package that is provided on openCollabNet. This installs Subversion, including the JavaHL library, into /opt/subversion. 

于是在http://www.open.collab.net/downloads/community/下载之,下载需要先注册,找到10.7版的。再开开eclipse,同步svn就没有问题

 

ps.在sinaapp上看到介绍svnx这个客户端,纪录下,有时间试试

posted @ 2012-01-10 10:49 yita 阅读(2025) | 评论 (0)编辑 收藏

Struts2 注解基础

The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

先是报这个错,因为struts2的filter是*.action的原因。改为以下即可。

<filter-mapping>
<filter-name>struts2Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

 

1.convention plugin插件

convention plugin默认result页面存放在WEB-INF/content.(可以通过struts.convention.result.path属性来设置)。

如 http://localhost:8080/hello-world该url将访问WEB-INF/content/hello-world.jsp。

2.convention plugin查找类的规则

    convention plugin会查找struts、struts2、action、actions等包里的满足以下条件的类(好像可以设置)

  • 实现或继承com.opensymphony.xwork2.Action、ActionSupport的类。
  • 或者action结尾的类名
  修改包查找规则修改下面两个属性
<constant name="struts.convention.package.locators" value="test" />
<constant name="struts.convention.package.locators.basePackage" value="com.test" />

3.convention plugin类对应URL规则

  在struts、struts2、action、actions等包下生成“/”,更深层次则继续以“包名/”,类名子目全小写,按驼峰法分隔单词添加“-”。举例如下:

com.example.actions.MainAction -> /main
com.example.actions.products.Display -> /products/display
com.example.struts.company.details.ShowCompanyDetailsAction -> /company/details/show-company-details

4.result对应页面名称

  页面命名与类名规则相同,再加上“-”与result值即可,如果找不到result的页面,似乎会返回到省略result名称的页面,还有success可省略,如下:

URLResultFile that could matchResult Type
/hello success /WEB-INF/content/hello.jsp Dispatcher
/hello success /WEB-INF/content/hello-success.htm Dispatcher
/hello success /WEB-INF/content/hello.ftl FreeMarker
/hello-world input /WEB-INF/content/hello-world-input.vm Velocity
/test1/test2/hello error /WEB-INF/content/test/test2/hello-error.html Dispatcher


5.chaining

  例子:foo action找不到result页面,会自动查找foo-bar action

package com.example.actions;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class HelloAction extends ActionSupport {
@Action("foo")
public String foo() {
return "bar";
}

@Action("foo-bar")
public String bar() {
return SUCCESS;
}
}

 

 

  

  

 

 

 

 

参考:

struts2 convention-plugin文档

http://www.vaannila.com/struts-2/struts-2-example/struts-2-annotation-example-1.html

http://apps.hi.baidu.com/share/detail/48320875

posted @ 2011-12-30 20:14 yita 阅读(182) | 评论 (0)编辑 收藏

vim的一些配置。

vimrc里加上下面代码就可以ctrl+c、ctrl+v、ctrl+a等windows操作

1 source $VIMRUNTIME/mswin.vim
2 behave mswin

 

解决乱码问题

" 设定默认解码
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
"set fileencoding=chinese
set fileencoding=utf-8
else
set fileencoding=utf-8
endif
language message zh_CN.utf-8
"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"set font
"set guifont=Nsimsun
set guifont=Fixedsys:cGB2312

 

最近用了这个vimrc(  http://amix.dk/vim/vimrc.html),据说是最强配置,去了个command—T(要装ruby),里面还有不少插件得自己找。看了下主要是python和js的配置,回头得再加点java的。

顺便得加上这个函数

fun! MySys()
return "windows"
endfun




posted @ 2011-12-20 12:05 yita 阅读(185) | 评论 (0)编辑 收藏

IE6的modaldialog里href运行javascript的错误解决方法

IE6中用modaldialog时,a的href里写javascript时,如<a href="javascript:test();">test</a>,如果无效或者出错时,加上<base target="_self">即可。

posted @ 2011-12-19 20:33 yita 阅读(163) | 评论 (0)编辑 收藏