George John has Published 1167 Articles

8086 program to add two 16 bit BCD numbers with carry

George John

George John

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

2K+ Views

In this program we will see how to add two 16-bit BCD numbers with carry.Problem StatementWrite 8086 Assembly language program to add two 16-bit BCD numbers stored in memory offset 500H – 501H and 502H – 503H.DiscussionHere we are adding the 16-bit data byte by byte. At first we are ... Read More

How to get connected clients in MongoDB?

George John

George John

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

599 Views

To get connected clients in MongoDB, use currentOp() with the set value to true and you need to iterate array result set with the help of field client. Let us first implement currentOp> db.currentOp(true)Following is the output. Here the client is 127.0.0.1 since we are using localhost. The output displays ... Read More

Please share a working example of session maintenance in JSP.

George John

George John

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

227 Views

This example describes how to use the HttpSession object to find out the creation time and the last-accessed time for a session. We would associate a new session with the request if one does not already exist.           Session Tracking       ... Read More

Unordered_multimap operator= in C++

George John

George John

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

48 Views

The C++ function std::unordered_multimap::operator=() assigns new contents to the unordered_multimap by replacing old ones and modifies size if necessary.Following is the declaration for std::unordered_multimap::operator=() function form std::unordered_map() header.C++11 (Syntax)unordered_multimap& operator=(const unordered_multimap& umm);Parametersumm - Another unordered_multimap object of same type.Return ValueReturns this pointer.Example Code#include #include using namespace std; int ... Read More

How to check if field is a number in MongoDB?

George John

George John

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

413 Views

To check if field is a number in MongoDB, use the $type operator. Following is the syntaxdb.yourCollectionName.find({youtFieldName: {$type:"number"}}).pretty();Let us first create a collection with documents> db.checkIfFieldIsNumberDemo.insertOne({"StudentName":"John", "StudentAge":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ec75dd628fa4220163b83") } >db.checkIfFieldIsNumberDemo.insertOne({"StudentName":"Chris", "StudentMathScore":98, "StudentCountryName":"US"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ec77cd628fa4220163b84") } ... Read More

What is an application Object in JSP?

George John

George John

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

328 Views

The application object is direct wrapper around the ServletContext object for the generated Servlet and in reality an instance of a javax.servlet.ServletContext object.This object is a representation of the JSP page through its entire lifecycle. This object is created when the JSP page is initialized and will be removed when ... Read More

Reset the primary key to 1 after deleting all the data in MySQL?

George John

George John

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

7K+ Views

To reset the primary key to 1 after deleting the data, use the following syntaxalter table yourTableName AUTO_INCREMENT=1; truncate table yourTableName;After doing the above two steps, you will get the primary key beginning from 1.To understand the above concept, let us create a table. The query to create a table ... Read More

Renaming column name in a MongoDB collection?

George John

George John

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

568 Views

To rename column name in a collection, you can use $rename operator. Following is the syntaxdb.yourCollectionName.update({}, {$rename: {'yourOldColumName': 'yourNewColumnName'}}, false, true);Let us first create a collection with documents:> db.renamingColumnNameDemo.insertOne({"StudentName":"Larry", "Age":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9ee2c6d628fa4220163b9a") } > db.renamingColumnNameDemo.insertOne({"StudentName":"Sam", "Age":26}); {    "acknowledged" : true,    "insertedId" ... Read More

C++ Program that will fill whole memory

George John

George John

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

229 Views

In this article we will see how to fill the whole memory by writing a simple C++ program. Here the logic is very simple. We shall create new integer variables by using the dynamic memory allocation. If we create some variables again and again, it will fill the entire primary ... Read More

Adding new property to each document in a large MongoDB collection?

George John

George John

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

667 Views

You can use update command along with forEach() for large collection. Let us first create a collection with documents>db.addingNewPropertyDemo.insertOne({"StudentName":"John", "StudentAge":23, "CountryName":"US"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca1e61866324ffac2a7dc56") } >db.addingNewPropertyDemo.insertOne({"StudentName":"David", "StudentAge":21, "CountryName":"AUS"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca1e62366324ffac2a7dc57") } >db.addingNewPropertyDemo.insertOne({"StudentName":"Bob", "StudentAge":21, "CountryName":"UK"}); {    "acknowledged" ... Read More

Advertisements