Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
George John has Published 1080 Articles
George John
283 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
George John
219 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
George John
313 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
George John
213 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
George John
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
George John
671 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
George John
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
George John
158 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
George John
679 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
George John
449 Views
Following example shows how a 407 error code is sent to the client browser. After this, the browser would show you "Need authentication!!!" message. Setting HTTP Status Code ... Read More