teleren/devto huggingface dataset:
180k+ Open Source Free Icons
Tags: design, icon
Published: 2023-08-18 06:28:25

There are numerous Open Source Icon projects available on GitHub; however, they are not all managed in a single location.

To address this issue, I have developed a project known as IconBuddy.app, which provides a centralized platform for browsing **a collection of 180k+ icons**.

[https://iconbuddy.app](https://iconbuddy.app)


[![Download, Customize, Edit and Personalize. Over 180k+ open source icons.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/halkadvl9pf9p01r66ux.png)](https://iconbuddy.app)

Search icons across more than 150 collections.


[![Search icons](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6l80m2rfwz0i7njgxpzj.png)](https://iconbuddy.app)

Customize icon with color, size, background color, gradient, & more.


[![Customize icon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nz2pqsw7q2y70dy5fsr0.png)](https://iconbuddy.app)

We have a wide range of formats to choose from, so you can download the icons in the format you want. We have SVG, PNG, WEBP, JSX, VUE and BASE64, URLs, CSS background snippers, HTML Image tags. We have it all.

Go and checkout here → [https://iconbuddy.app](https://iconbuddy.app)

Looking forward to know your feedbacks. Thanks
5 Python Self-study Websites
Published: 2023-08-18 06:27:45

Python is a widely used programming language compared to other languages ​​such as Java, Perl, PHP and Ruby. Python is a simple and easy-to-learn open source language with its own syntax.

The text recommends some python self-study websites.

1.Learn Code the Hard Way
“Learn Code the Hard Way” is an introduction to the most popular Python programming language. No coding experience required. This is an open source free tutorial that includes courses from zero base to advanced level. We give you the opportunity to test and put into practice what you have learned. Reviewers and professional programmers are available online.


2.Python spot
If you’re looking for Python-focused tutorials and resources, Pythonspot is for you. We provide free tutorials and great content on the Python programming language for beginners and expert developers. Of course, the content is organized according to the difficulty level.


3.Coursera
Like other tutorial sites, Coursera offers free online tutorials in multiple programming languages. You can easily learn the Python programming language using this platform. You can also display subtitles for the video if you want. It includes Korean, Chinese, Spanish, German and more.


4.New Circle Python
New Circle, like other programming tutorials, is an online platform for beginners and professional programmers to learn the Python programming language. You can watch some video tutorials on the website to help you understand the concepts better. A Python Fundamentals training series for beginners is also available.


5.Tutorials Point
Tutorials Point is one of the best online tutorials that provide free, high-quality content for learning the Python programming language. Here you can test your own learning effectiveness with multiple exercises and different coding options. In addition to basic Python concepts, it includes advanced Python content such as database access, CGI, game programming, XML processing, networking, and more.
String in Python part - 1
Tags: python, programming, machinelearning, mlops
Published: 2023-08-18 06:18:56

In Python, a string is a sequence of characters enclosed within either single ('') or double ("") quotation marks. It's a fundamental data type used to represent textual data. Strings can contain letters, numbers, symbols, and even spaces.  

### **How strings work in Python**

#### Creating Strings
we can create a string by using '' or double quotation marks. for example 

```
myString = "Mlops journey 2023"
country = 'Bangladesh'
name ='sajjad rahman'
```

#### Indexing 
An index refers to the position of a character within that string. It's a numerical value that helps identify the location of a specific character. Also, we know that index starts from 0 and increases by 1 . For example

```
myString = "Mlops journey 2023"
myString[0] 
'M' # output 
myString[7]
'j'
```

#### Indexing
Each character in a string has a specific index, starting from 0 for the first character. You can access individual characters using their indices. For example, "Python"[0] returns 'P'.

Negative Index: Yes, the negative index is allowed in Python. where -1 corresponds to the last character, -2 to the second-to-last, and so on. For example

```
myString = "Mlops journey 2023"
myString[-1]
'3' # output
myString[-8]
'n' # output
```


#### String Slicing
Slicing allows you to extract a portion of a string. we can specify a start index, an end index (exclusive), and a step size. For example, 

```

myString[3:]
'ps journey 2023'
myString[3:8]
'ps jo'

```
#### String Concatenation
We can combine  strings using the + operator. For example, 

```

firstName = 'sajjad'
lastName = 'rahman'
fullNmae = firstName + lastName
print(fullName)
'sajjad rahman' # output 
```

#### String Length
The len() function returns the number of characters in a string. For example, 

```
len(myString)
18 # output 
```
How to customize a useState so that the latest value can be synchronously obtained after the state is updated
Published: 2023-08-18 06:15:01


I want to execute setState and synchronize printing to obtain new values, such as the following
```
async function submit() {
    await clearEnhanceSwitch();
    console.log(videoSwitches, audioSwitches);
}
```
ClearEnhanceSwitch is used to execute the update status. The specific code is as follows: wrapped with promise to solve the promise after the callback function is triggered, and printed with the await keyword to obtain the latest value

```
const clearEnhanceSwitch = async () => {
    const stack = [];

    if (!options.value.includes('video')) {
      stack.push(
        new Promise(resolve => {
          setVideoSwitches([], () => {
            resolve(true);
          });
        }),
      );
    }

    if (!options.value.includes('audio')) {
      stack.push(
        new Promise(resolve => {
          setAudioSwitches([], () => {
            resolve(true);
          });
        }),
      );
    }

    return Promise.all(stack);
  };
```
videoSwitches,audioSwitchesCreated using a custom hook

```
const [videoSwitches, setVideoSwitches] = useStateCallback<VideoEnhanceField[]>(['superResolution']);
const [audioSwitches, setAudioSwitches] = useStateCallback<AudioEnhanceField[]>([]);
```
This is a custom hook useStateCallback I wrote:

```
import { useCallback, useEffect, useRef, useState } from 'react';

type CallbackFunction<T> = (state: T) => void;

export default function useStateCallback<T>(init: T): [T, (newValue: T, callback?: CallbackFunction<T>) => void] {
  const [state, setState] = useState<T>(init);
  const callbackRef = useRef<CallbackFunction<T> | null>(null);

  useEffect(() => {
    console.log(state);
    if (callbackRef.current) {
      callbackRef.current(state);
    }
  }, [state]);

  const setStateWithCallback = useCallback((newValue: T, callback?: CallbackFunction<T>) => {
    setState(() => {
      if (callback) {
        callbackRef.current = callback;
      }
      return newValue;
    });
  }, []);

  return [state, setStateWithCallback];
}
```
When I execute clearEnhanceSwitch in the submit, the expected result is that the corresponding setState is triggered and the promise and await are used to complete the callback before resolving the promise. At this point, the setState operation is completed and new values can be obtained. However, in fact, the printed values here are still the old values, not the expected empty array []. Can someone help me explain the reasons and principles behind this？
Manager Handbook for Centralized AntDB-T - P5–3
Published: 2023-08-18 06:07:26

pg_dump example 1:

```
$ pg_dump mydb > db.sql             #Dump a database mydb to an SQL script file
$ psql -d newdb -f db.sql           #Reload such a script into a newly created database named newdb
$ pg_dump -Fc mydb > db.dump        #Dump a database to a custom format archive file
$ pg_dump -Fd mydb -f dumpdir       #Dump a database to a directory format archive
$ pg_dump -Fd mydb -j 5 -f dumpdir  #Dump a database into a directory format archive using 5 parallel worker tasks
$ pg_dump -t mytab mydb > db.sql    #To dump a table named mytab

# To dump all tables in the destroy mode with names starting with emp, exclude those named employee_ Table of logs
$ pg_dump -t 'detroit.emp*' -T detroit.employee_log mydb > db.sql

#To dump all patterns with names starting with east or west and ending with gsm, exclude any patterns with names containing the word test
$ pg_dump -n 'east*gsm' -n 'west*gsm' -N '*test*' mydb > db.sql

#To dump, except for the name with ts_ All database objects except for the table at the beginning
$ pg_dump -T 'ts_*' mydb > db.sql
```
pg_dump example 2:
Data backup is more important than anything else, and backup execution should be checked on a daily basis, and backup validity should be checked to ensure that backups can secure data, and backup security encryption should be taken into account.
To dump a databasemydb to a SQL script file:

```
pg_dump mydb > db.sql
```
To dump a database to a custom format archive file:

```
pg_dump -Fc mydb > db.dump
```

To dump a database to a directory format archive with 5 parallel worker tasks:

```
pg_dump -Fd mydb -j 5 -f dumpdir
```
To dump a table namedmytab:

```
pg_dump -t mytab mydb > db.sql
```
To dump all tables in the detroitschema starting with the empname, excluding tables namedemployee_log:

```
pg_dump -t 'detroit.emp*' -T detroit.employee_log mydb > db.sql
```
To dump all schemas whose names begin with eastor westand end withgsm, excluding any schema whose name contains the wordtest:

```
pg_dump -n 'east*gsm' -n 'west*gsm' -N '*test*' mydb > db.sql
```
Writing Instagram Captions
Published: 2023-08-18 06:04:35

Today, [captions](https://blog.hubspot.com/marketing/instagram-captions) are a powerful tool for conveying your message, sparking engagement, and building your brand identity. Whether you're a social media maven or just starting your Instagram journey, learning the art of editing Instagram captions to perfection is what you need.

Instagram captions have a character limit, so brevity is key. Craft your caption using concise language that delivers value to your audience. Cut out any unnecessary words or phrases that don't contribute to the overall message.

Your [caption](https://longcaption.com/what-is-a-caption-and-how-to-add-captions-to-a-video/) and visual content should complement each other seamlessly. Make sure the caption reflects the context of the image or video. If the content seems disconnected, consider revising to maintain a cohesive message.

Hashtags increase the discoverability of your content, making it easier for users interested in your niche to find your posts. Research and include relevant hashtags, [instagram story](https://dev.to/brainiacneit/creating-stunning-3d-instagram-story-swipes-with-react-a-step-by-step-tutorial-5938), but avoid overloading your caption with them. A clean, uncluttered caption is more appealing.

Now, let's get down to the nitty-gritty of editing. Read through your caption and check for grammatical errors, spelling mistakes, and punctuation. A well-edited caption shows professionalism and attention to detail.

Readability is crucial for keeping your audience engaged. Break longer captions into shorter paragraphs to avoid overwhelming readers. Use line breaks strategically for better visual appeal.

Allow your [brand's voice](https://everycaptions.com/how-to-use-instagram-captions-to-build-brand-voice/) shine through your caption. Whether it's humor, positivity, or authenticity, infuse emotion that resonates with your audience. A personal touch helps create a genuine connection.
How to Solve Linear Equations with Matrix Inversion
Tags: machinelearning, python, programming, code
Published: 2023-08-18 05:55:14

In this article, we will solve linear equations using inverse matrix using Python and Numpy.

We will solve linear equations using an inverse matrix in two steps. First, we will find the inverse of the matrix and then we will multiply the inverse matrix with the constant matrix.

For this, we will take an example of two linear equations with two variables. we will solve to find the value of x and y.

## What is Linear Equation?

A linear equation is an equation of a straight line. It is a polynomial equation of degree 1. A linear equation can have more than one variable.

## Standard Form of Linear Equation

The standard form of the linear equation is given below.

{% katex %}
ax + by = c
{% endkatex %}

## Example of Linear Equation

{% katex %}
3x + 8y = 5
{% endkatex %}
{% katex %}
4x + 11y = 7
{% endkatex %}

### How to Solve Linear Equations with Matrix Inversion? | Mathematics

```
A = [[3, 8], 
    [4, 11]]

B = [5, 7]

X = ?


X = inverse(A) . B

```

### How to Find Inverse of Matrix? | Python

Here is the Python code to find the value of x and y using an inverse matrix using Python and Numpy.

{% gist https://gist.github.com/codeperfectplus/c0468dd89e8be2b228b1e0f8c352f6c7 file=how-to-solve-linear-equations-with-matrix-inversion.txt %}

First, we will check if the matrix is invertible or not. If the matrix is invertible then we will find the inverse of the matrix and then we will multiply the inverse matrix with the constant matrix to find the value of x and y.

### Driver Code

It’s time to test our code. Here is the driver code to test our code.

```
def test_case():
    A = np.array([[3, 8], [4, 11]])
    B = np.array([5, 7])
    solver = LinearEquationSolver(A, B)
    coff = solver.solve()
    print(coff)

if __name__ == " __main__":
    test_case()

```

## Output

```
[-1. 1.]

```

## Explanation

Here is the explanation of the output.

{% katex %}
x = -1
{% endkatex %}
{% katex %}
y = 1
{% endkatex %}
{% katex %}
3x + 8y = 5
{% endkatex %}
{% katex %}
3(-1) + 8(1) = 5
{% endkatex %}
{% katex %}
-3 + 8 = 5
{% endkatex %}
{% katex %}
5 = 5

---

{% endkatex %}
{% katex %}
4x + 11y = 7
{% endkatex %}
{% katex %}
4(-1) + 11(1) = 7
{% endkatex %}
{% katex %}
-4 + 11 = 7
{% endkatex %}
{% katex %}
7 = 7
{% endkatex %}

## Conclusion

In this article, we learned how to solve linear equations using an inverse matrix. We learned how to find the inverse of the matrix and how to multiply the inverse matrix with the constant matrix to find the value of x and y.
Proper Method for Storing User Data on the Client Side in React for Authentication
Tags: react, client, javascript, beginners
Published: 2023-08-18 05:50:34

I'm developing a React application and need to securely store logged-in user information on the client side for authentication purposes. I'm currently exploring options such as localStorage, sessionStorage, and state management libraries like Redux. My concern is to ensure data privacy and security while maintaining efficient performance. I'm seeking guidance on the recommended approach to handle this situation effectively within the React ecosystem. Are there any industry best practices or established patterns for managing user data on the client side? Thank you for your insights and advice!
Unveiling Lesser-Known Tricks for Developers
Tags: javascript, development, beginners
Published: 2023-08-18 05:19:12


JavaScript is the powerhouse of modern web development, allowing developers to create dynamic and interactive web applications. While many developers are familiar with the basics, there are plenty of lesser-known tricks that can enhance your productivity and make your code more elegant. In this blog post, we'll dive into some clever JavaScript tricks that can help you level up your skills and become a more efficient developer.

**1. Destructuring Magic:**

Destructuring is a powerful feature that allows you to extract values from arrays or objects and assign them to variables in a concise and efficient manner. But did you know you can use it to swap variables' values without using a temporary variable? Just one line of code can save you some keystrokes and improve your code readability.

```
let a = 5;
let b = 10;

[a, b] = [b, a]; // Swap the values of a and b
```

**2. Default Parameter Values:**

Setting default parameter values for functions can save you from writing extra conditional statements to handle missing arguments. This trick is especially handy when you're dealing with optional parameters or need to ensure your function doesn't break if certain arguments are omitted.

```
function greet(name = "Guest") {
  console.log(`Hello, ${name}!`);
}
```


**3. Short-Circuiting with Logical Operators:**

You can use logical operators to perform concise conditional checks and assignments. The || operator returns the first truthy value, while the && operator returns the first falsy value or the last value if all are truthy. This can be helpful for assigning default values or executing functions conditionally.

```
const value = someValue || defaultValue;
const result = condition && doSomething();

```

**4. Spread Syntax for Cloning and Merging:**

The spread syntax (...) is not just for arrays; it works wonders with objects as well. Use it to create a shallow copy of arrays or objects or to merge multiple objects into one. This can make your code more efficient and easier to manage.

```
const originalArray = [1, 2, 3];
const clonedArray = [...originalArray];

const object1 = { foo: "bar" };
const object2 = { baz: "qux" };
const mergedObject = { ...object1, ...object2 };
```


**5. Convenient Object Property Assignment:**

If you have a variable with the same name as the object property you want to assign, you can use the shorthand notation to save typing and make your code cleaner.


```
const name = "John";
const age = 30;

const person = { name, age }; // Equivalent to { name: name, age: age }
```

**Conclusion:**

JavaScript is full of hidden gems that can streamline your development process and make your code more concise and expressive. By incorporating these lesser-known tricks into your toolkit, you'll be well-equipped to tackle complex challenges and write more elegant and efficient code. So go ahead and experiment with these tricks in your next project on dev.to, and watch your JavaScript skills soar to new heights. Happy coding!

#
Geeks For Geeks - Problem of the Day | POTD | 18 Aug
Published: 2023-08-18 05:14:20


## [Leaders in an array](https://practice.geeksforgeeks.org/problems/leaders-in-an-array-1587115620/1)
Given an array A of positive integers. Your task is to find the leaders in the array. An element of array is leader if it is greater than or equal to all the elements to its right side. The rightmost element is always a leader.
**Example 1:**

> **Input:** n = 6 A[] = {16,17,4,3,5,2}
> **Output:** 17 5 2 **Explanation:** The first leader is 17  as it is greater than all the elements to its right.  Similarly, the next 
> leader is 5. The right most element  is always a leader so it is also 
> included.

**Example 2:**
> 
> **Input:** n = 5 A[] = {1,2,3,4,0}
> **Output:** 4 0  
> **Explanation:** 0 is the rightmost element   and 4 is the only element which is greater   than all the elements to its right.

**Your Task:**  
You don't need to read input or print anything. The task is to complete the function **leader**() which takes array A and n as input parameters and returns an array of leaders in order of their appearance.

**Expected Time Complexity:** O(n)  
**Expected Auxiliary Space:** O(n)

**Constraints:**  
1 <= n <= 107  
0 <= Ai <= 107
[Link to the Question](https://practice.geeksforgeeks.org/problems/leaders-in-an-array-1587115620/1)
## Solution
## Approach:

The idea is last element is always going to be the Leader(as there is no element on it's right) and if we can find an element greator than it on left than it's also leader.In this way we get the leader's in reverse;

## Algorithm:

-   intialize a vector/array with the last elemtent of the array
-   maintain a variable of last Leader
-   traverse the array in reverse and if an element greator than the last leader is encountered update last leader and push it to the resulting vector/array
-   Doing so we get the leader array in reverse so simply reverse the array and return it.

**Time Complexity: time to traverse + time to reverse = O(N) + O(N/2) = O(N);**

**Space Complexity: O(N) as all element can be leader in worst case of array being sorted in reverse order.**

## c++ code:

```
 vector<int> leaders(int a[], int n){
        // Code here
        vector<int> res = {a[n-1]};
        
        int crL = a[n-1];
        
        for(int i = n-2;i>=0;i--){
            if(crL<=a[i]){
                crL = a[i];
                res.push_back(crL);
            }
           
        }
        
       reverse(res.begin(),res.end());
        return res;
        
    }
```
Why are you testing?
Tags: qa, testing, automation, softwareengineering
Published: 2023-08-18 04:55:32

You might already have some quick answers in mind for this question. I totally get it — I do too.

I'm not here to talk you out of testing or the usual testing processes. I just want to nudge you to think about why you're testing in the first place. Figuring out and questioning the "why" can really steer you towards the right testing methods and tools.

Here are a few questions you need to ask yourself.

---

## Your project

- What's the baseline quality that's expected for a project like yours?
- Is uniform quality necessary across all interactions? For example, consider the user experience of your sign-up process. Is it worthwhile to channel efforts into refining that experience rather than testing a section that only a few users might visit?

---

## Your audience

If you are building something which has yet to see the light of the day. Would you rather have it

- Launch early but in a rough shape but risk a lukewarm reception from initial users?
- Launch it later in a polished state but risk finding out that no one's interested?
- Which user paths will be the most traveled? Consider interactions like visits to the settings page, are they frequent?

---

## Your team

- How big is your team?
- Is everyone aligned on what the goal is?
- What skill set and experience does your team possess?
- What budget are you operating under? How long can you afford to develop before you need to generate revenue.

---

Considering the context that you are in will help you truly answer the question of "Why are you testing?".

Testing is not a one-size-fits-all approach. It requires thoughtful consideration of your audience, team, and project context. 

By asking these questions and reflecting on your unique circumstances, you can shape your testing strategy to deliver a project that truly meets the needs of your users.