If given a string containing a path to a file, the PHP basename() function will return the base name of the file. To get its equivalent in MySQL, you can use SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable -> ( -> Location varchar(200) -> ); Query OK, 0 rows affected (1.02 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('C:\Web\Sum.java'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('E:\WebDevelopment\Image1.png'); Query OK, 1 row affected (0.42 sec)Display all records from the table using select statement ... Read More
To rotate the contents of an array cyclically −create an empty variable. (temp)save the last element of the array in it.Now, starting from the nth element of the array, replace the current element with the previous element.Store the element in temp in the 1st position.Example Live Demoimport java.util.Arrays; import java.util.Scanner; public class CyclicallyRotateanArray { public static void main(String args[]){ Scanner sc = new Scanner(System.in); System.out.println("Enter the required size of the array ::"); int size = sc.nextInt(); int [] myArray = new int[size]; System.out.println("Enter elements of ... Read More
In this section we will see the get() function of array in C++ STL. This function is used to get the ith element of the array container. The syntax is like below −Syntaxget array_nameThis function takes two mandatory parameters. The is the index parameter. It is used to point to the ith position of the array. The second argument is array_name. This is the actual array from this ith element will be taken. This function returns the ith element.Let us see one example to get the idea.Example Live Demo#include #include using namespace std; main() { array arr = {00, 11, ... Read More
A common mistake for people new to programming is a misunderstanding of the way that boolean operators works, which stems from the way the python interpreter reads these expressions. For example, after initially learning about "and " and "or" statements, one might assume that the expression X = (‘x’ or ‘y’) would check to see if the variable X was equivalent to one of the strings ‘a’ or ‘b’. This is not so. To understand, what i’m trying to say, start an interactive session with the interpreter and enter the following expressions:>>> 'x' == ('x' or 'y') True >>> 'y' ... Read More
Python’s sys module provides access to any command-line arguments via the sys.argv. sys.argv is the list of command-line arguments and sys.argv[0] is the program ie. the script name.Save following code as args.pyimport sys print ('argument list', sys.argv)Execute above script from command line as follows:C:\python37>python args.py 11 22 argument list ['args.py', '11', '22']The getopt module has funcions toparse the command line arguments in sys.argv. It supports the same conventions as the Unix getopt() function (including the special meanings of arguments of the form ‘-‘ and ‘--‘).API is designed to be familiar to users of the C getopt() function.getopt(args, shortopts, longopts=[])Parses command ... Read More
This example demonstrate about How to enable vibration and lights for the Android notificationsStep 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. Step 3 − Add the following code to res/layout/custom_notification_layout.xml. Step 4 − Add the following code to src/MainActivity.package app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.os.Bundle ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.view.View ; import android.widget.RemoteViews ; public class ... Read More
To create line border, use the createLineBorder() method. Let us first create a label component −JLabel label; label = new JLabel("Demo label");Now, create line border with BorderFactory class. Here, we have also set the color for the line border −label.setBorder(BorderFactory.createLineBorder(Color.yellow));The following is an example to create a LineBorder with BorderFactory class −package my; import javax.swing.BorderFactory; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; public class SwingDemo { public static void main(String[] args) throws Exception { JFrame frame = new JFrame("Demo"); JLabel label; label = new JLabel("Demo label"); ... Read More
The matte border gives a “matte” look. Let’s say the following is our component −JLabel label; label = new JLabel("This has matte border!");Let us create a matte border with BorderFactory class. Here, we have given color YELLOW using the Color class −label.setBorder(BorderFactory.createMatteBorder(3, 5, 10, 5, Color.YELLOW));The following is an example to create a Matte-look border −Examplepackage my; import javax.swing.BorderFactory; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; public class SwingDemo { public static void main(String[] args) throws Exception { JFrame frame = new JFrame("Demo"); JLabel label; label = new JLabel("This ... Read More
For this, use $ifNull operatorLet us first create a collection with documents −> dbquerySelectDemoinsertOne({"Value1":10, "Value2":null}); { "acknowledged" : true, "insertedId" : ObjectId("5cefc0ceef71edecf6a1f6b6") } > dbquerySelectDemoinsertOne({"Value1":null, "Value2":30}); { "acknowledged" : true, "insertedId" : ObjectId("5cefc0d7ef71edecf6a1f6b7") } > dbquerySelectDemoinsertOne({"Value1":60, "Value2":40}); { "acknowledged" : true, "insertedId" : ObjectId("5cefc0e2ef71edecf6a1f6b8") }Display all documents from a collection with the help of find() method −> dbquerySelectDemofind()pretty();Output{ "_id" : ObjectId("5cefc0ceef71edecf6a1f6b6"), "Value1" : 10, "Value2" : null } { "_id" : ObjectId("5cefc0d7ef71edecf6a1f6b7"), "Value1" : null, "Value2" : 30 } { "_id" : ObjectId("5cefc0e2ef71edecf6a1f6b8"), "Value1" : 60, ... Read More
The target attribute of the element allows you to display the response generated after submitting the form.Following is the syntax −Here, _blank is used to display the response in new window or tab, _self display the response in the same frame, _parent displays the response in the parent frame, _top displays the response in the entire body of the window, frame displays the response in a named frame.Let us now see an example to implement the target attribute of the element −Example Live Demo Points Player: Rank: Points: Submit ... Read More