Internal Address Latch in 8085 Microprocessor

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

520 Views

The select unit of the register in the 8085 selects any one of the register pairs (BC, DE, HL, SP, PC, or WZ) for sending them to it to the latch unit specified for addressing. For example, the contents of the PC be C200H. If the selection unit be the register which selects the PC, and sends C200H from the PC to the address latch internally thereafter the latch holds the specified value and sends directly out to the pins of the address after buffering. The Most Significant Byte of the address i.e. the C2H, is sent out to the ... Read More

Count Multiple Occurrences of Separate Texts in MySQL

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

367 Views

You can use aggregate function count along with if() for this. To understand the concept, let us create a table. The query to create a table is as followsmysql> create table CountOccurrencesDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> TechnicalSubject varchar(100)    -> ); Query OK, 0 rows affected (0.68 sec)Now you can insert some records in the table using insert command. The query is as followsmysql> insert into CountOccurrencesDemo(TechnicalSubject) values('Java'); Query OK, 1 row affected (0.14 sec) mysql> insert into CountOccurrencesDemo(TechnicalSubject) values('MongoDB'); Query OK, 1 row affected (0.13 sec) mysql> insert into ... Read More

LocalDate hashCode Method in Java

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

282 Views

The hash code value of the LocalDate can be obtained using the hashCode() method in the LocalDate class in Java. This method requires no parameters and it returns the hash code value of the LocalDate.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalDate ld = LocalDate.parse("2019-02-15"); System.out.println("The LocalDate is: " + ld); System.out.println("The hash code is: " + ld.hashCode()); } }OutputThe LocalDate ... Read More

toArray Method of CopyOnWriteArrayList in Java

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

118 Views

The toArray() method is used to return an array containing all the elements in this list in proper sequence.The syntax is as follows −Object[] toArray()To work with CopyOnWriteArrayList class, you need to import the following package −import java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class toArray() method in Java−Example Live Demoimport java.util.Arrays; import java.util.concurrent.CopyOnWriteArrayList; public class Demo { public static void main(String[] args) { CopyOnWriteArrayList arrList = new CopyOnWriteArrayList(); arrList.add(220); arrList.add(250); arrList.add(400); ... Read More

Get a Particular Element from MongoDB Array

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

245 Views

You can use the aggregate framework to get a particular element from the MongoDB array. To understand the concept, let us create a collection with the document. The query to create a collection with the document is as follows −> db.getParticularElement.insertOne({"InstructorName":"Larry", "InstructorTechnicalSubject":["Java", "C", "C++", "MongoDB", "MySQL", "SQL Server"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c7ee027559dd2396bcfbfb1") }Display all documents from a collection with the help of find() method. The query is as follows −> db.getParticularElement.find().pretty();The following is the output −{    "_id" : ObjectId("5c7ee027559dd2396bcfbfb1"),    "InstructorName" : "Larry",    "InstructorTechnicalSubject" : [       "Java",       ... Read More

Order By a Function of Two Columns in a Single MySQL Query

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

152 Views

Let us first create a tablemysql> create table orderByAFunctionDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> FirstNumber int,    -> SecodNumber int    -> ); Query OK, 0 rows affected (0.44 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into orderByAFunctionDemo(FirstNumber, SecodNumber) values(10, 4); Query OK, 1 row affected (0.11 sec) mysql> insert into orderByAFunctionDemo(FirstNumber, SecodNumber) values(45, 78); Query OK, 1 row affected (0.17 sec) mysql> insert into orderByAFunctionDemo(FirstNumber, SecodNumber) values(23, 10); Query OK, 1 row affected (0.12 sec) mysql> insert into orderByAFunctionDemo(FirstNumber, SecodNumber) values(67, ... Read More

Find Size of the Largest Independent Set (LIS) in a Binary Tree

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

194 Views

This is a C++ Program to Find Size of the Largest Independent Set (LIS) in a Given a Binary Tree.AlgorithmBegin.    Create a structure n to declare data d, a left child pointer l and a right child pointer r.    Call a function max() to return maximum between two integers. Create a function LIS() to return the    size of the largest independent set in a given binary tree.    Calculate size excluding the current node    int size_excl = LIS(root->l) + LIS(root->r)    Calculate size including the current node    int size_incl = 1;    if (root->l)   ... Read More

C++ Program to Implement Network Flow Problem

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

640 Views

This is a C++ Program to implement Network_Flow problem using Ford Fulkerson algorithm.Algorithms:Begin    function bfs() returns true if there is path from source s to sink t in    the residual graph which indicates additional possible flow in the graph. End Begin    function fordfulkarson() return maximum flow in given graph:    A) initiate flow as 0.    B) If there is an augmenting path from source to sink, add the path to flow.    C) Return flow. EndExample Code#include #include #include #include #define n 7 using namespace std; bool bfs(int g[n][n], int s, int ... Read More

Retrieve Documents Whose Values End with a Particular Character in MongoDB

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

2K+ Views

Following is the syntax to retrieve the documents whose values end with a particular character in MongoDBdb.yourCollectionName.find({yourFieldName: {$regex: "yourEndingCharacter$"}}).pretty();Let us first create a collection with documents>db.retrieveDocumentsWithEndsWithParticularCharacterDemo.insertOne({"StudentName":"Adam", "StudentAge":25, "StudentCountryName":"LAOS"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9c45b32d66697741252456") } >db.retrieveDocumentsWithEndsWithParticularCharacterDemo.insertOne({"StudentName":"Sam", "StudentAge":24, "StudentCountryName":"ANGOLA"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9c45c02d66697741252457") } >db.retrieveDocumentsWithEndsWithParticularCharacterDemo.insertOne({"StudentName":"Robert", "StudentAge":21, "StudentCountryName":"AUS"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9c45cb2d66697741252458") } >db.retrieveDocumentsWithEndsWithParticularCharacterDemo.insertOne({"StudentName":"Chris", "StudentAge":20, "StudentCountryName":"UK"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9c45d92d66697741252459") } >db.retrieveDocumentsWithEndsWithParticularCharacterDemo.insertOne({"StudentName":"Larry", "StudentAge":23, "StudentCountryName":"US"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9c45eb2d6669774125245a") }Following is the query to display all documents from a collection ... Read More

Sort a Subset of Array Elements in Java

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

361 Views

Let us first create a string array −String[] strArr = new String[] { "r", "p", "v", "y", "s", "q" };Now, use Arrays.sort() to get the subset. Use the following to sort only from the index range 2 to 6.Arrays.sort(strArr, 2, 6);Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String[] args) {       String[] strArr = new String[] { "r", "p", "v", "y", "s", "q" };       Arrays.sort(strArr, 2, 6);       System.out.println("Sorted subset of array elements from index 2 to 6...");       for (int a = 0; a < strArr.length; ... Read More

Advertisements