自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 ++i+i++

偶然看到一个朋友的QQ验证问题:int i=0;i+=++i+i++;++i+i++=?在不同的环境里面运行结果竟然不一样,leetcode的结果是13,VS里是10,eclipse是6,然后上网查了一下,可能跟C++和Java对于自增操作的不同处理有关,在Java中,对于i=i++,JVM会先把i的初值(即为0)拷贝到临时变量区,然后对i值+1,此时i值是1,然后返回临时变量区的值并赋值给i

2016-09-28 10:24:24 1074

原创 获取Storm集群上TridentWordCount计算结果的方法

由于Storm集群上的拓扑是持续计算的,不像Hadoop会在HDFS上保存计算结果,因为对于提交到集群上的拓扑而言,需要用户在写程序的时候指定计算结果的输出位置,比如数据库或者本地文件,在运行TridentWordCount的时候,会设置一个DRPCStream来查询Trident的状态,从而可以查询某些单词的统计结果,由于storm-starter中的例子只给了在本地模式下使用localDRPC

2016-09-27 20:38:27 2505

原创 离线环境下使用Maven打包Storm程序

Maven打包程序会根据程序提供的pom.xml文件下载很多依赖包,一旦这些依赖包在本地存在以后,再打包程序就无需重复下载,因此要想在离线环境中使用Maven打包Storm程序,只需要从已经下载好依赖包主机,将其中的~/.m2文件夹复制到离线环境中,在离线环境的$MAVEN_HOME/conf修改settings.xml文件,指定本地仓库为复制来的.m2文件即可,指定本地仓库的配置如下:/usr/

2016-09-27 20:26:52 4936

原创 Storm上的Nimbus、Supervisor以及Worker之间的关系

1.Storm中各节点介绍1.1 主控节点和工作节点Storm将每个节点分为主控节点和工作节点两种,其中主控节点只有一个,工作节点可以有多个。1.2 Nimbus主控节点运行Nimbus守护进程,类似于Hadoop中的jobtracker,负责在集群中分发代码,对节点分配任务,并监视主机故障。1.3 Supervisor每个工作节点运行Supervisor守护进程,负责监听

2016-09-24 19:47:26 17550

原创 108. Convert Sorted Array to Binary Search Tree

题目Given an array where elements are sorted in ascending order, convert it to a height balanced BST.分析对给定的数组进行二分检索,检索的过程中构造相应的树结构,由于树的定义只有带参数的构造函数,而没有默认构造函数,所以只能通过返回指针的形式构造树。/** * Definition

2016-09-21 16:57:33 255

原创 216. Combination Sum III

题目Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Example

2016-09-21 15:37:02 291

原创 Eclipse运行storm-starter

官网下载的Storm安装文件中自带storm-starter源码,所在路径为storm/examples/storm-starter,可以在该目录下用maven打包源代码并提交到storm上运行,也可以使用eclipse编译运行。1.新建项目,导入依赖库在eclipse中新建一个java项目,例如storm_starter,点击下一步,然后在Libraries中选择add External

2016-09-14 13:45:02 2682

原创 CentOS 6.3输入法不显示候选词

CentOS使用ibus输入法时,会调用python执行,当python更新到2.7以上时,由于将/usr/bin/python使用软链接到python2.7,导致无法显示拼音输入法的候选词列表,所以需要到一下目录中修改ibus相关文件,使其调用python时使用python2.6/usr/libexec/ibus-ui-gtk/usr/ bin/ibus-setup/usr/libe

2016-09-13 13:13:12 992

原创 CentOS 6.3配置Storm1.0.2

本文环境如下: 操作系统:CentOS 6.3 64位 Hive版本:2.0.0 JDK版本:1.8.0_71Hadoop版本:2.6.4

2016-09-13 10:52:36 2557 2

原创 22. Generate Parentheses

题目Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()",

2016-09-11 17:39:15 193

原创 337. House Robber III

题目The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. Afte

2016-09-07 14:29:27 266

原创 377. Combination Sum IV

题目Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3]target = 4

2016-09-07 10:13:00 253

原创 230. Kth Smallest Element in a BST

题目Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Follow up:Wha

2016-09-05 15:36:57 188

原创 318. Maximum Product of Word Lengths

题目Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower

2016-09-05 13:54:31 194

原创 137. Single Number II

题目Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it wit

2016-09-02 16:44:48 211

原创 12. Integer to Roman

题目Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.分析构造一个4*10的矩阵,保存1-9,10-90,100-900,1000-3000的罗马字符,然后对num从千位开始找到合适的罗马字符与之组合即可。

2016-09-01 10:41:16 173

原创 378. Kth Smallest Element in a Sorted Matrix

题目Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is the kth smallest element in the sorted or

2016-09-01 10:07:56 251

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除