Smita Kapse has Published 498 Articles

Is it possible in Android to check if a notification is visible or canceled?

Smita Kapse

Smita Kapse

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

810 Views

This example demonstrate about How it is possible in Android to check if a notification is visible or canceledStep 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 ... Read More

Selecting only a single field from MongoDB?

Smita Kapse

Smita Kapse

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

480 Views

You can use $and operator. Let us first create a collection with documents −>db.selectingASingleFieldDemo.insertOne({"StudentFirstName":"John", "StudentAge":23, "StudentCountryName":"US"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd547142cba06f46efe9f02") } >db.selectingASingleFieldDemo.insertOne({"StudentFirstName":"Carol", "StudentAge":21, "StudentCountryName":"UK"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd5471f2cba06f46efe9f03") } >db.selectingASingleFieldDemo.insertOne({"StudentFirstName":"David", "StudentAge":24, "StudentCountryName":"AUS"}); {    "acknowledged" : true,    "insertedId" : ... Read More

How to set location of JLabel in a JFrame with Java?

Smita Kapse

Smita Kapse

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

8K+ Views

To set location of a component in a JFrame, use the setBounds() method. Let us first create a frame and a panel −JFrame frame = new JFrame("Demo Frame"); JPanel panel = new JPanel(); frame.getContentPane();Create a component i.e. label and set the dimensions using setBounds(). Here, you can set the location ... Read More

How can I insert an EditText (for inserting text) on an Android notification?

Smita Kapse

Smita Kapse

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

380 Views

This example demonstrate about How can I insert an EditText (for inserting text) on an Android notificationStep 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. ... Read More

How to use try-with-resources with JDBC?

Smita Kapse

Smita Kapse

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

5K+ Views

Whenever, we instantiate and use certain objects/resources we should close them explicitly else there is a chance of Resource leak.Generally, we used close resources using the finally block as −Connection con = null; Statement stmt = null; ResultSet rs = null; //Registering the Driver try {    con = DriverManager.getConnection(mysqlUrl, ... Read More

Get documents expired before today in MongoDB?

Smita Kapse

Smita Kapse

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

323 Views

You can use $lte operator along with Date() for this. Let us first create a collection with documents. Here, we have set the date 2019-05-11, which is the current date −> db.getDocumentsExpiredDemo.insertOne({"ArrivalDate":new ISODate("2019-05-11")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd563b17924bb85b3f4893b") } > db.getDocumentsExpiredDemo.insertOne({"ArrivalDate":new ISODate("2019-01-01")}); {    "acknowledged" : ... Read More

How to enable vibration and lights for the Android notifications?

Smita Kapse

Smita Kapse

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

528 Views

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.     ... Read More

How to get LocalDateTime object from java.sql.Date using JDBC?

Smita Kapse

Smita Kapse

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

4K+ Views

The java.time package of Java8 provides a class named LocalDateTime is used to get the current value of local date and time. Using this in addition to date and time values you can also get other date and time fields, such as day-of-year, day-of-week and week-of-year.Converting java.sql.Date to LocalDateTimeThe java.sql.TimeStamp ... Read More

How to set an Android notification to a specific date in the future?

Smita Kapse

Smita Kapse

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

3K+ Views

This example demonstrate about How to set an Android notification to a specific date in the future.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. ... Read More

Limited-Contention Protocols

Smita Kapse

Smita Kapse

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

7K+ Views

Limited Contention Protocols are the media access control (MAC) protocols that combines the advantages of collision based protocols and collision free protocols. They behave like slotted ALOHA under light loads and bitmap protocols under heavy loads.ConceptIn computer networks, when more than one station tries to transmit simultaneously via a shared ... Read More

Advertisements