Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Array



  PHP Query String

Query string plays important role in building web applications, especially if you want to make nice urls without question mark and many key, value pairs, actually it is not so easy to design application with nice urls however it is always worth doing so, because it not only looks very proffessional, such URLs are search engine friendly, which means that they will get indexed faster but also it happens that search engines have problems with indexing pages with more then 3 key=value pairs in query...

   PHP,Query string,Request,Security     2011-10-01 02:23:15

  How does PHP session work?

This article is about how PHP session works internally. Below are the steps : 1. Session in PHP is loaded into PHP core as an extension, we can understand it as an extension. When session extension is loaded, PHP will call core functions to get the session save_handler, i.e interface or functions for reading and writing session data. By default, PHP will handle session data by writing and reading files on the server. But PHP also supplies custom methods for handling session data, we can use sess...

   PHP, session, mechanism     2012-12-28 13:36:49

  Handy PHP functions should be in your toolkit

When developing projects, there are always some common work should be accomplished, for example, encrption/decryption, get IP. As a PHP developer, you should have a list of the handy functions in your toolkit so that you can pick up in every project you work on. Here is a summary of some handy PHP functions. 1. PHP encryption/decryption Encryption/decryption can be used when storing user confidential information such as passwords. Below function uses base64 and MD5 to accomplish encryption/decry...

   PHP,function,real IP,SQL injection     2014-12-06 08:46:08

  Automatically post to Facebook from PHP script

Facebook is currently on of the most important publishing and traffic generating sources for many websites. Manually Cross publishing content on your own site and Facebook seems like a lot of extra work. This post guides you through the creation of a Facebook application that can automatically post messages and other types of content on your Facebook wall. Getting started Building a php script that automatically posts status updates on your wall requires the following steps: Download Faceboo...

   PHP,Facebook,API,Auto post,OAuth     2012-02-27 09:03:00

  IE ActiveX(”htmlfile”) Transport, Part II

In my last post I discussed using the ActiveX(”htmlfile”) technique to provide a usable streaming transport in Internet Explorer. The solution I provided will work, but since writing the last article I’ve made significant progress in understanding why IE behaves the way it does with respect to the streaming transport. The previous solution amounted to creating an array of messages, pushing messages on that array from the htmlfile iframe, and popping messages off of the array i...

   IE,Http,Streaming,htmlfile,Transport,Act     2011-09-05 04:07:02

  Resolve high CPU usage issue caused by file_get_contents in PHP

Sometimes a Linux server which runs Nginx + PHP-CGI(php-fpm) web service may experience sudden system load increase and the CPU usage is around 100% for many php-cgi processes when checking with top command. If this happens, file_get_contents may be the cause if it's used in the PHP script. In lots of web applications, normally there are lots of API requests based on HTTP. Many PHP developers like to use file_get_contents("http://example.com/") to get the API response because it's simple to...

   PHP,FILE_GET_CONTENTS,PHP-CGI     2018-11-09 21:35:00

  Unfortunate Python

Python is a wonderful language, but some parts should really have bright WARNING signs all over them. There are features that just can't be used safely and others are that are useful but people tend to use in the wrong ways. This is a rough transcript of the talk I gave at my local Python group on November 15, with some of the audience feed back mixed in. Most of this came from hanging around the Python IRC channel, something I highly recommend. [update 2011-12-19: improved "array" cr...

   Python,Defects,Deprecated methods,Warning     2011-12-20 08:27:36

  Best practices of front end optimization

1. Use DocumentFragment or innerHTML to replace complex elements insertion DOM operation on browser is expensive. Although browser performance is improved much, multiple DOM elements insertion is still expensive and will affect the page load speed. Assume we have an ul element on our page, we now want to retrieve a JSON list using AJAX and then update the ul using JavaScript. Usually we may write it as : var list = document.querySelector('ul'); ajaxResult.items.forEach(function(item) { // ...

   JavaScript,Front end,Optimization,Tips     2013-07-06 11:26:27

  New features in PHP 5.5

Just a few days ago, the PHP official website was redesigned. It seems we directly go from Web 1.0 era to Web 2.0 era. In addition to this new change, PHP 5.5 was also released. Some new features are added in this release. Here we summarize some of them. Enable OPCache by default When installing PHP 5.5, the Zend OPCache will be compiled as OPCache by default and OPCache is enabled by default. Some changes to the language itself Add Generator function getLinesFromFile($fileName) { if (!$file...

   PHP 5.5,New features,Generator     2013-07-05 03:13:22

  Efficiency of code execution

If you want to optimize your program codes, you need to find their Hotspot, i.e, the codes which are executed most frequently. If you can optimize this portion of codes a bit, you may gain much improvement of your code efficiency. Here I give you three examples about efficiency of code execution.1. PHP's Getter and Setter (From Reddit)This example a quite simple, you can skip it if you want.Consider the code below, we can find it's slower when we use Getter/Setter method to read a member variabl...

   Code, Efficiency,Analysis,Trick     2012-07-13 10:59:21