Articles on Trending Technologies

Technical articles with clear explanations and examples

Get another order after limit with MySQL?

Arjun Thakur
Arjun Thakur
Updated on 30-Jul-2019 306 Views

You need to use subquery with select statement, one select for inner and one for outer. The inner select will return rows and outer will order by ascending order. The syntax is as follows:SELECT *FROM (    SELECT *FROM yourTableName ORDER BY yourColumnName1 DESC LIMIT 9 ) AS anyAliasName ORDER BY yourColumnName2;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table OrderByAfterLimit    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> UserName varchar(20),    -> UserAge int,    -> PRIMARY KEY(Id)    -> ); Query OK, ...

Read More

How to update continues ui from Intent Service in Android?

Nitya Raut
Nitya Raut
Updated on 30-Jul-2019 627 Views

Before getting into example, we should know what is Intent service in android. Intent Service is going to do back ground operation asynchronously. When user call startService() from activity , it doesn’t create instance for each request and it going to stop service after done some action in service class or else we need to stop service manually by using stopSelf().This example demonstrate about How to update continues ui from Intent 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 ...

Read More

How to use UNIQUE constraints in Android sqlite?

Jennifer Nicholas
Jennifer Nicholas
Updated on 30-Jul-2019 704 Views

Before getting into an example, we should know what SQLite database in android is. SQLite is an opensource SQL database that stores data to a text file on a device. Android comes in with built-in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.This example demonstrates How to use UNIQUE constraints in Android SQLite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new ...

Read More

How to enable webview java script in android?

Nitya Raut
Nitya Raut
Updated on 30-Jul-2019 1K+ Views

This example demonstrate about How to enable webview java script 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 web view to show google.com.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.webkit.WebView; import android.widget.EditText; public class MainActivity extends AppCompatActivity { @RequiresApi(api = Build.VERSION_CODES.P) @Override ...

Read More

How to get Wi-Fi connected state in android?

Jennifer Nicholas
Jennifer Nicholas
Updated on 30-Jul-2019 653 Views

This example demonstrates How to get Wi-Fi connected state 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 to show wifi connected state.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; 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 textView; ...

Read More

How to use removeFirstOccurrence() in android ConcurrentLinkedDeque?

Jennifer Nicholas
Jennifer Nicholas
Updated on 30-Jul-2019 148 Views

Before getting into an 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 removeFirstOccurrence () 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; ...

Read More

How to arrange data in s specific order in MySQL?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 177 Views

Use ORDER BY IF() to arrange data in a specific order. Following is the syntax −select *from yourTableName ORDER BY IF(yourColumnName=yourValue1 OR yourColumnName=yourValue2 OR yourColumnName=yourValue3, yourColumnName, ~yourColumnName) ASC;Let us first create a table −mysql> create table arrangeDataInSpecificOrder    -> (    -> StudentId int,    -> StudentName varchar(20)    -> ); Query OK, 0 rows affected (0.64 sec)Following is the query to insert some records in the table using insert command −mysql> insert into arrangeDataInSpecificOrder values(10, 'Larry'); Query OK, 1 row affected (0.12 sec) mysql> insert into arrangeDataInSpecificOrder values(15, 'Mike'); Query OK, 1 row affected (0.09 sec) mysql> insert into ...

Read More

How can I display Java date as '12/04/2019'

Krantik Chavan
Krantik Chavan
Updated on 30-Jul-2019 122 Views

To format and display date like this i.e. Day/Month/Year, you need to set the pattern:dd/MM/yyyyAt first, set a LocalDate:LocalDate localDate = LocalDate.now();Now format and display date as '12/04/2019':localDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy"))Exampleimport java.time.LocalDate; import java.time.format.DateTimeFormatter; public class Demo {    public static void main(String[] args) {       LocalDate date = LocalDate.now();       System.out.println("Date = "+date);       DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");       System.out.println("Formatted Date = "+date.format(formatter));    } }OutputDate = 2019-04-12 Formatted Date = 12/04/2019

Read More

How to select data from a table where the table name has blank spaces in MYSQL?

Samual Sam
Samual Sam
Updated on 30-Jul-2019 1K+ Views

You need to use backticks around the table name where the table name has blank space. Let us first create a table. Here, we have used backtick −mysql> create table `Demo Table138` (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Price int ); Query OK, 0 rows affected (0.47 sec)Insert records in the table using insert command −mysql> insert into `Demo Table138`(Price) values(450); Query OK, 1 row affected (0.18 sec) mysql> insert into `Demo Table138`(Price) values(499); Query OK, 1 row affected (0.16 sec) mysql> insert into `Demo Table138`(Price) values(199); Query OK, 1 row affected (0.17 sec) mysql> insert into ...

Read More

Network Control Protocol (NCP)

Krantik Chavan
Krantik Chavan
Updated on 30-Jul-2019 4K+ Views

Network Control Protocol (NCP) is a set of protocols forming a part of Point − to − Point Protocol (PPP). PPP is a data link layer protocol that is used to transmit multiprotocol data between two directly connected (point-to-point) computers. PPP is composed of link control protocol (LCP), authentication protocol (AP) and network control protocol (NCP). NCPs are used for negotiating the parameters and facilities for the network layer. For every higher-layer protocol supported by PPP, one NCP is there.The following diagram illustrates the layer in which NCPs operate:List of NCPsSome of the NCPs are −Internet Protocol Control Protocol (IPCP) ...

Read More
Showing 58931–58940 of 61,248 articles
Advertisements