package com.spring.aop.helloworld;
public class Main {
public static void main(String[] args) {
ArithmeticCalculcator target = new ArithmeticCalculcatorImpl();
ArithmeticCalculcator proxy = new ArithmeticCalculcatorLoggingProxy(target).getLoggingProxy();
System.out.println(proxy.getClass().getName());
System.out.println(proxy.add(1, 3));
System.out.println(proxy.div(7, 3));
}
}
/*
com.sun.proxy.$Proxy0
The method add beagins with[1, 3]
The method add ends with4
4
The method div beagins with[7, 3]
The method div ends with2
2
*/
ArithmeticCalculcator
package com.spring.aop.helloworld;
public interface ArithmeticCalculcator {
int add(int i,int j);
int sub(int i,int j);
int mul(int i,int j);
int div(int i,int j);
}
ArithmeticCalculcatorImpl
package com.spring.aop.helloworld;
public class ArithmeticCalculcatorImpl implements ArithmeticCalculcator{
@Override
public int add(int i, int j) {
int result = i + j;
return result;
}
@Override
public int sub(int i, int j) {
int result = i - j;
return result;
}
@Override
public int mul(int i, int j) {
int result = i * j;
return result;
}
@Override
public int div(int i, int j) {
int result = i / j;
return result;
}
}
package com.spring.aop.impl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Main {
public static void main(String[] args) {
//1.创建spring IOC 容器
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
//2.从IOC容器中获取bean的实例
ArithmeticCalculcator a = (ArithmeticCalculcator)ac.getBean("arithmeticCalculcatorImpl");
//3.使用bean
int result = a.add(3, 1);
System.out.println(result);
System.out.println(a.div(9, 3));
}
}
/*
validate:[3, 1]
around:The method add begins with [3, 1]
before:The method add begins with[3, 1]
around:The method add ends with4
around: The method add ends
after:The method add ends
afterReturn:The method add ends with4
4
validate:[9, 3]
around:The method div begins with [9, 3]
before:The method div begins with[9, 3]
around:The method div ends with3
around: The method div ends
after:The method div ends
afterReturn:The method div ends with3
3
*/
applicationContext.xml
ArithmeticCalculcator
package com.spring.aop.impl;
public interface ArithmeticCalculcator {
int add(int i,int j);
int sub(int i,int j);
int mul(int i,int j);
int div(int i,int j);
}
ArithmeticCalculcatorImpl
package com.spring.aop.impl;
import org.springframework.stereotype.Component;
@Component
public class ArithmeticCalculcatorImpl implements ArithmeticCalculcator{
@Override
public int add(int i, int j) {
int result = i + j;
return result;
}
@Override
public int sub(int i, int j) {
int result = i - j;
return result;
}
@Override
public int mul(int i, int j) {
int result = i * j;
return result;
}
@Override
public int div(int i, int j) {
int result = i / j;
return result;
}
}
package com.spring.aop.xml;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Main {
public static void main(String[] args) {
//1.创建spring IOC 容器
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext-xml.xml");
//2.从IOC容器中获取bean的实例
ArithmeticCalculcator a = (ArithmeticCalculcator)ac.getBean("arithmeticCalculcatorImpl");
//3.使用bean
int result = a.add(3, 1);
System.out.println(result);
System.out.println(a.div(9, 3));
}
}
/*
validate:[3, 1]
around:The method add begins with [3, 1]
before:The method add begins with[3, 1]
around:The method add ends with4
around: The method add ends
after:The method add ends
afterReturn:The method add ends with4
4
validate:[9, 3]
around:The method div begins with [9, 3]
before:The method div begins with[9, 3]
around:The method div ends with3
around: The method div ends
after:The method div ends
afterReturn:The method div ends with3
3
*/
applicationContext-xml.xml
ArithmeticCalculcator
package com.spring.aop.xml;
public interface ArithmeticCalculcator {
int add(int i,int j);
int sub(int i,int j);
int mul(int i,int j);
int div(int i,int j);
}
ArithmeticCalculcatorImpl
package com.spring.aop.xml;
import org.springframework.stereotype.Component;
public class ArithmeticCalculcatorImpl implements ArithmeticCalculcator{
@Override
public int add(int i, int j) {
int result = i + j;
return result;
}
@Override
public int sub(int i, int j) {
int result = i - j;
return result;
}
@Override
public int mul(int i, int j) {
int result = i * j;
return result;
}
@Override
public int div(int i, int j) {
int result = i / j;
return result;
}
}
返回做IO数目最多的50条语句以及它们的执行计划。
select top 50
(total_logical_reads/execution_count) as avg_logical_reads,
(total_logical_writes/execution_count) as avg_logical_writes,
(tot
The CUDA 5 Release Candidate is now available at http://developer.nvidia.com/<wbr></wbr>cuda/cuda-pre-production. Now applicable to a broader set of algorithms, CUDA 5 has advanced fe
Essential Studio for WinRT界面控件包含了商业平板应用程序开发中所需的所有控件,如市场上运行速度最快的grid 和chart、地图、RDL报表查看器、丰富的文本查看器及图表等等。同时,该控件还包含了一组独特的库,用于从WinRT应用程序中生成Excel、Word以及PDF格式的文件。此文将对其另外一个强大的控件——网格控件进行专门的测评详述。
网格控件功能
1、
Project Euler是个数学问题求解网站,网站设计的很有意思,有很多problem,在未提交正确答案前不能查看problem的overview,也不能查看关于problem的discussion thread,只能看到现在problem已经被多少人解决了,人数越多往往代表问题越容易。
看看problem 1吧:
Add all the natural num
Adding id and class names to CMenu
We use the id and htmlOptions to accomplish this. Watch.
//in your view
$this->widget('zii.widgets.CMenu', array(
'id'=>'myMenu',
'items'=>$this-&g
Given a collection of integers that might contain duplicates, nums, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.
The solution set must not conta