Use Pool with ArrayBlockingQueue in Android

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

165 Views

Before getting into an example, we should know what arrayblockingqueue is, it travels FIFO manner and the first element going to live the longest period of time and last element of the queue going to live a short period of the time.This example demonstrates about How to use pool() ArrayBlockingQueue 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 a text view to show ... Read More

Best Bitcoin Mobile Wallet

Prasanna Kotamraju
Updated on 30-Jul-2019 22:30:25

150 Views

Bitcoin wallets come on different platforms with different features. There is not “one size fits all” concept.Bitcoin wallet can be set up electronically either on your mobile or desktop. It is an application or a program which allows you to send or receive Bitcoin cash, and keep track of your transactions and history. The software program stores the private and public keys and interacts with various block chains to enable the users to send and receive digital currency and also monitor their balance. If you want to store and use the crypto currency you need a Digital Wallet.They are downloaded ... Read More

Make Hashtable Read-Only in Java

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

240 Views

Read-only Hashtable would mean users won’t be able to add or remove elements from it. Let us first create a Hashtable with key-value pair −Hashtablehash = new Hashtable(); hash.put("1", "A"); hash.put("2", "B"); hash.put("3", "C"); hash.put("4", "D"); hash.put("5", "E"); hash.put("6", "F"); hash.put("7", "G");Now, use unmodifiableMap() to form a Hashtable read-only −Mapm = Collections.unmodifiableMap(hash);Example Live Demoimport java.util.Collections; import java.util.Hashtable; import java.util.Map; public class Demo {    public static void main(String[] s) {       Hashtablehash = new Hashtable();       hash.put("1", "A");       hash.put("2", "B");       hash.put("3", "C");       hash.put("4", "D");       hash.put("5", ... Read More

difftime C Library Function

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

187 Views

Here we will see what is the difftime() function in C. The difftime() is used to get the differences between two time values.difftime() takes two time argument, the first one is the lower bound, and the second one is the upper bound. And it returns the differences between these two arguments.Example#include #include #include main() {    int sec;    time_t time1, time2;    time(&time1);    printf("Current Time: %ld",time1);    for (sec = 1; sec

Interfacing of I/O Devices

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

836 Views

We interface the I/O device in a very segmented manner and is carried systematically. In the interfacing of seven segment display to 8085 microcontroller it is found that An output device which is very common is, especially in the kit of 8085 microprocessor and it is the Light Emitting Diode consisting of seven segments. Moreover, we have eight segments in a LED display consisting of 7 segments which includes ‘.’, consisting of character 8 and having a decimal point just next to it. We denote the segments as ‘a, b, c, d, e, f, g, and dp’ where dp signifies ... Read More

Get Total in the Last Row of MySQL Result

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

690 Views

To get total in the last row of MySQL result, use the following syntax −(    SELECT yourColumnName1,    yourColumnName2,    yourColumnName3,    .    .    N    FROM yourTableName ) UNION (    SELECT "yourMessage" AS anyAliasName1,    SUM(yourColumnName1) AS anyAliasName2,    SUM(yourColumnName2) AS anyAliasName3,    .    .    N    FROM yourTableName );To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table ProductDemo    -> (    -> ProductId varchar(10),    -> ProductQuantity int,    -> ProductValue int    -> ); Query OK, 0 ... Read More

Types of Result Sets in JDBC

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

5K+ Views

There are two types of result sets namely, forward only and, bidirectional.Forward only ResultSet: The ResultSet object whose cursor moves only in one direction is known as forward only ResultSet. By default, JDBC result sets are forward-only result sets.You can move the cursor of the forward only ResultSets using the next() method of the ResultSet interface. It moves the pointer to the next row from the current position. This method returns a boolean value. If there are no rows next to its current position it returns false, else it returns true.Therefore, using this method in the while loop you can ... Read More

Check Android Mobile for Step Counter Sensor Support

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

806 Views

This example demonstrate about How to check android mobile supports STEP COUNTER 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 STEP COUNTER 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 { ... Read More

Copy String Without Using strcpy Function in C

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

628 Views

In this section we will see how to copy a string to other string without using strcpy() function. To solve this problem we can write our own function that can act like strcpy(), but here we will follow some trick. We will use another library function to copy a string into another.The logic is very simple. Here we will use the sprintf() function. This function is used to print some value or line into a string, but not in the console. This is the only difference between printf() and sprintf(). Here the first argument is the string buffer. where we ... Read More

Update MySQL Column Containing Dot in Its Name

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

1K+ Views

If the MySQL column contains dot (.) in its name, then you need to use backticks around the column name. To understand the above concept, let us create a table. The query to create a table is as followsmysql> create table UpdateDemo    -> (    -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> `User.FirstName.LastName` varchar(60)    -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into UpdateDemo(`User.FirstName.LastName`) values('John Smith'); Query OK, 1 row affected (0.14 sec) mysql> insert into UpdateDemo(`User.FirstName.LastName`) values('Adam Smith'); Query OK, ... Read More

Advertisements