Basic or Simple Data Transfer in 8085

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

336 Views

 The simplest data transfer scheme is the basic or simple data transfer. This method is beneficial to us when we have accurate knowledge of the Input-Output device timing characteristics. When we become familiar that the device is ready for transferring data, we execute the instructions IN and OUT, depending on the required data transfer direction. In this case when the Input Output port gets connected in the system as an I/O-mapped I/O port. If we connect the port as a memory-mapped I/O port, “MOV M, A”, “MOV A, M”, or any other memory reference instruction is used which depends on ... Read More

Difference Between #include and #include "filename"

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

362 Views

The difference between the two forms is in the location where the preprocessor searches for the file to be included.#include The preprocessor searches in an implementation-dependent manner, it searches directories pre-designated by the compiler. This method is usually used to include standard library header files.#include "filename"The preprocessor searches in the same directory as the file containing the directive. If this fails, then it starts behaving like the #include form. This method is usually used to include your own header files.

Is It Mandatory to Close JDBC Connections?

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

3K+ Views

At the end of your JDBC program, it is required explicitly to close all the connections to the database to end each database session. However, if you forget, Java's garbage collector will close the connection when it cleans up stale objects.Relying on the garbage collection, especially in database programming, is a very poor programming practice. You should make a habit of always closing the connection with the close() method associated with connection object.To ensure that a connection is closed, you could provide a 'finally' block in your code. A finally block always executes, regardless of an exception occurs or not.To ... Read More

Use getChars in Android TextView

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

220 Views

This example demonstrate about How to use getChars() in Android textview.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 name as Edit text, when user click on button it will take data and returns characters from 9 to end of the string.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import ... Read More

Period withYears Method in Java

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

170 Views

An immutable copy of a Period with the number of years as required is done using the method withYears() in the Period class in Java. This method requires a single parameter i.e. the number of years in the Period and it returns the Period with the number of years as required.A program that demonstrates this is given as followsExample Live Demoimport java.time.Period; public class Demo {    public static void main(String[] args) {       String period = "P5Y7M15D";       Period p1 = Period.parse(period);       System.out.println("The Period is: " + p1);       Period p2 ... Read More

LocalTime TruncatedTo Method in Java

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

97 Views

An immutable truncated LocalTime object can be obtained using the truncatedTo() method in the LocalTime in Java. This method requires a single parameter i.e. the TemporalUnit till which the LocalTime object is truncated and it returns the immutable truncated object.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.time.temporal.ChronoUnit; public class Demo {    public static void main(String[] args) {       LocalTime lt = LocalTime.parse("23:15:30");       System.out.println("The LocalTime is: " + lt.toString());       LocalTime truncatedLocalTime = lt.truncatedTo(ChronoUnit.MINUTES);       System.out.println("The truncated LocalTime is: " + truncatedLocalTime);    } }OutputThe ... Read More

Conway's Game of Life Using Python

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

644 Views

A British mathematician in an around 1970 created his “Game of Life” – which are basically a set of rules depicting the chaotic yet patterned growth of a colony of biological organisms. The “Game of Life” is a two-dimensional grid consists of “living” and “dead” cells.Rules of Game of lifeOverpopulation: A cell dies(off) if its surrounded by more than three living cells.Static: A cell lives(on) if its surrounded by two or three living cells.Underpopulation: A cell dies(off) if its surrounded by fewer than two living cells.Reproduction: A cell becomes live(on) if a dead cell is surrounded by exactly three cells. Cell ... Read More

Send Data Between Activities in Android Using Bundle

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

2K+ Views

This example demonstrate about How to send data from one activity to another in Android using bundle.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.         Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main); ... Read More

Read Map by Map.Entry in Java

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

178 Views

To read the Map, first use getProperties() ad then iterator to iterate through the entire list of Map −Properties prop = System.getProperties(); Iterator i = prop.entrySet().iterator();Now, loop through Map.Entry and get the key-value pair for the Map −while (i.hasNext()) {    Map.Entry entry = (Map.Entry) i.next();    System.out.println(entry.getKey() + " => " + entry.getValue()); }Example Live Demoimport java.util.Iterator; import java.util.Map; import java.util.Properties; public class Demo {    public static void main(String[] a) {       Properties prop = System.getProperties();       Iterator i = prop.entrySet().iterator();       while (i.hasNext()) {          Map.Entry entry = (Map.Entry) ... Read More

Get Difference Between Two Columns in MySQL

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

7K+ Views

Let us first create a table with columns for which we will calculate the difference in a new column −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    LowValue int,    HighValue int ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(LowValue, HighValue) values(100, 200); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable(LowValue, HighValue) values(300, 700); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(LowValue, HighValue) values(1000, 2000); Query OK, 1 row affected (0.13 sec)Following is the query to ... Read More

Advertisements