karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 77 of 143

How to use peekLast() in android LinkedBlockingDeque?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 163 Views

Before getting into an example, we should know what LinkedBlockingDeque is. It is implemented by Collection interface and the AbstractQueue class. It provides optional boundaries based on linked nodes.It going to pass memory size to a constructor and helps to provide memory wastage in android.This example demonstrates about How to use peekLast() in android LinkedBlockingDequeStep 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 ...

Read More

How to use peekFirst() in android LinkedBlockingDeque?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 167 Views

Before getting into an example, we should know what LinkedBlockingDeque is. It is implemented by Collection interface and the AbstractQueue class. It provides optional boundaries based on linked nodes. It going to pass memory size to a constructor and helps to provide memory wastage in android.This example demonstrates about How to use peekFirst() in android LinkedBlockingDequeStep 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 ...

Read More

How to use peek() in android ConcurrentLinkedQueue?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 189 Views

Before getting into an example, we should know what ConcurrentLinkedQueue is, it is an unbounded queue based on linked nodes. Multiple threads can access queue elements with safety. Elements travel based on queue strategy as FIFO and elements going to insert from a tail. It does not allow null values.This example demonstrates about How to use peek() in android ConcurrentLinkedQueueStep 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, ...

Read More

Find a specific column in all the tables in a database?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 777 Views

For this, use COLUMN_NAME and set LIKE with that specific column name. Let us find a specific column in an unknown table in a database −mysql> SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT    -> FROM INFORMATION_SCHEMA.COLUMNS    -> WHERE column_name LIKE '%StudentName%'    -> AND table_schema = 'web';OutputThis will produce the following output −+-------------------+-------------+-----------+-------------+----------------+ | TABLE_NAME        | COLUMN_NAME | DATA_TYPE | IS_NULLABLE |COLUMN_DEFAULT  | +-------------------+-------------+-----------+-------------+----------------+ | demotable215      | StudentName | varchar   | YES         | NULL           | | demotable221      | StudentName | varchar   ...

Read More

How to use peek() in android ConcurrentLinkedDeque?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 245 Views

Before getting into the example, we should know what ConcurrentLinkedDeque is, it is unbounded deque based on linked nodes. Multiple threads can access deque elements with safety.This example demonstrates about How to use peek() in android ConcurrentLinkedDequeStep 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 ConcurrentLinkedDeque elements.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; ...

Read More

Can we get records "Jone Deo" or "Deo Jone" with a single MySQL query?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 122 Views

For this, you can use the LIKE clause. Let us first create a table −mysql> create table DemoTable    -> (    -> ClientName varchar(100)    -> ); Query OK, 0 rows affected (0.85 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John Smith'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('Smith John'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('Jone Deo'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('Deo Jone'); Query OK, 1 row affected (0.14 sec) mysql> ...

Read More

How to add column and index in a single MySQL query?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 4K+ Views

Use ALTER for this with ADD. Following is the syntax −alter table yourTableName add yourColumnName DATETIME DEFAULT NOW(), add index(yourColumnName);Let us first create a table −mysql> create table DemoTable    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(100),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.69 sec)Let us check the description of the table −mysql> desc DemoTable;OutputThis will produce the following output −+-------+--------------+------+-----+---------+----------------+ | Field | Type         | Null | Key | Default | Extra          | +-------+--------------+------+-----+---------+----------------+ | Id    | int(11) ...

Read More

MySQL query to first set negative value in descending order and then positive value in ascending order

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 562 Views

For this, you can use UNION. Let us first create a table −mysql> create table DemoTable -> ( -> Number int -> ); Query OK, 0 rows affected (1.17 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(-9); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values(-190); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(190); Query OK, 1 row affected ...

Read More

MySQL query to increment one of the column values

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 2K+ Views

Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(100), -> Score int -> ); Query OK, 0 rows affected (0.78 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name, Score) values('John', 68); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable(Name, Score) values('Carol', 98); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable(Name, Score) values('David', 89); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable(Name, Score) values('Robert', 67); Query OK, 1 row affected ...

Read More

How to use offer() in android PriorityBlockingQueue?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jun-2020 149 Views

Before getting into the example, we should know what PriorityBlockingQueue is. It is an unbounded queue and follows the same order as a priority queue. The main usage of priority blocking queue is, it going to handle out of memory error.This example demonstrates about How to use offer() in android PriorityBlockingQueueStep 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 PriorityBlockingQueue ...

Read More
Showing 761–770 of 1,421 articles
« Prev 1 75 76 77 78 79 143 Next »
Advertisements