Nishtha Thakur has Published 387 Articles

How to use time() in Android sqlite?

Nishtha Thakur

Nishtha Thakur

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

440 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

How to hide _id from Aggregation?

Nishtha Thakur

Nishtha Thakur

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

599 Views

To hide _id from aggregation, use the below syntax −db.yourCollectionName.aggregate(    {$project : {       _id : 0 ,       yourIncludeFieldName:1,       yourIncludeFieldName:1    }} ).pretty();To understand the above syntax, let us create a collection with the document. The query to create a collection ... Read More

How to generate Infinite Stream of Double in Java using DoubleStream.generate()

Nishtha Thakur

Nishtha Thakur

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

150 Views

The DoubleStream.generate() method returns an infinite sequential unordered stream where each element is generated by the provided DoubleSupplier.The syntax is as follows −static DoubleStream generate(DoubleSupplier s)Here, s is the DoubleSupplier for generated elements. The DoubleSupplier represents a supplier of double-valued results.To use the DoubleStream class in Java, import the following ... Read More

LongStream forEachOrdered() method in Java

Nishtha Thakur

Nishtha Thakur

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

135 Views

The forEachOrdered() method in Java performs an action for each element of this stream, guaranteeing that each element is processed in encounter order for streams that have a defined encounter order.The syntax is as follows −void forEachOrdered(LongConsumer action)Here, parameter wrapper is a non-interfering action to perform on the elements. LongConsumer ... Read More

Encode and decode binhex4 files using Python (binhex)

Nishtha Thakur

Nishtha Thakur

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

686 Views

The binhex module encodes and decodes files in binhex4 format. This format is used in the representation of Macintosh files in ASCII. Only the data fork is handled.The binhex module defines the following functions −binhex.binhex(input, output): Convert a binary file with filename input to binhex file output. The output parameter can ... Read More

Prettyprint in MongoDB shell as default?

Nishtha Thakur

Nishtha Thakur

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

269 Views

You can call pretty() function on cursor object to prettyprint in MongoDB shell. The syntax is as follows −db.yourCollectionName.find().pretty();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.prettyDemo.insertOne({"ClientName":"Larry", "ClientAge":27, "ClientFavoriteCountry":["US", "UK"]}); {    "acknowledged" : ... Read More

Match between fields in MongoDB aggregation framework?

Nishtha Thakur

Nishtha Thakur

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

310 Views

      You can use $cmp operator for this. 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.matchBetweenFieldsDemo.insertOne({"FirstValue":40, "SecondValue":70}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c92c9625259fcd19549980d") } > db.matchBetweenFieldsDemo.insertOne({"FirstValue":20, "SecondValue":5}); ... Read More

Set vs Map in C++ STL

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

Set is an abstract data type in which each element has to be unique because the value of the element identifies it. The value of the element cannot be modified once it is added to the set, but it is possible to remove and add the modified value of that ... Read More

The isEmpty() method of Java AbstractCollection class

Nishtha Thakur

Nishtha Thakur

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

336 Views

The isEmpty() method of the AbstractCollection class checks whether the collection is empty or not i.e. whether it has zero elements. It returns if the Collectionn has no elements.The syntax is as follows −public boolean isEmpty()To work with AbstractCollection class in Java, import the following package −import java.util.AbstractCollection;The following is ... Read More

How to return static strings in MySQL?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

In order to return static strings in MySQL, you can use UNION. Following is the syntax −select 'yourStringValue1' as yourAliasName UNION select 'yourStringValue2' as yourAliasName;Let us implement the above syntax to return static strings in MySQL. Following is the query −mysql> select 'HELLO' as staticStringsResult    -> UNION    -> ... Read More

Advertisements