Krantik Chavan has Published 308 Articles

Stringize and Token-pasting operator in C

Krantik Chavan

Krantik Chavan

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

2K+ Views

In this section we will see what are the Stringize operator and Token Pasting operator in C. The Stringize operator is a preprocessor operator. It sends commands to compiler to convert a token into string. We use this operator at the macro definition.Using stringize operator we can convert some text ... Read More

How to retrieve documents from a collection in MongoDB?

Krantik Chavan

Krantik Chavan

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

1K+ Views

To retrieve documents from a collection in MongoDB, you need to use find() method. The syntax is as follows:db.yourCollectionName.find();The above syntax will return all the documents from a collection in MongoDB. To understand the above syntax, let us create a collection with documents. The query to create documents are as ... Read More

Retrieve only the queried element in an object array in MongoDB collection?

Krantik Chavan

Krantik Chavan

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

227 Views

You can use projection operator $elemMatch to filter in queried element in an object array in MongoDB collection. To retrieve only the queried element in an object array in MongoDB, let us first create a collection with documents object array.The query is as follows:> db.objectArray.insert({"Persons":[    {"PersonName":"Adam", "PersonSalary":25000}, {"PersonName":"Larry", "PersonSalary":27000 ... Read More

Update MongoDB field using value of another field?

Krantik Chavan

Krantik Chavan

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

2K+ Views

You can use aggregate function to update MongoDB field using the value of another field. Here, we will create two collections:namestudentInformation CollectionThe query to create first collection with documents is as follows:> db.name.insert({"FirstName":"John", "LastName":"Smith"}); WriteResult({ "nInserted" : 1 })Now you can display all documents from the collection with the help ... Read More

Decimal fixed point and floating point arithmetic in Python

Krantik Chavan

Krantik Chavan

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

1K+ Views

Floating point numbers are represented in the memory as a base 2 binary fraction. As a result floating point arithmetic operations can be weird at times. Addition of 0.1 and 0.2 can give annoying result as follows −>>> 0.1 + 0.2 0.30000000000000004In fact this is the nature of binary floating ... Read More

What is static import in Java?

Krantik Chavan

Krantik Chavan

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

451 Views

As import statement allows to use a class without its package qualification, static import allows to access the static members of a class without class qualifications. For Example, to access the static methods you need to call the using class name − Math.sqrt(169); But, using static import you ... Read More

Tokens vs Identifiers vs Keywords in C++

Krantik Chavan

Krantik Chavan

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

616 Views

A token is the smallest element of a C++ program that is meaningful to the compiler. The C++ parser recognizes these kinds of tokens: identifiers, keywords, literals, operators, punctuators, and other separators. A stream of these tokens makes up a translation unit. Tokens are usually separated by white space.The parser ... Read More

Writing at the end of report without clearing current screen in SAP ABAP

Krantik Chavan

Krantik Chavan

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

78 Views

Yes, it is possible. You would require using MODIFY LINE

Advertisements