Interrupt Driven Data Transfer in 8085

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

3K+ Views

We use this method when there is a lack of accurate knowledge of the timing characteristics of the Input Output device which takes maximum time for the device to be ready for use. Suppose we resort for the checking of data transfer; the processor here wastes a huge time in the loop for the device to get ready up to the mark. For avoiding this problem, we use the interrupt-driven data transfer process. Here the processor goes ahead with its desired work, and as soon as the device is ready for data transfer process, the corresponding Input Output port sends ... Read More

Write Image File in External Storage with Runtime Permission in Android

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

1K+ Views

This example demonstrates How to write an image file in external storage with runtime permission 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 a button. When user click on button, it will store data in external storage.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.annotation.TargetApi; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; ... Read More

Use UNLIKELY in Android SQLite

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

153 Views

Before getting into example, we should know what sqlite database in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.This example demonstrates about How to use unlikely () in Android sqliteStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create ... Read More

Instant isAfter Method in Java

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

253 Views

It can be checked if a particular Instant object is after the other Instant object in a timeline using the isAfter() method in the Instant class in Java. This method requires a single parameter i.e. the Instant object that is to be compared. It returns true if the Instant object is after the other Instant object and false otherwise.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; import java.time.temporal.ChronoUnit; public class Demo {    public static void main(String[] args) {       Instant i1 = Instant.parse("2019-01-13T16:10:35.00Z");       Instant i2 = Instant.parse("2019-01-13T11:19:28.00Z");       boolean ... Read More

LocalTime toNanoOfDay Method in Java

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

96 Views

The time in the form of nanoseconds of the day can be obtained using the toNanoOfDay() method in the LocalTime class in Java. This method requires no parameters and it returns the time in the form of nanoseconds of the day.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main {    public static void main(String[] args) {       LocalTime lt = LocalTime.parse("05:15:30");       System.out.println("The LocalTime is: " + lt);       System.out.println("The nanoseconds of the day are: " + lt.toNanoOfDay());    } }OutputThe LocalTime is: 05:15:30 The nanoseconds of ... Read More

Replace Values in a MySQL Table

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

287 Views

To replace values in a table, use the CASE statement. To understand the concept, let us create a table. The query to create a table is as followsmysql> create table replaceValueDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Name varchar(10),    -> isGreaterThan18 varchar(10)    -> ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into replaceValueDemo(Name, isGreaterThan18) values('John', 'YES'); Query OK, 1 row affected (0.24 sec) mysql> insert into replaceValueDemo(Name, isGreaterThan18) values('Carol', 'NO'); Query OK, 1 row affected (0.16 sec) ... Read More

StringJoiner Merge Method in Java 8

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

339 Views

The merge() method of the StringJoiner class in Java 8 is used to merge the contents of the StringJoiner str, which is passed as a parameter. The content gets added as the next element.The syntax is as follows:public StringJoiner merge(StringJoiner str)Here, str is the StringJoiner content to be merged.To work with the StringJoiner in Java 8, import the following package:import java.util.StringJoiner;The following is an example to implement StringJoiner merge() method in Java:Example Live Demoimport java.util.StringJoiner; public class Demo {    public static void main(String[] args) {       // StringJoiner 1       StringJoiner strJoin1 = new StringJoiner(" "); ... Read More

Implement Hash Tables Using Chaining with Singly Linked Lists in C++

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

4K+ Views

A hash table is a data structure which is used to store key-value pairs. Hash function is used by hash table to compute an index into an array in which an element will be inserted or searched.This is a C++ program to Implement Hash Tables chaining with singly linked lists.AlgorithmFor insert:Begin    Declare Function Insert(int k, int v)       int hash_v = HashFunc(k)       HashTableEntry* p = NULL       HashTableEntry* en = ht[hash_v]       while (en!= NULL)          p = en          en= en->n     ... Read More

Remove Partial Text from Value in MySQL

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

574 Views

In order to remove partial text from value, you can use REPLACE() from MySQL. Following is the syntax −update yourTableName set yourColumnName = replace(yourColumnName ,'yourValue ', '' );Let us first create a table −mysql> create table removePartialTextDemo    -> (    -> JavaVersionDetails varchar(100)    -> ); Query OK, 0 rows affected (0.51 sec)Following is the query to insert some records in the table using insert command −mysql> insert into removePartialTextDemo values('Java Version 1.0'); Query OK, 1 row affected (0.50 sec) mysql> insert into removePartialTextDemo values('Java Version 1.1'); Query OK, 1 row affected (0.23 sec) mysql> insert into ... Read More

Display Prime Numbers Less Than a Given Number in Java

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

410 Views

Let’s say the value you have set is 20 and you have to display a prime number less than this value i.e. 19 in this case.The following is an example that displays a prime number less than the given number −Example Live Demopublic class Demo {    public static void main(String[] args) {       int val = 20;       boolean[] isprime = new boolean[val + 1];       for (int i = 0; i

Advertisements