George John has Published 1081 Articles

How to create Animated Gradient Background in android.

George John

George John

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

888 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

5K+ 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

5K+ 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

220 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

136 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

Get floor key from NavigableMap in Java

George John

George John

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

94 Views

To get floor key means to return the greatest key less than or equal to the given key, or null if there is no such key. This can be done with the floorKey() metho.The following is an example to get floor key from NavigableMapExample Live Demoimport java.util.*; public class Demo { ... Read More

MySQL date format DD/MM/YYYY select query?

George John

George John

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

4K+ Views

Format the date DD/MM/YYYY using select and order by in descending order. The syntax is as follows −SELECT *FROM yourTableName where yourDatetimeColumnName order by STR_TO_DATE(yourDatetimeColumnName, ’%d/%m%Y’) desc;The above syntax will give the date in descending order. To understand the above syntax, let us first create a table. The query to ... Read More

How to select max of mixed string/int column in MySQL?

George John

George John

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

290 Views

To select max of mixed string/int column, you need to use substring() function. The syntax is as follows:SELECT MAX(CAST(SUBSTRING(yourColumnName, 4, length(yourColumnName)-3) AS UNSIGNED)) AS anyVariableName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table StringIntMixHighestDemo    -> ... Read More

How to select record from last 6 months in a news table using MySQL?

George John

George John

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

6K+ Views

To select the last 6 months records from news table, use the date_sub() function from MySQL since news records are arranged according to date.The syntax is as follows −select *from yourTableName where yourDateTimeColumnName >= date_sub(now(), interval 6 month);To understand the above concept, let us first create a NEWS table with ... Read More

Advertisements