teleren/devto huggingface dataset:
Corrigir no Docker: Got permission denied issue 🐳
Tags: docker, ubuntu, linux, beginners
Published: 2022-06-06 15:19:23

Hoje o artigo será bem curto, o que falaremos hoje é como resolver o seguinte erro:
```
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.26/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See docker run --help.
```
É provável que você obteve este erro quando tentou executar o comando `docker-compose up` é a uma solução bem simples para esse problema, basta digitar `sudo` antes de qualquer comando docker. Por exemplo:
```
sudo docker ps -a
```

![Wow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zlhg4wxjf09bqf2q6iyh.gif)

### Adicione seu usuário ao grupo do Docker
Entretanto, é chato ficar digitando sudo a todo comando Docker e sabemos que não é recomendável executar nenhum comando com privilégios sudo no ambiente de produção. Então pensando nisso, vamos adicionar o seu usuário ao grupo do Docker com o seguinte comando:
```
sudo usermod -aG docker $USER
```

Com isso, o seu usuário já está adicionado ao grupo do Docker, então o próximo passo será fazer algumas das opções abaixo:
1. Fazer login novamente;
2. Reiniciar sua maquina;
3. Ou executar o seguinte comando:
```
exec su -l $USER
```
Se testamos agora o comando `docker ps -a` veremos que vai ser listado no terminal os contêineres disponíveis localmente sem a necessidade de utilizar o sudo.

## Me acompanhe no meu...

Website: [carlosalves.vercel.app](https://carlosalves.vercel.app/)
Gitub: [@EuCarlos](https://github.com/EuCarlos)
Dribbble: [@EuCarlos](https://dribbble.com/eucarlos)
LinkedIn: [linkedin.com/in/josecarlos98](https://www.linkedin.com/in/josecarlos98)
Sim Sài Gòn - Địa chỉ Mua Sim Số Đẹp Giá Rẻ Uy Tín số 1Sim Sài Gòn - Địa chỉ Mua Sim Số Đẹp Giá Rẻ Uy Tín số 1
Tags: simsaigonvn, simsaigon, simsodepgiare, simsodep
Published: 2022-06-06 15:11:11

Sim Sài Gòn - Bán Sim Số Đẹp Viettel, Mobi, Vina giá rẻ nhất Tp.HCM. Mua Sim Số Đẹp Online chính chủ uy tín tại Simsaigon.vn, giao Sim Đẹp miễn phí toàn quốc.
Liên hệ thông tin:
Địa chỉ: 423 Lạc Long Quân, Phường 5, Quận 11, Thành phố Hồ Chí Minh
Điện thoại: 18008092
Email: cskh@simsaigon.vn
Bản đồ: [https://goo.gl/maps/aL7o9ApHz1FoDeWE7](https://goo.gl/maps/aL7o9ApHz1FoDeWE7)
Facebook:  [https://www.facebook.com/simsaigondotvn](https://www.facebook.com/simsaigondotvn)
Các MXH Sim Sài Gòn tham gia:
Twitter: [https://twitter.com/simsaigon](https://twitter.com/simsaigon)
Pinterest: [https://www.pinterest.com/simsaigon/](https://www.pinterest.com/simsaigon/)
About.me: [https://about.me/simsaigon/](https://about.me/simsaigon/)
Study over Joins in sql and nosql databases.
Tags: webdev, node, database, computerscience
Published: 2022-06-06 15:02:37

## what are joins actually?
lets discuss that first.
As of now, we all know that in SQL databases  if there are two tables with a common entity we can perform an algorithm in order to merge both the tables, and as a result we get a new table that consists of the common entities and with some constraints for ex:-(left join, right join,self join) we can preserve the whole data of a table that we choose.
a very typical SQL query for a join is given below
```
SELECT book.title, publisher.name
FROM book
LEFT JOIN book.publisher_id ON publisher. id;

```
**WHY SQL DATABASES PERFORM JOINS**
The reason that SQL databases perform joins is that they form relations between them i.e. they are also called Relational databases. Also, SQL databases use a diagrammatical representation of relationships between entities that are also called E-R DIAGRAMS.


**NO SQL databases**
**A brief Introduction to NoSQL databases**
these types of DBS (such as MongoDB,dynamodb, NEO4j, etc) are very useful to build modern-day applications where we are not sure that the data coming from the client-side will always be consistent or not some of the cases where we can use NoSQL DBS are:-

1. Fraud detection and identity authentication.

2. iot based systems

and also there are many more cases where we can use NoSQL DBS

> How does NoSQL DBS store data and how it's different from SQL DBS?

- As we know that SQL databases use a table-like structure as discussed earlier in the article 

- but when it comes to NoSQL DBS the data is stored in the form of key-value pairs (collections )
something of the sort that is given below:-
```
{
  "_id": ObjectID("45b83bda421238c76f5c1969"),
  "name": "virat",
  "email: "virat@kohli.com",
  "country": "india",
 
}
```

Also, NoSQL DBS are also called non-relational databases which means our DBS (entities inside them cannot have relations ) since no relations means that we cant perform join operations(Algorithms).

- unfortunately, it is not possible to perform a Join into a NoSQL database. This is one of the biggest differences between SQL and NoSQL DBS.
Removing Minimum Number of Magic Beans
Tags: leetcode, dsa, theabbie
Published: 2022-06-06 15:00:48

You are given an array of **positive** integers `beans`, where each integer represents the number of magic beans found in a particular magic bag.

**Remove** any number of beans (**possibly none**) from each bag such that the number of beans in each remaining **non-empty** bag (still containing **at least one** bean) is **equal**. Once a bean has been removed from a bag, you are **not** allowed to return it to any of the bags.

Return _the **minimum** number of magic beans that you have to remove_.

**Example 1:**

**Input:** beans = \[4,**1**,6,5\]
**Output:** 4
**Explanation:** 
- We remove 1 bean from the bag with only 1 bean.
  This results in the remaining bags: \[4,**0**,6,5\]
- Then we remove 2 beans from the bag with 6 beans.
  This results in the remaining bags: \[4,0,**4**,5\]
- Then we remove 1 bean from the bag with 5 beans.
  This results in the remaining bags: \[4,0,4,**4**\]
We removed a total of 1 + 2 + 1 = 4 beans to make the remaining non-empty bags have an equal number of beans.
There are no other solutions that remove 4 beans or fewer.

**Example 2:**

**Input:** beans = \[**2**,10,**3**,**2**\]
**Output:** 7
**Explanation:**
- We remove 2 beans from one of the bags with 2 beans.
  This results in the remaining bags: \[**0**,10,3,2\]
- Then we remove 2 beans from the other bag with 2 beans.
  This results in the remaining bags: \[0,10,3,**0**\]
- Then we remove 3 beans from the bag with 3 beans. 
  This results in the remaining bags: \[0,10,**0**,0\]
We removed a total of 2 + 2 + 3 = 7 beans to make the remaining non-empty bags have an equal number of beans.
There are no other solutions that removes 7 beans or fewer.

**Constraints:**

*   `1 <= beans.length <= 105`
*   `1 <= beans[i] <= 105`

**SOLUTION:**

    class Solution:
        def minimumRemoval(self, beans: List[int]) -> int:
            n = len(beans)
            beans.sort()
            total = sum(beans)
            cost = total
            for i in range(n):
                currcost = total - (n - i) * beans[i]
                cost = min(cost, currcost)
            return cost
What is create react app?
Tags: javascript, react, beginners
Published: 2022-06-06 14:58:05

hai guys, this is my first post in dev.to and i will talk about what is create react app?

anyway, when i learn about react library for making a website, i was very confuse about what is create react app? is it just a react library tools or it's a standard to create web app using react?

after i search and talk to my friends, i got the answer. create react app is a tool for make website using react much easier. it means, you didn't have to make the configuration like file, component, css and etc. the next question, is it another tool for making react web app? yes, i just find in community that tools called vite. vite is same with create react app, vite and create react app using webpack for bundling your react web app file (css, js and etc). 

first thing when you want make react app, make sure you have node js in your environment. you can check this [node](https://nodejs.org/en/) website for install.

after that, you can choose tool for make react app (create react app or vite)

how you initialize react using create react app.
`npx create-react-app your-app-name`

if you want to use vite, you can run this command.
`yarn create vite`
after you run this command, you have to fill project name, and choose what library/framework you want to use it.

so that all from me, feel free if you want discuss about it and thank you :)
Cpp Square Root Calculator
Tags: calculator, squareroot, cpp, programming
Published: 2022-06-06 14:52:20

I like making calculators so I made one for square root. This uses the cmath package 

[Link](https://replit.com/@Analyze185/Square-root?v=1)


```
#include <cmath>
#include <iostream>
using namespace std;

int main() {
  string session = "y";

  while (session == "y") {
    int num = 0;
    cout << "What would you like to find the quare root of?\n";
    cin >> num;
    cout << sqrt(num) << "\nWould you like to continue session [y/n]?\n";
    cin >> session;
    cout << "\x1B[2J\x1B[H";
  } // end of session
  cout << "\x1B[2J\x1B[H";
  cout << "Ended session\n";
  return 1;
} // end of code
```
Sort Array by Increasing Frequency
Tags: leetcode, dsa, theabbie
Published: 2022-06-06 14:30:42

Given an array of integers `nums`, sort the array in **increasing** order based on the frequency of the values. If multiple values have the same frequency, sort them in **decreasing** order.

Return the _sorted array_.

**Example 1:**

**Input:** nums = \[1,1,2,2,2,3\]
**Output:** \[3,1,1,2,2,2\]
**Explanation:** '3' has a frequency of 1, '1' has a frequency of 2, and '2' has a frequency of 3.

**Example 2:**

**Input:** nums = \[2,3,1,3,2\]
**Output:** \[1,3,3,2,2\]
**Explanation:** '2' and '3' both have a frequency of 2, so they are sorted in decreasing order.

**Example 3:**

**Input:** nums = \[-1,1,-6,4,5,-6,1,4,1\]
**Output:** \[5,-1,4,4,-6,-6,1,1,1\]

**Constraints:**

*   `1 <= nums.length <= 100`
*   `-100 <= nums[i] <= 100`

**SOLUTION:**

    from collections import Counter
    
    class Solution:
        def frequencySort(self, nums: List[int]) -> List[int]:
            ctr = Counter(nums)
            return sorted(nums, key = lambda x: (ctr[x], -x))
Python Daily Exercise 5: Generate new list by removing unwanted object
Tags: beginners, python
Published: 2022-06-06 14:30:11

## Question
**Given**:
```python
str_list = ["Emma", "Jon", "", "Kelly", None, "Eric", ""]
```
**Expected Output**:
```
Original list of sting
['Emma', 'Jon', '', 'Kelly', None, 'Eric', '']

After removing empty strings
['Emma', 'Jon', 'Kelly', 'Eric']
```
## My solution
I don't have any clue at first, so I look at the hint and it tell me to use filter() function, or use the for loop and if condition to remove the empty strings from a list

### I Search and Learn The filter() Function

```python
str_list = ["Emma", "Jon", "", "Kelly", None, "Eric", ""]  
print("Original list of sting")

filtered_list = list(filter(None, str_list))  
print("After removing empty strings")  
print(filtered_list)
```
- filter() function has a syntax of `filter(function, iterable)` and return a iterator, so I cannot just print out the result, need to use a list to include all the element.
- However I feel using list comprehension is faster, easier and more Pythonic than the filter function,

### Or Use List Comprehension

```python
str_list = ["Emma", "Jon", "", "Kelly", None, "Eric", ""]  
new_list = [x for x in str_list if x]  
  
print(new_list)
```

## Other solution
- Using if loop
```python
str_list = ["Emma", "Jon", "", "Kelly", None, "Eric", ""]
res_list = []
for s in str_list:
    # check for non empty string
    if s:
        res_list.append(s)
print(res_list)
```
algo of the loop:
create an new empty
then iterate the old list
check the object's truth is false
(empty string and None are considered False in default)
if the object is True add to new list

## My reflection
- I cannot figure out how to use the if loop at first, as i don't remember the default truth value of an object.

## Credit
- exercise form [Pynative](https://pynative.com/python-string-exercise#h-exercise-14-remove-empty-strings-from-a-list-of-strings)
Music Monday — What are you listening to? (June 6)
Tags: watercooler, discuss, music
Published: 2022-06-06 14:10:41

_cover image credits: [Laurent Hrybyk](https://giphy.com/laurenthrybyk/)_

In this weekly series, folks can chime in and drop links to whatever it is they've been listening to recently + browse others suggestions.

If you like talking about music, consider following the org [#music discussions](https://dev.to/music-discussions) for more conversations about music!

{% embed https://dev.to/music-discussions %}

Also noteworthy, my friend @duxtech has a Spanish speaking version of this series [here](https://dev.to/duxtech/series/17890) in case you'd like to chime in there as well. 🙌

***

So, what have y'all been listening to today? _Note: you can embed a link to your song on most platforms using the following syntax `{% embed https://... %}`._

I look forward to listening to y'all's suggestions! 👂 🎶
Check if There Is a Valid Parentheses String Path
Tags: leetcode, dsa, theabbie
Published: 2022-06-06 14:00:48

A parentheses string is a **non-empty** string consisting only of `'('` and `')'`. It is **valid** if **any** of the following conditions is **true**:

*   It is `()`.
*   It can be written as `AB` (`A` concatenated with `B`), where `A` and `B` are valid parentheses strings.
*   It can be written as `(A)`, where `A` is a valid parentheses string.

You are given an `m x n` matrix of parentheses `grid`. A **valid parentheses string path** in the grid is a path satisfying **all** of the following conditions:

*   The path starts from the upper left cell `(0, 0)`.
*   The path ends at the bottom-right cell `(m - 1, n - 1)`.
*   The path only ever moves **down** or **right**.
*   The resulting parentheses string formed by the path is **valid**.

Return `true` _if there exists a **valid parentheses string path** in the grid._ Otherwise, return `false`.

**Example 1:**

![](https://assets.leetcode.com/uploads/2022/03/15/example1drawio.png)

**Input:** grid = \[\["(","(","("\],\[")","(",")"\],\["(","(",")"\],\["(","(",")"\]\]
**Output:** true
**Explanation:** The above diagram shows two possible paths that form valid parentheses strings.
The first path shown results in the valid parentheses string "()(())".
The second path shown results in the valid parentheses string "((()))".
Note that there may be other valid parentheses string paths.

**Example 2:**

![](https://assets.leetcode.com/uploads/2022/03/15/example2drawio.png)

**Input:** grid = \[\[")",")"\],\["(","("\]\]
**Output:** false
**Explanation:** The two possible paths form the parentheses strings "))(" and ")((". Since neither of them are valid parentheses strings, we return false.

**Constraints:**

*   `m == grid.length`
*   `n == grid[i].length`
*   `1 <= m, n <= 100`
*   `grid[i][j]` is either `'('` or `')'`.

**SOLUTION:**

    from functools import lru_cache
    
    class Solution:
        @lru_cache(maxsize=None)
        def hasPath(self, i, j, m, n, ctr):
            pmap = { '(': 1, ')': -1 }
            if ctr >= 0 and 0 <= i < m and 0 <= j < n:
                curr = self.grid[i][j]
                ctr += pmap[curr]
                if (i, j) == (m - 1, n - 1):
                    return ctr == 0
                if self.hasPath(i + 1, j, m, n, ctr) or self.hasPath(i, j + 1, m, n, ctr):
                    return True
            return False
        
        def hasValidPath(self, grid: List[List[str]]) -> bool:
            m = len(grid)
            n = len(grid[0])
            self.grid = grid
            return self.hasPath(0, 0, m, n, 0)
reactjs can't sent api request from localhost
Published: 2022-06-06 13:50:44

This is my api url: `http://localhost:8000/my-api/` when I am trying to sent get or post request from my fontend reactjs apps, I am getting this error `Access to XMLHttpRequest at 'http://localhost:8000/my-api/' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.`

here is my code:
`const SubmitContact = async (e)=>{
        e.preventDefault()
        const contact = {contact_name:contact_name,contact_email:contact_email,contact_body:contact_body}
        await axios.post("http://localhost:8000/my-api/", JSON.stringify(contact)}`

I also tried to add proxy in my package.json but didn't work. When I used post man for my api testing it's worked but I don't know why it's not working in reactjs.
i18next Crash Course | the JavaScript i18n framework
Published: 2022-06-06 13:48:00

i18next is one of the most used "i18n" JavaScript frameworks.
In this video, we will check out the basic features of i18next and internationalize a React.js app.

Published also here: https://youtu.be/SA_9i4TtxLQ

Code:
https://github.com/i18next/i18next
https://github.com/i18next/react-i18next

Website & Docs:
https://www.i18next.com
https://react.i18next.com

Articles:
React.js: https://dev.to/adrai/how-to-properly-internationalize-a-react-application-using-i18next-3hdb
Node.js: https://dev.to/adrai/how-does-server-side-internationalization-i18n-look-like-5f4c
Deno: https://dev.to/adrai/internationalization-i18n-for-deno-with-i18next-3e0l
Next.js: https://dev.to/adrai/all-side-optimized-nextjs-translations-4n9i
Remix: https://dev.to/adrai/how-to-internationalize-a-remix-application-part-2-glf
Gatsby: https://dev.to/adrai/best-internationalization-for-gatsby-mkf
Vue.js: https://dev.to/adrai/how-to-properly-internationalize-a-vue-application-using-i18next-1doj
jQuery: https://dev.to/adrai/the-progressive-guide-to-jquery-internationalization-i18n-using-i18next-3dc3
Angular: https://dev.to/adrai/unleash-the-full-power-of-angular-i18next-4b7o
Were you ever fired as a junior developer?
Tags: anonymous, discuss, help, career
Published: 2022-06-06 13:47:45

_This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment or if you want to ask your own anonymous question._ 

***

I'm really curious to see if the DEV Community has any stories of being fired as a junior developer. How would something like that happen - what were the extraneous circumstances around it? What were (if any) the lasting career impacts from being fired as a junior dev?
👉 REST API vs GRAPHQL , which one is better? 🤔
Tags: javascript, webdev, restapi, graphql
Published: 2022-06-06 13:47:23

🙋‍♂️ Hi guys , I always had a small doubt when I heard there are more than one API, I heard about GRAPHQL, and REST, so I got a doubt that which one should I use and which one is better to use.

👉In this post, I would like to give a brief on which is the best, I know only REST API, but not GRAPHQL, so I am using some reference materials for completing this post.



**👉 REST API vs GRAPHQL**

Let me start with which one is the best

✍️ GraphQL is the better than REST 

**👨‍💻 The main difference between GRAPHQL and REST**

👉 A REST API is an architectural concept for network-based software. GraphQL, on the other hand, is a query language, a specification, and a set of tools that operates over a single endpoint using HTTP

**👨‍💻 Where GraphQL is better than REST API**

👉 When using a REST API to fetch information, you’ll always get back a complete dataset. For example, if you wanted to request information from two objects, you’d need to perform two REST API requests.

Lets say you need initial user data, and you need to fetch it from `/users/:userID`, and secondly you need posts data for that user, so another end point may be. `/users/:userID/posts`.



So when the end point is REST API. It would take two HTTP GET requests. They are (I am using json data in this example)
```
/users/:userID


{

         “user”:{

             “id”:”user1”,

             “firstName”:”rohan”,

              “lastName”:”devaki”

         }

}
```
And one more request for posts of `userID` with end point `/users/:userID/posts`
```

 {

     “posts”: [{

         “id” :”post1”,

         “title”: “REST_vs_GRAPHQL”,

         “content”:”graphql is better than REST”

      }]

}
```


In GRAPHQL, on the other hand, you need to simply send a query to the GRAPHQL server that includes the data requirements. Then the server responds with the JSON object where the requirements are fulfilled
```
Query{

  User(id:”user1”){

      Name

      Posts{

           Title     

      }

}
```


👉 So by this we can understand that the GRAPHQL is powerful, flexible and efficient , where as REST is not that much flexible and inefficient.

👉 GRAPHQL also fetches the data , that is actually required in the query. But REST in the other hand, it fetches all the data that is not even required.

     👨‍💻  as in the above example you can see REST fetched, all of the user and the post details, where as GRAPHQL only fetched the user’s name and the post’s title.

Don’t just read it ,and get the knowledge, like and share so that others also get the knowledge 😃.

you are welcomed to tell the points which are need to be improved in the comments section 😃.

Follow me on [Linkedin ](https://www.linkedin.com/in/rohandevaki/)here , and I will be back with an informative post soon 😃.

Check my next blog here :  [best laptops for students under 65K](https://algorithammer.herokuapp.com/blog/best-laptops-for-students-2021-under-65000-1) 😃
A helper to generate the READE file automatically from YAML-based metadata files.
Tags: readme, github
Published: 2022-06-06 13:43:17

This is an open-source to help maintainers to generate the README file automatically from YAML-based metedata files.

Especially, it's helpful when you try to maintain a big table in a Markdown file. The biggest problem is that too many people filing PRs to update it could cause conflicts.

Feel free to leave your comments on an issue or PR.

https://github.com/LinuxSuRen/yaml-readme
New Web App Launch - WordSearch360.com
Tags: webdev, nextjs, javascript, gamedev
Published: 2022-06-06 13:31:30

👋 Hi there,

I'm Aris, just finished my hobby project [wordsearch360.com](https://wordsearch360.com) it's a game and tool, you can play word search puzzles or build your own and save as printable image
feel free to give a feedback or feature request if you may 😁

Thank you