We shall write a program in assembly language just for the simulation of a multiplexer 8 to 1 which is used by the logic controller interface.The pins of the 8 to 1 multiplexer to be simulated are assumed to be as shown in the fig.For this multiplexer simulation, 8255 ports as indicated in the following provide the inputs and outputs.Port B used as I7-0 inputs;Pin 7 of Port C used as chip select;Pins 6-4 of Port C used as select inputs;Pin 0 of Port A used as output of multiplexer.Sample CodeFILE NAME Prog_MUX.ASM ORG C100H TABLE DB 01H, 02H, 04H, 08H, ... Read More
The setAt1() method is used to set the Triplet value in JavaTuples and a copy with a new value at the specified index i.e. index 1 here.Let us first see what we need to work with JavaTuples. To work with Triplet class in JavaTuples, you need to import the following package −import org.javatuples.Triplet;Note − Steps to download and run JavaTuples program If you are using Eclipse IDE to run Triplet Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Triplet; ... Read More
This example demonstrates How to get current Wi-Fi network id 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 taken text view to show WIFI network id.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.text.format.Formatter; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView textView; @RequiresApi(api ... Read More
The hash code value of the LocalDateTime can be obtained using the hashCode() method in the LocalDateTime class in Java. This method requires no parameters and it returns the hash code value of the LocalDateTime.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { LocalDateTime ldt = LocalDateTime.parse("2019-02-18T23:15:30"); System.out.println("The LocalDateTime is: " + ldt); System.out.println("The hash code is: " + ldt.hashCode()); } }OutputThe LocalDateTime is: 2019-02-18T23:15:30 The hash code is: -388538188Now let us understand the above program.First ... Read More
The listIterator() method of the AbstractList class in Java is used to return a list iterator over the elements in this list, beginning at the specified position in the list.The syntax is as follows.public ListIterator listIterator(int index)Here, index is the index of the first element to be returned from the list iterator, whereas, ListIterator is an iterator for lists.To work with the AbstractList class, import the following package.import java.util.AbstractList;For ListIterator, import the following package.import java.util.ListIterator;The following is an example to implement listIterator() method of the AbstractlList class in Java.Example Live Demoimport java.util.ArrayList; import java.util.ListIterator; import java.util.AbstractList; public class Demo { ... Read More
This is a C++ program to apply Above-Below-on Test to find the position of a point with respect to a Line. For any point t (xt, yt) on the plane, its position with respect to the line L connecting m and n is found by calculating the scalar s −Y = A xt + B yt + CIf Y< 0, t lies in the clockwise halfplane of L; if Y>0, t lies on the counter-clockwise halfplane; if Y= 0, t lies on L.AlgorithmBegin Take the points as input. For generating equation of the line, generate random numbers for ... Read More
This example demonstrates about Android Recyclerview GridLayoutManager column spacingStep 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 recyclerview.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; public class ... Read More
Yes, we can order with mathematical operations using ORDER BY clause. Let us first create a table:mysql> create table orderByMathCalculation -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Quantity int, -> Price int -> ); Query OK, 0 rows affected (0.57 sec)Following is the query to insert some records in the table using insert command:mysql> insert into orderByMathCalculation(Quantity, Price) values(10, 50); Query OK, 1 row affected (0.21 sec) mysql> insert into orderByMathCalculation(Quantity, Price) values(20, 40); Query OK, 1 row affected (0.14 sec) mysql> insert into orderByMathCalculation(Quantity, Price) values(2, 20); Query ... Read More
Let us first create signed byte −byte signedVal = -100;Now convert a byte to an unsigned integer −int unsignedVal = Byte.toUnsignedInt(signedVal);Examplepublic class Demo { public static void main(String[] args) { byte signedVal = -100; int unsignedVal = Byte.toUnsignedInt(signedVal); System.out.println("Signed value (byte) = " + signedVal); System.out.println("Unsigned value (byte) = " + unsignedVal); } }OutputSigned value (byte) = -100 Unsigned value (byte) = 156
Gauss Seidel method is used to solve linear system of equations in iterative method. This is a C++ Program to Implement Gauss Seidel Method.AlgorithmBegin Take the dimensions of the matrix p and its elements as input. Take the initials values of x and no of iteration q as input. While q>0 Make a for loop i = 0 to p-1 initialize n[i] = (b[i] / a[i][i]). Make a for loop i = 0 to p-1 If (j == ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP