teleren/devto huggingface dataset:
The Python 3.1 problem
Tags: yaml, python, testing, ci
Published: 2021-05-19 14:08:31

## Or, a variation on the Norway problem

Short version: put quotes around version numbers in YAML.

### The Norway problem

The [Norway problem](https://hitchdev.com/strictyaml/why/implicit-typing-removed/) is when you put this in YAML:

```yaml
countries:
  - GB
  - IE
  - FR
  - DE
  - NO
```

But get this out:

```python
>>> import yaml
>>> with open("countries.yml") as f:
...     yaml.safe_load(f)
...
{'countries': ['GB', 'IE', 'FR', 'DE', False]}
```

:scream:

### The Norway fix

Use quotes:

```yaml
countries:
  - "GB"
  - "IE"
  - "FR"
  - "DE"
  - "NO"
```

```python
>>> with open("countries.yml") as f:
...     yaml.safe_load(f)
...
{'countries': ['GB', 'IE', 'FR', 'DE', 'NO']}
```

🇳🇴 ✅

### The Python 3.1 problem

A similar problem will affect the Python community in October 2021, when [Python 3.10 comes out](https://www.python.org/dev/peps/pep-0619/).

Why?

When `3.10` is added to YAML, for example in CI test matrix config, it's interpreted as a float. This:

```yaml
python-version: [
    3.6,
    3.7,
    3.8,
    3.9,
    3.10,
    pypy3,
]
```

Turns into this:

```python
>>> import yaml
>>> with open("versions.yml") as f:
...     yaml.safe_load(f)
...
{'python-version': [3.6, 3.7, 3.8, 3.9, 3.1, 'pypy3']}
```

CI failed! It's not [2009](https://www.python.org/dev/peps/pep-0375/)! Python 3.1 not found!

:scream:

Relatedly, `3.10-dev` without quotes works because it's interpreted as a string. But when deleting `-dev`, `3.10` is interpreted as a float.

### The Python 3.10 fix

Version numbers are strings, not floats. Use quotes:

```yaml
python-version: [
    "3.6",
    "3.7",
    "3.8",
    "3.9",
    "3.10",
    "pypy3",
]
```

```python
>>> import yaml
>>> with open("versions.yml") as f:
...     yaml.safe_load(f)
...
{'python-version': ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy3']}
```

🐍 ✅

### See also

[flake8-2020](https://github.com/asottile/flake8-2020/) is a useful Flake8 plugin to find Python 3.10 and other bugs caused by assumptions about the length of version numbers when using `sys.version` and `sys.version_info`.

---

<small>Header photo: "<a target="_blank" rel="noopener noreferrer" href="https://www.flickr.com/photos/49968232@N00/2115403318">zero</a>" by <a target="_blank" rel="noopener noreferrer" href="https://www.flickr.com/photos/49968232@N00">Leo Reynolds</a> is licensed under <a target="_blank" rel="noopener noreferrer" href="https://creativecommons.org/licenses/by-nc-sa/2.0/?ref=openverse">CC BY-NC-SA 2.0</a>.</small>
Convert binary to decimal
Tags: javascript, tutorial, programming
Published: 2021-05-19 13:59:04

I have just worked on a project where I had to create a binary to decimal converter. For the same project, I developed other binary, hex, and octal conversion tools. For my machine learning project, I developed a binary to decimal converter. My client insisted to develop such to enhance security for the project.

Honestly, considering recent security threats, it is really important to enhance security for an app.

When I came to know about developing this binary to decimal converter, I had no idea who I would do that because I had very little knowledge about this number conversion system. I spent one full day learning about it. For that reason, I thought, sharing code for such conversion can be beneficial for the developer who may work on such a project in the future.

About binary and decimal numbers:

Binary numbers are written in just zeros and ones. They are the 2-bit numbers and all the electronic devices and computer processors can understand binary numbers only. For the last several years, binary numbers have been used by almost all devices.

Decimal numbers are the base-10 numbers. It contains 0 to 9 numbers. After binary numbers, decimals are the most used numbering system right now. Most machine learning, artificial intelligence products, and IoT products use this numbering system.

Why did I need to develop a binary to the decimal converter?

As decimal numbers are represented in 0 to 9 and binary contain zeros and ones. Decimal numbers can easily be read and understood by humans while it is pretty difficult to read the convert binary numbers. For that reason, my client wanted me to develop such a tool.

Javascript code to convert binary to decimal:

```Javascript
function bintodec() {
    var input = document.getElementById("text_value").value;
        var cc = new BigNumber(input, 2);
        
document.getElementById("ans").innerHTML = cc;
       }
```

And done! Copy and paste the above code to convert [binary to decimal](https://binarytotext.net/binary-to-decimal/). In this code, I used the Bigumber.js javascript library. If you are dealing with such big numbers, then you need to use Bignumber.js otherwise you might get an error while getting the answer.
So, this is the technique I used to convert binary to decimal. If you have used any other technique for such conversion, then do let me know by dropping a comment. I would love to hear from you.
Find how many alphabet are there in a string 
Tags: javascript
Published: 2021-05-19 13:41:36

Hi😀! This is my first post in the community🖐. While talking the JavaScript course from freeCodeCamp.org🔥, this simple question struct my if I can calculate the number of alphabet in a string.
I have used Regular Expression to analyze the string. Also used Recursive🔥🔥🔥 function to check I the same alphabet occurs multiple times.
#### 👉👉Here's the code:
````
const noa=(string)=> {
let quoteSample = !(string==null ||string==undefined)?string.toLowerCase():"";
let alphabetRegex = /[a-z]/gi;
let result = quoteSample.match(alphabetRegex);
if(result==null||result==undefined){
   console.log("number of Alphabate is 0")
  return 0
}
result= result.sort();
function diet(){
  for(let i=0; i<result.length;i++){
    if(result[i]==result[i+1]){
      result.splice(i,1)
      diet();
    }
  }
}
diet();
return result.length;
}
````
Please let me know your thoughts on How I can optimize this.🙏🙏🙏
Having problem targeting the text inside li
Published: 2021-05-19 13:38:25

I am having a problem to find a selector for the text inside my "li" to target with JavaScript. The problem is that I have a nested "span" element with two icons in my "li". That gives me a problem just to "li" to target it, since, it also covers the "span" with icons. What I am trying to do is add {text-decoration: 'line-through'} when the 'check' icon is clicked. and remove the text, when 'trash'icon is clicked. As I said, my problem is targeting the text within the "li" .
Best Practice React.js project For Beginners
Tags: react, beginners, programming, devops
Published: 2021-05-19 13:31:21

Aiming to master front-end frameworks? Start learning ReactJS diligently and look forward to a great career in programming. The best way to polish your skill is to  start building Practice <a href="https://codersera.com/blog/reactjs-projects-for-beginners/">React.js  project For Beginners</a> and get hands-on with ReactJS.

By now you must be clear on requirements for building React apps. Let’s start React Learning Path about a few of the best ReactJS projects for beginners list-

1. E-Commerce Apps
2. Calculator
3. Weather App
4. Messaging App
5. Simple CRM
6. Social Media App
I used the SPREAD OPERATOR for the first time 🤯🤯
Tags: javascript, beginners, webdev
Published: 2021-05-19 13:30:00

## What is a spread operator?
The spread operator is used when all elements of an iterable variable such as an object or an array needs to be included in some sort of a list. This has a lot of use cases, below is a basic description of what using the spread operator looks like:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/588fa9wcepzy62w4afrb.png)

I was recently consuming API endpoints and I came across an endpoint whose response is an array of arrays and each array item contains several objects which I needed to get. First instance was to do a forEach() to loop through each arrays. Then I proceeded to do another forEach() to get to the individual objects of each of the arrays. All was going fine until I decided to render those items to the DOM and it turns out only the last array of objects was getting rendered. This was a point of confusion because everything seems to be working fine. After a lot of trying to figure things out, I decided to use a spread operator after the first forEach loop to push each item in each of the arrays to an empty array. This makes it that all objects are in a single array
![spread in action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/byhnkgvbz23tr1rej60j.png)
Remover todos os Containers Docker 
Tags: docker
Published: 2021-05-19 13:04:39

---
title: Remover todos os Containers Docker 
published: true
description: Remover todos os containers docker
tags: #docker
//cover_image: https://direct_url_to_image.jpg
---
Parar e remover todos os containers, volumes e imagens do Docker

Parar todos os containers

    docker stop $(docker ps -aq)

Remover todos os containers

    docker rm $(docker ps -aq)

Remover todos os volumes

    docker volume rm $(docker volume ls -qf dangling=true)

Comandos menos utilizados:

Remover todas as imagens

    docker volume rm $(docker volume ls -qf dangling=true)
💳 What Is Credential Stuffing? How To Prevent Credential Stuffing Attacks
Tags: security
Published: 2021-05-19 13:02:15

#### 💻 Credential stuffing is one of the most common types of cyberattacks. Here’s how to prevent credential stuffing.

### <br>
Credential stuffing is a type of cyberattack in which a cybercriminal uses stolen usernames and passwords from one organization (obtained in a breach or purchased off of the dark web) to access user accounts at another organization.

Credential stuffing attacks are one of the[ most common causes of data breaches](https://enterprise.verizon.com/resources/reports/dbir/) because[ 65% of all people](https://services.google.com/fh/files/blogs/google_security_infographic.pdf) reuse the same password on multiple (and sometimes all) accounts. In fact, on Auth0's platform alone,[ nearly half of all login requests](https://assets.ctfassets.net/2ntc334xpx65/1xz31vn3dwydWcTZPhQGR9/888791a06e356901cacdc9db98ba8ab8/Credential-stuffing-whitepaper.pdf) we receive each day are attempts at credential stuffing.

The opportunity for cybercriminals to use credential stuffing is[ only growing](https://www.computerweekly.com/news/252485713/Over-15-billion-credentials-for-sale-on-dark-web) as more credentials are exposed through breaches; at present, literally billions of compromised credentials are circulating on the dark web. 

However, credential stuffing attacks are preventable if you implement the right cybersecurity measures. Below is what executives need to know about credential stuffing attacks and what can be done to reduce or prevent the likelihood that their organizations will be a victim of one.

* **More in our [credential stuffing whitepaper](https://auth0.com/resources/whitepapers/credential-stuffing-attacks)**
* **[What is broken authentication](https://auth0.com/blog/what-is-broken-authentication/)**

## How Credential Stuffing Works?

[Read more...](https://auth0.com/blog/what-is-credential-stuffing/?utm_source=content_synd&utm_medium=sc&utm_campaign=security)
Create your own blazing fast mock server with just a JSON file!
Tags: go, webdev, showdev
Published: 2021-05-19 12:43:36

TLDR; https://github.com/Ananto30/mocker

The idea is really simple. Just create high-performing 🚀 mock servers using a json file that maps path to status code and response body.

This can be used to benchmark your microservices, that are dependant on other HTTP services.

This is a sample mock file - 
```json
{
  "/hello/worlds": {
    "statusCode": 200,
    "responseBody": {
      "message": "Hello worlds!",
      "data" : {
        "time": "now"
      },
      "worlds": [
        "cross origin world",
        "mars world",
        "moon world"
      ]
    }
  }
}
```
Then just run - 
```bash
./mocker -addr <YOUR_HOST_AND_PORT> -file <MOCK_JSON_FILE_LOCATION>
```

In windows - 
```powershell
mocker.exe -addr <YOUR_HOST_AND_PORT> -file <MOCK_JSON_FILE_LOCATION>
```

Please report bugs and suggest new features and ideas. 👇
Introduction to Digital Marketing
Published: 2021-05-19 12:20:58

With the developing client base of social media sites and the expanded openness of the Internet, Digital Marketing has become a truly practical method of imparting your item to the overall customer. The best thing about Digital Marketing is that you get a huge load of adaptability and customization choices to augment your marketing productivity, more than any elective technique for marketing. 

Marketing is an outcome based calling. The organizations that recruit advertisers assess a marketing exertion dependent on the quantity of transformations or deals accomplished through marketing channels. Thus, it doesn't make any difference how great your marketing effort looks outwardly, or how great the material is. On the off chance that the objectives aren't being met, the fault will fall on you and your absence of skill. Fortunately, with Digital Marketing, you have the desired apparatuses available to you, with simply a tick of a catch, to decide your intended interest group and the channel of internet marketing that you would need to decide for that specific gathering. 

Considering the way that individuals all throughout the planet genuinely invest a lot of energy on social media, video real time sites, websites, and emails, you are basically getting an ensured client base of dynamic leads or possible clients. 

As examined before, Digital Marketing involves numerous specialized substudies. In this Digital Marketing instructional exercise, we will go investigate subjects like SEO (Search Engine Optimization), SEM (Search Engine Marketing), SMM (Social Media Marketing), email marketing, video marketing, affiliate marketing, and paid marketing. To learn about it you can opt for [Digital Marketing Training](https://intellipaat.com/digital-marketing-course-certification-bangalore/). 

What is the advantage of utilizing digital data? 

Digital Data can help you settle on educated choices and improve online execution. With the expanding infiltration of the web among customers, it is vital to take advantage of this Digital Data, which will help in improved educated dynamic and consequently increment execution.
Delay font loading using Javascript
Tags: webdev, webperf
Published: 2021-05-19 12:20:08

Achieving 100% across the board in Lighthouse can be tricky to do.

![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udb06mz81b39vjx3afva.png)

One of the assets of any web application is fonts. Loading fonts can have an impact on page load times and directly affects Lighthouse scores.

Fonts are often placed in the page `<head>` using a `<link>` tag.

```html
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet"> 
```

Whilst this is the recommended way to load fonts, style sheets loaded in the `<head>` block rendering and impact page load times.

## A simple solution

Whilst Javascript shouldn't be used in place of HTML or CSS, it does offer the ability to create a simple solution that doesn't impact load times and takes one step closer to the 100% Lighthouse score.

The following snippet delays the loading of fonts until the page has loaded. This means that fonts are not available whilst the page is being rendered, they are rendered after page load.

```js
['https://fonts.googleapis.com/css2?family=Roboto&display=swap'].forEach(function (f) {
  const gf = document.createElement('link')
  gf.rel = 'stylesheet'
  gf.href = f
  gf.type = 'text/css'
  const gd = document.getElementsByTagName('link')[0]
  gd.parentNode.insertBefore(gf, gd)
})
```

This snippet of Javascript relies on an existing `<link>` tag to exist in the `<head>` so it can attach the font stylesheet. If you are using Google fonts or other CDN, it is recommended to use a `rel="preconnect"` link tag to tell the browser to establish an early connection with that origin.

```html
<link rel="preconnect" href="https://fonts.gstatic.com">
```

## How to use

Copy the following Javascript into a file named `fonts.mjs` and include URLs to the style sheets you want to load:

```js
['https://fonts.googleapis.com/css2?family=Roboto&display=swap'].forEach(function (f) {
  const gf = document.createElement('link')
  gf.rel = 'stylesheet'
  gf.href = f
  gf.type = 'text/css'
  const gd = document.getElementsByTagName('link')[0]
  gd.parentNode.insertBefore(gf, gd)
})
```

Add a `<script>` tag to your HTML page pointing to the Javascript file:

```html
<script type="module" src="/path/to/fonts.mjs"></script>
```
Web / Tool Engineer - NavInfo Europe - Eindhvoen
Tags: vacancy, engineer
Published: 2021-05-19 12:11:56

Are you looking for a new and exciting opportunity? Are you experienced with Ruby on Rails and MySQL?

NavInfo Europe and Mapscape are looking for a web / tool engineer!

Find the jobdescription here:
https://navinfoeurope.recruitee.com/o/web-tool-engineer
The Vim Editor: 5+ Tips and Tricks for Mastering Vim
Tags: linux, vim, productivity
Published: 2021-05-19 12:09:50

[Vim](https://en.wikipedia.org/wiki/Vim_(text_editor)) (Vi Improved) is a modal text editor. The learning curve is a little steep but it offers many features that can make editing code faster. 

I’ve been using Vim as my primary editor for a few years now and these are some of the tips and tricks to help increase your speed.

Vim can be overwhelming at first. To help you get your feet wet, here are some tips that will improve your productivity and make you faster at editing text. 

## Vim tips

### Quick shortcuts :smile:

Hit escape then to get into command mode, then use one of the following commands:
* `h` - go left on line
* `j` - go down a line
* `k` - go up a line
* `l` - go right on line
* `gg` - go to the beginning of the file
* `gj` - go down a screen
* `gk` - go up a screen
* `G` - go to the end of the file
* `w` - to move forward one word at a time.
* `b` - to move backward one word at a time

You can type text in insert mode, press `i` to open insertion mode.

### Practice exercises

Vim has a steep learning curve, it just works different than other editors but with the benefit of speed. 

If you are new to vim, I recommend these [exercises](https://vim.is)

### Switch case quickly

You can quickly switch case by pressing `~`. Hold the key to repeat the action. Pretty cool feature

### Repeat actions

Vim lets you repeat actions. Pressing `50j` moves down 50 lines, `50k` moves up 50 lines. This works for any command, `5dd` deletes 5 lines. 

## Use vertical screen

Not specifically vim, but it can boost your productivity. Letting you see more lines at once. You can see the different in the image below:

![vim on screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wjdazcjrehhtfup7n7l6.jpg)

### Swap lines

Press the keys `ddp` to swap lines. It swaps the current line with the next one. Easy to switch lines, in case you may need it.

### Quick search for word under cursor

You can search for the word under the cursor. First move to the word you want to search for, then press `*`. You can do this for any word. Pressing `#` searches in reverse order.

### Make a .vimrc

It will help you with plugins and configure the default vim. Use your [.vimrc](https://vim.fandom.com/wiki/Open_vimrc_file) to outline exactly what you want to happen every time you invoke vim.

### Regular search

You can search by pressing `/word`. Then press `n` to search for the next word. Your search can be longer than one word
How to Manage Workload Effectively – Top Tips to Follow for Managers
Published: 2021-05-19 12:09:30


Workload Management
Workload management is essential for meeting deadlines while maintaining the high efficiency of employees. As a systematic process of managing the workflow accurately & project managers distribute work to team members and monitor their work routine.

This monitoring enables managers to utilize the skills of available resources effectively that assists them and identify any loopholes and make adjustments. Though task management software can help you manage workload efficiently & here we share some useful tips that will make your life easier.

As a project manager, you need to ensure that the assigned work has been completed and delivered on time. You should maintain a subtle balance between the number of tasks and the abilities of your team members to accomplish all the assignments on time & maintaining the optimum productivity level. But then, managing all the aspects at once itself is a herculean task & therefore, workload management comes into the picture. 

Poor resource allocation, inaccurate estimation of deadlines, the underperformance of the team & work-related inadequacy at an individual level can create an imbalance in workload management. If you want to implement proper management at the workplace, these aspects need proper attention.

Let’s understand the key factors that contribute to proper workload management.
1. Delegate tasks as per the employee’s skills and overall performance

2. Compare actual workload and estimated workload as per the project

3. Identify processes necessary to be accomplished for ongoing projects

A team task management tool can help you delegate tasks effectively as per the employee’s capabilities, and you can easily identify necessary processes. These factors are important to manage workload systematically. 

Original Source: https://www.taskopad.com/blog/workload-management-tips-for-managers/
Daily Developer Jokes - Wednesday, May 19, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-05-19 12:00:00

---
title: "Daily Developer Jokes - Wednesday, May 19, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Wednesday%2C%20May%2019%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e125999cc4b1.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q___: What are clouds made of?

___A___: Mostly linux servers.
 -->
Dala
Published: 2021-05-19 11:54:44

Engaging in creative work is so challenging at times that if it was not so unbelievably rewarding I doubt anyone would do it. I know I wouldn't. But it is in and of itself rewarding, thank God, and so rewarding in fact that people are generally familiar with the archetype of the 'starving artist'. I find it remarkable; how exceptionally talented individuals can spend most if not all of their time and effort in pursuit of a vision that oftentimes only they can see. 

It is lunacy, yet it is this very lunacy that we owe our modern world to. The creatives (in all fields, not just the arts) tend to be the frontrunners, advancing innovation. This post is an open letter of appreciation to all who create, they that dala what they must: I salute you one and all.
Angular 12 Free Templates
Tags: angular12, admindashboard, templates
Published: 2021-05-19 11:45:49

---
title: Angular 12 Free Templates
published: true
description: Angular 12 Free Templates
tags: angular12, admindashboard, templates
//cover_image: https://direct_url_to_image.jpg
---

Hello guy's here is the link from where we can get Angular 12 free templates. There are following:
[Angular 12 Free Templates](https://therichpost.com/category/angular-templates/)

Thanks