<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pep&#039;s Top Blog</title>
	<atom:link href="http://www.peptop.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peptop.com</link>
	<description>The more we share, the more we have!</description>
	<lastBuildDate>Sun, 10 Jul 2011 09:50:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Free Google Plus (Google+) Invitations</title>
		<link>http://www.peptop.com/web/free-google-plus-invitations/</link>
		<comments>http://www.peptop.com/web/free-google-plus-invitations/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 09:50:32 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=179</guid>
		<description><![CDATA[Send free Google Plus invitations to people and the experience of successful login to Google Plus. ]]></description>
			<content:encoded><![CDATA[<p>Received Google Plus invitation many days ago, but when I logged in, Google always says we&#8217;ve temporarily exceeded our capacity. Please try again soon.</p>
<p style="text-align: center;">
<img class="aligncenter" src="/wp-content/uploads/2011/07/keep-me-posted.png" alt="google plus keep me posted" width="325" height="308" /></p>
<p>In the following days, I just opened https://plus.google.com every day and clicked &#8220;Keep Me Posted&#8221; many times. Finally, I logged into Google Plus successfully today.</p>
<p>Then I invited my friend, and he received the invitation email from Google Plus immediately. Fortunately, he successful login to Google Plus without any more attempts. </p>
<p>So today should be the opening day of Google Plus, if you want a free invitation of Google Plus, just give me your Google account.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/web/free-google-plus-invitations/feed/</wfw:commentRss>
		<slash:comments>192</slash:comments>
		</item>
		<item>
		<title>Google Doodle Guitar Demo and Source Code</title>
		<link>http://www.peptop.com/web/google-doodle-guitar-demo-and-source-code/</link>
		<comments>http://www.peptop.com/web/google-doodle-guitar-demo-and-source-code/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 12:23:46 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Google Doodle]]></category>
		<category><![CDATA[Guitar]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=169</guid>
		<description><![CDATA[Provides extracted Guitar source code from Google Doodle, including online demo and JavaScript source code package to download.]]></description>
			<content:encoded><![CDATA[<p>To celebrate Lester William Polsfuss (June 9, 1915 – August 12, 2009) &#8211; known as Les Paul who was a legendary jazz guitarist has been his 96th birthday, Google has created a musical doodle which reflects his guitar legacy.</p>
<p>Via this doodle, a guitar like Google logo, you can play and listen, you can also bang out chords and tunes by clicking on the &#8220;keyboard&#8221; icon.<br />
As the doodle is so awesome, I decided to get the source and keep it forever.</p>
<p>Here comes the online demo and source code of Google doodle guitar for researching and collection, Google owns all rights.<br />
<span id="more-169"></span></p>
<h4>Google Doodle Guitar Online Demo:</h4>
<p><iframe src="/wp-content/uploads/guitar/google-guitar.htm" height="340px" width="660px" style="overflow:hidden" frameborder="0" ></iframe></p>
<div style="color:red">Google Doodle Guitar updated today!, now you can record and replay the tunes you played!</div>
<h4>Google Doodle Recordable Guitar Online Demo:</h4>
<p><iframe src="/wp-content/uploads/guitar/recordable-guitar.htm" height="360px" width="660px" style="overflow:hidden" frameborder="0" scrolling="no"></iframe></p>
<h4>Google Doodle Guitar Source Code:</h4>
<p><a href="/wp-content/uploads/guitar/google-guitar.zip" >Google Doodle Source Code</a></p>
<p>Just use a iframe tag to include the google-guitar.htm or recordable-guitar.htm, you can has the effect in your own site.</p>
<h4>My Google Doodle Guitar Has No Sound, Why?</h4>
<p>Maybe you will not listen any music when you play this doodle in your local computer for the security reason of flash, after upload these codes to the server, it works OK, and was tested on IE/FF/Chrome .<br />
If you want to play it in local, you can change the flash security settings at <a href="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html" rel="nofollow" target="_blank">http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html</a><br />
Just add the path of guitar11.swf to the Security panel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/web/google-doodle-guitar-demo-and-source-code/feed/</wfw:commentRss>
		<slash:comments>79</slash:comments>
		</item>
		<item>
		<title>Resolve YOURLS V1.5 cannot Edit or Delete Links</title>
		<link>http://www.peptop.com/web/resolve-yourls-cannot-edit-or-delete-links/</link>
		<comments>http://www.peptop.com/web/resolve-yourls-cannot-edit-or-delete-links/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 04:55:39 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[YOURLS]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=158</guid>
		<description><![CDATA[YOURLS is a nice and powerful PHP URL shorten scripts, but some users can't use the Edit or Delete buttons in the new version, this article give the reason and the resolution way.]]></description>
			<content:encoded><![CDATA[<p>YOURLS is a nice and powerful PHP scripts that will allow you to run your own URL shortening service. You can make it private or public, pick custom keyword URLs. </p>
<p>With some simple steps, I installed YOURLS 1.5 (the latest and featured version) on my Linux VPS successfully.</p>
<p>When I logged in the admin panel, I was attracted by the simple and beautiful interface. However I found I can&#8217;t use the Edit and Delete buttons in the panel, it seems the AJAX functions doesn&#8217;t work properly.<br />
<span id="more-158"></span><br />
After some searching with Google, I found many users occurred the same problem as mentioned above. For example, there is a thread on Google Code, http://code.google.com/p/yourls/issues/detail?id=587 .</p>
<p>And the author OZH gave a resolution on http://code.google.com/p/yourls/wiki/EndlessSpinningIcon , but it not works, because I wasn&#8217;t facing the problem of Endless Spinning Icon.</p>
<p>So I decided to see what had happened.<br />
By using FireBugs, I found the AJAX returned &#8220;omg error&#8221; which caused by the following code in admin-ajax.php:<br />
<code>	case 'edit_display':<br />
		yourls_verify_nonce( 'edit-link_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' );<br />
</code><br />
The $_REQUEST['nonce'] was null so the verify was always failed.</p>
<p>And this issue was caused by the following code in insert.js<br />
<code>	var nonce = get_var_from_query( $('#edit-button-'+id).attr('href'), 'nonce' );</code></p>
<p>The JQuery can&#8217;t select the correct id, if I replaced with getElementById(), it works.</p>
<p>Well, I found the edit button&#8217;s IDs which the script generated were something like this &#8220;1234.000000&#8243;, it contained &#8220;.&#8221; so JQuery selector didn&#8217;t work.</p>
<p>After reading some codes, I know the IDs was generated by function yourls_string2int( $string, $chars = null ) in functions.php .</p>
<p><code>function yourls_string2int( $string, $chars = null ) {<br />
	if( $chars == null )<br />
		$chars = yourls_get_shorturl_charset();<br />
	$integer = 0;<br />
	$string = strrev( $string  );<br />
	$baselen = strlen( $chars );<br />
	$inputlen = strlen( $string );<br />
	for ($i = 0; $i < $inputlen; $i++) {<br />
		$index = strpos( $chars, $string[$i] );<br />
		$integer = bcadd( $integer, bcmul( $index, bcpow( $baselen, $i ) ) );<br />
	}<br />
	return yourls_apply_filter( 'string2int', $integer, $string, $chars );<br />
}<br />
</code></p>
<p>This function is to convert a string (3jk) to an integer (1337) by baselen 36 or 62 which defined in config.php . </p>
<p>However there is an optional scale parameter of bcadd which is used to set the number of digits after the decimal place in the result.</p>
<p>"You can also set the global default scale for all functions by using bcscale()." wrote by PHP manual.<br />
This is the reason why some people can't use Edit or Delete buttons but the authors can. </p>
<p>Just change the line<br />
<code>$integer = bcadd( $integer, bcmul( $index, bcpow( $baselen, $i ) ) );</code><br />
to<br />
<code>$integer = bcadd( $integer, bcmul( $index, bcpow( $baselen, $i ) ) ,0 );</code><br />
Upload and overwrite the functions.php, refresh the admin panel, it will work.</p>
<p>Here is the modified functions.php if you don't want to modify it manually.<br />
Download it, unzip it, and overwrite the functions.php in folder "includes".<br />
<a href="/wp-content/uploads/2011/functions.zip">functions.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/web/resolve-yourls-cannot-edit-or-delete-links/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Google Instant and Baidu Box Computing</title>
		<link>http://www.peptop.com/web/google-instant-and-baidu-box-computing/</link>
		<comments>http://www.peptop.com/web/google-instant-and-baidu-box-computing/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 05:58:54 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=147</guid>
		<description><![CDATA[Introduced what is Google Instant and Baidu Box Computing, the example and comparing of the new two technologies.]]></description>
			<content:encoded><![CDATA[<p>Google, the biggest search engine in the world, and Baidu, the biggest one in China bring us two new technologies called Google Instant and Baidu Box Computing.</p>
<p>After some experiencing, I found something interesting.<span id="more-147"></span></p>
<h3>What is Google Instant</h3>
<p>&#8220;Google Instant is a new search enhancement that shows results as you type&#8221;, defined by Google.</p>
<p>In fact, I think Google Instant is the combination of Google Suggestion and real time search technology.<br />
When you are typing key words in the Google search  box,  the Google will shows suggestion in the box and shows a results page real time.</p>
<p>For example:<br />
<img class="aligncenter size-full" title="google-instant" src="/wp-content/uploads/2010/09/google-instant.gif" alt="Google Instant Example" width="675" height="581" /><br />
If you want to search a famous game &#8220;plants vs zombies&#8221;, you just need type &#8220;plant&#8221;, google will have shown the search results for you, you even needn&#8217;t type &#8220;Enter&#8221; or click &#8220;Search&#8221; button.</p>
<p>&#8220;Google Instant can save 2-5 seconds per search&#8221;, they estimate if everyone uses Google Instant globally, this will save more than 3.5 billion seconds a day.</p>
<h3>Let&#8217;s Look What is Baidu Box Computing</h3>
<p>Through Baidu Search Open Platform, webmasters can submit applications as data feeds to Baidu that may appear above Baidu’s organic search results. Baidu’s box computing is about enabling Baidu’s users to create user-generated content (UGC) that will show up within Baidu’s SERP.</p>
<p>Fox example:<br />
<img class="aligncenter size-full" title="baidu-box-computing" src="/wp-content/uploads/2010/09/baidu-box-computing.gif" alt="Baidu Box Computing Example" width="607" height="700" /><br />
If you want to search a famous Chinese game &#8220;LinLink&#8221;, when you finish typing and click &#8220;Search&#8221; button, Baidu.com will return the contents who cooperate with Baidu, and you can play the game&#8217;s flash version in the Baidu Box, users needn&#8217;t open any other websites.</p>
<p>Many webmasters in China worry, those who doesn&#8217;t cooperate with Baidu will lose a lot of traffic and die immediately, those who cooperate with Baidu will lose a lot of traffic and die slowly.<br />
We won&#8217;t wait too long to see the result that there is only one website Baidu left in China.</p>
<h3>Comparing the two new technologies</h3>
<p>From above introduction, Google is focusing on how to speed up the searching process, and brings users to their target websites ASAP.<br />
Baidu is focusing on how to attract and retain users on their own website baidu.com .</p>
<p>Let&#8217;s wait and see what will happen in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/web/google-instant-and-baidu-box-computing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Study Notes – Storing and Retrieving Data</title>
		<link>http://www.peptop.com/web/php-study-notes-storing-retrieving-data/</link>
		<comments>http://www.peptop.com/web/php-study-notes-storing-retrieving-data/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 14:36:02 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Study Notes]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=141</guid>
		<description><![CDATA[Storing and retrieving data section of the PHP study notes, including reading and writing data via file functions, introduced many useful file functions, such as fopen, fclose, fread, and fwrite, etc.]]></description>
			<content:encoded><![CDATA[<p>Chapter 2 , introduced how to open, read, write, lock, close a file and other useful file functions.<br />
<span id="more-141"></span></p>
<h3>Opening a File</h3>
<h4>Using fopen() to Open a File</h4>
<p>fopen() definition:<br />
<code>resource fopen ( string $filename , string $mode [, bool $use_include_path = false [, resource $context ]] )</code></p>
<p>fopen() examples:<br />
<code>$handle = fopen("/home/rasmus/file.txt", "r");<br />
$fp = fopen("$_SERVER['DOCUMENT_ROOT']/../orders/orders.txt",'w'); </code></p>
<h4>Summary of File Modes for fopen()</h4>
<table>
<thead>
<tr>
<th>mode</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>&#8216;r&#8217;</td>
<td>Open for reading only; place the file pointer at the beginning of the file.</td>
</tr>
<tr>
<td>&#8216;r+&#8217;</td>
<td>Open for reading and writing; place the file pointer at the beginning of the file.</td>
</tr>
<tr>
<td>&#8216;w&#8217;</td>
<td>Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.</td>
</tr>
<tr>
<td>&#8216;w+&#8217;</td>
<td>Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.</td>
</tr>
<tr>
<td>&#8216;a&#8217;</td>
<td>Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.</td>
</tr>
<tr>
<td>&#8216;a+&#8217;</td>
<td>Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.</td>
</tr>
<tr>
<td>&#8216;x&#8217;</td>
<td>Create and open for writing only; place the file pointer at the beginning of the file.<br />
If the file already exists, the fopen() call will fail by returning FALSE, and PHP will generate a warning.<br />
If the file does not exist, attempt to create it.</td>
</tr>
<tr>
<td>&#8216;x+&#8217;</td>
<td>Create and open for reading and writing; place the file pointer at the beginning of the file.<br />
If the file already exists, the fopen() call will fail by returning FALSE, and PHP will generate a warning.<br />
If the file does not exist, attempt to create it.</td>
</tr>
<tr>
<td>&#8216;b&#8217;</td>
<td>Used in conjunction with one of the other modes. Opening file in binary mode, recommend. It is the default mode.</td>
</tr>
<tr>
<td>&#8216;t&#8217;</td>
<td>Used in conjunction with one of the other modes. Opening file in text mode, not recommend.</td>
</tr>
</tbody>
</table>
<h4>Other Points Requiring Attention</h4>
<ul>
<li>You can open files via FTP, HTTP, and other protocols using fopen(). You can disable this capability by turning off the allow_url_fopen directive in the php.ini file.</li>
<li>The scripts must has permission to access the file you are trying to use.</li>
</ul>
<h3>2. Reading and Writing Files</h3>
<h4>Reading from a File</h4>
<p><code>string fgets ( resource $handle [, int $length ] )</code>Gets a line from file pointer.</p>
<p><code>string fgetss ( resource $handle [, int $length [, string $allowable_tags ]] )</code>Identical to fgets(), except that fgetss() attempts to strip any NUL bytes, HTML and PHP tags from the text it reads.</p>
<p><code>array fgetcsv ( resource $handle [, int $length [, string $delimiter = ',' [, string $enclosure = '"' [, string $escape='\\']]]] )</code>Similar to fgets() except that fgetcsv() parses the line it reads for fields in CSV format and returns an array containing the fields read.</p>
<p><code>string fgetc ( resource $handle )</code>Gets a character from the given file pointer.</p>
<p><code>string fread ( resource $handle , int $length )</code>Reads up to length bytes from the file pointer referenced by handle.</p>
<p><code>int readfile ( string $filename [, bool $use_include_path = false [, resource $context ]] )</code>Reads a file and writes it to the output buffer.</p>
<p><code>int fpassthru ( resource $handle )</code>Reads to EOF on the given file pointer from the current position and writes the results to the output buffer.</p>
<p><code>array file ( string $filename [, int $flags = 0 [, resource $context ]] )</code>Reads an entire file into an array, each element of the array corresponds to a line in the file, with the newline still attached.</p>
<p><code>string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen = -1 ]]]] )</code>This function is similar to file(), except that file_get_contents() returns the file in a string , starting at the specified offset up to maxlen bytes.</p>
<h4>Writing to a File</h4>
<p><code>int fwrite ( resource $handle , string $string [, int $length ] )</code>Writes the contents of string to the file stream pointed to by handle.</p>
<p><code>int file_put_contents ( string $filename , mixed $data [, int $flags = 0 [, resource $context ]] )</code>This function is identical to calling fopen(), fwrite() and fclose() successively to write data to a file. If filename does not exist, the file is created. Otherwise, the existing file is overwritten, unless the FILE_APPEND flags is set.</p>
<h4>Navigating Inside a File</h4>
<p><code>bool rewind ( resource $handle )</code>Sets the file position indicator for handle to the beginning of the file stream.</p>
<p><code>int fseek ( resource $handle , int $offset [, int $whence = SEEK_SET ] )</code>Sets the file position indicator for the file referenced by handle. The new position, measured in bytes from the beginning of the file, is obtained by adding offset to the position specified by whence.</p>
<p><code>int ftell ( resource $handle )</code>Returns the position of the file pointer referenced by handle.</p>
<p><code>bool feof ( resource $handle )</code>Tests for end-of-file on a file pointer.</p>
<h3>3. Other Useful File Functions</h3>
<p><code>bool fclose ( resource $handle )</code>The file pointed to by handle is closed.</p>
<p><code>bool file_exists ( string $filename )</code>Checks whether a file or directory exists.</p>
<p><code>int filesize ( string $filename )</code>Gets the size for the given file.</p>
<p><code>bool unlink ( string $filename [, resource $context ] )</code>Deletes filename. There is no function called delete.</p>
<p><code>bool flock ( resource $handle , int $operation [, int &amp;$wouldblock ] )</code>Locks or releases a file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/web/php-study-notes-storing-retrieving-data/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Study Notes &#8211; Crash Course</title>
		<link>http://www.peptop.com/web/php-study-notes-crash-course/</link>
		<comments>http://www.peptop.com/web/php-study-notes-crash-course/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 09:08:15 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Study Notes]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=129</guid>
		<description><![CDATA[Crash course section of the PHP study notes, including the PHP tag styles, comment styles, variables, constants, variable scope, variables related functions, conditional statements, operators, and an overview of precedence.]]></description>
			<content:encoded><![CDATA[<p>Chapter 1 , from a  C/C++ programmer&#8217;s point of view, introduced the PHP basic syntax, variables, constants, variables and constants scope, operator, operator precedence, variable functions, conditional statements, etc for Crash Course.<br />
<span id="more-129"></span></p>
<h3>1. Basic Syntax</h3>
<h4>PHP Tags</h4>
<ul>
<li>XML style (recommended):<br />
<code>&lt;?php echo '&lt;p&gt;Order processed.&lt;/p&gt;'; ?&gt;</code></li>
<li>Short style (need to enable short_open_tag setting):<br />
<code>&lt;? echo '&lt;p&gt;Order processed.&lt;/p&gt;'; ?&gt;</code></li>
<li>Script style:<br />
<code>&lt;script language='php'&gt; echo '&lt;p&gt;Order processed.&lt;/p&gt;'; &lt;/script&gt;</code></li>
<li>ASP style (Need to enable asp_tags setting, not recommended):<br />
<code>&lt;% echo '&lt;p&gt;Order processed.&lt;/p&gt;'; %&gt;</code></li>
</ul>
<h4>Comments</h4>
<ul>
<li>Multiline comments: /*&#8230;*/</li>
<li>single-line comments: //&#8230; or #&#8230;</li>
</ul>
<h3>2. Variables</h3>
<h4>Identifiers Naming Rules</h4>
<ul>
<li>Variables must start with $</li>
<li>Identifiers can be of any length and can consist of letters, numbers, and under-scores</li>
<li>Identifiers cannot begin with a digit</li>
<li>In PHP, identifiers are case sensitive</li>
<li>Function names are not case sensitive, and a variable can have the same name as a function (not make sense enough)</li>
</ul>
<h4>Variable Types</h4>
<p>PHP supports the following basic data types: Integer, Float, String, Boolean, Array, Object.<br />
Two special types are also available: NULL and Resource.</p>
<p>PHP is called weakly typed, or dynamically typed language. So when you needn&#8217;t explicitly specify the type when you declare a variable, PHP changes the variable type according to what is stored in it at any given time. In addition, the variables need not declare a variable before using it.</p>
<h4>Variable Variables</h4>
<p>Variable variables enable you to change the name of a variable dynamically.<br />
<code>$varname = 'tireqty';<br />
$$varname = 5;<br />
This is exactly equivalent to<br />
$tireqty = 5;</code></p>
<h3>3. Constants</h3>
<h4>Declaring Constants</h4>
<p><code>define('USER_NAME', 'admin');<br />
define('IS_ADMIN', TRUE); </code></p>
<h4>Data Type</h4>
<p>Constants can store only boolean, integer, float, or string data.</p>
<h4>Using Constants</h4>
<p>You needn&#8217;t type a &#8220;$&#8221; before a constant name.</p>
<h3>4. Variable and Constant Scope</h3>
<ul>
<li>Built-in superglobal variables are visible everywhere within a script.</li>
<li>Constants, once declared, are always visible globally; that is, they can be used inside and outside functions.</li>
<li>Global variables declared in a script are visible throughout that script, but not inside functions except you declare global refer:<br />
<code>&lt;?php<br />
$a = 1;<br />
$b = 2;<br />
function Sum()<br />
{<br />
global $a, $b;	//global refer<br />
$b = $a + $b;<br />
}<br />
Sum();<br />
echo $b;	//Output result is 3<br />
?&gt;</code></li>
<li>Variables created inside functions are local to the function and cease to exist when the function terminates.</li>
<li>Variables created inside functions and declared as static are invisible from outside the function but keep their value between one execution of the function and the next.</li>
</ul>
<h3>5. Operators</h3>
<h4>Arithmetic Operators</h4>
<p>Including &#8220;+,-,*,/,% (Modulus) &#8220;.</p>
<h4>String Operators</h4>
<p>&#8220;.&#8221;  String concatenation operator adds two strings and generates and stores a result.</p>
<h4>Assignment and Combined Assignment Operators</h4>
<p>Including &#8220;=,+=,-=,*=,/=,%=,.=&#8221;, similar to the C language.</p>
<h4>Self-increment and Self-decrement Operators</h4>
<p>Including &#8220;++,- -&#8221;, like the C language, just understand the difference between $a++ and ++a$.</p>
<h4>Reference Operator</h4>
<p><code>$a = 5;<br />
$b = &amp;$a;<br />
$a = 7; // $a and $b are now both 7<br />
</code></p>
<h4>Comparison Operators</h4>
<p>Including &#8220;==,===,!=,!==,&lt;&gt;,&lt;,&gt;,&lt;=,&gt;=&#8221;.<br />
Note that &#8220;7&#8243; == 7 return TRUE, while 7 === &#8220;7&#8243; returns False, because the identical operator (===), which returns true only if the two operands are both equal and of the same type.</p>
<h4>Logical Operators</h4>
<p>Including &#8220;!, &amp;&amp;, ||, and, or, xor&#8221;, similar to the C language.</p>
<h4>Bitwise Operators</h4>
<p>Including &#8220;~, &amp;, |, ^, &gt;&gt;, &lt;&lt;&#8221;, similar to the C language.</p>
<h4>Other Operators</h4>
<ul>
<li>&#8220;,,new,-&gt;,(?:)&#8221;  similar to the C language.</li>
<li>&#8220;@&#8221; The error suppression operator (@) can be used in front of any expression.</li>
<li>&#8220;` `&#8221; The execution operator is really a pair of operators—a pair of backticks (&#8220;) , PHP attempts to execute whatever is contained between the backticks as a command at the server’s command line.</li>
</ul>
<h3>6. Operator Precedence</h3>
<p>No need to remember precedence and associativity, you can use parentheses when you are uncertain.</p>
<h3>7. Variables and Types Related Functions</h3>
<ul>
<li>string gettype(mixed var); //Returns a string containing the type name</li>
<li>bool settype(mixed var, string type); //change the type of the var</li>
<li>bool is_array(mixed var); //Checks whether the variable is an array</li>
<li>bool  is_long(mixed var); / is_int() / is_integer() //Checks whether the variable is an integer</li>
<li>bool is_double(mixed var); / is_float() / is_real() //Checks whether the variable is a float</li>
<li>bool is_scalar(mixed var); //Checks whether the variable is a scalar, that is, an integer, boolean, string, or float</li>
<li>bool is_callable(mixed var); //Checks whether the variable is the name of a valid function</li>
<li>There are similar functions like is_string(), is_bool(), is_object(), is_resource(), is_null() etc.</li>
<li>bool isset ( mixed var [, mixed var [, ...]]); //Returns true if it exists and false otherwise</li>
<li>void unset ( mixed var [, mixed var [, ...]]); //Gets rid of the variable it is passed</li>
<li>bool empty ( mixed var [, mixed var [, ...]]); //Checks to see whether a variable exists and has a nonempty, nonzero value</li>
</ul>
<h3>8. Conditional statements</h3>
<ul>
<li>if/elseif/else</li>
<li>switch</li>
<li>while/do&#8230;while</li>
<li>for/foreach</li>
<li>break</li>
</ul>
<p>All these conditional and loop statements are similar to other programming languages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/web/php-study-notes-crash-course/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Study Notes</title>
		<link>http://www.peptop.com/web/php-study-notes/</link>
		<comments>http://www.peptop.com/web/php-study-notes/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 08:37:59 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Study Notes]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=125</guid>
		<description><![CDATA[Include introduction of "PHP and MySQL Web Development 4th Edition" and the directory of  PHP study notes.]]></description>
			<content:encoded><![CDATA[<p>For PHP, I can read it, modify it, but can not write it, after the World Cup, I intend to make a systematic study of PHP.<br />
The reference book is &#8220;PHP and MySQL Web Development 4th Edition&#8221; written by Luke Welling and Laura Thomson, this book is known as  &#8220;PHP Bible&#8221; .</p>
<p>As usual, the book briefly introduced what is PHP, MySQL, Why use PHP / MySQL, as well as their strengths and so on, quickly scanned.</p>
<p>Followed by What is new in PHP5:</p>
<ul>
<li> Better object-oriented support built around a completely new object model</li>
<li> Exceptions for scalable, maintainable error and exception handling </li>
<li> built-in SimpleXML for easy handling of XML data </li>
</ul>
<p>And key features of PHP 5.3 (At the time of writing, PHP 5.2 was the current version) for example, namespaces (very important) and so on.<span id="more-125"></span></p>
<h3> Directory of PHP Study Notes </h3>
<ol>
<li> <a href="/web/php-study-notes-crash-course/">PHP Crash Course</a> </li>
<li> <a href="/web/php-study-notes-storing-retrieving-data/">Storing and Retrieving Data</a> </li>
<li> Using Arrays </li>
<li> String Manipulation and Regular Expressions </li>
<li> Reusing Code and Writing Functions</li>
<li> Object-Oriented PHP </li>
<li> Error and Exception Handling </li>
<li> &#8230;&#8230;</li>
<li> To be added </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/web/php-study-notes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Doodle Pac-Man Source Code</title>
		<link>http://www.peptop.com/web/google-doodle-pac-man-source-code/</link>
		<comments>http://www.peptop.com/web/google-doodle-pac-man-source-code/#comments</comments>
		<pubDate>Sat, 22 May 2010 07:09:29 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Google Doodle]]></category>
		<category><![CDATA[PacMan]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=113</guid>
		<description><![CDATA[Provides extracted Pac-Man game source code from Google Doodle, including online demos and JavaScript source code package to download.]]></description>
			<content:encoded><![CDATA[<p>Google has unveiled a Pac-Man doodle to celebrate the game&#8217;s 30th anniversary. You can play the game on the Google homepage.</p>
<p>The Logo on the homepage of Google can be used directly as a Pac-Man game to play, to support double and  to support keyboard / mouse operation, a total of more than 200 levels.</p>
<p>Here is the online demo provided by <a href="http://www.peptop.com/">Pep</a> for researching and collection. Google owns all rights.<br />
Click &#8220;Insert Coin&#8221; to start the game, click twice to start the double game, tested OK in IE / FireFox / Chrome .</p>
<h4>Google Pac-Man Online Demo:</h4>
<p><iframe src="/wp-content/uploads/pacman/pacman.html" height="340px" width="660px" style="overflow:hidden" frameborder="0" ></iframe></p>
<h4>Google Pac-Man Source Code:</h4>
<p><a href="/wp-content/uploads/pacman/pacman.zip" >JavaScript Source Code of Google Pac-Man Doodle</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/web/google-doodle-pac-man-source-code/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to Use Self Sign Free SSL Cert on Nginx</title>
		<link>http://www.peptop.com/web/self-sign-free-ssl-cert/</link>
		<comments>http://www.peptop.com/web/self-sign-free-ssl-cert/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 08:39:12 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[Nginx Configuration]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=105</guid>
		<description><![CDATA[Described in Debian5 OS, OpenSSL module, Nginx environment, how to self sign a SSL digital certificates by free, and how to configure Nginx, visit the website with HTTPS protocol.]]></description>
			<content:encoded><![CDATA[<p>As the HTTP protocol transfer information with plain data, some websites such as shopping, transaction, login and register need to open the HTTPS protocol to increase security, ensure important data like password will not be intercepted and sniffed.</p>
<p>HTTPS need the support of SSL digital certificate, almost every browser trusted CA organizations charge fees when sign digital certificates, and the price is generally 13 U.S. dollars to 50 U.S. dollars per year. (Except StartSSL and PositiveSSL)</p>
<p>If the certificate only for the own use, to prevent the online management of your password has been tapped, you can self sign SSL digital certificate by free.<br />
On Debian5 + OpenSSL + Nginx environment, just follow these steps:<span id="more-105"></span></p>
<h3>1. Generate SSL digital certificate with OpenSSL</h3>
<p><code class="command">openssl genrsa -out privkey.pem 2048<br />
openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095<br />
</code><br />
The first command is to generate the user certificate RSA key pair, and not with a password.<br />
The second command is to generate and self sign certificate. At this time, you will be asked to input parameters, random fill, but the Common Name must fill in the domain name of your website, for example: *. yourdomain.com.</p>
<h3>2. Configure and compile Nginx with SSL module</h3>
<p>The Nginx does not support SSL by default, so we need re-configure and compile it, the commands are as follows:<br />
<code class="command">wget http://nginx.org/download/nginx-0.7.65.tar.gz<br />
tar zxvf nginx-0.7.65.tar.gz<br />
cd /root/nginx-0.7.65<br />
./configure --with-http_stub_status_module --with-http_ssl_module<br />
make<br />
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old<br />
cp ./objs/nginx /usr/local/nginx/sbin/nginx<br />
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`<br />
kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`<br />
</code><br />
Thees commands are actually a standard Nginx upgrade operation, you shloud replace the directories to your owns.<br />
In addition, you can also comment line CFLAGS = &#8220;$ CFLAGS-g&#8221; in auto/cc/gcc , so to compile Nginx not in Debug mode, saving file size and memory usage, improving the speed.</p>
<h3>3. Modify Nginx configuration file</h3>
<p>Modify corresponding server section in nginx.conf:<br />
<code>	server<br />
	{<br />
		listen 443;<br />
		ssl on;<br />
		ssl_certificate /etc/ssl/cacert.pem;<br />
		ssl_certificate_key /etc/ssl/privkey.pem;<br />
		server_name www.yourdoamin.com;<br />
		index index.html index.htm index.php;<br />
		root  /home/wwwroot/yourdomain;<br />
		......<br />
		......<br />
	}<br />
</code><br />
You should also change the path of pem files according to actual conditions.</p>
<h3>4. Restart Nginx</h3>
<p>Upload nginx.conf, then test the configuration file, and restart Nginx：<br />
<code class="command">/usr/local/nginx/sbin/nginx -t<br />
kill -HUP `cat /usr/local/nginx/logs/nginx.pid`<br />
</code></p>
<h3>5. Test your website with HTTPS</h3>
<p>Input https://www.yourdomain.com, you will see a security alert dialog like this:<br />
<img src="/wp-content/uploads/2010/03/ssl-cert-security-alert.png" alt="security alert dialog of SSL" /><br />
Because it is for own use, just click View Certificate &#8211; install the certificate, the browser will no longer pop up the alert box.</p>
<p>At this point, you can use the HTTPS protocol visit your website, do not worry about the user name and password will be sniffed during transmission.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/web/self-sign-free-ssl-cert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LinLink Official Theme &#8211; Mliho</title>
		<link>http://www.peptop.com/linlink/theme-mliho/</link>
		<comments>http://www.peptop.com/linlink/theme-mliho/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 13:12:24 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[LinLink]]></category>
		<category><![CDATA[LinLink Theme]]></category>
		<category><![CDATA[Mliho]]></category>

		<guid isPermaLink="false">http://www.peptop.com/?p=83</guid>
		<description><![CDATA[The introducation of LinLink official theme - Mliho, include features, authors and screenshot.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.linlink.net" rel="external"><img src="http://www.peptop.com/wp-content/uploads/2010/01/theme-mliho-thumbnail.jpg" alt="LinLink Official Theme Mliho" class="alignleft" /></a><br />
<h3>Key features: </h3>
<p>Animated Tile Images<br />
Different Background Pictures</p>
<h3>The authors:</h3>
<p>Skyker Software<br />
Mliho.com</p>
<p><span id="more-83"></span></p>
<h3 class="clear">How to install this theme:</h3>
<p><strong>Registered User</strong>: Enter LinLink 5&#8242;s theme mode, click the thumbnail of Mliho theme.<br />
<strong>Trial user</strong>: Download it from <a href="http://www.linlink.net/update/theme/Mliho.zip">here</a>, and unzip the file to LinLink 5&#8242;s theme directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.peptop.com/linlink/theme-mliho/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
