發表文章

Nginx Vs Apache: Nginx Basic Architecture and Scalability

圖片
Nginx Vs Apache: Nginx Basic Architecture and Scalability The need for serving large number of concurrent requests is raising every day. The prediction of C10K problem (i.e 10,000 concurrent clients) started the research on web server architecture which could solve this problem. As a result Nginx architecture was developed. This article explains on a very high-level how Nginx works to solve the scalability problem, along with high level differences between Nginx and Apache webserver. Increasing Web Server Scalability The web server scalability problem can be solved either by increasing the hardware capabilities (i.e memory, CPU, etc ) or by improving the web server architecture. The goal here is to improve the web server architecture too optimize the hardware resources, which will eventually lead to a cost effective architecture. For solving this problem, In 2002 Igor Sysoev started developing a web server written in C, which had an efficient thread management. Nginx was ...

[Programming] Throw out a 'The Connection was reset' error after submiting (POST) form

Here are a number of reasons that may occurs error after submiting (POST) form: Too much parameter sent: Try to reduce the useless input before submit Reach the max input var: set "max_input_vars   1000" in php.ini or in PHP page Loading time too long: In particular, the values for max_execution_time and max_input_time could safely be increased. Both of these are currently set to 180 seconds, or 3 minutes Reach the max of files: Set " max_file_uploads   20" in php.ini or in PHP page Posting data too large: Set " post_max_size   28M" in php.ini or in PHP page Over memory: Set "memory_limit   128M" in php.ini or in PHP page

[MYSQL] Find row in mysql with same column different values

SELECT Item FROM YourTable WHERE categories IN ( 'red' , 'blue' , 'green' ) GROUP BY Item HAVING COUNT ( DISTINCT categories ) = 3

HTML5 Placeholder jQuery Plugin for all browsers (Including IE)

HTML5 Placeholder jQuery Plugin $(function() { $('input, textarea').placeholder(); }); source from: http://www.jqueryscript.net/demo/HTML5-Placeholder-For-All-Browsers-With-jQuery-placeholder/

用 jQuery Preload 預先載入圖片

圖片
一個幫助你預先載入圖片的 jQuery 插件 說明 做網站時常常會需要預先載入圖片來帶給使用者更好的體驗, 像是滑鼠滑過去改變背景圖, slideshow 改變圖片等等. 預先載入圖片可以避免滑鼠滑過時背景圖消失了幾秒才出現, 或是使用 slideshow 等待下一張圖切換過久的問題. Demo 按   這裡   檢視這個 demo 原始碼裡也包含了這個 demo 頁面 下載 從   Github   下載原始碼 需求 jQuery 1.2.3+ 支援瀏覽器 Firefox   2.0+ Internet Explorer   6+ Safari   3+ Opera   10.6+ Chrome   8+ 安裝 首先, 確定你使用了一個有效的   DOCTYPE 引用 JS 檔案 1 2 < script type = "text/javascript" src = " http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js " ></ script > < script type = "text/javascript" src = "path-to-file/jquery.preload.js" ></ script > 使用方法 範例程式碼: 1 2 3 4 5 $.preload( '/img/space.gif' ,    '/img/loading.gif' ,    '/img/header-bg.png' ,    '/img/avatar.jpg' ); Source from: http://dreamerslab.com/blog/tw/preload-images-with-jquery-preload-plugin/