Found 27104 Articles for Server Side Programming

How to change the figure style to Darkgrid in Seaborn?

Niharika Aitam
Updated on 02-Aug-2023 17:34:00

270 Views

Seaborn provides several built-in figure styles that we can choose from to enhance the visual appearance of our plots. These styles affect various elements such as colors, grid lines, background, and fonts. To set the figure style in Seaborn, we can use the sns.set_style() function. The following are the available figure styles in Seaborn library. Darkgrid − This style features a dark gray background with grid lines, which helps in focusing attention on the data points. Whitegrid − This style is similar to "darkgrid" but with a white background, making it suitable for plots with lighter color schemes. Dark ... Read More

Finding the Common items among Python dictionaries

Niharika Aitam
Updated on 02-Aug-2023 17:33:27

75 Views

A Dictionary is one of the unordered data structures available in python to store the data in the key and value pair. It is also known as Associative array or Hash map in other programming languages. The dictionary is represented using the curly braces {} and the key and value are separated using a colon “:” The keys in the dictionary are unique and the values can be of duplicates. To access the elements of the dictionary we will use the keys. Example The following is the example of creating a dictionary using the dic() method and curly braces {} available ... Read More

How to Display Data from CSV file using PHP?

Dishebh Bhayana
Updated on 02-Aug-2023 20:18:08

2K+ Views

In this article, we will learn how to display data from a CSV file using PHP using fgetcsv(), str_getcsv and SplFileObject functions. CSV file is a simple file format used to store data with comma-separated values, and each row in it represents a record in the tabular data. To read a CSV file using PHP, we will use the fgetcsv() function which reads a line from a CSV file and returns an array of values representing the CSV data present in that line. Let’s understand this with the help of an example below − Example 1 In this ... Read More

Sorting Arrays in PHP

Pradeep Kumar
Updated on 02-Aug-2023 12:53:13

2K+ Views

What is Sorting? Sorting is the process of arranging a collection of items or data elements in a particular order, usually based on some predefined criteria. It is a fundamental operation in computer science and is used extensively in various algorithms and applications. The purpose of sorting is to bring organization and structure to a set of data so that it can be easily searched, accessed, or presented in a meaningful way. By arranging the data in a specific order, sorting allows for efficient searching, comparison, and retrieval operations. Sorting can be performed on various types of ... Read More

Sort Array of Objects by Object Fields in PHP

Pradeep Kumar
Updated on 02-Aug-2023 12:44:10

2K+ Views

There are several ways to sort an array of objects by object fields in PHP. Here are some common approaches: Using usort() function with a custom comparison function Implementing a custom sorting algorithm Utilizing the array_multisort() function Using usort() Function with a Custom Comparison Function Here's an example of using the usort() function with a custom comparison function to sort an array of objects by object fields in PHP: // Custom comparison function function compareByField($a, $b) { // Replace 'fieldName' with ... Read More

Sort a Multidimensional Array by Date Element in PHP

Pradeep Kumar
Updated on 02-Aug-2023 12:38:50

3K+ Views

In PHP, you can sort a multidimensional array by a specific element, such as a date, using various approaches. Let's explore a few different methods. Using array_multisort() Using a custom comparison function Using the array_multisort() function with a callback Using array_multisort() Here's an example of sorting a multidimensional array by a date element using array_multisort(): $multiArray = array( array('date' => '2023-06-01', 'name' => 'John'), array('date' => '2023-05-15', 'name' => 'Alice'), array('date' => '2023-06-10', 'name' => ... Read More

Saving an Image from URL in PHP

Pradeep Kumar
Updated on 02-Aug-2023 12:35:32

7K+ Views

There are several ways to save an image from a URL in PHP. Here are three common methods: Using file_get_contents() and file_put_contents() Using cURL Using the GD library Using file_get_contents() and file_put_contents() Using file_get_contents() and file_put_contents() is a straightforward method to save an image from a URL in PHP. Here's an Example $url = "https://example.com/image.jpg"; $image = file_get_contents($url); file_put_contents("path/to/save/image.jpg", $image); In this code snippet, file_get_contents() is used to retrieve the contents of the image file from the specified URL. ... Read More

Python program to concatenate two Integer values into one

Niharika Aitam
Updated on 02-Aug-2023 12:28:43

3K+ Views

An integer is a data type in Python that represents whole numbers without any fractional or decimal parts. In Python, integers are a built-in data type, and they can be used to perform arithmetic operations, store numerical values, and represent counts, indices, or other discrete quantities. Integers in Python have a wide range of applications, including mathematical calculations, indexing and slicing sequences e.g., lists, strings, and controlling loops and iterations. They provide a fundamental building block for numerical computations and algorithm implementations in Python. The following are the examples of integers in python. x = 5 y = -10 z ... Read More

Python program to Concatenate Kth index words of String

Niharika Aitam
Updated on 02-Aug-2023 12:27:32

60 Views

The string is the immutable data structure which stores the data in the string format. It can be created by using the str() method or by giving the data in the single or double quotes. It accesses the elements of the string we use indexing. In Indexing we have negative indexing and positive indexing where as in negative indexing we will access the last element using -1 and (–length of string) to the first element. In positive indexing we will give 0 to the first element and (length of string - 1) to the last element. Now, in this article ... Read More

Refresh a Page Using PHP

Pradeep Kumar
Updated on 02-Aug-2023 12:17:29

3K+ Views

What is PHP? PHP, which stands for Hypertext Preprocessor, is a popular server-side scripting language used for web development. It is designed to create dynamic and interactive web pages. PHP is embedded within HTML code and executed on the server, generating HTML output that is sent to the client's browser. With its simple and easy-to-learn syntax, PHP allows developers to build dynamic websites, handle form data, interact with databases, and perform various server-side tasks. It has a vast ecosystem of libraries and frameworks that enhance its functionality and enable developers to create robust and scalable web applications. PHP is ... Read More

Advertisements