Monday, 17 June 2013

MySql Storage Engine Types


A storage engine is a software module that a database management system uses to create, read, update data from a database. There are two types of storage engines in MySQL. Transactional and non-transactional.

The default storage engine for MySQL prior to version 5.5 was MyISAM. For MySQL 5.5 and later, the default storage engine is InnoDB. Choosing the right storage engine is an important strategic decision, which will impact future development.


List of MySQL supported storage engines:


1.) MyISAM

2.) InnoDB

3.) Memory

4.) CSV

5.) Merge

6.) Archive

7.) Blackhole

8.) Federated

9.) Example



1.) MyISAM:- The default MySQL storage engine and the one that is used the most in Web, data warehousing, and other application environments.It is a fast storage engine. It does not support transactions. MyISAM provides table-level locking.

2.) InnoDB:- A transaction-safe (ACID compliant) storage engine for MySQL that has commit, rollback, and crash-recovery capabilities to protect user data. InnoDB row-level locking (without escalation to coarser granularity locks) and Oracle-style consistent nonlocking reads increase multi-user concurrency and performance. InnoDB stores user data in clustered indexes to reduce I/O for common queries based on primary keys. To maintain data integrity, InnoDB also supports FOREIGN KEY referential-integrity constraints.

3.) Memory:- Stores all data in RAM for extremely fast access in environments that require quick lookups of reference and other like data. This engine was formerly known as the HEAP engine.

4.) CSV:- The CSV storage engine stores data in text files using comma-separated values format. You can use the CSV engine to easily exchange data between other software and applications that can import and export in CSV format.

5.) Merge:- Merge operates on underlying MyISAM tables. Merge tables help manage large volumes of data more easily. It logically groups a series of identical MyISAM tables, and references them as one object. Good for data warehousing environments.

6.) Archive:- Archive storage engine is optimized for high speed inserting. It compresses data as it is inserted. It does not support transactions. It is ideal for storing, retrieving large amounts of seldom referenced historical, archived data.

7.) Blackhole:- The Blackhole storage engine accepts but does not store data. Retrievals always return an empty set. The functionality can be used in distributed database design where data is automatically replicated, but not stored locally. This storage engine can be used to perform performance tests or other testing.

8.) Federated:- Federated storage engine offers the ability to separate MySQL servers to create one logical database from many physical servers. Queries on the local server are automatically executed on the remote (federated) tables. No data is stored on the local tables. It is good for distributed environments.

9.) Example:- The Example storage engine is “stub” engine that does nothing. You can create tables with this engine, but no data can be stored in them or retrieved from them. The purpose of this engine is to serve as an example in the MySQL source code that illustrates how to begin writing new storage engines. As such, it is primarily of interest to developers.

Saturday, 2 March 2013

Beginners Guide : How to Install Node.js


Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.



In simple words – is server-side JavaScript. Every function in Node.js is asynchronous,Node.js uses an event-based server execution procedure rather than the multithreaded execution in PHP.

Node.js provide only an environment – meaning that you have to do everything yourself. There is not a default HTTP server, or any server for that matter. This can be overwhelming for new users, but the payoff is a high performing web app. One script handles all communication with the clients. This considerably reduces the number of resources used by the application.


Installation

if you use Windows or OS X; the nodejs.org website offers installers for those operating systems, go to http://nodejs.org/ and  you can directly install.



Installing on Windows

Probably asks for cygwin packages, if not installed.

The http://nodejs.org/dist/latest/ directory contains the latest .msi package (such as node-v0.6.15.msi when Node v0.6.15 was the latest) that you may use to install both Node.js engine and npm.

Installing on Mac

The http://nodejs.org/dist/latest/ directory contains the latest .pkg package (such as node-v0.6.15.pkg when Node v0.6.15 was the latest).



Building on GNU/Linux and other UNIX

There's a number of ways to install Node.js on Linux
The filenames vary with the Node's version. The following examples are for Node v0.6.18.



Prerequisites:-

1. GNU make 3.81 or newer. Pre-installed on most systems. Sometimes called gmake.

2. python 2.6 or 2.7. The build tools distributed with Node run on python.

3. libssl-dev (Node v0.6.x only.) Can usually be installed on *NIX systems with your favorite package manager. Pre-installed on OS X.

4. libexecinfo (FreeBSD and OpenBSD only.) Required by V8. pkg_add -r libexecinfo installs it.


Do something like this

tar -zxf node-v0.6.18.tar.gz   #Download this from nodejs.org
cd node-v0.6.18
./configure
make
sudo make install


Or, if you'd like to install from the repository 

git clone https://github.com/joyent/node.git
cd node
git checkout v0.6.18     #Try checking nodejs.org for what the stable version is
./configure
make
sudo make install

You may wish to install Node in a custom folder instead of a global directory. 

./configure --prefix=/opt/node
make
sudo make install





Saturday, 23 February 2013

How to Disable Ubuntu’s Guest Account

Here i am giving a quick tip that shows you how to remove / disable the guest account from  login screen of Ubuntu.



By default, Ubuntu is comes with the guest account enabled and shown on the login screen. If you want to remove it .

open the terminal and run below command

sudo sh -c 'echo "allow-guest=false" >> /etc/lightdm/lightdm.conf'


Now Restart your computer and the guest account should be gone.





Friday, 15 February 2013

Installation of Webmin on a CentOS server




Repository Configuration

Before install Webmin, you'll need to set up your repositories to pull the Webmin package via yum. To do this, we need to create "webmin.repo" file in the /etc/yum.repos.d/ directory.

sudo nano /etc/yum.repos.d/webmin.repo

In this file, place the following lines:

[Webmin]
name=Webmin Distribution Neutral
baseurl=http://download.webmin.com/download/yum
enabled=1

Save and close the file.
Now we'll import the GPG key for the repository.

sudo rpm --import http://www.webmin.com/jcameron-key.asc

Now the repository is configured! 

Install Pre-Requisites
Now that we have the software downloaded we need to install a few pre-requisites before installation. Type the following command below to install the required modules:

sudo yum -y install perl-Net-SSLeay
Note: It *is* case sensitive.

Installation
Now it is time to install the Webmin package.To do so, use the command below

sudo yum install webmin

Once the installation has completed you should get the following message:

Webmin install completed . You can now login https:server:10000/ as root with your root password.



Thursday, 14 February 2013

Check your Array type in PHP


if you want to know your array is a numerical or associative for some specific task but PHP don't have any in built functions.i write down one function which return output in Boolean if Array is a Associative it will return True else it will return False..
 

//function
 
 function is_assoc($array) {
 
  return (bool)count(array_filter(array_keys($array), 'is_string'));
 
}


 //test some array
 
var_dump(is_assoc(array('a', 'b', 'c')));  // false(numeric key)
 
var_dump(is_assoc(array("0" => 'a', "1" => 'b', "2" => 'c')));  // false(numeric key)
 
var_dump(is_assoc(array("1" => 'a', "0" => 'b', "2" => 'c')));  // false(numeric key)
 
var_dump(is_assoc(array("a" => 'a', "b" => 'b', "c" => 'c')));  // true(associative key)