2009年6月29日

wii

http://www.wiiholic.com

http://www.wii.club.tw


用硬碟玩Wii遊戲的時代來臨(安裝步驟圖文詳解)新增遊戲安裝列表
http://kissjojo99.pixnet.net/blog/post/23134530

Wii中文說明書
http://game.ps2ps3.com/wii/


http://www.corumcollege.com/forum/forumdisplay.php?f=53

2009年6月24日

ORACLE 有關時間的格式表

















































































MMNumeric month (e.g., 07)
MONAbbreviated month name (e.g., JUL)
MONTHFull month name (e.g., JULY)
DDDay of month (e.g., 24)
DYAbbreviated name of day (e.g., FRI)
YYYY4-digit year (e.g., 1998)
YYLast 2 digits of the year (e.g., 98)
RRLike YY, but the two digits are ``rounded'' to a year in
the range 1950 to 2049.
Thus, 06 is considered 2006 instead
of 1906
AM (or PM)Meridian indicator
HHHour of day (1-12)
HH24Hour of day (0-23)
MIMinute (0-59)
SSSecond (0-59)

2009年6月23日

ant for spring

ant for spring
參考網路文件設定而成
主要是在ant 可執行 spring 中 bean 的task
ant-xml:







































destdir="${classes}"
encoding="utf-8"
>





























update="true"
>











id="test.1"
beanName="test"
method="execute"
classpathref="all.path"
beanlocation="test.xml"
beanlocationref="beanconfig.path"
>


refid="test.1"
method="execute1"
>


refid="test.1"
method="execute2"
>














testinputA1
testinputA2


















src:
SpringMethodCallValue.java

package spring_ant;

import org.apache.tools.ant.Task;

public class SpringMethodCallValue extends Task{

String value;
public void addText(String text) {
value = text;
}

}


MethodExecute.java

package spring_ant;

import java.util.*;
import java.lang.reflect.*;
public class MethodExecute {
String name;

List params=new ArrayList();;

public MethodExecute(String name,Object [] params){
this(name,Arrays.asList(params));
}

public MethodExecute(String name,List params){
this(name);
addParams(params);
}
public MethodExecute(String name ){
this.name=name;
}

public void addParam(Object value){
addParams(Arrays.asList(new Object[]{value}));
}
public void addParams(Collection values){

this.params.addAll(values);
}


Method findMethod(Class c) throws Exception{
Class [] mc = new Class[this.params.size()];
for(int i=0;i < this.params.size();i++){
mc[i]=this.params.get(i).getClass();
}

Method [] ms = c.getMethods();
Method m;
Class [] _mc;
boolean _ck=true;
for(int i = 0;i < ms.length;i++){
m = ms[i];
if(!m.getName().equals(name)){
continue;
}
_ck=true;
_mc=m.getParameterTypes();
if(mc.length == _mc.length){
for(int j=0;j < mc.length;j++){
if(!_mc[j].isAssignableFrom(mc[j])){
_ck=false;
break;
}
}
if(_ck){
return m;
}
}
}

throw new NoSuchMethodException(c.getName()+"."+name+"("+Arrays.asList(mc)+") not found");
//return c.getMethod(name, mc);
}


public Object execute(Object obj) throws Exception{
Class c = obj.getClass();
Method m = findMethod(c);
return m.invoke(obj, params.toArray());
}


public String toString(){
return "name="+name+" ,values="+params;
}

}


Spring.java

package spring_ant;


import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.util.ReflectionUtils;

import java.util.*;
import java.io.*;
import java.lang.reflect.*;

import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path;

import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.AntClassLoader;

public class Spring extends Task {
String defaultSpringConfig = "spring-config.xml";
String defaultCall = "execute";

String id;
//Path beanlocation ;
List beanlocation = new ArrayList(Arrays.asList(new String[]{defaultSpringConfig})) ;
Path classpath ;
String bean;
//String method=null;
MethodExecute _method=null;
BeanFactory beanFactory;
Object tobj;

// init
public void init(){
super.init();
classpath =new Path(this.getProject());
}

public void setBeanlocation(String path){
beanlocation.addAll(Arrays.asList(path.split("[,;\n]")));
}

public void setBeanlocationref(String id){
Path _path = new Path(this.getProject());
_path.setRefid(new Reference(this.getProject(),id));
beanlocation.addAll(Arrays.asList(_path.list()));
}

public void setClasspathref(String id){
classpath.setRefid(new Reference(this.getProject(),id));
}

public void setBeanName(String bean){
this.bean=bean;
}
public void setMethod(String methodCall){
this._method=new MethodExecute(methodCall);
}
public void addConfiguredMethod(SpringMethodCall mc){
//mc.maybeConfigure();
//this.log("mc=" + mc);
//this.log("mc.name=" + mc.name);
this._method=new MethodExecute(mc.name,mc.values);
}


public void setId(String id){
this.id = id;
this.getProject().addIdReference(id, this);
}

public void setRefid(String refid){
Spring rf = (Spring)this.getProject().getReference(refid);
if(rf == null){
throw new RuntimeException(" refid["+refid+"] not found");
}
beanlocation = rf.beanlocation ;
classpath =rf.classpath ;
bean=rf.bean;
_method=rf._method;
beanFactory=rf.beanFactory;
tobj=rf.tobj;
}






public void execute(){
//checkBeanloactions
getCheckBeanloactions();
//check attributes
assertCheck();
//load classpath if need
loadClasspath();
//find object and invoke method
invoke();
}

void assertCheck(){
//check bean
//this.log("bean=" + bean);
if(bean == null || "".equals(bean.trim())){
throw new IllegalArgumentException("bean is null or empty");
}

//this.log("method=" + _method);
//this.log("classpath=" + classpath);
//this.log("beanloactions=" + beanlocation);
String [] ckbs = getCheckBeanloactions();
//this.log("ckbs=" + Arrays.asList(ckbs));
if(ckbs.length == 0){
throw new IllegalArgumentException("all beanloactions path not exit :["+beanlocation+"]");
}

}


String [] getCheckBeanloactions(){
List _beanlocation = new ArrayList();
File path;
for( Iterator ite = beanlocation.iterator() ;ite.hasNext(); ){
path =new File((String)ite.next()) ;
if(path.exists()){
_beanlocation.add(path.getAbsolutePath());
}/*else{
this.log("beanloaction["+path+"] is not exist");
}*/
}
String [] rs = new String [_beanlocation.size()];
_beanlocation.toArray(rs);
return rs;
}
void loadClasspath(){
AntClassLoader acl = new AntClassLoader(this.getClass().getClassLoader(), this.getProject(), this.classpath);
acl.setThreadContextLoader();
}
BeanFactory getBeanFactory(){
if(beanFactory == null){
beanFactory = new FileSystemXmlApplicationContext( getCheckBeanloactions());
}
return beanFactory;
}

Object getTargetObj(){
if(tobj == null){
BeanFactory bf = getBeanFactory();
tobj = bf.getBean(this.bean);
}
return tobj;
}

void invoke() {
Object obj = getTargetObj();
if(obj == null){
throw new NullPointerException("bean["+bean+"] not found");
}
// invoke if call not null
if(this._method != null){

//inject BeanFactory
try{
new MethodExecute("setBeanFactory",new Object[]{getBeanFactory()}).execute(obj);
}catch(Exception e){
//donothing
}
//invoke method
try {
this._method.execute(obj);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}






}



SpringClient.java

package spring_ant;

import org.springframework.beans.factory.BeanFactory;

public class SpringClient {
BeanFactory beanFactory;

public BeanFactory getBeanFactory() {
return beanFactory;
}

public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}

}


SpringMethodCall.java

package spring_ant;
import java.util.*;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
public class SpringMethodCall extends Task{
String name;
List values=new ArrayList();

public SpringMethodCall(){
//this.log("SpringMethodCall ");
}

public void setName(String _name){
//this.log("SpringMethodCall setName="+_name);
this.name=_name;
}

public void setValue(String value){
//this.log("SpringMethodCall setValue="+value);
appendStrValue(value);
}

public void addConfiguredValue(SpringMethodCallValue value){
appendStrValue(value.value);
}

void appendStrValue(String v){
String [] vs = v.split("[,;]");
if(vs.length == 1){
values.add(vs[0]);
}else{
values.add(vs);
}
}

public void execute() throws BuildException {
////this.log("SpringMethodCall.execute");
}



}

在 eclipse 中使用 tomcat 設定 jndi

在eclipse 中
設定servier / tomcat 下 的
1.server.xml
2.web.xml

1.server.xml
找到



AAA : 專案名稱
BBB : context root
在此新增JNDI 如下




2.web.xml
在底下新增以下程式碼,
res-ref-name : JNDI 的名稱
res-type : JNDI 的 TYPE




3.JNDI
tomcat : java:comp/env/jdbc/db