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 on Trending Technologies
Technical articles with clear explanations and examples
How to Center a Background Image Inside a div?
When creating web pages, centering a background image in a div is a common design requirement. There are several CSS methods available, each suited for different scenarios. This article demonstrates various techniques to center background images inside divs regardless of screen size or container dimensions. Syntax /* Method 1: Background Position */ .container { background-image: url('image.jpg'); background-position: center; background-repeat: no-repeat; } /* Method 2: Flexbox */ .container { display: flex; justify-content: center; ...
Read MoreCreate a Pandas Dataframe from a dict of equal length lists in Python
A Pandas DataFrame can be created from a dictionary where values are lists of equal length. This approach is useful when you have related data stored in separate lists and want to combine them into a tabular structure. Using Separate Lists and Dictionary In this approach, we declare lists individually and then use each list as a value for the appropriate key inside a dictionary. Finally, we apply pd.DataFrame() to convert the dictionary into a DataFrame ? Example import pandas as pd # Lists for Exam schedule days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] ...
Read MoreHow to Relatively Position an Element without It Taking Space in the Document Flow?
In standard CSS positioning, relatively positioned elements occupy space within the normal document flow even after being offset by top, left, right, or bottom properties. This can create a gap in the layout where the element would have naturally sat, disrupting the alignment or layout of other elements around it. In this article, we will position an element so that it appears relatively within the document but does not affect the design of surrounding elements, effectively making it "overlay" without creating extra space. Syntax .parent { position: relative; width: ...
Read MorePython to create a digital clock using Tkinter
Python Tkinter can be used to create all kinds of GUI programs for desktop applications. In this article, we will see how to create a digital clock that displays the current time in hours, minutes, and seconds format with live updates. We use the time module to import the strftime() method, which formats the current time. The clock updates automatically every 200 milliseconds using a recursive function and Tkinter's after() method. Creating the Digital Clock Here's how to build a simple digital clock using Tkinter ? import time from tkinter import * # Create ...
Read MoreHow to Make a Child Div Element Wider than Parent Div using CSS?
In CSS, there are times when you want to stretch a child div element beyond its parent div, often for specific design requirements. While this goes against the normal flow where children are contained within their parents, CSS provides several properties to achieve this effect. Syntax /* Method 1: Using overflow property */ .parent { overflow: visible; } .child { width: value-larger-than-parent; } /* Method 2: Using positioning */ .parent { position: relative; } .child { position: absolute; ...
Read MoreAdd style to Python tkinter button
Tkinter has great support for creating GUI programs based on Python. It offers different ways of styling buttons on the Tkinter canvas based on font, size, color, and other properties. In this article, we will see how to apply styles to specific buttons or all buttons in general on the canvas using the ttk.Style class. Applying Style to Specific Buttons Let's consider the case when we have two buttons in the canvas and we want to apply styling only to the first button. We use a custom style name like 'W.TButton' as part of the configuration along with ...
Read MoreHow to Style the Selected Label of a Radio Button?
In this article, we will style the label for the radio button which is currently selected. CSS allows you to eliminate the default radio button and style the selected and unselected states of the labels. This is accomplished with the help of the :checked pseudo-class and adjacent sibling selectors. Syntax input[type="radio"]:checked + label { /* Styles for selected label */ } label { /* Default label styles */ } Styling the Selected Label of a Radio Button To begin with, we hide the original circular ...
Read MorePython - Filtering data with Pandas .query() method
The Pandas .query() method provides a powerful way to filter DataFrame rows using a string-based query expression. It offers a more readable alternative to boolean indexing for complex filtering conditions. Basic Syntax The .query() method accepts a query string and optional parameters ? import pandas as pd # Create sample dataset data = { 'age': [25, 30, 35, 40, 45, 50, 55, 60, 65], 'salary': [30000, 45000, 55000, 65000, 70000, 80000, 85000, 90000, 95000], 'department': ['IT', 'HR', 'IT', 'Finance', 'HR', 'IT', 'Finance', 'HR', ...
Read MoreHow to insert Spaces/Tabs in text using HTML and CSS?
To insert spaces/tabs in text using HTML and CSS, can be tricky as HTML generally doesn't recognize multiple spaces or tabs by default. If you add extra spaces in your code, they'll collapse into a single space when displayed in the browser. We will be understanding three different approaches to insert spaces in text. Syntax /* Using CSS properties for spacing */ selector { margin-left: value; padding-left: value; text-indent: value; } Approaches to Insert Spaces/Tabs in Text ...
Read MorePython - Filter out integers from float numpy array
When working with NumPy arrays containing both floats and integers, you may need to filter out integer values for data cleansing purposes. This article demonstrates two effective methods to remove integers from a float NumPy array using astype comparison and modulo operations. Method 1: Using astype Comparison The astype function converts array elements to integers. By comparing the original array with its integer-converted version, we can identify which elements are not integers ? Example import numpy as np # Create array with mixed floats and integers data_array = np.array([3.2, 5.5, 2.0, 4.1, 5]) ...
Read More