Tuesday, 29 April 2014

Install,Uninstall/Remove,Update Package through apt-get in Ubuntu

What is apt-get
apt-get is a powerful command-line tool used for package management in Debian Linux distribution. It used to work with Ubuntu’s APT (Advanced Packaging Tool) library to Install/manage individual packages , Remove installed package, Upgrade packages etc.
To install package through apt-get package manager
For installing package, just write apt-get install and mention the name of package.
apt-get install package-name
For example- If i need to install phpmyadmin
apt-get install phpmyadmin
NOTE: if you get permission denied error, then use sudo with this command. To install any package or software in Ubuntu you need root access.
sudo apt-get install phpmyadmin
once you type and enter, it ask password for root user

Wednesday, 16 April 2014

PHP 5.4 traits tutorial,example and concept

As of PHP 5.4.0, PHP implements a method of code reuse called Traits.
PHP 5.4 introduces the concept of traits. Until Traits PHP uses Classical inheritance model in which one class can inherit only one class. In simple words Before PHP 5.4 PHP uses single inheritance model , which makes sometimes difficult to reuse the code.

Traits allow developer to reuse sets of methods freely in several independent classes living in different class hierarchies.

Saturday, 5 April 2014

How to Download CSV File in PHP

CSV stands for Comma Separated Values. This file format is commonly used to store data, export data from database etc.
Let’s create a CSV with more values. Now we are creating CSV with following header and multiple records.