Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

Page 56 of 81

8085 Program to do an operation on two numbers based on the contents of X

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

Now let us see a program of Intel 8085 Microprocessor. In this program we will see how to do different operations based on choice.Problem Statement:Write 8085 Assembly language program to perform some operations on two 8-bit binary numbers base on choice.Discussion:In this program we are taking a choice. The choice value is stored at memory location 8000H (named as X). And the numbers are stored at location 8001H and 8002H. We are storing the result at location 8050H and 8051H.Here if the choice is 00H, then it will perform addition, for 01H, it will perform subtraction, and for 02H, it ...

Read More

How to find edit text values start from consonant or not?

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

This example demonstrate about How to find edit text values start from consonant or not.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         In the above code, we have taken edit text and button view to verify edit text data is starting with a consonant.Step 3− Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity ...

Read More

MongoDB query which represents not equal to null or empty?

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

To set a query for not equal to null or empty, use the $nin operator. The syntax is as followsdb.yourCollectionName.find({yourFieldName:{$nin:[null, ""]}});Let us create a collection with documents> db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"Larry", "UserAge":24}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20b6a629b87623db1b26") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"", "UserAge":29}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20bea629b87623db1b27") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"Sam", "UserAge":32}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20c7a629b87623db1b28") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":null, "UserAge":27}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20d2a629b87623db1b29") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"Robert", "UserAge":26}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d20dda629b87623db1b2a") } > db.notEqualToNullOrEmptyDemo.insertOne({"UserName":"", "UserAge":23}); {    "acknowledged" : true,   ...

Read More

MySQL replication: temporarily prevent specific SQL statements replicating to the slaves?

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

To achieve this, you need to set sql_log_bin to 0. To understand the concept, let us create a table. The query to create a table is as followsmysql> create table SQLStatementsDemo    -> (    -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> UserName varchar(20)    -> ); Query OK, 0 rows affected (0.79 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into SQLStatementsDemo(UserName) values('John'); Query OK, 1 row affected (0.18 sec) mysql> insert into SQLStatementsDemo(UserName) values('Carol'); Query OK, 1 row affected (0.14 sec) mysql> insert into SQLStatementsDemo(UserName) values('Bob'); Query ...

Read More

MongoDB equivalent of SELECT field AS `anothername`?

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

In MySQL, we give an alias name for a column. Similarly, you can give an alias name for field name in MongoDB. The MongoDB equivalent syntax is as followsdb.yourCollectionName.aggregate( [    { "$project": {       "_id": 0,       "anyAliasName": "$yourFieldName"    }} ]);Let us first create a collection with documents> db.selectFieldAsAnotherNameDemo.insertOne({"Name":"Larry"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d448827b86948e204ca91") } > db.selectFieldAsAnotherNameDemo.insertOne({"Name":"Robert"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d449027b86948e204ca92") } > db.selectFieldAsAnotherNameDemo.insertOne({"Name":"Sam"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d449527b86948e204ca93") } > db.selectFieldAsAnotherNameDemo.insertOne({"Name":"Mike"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9d449927b86948e204ca94") ...

Read More

Which methods can be used to read HTTP header in your JSP program.

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

The request object provides methods to get HTTP header information including form data, cookies, HTTP methods, etc.Following table lists out the important methods that can be used to read HTTP header in your JSP program. These methods are available with HttpServletRequest object which represents client request to webserver.Sr.No.Method & Description1Cookie[] getCookies()Returns an array containing all of the Cookie objects the client sent with this request.2Enumeration getAttributeNames()Returns an Enumeration containing the names of the attributes available to this request.3Enumeration getHeaderNames()Returns an enumeration of all the header names this request contains.4Enumeration getParameterNames()Returns an enumeration of String objects containing the names of the ...

Read More

Get MongoDB Databases in a JavaScript Array?

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

To get MongoDB databases in a JavaScript array, you can use runCommand(). Following is the query to get MongoDB databases in a JavaScript array> use admin; switched to db admin > allDatabasesDetails = db.runCommand({listDatabases: 1});This will produce the following output{    "databases" : [       {          "name" : "admin",          "sizeOnDisk" : 847872,          "empty" : false       },       {          "name" : "config",          "sizeOnDisk" : 98304,          "empty" : false     ...

Read More

Check if MongoDB database exists?

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

There are two possibilities to check if MongoDB database exists.Case 1: The first possibility is that the MongoDB database exists i.e. it returns particular index.Case 2: The second possibility is that the MongoDB database does not exist i.e. it returns index -1.NOTE: An index starts from 0 and ends with (N-1) like an array.The syntax is as follows to check if MongoDB database exists.db.getMongo().getDBNames().indexOf("yourDatabaseName");Case 1: Let us implement the above syntax to check if MongoDB database exists. Following is the querydb.getMongo().getDBNames().indexOf("test");This will produce the following output6Look at the above sample output, we are getting 6 that means the database “test” ...

Read More

How do I use the conditional operator in C/C++?

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

This conditional operator is also known as the Ternary Operator. This operator has three phase.Exp1 ? Exp2 : Exp3;where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the colon. The value of a ? expression is determined like this: Exp1 is evaluated. If it is true, then Exp2 is evaluated and becomes the value of the entire ? expression. If Exp1 is false, then Exp3 is evaluated and its value becomes the value of the expression.The ? is called a ternary operator because it requires three operands and can be used to replace if-else statements, which ...

Read More

Example on ToggleButton?

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

Before getting into example, we should know what is togglebutton in android, Toggle button is extended view of Button view. It going to represent of state of button as checked and unchecked. Here is the simple solution about toggle button in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code we have added toggle button, when user click on toggle button it going to change the state.Step 3 ...

Read More
Showing 551–560 of 810 articles
« Prev 1 54 55 56 57 58 81 Next »
Advertisements