Anvi Jain has Published 569 Articles

wcstoll() function in C/C++

Anvi Jain

Anvi Jain

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

176 Views

The wcstoll() function is used to convert the wide character string to long long integers. It sets the pointer to point to the first character after the last one. The syntax is like below.long long wcstoll(const wchar_t* str, wchar_t** str_end, int base)This function takes three arguments. These arguments are like ... Read More

How do you update a MongoDB document while replacing the entire document?

Anvi Jain

Anvi Jain

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

150 Views

Let us first create a collection with a document −>db.replacingEntireDocumentDemo.insertOne({"StudentFirstName":"John", "StudentLastName":"Smith", "StudentCountryName":"US"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd3119bb64f4b851c3a13e8") }Following is the query to display document from a collection with the help of find() method −> db.replacingEntireDocumentDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cd3119bb64f4b851c3a13e8"),   ... Read More

How do I remove a string from an array in a MongoDB document?

Anvi Jain

Anvi Jain

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

412 Views

You can use $pull operator to remove a string from an array. Let us first create a collection with documents −> db.removeAStringDemo.insertOne({"Score":[45, 67, 89, "John", 98, 99, 67]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cda5224b50a6c6dd317adbd") }Following is the query to display all documents from a collection with the ... Read More

wprintf() and wscanf in C Library

Anvi Jain

Anvi Jain

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

2K+ Views

Here we will see the wprintf() and wscanf() functions in C. These are the printf() and scanf() functions for wide characters. These functions are present in the wchar.hThe wprintf() function is used to print the wide character to the standard output. The wide string format may contain the format specifiers ... Read More

MongoDB query for fields in embedded document?

Anvi Jain

Anvi Jain

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

247 Views

Let us first create a collection with documents −> db.embeddedDocumentDemo.insertOne( ...    { ...       "CustomerDetails":[ ...          {"CustomerName":"Chris", "CustomerPurchasePrice":3000}, ...          {"CustomerName":"Robert", "CustomerPurchasePrice":4500}, ...          {"CustomerName":"David", "CustomerPurchasePrice":1000}, ...       ] ...    } ... ); { ... Read More

How to push new items to an array inside of an object in MongoDB?

Anvi Jain

Anvi Jain

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

952 Views

You can use $elemMatch operator for this. Let us first create a collection with documents −> db.pushNewItemsDemo.insertOne(    {       "_id" :1,       "StudentScore" : 56,       "StudentOtherDetails" : [          {             "StudentName" : "John", ... Read More

sqrt, sqrtl and sqrtf in C++

Anvi Jain

Anvi Jain

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

897 Views

In the cmath library of C++, there are different functions for getting the square root except from sqrt. The sqrt is used basically for double type input. The others are used for float, long type data etc. Let us see the usage of these functions.The sqrt() FunctionThis function is used ... Read More

How to prevent resizing columns in a JTable

Anvi Jain

Anvi Jain

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

1K+ Views

To prevent resizing columns, use the method setResizingAllowed(). Here, we will set setResizingAllowed() to false for table header to disallow resizing of columns from header −table.getTableHeader().setResizingAllowed(false);Let us first see an example wherein we can easily resize columns in a table by resizing the table column header −Examplepackage my; import java.awt.Color; ... Read More

Find data for specific date in MongoDB?

Anvi Jain

Anvi Jain

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

2K+ Views

Let’s say you have saved the Login date of users. Now, you want the count of records for specific date only i.e. login date. For this, use $gte and $lt operator along with count(). Let us first create a collection with documents −> db.findDataByDateDemo.insertOne({"UserName":"John", "UserLoginDate":new ISODate("2019-01-31")}); {    "acknowledged" : ... Read More

C function argument and return values

Anvi Jain

Anvi Jain

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

9K+ Views

Here we will see what are the different types of C functions based on the return values and arguments.So a function either can take some arguments, or nothing is taken. Similarly, a function can return something, otherwise does not return anything. So we can categorize them into four types.Function with ... Read More

Advertisements