Remove Data from HashSet in Android

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

223 Views

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

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

2K+ Views

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

Type Scroll Insensitive ResultSet in JDBC

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

2K+ Views

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

LocalDateTime plusSeconds Method in Java

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

152 Views

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 Functions in C++ STL

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

1K+ Views

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

String::at() Function in C++

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

155 Views

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

Programmatically Take a Screenshot in Android

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

2K+ Views

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

Strip All Spaces from a Column in MySQL

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

1K+ Views

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

Convert LocalDateTime to LocalDate and LocalTime in Java

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

4K+ Views

At first set a LocalDateTime:LocalDate date = LocalDate.now(); LocalTime time = LocalTime.now(); LocalDateTime dateTime = LocalDateTime.of(date, time);Now, convert the LocalDateTime to LocalDate and LocalTime:LocalDate localDate = LocalDateTime.now().toLocalDate(); LocalTime localTime = LocalDateTime.now().toLocalTime();Exampleimport java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; public class Demo {    public static void main(String[] args) {       LocalDate date = LocalDate.now();       LocalTime time = LocalTime.now();       LocalDateTime dateTime = LocalDateTime.of(date, time);       System.out.println("DateTime = "+dateTime);       LocalDate localDate = LocalDateTime.now().toLocalDate();       LocalTime localTime = LocalDateTime.now().toLocalTime();       System.out.println("Date = "+localDate);       System.out.println("Time = ... Read More

Memory Speed Requirement in 8085 Microprocessor

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

336 Views

At the end of the state T2 in a machine cycle, 8085 processor senses the Ready input pin. If it is logic 0, 8085 processors enter the Twait state, else it enters to the T3 state. The Ready input is permanently fixed to logic 1. The memory chips and the Input Output ports in the system same speed with 8085. Else appropriate number of wait states should be generated by the external circuit. In fact, in the ALS kit the Ready pin should be fixed to logic 1As an example, we check up if the 27128A-20 16K×8 EPROM chip are used ... Read More

Advertisements