摘要: 接触spark有快一年了,对于scala语言的态度一直看不懂才查API、看资料。最近有比赛要用,所以开始认真学习scala。看的是《快学scala》这本书,记下自认为有用的语言特性及代码。package examplesobject Example1 { def main(args: Array[... 阅读全文
posted @ 2016-01-19 21:35 codingcat 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 1.含有“is”的行数val lines = sc.textFile("file:///usr/spark/spark-1.0.0-bin-hadoop2/README.md")lines.countval isrdd = lines.filter(line => line.contains("is... 阅读全文
posted @ 2016-01-19 21:29 codingcat 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 0 10:20:35 CREATE PROCEDURE pro_user4() BEGIN DECLARE a,b VARCHAR(20) ; DECLARE cur_t_user2 CURSOR FOR SELECT userName2,password2 FROM t_user2; DE... 阅读全文
posted @ 2015-11-02 10:55 codingcat 阅读(220) 评论(0) 推荐(0) 编辑
摘要: sort命令依据不同的数据类型进行排序,其语法及常用参数格式: sort [-bcfMnrtk][源文件][-o 输出文件]sort可针对文本文件的内容,以行为单位来排序。参 数:-b忽略每行前面开始出的空格字符。-c检查文件是否已经按照顺序排序。-f排序时,忽略大小写字母。-M将前面3个字母依... 阅读全文
posted @ 2015-10-26 19:42 codingcat 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 写了一个MR程序。发现reducer居然没执行。然后查看了半天,没发现有什么问题,后来经博士指点,找到了原因。1.首先,检查reducer,即job.setReducerClass(**.class);2.reducer函数里public void reduce(Text key, Iterable... 阅读全文
posted @ 2015-10-26 18:49 codingcat 阅读(599) 评论(0) 推荐(0) 编辑
摘要: 1.从第3000行开始,显示1000行。即显示3000~3999行cat filename | tail -n +3000 | head -n 10002.显示1000行到3000行cat filename| head -n3000| tail -n +1000*注意两种方法的顺序分解: tail ... 阅读全文
posted @ 2015-10-14 22:26 codingcat 阅读(3597) 评论(0) 推荐(0) 编辑
摘要: 很多mysql语句用的时候想不起来,现在用个简单的例子记着。/*SQLyog 企业版 - MySQL GUI v8.14MySQL - 5.1.49-community******************************************************************... 阅读全文
posted @ 2015-09-22 21:03 codingcat 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 很多mysql语句用的时候想不起来,现在用个简单的例子记着。/*SQLyog Ultimate v11.33 (64 bit)MySQL - 5.1.49-community : Database - db_book******************************************... 阅读全文
posted @ 2015-09-22 20:58 codingcat 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space.判断一个integer是否为回文。注意不要用额外的空间。另外,注意考虑负数。 1 public class Solution { 2 publ... 阅读全文
posted @ 2015-08-08 10:26 codingcat 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321注意考虑几个情况,x=1534236460 1534236469 -2147483647等等。写的代码有点冗长了。 1 pub... 阅读全文
posted @ 2015-08-08 10:25 codingcat 阅读(252) 评论(0) 推荐(0) 编辑