Chandu yadav has Published 1091 Articles

Set a radial gradient as the background image with CSS

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 13:40:14

227 Views

Set a radial gradient as the background image, with radial-gradient() CSS function. You can try to run the following code to implement linear-gradient() function in CSSExampleLive Demo                    #demo {             height: 200px;             background: radial-gradient(green, orange, maroon);          }                     Setting background as radial gradient.          

Random access to text lines in Python (linecache)

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 13:36:20

1K+ Views

Purpose of linecache module in Python’s standard library is to facilitate random access to any text file, although this module is extensively used by Python’s traceback module to generate error trace stack. Further prettyprints of reading are held in a cache so that it saves time while reading lines repeatedly.The ... Read More

What is the meaning of <> in MySQL query?

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 13:33:03

5K+ Views

The symbol in MySQL is same as not equal to operator (!=). Both gives the result in boolean or tinyint(1). If the condition becomes true, then the result will be 1 otherwise 0.Case 1 − Using != operator.The query is as follows −mysql> select 3!=5;The following is the output.+------+ ... Read More

SELECT increment counter in MySQL?

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 13:08:29

7K+ Views

To select increment counter in MySQL, first you need to declare and initialize a variable. The syntax is as follows −set @anyVariableName=0; select yourColumnName, @anyVariableName:=@anyVariableName+1 as anyVariableName from yourTableName;To understand the above syntax and set an increment counter, let us first create a table. The query to create a table ... Read More

MySQL update with random number between 1 - 3

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 13:01:59

1K+ Views

The syntax for updating a column with random number between 1-3 is is as follows −update yourTableName set yourColumnName=FLOOR(1+RAND()*3);To understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table UpdateNumber1To3 -> ( -> MyNumber int -> ); Query ... Read More

Euler’s Totient function for all numbers smaller than or equal to n in java

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 12:51:01

1K+ Views

Following is a program to get the result of Euler’s Totient function for all numbers smaller than or equal to n when n is given.Programimport java.util.Scanner; public class EulerTotient {    public static int gcd(int a,int b){       int i, hcf = 0;          for(i = 1; i

Divisors of factorials of a number in java

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 12:47:39

216 Views

Following is a Java program to find the divisors of factorials of a number.Programimport java.util.Scanner; public class DivisorsOfFactorial {    public static long fact(int i) {       if(i

Use reflection to create, fill, and display an array in Java

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 12:44:15

247 Views

An array is created using the java.lang.reflect.Array.newInstance() method. This method basically creates a new array with the required component type as well as length.The array is filled using the java.lang.reflect.Array.setInt() method. This method sets the required integer value at the index specified for the array.The array displayed using the for ... Read More

Sort arrays of objects in Java

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 12:39:27

512 Views

An array of objects can be sorted using the java.util.Arrays.sort() method with a single argument required i.e. the array to be sorted. A program that demonstrates this is given as follows −Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String args[]) throws Exception {       ... Read More

Modular multiplicative inverse in java

Chandu yadav

Chandu yadav

Updated on 25-Jun-2020 12:35:39

950 Views

The java.math.BigInteger.modInverse(BigInteger m) returns a BigInteger whose value is (this-1 mod m). Using this method you can calculate Modular multiplicative inverse for a given number.ProgramLive Demoimport java.math.*; public class BigIntegerDemo {    public static void main(String[] args) {       // create 3 BigInteger objects       BigInteger ... Read More

Advertisements