Nishtha Thakur

Nishtha Thakur

398 Articles Published

Articles by Nishtha Thakur

Page 16 of 40

How do I catch a Ctrl+C event in C++?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 14K+ Views

The CTRL + C is used to send an interrupt to the current executing task. In this program, we will see how to catch the CTRL + C event using C++.The CTRL + C is one signal in C or C++. So we can catch by signal catching technique. For this signal, the code is SIGINT (Signal for Interrupt). Here the signal is caught by signal() function. Then one callback address is passed to call function after getting the signal.Please see the program to get the better idea.Example#include #include #include #include using namespace std; // Define ...

Read More

How to perform $gt on a hash in a MongoDB document?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 156 Views

The $gt is for greater than, wherein select those documents where the value of the field is greater than the specified value. Let us first create a collection with documents −> db.performQueryDemo.insertOne({"PlayerDetails":{"PlayerScore":1000, "PlayerLevel":2}, "PlayerName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7eba41a844af18acdffa9") } > db.performQueryDemo.insertOne({"PlayerDetails":{"PlayerScore":0, "PlayerLevel":1}, "PlayerName":"Robert"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ebbb1a844af18acdffaa") } > db.performQueryDemo.insertOne({"PlayerDetails":{"PlayerScore":-10, "PlayerLevel":0}, "PlayerName":"Larry"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ebd41a844af18acdffab") } > db.performQueryDemo.insertOne({"PlayerDetails":{"PlayerScore":1, "PlayerLevel":1}, "PlayerName":"David"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ebe31a844af18acdffac") }Following is the query to display all documents from a collection with the help of ...

Read More

How to get notified when a notification is notified?\\n

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 108 Views

This example demonstrate about How to get notified when a notification is notifiedStep 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

Find the MongoDB document from sub array?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 458 Views

You can use dot(.) notation to find the document from sub array. Let us first create a collection with documents −> db.findDocumentDemo.insertOne( ...    { ...       "EmployeeDetails" : ...       { ...          "EmployeeAppraisalTime": ... ...          [ ... ...             {"EmployeeDesignation": "Developer", "Salary": 45000}, ...             {"EmployeeDesignation": "Tester", "Salary": 30000}, ...             {"EmployeeDesignation": "HR", "Salary": 22000}, ...             {"EmployeeDesignation": "Accountant", "Salary": 18000} ...          ] ...

Read More

How to add a title to JTable in Java Swing?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 2K+ Views

To display a title to the JTable, you can set a title for the JPanel, which already consists of a JTable.Here, we are using createTitledBorder() for the JPanel to set the title for the panel border that would eventually work for table title.Let’s say the following is the JPanel −JPanel panel = new JPanel();Now, use setBorder() and the BorderFactory class to set a title border for the panel that would be our table title as well −panel.setBorder(BorderFactory.createTitledBorder(    BorderFactory.createEtchedBorder(), "My Demo Table", TitledBorder.LEFT, TitledBorder.TOP));The following is an example to add a title to a JTable −Examplepackage my; import javax.swing.BorderFactory; import ...

Read More

MongoDB regex to display records whose first five letters are uppercase?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 1K+ Views

Let us first create a collection with documents −> db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"JOHN Smith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7edef1a844af18acdffb2") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"SAM Williams"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee011a844af18acdffb3") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"CAROL Taylor"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee101a844af18acdffb4") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"Bob Taylor"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee351a844af18acdffb5") } > db.upperCaseFiveLetterDemo.insertOne({"StudentFullName":"DAVID Miller"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd7ee451a844af18acdffb6") }Following is the query to display all documents from a collection with the help of find() method −> db.upperCaseFiveLetterDemo.find().pretty();This will produce the following output −{    "_id" : ...

Read More

How to hide the track on the slider in Java?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 293 Views

To hide the track on the slider, you need to use the setPaintTrack() method and set it to FALSE −JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 55); slider.setInverted(true); slider.setMinorTickSpacing(10); slider.setMajorTickSpacing(25); slider.setPaintTicks(true); slider.setPaintLabels(true); slider.setPaintTrack(false);The above method setPaintTrack() is by default set to TRUE.The following is an example to hide the track on the slider −Examplepackage my; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.WindowConstants; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame("Frame with Slider");       JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 55);   ...

Read More

Retrieve values from nested JSON array in MongoDB?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 1K+ Views

To retrieve values from nested JSON array, you can use the below syntax −db.yourCollectionName.find({"yourOuterFieldName.yourInnerFieldName.yourNextInnerFieldName…...N": "yourValue"}).pretty();Let us first create a collection with documents −> db.nestedJSONArrayDemo.insertOne({ ...    "ClientDetails" : ...    { ...       "ClientPersonalDetails" : [ ...          { "CountryName" : "US" }, ...          { "CountryName" : "AUS"}, ...          { "ClientName":"Chris" }, ...          { "ClientName":"David" } ...       ] ...    } ... }); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2cbb2b64f4b851c3a13bc") } > db.nestedJSONArrayDemo.insertOne({ ...    "ClientDetails" : ... ...

Read More

How to arrange components in a Flow to be right-justified in Java?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 152 Views

Use FlowLayout.RIGHT to arrange components in a FlowLayout to be right-justified. −JFrame frame = new JFrame("Language"); frame.setLayout(new FlowLayout(FlowLayout.RIGHT));The following is an example to arrange components in a flow to be right-justified −Examplepackage my; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.WindowConstants; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame("Language");       frame.setLayout(new FlowLayout(FlowLayout.RIGHT));       JLabel label = new JLabel("Most Spoken Language ");       label.setPreferredSize(new Dimension(220, 70));       label.setOpaque(true);       label.setBackground(Color.RED);     ...

Read More

How to style an Android notification using InboxStyle?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 192 Views

This example demonstrate about How to style an Android notification using InboxStyleStep 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 = "default" ...

Read More
Showing 151–160 of 398 articles
« Prev 1 14 15 16 17 18 40 Next »
Advertisements