- 博客(342)
- 资源 (7)
- 收藏
- 关注
原创 Spring Jetty替换Tomcat
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> ...
2018-04-12 15:47:38 1195
转载 spring IOC
https://blog.csdn.net/qq_22654611/article/details/52606960/其实IoC对编程带来的最大改变不是从代码上,而是从思想上,发生了“主从换位”的变化。应用程序原本是老大,要获取什么资源都是主动出击,但是在IoC/DI思想中,应用程序就变成被动的了,被动的等待IoC容器来创建并注入它所需要的资源了。 IoC很好的体现了面向对象设计法则之一—— 好...
2018-04-10 19:51:40 58
原创 对称的二叉树
boolean isOK(TreeNode node1,TreeNode node2){ if(node1==null&&node2==null)return true; if(node1!=null&&node2==null)return false; if(node1==null&&node2!...
2018-03-29 13:48:22 106
原创 数据流中的中位数
private int count = 1;//当前是第几个插入的值 private PriorityQueue<Integer> minHeap = new PriorityQueue<>(); private PriorityQueue<Integer> maxHeap = new PriorityQueue<Integer>( ...
2018-03-27 17:46:00 105
原创 kafka调优
合理设置batchduration 依据数据量合理设置kafka topic partition数目 kafka拉取量设置 maxRatePerPartition executor core的合理设置,避免资源闲置浪费 spark.task.maxFailures=1 spark.speculation为关闭状态...
2018-03-27 16:29:40 294
原创 滑动窗口的最大值
//对于前面的元素,如果后面的元素比它大,那么移除它,因为不可能成为后面窗口的最大值了 //对于前面的元素,如果后面的元素比它小,如果不在窗口中,那么删除它 //前面始终保存最大值 public static ArrayList<Integer> maxInWindows(int[] num, int size) { ArrayList<...
2018-03-27 16:27:22 137
原创 spark sql hive小文件优化
sparksession.sqlContext.setConf("hive.merge.mapfiles","true")sparksession.sqlContext.setConf("mapred.max.split.size","256000000")sparksession.sqlContext.setConf("mapred.min.split.size.per.node","192.
2018-03-22 13:17:46 5678 1
原创 链表倒置
class ListNode{int val;ListNode next=null;ListNode(int val){this.val=val;}}public static ListNode reverse2(ListNode head) {if(head==null)return head;ListNode pre=head;//最前面的节点ListNode cur=...
2018-03-21 14:56:41 175
原创 两个有序链表合并
class ListNode {int val;ListNode next = null;ListNode(int val) {this.val = val;}}public ListNode Merge(ListNode list1, ListNode list2) {if (list1 == null) return list2;if (list2 == null) re...
2018-03-21 14:56:18 259
原创 链表逆序输出
import java.util.ArrayList;import java.util.Stack;public class Solution { public ArrayList<Integer> printListFromTailToHead(ListNode listNode) { Stack<Integer> resstack=new ...
2018-03-21 14:55:50 212
原创 之字型打印二叉树
class TreeNode {int val = 0;TreeNode left = null;TreeNode right = null;public TreeNode(int val) {this.val = val;}}public ArrayList<ArrayList<Integer>> Print(TreeNode pRoot) {Arra...
2018-03-21 14:55:28 253
原创 用两个栈实现队列
Stack<Integer> stack1 = new Stack<Integer>(); Stack<Integer> stack2 = new Stack<Integer>(); public void push(int node) { while (!stack2.isEmpty()){ ...
2018-03-21 14:55:02 109
原创 替换空格字符串
public String replaceSpace(StringBuffer str) {StringBuffer res=new StringBuffer();for(int i=0;i<str.length();i++){if(str.charAt(i)==' '){res.append("%20");}else{res.append(str.charAt(i));}}...
2018-03-21 14:53:59 143
原创 栈的压入、弹出序列
public static boolean IsPopOrder(int [] pushA,int [] popA) {int len=pushA.length;Stack<Integer> dataStack=new Stack<>();int i=0;int j=0;//popA indexwhile (i<len){if(!dataStack.isEmpty()...
2018-03-21 14:53:31 110
原创 分层打印二叉树
public ArrayList<Integer> PrintFromTopToBottom(TreeNode root) {ArrayList<Integer> reslist=new ArrayList<>();if(root==null) return reslist ;// if(root.left==null&&root.right==...
2018-03-21 14:52:56 251
转载 redis一致性哈希算法
一致性哈希算法在1997年由麻省理工学院提出的一种分布式哈希(DHT)实现算法,设计目标是为了解决因特网中的热点(Hot spot)问题,初衷和CARP十分类似。一致性哈希修正了CARP使用的简 单哈希算法带来的问题,使得分布式哈希(DHT)可以在P2P环境中真正得到应用。 一致性hash算法提出了在动态变化的Cache环境中,判定哈希算法好坏的四个定义:1、平衡性(B
2017-09-22 10:46:24 1034
原创 python slice array
python数组切片分着正序和倒序a=[1,2,3,4,5,6,7,8]翻转数组的另一种方式:a[::-1]逆序slice ,start step must be bigger than end stepfor example you can use a[7:3:-1] to print out the slice array,but you can not use it for
2017-04-26 21:45:00 870
转载 quick select算法
本文的主角.quick select算法.其实就类似于快排.不同地方在于quick select每趟只需要往一个方向走.时间复杂度:O(n).def qselect(A,k): if len(A)<=k:return A pivot = A[-1] right = [pivot] + [x for x in A
2016-11-20 16:28:40 1076
转载 分类器的性能评估
本文转载于http://funhacks.net/2015/08/12/classifier-evaluation/感谢原作者的分享1. 背景当我们使用一个分类器进行预测时,我们会遇到一个很重要的问题:如何评价这个分类器的预测效果?这里我构造一个场景作为例子来说明。现在有10个人,其中1个人有感冒症状,9个人没有感冒症状。现在让医生进行诊断,判断哪些人有感冒,哪
2016-04-23 22:47:01 8832
转载 HBase优化实战
背景Datastream一直以来在使用HBase分流日志,每天的数据量很大,日均大概在80亿条,10TB的数据。对于像Datastream这种数据量巨大、对写入要求非常高,并且没有复杂查询需求的日志系统来说,选用HBase作为其数据存储平台,无疑是一个非常不错的选择。HBase是一个相对较复杂的分布式系统,并发写入的性能非常高。然而,分布式系统从结构上来讲,也相对较复杂,模块繁多,
2016-01-12 16:04:28 1697
转载 机器学习中的数学(1)-回归(regression)、梯度下降(gradient descent)
版权声明: 本文由LeftNotEasy所有,发布于http://leftnoteasy.cnblogs.com。如果转载,请注明出处,在未经作者同意下将本文用于商业用途,将追究其法律责任。前言: 上次写过一篇关于贝叶斯概率论的数学,最近时间比较紧,coding的任务比较重,不过还是抽空看了一些机器学习的书和视频,其中很推荐两个:一个是stanford的machin
2016-01-03 16:37:38 489
转载 Best Practices for YARN Resource Management
In this blog post, I will discuss best practices for YARN resource management. The fundamental idea of MRv2(YARN) is to split up the two major functionalities—resource management and job scheduling/mo
2015-12-31 13:19:25 1027
转载 Yarn下的YarnChild启动个数决定参数
Yarn下的mapper和reducer并发执行个数有什么决定的呢?由调度的资源决定的,也就是说启动的YarnChild个数多少取决于资源的分配和free的资源量参数说明:conf/yarn-site.xmlyarn.nodemanager.resource.memory-mbNodeManager总的可用物理内存,默认值是8192MB,一般情况下不要修改yarn.node
2015-12-31 13:16:27 4396
原创 ftp命令
一、vsftp安装篇复制代码代码如下:# 安装vsftpdyum -y install vsftpd# 启动service vsftpd start# 开启启动chkconfig vsftpd on二、vsftp相关命令之服务篇复制代码代码如下:# 启动ftp服务service vsftpd start# 查看ft
2015-12-01 11:25:13 655
原创 Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo
2015-11-29 15:53:39 388
转载 redis持久化
官方文章http://redis.io/topics/persistenceredis持久化主要分为两种RDB和AOF Redis支持2种持久化策略:snapshot方式和commandlog方式,前者通过将当前内存数据快照周期性写入RDB文件来实现;后者通过在log中记录Redis进程收到的写操作来实现,下次Redis重启时,回放commandlog来恢复数据状态。
2015-11-26 11:12:06 441
原创 Eclipse下安装Scala插件
scala版本为2.10.4http://scala-ide.org/download/prev-stable.htmlEclipse 3.8-4.3 (Juno and Kepler)For Scala 2.11.2 Install New Software', and paste this URL into the dialog box. Then,
2015-11-25 16:44:14 16553
原创 Generics are not supported at this language level
选择File---->Project Structure 修改Project language level为7
2015-11-23 10:31:13 5441 1
原创 Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe
2015-11-16 16:25:11 383
原创 Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link
2015-11-16 16:23:49 347
原创 centos7提示ifconfig command not found解决
安装centos7时,选择了minimal install的话,没有安装网络组件。 yum install net-tools 可以解决问题。
2015-11-14 21:41:23 4211 4
转载 如何免 sudo 使用 docker
1 简介默认安装完 docker 后,每次执行 docker 都需要运行 sudo 命令,非常浪费时间影响效率。如果不跟 sudo,直接执行 docker images 命令会有如下问题:FATA[0000] Get http:///var/run/docker.sock/v1.18/images/json: dial unix /var/run/docker.sock: permis
2015-11-14 21:07:02 3739
原创 在Centos上面用yum install安装redis
redis包含在第三方的yum源里面,不在centos官方yum源中。1:去下面的网站下载EPEL对应的版本:(epel是fedora维护的yum源,里面软件众多)http://fedoraproject.org/wiki/EPELhttps://dl.fedoraproject.org/pub/epel/6/x86_64/2:我下载的是这个:wget http://d
2015-11-13 15:24:25 2321
转载 Spark算子:RDD行动Action操作(7)–saveAsNewAPIHadoopFile、saveAsNewAPIHadoopDataset
saveAsNewAPIHadoopFiledef saveAsNewAPIHadoopFile[F def saveAsNewAPIHadoopFile(path: String, keyClass: Class[_], valueClass: Class[_], outputFormatClass: Class[_ saveAsNewAPIHadoopFile
2015-11-03 11:24:00 8892
转载 Spark: Transformation和Action
本文提供的是0.7.3版本中的action和transformation接口,RDD提供了两种类型的操作:transformation和action1,transformation是得到一个新的RDD,方式很多,比如从数据源生成一个新的RDD,从RDD生成一个新的RDD2,action是得到一个值,或者一个结果(直接将RDD cache到内存中)所有的transformat
2015-11-03 09:45:54 492
转载 ZooKeeper系列之八:ZooKeeper的简单操作
1 )使用 ls 命令来查看当前 ZooKeeper 中所包含的内容:[zk: 10.77.20.23:2181(CONNECTED) 1] ls /[zookeeper]2 )创建一个新的 znode ,使用 create /zk myData 。这个命令创建了一个新的 znode 节点“ zk ”以及与它关联的字符串:[zk: 10.77.20.23:2181(
2015-10-21 10:16:40 443
转载 kafka使用命令
上面的步骤都执行完了,环境算是好了,下面我们要测试下是否能成功运行kafka:1. 启动zookeeper server :bin/zookeeper-server-start.sh ../config/zookeeper.properties & (用&是为了能退出命令行)2. 启动kafka server: bin/kafka-server-start.sh ../config/
2015-10-21 10:14:17 1068
转载 Kafka 安装和测试
1. 简介 kafka (官网地址:http://kafka.apache.org)是一款分布式消息发布和订阅的系统,具有高性能和高吞吐率。 i. 消息的发布(publish)称作producer,消息的订阅(subscribe)称作consumer,中间的存储阵列称作broker。ii. 多个broker协同合作,producer、consumer和broker
2015-10-21 10:12:51 598
美团-机器学习-实践_最新AI算法实践真知
2018-11-22
elasticsearch-the-definitive-guide-cn
2018-08-22
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人