George John has Published 1081 Articles

LongStream allMatch() in Java

George John

George John

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

68 Views

The allMatch() method in the LongStream class returns whether all elements of this stream match the provided predicate.The syntax is as follows.boolean allMatch(LongPredicate predicate)The parameter predicate is a stateless predicate to apply to elements of this stream. The LongPredicate represents a predicate of one long-valued argument.To use the LongStream class ... Read More

Update two separate arrays in a document with one update call in MongoDB?

George John

George John

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

149 Views

You can use $push operator for this. Let us first create a collection with documents>db.twoSeparateArraysDemo.insertOne({"StudentName":"Larry", "StudentFirstGameScore":[98], "StudentSecondGameScore":[77]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b152815e86fd1496b38b8") } >db.twoSeparateArraysDemo.insertOne({"StudentName":"Mike", "StudentFirstGameScore":[58], "StudentSecondGameScore":[78]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b152d15e86fd1496b38b9") } >db.twoSeparateArraysDemo.insertOne({"StudentName":"David", "StudentFirstGameScore":[65], "StudentSecondGameScore":[67]}); {    "acknowledged" : true,    "insertedId" ... Read More

Collectors minBy() method in Java 8

George John

George John

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

491 Views

The minBy() method of the Collectors class in Java 8 returns a Collector that produces the minimum element according to a given Comparator, described as an OptionalThe syntax is as followsstatic Collector

MySQL query to discover current default database collation (via command line client)?

George John

George John

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

311 Views

You need to use INFORMATION_SCHEMA.SCHEMATA for current default database collation.The syntax is as followsSELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = 'yourDatabaseName' LIMIT 1;Let us implement the above syntax to discover current default database collation (via command line client). Our database here is ‘sample’.The query is as follows −mysql> SELECT DEFAULT_COLLATION_NAME ... Read More

BCD numbers in 8085 Microprocessor

George John

George John

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

2K+ Views

Many a time, we are required to represent decimal numbers in a computer, and perform arithmetic on these numbers. For example, we may be required to total the marks a student has obtained in five different subjects, where obviously, the marks are awarded in decimal notation.For this purpose, the BCD ... Read More

How to update value of a key in a list of a json in MongoDB?

George John

George John

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

766 Views

Let us first create a collection with documents> db.updateListOfKeyValuesDemo.insertOne( { "StudentDetails":[ { "StudentName":"John", "StudentAge":23, "StudentCountryName":"US" }, { "StudentName":"Carol", "StudentAge":24, "StudentCountryName":"UK" }, { "StudentName":"Bob", "StudentAge":22, "StudentCountryName":"AUS" } ] } ); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b5b759882024390176545") }Following is the query to display all documents from a collection with ... Read More

How to add a number to a current value in MySQL (multiple times at the same time)?

George John

George John

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

407 Views

You can use UPDATE command for this.The syntax is as followsupdate yourTableName set yourColumnName =yourColumnName +yourIntegerValue where ;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table addANumberToCurrentValueDemo    -> (    -> Game_Id int NOT NULL AUTO_INCREMENT PRIMARY ... Read More

Instruction register (IR) in 8085 Microprocessor

George John

George John

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

3K+ Views

IR (Instruction Register) is a special purpose register, which is used to receive the 8-bit opcode portion of an instruction. It is not accessible to the programmer. What it means is that there are no instructions by which the programmer can load it with values of his choice. For example, ... Read More

How to move data between two tables with columns in different MySQL databases?

George John

George John

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

578 Views

For this, you need to use an INSERT SELECT statement. The syntax is as followsINSERT INTO yourDatabaseName1.yourTableName1(yourColumnName1, yourColumnName2, ....N) SELECT yourColumnName1, yourColumnName2, ....N FROM yourdatabaseName2.yourTableName2;Here, I am using the following two databasessampletestLet us create the first table in the “test” databasemysql> use test; Database changed mysql> create table send   ... Read More

The subList() method of AbstractList class in Java

George John

George John

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

127 Views

The subList() method returns a part of this list between the specified fromIndex, inclusive, and toIndex, exclusive. Get a sublist using the method by setting the range as the two parameters.The syntax is as follows.public List subList(int fromIndex, int toIndex)Here, the parameter fromIndex is the low endpoint (inclusive) of the ... Read More

Advertisements