So far we have come across OF, MR, MW, IOR, and IOW machine cycles. The other possible machine cycles in 8085 are BI (bus idle) and INA (interrupt acknowledge) machine cycles. Now the differences between some of the machine cycles are presented in the following tables.Difference between OF and MR1. Number of T states in case for OF is 4, Number of T states in case for MR is 32. In case of OF address can be sent out from PC. Whereas in case of MR it can be sent from BC, PC, DE, HL etc.3. In case of OF, ... Read More
Before getting into example, we should know what sqlite data base in android is. SQLite is an opensource 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 demonstrate about How to use SELECT Query in Android sqlite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create ... Read More
This example demonstrates about How to remove data from HashSet in AndroidStep 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 the name and record number as Edit text, when user clicks on save button it will store the data into ArrayList. Click on delete button ... Read More
What is Android background music service?Before getting into an example, we should know what service is in android. Service is going to do background operation without interacting with UI and it works even after activity destroy.This example demonstrates what is Android background music service.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, when user click on text view, it will start ... Read More
This represents a scrollable ResultSet i.e. the cursor moves in forward or backward directions. This type of ResultSet is insensitive to the changes that are made in the database i.e. the modifications done in the database are not reflected in the ResultSet.Which means if we have established a connection with a database using JDBC program and retrieved a ResultSet holding all the records in a table named SampleTable and, meanwhile if we add some more records to the table (after retrieving getting the ResultSet), these recent changes will not be reflected in the ResultSet object we previously obtained.ExampleConsider we have ... Read More
An immutable copy of a LocalDateTime object where some seconds are added to it can be obtained using the plusSeconds() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the number of seconds to be added and it returns the LocalDateTime object with the added seconds.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.now(); System.out.println("The current LocalDateTime is: " + ldt); System.out.println("The LocalDateTime with 5 seconds added is: ... Read More
Binary search is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the sorted array. The time complexity of binary search is O(1). This is a C++ program in which we implement various. Binary Search functions in C++ STLAlgorithmBegin Initialize the vector of integer values. The functions are used here: binary_search(start_pointer, end_pointer, value) = Returns true if the value present in array otherwise false. lower_bound(start_pointer, end_pointer, value) = Returns pointer to “position of value” if container ... Read More
In this section, we will see what is the at a () function in C++. The at() function is used to access the character at a given position.In this program, we will iterate through each character using at a () function and print them into different lines.Example Code Live Demo#include using namespace std; main() { string my_str = "Hello World"; for(int i = 0; i
This example demonstrate about how to programmatically take a screenshot 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 two views as imageview and textview. when user click on textview, it going to take screen shot and append to imageview.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.graphics.Bitmap; import android.graphics.Canvas; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageView; import ... Read More
To strip all spaces from a column in MySQL, you can use REPLACE() function. Following is the syntax −update yourTableName set yourColumnName=REPLACE(yourColumnName, ' ', '' );Let us first create a table −mysql> create table stripAllSpacesDemo -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(100) -> ); Query OK, 0 rows affected (0.56 sec)Following is the query to insert records in the table using insert command −mysql> insert into stripAllSpacesDemo(Name) values('Jo h n'); Query OK, 1 row affected (0.19 sec) mysql> insert into stripAllSpacesDemo(Name) values(' Joh n'); Query OK, 1 row affected (0.16 ... Read More