Now, let me put it this way, according to the rules of Indian advertising you are not allowed to present false or misleading advertisements. By misleading ads we mean, ads with exotic language or without any relevant explanation. If the same thing would’ve been followed by the tech world then most of us would have been charged for malpractice, I am not taking any names again.Smart ConsumerismFor the readers, the tech circle life begins with some launches and after lots of thorough thought, it ends up with your choice of gadget in your hands. In all this process, somewhere in ... Read More
The property keys in the provider can be viewed using an unmodifiable Set view using the method keySet() in the class java.security.Provider. This method requires no parameters and it returns the unmodifiable Set view for the property keys as required.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo { public static void main(String[] argv) throws Exception { try { Signature sign = Signature.getInstance("DSA"); Provider p = sign.getProvider(); Set set = p.keySet(); Iterator ... Read More
This example demonstrate about How to load html content in android webview.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 the above code, we have taken web view to show html content.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.app.ProgressDialog; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.widget.EditText; public class MainActivity extends AppCompatActivity { @RequiresApi(api ... Read More
This example demonstrate about How to get current Wi-Fi IP address 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 the above code, we have taken text view to show WIFI mac ip address.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.text.format.Formatter; import android.widget.TextView; public class MainActivity extends AppCompatActivity { ... Read More
An immutable copy of a LocalDateTime with the minutes altered as required is done using the method withMinute() in the LocalDateTime class in Java. This method requires a single parameter i.e. the minute that is to be set in the LocalDateTime and it returns the LocalDateTime with the minute altered as required.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalDateTime ldt1 = LocalDateTime.parse("2019-02-18T23:15:30"); System.out.println("The LocalDateTime is: " + ldt1); LocalDateTime ldt2 = ldt1.withMinute(45); ... Read More
Like procedures, you can also create function in a database and store them.SyntaxFollowing is the syntax of creating a function in a(MySQL) database:CREATE FUNCTION Function_Name(input_arguments) RETURNS output_parameter BEGIN declare variables; statements . . . . . . . . . . return data_type; ENDTo create a function in a database using JDBC API you need to:Register the driver: class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Establish a connection: Connect ot the database using the getConnection() method of the DriverManager class. Passing ... Read More
Here is a C++ Program to Implement Traveling Salesman Problem using Nearest Neighbour Algorithm.Required functions and pseudocodesAlgorithmBegin Initialize c = 0, cost = 1000; Initialize g[][]. function swap() is used to swap two values x and y. function cal_sum() to calculate the cost which take array a[] and size of array as input. Initialize sum = 0. for i = 0 to n compute s+= g[a[i %3]][a[(i+ 1) %3]]; if (cost >s) cost = s function permute() is used to perform permutation: if ... Read More
Before getting into an example, we should know what CopyOnWriteArraySet is. It is a thread-safe variant of ArrayList and operations add, set, and so on by making a fresh copy of the underlying array.This example demonstrates about How to use size() in android CopyOnWriteArraySetStep 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 the above code, we have taken a text view to show CopyOnWriteArraySet elements.Step 3 − Add the following ... Read More
To format MySQL time with lowercase am/pm, use the LOWER() as well as DATE_FORMAT().Let us first create a table −mysql> create table formatTime -> ( -> LoginTime time -> ); Query OK, 0 rows affected (0.56 sec)Following is the query to insert records in the table using insert command −mysql> insert into formatTime values('12:40:34'); Query OK, 1 row affected (0.20 sec) mysql> insert into formatTime values('14:10:58'); Query OK, 1 row affected (0.13 sec) mysql> insert into formatTime values('16:56:40'); Query OK, 1 row affected (0.18 sec) mysql> insert into formatTime values('10:12:14'); Query OK, 1 row ... Read More
This is a C++ program to convert string to char array in C++. This can be done in multiple different waysType1AlgorithmBegin Assign a string value to a char array variable m. Define and string variable str For i = 0 to sizeof(m) Copy character by character from m to str. Print character by character from str. EndExample#include #include using namespace std; int main() { char m[]="Tutorialspoint"; string str; int i; for(i=0;i