Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Anvi Jain
427 articles
Configuration file parser in Python (configparser)
The configparser module from Python's standard library provides functionality for reading and writing configuration files as used by Microsoft Windows OS. Such files usually have .INI extension. The INI file consists of sections, each led by a [section] header. Between square brackets, we can put the section's name. Section is followed by key/value entries separated by = or : character. It may include comments, prefixed by # or ; symbol. A sample INI file is shown below − [Settings] # Set detailed log for additional debugging info DetailedLog=1 RunStatus=1 StatusPort=6090 StatusRefresh=10 Archive=1 # Sets the location of ...
Read MoreDisassembler for Python bytecode
The dis module in Python's standard library provides functions for analyzing Python bytecode by disassembling it into human-readable form. This helps with code optimization and understanding how Python executes your code internally. Basic Disassembly with dis() The dis() function generates a disassembled representation of Python code objects like functions, methods, or classes − import dis def hello(): print("hello world") dis.dis(hello) 2 0 LOAD_GLOBAL ...
Read MoreHow do we create the title of the text track in HTML?
The label attribute in HTML is used to create the title of text tracks in the element. This attribute provides a user-readable title for the track that appears in the browser's media controls, helping users identify and select different subtitle, caption, or description tracks. Syntax Following is the syntax for using the label attribute in the element − Where label specifies a user-readable title for the text track. This title is displayed in the browser's track selection menu. Track Element Attributes The element supports several important attributes for ...
Read MoreHow do we set the alignment according to surrounding elements in HTML?
The align attribute was used in older HTML versions to set the alignment of elements according to their surrounding content. However, this attribute is deprecated in HTML5, and CSS should be used instead for modern web development. Note − The align attribute is deprecated in HTML5. Use CSS text-align, margin, or flexbox properties for alignment instead. Legacy Align Attribute Syntax The deprecated align attribute had the following syntax − Content Where value could be: left − Aligns content to the left right − Aligns content to the right center − Centers ...
Read MoreHow do we add glossary definitions in HTML?
The definition list in HTML is created using the tag to add glossary definitions and term-description pairs. A definition list consists of terms defined with (definition term) and their corresponding descriptions using (definition description) tags. Definition lists are ideal for glossaries, dictionaries, FAQs, and any content where you need to pair terms with their explanations or definitions. Syntax Following is the syntax for creating definition lists in HTML − Term 1 Description of term 1 Term 2 Description of ...
Read MoreHow can I display an image inside SVG circle in HTML5?
To display an image inside an SVG circle in HTML5, you use the element combined with a clipping path. The element defines the circular boundary, while the element displays the actual image content that gets clipped to the circle shape. Syntax Following is the basic syntax for creating a clipped circular image in SVG − ...
Read MoreHow do we add a single-line input field in HTML?
To add a single-line input field in HTML, use the tag with type="text". This creates a text input field where users can enter data. The tag is a self-closing element and one of the most versatile form elements in HTML. Note: The article mentioned tag, but this tag has been deprecated since HTML 4.01 and removed entirely in HTML5. Modern web development uses the tag instead. Syntax Following is the basic syntax for creating a single-line input field − For better accessibility and user experience, it's recommended to ...
Read MoreHTML5 meta name = "viewport" doesn't work as expected
The HTML5 viewport meta tag controls how web pages are displayed on mobile devices. When it doesn't work as expected, it's often due to incorrect syntax or conflicting properties. Common Issues and Solutions Here are the most effective viewport configurations to fix common display problems: Method 1: Standard Responsive Design For most responsive websites, use this configuration: Responsive Page This page adapts to screen width Content scales properly on all devices. ...
Read MoreHow to format a rounded number to N decimals using JavaScript?
Use the toFixed() method to format a rounded number to N decimals. The toFixed() method formats a number with a specific number of digits to the right of the decimal point and returns a string representation. Syntax number.toFixed(digits) Parameters digits (optional): An integer specifying the number of digits after the decimal point. Must be in the range 0-100. Default is 0. Return Value Returns a string representation of the number with the specified number of decimal places. Example Here's how to format numbers to different decimal places: ...
Read MoreHow to create a new img tag with JQuery, with the src and id from a JavaScript object?
To create a new img tag with jQuery using data from a JavaScript object, you can pass an HTML string to the jQuery constructor or use the attribute object syntax. Method 1: Using HTML String and attr() Create an img element and set attributes using the attr() method: // JavaScript object with image data var imageData = { id: 'dynamic-image', src: 'https://via.placeholder.com/150', alt: 'Dynamic Image' }; // Create img element and set attributes var myImg = $(''); myImg.attr('id', imageData.id); myImg.attr('src', imageData.src); myImg.attr('alt', ...
Read More