Build Tengine, MariaDB and PHP on Ubuntu 14.04

Introduction Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. Tengine is a branch of Nginx which is created by Alibaba Inc. MariaDB is a database server developed by some of the original authors of MySQL, offers drop-in replacement functionality. Prerequisites Before you begin this guide, you should have a regular, non-root user with sudo privileges configured on your server. We will build all components from the source code. Of course, it's OK for you to install them using apt-get command. All steps have been tested on Ubuntu 14.04. Install Tengine Install Required Packages Download and Compile the Source Code Set File…

Continue Reading

Difference Between require() and include() in PHP

One of the most common questions I get asked by PHP beginners is, Why is there 4 ways to include a file on your page? There is include(), include_once(), require() and require_once(). What do these do? What's the difference between them? In this article we're going to look at all these different functions and will talk about an example of when you need to use each of them. include() The include function is used in PHP when you want to include a file within the current process. It takes one argument which will be a string to the file path you want to include. The code inside the included file will then run when the include function is called. This…

Continue Reading

Install OS X Yosemite using Clover

Clover is a new and exciting open source EFI bootloader. Developed over the past 3 years by a group of developers at Project OS X led by Slice, Clover aims to solve problems inherent in existing OS X installation methods and legacy bootloaders: Boots troublesome desktop and laptop BIOS/UEFI Uses native OS X installation media Ability to patch DSDT/kernel/kexts at boot time Creates OS X Recovery partition No boot0 error with 4K Advanced Format drives Solves multi-boot issues with Linux and Windows 7/8 Solves traditional bootloader NVRAM issues related to iMessage/FaceTime Clover has a completely different system of configuration with a decidedly steep learning curve. It can be confusing for those who have only ever used the more traditional Chameleon or…

Continue Reading

Java Collections Framework

Almost all collections in Java are derived from the java.util.Collection interface. Collection defines the basic parts of all collections. The interface states the add() and remove() methods for adding to and removing from a collection respectively. Also required is the toArray() method, which converts the collection into a simple array of all the elements in the collection. Finally, the contains() method checks if a specified element is in the collection. The Collection interface is a subinterface of java.lang.Iterable, so any Collection may be the target of a for-each statement. (The Iterable interface provides the iterator() method used by for-each statements.) All collections have an iterator that goes through all of the elements in the collection. Additionally, Collection is a generic.…

Continue Reading

Spring AOP Example Using Annotation

Spring Framework is developed on two core concepts – Dependency Injection and Aspect Oriented Programming (AOP). Today we will look into the core concepts of Aspect Oriented Programming and how we can implement it using Spring Framework. Aspect Oriented Programming Overview Most of the enterprise applications have some common crosscutting concerns that is applicable for different types of Objects and modules. Some of the common crosscutting concerns are logging, transaction management, data validation etc. In Object Oriented Programming, modularity of application is achieved by Classes whereas in Aspect Oriented Programming application modularity is achieved by Aspects and they are configured to cut across different classes. AOP takes out the direct dependency of crosscutting tasks from classes that we can’t achieve…

Continue Reading

Consistent Hash Ring

Consistent hashing is a special kind of hashing such that when a hash table is resized and consistent hashing is used, only K/n keys need to be remapped on average, where K is the number of keys, and n is the number of slots. In contrast, in most traditional hash tables, a change in the number of array slots causes nearly all keys to be remapped. Consistent hashing achieves the same goals as Rendezvous hashing (also called HRW Hashing). The two techniques use different algorithms, and were devised independently and contemporaneously. Problem on Distributed Cache The need for consistent hashing arose from limitations experienced while running collections of caching machines - web caches, for example. If you have a collection…

Continue Reading
Contact Us
  • SenseTime Research, Shenzhen Bay Eco-Technology Park
  • cshzxie [at] gmail [dot] com