test

spring源码学习之AOP(一)

谁说胖子不能爱 提交于 2020-03-07 08:20:18
  继续源码学习,看了spring中基础的容器和AOP感觉自己也没有什么长进,哈哈,我也不知道到底有用没有,这可能是培养自己的一种精神吧,不管那么多,继续学习!AOP中 AOP中几个重要的概念: (1)Advice--通知 Advice定义在连接点做什么,为切面增强提供织入接口。在spring中,他主要描述spring AOP围绕方法调用而注入的切面行为。在spring AOP的实现中,使用了AOP联盟定义的统一接口--Advice接口并通过这个接口,为AOP切面的增强的织入功能做了更多的细话和扩展 (2)PonitCut--切点 PonitCut(切点)决定Advice通知应该作用于哪个连接点,也就是说通过PonitCut来定义需要增强的方法的集合。这些集合的选取可以按照一定的规则来完成。这种情况下,PonitCut通常意味着标识方法,例如,这些需要增强的地方可以由某个正则表达式进行标识,或根据某个方法名进行匹配 (3)Advisor--通知器 完成对目标方法的切面增强设计(Advice)和关注点的设计(PointCut)以后,需要一个对象把它们结合起来,完成这个作用的就是Advisor,通过Advisor,可以定义在应该使用哪个通知并在哪个关注点使用它,也就是说通过Advisor,把Advice和PointCut结合起来,这个结合为使用IoC容器配置AOP应用

python yield用法举例说明

為{幸葍}努か 提交于 2020-03-07 07:24:34
1 yield基本用法 典型的例子 :   斐波那契(Fibonacci)數列是一个非常简单的递归数列,除第一个和第二个数外,任意一个数都可由前两个数相加得到。1 2 3 5 8…… def fab(max): n, a, b = 0, 0, 1 while n < max: yield b # print b a, b = b, a + b n = n + 1   yield 的作用就是把一个函数变成一个generator,带有 yield 的函数不再是一个普通函数,Python 解释器会将其视为一个生成器,如调用fab函数, 不会执行该函数,而是返回一个iterable迭代对象!   在for循环执行时,每次循环都会相当于执行生成器的next函数,才开始执行fab函数的内部代码,执行到yield b时,fab函数就返回一个迭代值,然后挂起。   下次迭代时,代码从yield b的下一条语句继续执行,而函数的本地变量看起来和上次中断执行前是完全一样的,于是函数继续执行,直到再次遇到yield。 更多 yield 例子: #!/usr/bin/python def a(): print ("do a() will not print out") yield 5 a() print ("===============test a()") def b(): print ("list

LLDB调试器的使用

倾然丶 夕夏残阳落幕 提交于 2020-03-07 07:22:35
随着Xcode 5的发布,LLDB调试器已经取代了GDB,成为了Xcode工程中默认的调试器。它与LLVM编译器一起,带给我们更丰富的流程控制和数据检测的调试功 能。LLDB为Xcode提供了底层调试环境,其中包括内嵌在Xcode IDE中的位于调试区域的控制面板,在这里我们可以直接调用LLDB命令。如图1所示: 图1:位于Xcode调试区域的控制台 在本文中,我们主要整理一下LLDB调试器提供给我们的调试命令,更详细的内容可以查看 The LLDB Debugger 。 LLDB命令结构 在使用LLDB前,我们需要了解一下LLDB的命令结构及语法,这样可以尽可能地挖掘LLDB的潜能,以帮助我们更充分地利用它。 LLDB命令的语法有其通用结构,通常是以下形式的: 1 <command> [<subcommand> [<subcommand>...]] <action> [-options [option-value]] [argument [argument...]]</action></subcommand></subcommand></command> 其中: (命令)和(子命令):LLDB调试命令的名称。命令和子命令按层级结构来排列:一个命令对象为跟随其的子命令对象创建一个上下文,子命令又为其子命令创建一个上下文,依此类推。 :我们想在前面的命令序列的上下文中执行的一些操作。

Codeforces Round #419 (Div. 2)

烂漫一生 提交于 2020-03-07 07:17:16
Codeforces Round #419 (Div. 2) http://codeforces.com/contest/816/problem/A A. Karen and Morning time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Karen is getting ready for a new school day! It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome? Remember that a palindrome is a string that reads the same forwards

c/c++ 函数指针的用法

戏子无情 提交于 2020-03-07 07:02:16
【目录】 基本定义 c 函数指针使用举例 c++ 函数指针使用举例 函数指针作为函数参数 函数指针作为函数返回值 函数指针数组 typedef 简化函数指针操作 c语言函数指针的定义形式: 返回类型 (* 函数指针名称 )( 参数类型 , 参数类型 , 参数类型, …); c++函数指针的定义形式 : 返回类型 (类名称 ::* 函数成员名称)(参数类型,参数类型,参数类型, ….); 以下代码编译环境:codeblocks with gcc in win 7 c语言函数指针使用举例: #include <stdio.h> #include <stdlib.h> int fun1() { printf("this is fun1 call\n"); return 1; } void fun2(int k, char c) { printf("this is fun2 call:%d %c\n", k, c); } int main() { int (*pfun1)() = NULL; void (*pfun2)(int, char) = NULL; int a,b; pfun1 = fun1; //第一种赋值方法 a = pfun1(); //第一种调用方法(推荐) printf("%d\n",a); b = (*pfun1)();//第二种调用方法 printf("%d\n",b

笔试题

故事扮演 提交于 2020-03-07 06:56:37
选择题(1分/题) 1.我们想要将表格中的文字放在靠上居中的位置,应该怎么办? A) align="middle" align="top" B) align="center" align="top" C) valign="middle" align="top" D) valign="top" align="center" 2.下列哪种CSS样式定义的方式拥有最高的优先级? A) 嵌入 B) 行内 C) 链接 D) 导入 3.以下( )表达式产生一个0~7之间(含0,7)的随机整数. A. Math.floor(Math.random()*6) B. Math.floor(Math.random()*7) C. Math. floor(Math.random()*8) D. Math.ceil(Math.random()*8) 4.下列JavaScript表达式当中,错误的是() A.var tempA, tempB, tempC B.tempA *= 3 C.tempA >= tempB || tempA <= tempC D.tempA >= tempB > tempC 5.关于变量的命名规则,下列说法正确的是。 字母,数字,_,$。不能关键字或者保留字,不能是数字开头 A)首字符必须是大写,小写的字母,下划线(_)或美元符($)。 B)后续的字符可以是字母,数字,下划线或美元符

线性回归两种求解方式总结

浪子不回头ぞ 提交于 2020-03-07 06:46:48
线性回归两种求解方式总结 使用梯度下降进行预测 from sklearn . datasets import load_boston # 波士顿房价数据集使用API from sklearn . linear_model import LinearRegression , SGDRegressor ##回归预测时使用的API from sklearn . model_selection import train_test_split from sklearn . preprocessing import StandardScaler ## 标准化API def myLinear ( ) : """线性回归直接预测房子价格""" # 获取数据 lb = load_boston ( ) # 分割数据集 x_train , x_text , y_train , y_text = train_test_split ( lb . data , lb . target , test_size = 0.25 ) # 进行标准化处理 std_x = StandardScaler ( ) x_train = std_x . fit_transform ( x_train ) x_text = std_x . transform ( ( x_text ) ) #目标值 std_y =

使用.net备份和还原数据库

江枫思渺然 提交于 2020-03-07 06:36:34
CSDN网友的提问http://community.csdn.net/Expert/TopicView3.asp?id=4929678 C#实现SQLSERVER2000数据库备份还原的两种方法 : 方法一(不使用SQLDMO): /// ///备份方法 /// SqlConnection conn = new SqlConnection("Server=.;Database=master;User ID=sa;Password=sa;"); SqlCommand cmdBK = new SqlCommand(); cmdBK.CommandType = CommandType.Text; cmdBK.Connection = conn; cmdBK.CommandText = @"backup database test to disk='C:\ba' with init"; try { conn.Open(); cmdBK.ExecuteNonQuery(); MessageBox.Show("Backup successed."); } catch(Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); conn.Dispose(); } /// ///还原方法 ///

ORACLE 导入导出

ぃ、小莉子 提交于 2020-03-07 06:22:51
数据导出: 1 将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中 exp system/manager@TEST file=d:\daochu.dmp full=y 2 将数据库中system用户与sys用户的表导出 exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys) 3 将数据库中的表table1 、table2导出 exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2) 4 将数据库中的表table1中的字段filed1以"00"打头的数据导出 exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\" 上面是常用的导出,对于压缩我不太在意,用winzip把dmp文件可以很好的压缩。 不过在上面命令后面 加上 compress=y 就可以了 数据的导入 1 将D:\daochu.dmp 中的数据导入 TEST数据库中。 imp system/manager@TEST file=d:\daochu.dmp 上面可能有点问题,因为有的表已经存在,然后它就报错

oracle 导入导出

大城市里の小女人 提交于 2020-03-07 06:21:41
数据导出: 1 将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中 exp system/manager@TEST file=d:\daochu.dmp full=y 2 将数据库中system用户与sys用户的表导出 exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys) 3 将数据库中的表table1 、table2导出 exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2) 4 将数据库中的表table1中的字段filed1以"00"打头的数据导出 exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\" 上面是常用的导出,对于压缩我不太在意,用winzip把dmp文件可以很好的压缩。 不过在上面命令后面 加上 compress=y 就可以了 数据的导入 1 将D:\daochu.dmp 中的数据导入 TEST数据库中。 imp system/manager@TEST file=d:\daochu.dmp 上面可能有点问题,因为有的表已经存在,然后它就报错