George John has Published 1081 Articles

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

George John

George John

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

2K+ 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

261 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

200 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

293 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

185 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

2K+ 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

643 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

3K+ 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

DoubleStream mapToLong() method in Java

George John

George John

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

141 Views

The mapToLong() method of the DoubleStream class returns a LongStream consisting of the results of applying the given function to the elements of this stream.The syntax is as followsLongStream mapToLong(DoubleToLongFunction mapper)Here, the parameter mapper is a stateless function to apply to each element. The DoubleToLongFunction here is a function that ... Read More

How to update a column of varchar type in MySQL to increase its length?

George John

George John

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

639 Views

Let us first create a table. Here, we have two columns with varchar type −mysql> create table DemoTable (    UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    UserFirstName varchar(10),    UserLastName varchar(20) ,    UserAge int ); Query OK, 0 rows affected (0.96 sec)Let us check the description of ... Read More

Advertisements