ntp – installation and configuration

ntp server

You need to install the following packages: ntp : ntpd server which continuously adjusts system time and utilities used to query and configure the ntpd daemon. ntpdate : Utility to set the date and time via NTP. ntp-doc : NTP documentation Open the terminal or login over the ssh session. You must login as as … Read more

MySQL trim function

MySQL Cluster

MySQL TRIM() function returns a string after removing all prefixes or suffixes from the given string. Syntax TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM ] str) Arguments Name Description BOTH Indicates that prefixes from both left and right are to be removed. LEADING Indicates that only leading prefixes are to be removed. TRAILING Indicates that … Read more

PHP – MySQL : Create Database

php-mysql

  [root@mysqlDB]# mysqladmin -u root -p create eduguru Enter password:****** This will create a MySQL database eduguru. This is a simple example to create database called eduguru. Example: <?php $dbhost = ‘localhost:3036’; //If mysql server is on same server $dbuser = ‘root’; //mysql user who has the permission to create database $dbpass = ‘rootpassword’; //mysql user’s password … Read more

MySQL RAND Function

MySQL Cluster

MySQL has a RAND function that can be invoked to produce random numbers between 0 and 1: mysql> SELECT RAND( ), RAND( ), RAND( ); +——————+—————–+——————+ | 0.45464584925645 | 0.1824410643265 | 0.54826780459682 | +——————+—————–+——————+ 1 row in set (0.00 sec) When invoked with an integer argument, RAND( ) uses that value to seed the random … Read more

Convert datetime to specific formats in PHP

There are many way to use date time with specific combination with format  in PHP.. dd/mm/yyyy 18/04/2016 $userdefine = date(“d/m/Y”, $datetime); echo $userdefine; mm/dd/yyyy 04/18/2016 $userdefine= date(“m/d/Y”, $datetime); echo $userdefine; Without mins/seconds 18 April 2016  $userdefine= date(“d F Y”, $datetime); echo $userdefine; With mins/seconds 18 April 2016 10:12:59  $userdefine= date(“d F Y H:i:s”, $datetime); echo $userdefine;   There are same other formats like $userdefine= date(“m-d-Y”, $datetime); echo $userdefine; —output like … Read more

mysql locate function

MySQL Cluster

MySQL LOCATE() returns the position of the first occurrence of a string within a string. Both of these strings are passed as arguments. An optional argument may be used to specify from which position of the string (i.e. string to be searched) searching will start. If this position is not mentioned, searching starts from the … Read more

mysql limit clause

MySQL Cluster

What is MySQL limit clause? The LIMIT clause is used in the SELECT statement to constrain the number of rows in a result set. The LIMIT clause accepts one or two arguments. The values of both arguments must be zero or positive integers. It limits the Data Selections from a MySQL Database. The LIMIT clause … Read more

mysql length function

MySQL Cluster

Description: MySQL LENGTH() returns the length of a given string. Syntax: LENGTH (str) Argument: Name      Description str            A string whose length is to be returned. Example of MySQL LENGTH() function mysql> SELECT LENGTH(NULL); Result: NULL mysql> SELECT LENGTH(”); Result: 0 mysql> SELECT LENGTH(‘ ‘); Result: 1 mysql> SELECT … Read more

mysql concat function

MySQL Cluster

MySQL CONCAT function is used to concatenate two strings to form a single string. Description: MySQL CONCAT() function is used to add two or more strings. There may be one or more arguments. Returns the string that results from concatenating the arguments. Returns a non binary string, if all arguments are non binary strings. Returns … Read more

Hierarchy of Operators Revisited in C

C Programming Tutorial

Since we have now added the logical operators to the list of operators we know, it is time to review these operators and their priorities. The higher the position of an operator is in the table, higher is its priority. The following figure summarizes the working of all the three logical operators.