Ankith Reddy

Ankith Reddy

730 Articles Published

Articles by Ankith Reddy

Page 4 of 73

HTML DOM activeElement Property

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 226 Views

The HTML DOM activeElement property is a read-only property to return the currently focused element in the document.Following is the syntax −document.activeElementLet us now see an example to implement the DOM activeElement property −Example Heading Two Click in the element to get the active element. function display() { var a = document.activeElement.tagName; document.getElementById("myid").innerHTML = a; } OutputNow, click the element to display the same currently active element −

Read More

HTML <form> autocomplete Attribute

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 176 Views

The autocomplete attribute of the element allows you to set whether the autocomplete for the form should be on or off. The web browser automatically fills the values if the autocomplete is on. This only happens if the user already entered values before.Following is the syntax −Above, on | off values are to be set for autocomplete to appear or not. Set on if you want the browser to complete the entries based on previously entered values, whereas off doesn’t allow to complete the entries.Let us now see an example to implement the autocomplete attribute of the element ...

Read More

IntStream toArray() method in Java

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 290 Views

The toArray() method returns an array containing the elements of this stream.Set the elements in the stream with the IntStream class of() method.IntStream stream = IntStream.of(20, 40, 60, 70, 100, 120, 140);Now, display an array with the elements of this stream using the toArray() method.int[] myArr = stream.toArray();The following is the syntax.int[] toArray()The following is an example to implement IntStream toArray() method in Java.Exampleimport java.util.*; import java.util.stream.IntStream; public class Demo {    public static void main(String[] args) {       IntStream stream = IntStream.of(20, 40, 60, 70, 100, 120, 140);       int[] myArr = stream.toArray();       System.out.println(Arrays.toString(myArr));    } }Output[20, 40, 60, 70, 100, 120, 140]

Read More

memset in C++

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 1K+ Views

In this section we will see what is the purpose of memset() function in C++. This function converts the value of a character to unsigned character and copies it into each of first n character of the object pointed by the given str[]. If the n is larger than string size, it will be undefined.The syntax of the memset() functionvoid* memset( void* str, int c, size_t n);In this example will use one string, then convert each character to some other character up to length n.Example#include using namespace std; int main() {    char str[] = "Hello World";    memset(str, 'o', ...

Read More

Declare variable as constant in C

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 20K+ Views

Variables can be declared as constant using the const keyword or the #define preprocessor directive. Details about these are given as follows.The const keywordVariables can be declared as constants by using the “const” keyword before the datatype of the variable. The constant variables can be initialized once only. The default value of constant variables are zero.A program that demonstrates the declaration of constant variables in C using const keyword is given as follows.Example#include int main() {    const int a;    const int b = 12;    printf("The default value of variable a : %d", a);    printf("The value ...

Read More

Generate Random Float type number in Java

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 5K+ Views

In order to generate Random float type numbers in Java, we use the nextFloat() method of the java.util.Random class. This returns the next random float value between 0.0 (inclusive) and 1.0 (exclusive) from the random generator sequence.Declaration −The java.util.Random.nextFloat() method is declared as follows −public float nextFloat()Let us see a program to generate random float type numbers in Java.Exampleimport java.util.Random; public class Example {    public static void main(String[] args) {       Random rd = new Random(); // creating Random object       System.out.println(rd.nextFloat()); // displaying a random float value between 0.0 and 1.0    } }Output0.7739767Note ...

Read More

filter_input() function in PHP

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 673 Views

The filter_input() function gets a name of external variable and filters it optionally.Syntaxfilter_input(type, var, filtername, options)Parameterstype − There are five types of inputs to check i.e. INPUT_GET, INPUT_POST, INPUT_COOKIE, INPUT_SERVER, or INPUT_ENV.var − The name of variable.filtername − The name of filter to get ID.options − Specifies options to use.ReturnThe filter_input() function returns the value of the variable on success, false on failure, or null if the parameter of variable is not set.Example

Read More

filter_var() function in PHP

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 611 Views

The filter_var() function is used to filter a variable with a specified filter.Syntaxfilter_var(variable, filter, options)Parametersvariable − The name of variable.filter − The name of filter to get ID.options − Specifies options to use.ReturnThe filter_var() function returns filtered data on success, or false on failure.Example

Read More

FILTER_VALIDATE_FLOAT constant in PHP

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 358 Views

The FILTER_VALIDATE_FLOAT constant validates a value as a float number.ReturnThe FILTER_VALIDATE_FLOAT constant does not return anything.ExampleOutputThe following is the output.float(291.9)

Read More

Full Date Short Time ("f") Format Specifier in C#

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 232 Views

The Full Date Short Time standard format specifier represents a combination of the long date ("D") and short time ("t") patterns.UseDateTime to set the date.DateTime myDate = new DateTime(2018, 8, 29, 1, 10, 0);Now, use the (“f”) format specifier like this −myDate.ToString("f", CultureInfo.CreateSpecificCulture("en-US"))The following is an example −Exampleusing System; using System.Globalization; class Demo {    static void Main() {       DateTime myDate = new DateTime(2018, 8, 29, 1, 10, 0);       Console.WriteLine(myDate.ToString("f",CultureInfo.CreateSpecificCulture("en-US")));    } }OutputWednesday, August 29, 2018 1:10 AM

Read More
Showing 31–40 of 730 articles
« Prev 1 2 3 4 5 6 73 Next »
Advertisements