George John has Published 1167 Articles

How to get default phone Network Specifier in android?

George John

George John

Updated on 26-Jun-2020 14:13:26

163 Views

This example demonstrate about How to get default phone Network Specifier in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In ... Read More

How to write long strings in Multi-lines C/C++?

George John

George John

Updated on 26-Jun-2020 14:10:35

11K+ Views

Long strings can be written in multiple lines by using two double quotes ( “ “ ) to break the string at any point in the middle.A program that demonstrates this in C is given as follows.Example Live Demo#include int main() {    char *str = "This is the method ... Read More

How to calculate combination and permutation in C++?

George John

George John

Updated on 26-Jun-2020 14:06:26

10K+ Views

Combination and permutation are a part of Combinatorics. Permutation is the different arrangements that a set of elements can make if the elements are taken one at a time, some at a time or all at a time. Combination is is the different ways of selecting elements if the elements ... Read More

When do function-level static variables get initialized in C/C++?

George John

George John

Updated on 26-Jun-2020 13:59:45

654 Views

Static variables can be defined using the static keyword. They are variables that remain in memory while the program is running i.e. their lifetime is the entire program run. This is different than automatic variables as they remain in memory only when their function is running and are destroyed when ... Read More

Initialization of a normal array with one default value in C++

George John

George John

Updated on 26-Jun-2020 13:49:16

14K+ Views

The entire array can be initialized to zero very simply. This is shown below.int arr[10] = {0};However, it is not possible to initialize the entire array to a non-zero value using the above method. This is shown below.int arr[10] = {5};In the above example, only the first element will be ... Read More

Why C/C++ variables doesn’t start with numbers

George John

George John

Updated on 26-Jun-2020 13:43:26

2K+ Views

In C/C++, a variable name can have alphabets, numbers and underscore( _ ) character. There are some keywords in C/C++ language, apart from them everything is treated as identifier. Identifiers are the name of variable, constants, functions etc.We can not specify the identifier which starts with a number because there ... Read More

What is the meaning of prepended double colon “::” in C++?

George John

George John

Updated on 26-Jun-2020 13:26:44

6K+ Views

The prepended double colon is also known as the scope resolution operator. Some of the uses of this operator are given as follows.Define a function outside a classThe scope resolution operator can be used to define a function outside a class. A program that demonstrates this is given as follows.Example Live ... Read More

How can I enable MySQL slow query log without restarting MySQL?

George John

George John

Updated on 26-Jun-2020 13:18:50

1K+ Views

We can enable the MySQL slow query log with the help of SET statement.The following is the syntax.SET GLOBAL slow_query_log = 'Value';In the above syntax, value can be filled with ON/OFF. To enable slow query log, let us see the query.mysql> SET GLOBAL slow_query_log = 'ON'; Query OK, 0 rows ... Read More

Making an existing field Unique in MySQL?

George John

George John

Updated on 26-Jun-2020 13:05:43

151 Views

Unique in MySQL means we cannot add duplicate records. Let us now see how to create a unique constraint in the column at the time of creating a table.mysql> create table UniqueConstDemo - > ( - > name varchar(100) unique - > ); Query OK, 0 rows affected (0.72 sec)Now, ... Read More

How to remove leading and trailing whitespace from a MySQL field value?

George John

George John

Updated on 26-Jun-2020 13:04:43

2K+ Views

We can remove the leading and trailing whitespaces from MySQL with the help of trim() function.The following is the syntax.mysql> SELECT TRIM(' AnyStringWithWhitespaces ');Let us now implement the above syntax in the below query.mysql> SELECT TRIM(' Leading And Trailing whitespaces Demo '); Here is the output that removes the whitespaces.+---------------------------------------+ ... Read More

Advertisements