This example demonstrate about How to check android mobile supports PROXIMITY sensorStep 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 text view to show PROXIMITY sensor information.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.SuppressLint; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView ... Read More
The syntax is as followsDoubleStream peek(DoubleConsumer action)Here, DoubleConsumer is an operation that accepts a single double-valued argument and returns no result.To use the DoubleStream class in Java, import the following packageimport java.util.stream.DoubleStream;The following is an example to implement DoubleStream peek() method in JavaExample Live Demoimport java.util.*; import java.util.stream.DoubleStream; public class Demo { public static void main(String[] args) { DoubleStream doubleStream = DoubleStream.of(28.7, 35.6, 48.3, 69.8, 75.8, 80.5, 90.8); System.out.println("Elements in the stream..."); long num = doubleStream.peek(System.out::println).count(); System.out.println("Number of elements in the stream = " + num); } ... Read More
You can use LIKE operator to find strings with a given prefix.The syntax is as followsselect *from yourTableName where yourColumnName LIKE 'yourPrefixValue%';To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table findStringWithGivenPrefixDemo -> ( -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> UserMessage text -> ); Query OK, 0 rows affected (0.82 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into findStringWithGivenPrefixDemo(UserMessage) values('Hi Good Morning !!!'); Query OK, 1 row affected (0.17 sec) mysql> insert into findStringWithGivenPrefixDemo(UserMessage) values('Hey ... Read More
We almost all use google maps to check distance between source and destination and check the travel time. For developers and enthusiasts, google provide ‘google distance matrix API’ to calculate the distance and duration between two places.To use google distance matrix api, we need google maps API keys, which you can get from below link:https://developers.google.com/maps/documentation/distance-matrix/get-api-keyRequired librariesWe can accomplish this by using different python library, like:PandasgooglemapsRequestsJsonI am using very basic requests and json library. Using pandas you can fill multiple source and destination places at a time and get the result in csv file.Below is the program to implement the same:# ... Read More
The sequential() method of the IntStream class in Java is used to return a sequential IntStream. The syntax is as follows:IntStream sequential()First, create an IntStream and elements in a range using the range() method:IntStream intStream1 = IntStream.range(11, 21);Now, for a sequential IntStream, use the sequential() method like this:IntStream intStream2 = intStream1.sequential();The following is an example to implement IntStream sequential() method in Java:Example Live Demoimport java.util.*; import java.util.stream.IntStream; public class Demo { public static void main(String[] args) { IntStream intStream1 = IntStream.range(11, 21); IntStream intStream2 = intStream1.sequential(); intStream2.forEach(System.out::println); } }Output11 12 ... Read More
If you want to give transparent background for your view, This example demonstrate about How to make a background 20% transparent on Android.All hex value from 100% to 0% alpha100% — FF99% — FC98% — FA97% — F796% — F595% — F294% — F093% — ED92% — EB91% — E890% — E689% — E388% — E087% — DE86% — DB85% — D984% — D683% — D482% — D181% — CF80% — CC79% — C978% — C777% — C476% — C275% — BF74% — BD73% — BA72% — B871% — B570% — B369% — B068% — AD67% — AB66% — A865% ... Read More
Bitcoins or any other cryptocurrency for that matter, trade at different values. These values are based on supply and demand and most importantly on speculation. The Block chain is the chain of block that stores the information of the transactions of a Bitcoin. Satoshi Nakamoto created the first block in 2009, which is called the Genesis Block.Block Chain is a distributed ledger which stores the data in Hash values. Every digital currency has its own block chain that keeps a record of all transactions ever done using that currency.Peer to Peer Network or P2P Network allows everyone to have a ... Read More
Here we will see what are the basic differences of do-while loop and the while loop in C or C++.A while loop in C programming repeatedly executes a target statement as long as a given condition is true. The syntax is like below.while(condition) { statement(s); }Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any nonzero value. The loop iterates while the condition is true.When the condition becomes false, the program control passes to the line immediately following the loop.Example#include int main () { int ... Read More
In the ALS-SDA-85M kit, we have 74138 EPROM of minimum size 16K x 8 and size of RAM IS 2K x 8, there are empty sockets for the EPROM to get expanded. The selection of these four chips is done by the integrated circuit 74138. Every time the selection of 74138 is done when IO/M* turns to 0, the election of 27138 is done when A15A14 turns to 0. 27138 have the lowest address range likeLowest address: 00 00000000000000 is 0000H.Highest address: 00 11111111111111 is 3FFFH.Whereas in 74138 the address ranges are as follows -Lowest address: 11 xxx 00000000000Highest Address: 11 xxx 11111111111.The ... Read More
We write an 8085 assembly language program for finding the square of a single digit (0 to 9) using a look-up table for displaying a number and its square in the address field.FILE NAME MYSQR.ASM ORG C100H X: DB 00H, 01H, 04H, 09H, 16H, 25H, 36H, 49H, 64H, 81H ORG C000H CURAD: EQU FFF7H UPDAD: EQU 06BCH IBUFF: EQU FFFFH MVI A, 0EH ; Load A with 0000 1110B SIM ; Unmask RST5.5 i.e. enable keyboard interrupt. ; The next 4 instructions check if a key is pressed. If a key is ; pressed, ... Read More