get the difference between two timestamps in seconds

MySQL Cluster

get the difference between two timestamps in seconds   You could use the TIMEDIFF() and the TIME_TO_SEC() functions as follows: SELECT TIME_TO_SEC(TIMEDIFF(‘2010-08-20 12:01:00’, ‘2010-08-20 12:00:00’)) diff; +——+ | diff | +——+ | 60 | +——+ 1 row in set (0.00 sec) You could also use the UNIX_TIMESTAMP() function. SELECT UNIX_TIMESTAMP(‘2010-08-20 12:01:00’) – UNIX_TIMESTAMP(‘2010-08-20 12:00:00’) diff; +——+ | diff | +——+ | … Read more

Convert decimal seconds time in Excel h:mm:ss format

convert decimal seconds to excel time

Convert decimal seconds time in Excel h:mm:ss format Generic formula =seconds/86400 Explanation To convert seconds in decimal format to a proper Excel time, divide by 86400. In the example shown, the formula in C6 is: =B6/86400 To display the result as time, apply a time format. Column D shows the same result formatted with [h]:mm. … Read more

How to identify server IP address in PHP

php how to example

How to identify server IP address in PHP   or the server ip: $_SERVER[‘SERVER_ADDR’]; and this for the port $_SERVER[‘SERVER_PORT’]; You can use this in CRUL as below: <?php // create a new cURL resource $ch = curl_init (); // set URL and other appropriate options curl_setopt ($ch, CURLOPT_URL, “http://blog.eduguru.in/test”); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt … Read more

IPTABLES : Introduction to Linux Firewall

firewall

IPTABLES : Introduction to Linux Firewall   Linux is the most-used open source operating system. Managing network traffic is one of the toughest jobs to deal with.  For this, we must configure the firewall in such a way that it meets the system and users requirements without leaving the system vulnerable. The default firewall in most of the Linux distributions is IPTables. IPTables is … Read more

Setup SFTP Server on linux

Linux yum

Setup SFTP Server on linux CentOS 7 or any Linux server distribution is a very powerful server that performs above and beyond what your business might need. Whatever task you throw at the server, it will be ready. And, if it isn’t ready out of the box, you can make it so. A complete and simple … Read more

asterisk task processors : high queue size warning

asterisk

asterisk task processors : high queue size warning You may have seen the “task processor queue reached 500 scheduled tasks” in asterisk. Let’s understand what is the meaning of this warning and what this cause. Task processors have been in Asterisk for a long time. Since Asterisk v12, they have become more important because the … Read more

Saving a curl response into a php variable

php-mysql

Saving a curl response into a php variable Here is example to save a curl resonse into a variable in php <?php //URL of targeted site $url = “http://www.putyourapihere.com/”; $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // grab URL and pass it to … Read more

get the last 7 characters of a PHP string

php-mysql

get the last 7 characters of a PHP string Use substr() with a negative number for the 2nd argument. $newstring = substr($dynamicstring, -7); string substr ( string $string , int $start [, int $length ] ) If start is negative, the returned string will start at the start’th character from the end of string Example: <?php echo … Read more

mysql length function : calculate length of a column

mysql 5.7

mysql length function : calculate length of a column Function length() Return the length of the string Usages SELECT CustomerName, LENGTH(CustomerName) AS LengthOfName FROM Customers; Tablenames Records Customers 91 Categories 8 Employees 9 OrderDetails 2155 Orders 830 Products 77 Shippers 3 Suppliers 29    

asterisk auto dialing using call file

asterisk

asterisk auto dialing using call file Asterisk call files are structured files which, when moved to the appropriate directory, are able to automatically place calls using Asterisk. Call files are a great way place calls automatically without using more complex Asterisk features like the AGI, AMI, and dialplan, and require very little technical knowledge to … Read more