Search code snippets, questions, articles...

A portal for programmers by programmers

Learn something new everyday and share your knowledge

Programming Feeds

Javascript examples to remove url from a string

Devsheet / August 14, 2022

If you're looking for a way to remove the url from a string using Javascript, you've come to the right place. In this article, we'll show you a few different examples of how to do this.

Python Switch Case: A Comprehensive Guide with Examples

Devsheet / August 12, 2022

If you're looking for a comprehensive guide on how to use switch case in Python, look no further! This guide will cover everything from the basics of switch case to more advanced concepts. We'll also provide plenty of examples to help you along the way.

Changing User Password in Ubuntu Terminal

codinginpearls / August 10, 2022

Note: If you are not familiar to using the terminal, you will find the space remains empty/blank as you type your existing and new password. Since I am new to using Ubuntu and really any terminal, I am needing a space to save even the simplest of commands.

How to customize a title in chart.js

Devsheet / August 9, 2022

Charts are a great way to visualize data, and chart.js is a powerful library for creating them. However, sometimes you may want to customize the title of your chart. This tutorial will show you how to do that.

Use jQuery to check if a tab is active/inactive

Devsheet / August 9, 2022

When using jQuery, it is possible to check if a tab is active or inactive. This can be done by using focus and blur events. By using these events, it is possible to determine if a tab is currently active or not. This can be useful when trying to determine if a user is currently on a specific tab.

jQuery code to run a function after page load

Devsheet / August 7, 2022

This code will allow you to run a function after the page has loaded. This can be useful if you want to initialize something on the page or make sure that the page is ready before running your code.

Find the Third Smallest Number in an Array using Javascript

Devsheet / August 6, 2022

If you're looking for a quick and easy way to find the third smallest number in an array using Javascript, you've come to the right place. In this article, we'll show you how to do just that with a few simple lines of code.

Python Sort String: Quick and Easy Guide

Devsheet / August 3, 2022

Python is a programming language that is widely used by web developers and software engineers. Python's simple syntax and powerful data structures make it an ideal language for sorting strings. This quick and easy guide will show you how to sort strings in Python.

Go to a line number in Visual Studio Code

Devsheet / August 1, 2022

Visual Studio Code is a code editor developed by Microsoft. It is a free and open-source tool. It has many features such as syntax highlighting, code completion, and debugging. Here, we will show you how to place your cursor on a line number on the current file

Send Form Data in axios POST request

Devsheet / July 30, 2022

When using axios, a Javascript library for making HTTP requests, to make a POST request, you need to set the data that you want to send as the body of the request. To do this, you can use the axios.post() method, which takes two arguments: the URL of the server you want to send the request to, and the data you want to send. In this article, we will look at how to use axios to make a POST request, and how to set the body of the request.

Generate a list of n numbers in Python

Devsheet / July 30, 2022

Python is a versatile language that you can use to write programs to complete a variety of tasks. In this article, you'll learn how to generate a list of numbers in Python. You'll also learn how to modify the list to meet your needs.

Randomly shuffle a list in python (Best Practices)

Devsheet / July 30, 2022

Python provides a number of ways to randomly shuffle a list. The most common is to use the shuffle() method from the random module. This method takes a list and shuffles it in place, returning None.

Python tip: How to insert a variable value inside a string

Devsheet / July 29, 2022

Python is a programming language that is widely used in many different applications today. Python is known for its ease of use and its readability, which makes it a great choice for beginners. One of the great things about Python is that you can insert a variable value inside a string, which can be very useful when you want to print out a message that includes a dynamic value.

Counting rows in a Pandas Dataframe based on column values

Devsheet / July 29, 2022

If you have a pandas DataFrame with a column of values and you want to count the number of rows where the value in that column is equal to a certain value, this tutorial will show you how.

Add a Boolean column in MySQL table with default value

Devsheet / July 27, 2022

Adding a Boolean column in MySQL with a default value is a simple process that can be completed in a few steps. You can add the column to the existing table or while creating a new table. We will explain all the processes that can be used to add the boolean column in the MYSQL table with a default value - true or false.

Sort array of objects by key value in Javascript

Devsheet / July 26, 2022

If you have an array of objects and you want to sort them by a key value, you can use the sort() method. The sort() method takes a callback function as an argument. The callback function takes two arguments, a and b. The sort() method will compare the a and b arguments and return a negative number if a is less than b, a positive number if a is greater than b, or 0 if a is equal to b.

Simplest Way to Find the Smallest Number in an Array using JavaScript

Devsheet / July 24, 2022

If you're looking for the simplest way to find the smallest number in an array using JavaScript, you've come to the right place. In this article, we'll show you how to do it with just a few lines of code.

Django: How to Delete All Rows from a Table

Devsheet / July 24, 2022

If you need to delete all the rows from a table in Django, there are a few different ways you can do it. In this article, we'll show you how to delete all rows from a table in Django using the Django ORM, as well as how to delete all rows from a table using raw SQL.

How to Get IP Addresses in Python - A Quick Tutorial

Devsheet / July 24, 2022

If you're looking for a quick tutorial on how to get IP addresses in Python, you've come to the right place. In this article, we'll show you how to use the Python socket module to get IP addresses. We'll also show you how to use the Python IP address module to validate IP addresses.

How to Use PHP to Get the Client IP Address

Devsheet / July 24, 2022

When PHP is used to get the client IP address, it is first important to understand what an IP address is. An IP address is a unique number that is assigned to each device that is connected to the internet. This number is used to identify the device and allow it to communicate with other devices on the network.

Check if array contains duplicate values in Javascript

Devsheet / July 19, 2022

In Javascript, there are many ways to check if an array contains duplicate values. One way is to use the Set data structure, which can only contain unique values. Another way is to use a for loop to iterate through the array and keep track of values that have been seen before in a separate data structure. If a value is seen more than once, then the array contains duplicates.

Print DataFrame in pretty format in Terminal

Devsheet / July 17, 2022

A DataFrame is a two-dimensional data structure, i.e., data is aligned in a tabular fashion in rows and columns. Each column can hold a different type of data. You can use the tabular package or IPython.display() function to print tabular data in a pretty format. The following code shows how to print a DataFrame in a pretty format in the Terminal.

Apply :hover on element:after and element:before using CSS

anamika / July 14, 2022

CSS is a powerful tool for adding special effects to web pages. In this article, we'll learn how to use the CSS :hover selector to add special effects to elements on our web pages. We'll learn how to apply :hover on elements:before and :after, and how to use CSS to create special effects when the user hovers over an element.

Find the index of Max value in an array using Javascript

Devsheet / July 10, 2022

We will be discussing how to find the index of the maximum value in an array using Javascript. This is a simple task that can be accomplished by using the built-in Math.max() function. However, this function only returns the maximum value, not the index. To get the index, we will use Array.indexOf() function.

Recursive Sum of Digits

alexandruneculai04F52C / July 10, 2022

Calculates the sum of the digits of a number recursively

Access object properties using with() function in Javascript(ES6)

Devsheet / July 10, 2022

ES6 provides a new way to access object properties using the with() function. This is a more convenient way to access object properties, especially when working with large objects.

Highlight the highest value list item using React

Devsheet / July 8, 2022

React is a popular JavaScript library for building user interfaces. When working with data in React, it is often necessary to highlight the largest value in a list. This can be accomplished using the built-in Math.max() function.

Get the largest value from a List in Python

Devsheet / July 7, 2022

Python is a versatile language that you can use to write programs of all kinds. In this article, you'll learn how to get the largest value from a list in Python. You'll also learn how to use the built-in max() function to get the largest value from a list.

Find minimum value from a List in Python

Devsheet / July 6, 2022

In this tutorial, we will learn how to find the minimum value from a list in Python. We will take a list of numbers as input from the user and find the minimum value from the list using the min() function.

Get the average of List values in Python

Devsheet / July 5, 2022

Python is a versatile language that can be used for a wide variety of programming tasks. One such task is working with lists. In this article, we'll take a look at how to get the average of a list in Python.

Loop through a String in Python

Devsheet / July 5, 2022

Python is a programming language with many features and applications. One feature of Python is the ability to loop through a string. This can be useful when you need to perform an operation on each character in a string, or when you need to find a specific character or group of characters in a string.

Get all rows that contain a substring in Pandas DataFrame

Devsheet / July 2, 2022

A Pandas DataFrame is a two-dimensional data structure that can store data of various types. It is similar to a SQL table or an Excel spreadsheet. We can use the Pandas DataFrame to find all rows that contain a substring.

Loading more...