Nitya Raut

Nitya Raut

158 Articles Published

Articles by Nitya Raut

Page 2 of 16

What is Hamming Distance?

Nitya Raut
Nitya Raut
Updated on 16-Mar-2026 79K+ Views

Hamming distance is a metric for comparing two binary data strings of equal length. It measures the number of bit positions in which the two bits are different, providing a quantitative way to assess how "close" or "far apart" two binary sequences are. The Hamming distance between two strings a and b is denoted as d(a, b). This distance metric is fundamental in computer networks for error detection and correction, as well as in coding theory for comparing equal-length data words. How It Works To calculate the Hamming distance between two binary strings, we perform an XOR ...

Read More

Constraint length of the Convolutional Code

Nitya Raut
Nitya Raut
Updated on 16-Mar-2026 4K+ Views

Convolutional codes are error correcting codes where data streams of indefinite lengths are encoded before transmission over noisy channels. The message streams are encoded by the sliding application of Boolean functions that generate a sequence of output bits. Convolutional codes were first introduced in 1955 by Elias. After extensive research by mathematicians, Viterbi developed an algorithm for maximum likelihood decoding in 1973, called the Viterbi algorithm, which led to modern convolutional codes. Parameters in Convolutional Codes For generating a convolutional code, information is passed sequentially through a linear finite-state shift register. The shift register comprises of K-bit ...

Read More

How to draw a hollow circle in SVG?

Nitya Raut
Nitya Raut
Updated on 16-Mar-2026 3K+ Views

To draw a hollow circle in SVG, use the element with fill="none" and define the outline using stroke properties. This creates a circle with only a border and transparent interior. SVG stands for Scalable Vector Graphics and is a language for describing 2D-graphics and graphical applications in XML. The XML is then rendered by an SVG viewer, and most web browsers can display SVG just like they display PNG, GIF, and JPG images. Syntax Following is the syntax for drawing a hollow circle in SVG − Parameters The element ...

Read More

How to display an image in HTML?

Nitya Raut
Nitya Raut
Updated on 16-Mar-2026 9K+ Views

Use the tag in HTML to display an image. The tag is a self-closing element that embeds images into web pages. It requires the src attribute to specify the image location and the alt attribute for accessibility. Syntax Following is the basic syntax for the tag − The tag is self-closing, meaning it doesn't require a closing tag. The src and alt attributes are essential for proper functionality and accessibility. IMG Tag Attributes The tag supports several attributes to control image display and behavior − ...

Read More

How to set the CSS property that the transition effect is for with JavaScript?

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 204 Views

Use the transitionProperty property in JavaScript to set which CSS properties should have transition effects. This property controls exactly which CSS properties will animate when they change. Syntax element.style.transitionProperty = "property1, property2, ..."; element.style.transitionProperty = "all"; // All properties element.style.transitionProperty = "none"; // No transitions Example Here's a complete example showing how to set transition properties dynamically: #div1 { ...

Read More

How to reconnect to websocket after close connection with HTML?

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 5K+ Views

WebSockets are designed to maintain persistent connections, but they can close due to network issues, server restarts, or connection timeouts. When a WebSocket connection closes, you need to manually recreate the socket to reconnect. How WebSocket Reconnection Works When a WebSocket connection closes, the onclose event fires. You can handle this event to automatically attempt reconnection by creating a new WebSocket instance and reattaching event listeners. Basic Reconnection Example // Socket Variable declaration var mySocket; const socketMessageListener = (event) => { console.log('Received:', event.data); }; // Connection opened const ...

Read More

Test if the HTML attribute tabindex is present and get the value

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 533 Views

To test if the HTML attribute tabindex is present and get its value, you can use jQuery's attr() method or JavaScript's hasAttribute() method. Using jQuery attr() Method The attr() method returns the attribute value if it exists, or undefined if the attribute is not present: Element with tabindex Element without tabindex // Get tabindex value ...

Read More

Configuring any CDN to deliver only one file no matter what URL has been requested

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 204 Views

Content Delivery Networks (CDNs) are typically designed to serve static files based on specific URL paths. However, there are scenarios where you need a CDN to deliver the same file regardless of the requested URL - commonly used for Single Page Applications (SPAs) that rely on client-side routing. Why Serve One File for All URLs? Single Page Applications like React, Vue, or Angular apps use client-side routing. When users navigate to different URLs, the same index.html file should be served, and JavaScript handles the routing internally. Method 1: Using CloudFlare Page Rules CloudFlare allows you to ...

Read More

Which is the best JavaScript compressor?

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 269 Views

JavaScript compressors reduce file sizes by removing unnecessary whitespace, comments, and optimizing code structure. Here are the best options available for different needs. Google Closure Compiler Google Closure Compiler is one of the most powerful JavaScript optimization tools. It parses JavaScript, analyzes it, removes dead code, rewrites inefficient patterns, and minimizes the output. Unlike simple minifiers, it performs advanced optimizations like function inlining and variable renaming. Original JS function add(a, b){ return a + b; ...

Read More

What are the DataTransfer object attributes?

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 585 Views

The DataTransfer object holds data about the drag and drop operation. This data can be retrieved and set using various attributes and methods associated with the DataTransfer object. The DataTransfer object is automatically created by the browser during drag and drop operations and is available through the event object in drag event handlers. DataTransfer Attributes and Methods Property/Method ...

Read More
Showing 11–20 of 158 articles
« Prev 1 2 3 4 5 16 Next »
Advertisements