Ankith Reddy has Published 1070 Articles

ArrayBlockingQueue remove() method in Java

Ankith Reddy

Ankith Reddy

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

81 Views

The remove() method of the ArrayBlockingQueue class in Java is used to remove a single instance of the specified element from this queue.The syntax is as followsboolean remove(Object ele)Here, ele is the element to be removed from the queue. To work with ArrayBlockingQueue class, you need to import the following ... Read More

Generation of rectangular wave using DAC interface

Ankith Reddy

Ankith Reddy

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

538 Views

We write a program for the generation of rectangular interface of Digital to Analog Converter (DAC) interference: Let us consider a problem solution in this domain. The problem states that: To get unipolar output, J1 is shorted to J2 on the interface. To display the waveform on a CRO connect pin ... Read More

How to search document in MongoDB by _id

Ankith Reddy

Ankith Reddy

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

351 Views

To search a document in MongoDB by _id, you need to call ObjectId(). Let us first see the syntaxdb.yourCollectionName.find({"_id":ObjectId("yourId")}).pretty();To understand the concept and search a document, let us implement the following query to create a collection with documents> db.searchDocumentDemo.insertOne({"UserId":1, "UserName":"Larry"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c97a8e4330fd0aa0d2fe487") } ... Read More

Does SELECT TOP command exist in MySQL to select limited number of records?

Ankith Reddy

Ankith Reddy

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

178 Views

There is no concept of TOP in MySQL. The alternate way to write your query is using LIMIT i.e to select 2 records, you need to use TOP 2. Let us see the syntax for the same in MySQLSELECT *FROM yourTableName ORDER BY yourColumnName DESC LIMIT 2;To understand the above ... Read More

IntStream noneMatch() method in Java

Ankith Reddy

Ankith Reddy

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

626 Views

The noneMatch() method in Java returns whether no elements of this stream match the provided predicate. The true boolean value is returned if either no elements of the stream match the provided predicate or the stream is empty.The syntax is as followsBoolean noneMatch(IntPredicate predicate)Here, parameter predicate is the stateless predicate ... Read More

The addAtX() method of the Octet Tuple in Java

Ankith Reddy

Ankith Reddy

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

53 Views

The addAtX() method is used in Octet Tuple to add value. Here, X is the index wherein you need to add the value i.e. to add value at index 0, use the addAt0() and value as a parameter. Let us first see what we need to work with JavaTuples. To ... Read More

How to remove document on the basis of _id in MongoDB?

Ankith Reddy

Ankith Reddy

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

150 Views

To remove document on the basis of _id in MongoDB, implement the following syntaxdb.yourCollectionName.remove({“_id”:ObjectId(“yourId”});Let us first implement the following query to create a collection with documents>db.removeDocumentOnBasisOfId.insertOne({"UserName":"Larry", "UserAge":23, "UserCountryName":"US"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c986f9f330fd0aa0d2fe4a3") } >db.removeDocumentOnBasisOfId.insertOne({"UserName":"Sam", "UserAge":21, "UserCountryName":"UK"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c986fb4330fd0aa0d2fe4a4") ... Read More

Set value in the JavaTuples KeyValue class

Ankith Reddy

Ankith Reddy

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

77 Views

To set value in the JavaTuples KeyValue class, you need to use the setValue() method. Let us first see what we need to work with JavaTuples. To work with KeyValue class in JavaTuples, you need to import the following packageimport org.javatuples.KeyValue;Note Download JavaTuples Jar library to run JavaTuples program. If ... Read More

Can I get the first item in a Cursor object in MongoDB?

Ankith Reddy

Ankith Reddy

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

496 Views

Yes, you can get the first item in a cursor object using findOne() method. Following is the syntaxdb.yourCollectionName.findOne();However, the following syntax is used if you want a single document in a cursor objectdb.yourCollectionName.findOne({yourCondition});We will first create a collection. Following is the query to create a collection with documents> db.getFirstItemDemo.insertOne({"CustomerName":"Chris", "CustomerAge":28}); ... Read More

How to increment all the rows of a particular column by 1 in a single MySQL query (ID column +1)?

Ankith Reddy

Ankith Reddy

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

1K+ Views

To increment all the rows of a particular ID column by 1, you need to use UPDATE command and update the table. The syntax of the query is as follows. We have also used ORDER BY hereUPDATE yourTableName SET yourIdColumnName=yourIdColumnName+1 ORDER BY yourIdColumnName DESC;To understand the above syntax, let us ... Read More

Advertisements