Ankith Reddy

Ankith Reddy

730 Articles Published

Articles by Ankith Reddy

Page 68 of 73

How to change position of Toast in Android?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 2K+ Views

Before getting into an example, we should know what is toast in android. Toast is subclass for  java.lang.Object and used to show a short message for a short period of time after that is going to disappear.This example demonstrates how to change the position of Toast 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 a text view. when the user clicks on text ...

Read More

MySQL Select IN range?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 6K+ Views

You cannot do select IN range. For the same result, use BETWEEN. Let us see an example −IN(start, end): It means that the intermediate value between start and end won’t get displayed. For the above logic, you can use BETWEEN.BETWEEN clause is inclusive, for example, suppose there are 1, 2, 3, 4, 5, 6 numbers. If you want to display numbers from 2 to 6 inclusively, then using BETWEEN the numbers 2 and 6 will also get displayed.Let us create a table −mysql> create table SelectInWithBetweenDemo -> ( -> PortalId int ...

Read More

How to implement ternary conditional operator in MySQL?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 3K+ Views

A ternary conditional operator looks like ?: in programming language like C, C++, Java etc. The syntax is as follows −(yourCondition) ? statement1:statement2;In the above syntax, if yourCondition becomes true then statement1 will evaluate and if yourCondition becomes false then statement2 will evaluate.But the above syntax does not work in MySQL. We can use IF() function from MySQL for the same purpose.Let us see an example −Case 1mysql> select if(3 > 5, 'Condition is true', 'Condition is not true') as ConditionalResult;The following is the output in which second statement evaluates since is 3 isn’t more than 5 −+-----------------------+ | ConditionalResult ...

Read More

MySQL - How to count all rows per table in one query?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 311 Views

You can count all rows per table with the help of aggregate function count (TABLE_ROWS) from informatio_schema.tables. The syntax is as follows −SELECT table_name, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'yourDatabaseName';Now you can apply the above syntax to get all rows per table. The query is as follows −mysql> SELECT table_name, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'business';Here is the output −+------------------------------------------------------------------+------------+ | TABLE_NAME                                                       | TABLE_ROWS | +------------------------------------------------------------------+------------+ | accentsearchdemo       ...

Read More

What is algorithm for computing the CRC?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 7K+ Views

Cyclic Redundancy Check (CRC)Cyclic Redundancy Check (CRC) is a block code that was invented by W. Wesley Peterson in 1961. It is commonly used to detect accidental changes to data transmitted via telecommunications networks and storage devices.CRC involves binary division of the data bits being sent by a predetermined divisor agreed upon by the communicating system. The divisor is generated using polynomials. So, CRC is also called polynomial code checksum.Before sending the message over network channels, the sender encodes the message using CRC. The receiver decodes the incoming message to detect error. If the message is error-free, then it is ...

Read More

SELECT not null column from two columns in MySQL?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 9K+ Views

There are lots of ways to select NOT NULL column from two columns. The syntaxes are as follows:Case 1: Use IFNULL() function.The syntax is as follows:SELECT IFNULL(yourColumnName1, yourColumnName2) as anyVariableName from yourTableName;Case 2: Use coalesce() function.The syntax is as follows:SELECT COALESCE(yourColumnName1, yourColumnName2) as anyVariableName from yourTableName;Case 3: Use CASE statement.The syntax is as follows:SELECT CASE WHEN yourColumnName1 IS NOT NULL THEN yourColumnName1 ELSE yourColumnName2 END AS anyVariableName FROM yourTableName;Case 4: Use only IF().The syntax is as follows:SELECT IF (yourColumnName1 ISNULL, yourColumnName2, yourColumnName1) AS NotNULLValue FROM SelectNotNullColumnsDemo;To understand the above syntax, let us create a table. The query to create a ...

Read More

How to make back button twice to close an activity in Android?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 922 Views

Sometimes we click back button unintentionally, When you click on a back button it will close your application or will go back to another activity. To avoid this problem, This example demonstrates how to make back button twice to close an activity.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.     Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.os.VibrationEffect; ...

Read More

What is WAN accelerator?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 677 Views

A wide area network accelerator (WAN accelerator) is a hardware component, a software, or an appliance executing in a virtualized environment that provides caching and optimization of WAN services. A WAN accelerator is also called a WAN optimizer or application accelerator.Working PrincipleA WAN accelerator provides services to speed up information flow between the end users for imparting better network experience. Its target is to reduce the data volume to be transmitted. So, it compresses data and uses data deduplication techniques. The accelerator caches duplicate data and sends references of them when they are needed multiple times instead of resending the ...

Read More

The Data Link Layer Frame and Frame Fields

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 21K+ Views

Data Link Layer FrameA frame is a unit of communication in the data link layer. Data link layer takes the packets from the Network Layer and encapsulates them into frames. If the frame size becomes too large, then the packet may be divided into small sized frames. At receiver’ end, data link layer picks up signals from hardware and assembles them into frames.Fields of a Data Link Layer FrameA data link layer frame has the following parts:Frame Header: It contains the source and the destination addresses of the frame and the control bytes.Payload field: It contains the message to be ...

Read More

How to use the front camera in Swift?

Ankith Reddy
Ankith Reddy
Updated on 30-Jul-2019 1K+ Views

To use the front camera in swift we first need to get a list of cameras available in the device we are using. In this article we’ll see how to get the list of devices and then check if the front camera is available or not. We’ll do it in a series of steps.Import AVFoundationCheck if the list of cameras existsFilter out the front camera if exists.guard let frontCamera = AVCaptureDevice.devices().filter({ $0.position == .front }) .first as? AVCaptureDevice else { fatalError("Front camera not found") }The devices() method of AVCapture returns the list of cameras available. From that ...

Read More
Showing 671–680 of 730 articles
« Prev 1 66 67 68 69 70 73 Next »
Advertisements