Prabhas

Prabhas

52 Articles Published

Articles by Prabhas

52 articles

How to access nested Python dictionary items via a list of keys?

Prabhas
Prabhas
Updated on 24-Mar-2026 2K+ Views

When working with nested Python dictionaries, you often need to access deeply buried values using a sequence of keys. Python provides several approaches to safely navigate through nested dictionary structures. Using a For Loop The most readable approach is to iterate through each key in the path ? def getFromDict(dataDict, mapList): for k in mapList: dataDict = dataDict[k] return dataDict a = { 'foo': 45, 'bar': { ...

Read More

Managed code vs Unmanaged code in C#

Prabhas
Prabhas
Updated on 17-Mar-2026 4K+ Views

In C#, code can be categorized as either managed or unmanaged based on how it is executed and controlled by the .NET runtime environment. Understanding the difference is crucial for C# developers working with system-level programming or interoperability scenarios. Managed Code Managed code is code whose execution is managed by the Common Language Runtime (CLR). The CLR provides automatic memory management, type safety, exception handling, and garbage collection. When you write C# code, it is compiled into Intermediate Language (IL) code, which is then executed by the CLR. Managed Code Execution Flow ...

Read More

Execute a script when the browser window is closed in HTML?

Prabhas
Prabhas
Updated on 16-Mar-2026 778 Views

The onunload event attribute in HTML triggers when the browser window is being closed, refreshed, or navigated away from. This event allows you to execute JavaScript code before the page is completely unloaded from memory. Syntax Following is the syntax for the onunload attribute − You can also use addEventListener in JavaScript − window.addEventListener('unload', function() { // Your code here }); Using onunload Attribute The onunload event fires when the user leaves the page by closing the browser window, clicking a link, refreshing the ...

Read More

How to specify if and how the author thinks the audio/video should be loaded when the page loads in HTML?

Prabhas
Prabhas
Updated on 16-Mar-2026 167 Views

The preload attribute in HTML5 allows authors to provide hints to the browser about how much of an audio or video file should be loaded when the page loads. This attribute helps optimize the user experience by controlling bandwidth usage and load times based on the content's expected usage. Syntax Following is the syntax for the preload attribute − The value can be none, metadata, or auto. Preload Attribute Values The preload attribute accepts three possible values ...

Read More

Include information about the document in HTML

Prabhas
Prabhas
Updated on 16-Mar-2026 264 Views

Use the tag to include information about the document. The HTML element contains metadata and other information about the document that is not displayed directly in the browser window. This section provides essential information to browsers, search engines, and other web services about your HTML document. Syntax Following is the basic syntax for the element − Common Elements in the Head Section The section typically contains several important elements − − Defines the document title shown in the browser tab ...

Read More

Execute a script when a file can be played all the way to the end without pausing for buffering in HTML?

Prabhas
Prabhas
Updated on 16-Mar-2026 123 Views

The oncanplaythrough attribute in HTML5 executes a JavaScript function when a media file (audio or video) can be played all the way through without pausing for buffering. This event fires when the browser estimates that enough data has been loaded to play the media from start to finish at the current playback rate. Syntax Following is the syntax for the oncanplaythrough attribute − The functionName() is a JavaScript function that gets executed when the media can play through without buffering interruptions. How It Works The oncanplaythrough event is part of ...

Read More

Streaming a video file to an HTML5 video player with Node.js so that the video controls continue to work

Prabhas
Prabhas
Updated on 16-Mar-2026 340 Views

When streaming video files to an HTML5 video player with Node.js, it's essential to implement proper HTTP range request support to maintain video controls functionality. The HTML5 video element relies on partial content requests (HTTP 206) to enable seeking, scrubbing, and progressive loading. How HTTP Range Requests Work The browser sends a Range header (e.g., bytes=0-1023) to request specific portions of the video file. The server responds with a 206 Partial Content status and the requested byte range, allowing the video player to load segments on demand. Basic Video Streaming Setup Following example demonstrates the basic ...

Read More

How to preselect a value in a dropdown list of items in HTML forms?

Prabhas
Prabhas
Updated on 16-Mar-2026 6K+ Views

With HTML, you can easily create a simple dropdown list of items to get user input in HTML forms. A select box, also called a dropdown box, provides an option to list down various options in the form of a dropdown list. You can also preselect a value in dropdown list of items in HTML forms. For that, add the selected attribute in the tag for the value you want to preselect. Syntax Following is the syntax to preselect an option in a dropdown list − Option 1 ...

Read More

How to add multi-language content in HTML?

Prabhas
Prabhas
Updated on 16-Mar-2026 4K+ Views

The lang attribute in HTML allows you to specify the language of content within elements, enabling proper rendering, accessibility, and search engine optimization for multi-language websites. This attribute helps browsers, screen readers, and translation tools understand and process content correctly. Syntax Following is the syntax for the lang attribute − Content The language code follows the ISO 639-1 standard (two-letter codes like en, fr, es) or BCP 47 standard for more specific regional variants (like en-US, fr-CA). Document-Level Language Declaration The most important use of the lang attribute is declaring the primary ...

Read More

Can we delete the "getContext" property of HTML5 Canvas tag through script?

Prabhas
Prabhas
Updated on 16-Mar-2026 176 Views

The getContext property of the HTML5 Canvas element is a built-in method that provides access to the drawing context. While the HTML5 specification doesn't explicitly address deletion of the getContext property through JavaScript, it is technically possible to delete this property from the prototype chain. When we delete the getContext method, all canvas elements lose their ability to create drawing contexts, effectively rendering them non-functional for graphics operations. Syntax Following is the syntax to delete the getContext property − delete window.HTMLCanvasElement.prototype.getContext; Following is the syntax to check if the property has been deleted ...

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