The External Data Representation (XDR) is a standard data serialization format used for transporting data between different systems. Python's xdrlib module provides encoders and decoders for XDR format, making it useful for creating and transferring complex data structures across networks. XDR provides a service associated with the OSI Presentation Layer and ensures consistent data representation regardless of the underlying system architecture. Basic XDR Packing and Unpacking The following example demonstrates how to pack and unpack data using the xdrlib module ? import xdrlib # Create a packer object packer = xdrlib.Packer() print("Packer type:", type(packer)) ... Read More
Creating a professional resume with HTML and CSS allows you to build an attractive, customizable document that can be easily shared digitally. A well-structured resume showcases your skills and experience effectively while maintaining a professional appearance across different devices. Syntax /* Basic Resume Layout Structure */ .container { display: grid; grid-template-columns: 1fr 2fr; max-width: 1000px; margin: 0 auto; } .left-section { background-color: #333; color: white; padding: 20px; } ... Read More
The uuencode module in Python provides functions to encode and decode files using the Unix uuencoding format. This encoding method converts binary data into ASCII text, making it safe for transmission over text-based protocols. Understanding Uuencoding Uuencoding (Unix-to-Unix encoding) transforms binary files into printable ASCII characters. The encoded output includes a header with file permissions and name, followed by encoded data lines. Encoding a File The uu.encode() function converts a binary file into uuencoded format ? Syntax uu.encode(in_file, out_file, name=None, mode=None) Example import uu import io # Create ... Read More
To show a Word document in an HTML page using JavaScript is important where you are required to read Word documents within your browser. This article will discuss three approaches to accomplishing this in JavaScript, allowing you to load .docx files and display them on your webpage to the user. In this article, our task is to show a word document in an HTML page using JavaScript. We will be either using a .docx file from our system or using URL. Approaches to Show Documents in HTML Using Mammoth.js Library Using iFrame with Microsoft Office Viewer ... Read More
When working with emails and web data, we often encounter non-ASCII characters that need special encoding. MIME quoted-printable encoding helps transmit such data safely over protocols that only support ASCII characters. Python provides built-in modules to handle this encoding and decoding efficiently. Using the email Package The email package includes modules for handling MIME encoding. Here's how to create a quoted-printable encoded message ? import email.mime.nonmultipart import email.charset # Create MIME message with UTF-8 charset msg = email.mime.nonmultipart.MIMENonMultipart('text', 'plain', charset='utf-8') # Construct charset with quoted-printable encoding cs = email.charset.Charset('utf-8') cs.body_encoding = email.charset.QP # ... Read More
Many times Python will receive data from various sources which can be in different formats like CSV, JSON etc which can be converted to Python lists or dictionaries. But to apply calculations or analysis using packages like pandas, we need to convert this data into DataFrames. In this article we will see how we can convert a given Python list whose elements are nested dictionaries, into a pandas DataFrame. Basic Approach We first take the list of nested dictionary and extract the rows of data from it. Then we create another for loop to append the rows into ... Read More
In HTML, a date picker is a useful input control that enables users to select specific dates on websites or forms. By default, date pickers accept any date, but you can limit the selectable date range using the max attribute to restrict selection to today or earlier dates. Syntax What is a Date Picker? A date picker is a user interface component that allows users to select dates through a calendar interface. It's commonly used in forms for applications like reservation systems, scheduling software, or collecting birthdates. Setting Max Date to Today ... Read More
A list in Python is a collection of items placed within [] which may contain duplicate values. In this article, we will explore different methods to extract only the unique values from a list while preserving or modifying the original order. Using append() with Manual Checking This approach creates a new empty list and appends elements only if they don't already exist. We use a for loop with not in condition to check for duplicates ? Example def get_unique_values(original_list): # Initialize an empty list unique_list = [] ... Read More
Images play an important role in increasing user interest in content and enriching the appearance of websites. However, broken images can occur due to wrong links, missing files, or server problems, which negatively affects user experience. In this article, we will explore how to repair broken pictures in HTML using different approaches to ensure graceful handling of image loading failures. Approaches to Repair Broken Pictures Using alt Attribute Using onerror Event Using CSS Fallback Using alt Attribute The alt attribute provides alternative text that displays when an image cannot be loaded. This text ... Read More
A list in Python can also contain lists inside it as elements. These nested lists are called sublists. In this article we will solve the challenge of retrieving only the last element of each sublist in a given list. Using for Loop It is a very simple approach in which we loop through the sublists fetching the item at index -1 in them. A for loop is used for this purpose as shown below ? sublists = [['Mon', 1], ['Tue', 'Wed', "Fri"], [12, 3, 7]] print("Given List:") print(sublists) print("Last Items from sublists:") for item in ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Economics & Finance