Smita Kapse has Published 558 Articles

How to pull an array element (which is a document) in MongoDB?

Smita Kapse

Smita Kapse

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

171 Views

You can use $pull operator. Let us first create a collection with documents −> db.pullAnArrayElementDemo.insertOne( { "StudentDetails": [ { "StudentFirstName":"Chris", "StudentScore":56 }, {"StudentFirstName":"Robert", "StudentScore":59 } ] } ); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3b55bedc6604c74817cd5") }Following is the query to display all documents from a collection with the ... Read More

static keyword in C++ vs Java

Smita Kapse

Smita Kapse

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

491 Views

In C++ or Java we can get the static keyword. They are mostly same, but there are some basic differences between these two languages. Let us see the differences between static in C++ and static in Java.The static data members are basically same in Java and C++. The static data ... Read More

Get the size of all the documents in a MongoDB query?

Smita Kapse

Smita Kapse

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

198 Views

To get the size of all the documents in a query, you need to loop through documents. Let us first create a collection with documents −> db.sizeOfAllDocumentsDemo.insertOne({"StudentFirstName":"John", "StudentSubject":["MongoDB", "Java"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3c0c1edc6604c74817cd7") } > db.sizeOfAllDocumentsDemo.insertOne({"StudentFirstName":"Larry", "StudentSubject":["MySQL", "PHP"], "StudentAge":21}); {    "acknowledged" : true,   ... Read More

Anything written in sizeof() is never executed in C

Smita Kapse

Smita Kapse

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

110 Views

The sizeof function (Sometimes called operator) is used to calculate the size of the given argument. If some other functions are given as argument, then that will not be executed in the sizeof.In the following example we will put one printf() statement inside the loop. Then we will see the ... Read More

Java program to set the content of the JLabel to be left-justified and bottom-aligned

Smita Kapse

Smita Kapse

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

140 Views

To set the text of the label component to be left-justified and bottom-aligned, you need to set the alignment. Set the label to be on the left and bottom aligned −JLabel label = new JLabel("Fav Sports", JLabel.LEFT); label.setVerticalAlignment(JLabel.BOTTOM);Here, we have set the size of the label as well as the ... Read More

How to encrypt a CLOB datatype in JDBC?

Smita Kapse

Smita Kapse

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

228 Views

Creating an Encrypted LOB(CLOB or, BLOB)Oracle database from 11g onwards provides SecureFiles feature to encrypt the Large object files (LOBs). You can create a secure file using the SECUREFILE keyword as −CREATE TABLE table_name (    myClob CLOB ) LOB(myClob) STORE AS SECUREFILE;You can encrypt a secured file using Encrypt ... Read More

Use of explicit keyword in C++

Smita Kapse

Smita Kapse

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

783 Views

Here we will see what will be the effect of explicit keyword in C++. Before discussing that, let us see one example code, and try to find out its output.Example#include using namespace std; class Point {    private:       double x, y;    public:       ... Read More

How to display count of notifications in toolbar icon in Android?

Smita Kapse

Smita Kapse

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

536 Views

This example demonstrate about How to display count of notifications in toolbar icon in Android.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

How to get all collections where collection name like '%2015%'?

Smita Kapse

Smita Kapse

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

432 Views

Let us first create some collections that starts from year number i.e. 2015, 2019, etc −> use web; switched to db web > db.createCollection("2015-myCollection"); { "ok" : 1 } > db.createCollection("2019-employeeCollection"); { "ok" : 1 } > db.createCollection("2015-yourCollection"); { "ok" : 1 }Now you can display all the collections with ... Read More

How to get the data type name from the java.sql.Type code using JDBC?

Smita Kapse

Smita Kapse

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

606 Views

The java.sql.Types class represents the SQL datatype in integer format. The valueOf() method of the enumeration JDBCType accepts an integer value representing the java.sql.Type and, returns the JDBC type corresponding to the specified value.ExampleLet us create a table with name MyPlayers in MySQL database using CREATE statement as shown below −CREATE ... Read More

Advertisements