自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

hahaliu005的专栏

Make everything possible

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

原创 perl study note

I'm studing perl language , This is just a note when I read a book named learning Perl . for remember and check back.What Does Perl  Stand For?Perl is sometimes called the ¡°Practical Extraction and Report Language,¡± although ithas also been called a ¡°Pa

2011-04-25 23:29:00 644

原创 Get relative path

This function get the relative path , and it can worked in the windows operation system correctly , but in the other operation system like linux or others , it may had some problems , in addition , I don't test it in other system at all ./** * get the re

2011-04-17 15:47:00 708

原创 BOM header

When you use some editer like notepad etc to edit file and save it to encoding utf-8 , the editer will add a flag in the front of the file , use hexadecimal express was EF BB BF . So convenient in some condition , but in some PHP file , it will occur some

2011-04-16 16:22:00 1379

原创 Singleton Pattern

The Singleton Patter only instance the class one time , after that , we actually use the first instance object all the time.class DbConn { /** * static property to hold singleton instance */ static $instance = false; /** * constructor * p

2011-04-14 00:20:00 306

原创 The factory pattern

<br />In the factory pattern , it just like a factory , provide what you need . <br />This example imitate the phone factory , it produce three kind of phone .<br />/** * The abstract class phone * */abstract class phone{ protected $_name; prot

2011-04-13 23:32:00 228

转载 Regular expression

<br />RegExp Object<br />A regular expression is an object that describes a pattern of characters.<br />Regular expressions are used to perform pattern-matching and "search-and-replace" functions on text.Syntax<br />var patt=new RegExp(pattern,modifiers);<

2011-04-13 21:12:00 332

原创 Mysql transaction

<br />There's two ways for MYSQL transaction.<br />1、Use begin,rollback,commit<br />begin start a transaction<br />rollback transaction rollback<br />commit transaction commit<br />2、Set mysql ini autocommit<br />In default mysql will commit automatically.

2011-04-12 00:05:00 1224

原创 php socket

<br />Write a simple socket about S/C peers . With this simple code . we can associate more.<br /> <br />server.php file<br /><br /><?php$protocol = getprotobyname('tcp');//create a socket$socket = socket_create(AF_INET,SOCK_STREAM,$protocol);socke

2011-04-11 23:51:00 269

原创 delete all tagname

<br />Description:when use getElementByTagName('div'); the var divs was an object if you remove(div[i]) directly,<br />when you remove(div[0]),then div[1] will became div[0] ,then when you remove[1], it doesn't work.note.<br /> <br /><!DOCTYPE html><html

2011-04-11 23:46:00 253

原创 Five kinds of sort algorithm

<br />1.Insertion sort<br />Insert a data element to the new array every time , keep the new array still in order.<br />The insertion sort just like this :<br />Beware:I use php to achieve the sort function from small to large,for convenient I use few php

2011-04-11 23:34:00 337

转载 Choosing Optimal Data Types

<br />Smaller is usually better.<br />In general, try to use the smallest data type that can correctly store and repre-<br />sent your data. Smaller data types are usually faster, because they use less space<br />on the disk, in memory, and in the CPU cach

2011-04-11 15:26:00 196

原创 mysql advance query

Show table statusshow table status like 'table_name';A better way to change storage engineCREATE TABLE innodb_table LIKE myisam_table;ALTER TABLE innodb_table ENGINE=InnoDB;INSERT INTO innodb_table SELECT * FROM myisam_table;Create usergrant select,insert,

2011-04-11 15:15:00 359

原创 mysql trigger

<br />This is about a very simply trigger but which is very useful :<br />syntax:<br />CREATE TRIGGER <trigger name> <--<br />{ BEFORE | AFTER }<br />{ INSERT | UPDATE | DELETE }<br />ON <table name><br />FOR EACH ROW<br /><the sql general statement which

2011-04-10 20:38:00 401

原创 mysql join syntax

There are four kinds of join syntax:1.inner join;select * from table1 inner join table2 on table1.id = table2.id;it is the same as the normal sql:select * from table1,table2 where table1.id = taable2.id;2.left outer joinselect * from table1 left outer join

2011-04-10 20:35:00 279

原创 Test driven development and The value object pattern

Test driven development<br />With the value object pattern , First we should write a test file , and if use Zend Studio Editer we can generate test file from file | new | PHPUnit Test Case . Then the test file about four operations just like this:<br

2011-04-10 02:01:00 345

原创 buffer control

There are various kinds of buffer. buffer in PHP , in apache server , and in brower .There are something diferences.In PHP there are some function and option about buffer for example: ob_start().etc

2011-04-09 13:35:00 391

原创 session_unset and session_destroy

<br /><br />You can use session begin with session_start();<br />And then if you want to use session_start() again , it is not allowed;<br />To start another session ,you can use session_destroy() and session_unset() first.<br /><br /><br />ses

2011-04-09 13:29:00 393

转载 refresh a page

<br />If you want to redirect an user and tell him he will be redirected, e. g. "You will be redirected in about 5 secs. If not, click here." you cannot use header( 'Location: ...' ) as you can't sent any output before the headers are sent.<br /><br />

2011-04-09 13:25:00 244

原创 about empty() in php

<br /><br />For empty() you must set var like this:<br />$var = 'value':<br />empty($var);<br />If you use it directly like this :<br />empty('value');<br />It is error!<br />the $var be set under will return TRUE:<br />"" (an empty string)0 (0 as an integ

2011-04-09 13:10:00 256

原创 About insert sql on duplicate key update

Here was a useful insert sql like this :insert into `table` (`field1`,`field2`,`field3`) values('value1','value2','value3') on duplicate key update `id`=`id`,`count`=`count`+1;It means if the values of field1,field2,field3 value1, value2,value3 are exi

2011-04-09 12:56:00 338

原创 A simple maze function

I use php write a maze function , it based on algorithm of random travel graph .array( *this key defines the row * [5]=>array( *this key defines the col * [0]=>1, *top: the value 1 defines the directi

2011-04-08 14:36:00 318

原创 Recursion all file direction in a direction

Get all file direction and save it to an reference array, The function like below.function scanfile($dir,&$dir_array){ if (is_dir($dir)){ $scandirs = scandir($dir); foreach ($scandirs as $scandir){ if ($scandir != '.' and $scandir != '..'){

2011-04-08 12:56:00 344

空空如也

空空如也

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

TA关注的人

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