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

 WEB


  Best practices of front end optimization

1. Use DocumentFragment or innerHTML to replace complex elements insertionDOM 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) { // Create element var li = document.createElement('li'); li.innerHTML = item.text; // Manipulate ...

3,417 0       JAVASCRIPT TIPS OPTIMIZATION FRONT END


  What you may not know about PHP session

When we access one website, the site usually should have a mechanism to keep track of the status of the user on the site. There are a few mechanisms supported by many server side languages to help track user status such as session and cookie.Today we will talk about session, when creating a session, we need to keep track of many data, besides user data, we also need to tell the server what is the timeout of the session so that we can garbage collect the session data which should not be stored anymore. How do we implement a reliable session mechanism?In PHP, we are often told that we can change...

10,250 0       EXAMPLE PHP SESSION SESSION TIMEOUT


  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 defaultWhen 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 itselfAdd Generatorfunction getLinesFromFile($fileName) { if (!$fileHandle = fopen($fileName, 'r')) { throw new RuntimeException('Couldn\'t open file "' . $fileName...

11,354 0       NEW FEATURES PHP 5.5 GENERATOR


  PHP buffer: output_buffering and ob_start

buffer is one piece of memory section, it is usually 4Kb in Linux. It is mainly used between different devices with different speed or different priorities. With buffer, the waiting time between different processes will be reduced. Here is one simple example, when you type something in a text editor, every time when you type a character, the operating system will not write it to the disk directly, instead it will write it to buffer first When the buffer is full, the data in the buffer will be written to disk. But when you call flush(), the data in the buffer will be written to the disk immedia...

18,817 1       PHP BUFFER OUTPUT_BUFFERING OB_START


  HTML Email Guide

Many of us may subscribe to some newsletters to get update about their site or information about a topic such as JavaScript Weekly, we may receive an email every week or every month to know what's happening there.The email we receive is just a simple HTML page but with an Email format called HTML Email. It seems it's simple to write this kind of HTML Email. But the thing is it's not so easy. It takes much effort by just designing an Email template.Whether the HTML Email can be displayed normally depends completely on the mail client. Most mail clients such as Outlook and Gmail will filter the ...

21,210 0       HTML EMAIL GUIDE


  Write high quality JavaScript and CSS with SublimeLinter

SublimeLinter is a plugin for one of the front end editor--Sublime Text, it is used to highlight those syntax not conforming to standard or wrong, it supports JavaScript,CSS,HTML,Java,PHP,Python,Ruby and some more.This article will introduce how to configure SublimeLinter in Windows to validate JavaScript and CSS codes.PreparationInstall Sublime Text package control tool : http://wbond.net/sublime_packages/package_controlInstall SublimeLinter with Sublime Text package control tool :https://github.com/SublimeLinter/SublimeLinterInstall Node.js, recommend you to install Windows Installer version...

8,918 0       VALIDATION SUBLIMELINTER SUBLIME TEXT


  Write HTML easily with Emmet and Haml

Writing HTML codes is very boring and tedious as it has many tags and it's static. One solution is to use template, filling content based on other's skeleton. One another solution is high speed writing. We can write HTML codes with Emmet and Haml.These two ways have similar functions but with different characteristics. Haml is based on Ruby, so when working on Ruby/Rails projects, we recommend to use Haml, otherwise we recommend to use Emmet.1. EmmetEmmet is a editor plugin, the official website provides multiple editor support. We can use it as vim plugin. First we can follow the vim plugin m...

9,864 1       HTML EMMET HAML


  Difference between sans-serif and serif font

When we design website, we will often need to choose which font to use while displaying contents on the page. Basically what's the criteria for the choice? There are two big families of fonts : sans-serif and serif. We need to first understand what the difference is between these two.The word sans is from French, the meaning of it is without. So the difference between sans-serif and serif is serif font will have lines in all ends of the character while sans-serif fonts don't have.Some examples of sans-serif fonts are: Arial, Verdana, Tahoma,Impact. Some examples of serif fonts are : Times New ...

2,977 0       SANS-SERIF SERIF FRENCH