package com.adminkk.annotation;import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;@Target({ElementType.TYPE})@Retention(RetentionPolicy.RUNTIME)public @interface Controller { public String value() default ""; public String description() default "";
}
package com.adminkk.annotation;import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;@Target({ElementType.TYPE,ElementType.METHOD})@Retention(RetentionPolicy.RUNTIME)public @interface RequestMapping { public String value() default ""; public String method() default ""; public String description() default "";
}
package com.adminkk.exception;
public final class MvcException extends RuntimeException{
public MvcException() { super();
}
public MvcException(String message) { super(message);
}
}
package com.adminkk.tools;import javassist.*;import javassist.bytecode.CodeAttribute;import javassist.bytecode.LocalVariableAttribute;import javassist.bytecode.MethodInfo;import java.lang.reflect.Method;
public final class ParameterNameUtils {
public final static String[] getParameterNamesByJavassist(final Class> clazz, final Method method) {
ClassPool pool = ClassPool.getDefault(); try {
CtClass ctClass = pool.get(clazz.getName());
CtMethod ctMethod = ctClass.getDeclaredMethod(method.getName()); // 使用javassist的反射方法的参数名
MethodInfo methodInfo = ctMethod.getMethodInfo();
CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
LocalVariableAttribute attr = (LocalVariableAttribute) codeAttribute
.getAttribute(LocalVariableAttribute.tag); if (attr != null) { String[] rtv = new String[ctMethod.getParameterTypes().length]; int len = ctMethod.getParameterTypes().length; // 非静态的成员函数的第一个参数是this
int pos = Modifier.isStatic(ctMethod.getModifiers()) ? 0 : 1; for (int i = 0; i < len; i++) {
rtv[i] = attr.variableName(i + pos);
} return rtv;
}
} catch (NotFoundException e) {
System.out.println("获取异常"+ e.getMessage());
} return new String[0];
}
}
package com.adminkk.scan;import com.adminkk.exception.MvcException;import com.adminkk.factory.BeanPostProcessor;import com.adminkk.factory.MvcBeanPostProcessor;import com.adminkk.factory.ServiceBeanPostProcessor;import com.adminkk.handler.HandlerMapping;import javassist.ClassClassPath;import javassist.ClassPool;import java.io.File;import java.util.ArrayList;import java.util.List;public final class FileScaner implements Scaner{ public FileScaner() {
} public static final List beanPostProcessorList = new ArrayList<>(); static {
beanPostProcessorList.add(new MvcBeanPostProcessor());
beanPostProcessorList.add(new ServiceBeanPostProcessor());
}
@Override public void doScane(String scanUrl) throws IllegalAccessException, InstantiationException, ClassNotFoundException { if(scanUrl == null || scanUrl.length() == 0){ throw new MvcException("容器基础扫描路径为空,请检查参数配置");
}
String baseUrl = HandlerMapping.class.getResource("/").getPath();
String codeUrl = scanUrl.replaceAll("\\.", "/");
String path = baseUrl + codeUrl; File file = new File(path); if(file == null || !file.exists()){ throw new MvcException("找不到对应扫描路径,请检查参数配置");
}
recursionRedFile(scanUrl,file);
} //递归读取文件
private void recursionRedFile(String scanUrl,File file) throws MvcException, ClassNotFoundException, IllegalAccessException, InstantiationException { if(!file.exists()){ return;
} //读取java文件
if(file.isFile()){
String beanName = scanUrl.replaceAll(".class",""); Class> forName = Class.forName(beanName); //放到Javassist容器里面
ClassPool pool = ClassPool.getDefault();
ClassClassPath classPath = new ClassClassPath(forName);
pool.insertClassPath(classPath); if(forName.isAnnotation() || forName.isEnum() || forName.isInterface() ){ return;
}
Object newInstance = forName.newInstance(); //前置执行
for (int i = 0; i < beanPostProcessorList.size() ; i++) {
BeanPostProcessor beanPostProcessor = beanPostProcessorList.get(i);
beanPostProcessor.postProcessBeforeInitialization(newInstance,beanName);
} //后置执行
for (int i = beanPostProcessorList.size()-1; i > 0 ; i++) {
BeanPostProcessor beanPostProcessor = beanPostProcessorList.get(i);
beanPostProcessor.postProcessAfterInitialization(newInstance,beanName);
} return;
} //文件夹下面的文件都递归处理
if(file.isDirectory()){ File[] files = file.listFiles(); if(files != null && files.length >0){ for (int i = 0; i < files.length; i++) { File targetFile = files[i];
recursionRedFile(scanUrl+"."+targetFile.getName(),targetFile);
}
}
}
}
}
package com.adminkk.scan;public final class XmlScaner implements Scaner{ public XmlScaner() {
} @Override
public void doScane(String scanUrl) { //可自行扩展
}
}
POJ-1273-Drainage Ditches
http://poj.org/problem?id=1273
基本的最大流,按LRJ的白书写的
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
#define INF 0x7fffffff
int ma
开启列模式: Alt+C 鼠标选择 OR Alt+鼠标左键拖动
列模式替换或复制内容(多行):
右键-->格式-->填充所选内容-->选择相应操作
OR
Ctrl+Shift+V(复制多行数据,必须行数一致)
-------------------------------------------------------
About Health Monitor
Beginning with Release 11g, Oracle Database includes a framework called Health Monitor for running diagnostic checks on the database.
About Health Monitor Checks
Health M
实现功能的代码:
# include <stdio.h>
# include <malloc.h>
struct Student
{
int age;
float score;
char name[100];
};
int main(void)
{
int len;
struct Student * pArr;
int i,
http://wiki.sdn.sap.com/wiki/display/BOBJ/Troubleshooting+Crystal+Reports+off+BW#TroubleshootingCrystalReportsoffBW-TracingBOE
Quite useful, especially this part:
SAP BW connectivity
For t