Programming Articles

Page 1100 of 2547

How to convert a Double array to a String array in java?

Sharon Christine
Sharon Christine
Updated on 11-Mar-2026 4K+ Views

You can convert a double array to a string using the toString() method. To convert a double array to a string array, convert each element of it to string and populate the String array with them.Exampleimport java.util.Arrays; public class DoubleArrayToString {    public static void main(String args[]) {       Double[] arr = {12.4, 35.2, 25.6, 98.7, 56.4};       int size = arr.length;       String[] str = new String[size];           for(int i=0; i

Read More

How to check if array contains three consecutive dates in java?

Nikitha N
Nikitha N
Updated on 11-Mar-2026 1K+ Views

To check to find whether a given array contains three consecutive dates:Convert the given array into a list of type LocalDate.Using the methods of the LocalDate class compare ith, i+1th and i+1th, i+2th elements of the list if equal the list contain 3 consecutive elements.Exampleimport java.time.LocalDate; import java.time.Month; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; public class ConsicutiveDate {    public static void main(String args[]) {       String[] dates = {"5/12/2017", "6/12/2017", "7/12/2017"};       List localDateList = new ArrayList();       for (int i = 0; i

Read More

How to find the row and column position of a value as vector in an R matrix?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 919 Views

To find the row and column position of a value as vector in an R matrix, we can follow the below steps −First of all, create a matrix.Then, find the row and column position of a particular value using which function and reading the output with as.vector function.Example 1Create a matrixLet's create a matrix as shown below −M1

Read More

How to divide data frame rows in R by row maximum?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 378 Views

To divide the data frame row values by row maximum in R, we can follow the below steps −First of all, create a data frame.Then, use apply function to divide the data frame row values by row maximum.Create the data frameLet's create a data frame as shown below −x

Read More

How to print string vectors vertically in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 475 Views

To print string vectors vertically in R, we can follow the below steps −First of all, create a vector.Then, use cat function to print the vector vertically.Example 1 Let's create a vector as shown below −Alphabets

Read More

How to limit the length of regression line using ggplot2 in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

To limit the length of regression line using ggplot2 in R, we can follow the below steps −First of all, create a data frame.Then, create the scatterplot using ggplot2 with regression line.After that, create the scatterplot with regression and add xlim function.Create the data frameLet's create a data frame as shown below −x

Read More

How to create horizontal lines with two different colors after a threshold in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 482 Views

To create two horizontal lines with different color after a threshold in R, we can follow the below steps −First of all, create a plot in base R.Then, add a line to the plot using abline function.After that, use segments function to partially change the color of the line.Create the plotUsing plot function to create a plot in base R −plot(1:5, 1:5, xlim=c(0, 5))OutputAdd a line to the plotUsing abline function to add a line to the plot −plot(1:5, 1:5, xlim=c(0, 5)) abline(h=3)OutputPartially color the lineUsing segments function to color the with yellow color starting from 0 to 3 −plot(1:5, ...

Read More

How to create a scatterplot in base R with points depending on categorical column?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 254 Views

To create a scatterplot in base R with points depending on categorical column, we can follow the below steps −First of all, create a data frame.Then, use plot function to create the scatterplot with col argument and using categorical column with factor function.Create the data frameLet's create a data frame as shown below −x

Read More

Node.js – util.deprecate() method

Mayank Agarwal
Mayank Agarwal
Updated on 11-Mar-2026 445 Views

The util.deprecate() method wraps fn (that may be a function or class) in such a way that it is marketed as a deprecated method. The util.deprecate() method returns a function that emits a DeprecationWarning. This warning is printed to the stderr when the function is called the first time. The function is called without any warning once the warning is emitted.Syntaxutil.deprecate( fn, msg, [code] )ParametersThe parameters are defined below:fn − The function that needs to be deprecated.msg − This is a warning message which is invoked once the deprecated function is called.code − This is an optional parameter which displays the passed ...

Read More

Node.js – hmac.update() Method

Mayank Agarwal
Mayank Agarwal
Updated on 11-Mar-2026 824 Views

The Hmac class is one of the many utility classes that is used for creating the cryptographic HMAC digests. The Hmac.update() method is used for updating the Hmac content with the data passed. If encoding is not provided and the data is in string format, then the default encoding 'utf8' is enforced.Syntaxhmac.update(data, [encoding])ParametersThe parameters are described below:data − This input parameter takes input for the data with which Hmac will be updated.encoding − This input parameter takes input for the encoding to be considered while updating the Hmac.Example 1Create a file with the name "hmacUpdate.js" and copy the following code snippet. After ...

Read More
Showing 10991–11000 of 25,466 articles
Advertisements