George John has Published 1167 Articles

When running UPDATE … datetime = NOW(); will all rows updated have the same date/ time in mysql?

George John

George John

Updated on 25-Jun-2020 11:27:32

2K+ Views

The now() function returns the constant time that exhibits the time at which any statement began to execute. The sysdate() function returns the exact same datetime at which it executed the statement from MySQL 5.0.13.Suppose if you are updating datetime with now() in triggers or stored procedure, the now() method ... Read More

Get the index of last substring in a given string in MySQL?

George John

George John

Updated on 25-Jun-2020 11:06:50

2K+ Views

To get the index of last substring in a given string, use the char_length() function. First, we need to calculate string length and subtract the last sub string length from the entire length. The difference in length is index of substring.SyntaxThe syntax is as follows −select CHAR_LENGTH(yourColumnName) - LOCATE('yourDelimiter ', ... Read More

CSS nav-left property

George John

George John

Updated on 25-Jun-2020 10:36:49

115 Views

The nav-left property is used to move left when you have pressed on left arrow button in keypad. You can try to run the following code to implement the CSS nav-left propertyExampleLive Demo                    button {         ... Read More

Set quotation marks with CSS

George John

George John

Updated on 25-Jun-2020 10:19:20

177 Views

Use the quotes property to set quotation marks. You can try to run the following code to implement the quotes propertyExampleLive Demo                    #demo {             quotes: "'" "'";          }                                        This is demo text surrounded by quotes.                    

How to catch all the exceptions in C++?

George John

George John

Updated on 25-Jun-2020 10:14:21

10K+ Views

Exceptions are the problems which arise at the time of execution of program. It is an event which is thrown at runtime. It protects the code and run the program even after throwing an exception. Exception handling is used to handle the exceptions. We can use try catch block to ... Read More

Error Handling in C

George John

George John

Updated on 25-Jun-2020 10:13:10

4K+ Views

Error handling is not supported by C language. There are some other ways by which error handling can be done in C language. The header file “error.h” is used to print the errors using return statement function.It returns -1 or NULL in case of any error and errno variable is ... Read More

ldexp() in C++

George John

George John

Updated on 25-Jun-2020 10:10:32

73 Views

The function ldexp() is used to calculate the multiplication of a floating point value ‘a’ by the number 2 raised to the exponent power. It takes two arguments, first is a floating point number and second is an integer value.Here is the mathematical expression of ldexp(), ldexp() = a * ... Read More

Left Shift and Right Shift Operators in C/C++

George John

George John

Updated on 25-Jun-2020 10:00:10

2K+ Views

Left ShiftIn the left shift operator, the left operands value is moved left by the number of bits specified by the right operand.Here is an example of left shift operator in C language,Example Live Demo#include int main() {    int y = 28; // 11100    int i = 0;    for(i;i

Why are global variables bad in C/C++?

George John

George John

Updated on 25-Jun-2020 09:52:17

2K+ Views

Global variables are declared and defined outside any function in the program. They hold their values throughout the lifetime of program. They are accessible throughout the execution of program.Non-const global variables are evil because their value can be changed by any function. Using global variables reduces the modularity and flexibility ... Read More

How to get current time and date in C++?

George John

George John

Updated on 25-Jun-2020 09:46:16

788 Views

Here is an example to get current date and time in C++ language,Example Live Demo#include using namespace std; int main() {    time_t now = time(0);    char *date = ctime(& now);    cout

Advertisements