George John has Published 1167 Articles

Performing a MySQL LIKE comparison on an INT field?

George John

George John

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

527 Views

You need to use cast() method to perform comparison on an INT field. The syntax is as follows −SELECT yourColumnName1, yourColumnName2, ......N yourTableName WHERE CAST(yourColumnName as CHAR) LIKE ‘%yourIntegerValue%’;To understand the above syntax, let us create a table. The following is the query to create a table for performing a ... Read More

Should I use COUNT(*) to get all the records in MySQL?

George John

George John

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

96 Views

Whenever you want all the values like not null for a column then use count(*). This is faster than using count() method.The syntax to use count(*) is as follows −select count(*) as anyVariableName from yourTableName;To understand the above concept, let us first create a table. The query to create a ... Read More

Simple Android grid example using RecyclerView with GridLayoutManager

George John

George John

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

735 Views

Before getting into grid Layout manager for recycler view example, we should know what is Recycler view in android. Recycler view is more advanced version of list view and it works based on View holder design pattern. Using recycler view we can show grids and list of items.This example demonstrate ... Read More

Does MySQL Boolean “tinyint(1)” holds values up to 127?

George John

George John

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

670 Views

Let us learn some points about TINYINT type in MySQL −The TINYINT type takes 1 byte i.e. 8 bits.The TINYINT(N), where N indicates the display width you want.For example, TINYINT(1) can be used to display width which is 1.Let us learn about the minimum and maximum values −The maximum value ... Read More

How to create Animated Gradient Background in android.

George John

George John

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

717 Views

Before getting into example, we should know what is Gradient color. According to Wikipedia, In computer graphics, a color gradient (sometimes called a color ramp or color progression) specifies a range of position-dependent colors, usually used to fill a region. For example, many window managers allow the screen background to ... Read More

How to find out number of days in a month in MySQL?

George John

George John

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

4K+ Views

To find the number of days in month, use the below syntax.select DAY(LAST_DAY(yourColumnName)) as anyVariableName from yourTableName;To understand the above syntax, let us first create a table. The query to create a table is as follows.mysql> create table DaysInaGivenMonth -> ( -> MonthName datetime -> ); Query OK, 0 rows ... Read More

How to get the absolute coordinates of a view in Android?

George John

George John

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

4K+ Views

Before getting into example, we should know what is absolute coordinates. It means absolute position (x, y)of a view on window manager. This example demonstrate about how to get the absolute coordinates of a view.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project ... Read More

How to get first day of every corresponding month in MySQL?

George John

George John

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

149 Views

You can use date-format() function from MySQL to get the first day of every corresponding month. The syntax is as follows −select DATE_FORMAT(yourDatetimeColumnName ,'%Y-%m-01') as anyVariableName from yourTableName;To understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table ... Read More

Return a shallow copy of IdentityHashMap in Java

George John

George John

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

68 Views

Returning a shallow copy means to copy elements of one IdentityHashMap to another. For this, clone() method is used.The following is an example to return a shallow copy of IdentityHashMapExample Live Demoimport java.util.*; public class Demo { public static void main(String[] args) { ... Read More

How to switch between hide and view password in Android

George John

George John

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

1K+ Views

There are so many cases, it required to show password while entering password or after entered password. This example demonstrate about How to switch between hide and view password.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to ... Read More

Advertisements