自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(26)
  • 收藏
  • 关注

原创 PHP实现PING

<?php// Checksum calculation functionfunction icmpChecksum($data){ if (strlen($data)%2) $data .= "/x00"; $bit = unpack(n*, $data); $sum = array_sum($bit); while (

2011-06-09 11:38:00 293

原创 PHP实现简单Diff

<br /><?php/** * Simple diff imlementation * Test example from http://en.wikipedia.org/wiki/Diff */$orginal = "This part of thedocument has stayed thesame from version toversion. It shouldn'tbe shown if it doesn'tchange. Otherwise, th

2011-04-06 15:35:00 1136

原创 BST树和RBT树

parent = NilNode::getInstance(); $this->left = NilNode::getInstance(); $this->right = NilNode::getInstance(); } static public function isNil(Node $node) { return is_a($node, 'NilNode'); } }class NilNode extends Node{ static protecte

2011-03-21 11:53:00 430

原创 数羊啦

<br />有一种羊,寿命为5年,其中第2年,第4年,都会生一只小羊,现在农场里搞来一头这样的羊,请问n年后,该农场有几头羊呢?<br /> <br />function count_sheep($year) { $year = (int)$year; if ($year < 1) $year = 1; if ($year == 1) return 1; $sheep[1] = 1; $sheep[2] = $sheep[3] = $sheep[4] = $sheep[5] = 0;

2011-03-13 02:43:00 353

原创 PHP实现MaxHeap

<br />从PHP5.3开始,PHP已经内置了MaxHeap的结构,见http://cn.php.net/manual/en/class.splmaxheap.php<br /> <br />以下纯属无聊:<br /> <br /><?phpclass MaxHeap { protected $_data = array(); protected $_count = 0; public function insert($value) { $index = ++$this->_c

2011-03-10 11:25:00 538

原创 PHP实现Levenshtein Distance算法

Levenshtein Distance算法可用于计算2个文本的近似度,PHP提供了levenshtein的字符串函数,但在实际使用过程中发现,该实现有2个缺点:1.不支持多字节编码2.字符串不能超过255个字节自己实现如下: 0 && $len2 > 0) { if(mb_substr($str1, $i, 1) != mb_substr($str2, $i, 1)) { break; } $i++

2011-03-07 16:41:00 902

转载 RFC1945 HTTP1.0协议中文版

<br />版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明<br />http://haoren.blogbus.com/logs/182145.html<br />RFC1945 HTTP1.0协议中文版<br />组织:中国互动出版网(http://www.china-pub.com/)<br />RFC文档中文翻译计划(http://www.china-pub.com/compters/emook/aboutemook.htm)<br />E-mail:ouyan

2010-11-05 10:00:00 589

原创 调用symfony doctrine 生成的 form出错

<br />代码很简单<br /> <br />class customerActions extends sfActions{ public function executeRegister(sfWebRequest $request){ $this->form = new CustomerForm(); }}<br />Customer由task, doctrine:build-forms自动生成。<br /> <br />本想节约时间的,没想到竟然出错了。。。不知因何原因

2010-07-16 17:42:00 436

转载 select函数和Web server

<br />很好的文章,解释了select函数在web server上的应用:<br /> <br />http://www.lowtek.com/sockets/select.html

2010-07-07 14:45:00 234

原创 使用mod_cache来提升服务器性能

<br />apache的模块里面有一个cache_module模块,这个模块可用于缓存一个url的内容,进而提高服务器的性能。参考(http://httpd.apache.org/docs/2.1/caching.html)<br /> <br />配置比较简单,首先确保<br /> <br />LoadModule cache_module modules/mod_cache.so<br />LoadModule disk_cache_module modules/mod_disk_cache.so<b

2010-06-23 12:03:00 430

原创 CRC Card 建模

了解了一些关于CRC Card建模的知识,下面是从网上找到的资料: http://blog.csdn.net/onight/archive/2009/12/01/4913065.aspx 有人相信通过这种互动的方式,可以更好的进行系统建模,甚至有人提出离开电脑,直接用乐高积木来建模:)

2010-03-09 10:21:00 835

原创 The Five Cookie Names and Types Used by Google Analytics

Cookie name     Time to live     Type Purpose__utma              24 months     first-party Stores domain and visitor identifiers                                                For example, uniqu

2010-02-26 11:13:00 212

原创 Mysql中的isolation level

Mysql中的事务可以运行在下面4个isolation level中,影响着select操作的结果: 1. Read Uncommitted事务可以读到其他事务没有提交的内容 2. Read Committed事务可以读到其他事务已经提交的内容 3. Repeatable ReadInnoDB的默认level,可以确保,在事务中每次执行的读操作返回的结果都与第一

2010-02-03 09:43:00 405

原创 动态添加Hidden控件,而不改写控件名称

我们有时候需要为一个表单动态的添加一些Hidden组件,作为数据传递,然而通过asp.net的controls.add方法添加的话,控件的名字会被改写,解决的方法就是通过Page.ClientScript.RegisterHiddenField这个方法来注册这些Hidden组件。 参见:http://www.codeproject.com/KB/aspnet/ASPNETinsertH

2010-01-22 11:17:00 301

原创 关于DataMapping

Data Mapping主要需要解决下面2个问题: 1. 对象之间的关系对象和对象之间的关系可分为1:1,1:N, N:N,对于前2者,可以使用数据库的外键的方式,将相关的对象关联起来,对于N:N的关系,则需要建立额外的表来映射他们的关系。 2.继承对于对象之前的继承关系,在建数据表的时候有三种表达方式,分别是Single Table, Concrete Table和Cla

2010-01-22 10:15:00 607

原创 关于SSL证书

关于SSL证书网上信息太乱了,查了一下资料,可以这样理解: 1.填一个申请表2.跑那些认证过的CA那里,他们签一下之后,这个信息就变成了你的证书拉3.在服务器上安装之 当一个用户通过浏览器访问你的https地址的时候,服务器会把安装的证书发给用户,客户端的浏览器会用已安装的那些个公钥尝试解密,一旦成功,就需要比对一下,现在浏览的地址和你证书里面的地址是不是一致,不一样的话,

2010-01-18 18:11:00 208

原创 15 Most Important Considerations when Choosing a Web Development Framework

http://net.tutsplus.com/tutorials/other/15-most-important-considerations-when-choosing-a-web-development-framework/

2009-12-08 17:36:00 222

原创 使用Gravatar来保存你的头像

http://en.gravatar.com/

2009-12-08 17:16:00 257

原创 关于Firefox的extension开发

今天下午心血来潮,抽空看了一下FF的扩展开发,这里把一个下午的收获列一下: 首先先要在本地建立一个开发环境,参考https://developer.mozilla.org/en/Setting_up_extension_development_environment 接着需要了解一下extension的文件结构,参考https://developer.mozilla.org

2009-12-04 17:42:00 446

原创 一则关于Apache中的Rewrite

今天打算研究一下Apache下的Rewrite模块,没想到。。。 这是我的.htaccess文件内容 Options +FollowSymLinksRewriteEngine OnRewriteRule ^(.*)$ magicurl.php?path=$1  这是我magicurl.php下面的内容:<?phpvar_dump($_GET);?>

2009-11-09 17:53:00 349

原创 PHP实现圆角图片

工作中用到,自己写了一个,分享给有需要的人,前面是类定义,后面2行是调用。 优点:不需要外部图片支持PNG透明可自定义圆角半径 不足:只能指定一种透明色     <?phpclass RoundedCorner { private $_r; private $_g; private $_b; private $_image_p

2009-11-05 09:54:00 2815 3

原创 foursquare

 可以运行在iphone,android或者其他的手机(通过网页),一旦登陆,就能看到当前登陆的好友的位置,查看他们常去的地方。另外,他还会根据你的当前位置,推荐别人推荐的餐厅,咖啡馆,shopping mall,你可以为你去过的地方打分,随着分数的积累,你可以获得相应的奖章,比如K歌之王,另外还有一个mayor的称号,ms就是一群朋友中,去一个地方最多的人,拥有这个称号的人,可以免费得到

2009-10-26 10:05:00 376

原创 通过ZCE考试

虽然考试过程出现一些意外,但最终还是通过了考试,晚上回家,爸爸特地买了2个螃蟹给我吃,特此留念。

2009-10-24 21:50:00 221

转载 PHP – Take advantage of language constructs

Fastest things in PHP are the language constructs.They are highly optimized in the interpreterDon’t require calling external librariesDon’t call a function if there is a language constr

2009-10-22 14:22:00 239

转载 php_value, php_flag, php_admin_value, php_admin_flag

php_value name value Sets thevalue of the specified directive. Can be used only with PHP_INI_ALL andPHP_INI_PERDIR type directives. To clear a previously set value usenone as the value.

2009-10-22 13:53:00 947

原创 国内电子商务网站列表

不定期更新: 书:China-Pub99书城 综合:当当网卓越网我买网哈乐购1号店e家商城 家电:苏宁易购 C2C:淘宝网      

2009-09-10 17:53:00 246

空空如也

空空如也

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

TA关注的人

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