2016/6/23

一、断言

在调试代码时非常有用,一般用在程序不准备通过捕获异常来处理可能发生的错误。
语法格式:
1.assert booleanExpression;
2.assert booleanExpression:messageException;
例如:
assert number > 0;
如果表达式number > 0的值为ture,程序继续执行,否则立即结束。
assert booleanExpression:messageException;
如果表达式number > o为true,程序继续执行,为false时,输出messageException的值,提示用户出现怎样错误。

二、finally字语句的try-catch语句

语法格式:
try{ }
catch(ExceptionSubClass1 e){ }
finally{ }
是否发生异常finally都执行
两种特殊情况
1.在try-catch中执行了return,finally依然执行。
2.执行程序退出码(System.exit(0)),则不执行finally。(其后所有语句也不执行

三、简写

int a,b;
a += b;    //a = a + b;的简写
a  -= b;    //a = a -  b;的简写  


求11月9号下午14点(14-15点),访问api/user/login接口的top10的ip地址 据集 2016-11-09 14:22:05 /api/user/login 110.23.5.33 2016-11-09 11:23:10 /api/user/detail 57.3.2.16 2016-11-09 14:59:40 /api/user/login 200.6.5.166 2016-11-09 14:22:05 /api/user/login 110.23.5.34 2016-11-09 14:22:05 /api/user/login 110.23.5.34 2016-11-09 14:22:05 /api/user/login 110.23.5.34 2016-11-09 11:23:10 /api/user/detail 57.3.2.16 2016-11-09 23:59:40 /api/user/login 200.6.5.166 2016-11-09 14:22:05 /api/user/login 110.23.5.34 2016-11-09 11:23:10 /api/user/detail 57.3.2.16 2016-11-09 23:59:40 /api/user/login 200.6.5.166 2016-11-09 14:22:05 /api/user/login 110.23.5.35 2016-11-09 14:23:10 /api/user/detail 57.3.2.16 2016-11-09 23:59:40 /api/user/login 200.6.5.166 2016-11-09 14:59:40 /api/user/login 200.6.5.166 2016-11-09 14:59:40 /api/user/login 200.6.5.166 1)建表 create table ip( time string, interface string, ip string) row format delimited fields terminated by '\t'; Select interface ,ip ,rn From (Select interface ,ip ,row_number()over(partition by interface order by cnt desc ) rn from (Select interface ,ip ,count(*) cnt From ip where date_format(time,'yyyy-MM-dd HH')>='2016-11-09 14' and date_format(time,'yyyy-MM-dd HH')<='2016-11-09 15' and interface =’api/user/login’ Group by interface ,ip)t)t2 Where rn <=10; 2)最终SQL select ip, interface, count(*) ct from ip where date_format(time,'yyyy-MM-dd HH')>='2016-11-09 14' and date_format(time,'yyyy-MM-dd HH')<='2016-11-09 15' and interface='/api/user/login' group by ip,interface order by ct desc limit 2;t1最后的limit是什么意思
11-19
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值