Chandu yadav has Published 1091 Articles

IntStream forEachOrdered() method in Java

Chandu yadav

Chandu yadav

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

395 Views

The forEachOrdered() method in Java assures that each element is processed in order for streams that have a defined encounter order.The syntax is as followsvoid forEachOrdered(IntConsumer action)Here, the action parameter is a non-interfering action to be performed on the elements.Create an IntStream and add elements to the streamIntStream intStream = ... Read More

MySQL replication: temporarily prevent specific SQL statements replicating to the slaves?

Chandu yadav

Chandu yadav

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

138 Views

To achieve this, you need to set sql_log_bin to 0. To understand the concept, let us create a table. The query to create a table is as followsmysql> create table SQLStatementsDemo    -> (    -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> UserName varchar(20)    -> ); ... Read More

MongoDB equivalent of SELECT field AS `anothername`?

Chandu yadav

Chandu yadav

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

2K+ Views

In MySQL, we give an alias name for a column. Similarly, you can give an alias name for field name in MongoDB. The MongoDB equivalent syntax is as followsdb.yourCollectionName.aggregate( [    { "$project": {       "_id": 0,       "anyAliasName": "$yourFieldName"    }} ]);Let us first create ... Read More

Which methods can be used to read HTTP header in your JSP program.

Chandu yadav

Chandu yadav

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

421 Views

The request object provides methods to get HTTP header information including form data, cookies, HTTP methods, etc.Following table lists out the important methods that can be used to read HTTP header in your JSP program. These methods are available with HttpServletRequest object which represents client request to webserver.Sr.No.Method & Description1Cookie[] ... Read More

Get MongoDB Databases in a JavaScript Array?

Chandu yadav

Chandu yadav

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

240 Views

To get MongoDB databases in a JavaScript array, you can use runCommand(). Following is the query to get MongoDB databases in a JavaScript array> use admin; switched to db admin > allDatabasesDetails = db.runCommand({listDatabases: 1});This will produce the following output{    "databases" : [       {     ... Read More

Check if MongoDB database exists?

Chandu yadav

Chandu yadav

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

3K+ Views

There are two possibilities to check if MongoDB database exists.Case 1: The first possibility is that the MongoDB database exists i.e. it returns particular index.Case 2: The second possibility is that the MongoDB database does not exist i.e. it returns index -1.NOTE: An index starts from 0 and ends with ... Read More

How do I use the conditional operator in C/C++?

Chandu yadav

Chandu yadav

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

306 Views

This conditional operator is also known as the Ternary Operator. This operator has three phase.Exp1 ? Exp2 : Exp3;where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the colon. The value of a ? expression is determined like this: Exp1 is evaluated. If it is true, ... Read More

Example on ToggleButton?

Chandu yadav

Chandu yadav

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

215 Views

Before getting into example, we should know what is togglebutton in android, Toggle button is extended view of Button view. It going to represent of state of button as checked and unchecked. Here is the simple solution about toggle button in android.Step 1 − Create a new project in Android ... Read More

Get component of Date / ISODate in MongoDB?

Chandu yadav

Chandu yadav

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

242 Views

To get component of Date/ISODate in MongoDB, let us create a document with date in the collection. Now let us get the component of Date/ISODate in MongoDB> db.componentOfDateDemo.insert({"ShippingDate":new Date()}); WriteResult({ "nInserted" : 1 })Following is the query to display all documents from a collection with the help of find() method> ... Read More

The toArray(T[] a) method of CopyOnWriteArrayList in Java

Chandu yadav

Chandu yadav

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

111 Views

The difference between toArray() and toArray(T[] arr) of the CopyOnWriteArrayList class is that both the methods returns an array containing all of the elements in this collection, but the latter has some additional features i.e. the runtime type of the returned array is that of the specified array.The syntax is ... Read More

Advertisements