自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 IO模型:同步、异步、阻塞、非阻塞

前言: 在Linux的网络编程中,同步IO(synchronous IO)、异步IO(asynchronous IO)、阻塞IO(blocking IO)、非阻塞IO(non-blocking IO)究竟是什么?它们之间又有什么联系和区别? 本文是我对这个问题的答案整理的笔记,参考《UNIX网络编程.卷1》一、IO模型在《UNIX网络编程.卷...

2016-07-18 19:18:00 362

转载 IO多路复用:select、poll、epoll示例

一、IO多路复用所谓IO多路复用,就是通过一种机制,一个进程可以监视多个描述符,一旦某个描述符就绪(一般是读就绪或者写就绪),能够通知程序进行相应的读写操作。Linux支持IO多路复用的系统调用有select、poll、epoll,这些调用都是内核级别的。但select、poll、epoll本质上都是同步I/O,先是block住等待就绪的socket,再是bl...

2016-05-06 03:35:00 416

转载 TCP socket心跳包示例程序

在做游戏开发时,经常需要在应用层实现自己的心跳机制,即定时发送一个自定义的结构体(心跳包),让对方知道自己还活着,以确保连接的有效性。在TCP socket心跳机制中,心跳包可以由服务器发送给客户端,也可以由客户端发送给服务器,不过比较起来,前者开销可能更大。—— 这里实现的是由客户端给服务器发送心跳包,基本思路是:1) 服务器为每个客户端保存了IP和计数器c...

2016-05-06 03:11:00 3472

转载 初识Elasticsearch

本文仅是个人的学习笔记,有问题请指正。一、简介在大数据领域,自从有了 Hadoop 以后,大家渐渐习惯收集日志到 HDFS 中,然后每天运行 MapReduce 任务做统计报表。但是,面对诸如“新上线的版本过去几分钟在各地反馈如何”,“昨天23:40左右这个投诉用户有没有异常”这种即时的开放性问题,传统的日志处理方案显得非常的笨拙和低效。复杂多变的实时数据...

2016-02-24 10:19:00 336

转载 常用linux系统监控命令

一、内存监控监控内存的使用状态是非常重要的,通过监控有助于了解内存的使用状态,比如内存占用是否正常,内存是否紧缺等等,监控内存最常使用的命令有free、vmstat、top等1.1 free$ free total used free shared buffers cached...

2015-08-23 23:36:00 253

转载 -ROOT-表和.META.表结构详解

在《HBase技术简介》中我们知道,HBase中有两个特殊的表:-ROOT-和.META.。由于HBase中的表可能非常大,故HBase会将表按行分成多个region,然后分配到多台RegionServer上。数据访问的整个流程如下图所示: 注意两点:Client端在访问数据的过程中并没有涉及到Master节点,也就是说HBase日常的数据操作...

2015-08-15 20:40:00 270

转载 MapReduce将HDFS文本数据导入HBase中

HBase本身提供了很多种数据导入的方式,通常有两种常用方式:使用HBase提供的TableOutputFormat,原理是通过一个Mapreduce作业将数据导入HBase另一种方式就是使用HBase原生Client API本文就是示范如何通过MapReduce作业从一个文件读取数据并写入到HBase中。首先启动Hadoop与HBase,然后创建一...

2015-08-12 11:04:00 449

转载 第一个MapReduce程序——WordCount

通常我们在学习一门语言的时候,写的第一个程序就是Hello World。而在学习Hadoop时,我们要写的第一个程序就是词频统计WordCount程序。一、MapReduce简介1.1 MapReduce编程模型MapReduce采用”分而治之”的思想,把对大规模数据集的操作,分发给一个主节点管理下的各个分节点共同完成,然后通过整合各个节点的中间结果,得到最终结果。简单地...

2015-07-29 17:57:00 3040

转载 HBase技术简介

一、HBase简介HBase – Hadoop Database,是一个高可靠性、高性能、面向列、可伸缩的分布式存储系统,利用HBase技术可在廉价PC Server上搭建起大规模结构化存储集群。HBase是Google BigTable的开源实现,类似Google BigTable利用GFS作为其文件存储系统,HBase利用Hadoop HDFS作为其文件存...

2015-07-24 00:11:00 195

转载 Hadoop+HBase+ZooKeeper分布式集群环境搭建

一、环境说明集群环境至少需要3个节点(也就是3台服务器设备):1个Master,2个Slave,节点之间局域网连接,可以相互ping通,下面举例说明,配置节点IP分配如下: Hostname IP User Password master 192.168.59.133 hadoop 123456 slave1...

2015-07-20 21:56:00 601

转载 HBase单机环境搭建

在搭建HBase单机环境之前,首先你要保证你已经搭建好Java环境:$ java -versionjava version "1.8.0_51"Java(TM) SE Runtime Environment (build 1.8.0_51-b16)Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mi...

2015-07-16 22:08:00 206

转载 MySQL基础笔记(六) 存储过程与函数

写在开头:本文所有的示例都是基于workers表,表中保存了某公司的员工姓名、性别、工资、年龄和居住城市,如下:+----+-----------+--------+--------+------+----------------+| id | name | sex | salary | age | city |+--...

2015-07-02 23:22:00 188

转载 MySQL基础笔记(五) 视图

一、什么是视图视图是一个虚拟表。也就是说,视图在外观和行为上都类似于表,但它不需要实际的物理存储,只保存了视图定义(查询语句)。视图由select查询所定义 —— 当创建一个视图时,实际上是在数据库里执行了一个select语句,它从一个或多个表中导出这个视图。对视图的操作与对表的操作一样,可以对视图进行查询、更新、删除。视图只是从表里引用数据,所以对视...

2015-07-02 23:12:00 409

转载 MySQL基础笔记(四) 索引

一、什么是索引索引(Index),可以看作一个指针,指向表里的数据。当数据库没有索引时,查找信息通常是全表扫描;使用了索引,它就会直接引导到数据在表里的准确物理位置。优点:索引的主要目的是提高数据检索的性能,在数据量比较大时尤其明显。缺点:索引通常与相应的表是分开保存的,索引也会占据物理存储空间,而且可能比表本身还大。索引的维护(索引项的添加和删除)...

2015-07-02 16:02:00 80

转载 MySQL基础笔记(三) 复杂查询

所谓复杂查询,指涉及多个表、具有嵌套等复杂结构的查询。这里简要介绍典型的几种复杂查询格式。一、连接查询连接是区别关系与非关系系统的最重要的标志。通过连接运算符可以实现多个表查询。连接查询主要包括内连接、外连接等。假设有Student和Grade两个表如下:+-----+--------+-------+ +-----+---------...

2015-07-01 22:27:00 192

转载 MySQL基础笔记(二) 完整性约束

我们知道,一种数据模型必须包含三个基本的部分:构造机制(数据结构):主要描述数据的类型、内容、性质以及数据间的联系等。运算机制(数据操作):主要描述在相应的数据结构上的操作类型和操作方式。约束机制(数据约束):主要描述数据结构内数据间的语法、词义联系、他们之间的制约和依存关系,以及数据动态变化的规则,以保证数据的正确、有效和相容。作为数据库的一种数据模...

2015-07-01 11:17:00 436

转载 MySQL基础笔记(一) SQL简介+数据类型

MySQL是一个关系型数据库管理系统(RDBMS),它是当前最流行的 RDBMS 之一。MySQL分为社区版和企业版,由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,一般中小型网站的开发都选择 MySQL 作为网站数据库。一、什么是SQLSQL,即结构化查询语言(Structured Query Language),是与关系型数据库进行通...

2015-06-27 15:19:00 150

转载 LeetCode 30 - Substring with Concatenation of All Words

一、问题描述 Description: You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenati...

2015-05-27 12:06:00 95

转载 LeetCode 29 - Divide Two Integers

一、问题描述 Description: Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT.不使用乘法、除法与取余操作符(即*、/、%),实现两个整数相除,返回商。...

2015-05-25 01:31:00 84

转载 LeetCode 28 - Implement strStr()

一、问题描述 Description: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.实现函数strStr(string hayst...

2015-05-24 23:32:00 88

转载 LeetCode 27 - Remove Element

一、问题描述 Description: Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn’t mat...

2015-05-24 10:42:00 104

转载 LeetCode 26 - Remove Duplicates from Sorted Array

一、问题描述 Description: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Forexample: Given input a...

2015-05-24 10:27:00 79

转载 LeetCode 25 - Reverse Nodes in k-Group

一、问题描述 Description: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then le...

2015-05-24 09:57:00 111

转载 LeetCode 24 - Swap Nodes in Pairs

一、问题描述 Description: Given a linked list, swap every two adjacent nodes and return its head. Forexample: Given 1->2->3->4, you should return the list as 2-&g...

2015-05-24 08:55:00 101

转载 LeetCode 23 - Merge k Sorted Lists

一、问题描述 Description: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.合并 k 个有序链表。二、解题报告解法一:两两合并由于前面刚刚做过《LeetCode ...

2015-05-24 01:42:00 88

转载 2015实习生求职季总结

一、实习季Timeline从2015年4月开始找实习,前后历时两个月,参加了很多的笔试/面试。这是一个焦虑又美好的学期,我在这段时间里学到了很多东西。这一个学期就这么磕磕绊绊的过了一半了,决定去360实习以后,也终于能安下心来。因为等待(笔试/面试通知)真的是很痛苦的一件事。参加的笔试/面试越多,越发现自己有很多的不足。求职难免碰壁,这两个月我被虐了好...

2015-05-23 14:56:00 98

转载 LeetCode 22 - Generate Parentheses

一、问题描述 Description: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Forexample: Given n = 3, a solution set i...

2015-05-20 19:20:00 105

转载 LeetCode 21 - Merge Two Sorted Lists

一、问题描述 Description: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.合并两个有序的链表,返回...

2015-05-20 18:09:00 98

转载 LeetCode 20 - Valid Parentheses

一、问题描述 Description: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the c...

2015-05-20 17:48:00 98

转载 LeetCode 19 - Remove Nth Node From End of List

一、问题描述 Description: Given a linked list, remove the nth node from the end of list and return its head. Forexample: Given linked list: 1->2->3->4->5, and ...

2015-05-20 13:34:00 96

转载 LeetCode 18 - 4Sum

一、问题描述 Description: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which give...

2015-05-20 12:49:00 64

转载 LeetCode 17 - Letter Combinations of a Phone Number

一、问题描述 Description: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephon...

2015-05-20 11:25:00 97

转载 LeetCode 16 - 3Sum Closest

一、问题描述 Description: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You m...

2015-05-19 21:11:00 143

转载 LeetCode 15 - 3Sum

一、问题描述 Description: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero....

2015-05-19 20:03:00 65

转载 LeetCode 14 - Longest Common Prefix

一、问题描述 Description: Write a function to find the longest common prefix string amongst an array of strings.给定一组字符串,写一个函数找出它们的最长公共前缀。二、解题报告首先,我尝试用 Trie 树去求公共前缀,但是超过了内存...

2015-05-19 14:10:00 104

转载 LeetCode 13 - Roman to Integer

一、问题描述 Description: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.给定一个字符串表示的罗马数字,把该罗马数字转化为一个整数。大小范围限制在 1 到 ...

2015-05-19 12:20:00 119

转载 LeetCode 12 - Integer to Roman

一、问题描述 Description: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.将一个整数用罗马数字表示法表示,大小范围限制在 1 到 3999。二、解题...

2015-05-19 11:46:00 111

转载 LeetCode 11 - Container With Most Water

一、问题描述 Description: Given n non-negative integers a1,a2,...,an, where each represents a point at coordinate (i,ai). n vertical lines are drawn such that the two endpoints of li...

2015-05-19 10:00:00 96

转载 LeetCode 10 - Regular Expression Matching

一、问题描述 Description: Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding elem...

2015-05-19 01:15:00 92

转载 LeetCode 211 - Add and Search Word - Data structure design

一、问题描述 Description: Design a data structure that supports the following two operations: void addWord(word)bool search(word) search(word) can search a literal word or...

2015-05-16 10:12:00 125

空空如也

空空如也

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

TA关注的人

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