namespace

SpringBoot中MyBatis的基本使用

喜夏-厌秋 提交于 2020-02-08 18:40:40
在项目的src/main/resources下新建mappers文件夹,并将UserMapper.xml复制到这个文件夹下! 这个UserMapper.xml就是用于配置SQL语句的文件! 这种配置SQL语句的XML文件的根节点是,需要在根节点配置namespace属性,取值为之对应的接口的全名: <mapper namespace="cn.tedu.mybatis.UserMapper"> </mapper> 接下来,根据需要执行的SQL语句的种类,从、、、中选择对应的子节点,节点的id属性就是对应的抽象方法的名称,然后在节点内部配置SQL语句: <mapper namespace="cn.tedu.mybatis.UserMapper"> <insert id="addnew"> INSERT INTO t_user ( username, password, age, phone, email ) VALUES ( #{username}, #{password}, #{age}, #{phone}, #{email} ) </insert> </mapper> 注意:如果配置的是节点,必须在该节点配置resultType或resultMap属性! 插入数据时获取自增的id 在配置时,添加配置useGeneratedKeys="true"和keyProperty="属性名

图像混合

风流意气都作罢 提交于 2020-02-08 17:09:12
图像混合:+ #include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace std; int main(int argc, char** argv) { Mat src1, src2, dst; src1 = imread("E:/opencv/0/0.jpg"); src2 = imread("E:/opencv/0/2.jpg"); if (!src1.data) { printf("could not load image1...\n"); return -1; } if (!src2.data) { printf("could not load image2...\n"); return -1; } double alpha = 0.3; if (src1.rows == src2.rows && src1.cols == src2.cols && src1.type() == src2.type()) { addWeighted(src1, alpha, src2, (1.0 - alpha), 0.0, dst); imshow("onput image", dst); } else { printf("could not blend image ,the

2020牛客寒假算法基础集训营2

一曲冷凌霜 提交于 2020-02-08 06:26:15
G.判正误: 牛可乐有七个整数 a , b , c , d , e , f , g a,b,c,d,e,f,g a , b , c , d , e , f , g ,并且他猜想 a d + b e + c f = g a^d+b^e+c^f=g a d + b e + c f = g 。但 牛可乐无法进行如此庞大的计算。 请验证:牛可乐的猜想是否成立。 输入: 第一行一个正整数 T T T ,表示有 T T T 组数据。 每组数据输入一行七个整数 a , b , c , d , e , f , g a,b,c,d,e,f,g a , b , c , d , e , f , g 。 保证 1 ≤ 1\leq 1 ≤ T T T ≤ 1000 \leq1000 ≤ 1 0 0 0 , , , − 1 0 9 -10^9 − 1 0 9 ≤ \leq ≤ a , b , c , g a,b,c,g a , b , c , g ≤ \leq ≤ 1 0 9 10^9 1 0 9 , 0 ,0 , 0 ≤ \leq ≤ d , e , f d,e,f d , e , f ≤ \leq ≤ 1 0 9 10^9 1 0 9 ,保证不会出现指数和底数同为 0 的情况。 输出: 每组数据输出一行,若猜想成立,输出 Y e s Yes Y e s ,否则输出 N o No N o 。 题解:  

namespace

青春壹個敷衍的年華 提交于 2020-02-07 06:01:38
# include <iostream> # include <cstring> using namespace std ; namespace space1 { int sp1_a = 10 ; } namespace space2 { int sp2_a = 20 ; namespace space3 { struct person { int id ; char name [ 10 ] ; } ; } } int main ( ) { using namespace space1 ; cout << sp1_a << endl ; using namespace space2 :: space3 ; struct person p = { 1 , "nihaomaz" } ; cout << "id: " << p . id << " name: " << p . name << endl ; char data [ 10 ] ; std :: strcpy ( data , p . name ) ; cout << "data: " << data << endl ; system ( "pause" ) ; return 0 ; } 来源: CSDN 作者: 从前,有个傻子........ 链接: https://blog.csdn.net/weixin_41377572

学习Apollo服务配置中心,与SpringBoot整合

こ雲淡風輕ζ 提交于 2020-02-06 16:24:54
学习Apollo服务配置中心,与SpringBoot整合 通过spring-boot搭建的业务系统,可以通过Apollo提供远程的配置服务,以达到集群环境统一使用一套动态配置的目的。 1.关于NameSpace https://github.com/ctripcorp/apollo/wiki/Apollo%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5%E4%B9%8B%E2%80%9CNamespace%E2%80%9D 1.1 namespace的使用场景 提供一份全公司默认的配置且可动态调整 RPC客户端项目可以自定义某些配置项且可动态调整 1.2 apollo的注解在java中配置 @EnableApolloConfig要和@Configuration一起使用。 想把日志配置也放阿波罗里,那么要把阿波罗的加载顺序提前,但是如此一来,阿波罗的启动就没日志了。 2. 注解 1.@ApolloConfig 自动注入Apollo对象 2.@ApolloConfigChangeListener 自动注册ConfigChangeListener事件 3.@ApolloJsonValue 转换配置的json字符串 3. 使用实践 3.1 单元测试 1.单元测试的时候用的是mockdata+{namespace}.properties 2

A Little Contest

痴心易碎 提交于 2020-02-06 01:52:59
(https://ac.nowcoder.com/acm/contest/3002/G) 我的思想:1,给出两个标记点first,last然后依次移动并将移动到位置的字母总数减一并维护ans。但是感觉不太好写就扔掉了。 2.暴力查找,结果超时了而且我太菜了想不出新方法了(困。。。) 结果一直交一直t,然后就放弃了。 代码如下: # include <bits/stdc++.h> using namespace std ; const int MAX = 99999999 ; char s [ 200010 ] ; int main ( ) { int n , m ; int sum ; int ans = MAX ; scanf ( "%d%d" , & n , & m ) ; scanf ( "%s" , s ) ; for ( int i = 0 ; i < n ; ++ i ) { sum = 0 ; for ( int j = i ; j < n ; ++ j ) { if ( s [ i ] == s [ j ] ) { sum ++ ; } if ( sum == m ) { ans = min ( ans , j - i + 1 ) ; break ; } } } printf ( "%d\n" , ans == MAX ? - 1 : ans ) ; }

C#常见的应用程序类型

烈酒焚心 提交于 2020-02-04 19:08:21
C#常见的应用程序类型 控制台应用程序 Windows应用程序(WPF程序) Web应用程序(Mobile应用程序) 注: Web应用程序(网上) Mobile应用程序(手机上) 一、.控制台应用程序 (运行快捷键Ctrl+F5) using 名称空间 例: using System 使用System名称空间,以便编程的简写,方便书写。 如: System.Console.Writeline("Hello Singto"); 如果将引用using System;时, 可以简写为: Console.Writeline("Hello Singto"); namespace 名称空间 例: namespace contoral 目的:使该空间(contoral)中的类和其他空间中的类不重名。 如: System.Threading.task; 程序中的Main()函数: static void Main(String[] args) 注: 类定义: calss 类名 例: class dog{ } 程序中的重要组成部分是类(class),所有的内容都要放进类(class)里面. Main()方法: 程序入口是Main()方法。它有固定的书写格式。 public static void Main(string[] args) 可以没有publi,可以没有string[] args Main

接口函数绑定错误

两盒软妹~` 提交于 2020-02-02 17:55:21
接口函数绑定错误 问题描述 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.imooc.o2o.dao.PersonInfoDao.getPersonInfoById 错误提示说MyBatis绑定错误或者没有找到被绑定的函数。 dao层的接口函数: /** * 通过用户ID取得用户信息 * * @param id 用户ID * @return 用户信息对象 */ PersonInfo getPersonInfoById ( long id ) ; MyBatis映射配置文件: <mapper namespace=“com.imooc.o2o.entity.PersonInfo"> < select id = " getPersonInfoById " resultType = " PersonInfo " > select * from person_info where person_id = #{id} </ select > </ mapper > 以上两部分代码都非常简单,为什么会出现绑定错误的问题呢? 问题解决 把映射配置文件的 namespace 属性值改为 com.imooc.o2o.dao.PersonInfoDao 就没有问题了。 这是什么原理

CF6

半腔热情 提交于 2020-02-01 22:36:44
A A 不解释 #include<bits/stdc++.h> using namespace std; namespace red{ inline int read() { int x=0;char ch,f=1; for(ch=getchar();(ch<'0'||ch>'9')&&ch!='-';ch=getchar()); if(ch=='-') f=0,ch=getchar(); while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();} return f?x:-x; } int a[5]; inline bool check(int id) { return (a[id]+a[id+1]>a[id+2]&&a[id+2]-a[id+1]<a[id]); } inline bool check2(int id) { return (a[id]+a[id+1]>=a[id+2]); } inline void main() { for(int i=1;i<=4;++i) a[i]=read(); sort(a+1,a+4+1); if(check(1)||check(2)) puts("TRIANGLE"); else if(check2(1)||check2(2)) puts("SEGMENT"); else

K8s Deployment YAML 名词解释

本秂侑毒 提交于 2020-02-01 09:06:29
Deployment 简述 Deployment 为 Pod 和 ReplicaSet 提供了一个声明式定义 (declarative) 方法,用来替代以前的 ReplicationController 更方便的管理应用。 作为最常用的 Kubernetes 对象, Deployment 经常会用来创建 ReplicaSet 和 Pod ,我们往往不会直接在集群中使用 ReplicaSet 部署一个新的微服务,一方面是因为 ReplicaSet 的功能其实不够强大,一些常见的更新、扩容和缩容运维操作都不支持, Deployment 的引入就是为了支持这些复杂的操作。 Deployment API 版本对照表 Kubernetes 版本 Deployment 版本 v1.5-v1.15 extensions/v1beta1 v1.7-v1.15 apps/v1beta1 v1.8-v1.15 apps/v1beta2 v1.9 apps/v1 Deployment 一个典型的用例 一个典型的用例如下: 使用 Deployment 来创建 ReplicaSet。ReplicaSet 在后台创建 pod。检查启动状态,看它是成功还是失败。 然后,通过更新 Deployment 的 PodTemplateSpec 字段来声明 Pod 的新状态。这会创建一个新的 ReplicaSet