自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

大山的单车

Hanging there, everything will be fine.

  • 博客(19)
  • 资源 (2)
  • 收藏
  • 关注

原创 PHP 一致性哈希环的简单实现

<?php#inspired by 大型分布式网站设计与实践,及 https://github.com/Yikun/hashes/blob/master/virtual_consist_hash.py/* 一致性哈希 * 1,哈希值应该是无符号整形,其值范围为0~2^32-1。 * 2,哈希环节点顺时针分布。 **/$items = 1000000; #元素$nodes =

2017-06-15 13:26:48 367

转载 PHP闭包的路由实例模型

<?php/* 回调函数 */class App { protected $routes = []; protected $responseStatus = '200 OK'; protected $responseContentType = 'text/html'; protected $responseBody = 'Hello World';

2017-06-14 23:07:06 292

原创 redis 主从配置

使用vagrant开启3台虚拟机,实践了下redis主从配置,3台虚拟机 28,29,30, master(28) slave(29,30)先上图, 如图左上,master-28有2个slave, slave0,slave1。配置配置master redis.confrequirepass passwd配置 slave redis.confslave

2017-06-03 15:24:43 269

原创 php 创建一个扩展开发环境的正确姿势

安装编译PHP官网下载最新php-7.1.5.tar的源码包设置开发目录,打开调试模式,禁止其他内置模块cd path/to/php-src./configure --prefix=path/to/php --enable-debug --disable-allmake && make install生成PHP扩展目录cd php-src/ext./ext_skel

2017-06-01 12:13:21 419

原创 leetcode.136. Single Number

QuestionGiven an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it

2017-05-30 15:02:25 158

原创 leetcode.485. Max Consecutive Ones

QuestionGiven a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits

2017-05-30 14:19:38 169

原创 leetcode463. Island Perimeter

QuestionYou are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last s

2017-05-30 13:48:46 199

原创 leetode.599. Minimum Index Sum of Two Lists

QuestionSuppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to help them find out their common i

2017-05-30 13:30:43 451

原创 leetcode.463. Island Perimeter

QuestionYou are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid

2017-05-29 14:33:16 213

原创 leetcode.496. Next Greater Element I

QuestionYou are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding

2017-05-29 03:22:30 197

原创 leetcode.344. Reverse String

QuestionWrite a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".Solution异或交换首尾char* reverseString(char* s) { int

2017-05-29 02:14:39 236

原创 leetcode.412. Fizz Buzz

QuestionWrite a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five o

2017-05-29 02:04:13 475

原创 leetcode.575. Distribute Candies

QuestionGiven an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to

2017-05-27 17:44:29 236

原创 leetcoe.557 Reverse Words in a String III

QuestionGiven a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take L

2017-05-27 16:46:17 385

原创 leetcode.476. Number Complement

QuestionGiven a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to fit wit

2017-05-27 15:41:26 224

原创 leetcode.561 Array Partition I

QuestionGiven an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from

2017-05-27 14:55:22 246

翻译 pubsub 设计模式

广播订阅模式介绍打开收音机选择不同频率的节目时,就像是订阅某个电台的节目。广播节目的电台(广播者)并不需要知道谁在收听他们的电台节目,他们只需广播就行。同样对收听节目的人(订阅者)来说,也不关心谁广播的这些节目,只需要打开收音机并调频到这个频率,当有节目时就可以收到。广播订阅模式优点解耦扩展清晰灵活测试广播订阅模式缺点不保证消息是否投递成功不保证消息

2017-05-26 16:50:09 526

原创 nginx 基础

nginx 作为web服务器有哪些优点?在服务器集群前充当一个安全缓冲,作为保护配置静态资源的CDN,加速访问速度实现复杂均衡epoll模型(队列事件驱动)master-worker 工作方式gzip 压缩,节省带宽安全、稳定,被各种大厂广泛应用nginx 是如何处理一个请求?虚拟主机假设我们有三个虚拟主机,监听80端口,nginx需要首先确定由那个

2017-05-24 11:51:35 354

原创 leetcode.461 Hamming Distance

问题 The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Not

2017-05-23 22:38:45 248

SRPINGBOOT+DUBBO+RPC

springboot2.0.1微服务架构demo,使用dubbo框架解决服务治理。

2018-11-21

Dev-Cpp 5.2.0.3 TDM-GCC x64

64位,非常小但是强大的c,c++,Dev-Cpp编辑器.

2014-08-29

空空如也

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

TA关注的人

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