create table Student --学生成绩表
(
id int, --主键
Grade int, --班级
Score int --分数
)
go
insert into Student values(1,1,88)
insert into Student values(2,1,66)
insert into Student values(3,1,75)
insert into Student values(4,2,30)
insert into Student values(5,2,70)
insert into Student values(6,2,80)
insert into Student values(7,2,60)
insert into Student values(8,3,90)
insert into Student values(9,3,70)
insert into Student values(10,3,80)
insert into Student values(11,3,80)
一、分区函数Partition By的与row_number()的用法
1、不分班按学生成绩排名
select *,row_number() over(order by Score desc) as Sequence from Student
执行结果:
2、分班后按学生成绩排名
select *,row_number() over(partition by Grade order by Score desc) as Sequence from Student
执行结果:
3、获取每个班的前1(几)名
select * from
(
select *,row_number() over(partition by Grade order by Score desc) as Sequence from Student
)T where T.Sequence<=1
/**
* Start an image request using the specified path. This is a convenience method for calling
* {@link #load(Uri)}.
* <p>
* This path may be a remote URL, file resource (prefixed with {@code file:}), content resource
* (prefixed with {@code content:}), or android resource (prefixed with {@code
* android.resource:}.
* <p>
* Passing {@code null} as a {@code path} will not trigger any request but will set a
* placeholder, if one is specified.
*
* @see #load(Uri)
* @see #load(File)
* @see #load(int)
* @throws IllegalArgumentException if {@code path} is empty or blank string.
*/publicRequestCreatorload(String path){if(path ==null){returnnewRequestCreator(this,null,0);}if(path.trim().length()==0){thrownewIllegalArgumentException("Path must not be empty.");}returnload(Uri.parse(path));}
Transformation 这就是Picasso的一个非常强大的功能了,它允许你在load图片 -> into ImageView 中间这个过成对图片做一系列的变换。比如你要做图片高斯模糊、添加圆角、做度灰处理、圆形图片等等都可以通过Transformation来完成。
来看一个高斯模糊的例子:
1,首先定义一个转换器继承 Transformation
publicstaticclassBlurTransformationimplementsTransformation{RenderScript rs;publicBlurTransformation(Context context){super();
rs =RenderScript.create(context);}@OverridepublicBitmaptransform(Bitmap bitmap){// Create another bitmap that will hold the results of the filter.Bitmap blurredBitmap = bitmap.copy(Bitmap.Config.ARGB_8888,true);// Allocate memory for Renderscript to work withAllocation input =Allocation.createFromBitmap(rs, blurredBitmap,Allocation.MipmapControl.MIPMAP_FULL,Allocation.USAGE_SHARED);Allocation output =Allocation.createTyped(rs, input.getType());// Load up an instance of the specific script that we want to use.ScriptIntrinsicBlur script =ScriptIntrinsicBlur.create(rs,Element.U8_4(rs));
script.setInput(input);// Set the blur radius
script.setRadius(25);// Start the ScriptIntrinisicBlur
script.forEach(output);// Copy the output to the blurred bitmap
output.copyTo(blurredBitmap);
bitmap.recycle();return blurredBitmap;}@OverridepublicStringkey(){return"blur";}}
LRU memory cache of 15% the available application RAM
Disk cache of 2% storage space up to 50MB but no less than 5MB. (Note: this is only
available on API 14+ <em>or</em> if you are using a standalone library that provides a disk cache on all API levels like OkHttp)
Three download threads for disk and network access.
/** Describes where the image was loaded from. */publicenumLoadedFrom{MEMORY(Color.GREEN),DISK(Color.BLUE),NETWORK(Color.RED);finalint debugColor;privateLoadedFrom(int debugColor){this.debugColor = debugColor;}}
/**
* Created by zhouwei on 17/2/26.
*/publicclassCustomDownloaderimplementsDownloader{@OverridepublicResponseload(Uri uri,int networkPolicy)throwsIOException{returnnull;}@Overridepublicvoidshutdown(){}}
/**
* Set the global instance returned from {@link #with}.
* <p>
* This method must be called before any calls to {@link #with} and may only be called once.
*/publicstaticvoidsetSingletonInstance(Picasso picasso){synchronized(Picasso.class){if(singleton !=null){thrownewIllegalStateException("Singleton instance already exists.");}
singleton = picasso;}}
--config value TOML 配置文件
--datadir “xxx” 数据库和keystore密钥的数据目录
--keystore keystore存放目录(默认在datadir内)
--nousb 禁用监控和管理USB硬件钱包
--networkid value 网络标识符(整型, 1=Frontier, 2=Morden (弃用), 3=Ropsten, 4=Rinkeby) (默认: 1)
--testnet Ropsten网络:预先配置的POW(proof-of-work)测试网络
--rinkeby Rinkeby网络: 预先配置的POA(proof-of-authority)测试网络
--syncmode "fast" 同步模式 ("fast", "full", or "light")
--ethstats value 上报ethstats service URL (nodename:secret@host:port)
--identity value 自定义节点名
--lightserv value 允许LES请求时间最大百分比(0 – 90)(默认值:0)
--lightpeers value 最大LES client peers数量(默认值:20)
--lightkdf 在KDF强度消费时降低key-derivation RAM&CPU使用
开发者(模式)选项:
--dev 使用POA共识网络,默认预分配一个开发者账户并且会自动开启挖矿。
--dev.period value 开发者模式下挖矿周期 (0 = 仅在交易时) (默认: 0)
ETHASH 选项:
--ethash.cachedir ethash验证缓存目录(默认 = datadir目录内)
--ethash.cachesinmem value 在内存保存的最近的ethash缓存个数 (每个缓存16MB ) (默认: 2)
--ethash.cachesondisk value 在磁盘保存的最近的ethash缓存个数 (每个缓存16MB) (默认: 3)
--ethash.dagdir "" 存ethash DAGs目录 (默认 = 用户hom目录)
--ethash.dagsinmem value 在内存保存的最近的ethash DAGs 个数 (每个1GB以上) (默认: 1)
--ethash.dagsondisk value 在磁盘保存的最近的ethash DAGs 个数 (每个1GB以上) (默认: 2)
交易池选项:
--txpool.nolocals 为本地提交交易禁用价格豁免
--txpool.journal value 本地交易的磁盘日志:用于节点重启 (默认: "transactions.rlp")
--txpool.rejournal value 重新生成本地交易日志的时间间隔 (默认: 1小时)
--txpool.pricelimit value 加入交易池的最小的gas价格限制(默认: 1)
--txpool.pricebump value 价格波动百分比(相对之前已有交易) (默认: 10)
--txpool.accountslots value 每个帐户保证可执行的最少交易槽数量 (默认: 16)
--txpool.globalslots value 所有帐户可执行的最大交易槽数量 (默认: 4096)
--txpool.accountqueue value 每个帐户允许的最多非可执行交易槽数量 (默认: 64)
--txpool.globalqueue value 所有帐户非可执行交易最大槽数量 (默认: 1024)
--txpool.lifetime value 非可执行交易最大入队时间(默认: 3小时)
性能调优的选项:
--cache value 分配给内部缓存的内存MB数量,缓存值(最低16 mb /数据库强制要求)(默认:128)
--trie-cache-gens value 保持在内存中产生的trie node数量(默认:120)
帐户选项:
--unlock value 需解锁账户用逗号分隔
--password value 用于非交互式密码输入的密码文件
API和控制台选项:
--rpc 启用HTTP-RPC服务器
--rpcaddr value HTTP-RPC服务器接口地址(默认值:“localhost”)
--rpcport value HTTP-RPC服务器监听端口(默认值:8545)
--rpcapi value 基于HTTP-RPC接口提供的API
--ws 启用WS-RPC服务器
--wsaddr value WS-RPC服务器监听接口地址(默认值:“localhost”)
--wsport value WS-RPC服务器监听端口(默认值:8546)
--wsapi value 基于WS-RPC的接口提供的API
--wsorigins value websockets请求允许的源
--ipcdisable 禁用IPC-RPC服务器
--ipcpath 包含在datadir里的IPC socket/pipe文件名(转义过的显式路径)
--rpccorsdomain value 允许跨域请求的域名列表(逗号分隔)(浏览器强制)
--jspath loadScript JavaScript加载脚本的根路径(默认值:“.”)
--exec value 执行JavaScript语句(只能结合console/attach使用)
--preload value 预加载到控制台的JavaScript文件列表(逗号分隔)
网络选项:
--bootnodes value 用于P2P发现引导的enode urls(逗号分隔)(对于light servers用v4+v5代替)
--bootnodesv4 value 用于P2P v4发现引导的enode urls(逗号分隔) (light server, 全节点)
--bootnodesv5 value 用于P2P v5发现引导的enode urls(逗号分隔) (light server, 轻节点)
--port value 网卡监听端口(默认值:30303)
--maxpeers value 最大的网络节点数量(如果设置为0,网络将被禁用)(默认值:25)
--maxpendpeers value 最大尝试连接的数量(如果设置为0,则将使用默认值)(默认值:0)
--nat value NAT端口映射机制 (any|none|upnp|pmp|extip:<IP>) (默认: “any”)
--nodiscover 禁用节点发现机制(手动添加节点)
--v5disc 启用实验性的RLPx V5(Topic发现)机制
--nodekey value P2P节点密钥文件
--nodekeyhex value 十六进制的P2P节点密钥(用于测试)
矿工选项:
--mine 打开挖矿
--minerthreads value 挖矿使用的CPU线程数量(默认值:8)
--etherbase value 挖矿奖励地址(默认=第一个创建的帐户)(默认值:“0”)
--targetgaslimit value 目标gas限制:设置最低gas限制(低于这个不会被挖?) (默认值:“4712388”)
--gasprice value 挖矿接受交易的最低gas价格
--extradata value 矿工设置的额外块数据(默认=client version)
GAS价格选项:
--gpoblocks value 用于检查gas价格的最近块的个数 (默认: 10)
--gpopercentile value 建议gas价参考最近交易的gas价的百分位数,(默认: 50)
虚拟机的选项:
--vmdebug 记录VM及合约调试信息
日志和调试选项:
--metrics 启用metrics收集和报告
--fakepow 禁用proof-of-work验证
--verbosity value 日志详细度:0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3)
--vmodule value 每个模块详细度:以 <pattern>=<level>的逗号分隔列表 (比如 eth/*=6,p2p=5)
--backtrace value 请求特定日志记录堆栈跟踪 (比如 “block.go:271”)
--debug 突出显示调用位置日志(文件名及行号)
--pprof 启用pprof HTTP服务器
--pprofaddr value pprof HTTP服务器监听接口(默认值:127.0.0.1)
--pprofport value pprof HTTP服务器监听端口(默认值:6060)
--memprofilerate value 按指定频率打开memory profiling (默认:524288)
--blockprofilerate value 按指定频率打开block profiling (默认值:0)
--cpuprofile value 将CPU profile写入指定文件
--trace value 将execution trace写入指定文件
WHISPER实验选项:
--shh 启用Whisper
--shh.maxmessagesize value 可接受的最大的消息大小 (默认值: 1048576)
--shh.pow value 可接受的最小的POW (默认值: 0.2)
1、@Transactional 只能被应用到public方法上, 对于其它非public的方法,如果标记了@Transactional也不会报错,但方法没有事务功能. 2、用 spring 事务管理器,由spring来负责数据库的打开,提交,回滚.默认遇到运行期例外(throw new RuntimeException(“注释”);)会回滚,即遇到不受检查(unchecked)的例外时回滚;而遇到需要捕获的例外(throw new Exception(“注释”);)不会回滚,即遇到受检查的例外(就是非运行时抛出的异常,编译器会检查到的异常叫受检查例外或说受检查异常)时,需我们指定方式来让事务回滚要想所有异常都回滚,要加上 @Transactional( rollbackFor={Exception.class,其它异常}) .如果让unchecked例外不回滚: @Transactional(notRollbackFor=RunTimeException.class) 如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><title></title><metahttp-equiv="Content-Type"content="text/html; charset=utf-8" /></head><body><divclass="comment"><h6>张三:</h6><pclass="para">沙发.</p></div><divclass="comment"><h6>李四:</h6><pclass="para">板凳.</p></div><divclass="comment"><h6>王五:</h6><pclass="para">地板.</p></div></body></html>
① 当一个数据包进入网卡时,它首先进入PREROUTING链,内核根据数据包目的IP判断是否需要转送出去。
② 如果数据包就是进入本机的,它就会沿着图向下移动,到达INPUT链。数据包到了INPUT链后,任何进程都会收到它。本机上运行的程序可以发送数据包,这些数据包会经过OUTPUT链,然后到达POSTROUTING链输出。
③ 如果数据包是要转发出去的,且内核允许转发,数据包就会如图所示向右移动,经过FORWARD链,然后到达POSTROUTING链输出。
从上面的算法流程可以看出,a === b 是最简单的。如果 a 和 b 的类型不同,那么一定会返回 false。而 a == b 则要灵活得多。JavaScript 会尝试调整 a 和 b 的类型,例如若 a 为字符串 b 为数字,则将字符串先转化为数字再与 b 比较,等等。这在很多时候简化了程序员的代码量。
例:作为传送消 息的机制之一,UNIX提供了一个向其所有用户传送消息的命令wall(意思是write to all写给所有用户),该命令允许向所有工作中的用户(终端)发送消息。为此,我们可以通过一段shell批处理程序wall.shell来模拟这一程序 (事实上比较老的版本中wall就是一段shell批处理程序:
$cat wall.shell : # @(#) wall.shell:发送消息给每个已注册终端 # cat >/tmp/$$ #用户录入消息文本 who -u | awk ‘{print $2}’ | while read tty do cat /tmp/$$>$tty done