Smita Kapse has Published 498 Articles

Python Context Variables

Smita Kapse

Smita Kapse

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

1K+ Views

Context variable can have different values depending on its context. Unlike Thread-Local Storage where each execution thread may have a different value for a variable, a context variable may be several contexts in one execution thread. This is useful in keeping track of variables in concurrent asynchronous tasks.The ContextVar class ... Read More

DoubleStream mapToObj() method in Java

Smita Kapse

Smita Kapse

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

235 Views

The mapToObj() method of the DoubleStream class returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.The syntax is as follows − Stream mapToObj(DoubleFunction

The equals() method of AbstractSequentialList in Java

Smita Kapse

Smita Kapse

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

116 Views

The equals() method is inherited from the AbstractList class in Java. It is used to check the object for equality with this list. It returns TRUE if the object is equal to this list, else FALSE is returned.The syntax is as follows −public boolean equals(Object o)Here, o is the object ... Read More

MongoDB query by sub-field?

Smita Kapse

Smita Kapse

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

2K+ Views

You can use dot(.) notation to query by subfield. Let us create a collection with a document. The query to create a collection with a document is as follows −> db.queryBySubFieldDemo.insertOne(    ... {       ... "StudentPersonalDetails" : {"StudentName" : "John", "StudentHobby" :"Photography"},       ... "StudentScores" ... Read More

How do I drop a MongoDB database from the command line?

Smita Kapse

Smita Kapse

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

330 Views

To drop a MongoDB database from the command line, use the following syntax:mongo yourDatabaseName --eval "db.dropDatabase()"To understand the above syntax, let us display all the database from MongoDB. The query is as follows −> show dbs;The following is the output −StudentTracker 0.000GB admin 0.000GB config 0.000GB local 0.000GB sample 0.000GB ... Read More

LongStream flatMap() method in Java

Smita Kapse

Smita Kapse

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

103 Views

The flatMap() method in LongStream class returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.The syntax is as follows −LongStream flatMap(LongFunction

How to delete everything in a MongoDB database?

Smita Kapse

Smita Kapse

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

569 Views

You can delete everything in a MongoDB database using dropDatabase() function. The syntax is as follows −use yourDatabaseName; db.dropDatabase();The above syntax will delete everything in a MongoDB database.To delete everything in a MongoDB database, let us first display all the databases from MongoDB. The query is as follows −> show ... Read More

Is it possible to cast in a MongoDB Query?

Smita Kapse

Smita Kapse

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

324 Views

Yes, it is possible to cast in a MongoDB query −db.yourCollectionName.find("this.yourFieldName >yourValue);To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.castingDemo.insertOne({"Amount":"200"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c947e874cf1f7a64fa4df42") } > db.castingDemo.insertOne({"Amount":"100"}); { ... Read More

Convert between binary and ASCII using Python (binascii)

Smita Kapse

Smita Kapse

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

1K+ Views

The binascii module enables conversion between binary and various ASCII encoded binary representations. The binascii module contains low-level functions written in C for greater speed. They are used by the higher-level modules such as uu, base64 or binhex modules.The binascii module defines the following functions. These function are named as ... Read More

The iterator() method of Java AbstractCollection class

Smita Kapse

Smita Kapse

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

144 Views

The iterator() method of the AbstractCollection class in Java is used to return an iterator over the elements contained in this collection.The syntax is as follows −public abstract Iterator iterator()To work with AbstractCollection class in Java, import the following package −import java.util.AbstractCollection;For Iterator, import the following package −import java.util.Iterator;The following ... Read More

Advertisements