Found 53 Questions For Programming

Convert png, jpg, jpeg, gif to webp using PHP Function

Updated on 03-Apr-2023 8:50:14
To convert PNG, JPG, JPEG, and GIF files to WebP format using PHP, you can use the GD library and imagewebp() function. Here's an example code snippet that should do the trick: function convertToWebP($sourcePath, $destinationPath) { // Check if the file is a supported image type $mime = mime_content_type($sourcePath); if ($mime == 'image/png') { $image = imagecreatefrompng($sourcePath); } elseif ($mime == 'image/jpg' || $mime == 'image/jpeg') { $image = imagecreat... Read More

Count of permutations of size 2N with at least N increasing elements

Updated on 01-Apr-2023 17:29:30
Permutations are arrangements of objects in a specific order. In mathematics, a permutation of a set is an arrangement of its elements, without repetition and order being important. Permutations play a significant role in various fields of mathematics, including combinatorics, group theory, and algebra. In this article, we will discuss the count of permutations of size 2N with at least N increasing elements and explain it with an example. C++ CODE // C++ implementation of the approach #includ... Read More

Explain Lambda Function in Python details with Code

Updated on 10-Mar-2023 0:41:20
What is Lambda Function in Python ? In Python, a lambda function is a small anonymous function that can have any number of arguments but can only have one expression. It is defined using the keyword "lambda" followed by the function arguments and a colon, followed by the expression to be evaluated.Here's the syntax for defining a lambda function:lambda arguments: expressionThe lambda function can then be assigned to a variable for later use or can be used directly as a function.Here's ... Read More

How to Use the JavaScript Fetch API to Get Data from an API?

Updated on 20-Feb-2023 0:17:53
In this tutorials, we will learn how the Fetch API can be used to get data from an API. I will be taking a fake API which will contain employee details as an example and from that API. I will show to get data by fetch() API method. JavaScript fetch() method: The fetch() method is modern and versatile and is very well-supported among modern browsers. It can send network requests to the server and load new information whenever it’s needed, without reloading the browser.Syntax: The fetch() m... Read More

Write C program to Check Whether a Number is Positive or Negative

Updated on 10-Feb-2023 13:46:26
In this tutorial we'll learn how to check whether a given integer is positive or negative. We have the the number that we need to check that integer is positive or negative number using c program. Problem Description The program takes the given integer and checks whether the integer is positive or negative. Problem Solution 1. Take the integer which you want to check as input. 2. Check if it is greater or lesser than zero and print the output accordingly. 3. Exit. Program/So... Read More

How To Reduce the Array to 0 by decreasing elements by 1 or replacing at most K elements by 0

Updated on 14-Nov-2022 19:30:10
Given an array arr[ ] of N integers and a positive integer K, the task is to find the minimum number of operations required to reduce all array elements to 0 such that in each operation reduce any array element by 1 and independently at most K array element can be reduced to 0. Examples: Input: arr[ ] = {4, 1, 5}, K = 1 Output: 5 Explanation: Following are the operations performed to convert all array elements to 0: Here K = 1, So replace arr[2] by 0, converts arr[v] to {... Read More

Create A Todo List App in HTML CSS & JavaScript

Updated on 13-Mar-2022 15:42:30
Hey guys, today in this tutorial, you’ll learn how to create a Todo List App in HTML CSS & JavaScript. I have already written two tutorials on Todo App in JavaScript, but these todos have limited features only. So, I have created a new todo app, and it has additional features than the previous todo list. In this todo app, you can easily add, edit, or delete your task. There are filters button too that helps you to filter the tasks. The tasks you added on this todo app will be stored in th... Read More

Recursive program to linearly search an element in a given array using C

Updated on 15-Feb-2022 16:04:30
Given an unsorted array and an element x, search x in given array. Write recursive C code for this. If element is not present, return -1. Approach : The idea is to compare x with the last element in arr[]. If an element is found at the last position, return it. Else recur elmntSrch() for remaining array and element x. Program : /* * Approach : The idea is to compare x with the last element in arr[]. * If an element is found at the last position, return it. * Else recur el... Read More

create an Attractive Poll UI Design using HTML CSS & JavaScript

Updated on 26-Jan-2022 13:51:43
Hey Everyone, today in this tutorial you’ll learn how to create an Attractive Poll UI Design using HTML CSS & JavaScript. In the earlier tutorial, I have shared How to Highlight Searched Text Using JavaScript and now it’s time to create a Pooling System in JavaScript. You may have seen polls on Facebook, YouTube where the author posts a poll with some options, and user have to select one option from the mentioned options. You can undo your selection and in this blog, I’ll show you th... Read More

How to Highlight Searched Text Using JavaScript

Updated on 21-Jan-2022 13:29:25
Hello Everyone, In this tutorial you'll learn how to highlight searched text using HTML & JavaScript. In the previous tutorials we shared Count Up / Count Down Animation With Javascript. Now, its time to create highlight searched text using js. If we want to highlight the text in the Html document using the <mark> tag, then we have to follow the steps which are given below. Using these steps, we can easily highlight the text. Highlight Searched Text Using JavaScript with Source Code ... Read More
1 2 36 Next