Anvi Jain has Published 629 Articles

Update array in MongoDB document by variable index?

Anvi Jain

Anvi Jain

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

293 Views

To update array in MongoDB document by variable index, use the below syntax. Here, yourIndexValue in the index value, where yourIndexVariableName is the variable name for index −var yourIndexVariableName= yourIndexValue, anyVariableName= { "$set": {} }; yourVariableName["$set"]["yourFieldName."+yourIndexVariableName] = "yourValue"; db.yourCollectionName.update({ "_id":  yourObjectId}, yourVariableName);Let us first create a collection with documents −> ... Read More

How to suppress Android notification on lock screen but let it be in notification area?

Anvi Jain

Anvi Jain

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

375 Views

This example demonstrate about How to suppress Android notification on lock screen but let it be in notification areaStep 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

How to start a transaction in JDBC?

Anvi Jain

Anvi Jain

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

1K+ Views

A transaction is a unit of work that is performed against a database. Transactions are units or sequences of work accomplished in a logical order, whether in a manual fashion by a user or automatically by some sort of a database program.A transaction is the propagation of one or more ... Read More

How to center a JLabel in a JPanel with GridBagLayout in Java?

Anvi Jain

Anvi Jain

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

719 Views

Center a component in a JPanel with GridBagLayout. Let us first create a JFrame and JPanel inside it -JFrame frame = new JFrame("Demo Frame"); JPanel panel = new JPanel();Now, we will add our components −JLabel label = new JLabel("Demo Label (Centered)"); label.setForeground(Color.white); JCheckBox checkBox = new JCheckBox("Checkbox (Centered)");Set the layout ... Read More

How to remove notification from notification bar programmatically in android?

Anvi Jain

Anvi Jain

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

3K+ Views

This example demonstrate about How to remove notification from notification bar programmatically in androidStep 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 ... Read More

Is it mandatory to register the driver while working with JDBC?

Anvi Jain

Anvi Jain

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

570 Views

Initially, till Java6 it is needed to register the driver using Class.forname() or the registerDriver() method before establishing connection with the database.But, since Java 1.6, JDBC 4.0 API, there is no need to register the driver explicitly, You Just need to set the Class path for the JDBC 4.X driver, ... Read More

How to create an Android notification with expiration date?

Anvi Jain

Anvi Jain

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

641 Views

This example demonstrate about How to create an Android notification with expiration dateStep 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 ... Read More

Wireless LAN Protocols

Anvi Jain

Anvi Jain

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

12K+ Views

Wireless LANs refer to LANs (Local Area Networks) that use high frequency radio waves instead of cables for connecting the devices. It can be conceived as a set of laptops and other wireless devices communicating by radio signals. Users connected by WLANs can move around within the area of network ... Read More

Write a program to get the list of all the supported datatypes in JDBC?

Anvi Jain

Anvi Jain

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

113 Views

The class named Types of the java.sql package contains the constants that represents the SQL datatypes. All these datatypes are represented by unique integer values.Retrieving the integer values from the Types classTo print all the class names and values of the constants in java.sql.Types class −Retrieve all the fields in ... Read More

How to Create a Reminder Notification in Android?

Anvi Jain

Anvi Jain

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

3K+ Views

This example demonstrate about How to Create a Reminder Notification in AndroidStep 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 ... Read More

Advertisements