context源码解析

为什么会有这个包? 我们知道goroutine之间是相互独立的,没有父子关系,一个goroutine无法主动关闭另一个goroutine,只能

Redis Cluster 入门实践

前言 最初,我们使用单点redis就可以愉快地玩耍,直到有一天这个单点挂掉导致整个服务不可用,我们意识到要用主从节点。在日常使用中,至少会使用

SPI协议简介

一. 引言 只要你使用过树莓派、arduino或者单片机之类的东西,一定少不了和各种传感器打交道。两个设备之间通信,就会涉及到协议的问题。所谓协

PHP-Parser 学习笔记

缘起 最近工作上接到一个任务,要把项目代码的控制器中所有没有判断过权限的public方法找出来。我们的控制器里有一个统一的checkAllow

Algorithms Part I week 1: Analysis of Algorithms

Why to analyze? To solve a single problem, there may be many different algorithms. Should we just randomly pick up one or use the best one? Of course, we want the best one. But how can we assert that this one is better than that one? Even though we have the best one, is it really the best one in the world? Can there be a better undiscovered algorithm? We must analyze algorithms to:

Algorithms Part I week 1: union-find

Theses days, I took a MOOC course named Algorithms instructed by Robert Sedgewick and Kevin Wayne from Princton University. To solidify my understanding of the course and for future reference, I’m going to write some notes on the subject. And from this post on, I decide to write technical articles in English, which is a good way to improve my written English skill. Basic steps There are some steps we can follow to develop a usable algorithm.

laravel route 重定向的一个小坑

今天做项目发现一个奇怪的现象,我的路由配置里有如下配置: 1 2 3 4 5 6 7 8 <?php Route::group(array('prefix'=>'admin','before'=>'adminauth'),function(){ // 管理员登录 Route::get('/',function(){ return Redirect::to('admin/login'); }); Route::get('login','UserController@adminLogin'); }; 目的是无论用户输入admin,还是adm

搭建 vpn

今天入手了linode,网站环境搭建好后,开始弄vpn。本文参考了一下这篇文章,并结合之前的经验。 1. 安装PPP,PPTP 1 2 # yum install -y ppp # rpm -ivh