分类 技术相关 下的文章

sqlserver百分比运算

select ltrim(Convert(numeric(9,2),25*100.0/30))+'%' As 百分比
- 得到百分比小数
select Cast(Convert(numeric(9,2),25*100.0/30) as decimal(18,2)) As 百分比小数

说明

NUMERIC(P,S) P的默认值是:38 S的默认值是:-84~127
numeric(a,b)函数有两个参数,前面一个为总的位数,后面一个参数是小数点后的位数,例如numeric(5,2)是总位数为5,小数点后为2位的数,也就是说这个字段的整数位最大是3位。

java1.8可以使用stream()流的方法,如下

List<Integer> numbers = Arrays.asList(1,2,3,4,5,6,7,8,9,10);
int chunkSize = 20;   //3 ok
AtomicInteger counter = new AtomicInteger();

Collection<List<Integer>> resultList = numbers.stream()
      .collect(Collectors.groupingBy(it -> counter.getAndIncrement() / chunkSize))
      .values();

System.out.println(resultList);

使用第三方工具类的方法:

  • Google Guava has Lists.partition(List list, int size) method (docs)
  • Apache Commons Collections has ListUtils.partition(List list, int size) method (docs)

举例说明:
Check out Lists.partition(java.util.List, int) from Google Guava:
Returns consecutive sublists of a list, each of the same size (the final list may be smaller). For example, partitioning a list containing [a, b, c, d, e] with a partition size of 3 yields [[a, b, c], [d, e]] -- an outer list containing two inner lists of three and two elements, all in the original order.

svn切换分支每次都下载大量的源码,切换非常不便。
但svn用的时间很长了,而且很多commit,我们希望保存svn commit的信息以便做版本的控制和比较。幸好git提供了相应的解决办法。

准备安装环境

确保本地有svn和git环境,安装步骤略

建立svn账号与git账号映射

users.txt
svn账号=git账号名称<[email protected]>

svn转换为git

git svn clone svn://ip端口/projectname --no-metadata --authors-file=users.txt --trunk=trunk projectname
cd projectname

添加git仓库

git remote add origin [email protected]:root/projectname.git

提交到远端

git push -u origin master

360 前端静态资源库

https://cdn.baomitu.com/
360加速服务
360 前端静态资源库是由奇舞团支持并维护的开源项目免费 CDN 服务,支持 HTTPS 和 HTTP/2,囊括上千个前端资源库和 Google 字体库。
本站静态资源库数据均同步于 cdnjs,如发现版本更新不及时或未收录,欢迎向 cdnjs 提交 PR。

BootCDN

http://www.bootcdn.cn/
稳定、快速、免费的前端开源项目 CDN 加速服务
BootCDN开源免费cdn服务

免责声明
本博客部分内容来自于互联网,不代表作者的观点和立场,如若侵犯到您的权益,请联系[email protected]。我们会在24小时内进行删除。