Nishtha Thakur

Nishtha Thakur

398 Articles Published

Articles by Nishtha Thakur

398 articles

Encode and decode binhex4 files using Python (binhex)

Nishtha Thakur
Nishtha Thakur
Updated on 25-Mar-2026 697 Views

The binhex module encodes and decodes files in binhex4 format, which was used to represent Macintosh files in ASCII format for transmission over text-based protocols. This module handles only the data fork of files. Functions The binhex module provides two main functions: binhex.binhex(input, output): Converts a binary file to binhex4 format. The input parameter is the filename to encode, and output can be either a filename or a file-like object with write() and close() methods. binhex.hexbin(input, output): Decodes a binhex4 file back to binary format. The input can be a filename or file-like object, and output ...

Read More

Inspect live objects in Python

Nishtha Thakur
Nishtha Thakur
Updated on 25-Mar-2026 805 Views

The inspect module in Python provides powerful functions to examine live objects such as modules, classes, methods, functions, and code objects. These functions perform type checking, retrieve source code, inspect classes and functions, and examine the interpreter stack. Key Functions getmembers() − Returns all members of an object in a list of name-value pairs sorted by name. Optional predicate parameter filters results. getmodulename() − Returns the module name from a file path, excluding enclosing package names. Example Module Let's create a sample module to demonstrate inspect functionality ? # inspect_example.py '''This is module ...

Read More

Difference between %p and %x in C/C++

Nishtha Thakur
Nishtha Thakur
Updated on 18-Mar-2026 10K+ Views

Here we will see what are the differences between %p and %x in C or C++. The %p format specifier is used to print pointer values (memory addresses), while %x is used to print unsigned integers in hexadecimal format. Though pointers can also be displayed using %u or %x, the correct and portable way to print a pointer is %p. The visible difference is that %p prints with leading zeros and is platform-width aware (16 hex digits on 64-bit systems, 8 on 32-bit), while %x prints only the significant digits without padding. Syntax printf("%p", pointer); ...

Read More

What is bit stuffing in computer networks?

Nishtha Thakur
Nishtha Thakur
Updated on 16-Mar-2026 26K+ Views

Bit stuffing is a mechanism used in data communication where one or more non-information bits are inserted into a message to prevent the data from being mistaken for control sequences, particularly frame delimiters. Purpose of Bit Stuffing In the Data Link layer, the stream of bits from the physical layer is divided into data frames. Variable-length frames require a specific bit pattern as a delimiter to mark frame boundaries. However, if this same pattern appears within the actual data, the receiver might incorrectly interpret it as a frame boundary. The two common approaches to solve this problem ...

Read More

Forward Error Correction (FEC)

Nishtha Thakur
Nishtha Thakur
Updated on 16-Mar-2026 19K+ Views

Forward Error Correction (FEC) is an error correction technique that detects and corrects a limited number of errors in transmitted data without requiring retransmission from the sender. In FEC, the sender adds redundant error-correcting bits to the original data frame before transmission. At the receiver end, these additional bits are used to perform error detection and correction. If errors are found within the correctable range, the receiver reconstructs the original data and removes the redundant bits before passing the message to upper layers. Forward Error Correction Process ...

Read More

The Adaptive Tree Walk Protocol

Nishtha Thakur
Nishtha Thakur
Updated on 16-Mar-2026 9K+ Views

The Adaptive Tree Walk Protocol is a channel access technique for shared communication channels that dynamically combines the advantages of collision-based protocols (like ALOHA) and collision-free protocols. It adapts to network load conditions by organizing stations in a hierarchical tree structure. In computer networks, when multiple stations transmit simultaneously over a shared channel, their data collides and becomes garbled. Collision-based protocols like ALOHA allow all stations to transmit freely without checking channel availability, which works well under light loads. Collision-free protocols resolve channel access through contention periods, eliminating collisions but adding overhead that benefits heavy loads. The Adaptive ...

Read More

The Hidden Terminal Problem

Nishtha Thakur
Nishtha Thakur
Updated on 16-Mar-2026 27K+ Views

In wireless LANs (wireless local area networks), the hidden terminal problem is a transmission problem that arises when two or more stations who are out of range of each other transmit simultaneously to a common recipient. This is prevalent in decentralized systems where there isn't any central entity for controlling transmissions. This occurs when a station is visible from a wireless access point (AP), but is hidden from other stations that communicate with the AP. Problem Illustration Suppose that there are three stations labeled STA, STB, and STC, where STA and STC are transmitting while STB is receiving. ...

Read More

Execute a script when a user navigates away from a page in HTML?

Nishtha Thakur
Nishtha Thakur
Updated on 16-Mar-2026 308 Views

When a user navigates away from a page, you can execute JavaScript code using the onpagehide event attribute. This event triggers when the user leaves the page by clicking a link, closing the browser tab, submitting a form, refreshing the page, or navigating to another URL. The onpagehide event is part of the HTML5 Page Visibility API and provides a reliable way to detect when users are leaving your page, making it useful for cleanup tasks, saving user data, or logging analytics. Syntax Following are the different ways to use the onpagehide event − HTML attribute ...

Read More

Why to use canvas tag in HTML5?

Nishtha Thakur
Nishtha Thakur
Updated on 16-Mar-2026 321 Views

The HTML tag is a powerful HTML5 element used to draw graphics, animations, charts, and interactive visual content directly in the browser using JavaScript. Unlike static images, the canvas provides a dynamic drawing surface that can be programmatically controlled to create rich visual experiences. Syntax Following is the basic syntax for the canvas element − Fallback content for browsers that don't support canvas Canvas Attributes The canvas element has two specific attributes that control its dimensions − Attribute Value Description ...

Read More

How to specify that a user can enter more than one value in HTML?

Nishtha Thakur
Nishtha Thakur
Updated on 16-Mar-2026 209 Views

The multiple attribute in HTML allows users to select or enter more than one value in specific form elements. This attribute is commonly used with elements of type file and email, as well as with elements to enable multi-selection capabilities. Syntax Following is the syntax for using the multiple attribute − ... The multiple attribute is a boolean attribute, which means its presence alone enables the functionality. You can write it as multiple, multiple="", or multiple="multiple". Multiple File Selection The most common use of the multiple attribute is ...

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