Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

810 articles

HTML5 input type="file" accept="image/*" capture="camera" display as image rather than choose file button

Chandu yadav
Chandu yadav
Updated on 13-Mar-2026 453 Views

Use the JavaScript FileReader to allow users to choose an image file and display it as an image instead of showing the default file input button. This approach provides a better user experience by giving immediate visual feedback when an image is selected. The HTML5 input element with type="file", accept="image/*", and capture="camera" attributes allows users to select images from their device or capture photos directly from the camera on mobile devices. HTML Structure First, let's create the basic HTML structure with a file input and an image element − ...

Read More

How to reload the current page without losing any form data with HTML?

Chandu yadav
Chandu yadav
Updated on 13-Mar-2026 8K+ Views

The easiest way to reload the current page without losing form data is to use WebStorage, where you have persistent storage (localStorage) or session-based (sessionStorage) which remains in memory until your web browser is closed. Using localStorage to Preserve Form Data The key is to save form data before the page reloads and restore it after the page loads. Here's how to implement this solution − Step 1: Save Form Data Before Page Reload Use the beforeunload event to capture form data when the page is about to reload − window.onbeforeunload = function() { ...

Read More

Facing Problem in retrieving HTML5 video duration

Chandu yadav
Chandu yadav
Updated on 12-Mar-2026 504 Views

A common problem when working with HTML5 video is that the duration property returns NaN (Not a Number) when you try to access it before the browser has finished loading the video's metadata. This happens because the video file's metadata (which contains the duration, dimensions, etc.) is not available immediately after the page loads. Why Does video.duration Return NaN? The HTML5 element has a readyState attribute that indicates how much data the browser has loaded. It has values from 0 to 4 − 0 (HAVE_NOTHING) − No data available yet. 1 (HAVE_METADATA) − Metadata (duration, dimensions) is loaded. ...

Read More

Are new HTML5 elements like <section> and <article> useless?

Chandu yadav
Chandu yadav
Updated on 12-Mar-2026 186 Views

No, HTML5 semantic elements like and are not useless. They are extremely useful for screen readers and assistive technologies, helping visually impaired users navigate and understand the structure of your web page. They are also beneficial for eBook readers, search engines, and any tool that parses HTML for meaning. While you could use generic tags for everything, semantic elements convey the purpose of the content to both browsers and developers, making your code more readable and accessible. The Element The element represents a thematic grouping of content, typically with a heading. Use it to divide ...

Read More

Represent Int64 as a Hexadecimal String in C#

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 2K+ Views

To represent Int64 as a Binary string in C#, use the ToString() method and set the base as the ToString() method’s second parameter i.e.16 for Hexadecimal.Int64 represents a 64-bit signed integer.Firstly, set an Int64 variable.long val = 947645;Now, convert it to a hex string by including 16 as the second parameter.Convert.ToString(val, 16)Exampleusing System; class Demo {    static void Main() {       long val = 947645;       Console.WriteLine("Long: "+val);       Console.Write("Hex String: "+Convert.ToString(val, 16));    } }OutputLong: 947645 Hex String: e75bd

Read More

Java Program to Check if a String is Numeric

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 382 Views

ExampleYou can check if a given string is Numeric as shown in the following program.import java.util.Scanner; public class StringNumeric {    public static void main(String[] args) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter a string ::");       String str = sc.next();       boolean number = str.matches("-?\d+(\.\d+)?");       if(number) {          System.out.println("Given string is a number");       } else {          System.out.println("Given string is not a number");       }    } }OutputEnter a string :: 4245 Given string is a number

Read More

Which element is used to add special style to the first letter of the text in a selector with CSS

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 141 Views

Use the :first-letter element to add special effects to the first letter of elements in the document. You can try to run the following code to add special styles to the first letter of text −Example                    p:first-letter {             font-size: 5em;          }          p.normal:first-letter {             font-size: 10px;          }                     First character of this paragraph will be normal ...

Read More

Give the object a sine wave distortion to make it look wave with CSS

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 575 Views

Wave effect is used to give the object a sine wave distortion to make it look wavy.The following parameters can be used in this filterS.NoParameter & Description1AddA value of 1 adds the original image to the waved image, 0 does not.2FreqThe number of waves.3LightThe strength of the light on the wave (from 0 to 100).4PhaseAt what degree the sine wave should start (from 0 to 100).5StrengthThe intensity of the wave effect.ExampleYou can try to run the following code to set wave effect −                         Text Example:       CSS Tutorials    

Read More

Set Bordered Form Inputs with CSS

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 212 Views

To set border to form inputs, use the CSS border property.You can try to run the following code to add borderExample                    input[type = text] {             width: 100%;             padding: 10px 15px;             margin: 5px 0;             box-sizing: border-box;             border: 3px inset orange;          }                     Fill the below form,                Subject                    Student                    

Read More

Java program to calculate mode in Java

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 16K+ Views

In statistics math, a mode is a value that occurs the highest numbers of time. For Example, assume a set of values 3, 5, 2, 7, 3. The mode of this value set is 3 as it appears more than any other number.Algorithm1.Take an integer set A of n values. 2.Count the occurrence of each integer value in A. 3.Display the value with the highest occurrence.Examplepublic class Mode {    static int mode(int a[], int n) {       int maxValue = 0, maxCount = 0, i, j;       for (i = 0; i < n; ...

Read More
Showing 1–10 of 810 articles
« Prev 1 2 3 4 5 81 Next »
Advertisements