Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

Page 57 of 81

Get component of Date / ISODate in MongoDB?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 264 Views

To get component of Date/ISODate in MongoDB, let us create a document with date in the collection. Now let us get the component of Date/ISODate in MongoDB> db.componentOfDateDemo.insert({"ShippingDate":new Date()}); WriteResult({ "nInserted" : 1 })Following is the query to display all documents from a collection with the help of find() method> db.componentOfDateDemo.find().pretty()This will produce the following output{    "_id" : ObjectId("5c9e9d57d628fa4220163b68"),    "ShippingDate" : ISODate("2019-03-29T22:33:59.776Z") }Following is the query to get result using findOne()> var result=db.componentOfDateDemo.findOne();Now you can display documents from the collection. Following is the query> resultThis will produce the following output{    "_id" : ObjectId("5c9e9d57d628fa4220163b68"),    "ShippingDate" : ISODate("2019-03-29T22:33:59.776Z") ...

Read More

What is the difference between JspWriter and PrintWriter?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 292 Views

The JspWriter object contains most of the same methods as the java.io.PrintWriter class. However, JspWriter has some additional methods designed to deal with buffering. Unlike the PrintWriter object, JspWriter throws IOExceptions.

Read More

8086 program to add two 16-bit numbers with or without carry

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 21K+ Views

In this program we will see how to add two 16-bit numbers with and without carry.Problem StatementWrite 8086 Assembly language program to add two 16-bit number stored in memory location 3000H – 3001H and 3002H – 3003H.Discussion8086 is 16-bit register. We can simply take the numbers from memory to AX and BX register, then add them using ADD instruction. When the Carry is present store carry into memory, otherwise only store AX into memory.We are taking two numbers BCAD + FE2D = 1BADAInput:AddressData……3000AD3001BC30022D3003FE…… Flow Diagram ProgramOutputAddressData……3004DA3005BA300601……

Read More

How to write a procedure to insert data in the table in phpMyAdmin?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 528 Views

Let us first create a new table and understand the concept in continuationmysql> create table StoredProcedureInsertDemo    -> (    -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> UserName varchar(20),    -> UserAge int    -> ); Query OK, 0 rows affected (0.63 sec)Here is the query to create a stored procedure to insert data in to the tablemysql> DELIMITER // mysql> create procedure procedure_InsertIntoTable(IN FirstName VARCHAR(100), IN Age INT)    -> BEGIN    -> insert into StoredProcedureInsertDemo(UserName, UserAge) values (FirstName, Age);    -> END    -> // Query OK, 0 rows affected (0.34 sec) mysql> DELIMITER ;Call ...

Read More

How do you limit an array sub-element in MongoDB?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 842 Views

You can use $slice operator to limit an array. Let us create a collection with documents. Following is the query> db.limitAnArrayDemo.insertOne( ...    { ...       _id: 101, ...       "PlayerName": "Bob", ...       "PlayerDetails": {Age:23, isStudent:true}, ...       "PlayerGameScores": [234, 5767, 58, 67, 78, 90, 1002, 576, 68, 45, 23, 45, 678, 89, 78 ] ...    } ... ); { "acknowledged" : true, "insertedId" : 101 }Following is the query to display all documents from a collection with the help of find() method> db.limitAnArrayDemo.find().pretty();This will produce the following output{   ...

Read More

Set Decade value in JavaTuples

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 156 Views

To set a new value in the Decade Tuple, you need to use the setAtX() method. Here, X is the index wherein you want to set the value. For example, setAt2() sets the value at index 2. The value to be included is to be set as the value in the parameter, likesetAt2(“Amit”);Let us first see what we need to work with JavaTuples. To work with Decade class in JavaTuples, you need to import the following packageimport org.javatuples.Decade;Note Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java ...

Read More

What methods of session object is used frequently in JSP and for what purpose?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 302 Views

Here is a summary of important methods available through the session object −Sr.No.Method & Description1public Object getAttribute(String name)This method returns the object bound with the specified name in this session, or null if no object is bound under the name.2public Enumeration getAttributeNames()This method returns an Enumeration of String objects containing the names of all the objects bound to this session.3public long getCreationTime()This method returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.4public String getId()This method returns a string containing the unique identifier assigned to this session.5public long getLastAccessedTime()This method returns the last ...

Read More

Building Multiple Indexes at once in MongoDB?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 2K+ Views

In order to build multiple indexes at once, you need to use createIndexes() and pass multiple keys into an array. Following is the query for building multiple indexes at once.>db.multipleIndexesDemo.createIndexes([{"First":1}, {"Second":1}, {"Third":1}, {"Fourth":1}, {"Fifth":1}]);This will produce the following output{    "createdCollectionAutomatically" : true,    "numIndexesBefore" : 1,    "numIndexesAfter" : 6,    "ok" : 1 }Now get all the indexes> db.multipleIndexesDemo.getIndexes();This will produce the following output[    {       "v" : 2,       "key" : {          "_id" : 1       },       "name" : "_id_",       ...

Read More

How to find capital letters with Regex in MySQL?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 572 Views

You can use REGEXP BINARY for thisselect *from yourTableName where yourColumnName REGEXP BINARY '[A-Z]{2}';Let us first create a tablemysql> create table FindCapitalLettrsDemo    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentFirstName varchar(20)    -> ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into FindCapitalLettrsDemo(StudentFirstName) values('JOHN'); Query OK, 1 row affected (0.24 sec) mysql> insert into FindCapitalLettrsDemo(StudentFirstName) values('Carol'); Query OK, 1 row affected (0.15 sec) mysql> insert into FindCapitalLettrsDemo(StudentFirstName) values('bob'); Query OK, 1 row affected (0.14 sec) mysql> insert into ...

Read More

What is a pageContext Object in JSP?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 1K+ Views

The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The pageContext object is used to represent the entire JSP page.This object is intended as a means to access information about the page while avoiding most of the implementation details.This object stores references to the request and response objects for each request. The application, config, session, and out objects are derived by accessing attributes of this object.The pageContext object also contains information about the directives issued to the JSP page, including the buffering information, the errorPageURL, and page scope.The PageContext class defines several fields, including PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, and APPLICATION_SCOPE, ...

Read More
Showing 561–570 of 810 articles
« Prev 1 55 56 57 58 59 81 Next »
Advertisements