Samual Sam has Published 2310 Articles

Get attribute list from MongoDB object?

Samual Sam

Samual Sam

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

1K+ Views

To get attribute list from MongoDB object, you can use for loop to extract key and value for document. Let us create a collection with documents −>db.getAttributeListDemo.insertOne({"StudentId":101, "StudentName":"John", "StudentAdmissi onDate":new ISODate('2019-01-12'), "StudentSUbjects":["MongoDB", "Java", "MySQL"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cbdfcc9ac184d684e3fa269") }Display all documents from a collection with ... Read More

Generate random numbers using C++11 random library

Samual Sam

Samual Sam

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

2K+ Views

In C++11, we can get the random library to generate random numbers. Here we have used random_device once to seed the random number generator object called mt. This random_device is slower than the mt19937, but we do not need to seed it. It requests for random data to the operating ... Read More

How does generic lambda work in C++14?

Samual Sam

Samual Sam

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

285 Views

In C++11, the lambda was introduced. Lambdas are basically a part of, that can be nested inside other function call statements. By combining lambda expressions with the auto keyword, they can be used later.In C++14, these lambda expressions are improved. Here we can get the generalized or generic lambda. For ... Read More

How to get memory usage under Linux in C++

Samual Sam

Samual Sam

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

3K+ Views

Here we will see how to get the memory usage statistics under Linux environment using C++.We can get all of the details from “/proc/self/stat” folder. Here we are taking the virtual memory status, and the resident set size.Example#include #include #include #include #include using namespace std; ... Read More

How to launch a program using C++ program?

Samual Sam

Samual Sam

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

3K+ Views

Here we will see how to start some third-party application like notepad or anything using C++ program. This program is very simple, we can use command prompt command to do this task.We will pass the application name inside the system() function. This will open it accordingly.Example#include using namespace std; ... Read More

What does buffer flush means in C++ ?

Samual Sam

Samual Sam

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

2K+ Views

The buffer flush is used to transfer of computer data from one temporary storage area to computers permanent memory. If we change anything in some file, the changes we see on the screen are stored temporarily in a buffer.In C++, we can explicitly have flushed to force the buffer to ... Read More

transform() in C++

Samual Sam

Samual Sam

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

3K+ Views

The transform function is present in the C++ STL. To use it, we have to include the algorithm header file. This is used to perform an operation on all elements. For an example if we want to perform square of each element of an array, and store it into other, ... Read More

Advanced C++ with boost library

Samual Sam

Samual Sam

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

1K+ Views

C++ boost libraries are widely useful library. This is used for different sections. It has large domain of applications. For example, using boost, we can use large number like 264 in C++.Here we will see some examples of boost library. We can use big integer datatype. We can use different ... Read More

static_cast in C++

Samual Sam

Samual Sam

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

5K+ Views

The static_cast is used for the normal/ordinary type conversion. This is also the cast responsible for implicit type coercion and can also be called explicitly. You should use it in cases like converting float to int, char to int, etc. This can cast related type classes.Example#include using namespace std; ... Read More

The feclearexcept in C++

Samual Sam

Samual Sam

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

67 Views

The feclearexcept() function is used to clear the supported floating point exceptions represented by the excepts.This function returns 0, if all exceptions are cleared, or the exception value is 0. And returns nonzero value for some exceptions.To use this function, we have to enable the FENV_ACCESS. This will give our ... Read More

Advertisements