摘要: RPC采用客户机/服务器模式。 请求程序就是一个客户机,而服务提供程序就是一个服务器。首先,客户机调用进程发送一个有进程参数的调用信息到服务进程,然后等待应答信息。在服务器端, 进程保持睡眠状态直到调用信息的到达为止。当一个调用信息到达,服务器获得进程参数,计算结果,发送答复信息,然后等待下一个调用... 阅读全文
posted @ 2015-05-03 12:10 hylaz 阅读(1372) 评论(0) 推荐(0) 编辑
摘要: 今天没事了,在查看nginx源代码中看到ngx_list的结构,发现设计为链表数组的形式,不知道为什么这样设计struct ngx_list_part_s { void *elts;//指向数组的起始地址 ngx_uint_t nelts;//数组已... 阅读全文
posted @ 2015-05-01 22:27 hylaz 阅读(705) 评论(0) 推荐(0) 编辑
摘要: /etc/syslog.conf配置文件控制syslog daemon的操作规则形式:facility.level actionfacility.level 为选择器,action 指定与选择器匹配的消息被发送到何处*.err /dev/tty2表示所有的工具(*)的level为err或者更高的消息... 阅读全文
posted @ 2015-04-04 22:18 hylaz 阅读(1511) 评论(0) 推荐(0) 编辑
摘要: 工作中经常用php操作文件,因此把常用文件操作整理出来: 1 class hylaz_file{ 2 /** 3 * Read file 4 * @param string $pathname 5 * @return string content 6 ... 阅读全文
posted @ 2015-04-01 22:38 hylaz 阅读(1068) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序是非常容易理解和实现,,以从小到大排序举例:设数组长度为N。1.比较相邻的前后二个数据,如果前面数据大于后面的数据,就将二个数据交换。2.这样对数组的第0个数据到N-1个数据进行一次遍历后,最大的一个数据就“沉”到数组第N-1个位置。3.N=N-1,如果N不为0就重复前面二步,否则排序完成。... 阅读全文
posted @ 2015-03-29 11:58 hylaz 阅读(763) 评论(0) 推荐(0) 编辑
摘要: 插入排序原理:输入一个元素,检查数组列表中的每个元素,将其插入到一个已经排好序的数列中的适当位置,使数列依然有序,当最后一个元素放入合适位置时,该数组排序完毕。php实现方法1:function insert($array){ $count=count($array); if($count=0;$j... 阅读全文
posted @ 2015-03-29 01:34 hylaz 阅读(384) 评论(0) 推荐(0) 编辑
摘要: 针对堆排序的概念自己百度去,今天没事了用php实现堆排序的算法 1 abstract class Heap { 2 protected $elements = array(); 3 protected $n = 0; 4 5 public abstract func... 阅读全文
posted @ 2015-03-28 21:37 hylaz 阅读(520) 评论(0) 推荐(0) 编辑
摘要: class base{ private $member; function __construct() { echo __METHOD__ . "(begin)\n"; $this->member = 'base::member'; $this->test(); ... 阅读全文
posted @ 2014-10-13 18:04 hylaz 阅读(554) 评论(0) 推荐(0) 编辑
摘要: 在php5.3以后,php加入匿名函数的使用,今天在使用匿名的时候出现错误,不能想php函数那样声明和使用,详细看代码$callback=function(){ return "aa";};echo $callback();这是打印出来是aa;看下面的例子: echo $callback();$c... 阅读全文
posted @ 2014-03-14 17:43 hylaz 阅读(1988) 评论(0) 推荐(0) 编辑
摘要: 1.去除html标记function Text2Html($txt){ $txt = str_replace(""," ",$txt); $txt = str_replace("<","&lt;",$txt); $txt = str_replace(">","&gt;",$txt); $txt = preg_replace("/[\r\n]{1,}/isU","<br/>\r\n",$txt); 阅读全文
posted @ 2012-12-24 13:54 hylaz 阅读(252) 评论(0) 推荐(0) 编辑