Import All Classes in Java

Vikyath Ram
Updated on 30-Jul-2019 22:30:24

13K+ Views

All the classes in a package can be imported using the import statement along with the character *. For example - All the classes in the package java.util can be imported using import java.util.*;A program that demonstrates this in Java is given as follows:Example Live Demoimport java.util.*; public class Demo {    public static void main(String args[]) {       Stack stack = new Stack();       stack.push("Apple");       stack.push("Mango");       stack.push("Guava");       stack.push("Pear");       stack.push("Orange");       System.out.println("The stack elements are: " + stack);    } }OutputThe stack elements ... Read More

See Global Locks in MySQL InnoDB

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

623 Views

In order to see the global locks in MySQL (Innodb), use the SHOW command. The below query shows the global locks as well owner of locks and waiters. The following query will also show transaction id and more related to Innodb.The query is as follows:mysql> SHOW ENGINE INNODB STATUS\GThe following is the output:*************************** 1. row *************************** Type: InnoDB Name: Status: ===================================== 2019-01-23 14:46:58 0x2914 INNODB MONITOR OUTPUT ===================================== Per second averages calculated from the last 23 seconds ----------------- BACKGROUND THREAD ----------------- srv_master_thread loops: 87 srv_active, 0 srv_shutdown, 51953 srv_idle srv_master_thread log flush and writes: 0 ---------- SEMAPHORES ---------- OS WAIT ... Read More

Get Average on MySQL Time Column

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

2K+ Views

To get average on time column, use the below syntax. It will give the average in time format −SELECT SEC_TO_TIME(AVG(TIME_TO_SEC(yourColumnName))) as anyVariableName from yourTableName;To understand the above concept, let us create a table. The following is the query −mysql> create table AverageOnTime    −> (    −> PunchInTime time    −> ); Query OK, 0 rows affected (0.61 sec)Insert time values in the table using insert command. The query to insert records is as follows −mysql> insert into AverageOnTime values('00:00:40'); Query OK, 1 row affected (0.20 sec) mysql> insert into AverageOnTime values('00:02:50'); Query OK, 1 row affected (0.15 sec) ... Read More

Set Adapter to Auto Complete Text View

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

1K+ Views

 Before getting into an example, we should know what is autocomplete textview in android. Autocomplete textview is just like an edit text and it is a subclass of editext, but it is going to show suggestion from a list as a dropdown list. We have to set up Threshold value to auto-complete text view. for example, we have set it up Threshold as 1 so if user enters one letter is going to give suggestion according to Threshold letter.This example demonstrates about how to set up an adapter to auto-complete Textview.Step 1 − Create a new project in Android Studio, ... Read More

Prevent Going Back to Previous Activity in Android

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

2K+ Views

There are so many situations, where we should not call back action when user click on back button.This example demonstrates how to integrate Android Login and register form.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/actvity_main.xml.         Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    int view = R.layout.activity_main;    @RequiresApi(api = ... Read More

Programmer's View of Z-80

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

418 Views

In this section we will see the basic architecture of the Z-80 Microprocessor, and different registers to write programs into it.To write programs we have to care about the registers and some instructions to access them during program execution.From this diagram it is clear that there are some special purpose registers like W, Z, some other registers like Stack Pointer (SP), Program Counter (PC) etc. three general purpose register pairs (BC, DE, HL) and Accumulator A. There is also an 8-bit flag register to hold the flag bits. Up to this, it is like the 8085 architecture, but in Z-80, ... Read More

Remove Highest Element in Java TreeSet

Samual Sam
Updated on 30-Jul-2019 22:30:24

512 Views

To remove the highest element, use the pollLast() method.Create a TreeSet and add elements to it −TreeSet tSet = new TreeSet(); tSet.add("78"); tSet.add("56"); tSet.add("88"); tSet.add("12");Now, remove the highest element −tSet.pollLast()The following is an example to remove highest element in Java TreeSet −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]){ TreeSet tSet = new TreeSet(); tSet.add("78"); tSet.add("56"); tSet.add("88"); tSet.add("12"); ... Read More

MySQL Query to Change Lower Case to Upper Case

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

8K+ Views

You can use in-built function UPPER() from MySQL to change a lower case to upper case. The syntax is as follows with select statement.SELECT UPPER(‘yourStringValue’);The following is an example showing string in lower case −mysql> select upper('john');Here is the output displaying string in upper case −+---------------+ | upper('john') | +---------------+ | JOHN          | +---------------+ 1 row in set (0.00 sec)If you already have a table with a lower case value, then you can use the UPPER() function with update command. The syntax is as follows −UPDATE yourTableName set yourColumnName = UPPER(yourColumnName);To understand the above concept, let ... Read More

Reload Activity in Android

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

7K+ Views

In some situations, we need to recall activity again from onCreate(). This example demonstrates how to reload activity 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 text view, when a user clicks on text view, it will call Main Activity again.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import ... Read More

How Fast is the Time from Thought to Google Results?

Jaya P
Updated on 30-Jul-2019 22:30:24

238 Views

When I googled the question "time taken for Google to show the results", I got 19,40,00,000 results in 0.47 seconds.This again varies with the speed of your system's processor and the speed of your internet connection.This wonderful, super fast search engine is 50,000 times faster than the time our brain takes to interpret an image and about 6 million times faster than the time it takes for an average human brain to react to an external stimulus.

Advertisements