George John has Published 1167 Articles

DoubleStream parallel() method in Java

George John

George John

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

80 Views

The parallel() method of the DoubleStream class returns an equivalent stream which is parallel.The syntax is as followsDoubleStream parallel()To use the DoubleStream class in Java, import the following packageimport java.util.stream.DoubleStream;The following is an example to implement DoubleStream parallel() method in JavaExample Live Demoimport java.util.*; import java.util.stream.DoubleStream; public class Demo {   ... Read More

How to query MySQL on the current week?

George John

George John

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

2K+ Views

To query MySQL on the current week, you can use YEARWEEK() function.The syntax is as followsSELECT *FROM yourTableName WHERE YEARWEEK(yourDateColumnName) = YEARWEEK(NOW());To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table currentWeekDemo -> ( ... Read More

8086 program to find sum of Even numbers in a given series

George John

George John

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

1K+ Views

In this program we will see how to add even numbers in a given seriesProblem StatementWrite 8086 Assembly language program to add the even numbers stored in a given series starts from memory offset 501. The size of the series is stored at memory offset 500.DiscussionTo do this task we ... Read More

Get Absolute value with MongoDB aggregation framework?

George John

George John

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

194 Views

You can use $abs operator for this. Let us first create a collection with documents> db.absoluteValueDemo.insert({"Value":98}); WriteResult({ "nInserted" : 1 }) > db.absoluteValueDemo.insert({"Value":-100}); WriteResult({ "nInserted" : 1 }) > db.absoluteValueDemo.insert({"Value":0}); WriteResult({ "nInserted" : 1 }) > db.absoluteValueDemo.insert({"Value":-9999990}); WriteResult({ "nInserted" : 1 })Following is the query to display all documents from ... Read More

GROUP BY the number of rows returned by GROUP BY in MySQL?

George John

George John

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

121 Views

You can use GROUP_CONCAT() for this. To understand the above concept, let us create a table.The query to create a table is as followsmysql> create table groupByDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Name varchar(100)    -> ); Query OK, 0 rows ... Read More

Can we write code in try/catch block in JSP as well?

George John

George John

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

208 Views

If you want to handle errors within the same page and want to take some action instead of firing an error page, you can make use of the try....catch block.Following is a simple example which shows how to use the try...catch block. Let us put the following code in main.jsp ... Read More

DoubleStream sum() method in Java

George John

George John

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

136 Views

The sum() method of the DoubleStream class in Java returns the sum of elements in this stream.The syntax is as followsdouble sum()To use the DoubleStream class in Java, import the following packageimport java.util.stream.DoubleStream;Create DoubleStream and add some elementsDoubleStream doubleStream = DoubleStream.of(23.6, 45.3, 59.6, 60.6, 73.6, 84.7, 94.8);Now, sum the elements ... Read More

How to modify column default value in MySQL?

George John

George John

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

1K+ Views

Let us first create a table −mysql> create table DemoTable (    UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    UserName varchar(20) DEFAULT 'John' ); Query OK, 0 rows affected (0.76 sec)Let us check the description of table −mysql> desc DemoTable;This will produce the following output −+----------+-------------+------+-----+---------+----------------+ | Field ... Read More

MySQL update a column with an int based on order?

George John

George John

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

500 Views

The syntax is as follows to update a column with an int based on orderset @yourVariableName=0; update yourTableName set yourColumnName=(@yourVariableName:=@yourVariableName+1) order by yourColumnName ASC;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table updateColumnDemo    -> (    -> ... Read More

8086 program to find Square Root of a number

George John

George John

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

2K+ Views

In this program we will see how to find the square root of a number.Problem StatementWrite 8086 Assembly language program to find the square root of a number. The number is stored at memory offset 500. Finally store the result at memory offset 600.DiscussionTo find the square root here at ... Read More

Advertisements