HTML DOM PopStateEvent Object

AmitDiwan
Updated on 30-Jul-2019 22:30:26

147 Views

The HTML DOM popStateEvent object is an event handler for the popstate event which occurs when window’s history changes.Property of PopStateEventPropertyExplanationstateIt returns an object that represents a copy of the history entries.ExampleLet us see an example of HTML DOM popStateEvent Object − Live Demo    html{       height:100%;    }    body{       text-align:center;       color:#fff;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat;       height:100%;    }    p{       font-size:1.2rem;    }    .btn{       background:#0197F6;       border:none;   ... Read More

C++ Program for Finding Vertex, Focus and Directrix of a Parabola

Arnab Chakraborty
Updated on 30-Jul-2019 22:30:26

176 Views

Here we will see how to find the vertex, focus directrix of a parabola using C or C++ program. To get these parameters we need the general equation of a parabola. The general formula is −𝑦 = 𝑎𝑥2 + 𝑏𝑥 + 𝑐The values of a, b and c are given.The formula for the vertex −The formula for the focus −The formula for the Directrix - y −Example Live Demo#include using namespace std; void getParabolaDetails(float a, float b, float c) {    cout

Automatically Generate Stacktrace When GCC C++ Program Crashes

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

2K+ Views

For Linux and we can use gcc to compile C/C++ codes. This compiler uses glibc library. We can use the backtrace() function to trace the error. This function is present inside the execinfo.h header file. In this example, we are going to display Segmentation fault error using the stack trace feature.Example#include #include #include #include #include using namespace std; void error_handler(int sig) {    void *array[10];    size_t size;    size = backtrace(array, 10); //get the void pointers for all of the entries    cout

Create FileFilter for JFileChooser in Java

Samual Sam
Updated on 30-Jul-2019 22:30:26

981 Views

To create FileFilter, use the FileNamExtensionFilter class. The following is an example to display File Type in JFileChooser −Exampleimport javax.swing.JFileChooser; import javax.swing.filechooser.FileNameExtensionFilter; public class SwingDemo {    public static void main(String[] args) {       JFileChooser file = new JFileChooser();       file.setAcceptAllFileFilterUsed(false);       FileNameExtensionFilter extFilter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg");       file.addChoosableFileFilter(extFilter);       file.showOpenDialog(null);    } }Output

Create Android Notification with Longer Text

Smita Kapse
Updated on 30-Jul-2019 22:30:26

370 Views

This example demonstrate about How to create an Android notification with a longer textStep 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 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 ; public class MainActivity extends AppCompatActivity {    public static final String NOTIFICATION_CHANNEL_ID = "10001" ;    private final static String default_notification_channel_id ... Read More

Match Element in Array of MongoDB

Anvi Jain
Updated on 30-Jul-2019 22:30:26

305 Views

You can use $or operator along with limit(1) to match element in array. Let us first create a collection with documents −> db.matchElementInArrayDemo.insertOne( ...   { ...      "StudentName" : "Chris" , ...      "StudentOtherDetails" : ...      [ ...         {"StudentCountryName" : "US" , "StudentSkills" : "MongoDB"}, ...         {"StudentCountryName" : "UK" , "StudentSkills" : "Java"} ...       ] ...   } ... ); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd423282cba06f46efe9ee2") } > db.matchElementInArrayDemo.insertOne( ...   { ...      "StudentName" : "Chris" , ...   ... Read More

Insert Tab After the First Tab of a JTabbedPane Container

Anvi Jain
Updated on 30-Jul-2019 22:30:26

126 Views

We are inserting a tab just after the first tab by using the index value 1. Here, index 1 would be location 2nd i.e. just after the first tab of the JTabbedPane container.The following is an example to insert a tab after the first tab −Examplepackage my; import javax.swing.*; import java.awt.*; public class SwingDemo {    public static void main(String args[]) {       JFrame frame = new JFrame("Devices");       JTabbedPane tabbedPane = new JTabbedPane();       JTextArea text = new JTextArea(100, 100);       JPanel panel1, panel2, panel3, panel4, panel5, panel6, panel7, panel8;   ... Read More

Deselect a Range of Rows from a Table in Java

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

261 Views

Let’s say, we have selected a range of rows using addRowSelectionInterval() as shown in the demo screenshot −Now, we will deselect the above shown selected rows using removeRowSelectionInterval(). The range is to be set here for interval i.e rows 3 to 6 (index 2 to 5) will get deselected −table.removeRowSelectionInterval(2, 5);The following is our example to deselect a range of rows −Examplepackage my; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class SwingDemo {    public static void main(String[] argv) throws Exception {       DefaultTableModel tableModel = new DefaultTableModel();       JTable table = new JTable(tableModel); ... Read More

Select Specific Rows in a Range with MySQL

George John
Updated on 30-Jul-2019 22:30:26

619 Views

Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentName varchar(20)    ); Query OK, 0 rows affected (1.23 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName) values('John'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable(StudentName) values('Carol'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(StudentName) values('David'); Query OK, 1 row affected (0.07 sec) mysql> insert into DemoTable(StudentName) values('Bob'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(StudentName) values('Chris'); Query OK, 1 row affected (0.12 sec) ... Read More

MySQL Query to Select Records Starting from a Specific ID

Rama Giri
Updated on 30-Jul-2019 22:30:26

2K+ Views

Let us first create a table −mysql> create table DemoTable    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Name varchar(100)    -> ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name) values('John'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(Name) values('David'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(Name) values('Carol'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(Name) values('Bob'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable(Name) ... Read More

Advertisements