teleren/devto huggingface dataset:
Allow User Registration on Your WordPress
Tags: webdev, beginners, tutorial, wordpress
Published: 2022-02-24 16:07:26

There are many reasons why you should enable user registration in WordPress. For example, if you have a need for guest blogging, allowing your guest bloggers to register to your website and assigning them a Contributor role can really make things more efficient for you. In this way, when they’re done with their post, they can simply submit it for a review and you get to decide what to do with the post from there.

User registration can also be of excellent use in case you want to create certain areas of your website that only registered users can access, or if you want to provide them with an exclusive offer (like limited deals, for example). Finally, allowing users to register to your site can help you a great deal when it comes to your marketing strategy since, this way, you can easily reach all your registered users via email. In other words, you can effectively inform them about any news related to your brand, if you want to promote a new service or product, and so on.

###Enabling WordPress User Registration in the General Settings

Before you can do anything else, you have to allow user registrations at your website first. This setting is actually turned off by default, which is why you need to go to **Settings** >> **General** in your WordPress admin to switch it on. Find the “**Anyone can register**” box next to the “**Membership**” option and mark it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5c4it3omdfpdjg26pu2.jpg)

Then, you should pick the user role that you wish to set as default. Keep in mind that whichever role you pick, it will be automatically assigned to new users that register on your site. Also, make sure to never assign the Administrator role for registered users.

Finally, once you assign your default role to users, you should click on Save Changes for the settings to take effect.

Read More: [How to Allow User Registration on Your WordPress](https://softcodeon.com/wordpress/allow-user-registration-wordpress.htm)
Jayce the Aspiring Adv.  Please help me find partial (0.1) adventurers!!
Published: 2022-02-24 17:00:55

Hello I am somewhat of a beginner programmer and professional bullshitter.  Let's just be honest and get that out the way haha.  I am currently part of a DeFi project that no one can give solid answers on, including the Devs. Would someone be willing to look over this project/contract and help me attempt a calculator or even how derive an answer for the community.  

1 Basics: Jayce the Aspiring Adventurer is an ROI garden contract.  You use gold to hire adventurers by sacrificing your token to the contract.  Your adventuerers then bring you 3% ROI on your sacrafice each day in gold $DEG (ticker).  It currently costs 1470 DEG to purchase an adventurer but no one including the devs knows what happens to any decimals when you "hire" or "compound" your gold.  Some say it counts some say it goes to the contract and you lose it.  The faq says do your own research!  Well as 99.9999999999 arent smart contract programers that leaves a lot to be desired.  I'd love some eyes on this if anyone is bored! Heres the contract and the game website. 

https://bscscan.com/address/0xDe52fDe9F56A121bC46439FFa54008CaEd2759ba#code

https://www.defiempiregames.com/index.html   (main company page)

https://www.jayce.defiempiregames.com/   (game)

Thanks in advance. As stated I'd love to come up with a calculator for this.
Best Flask Tutorials
Tags: python, flask, beginners
Published: 2022-02-24 17:00:10

---
title: Best Flask Tutorials
published: true
description: python
tags: python, flask, beginner, 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rdh5dhl87xa6eqs5oj0u.png
---

In your humble opinion, What are the top 3 Flask tutorials you have used?
Day-31 Training At Ryaz
Tags: javascript, webdev, beginners, node
Published: 2022-02-24 16:59:46

- Date:24/02/2022
- Day:Thursday

Today,I started at about 10:30 pm and as I have started with the cource the complete node js cource so, I was done with 1st module yesterday and today I started with 2nd module and completed it. firstly in starting of second course the instructor started to create node.js file and then he begin with logger file that suggested to create function that displays message that user have logging and after this user have logged in.After this he suggested events like event is that when for eg if user have logged in so, event gets triggered and it display message that is written in console.log('Our Message') and then explained about emitter calsses and explained that we have to create new object of class and then use them. and I have created two files app.js and logger.js files. so, I got to learn many new things and this way my day ended.
How to fetch a contribution branch to test it locally as an open-source maintainer
Tags: git, github, opensource, tutorial
Published: 2022-02-24 16:26:30

Hello Fellow CodeNewbies 👋,

In my [last post](https://dev.to/adiatiayu/git-how-to-pull-a-branch-from-the-upstream-to-the-local-repo-in-5-steps-1ili), we talked about how to fetch a branch from `upstream` repo as a contributor and test it locally.

And in this post, let's change the role.
If we were a repo maintainer, we would want to test the changes locally and see if things work as expected. Otherwise, we can encounter problems when we merge a contribution without trying it.
How can we do so?
I will walk you through the steps below.

## Fetch a contribution branch

### 1. Add a remote repo for the forked repo
  First, we need to add the contributor's forked repo as our remote repo.
  ```bash
  git remote add <remote-name> <fork-repo-url>
  ```
  We can name the `<remote-name>` anything we want. I find it clearer to name this remote with the contributor's name or their GitHub username.
  As an example:
  ```bash
  git remote add ayu <fork-repo-url>
  ```
  Go to the contributor's fork repo on GitHub to copy their repo URL and paste it to replace the `<fork-repo-url>` part.

### 2. Check if the remote repo has been added.

Run this command to check our remote repos.
```bash
git remote -v
```
If the remote repo has been added, we should see:
```bash
origin <original-repo-url> (fetch)
origin <original-repo-url> (push)
ayu <fork-repo-url> (fetch)
ayu <fork-repo-url> (push)
```

### 3. Fetch the forked repo to our local
Run this command to fetch the repo.
```bash
git fetch <remote-name>
```
So, in our case:
```bash
git fetch ayu
``` 
Now the repo contents, including the targeted branch, are fetched.
We will see something like this on our command line:
```text
...
* [new branch]      main           ->  ayu/main
* [new branch]      some-branch    ->  ayu/some-branch
* [new branch]      target-branch  ->  ayu/target-branch
```

But wait. There are two branches there. 
How do we know which branch is pushed by the contributor to the repo?

#### How to find out the pushed branch

1. From the `origin` repo on GitHub, navigate to the `Pull requests` tab.
2. Click on the contributor's pull request.
3. Under the title of the pull request, next to the green "Open" button, we will see:
```text
ayu wants to merge X commits into main from target-branch
```
We know now that the branch that we want to navigate to is the `target-branch`.

### 4. Navigate to the branch

Run this command:
```bash
git checkout <branch-name>
```
In this example, it would be:
```bash
git checkout target-branch
```

We now can test out the changes from the contributor locally 😄.

---

Thank you for reading!
Last but not least, you can find me on [Twitter](https://twitter.com/AdiatiAyu). Let's connect! 😊
New tsParticles Confetti website is now live
Tags: showdev, javascript, typescript, webdev
Published: 2022-02-24 16:23:00

Today the new tsParticles Confetti website was approved by the <js.org> maintainers.

The content of this new website will be more focused on confetti animations, instead of all kind of particles. There are few samples actually, but more will be available in the next days.

If someone wants to be creative helping with the website, any kind of help is welcome and appreciated.

The website is open source like any other tsParticles project and the repository is linked below.

The new website is: <https://confetti.js.org>

{% github matteobruni/confetti %}

Any useful feedback is appreciated, it's something created in few hours. I know it needs more work 😅
SQL - operações matemáticas no SELECT
Tags: sql, beginners, database, datascience
Published: 2022-02-24 16:11:46

Enquanto estudava SQL, tive muita dificuldade de entender algumas operações nas queries, especialmente nas divisões e multiplicações pela singularidade da linguagem SQL em retornar o número inteiro. 
NÃO ENTENDI NADA DE PRIMEIRAAAA! Então vou anotar aqui pra nunca mais esquecer. 

![homem batendo com a mão na cabeça repetidamente](https://media.giphy.com/media/XeLcgh8gT8o0F5SQ8i/giphy.gif)


---

## Operações no SELECT

Há dois tipos de consultas: linha a linha e funções de agregação (por coluna).
A agregação é basicamente um "ETL" direto no SQL. 
 
### Operações básicas

**Soma**
`SELECT  1+2 AS resultado;`
`SELECT 458.99 + 899 + 7.77;`

**Subtração**
`SELECT 233 - (78.99 + 333)`
a operação segue a ordem de resolução, primeiro a operação entre parênteses depois o que está fora 


**DIVISÃO**

`SELECT 50 / 2 AS resultado;`
retorna `25`

mas...

`SELECT 49 / 2 AS resultado; `
retorna `24`
ou seja: apenas o número inteiro

**PARA EXIBIR AS CASAS DECIMAIS**

`SELECT 49.0 / 2 AS resultado;`
retorna `24.500000`

OU também 

`SELECT 49.99 / 2 AS resultado; `
retorna `24.995000`


**MULTIPICAÇÃO**

`SELECT 50*2 AS resultado `
retorna 100

`SELECT 50.88*3 AS resultado`
retorna 152.64

Ou seja: 

#### SEMPRE QUE VOCÊ FIZER A CONTA COM NÚMEROS INTEIROS, RETORNARÁ NÚMEROS INTEIROS. SE VOCÊ FIZER COM DECIMAIS, RETORNARÁ COM DECIMAIS. 

---
### Outras operações 

**POTENCIAÇÃO**

- `SQUARE()` = calcula o quadrado

- `POWER(x,y)`: potenciação: x elevado a y 

**PORCENTAGEM** 

- Ex:(+ 10%)

`SELECT 100 * 1.1 AS resultado
SELECT 100 + (100 * 0.1) AS resultado`
retorna 110.0 

- Ex: (- 10%)

`SELECT 100 * 0.9 AS RESULTADO `
retorna 90.0 

**RAIZ QUADRADA**
`SELECT SQRT (49)`

**PI**
`SELECT PI() `

**DATA ATUAL**
`SELECT GETDATE()`
Drawing Book (HackerRank JavaScript Solution) 🚀🚀
Published: 2022-02-24 15:46:16

A teacher asks the class to open their books to a page number. A student can either start turning pages from the front of the book or from the back of the book. They always turn pages one at a time. When they open the book, page _1_ is always on the right side:
![Drawing book 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6te6is8czc04ptls38jn.png)
When they flip page _1_, they see pages _2_ and _3_. Each page except the last page will always be printed on both sides. The last page may only be printed on the front, given the length of the book. If the book is _n_ pages long, and a student wants to turn to page _p_, what is the minimum number of pages to turn? They can start at the beginning or the end of the book.

Given _n_ and _p_, find and print the minimum number of pages that must be turned in order to arrive at page _p_.

### Example
_n = 5_
_p = 3_
![Drawing Book 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ezgtisn5eqf2hdyp7kh.png)
Using the diagram above, if the student wants to get to page _3_, they open the book to page _1_, flip _1_ page and they are on the correct page. If they open the book to the last page, page _5_, they turn _1_ page and are at the correct page. Return _1_.

### Function Description
Complete the pageCount function in the editor below.

pageCount has the following parameter(s):

- int n: the number of pages in the book
- int p: the page number to turn to

### Returns
- int: the minimum number of pages to turn

## Solution
```js
function pageCount(n, p) {
    // Write your code here
    let count = 0
    const bookHalf = Math.floor(n/2) 
    const pageDiff = n - p
    if(p == bookHalf){
// if page is at the center of the book
        count = Math.floor(bookHalf/2)
    }else if(p < bookHalf){
// if page is closer to the front
        count = Math.floor(p / 2)
    } else if(pageDiff == 1 && n%2 == 0){
// if page is at the end and last page number is even
        count = Math.ceil(pageDiff / 2)
    } else if(pageDiff == 1 && n%2 !== 0){
// if page is at the end and last page number is odd
        count = Math.floor(pageDiff / 2)
    }
    else {
// if page is closer to the end
        count = Math.floor(pageDiff / 2)
    }
    return count
}
```
Rubber Duck Debugging
Tags: beginners, programming, debugging
Published: 2022-02-24 15:44:44

## Talk through the problem
Have you ever been stuck on something?

As you are talking about it or telling someone about it, suddenly the solution arrives or you get that eureka moment where you stop and realize you have the answer.  Even when writing out the issue you are working on to someone, then the answer comes as you are writing it out.  This happens to me a lot.  Sometimes just looking for something at work, or I am writing an email and send it, then I realize I needed to try some step. **BOOM**! The solution presents itself.


![Talking about a problem](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4xgun7l9vkh1ocdsj04.jpg)
## Talking it out
I used to just call it talking things out and leave it at that, then I find out that there is a name for this.

[Rubber Duck Debugging](https://en.wikipedia.org/wiki/Rubber_duck_debugging)!

I've never spent my time talking to inanimate objects, maybe myself but while I may be an object I am not inanimate, so while talking to myself or others I do get in this situation. At times its kind of embarrassing to send an email or message, then immediately follow it up with a never mind..

That sort of makes me feel like the old SNL character Roseanne Roseannadanna.

![roseanne roseannadanna](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/78l2ovs0rjxvjo84y4y5.jpg)

## Never get stuck alone thinking
To me the whole point of it is to not get stuck on a problem and just sit there thinking and thinking and thinking on it.  Getting stuck on something small that distracts me from moving onto the solution.

Talk it out, step away, or speak to a duck if you have one. You never know, the answer may just suddenly appear.

Anyone else have this happen to them?
phase 1 project
Published: 2022-02-24 15:36:02

-Started the project by looking through the free API lists to see if anything would jump out at me. I wanted to pick something straightforward to make my project simple. I found https://www.thecocktaildb.com which gave me an idea of single page application that lists cocktail cards.

-Upon looking into API, I found that most of it was behind a paywall. I did not want to give up the idea though so I did some search on git hub and found https://gist.github.com/renandanton/8d99dab65bf9fb5b4465ded7ab73a7df which is json DB file that also lists cocktails. I copied part of it and made json file cocktails.json

-To fetch JSON data, I made function getDrinks.
![getDrinks function fetches data from json server](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2wgdcx5ewyuruu4iyty.png)
This function sends fetch request to JSON server, then when promise is fulfilled, takes the response and parses it as JSON file that JS can use. 
Once that is done, getDrinks function will take that array and calls back renderDrink function to iterate each item through renderDrink function to render cards.
If the promise errors out, catch will console log error on the browser console.

-renderDrink function is a callback function which will take the object and create and append card into main body.
![renderDrink function creates and appends cards](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11w5u7byhtn7e3e5n6my.png)
It creates document element card, and it will input values from the object to link image, write name and short preparation.
then It will append the card as child under drink-collection DIV 

-to have submit form hidden by default, and have it show up when an user clicks a button, I used![submit form will be hidden until add drink button is pressed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kpfecvxwabkfsmbwk7v3.png)
First, I made a variable called addDrink and declared it false, then I added an click event listener to a button that I ID'd as new-drink-btn. 
Each time the button is pressed, it will change the addDrink variable state from false to true and vice versa. 
I added conditional statement to display the form in block form if addDrink is true, and to not display if it is false. 
Since the default state is false, it will hide the form before the button is pressed.

- For my functionality of the SPA, I chose to go with creating and appending a new card when an user submits the previously hidden form.
![handleSubmit takes user entries and creates a new card](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a90webhcid34om16t5fo.png)
I made handleSubmit function, and declared a variable object drinkObj which contains the inputs of the user. then the function calls renderDrinks function to render and append new card from the inputs.
Laravel 9 Custom Token Based Api Authentication Tutorial
Tags: laravel
Published: 2022-02-24 15:20:31

In this article, we will discuss how to create Laravel 5.6 Custom Token Base API Authentication. As we discuss the JWT Auth in our previous article. But Laravel is open to creating a custom authentication for our API’s. I’m assuming you are familiar with the Laravel framework if not then you can start with given tutorials.

In this article, we will discuss how to create Laravel 5.6 Custom Token Base API Authentication. As we discuss the JWT Auth in our previous article. But Laravel is open to creating a custom authentication for our API’s. I’m assuming you are familiar with the Laravel framework if not then you can start with given tutorials

[Laravel 9 Custom Token Based Api Authentication Tutorial](https://www.codecheef.org/article/laravel-9-custom-token-based-api-authentication-tutorial)
The struggle is real!
Tags: webdev, programming, productivity, codenewbie
Published: 2022-02-24 15:08:34

I was up all night working on passing some JavaScript tests and I know we all hear it at some point or another but can be hard to remember IT IS OK TO STEP AWAY FROM YOUR WORK it is inevitable that there will always be something to work on and accomplish, however there will not always be the opportunity to enjoy life.
I created opensense 👁
Tags: webdev, showdev, productivity, javascript
Published: 2022-02-24 14:55:45

Hello I created opensense a full open-source license provider.I started this project as open-source you can use it for free.You can choose your license for your open-source projects like MIT,BSD,ISC,APACHE etc.In coming days i updating it with more licenses

Website url-https://sripadhs.github.io/opensense
Day 31/100 Java
Tags: 100daysofcode
Published: 2022-02-24 14:37:08

Challenges along the way.

Day 31/100

**Language:**
JAVA

**Time Period Spent:**
2 hrs

**Course Taken:**
Udemy: Java Programming Masterclass - Tim Buchalka

**Today's Learning:**
- Inner Classes
- Abstract Classes
- Abstraction vs Interface

- Code Challenges:
	- Playlist
	- Inner Classes
	- Interfaces

**Additional Notes:**
Easing my way through the course. There are many different ways to implement things in java which can make it complex. You can make simple implementations with inheritance, for example, use abstraction to create blueprints and extend classes from this. I like the different concepts as it allows you to choose how complex and in-depth you want to be with you program.

I am enjoying the writing of Java a lot. It allows you to be more descriptive with code. It forces you to write cleaner and more readable code out of the box. Honestly speaking, I find it a lot easier than Python, but this is just me. The comprehension of Java is harder and the inner workings are definitely harder to grasp, but I feel like this is down to pure theory of the language.
Paracetamol.js💊| #63: Explica este código JavaScript
Tags: javascript, spanish, webdev, beginners
Published: 2022-02-24 14:34:20

## **Explica este código JavaScript**

```js
let name = 'Lydia'

function getName() {
  console.log(name)
  let name = 'Sarah'
}

getName()
```

-     A: `Lydia`
-     B: `Sarah`
-     C: `undefined`
-     D: `ReferenceError`

Respuesta en el primer comentario.

---
npm Error code 403! Creating react app using create-react-app my-app
Tags: react
Published: 2022-02-24 14:20:23



 Installing packages. 
This might take a couple of minutes. 
Installing react, react-dom, and react-scripts with cra-template 
npm ERR! code E403 
npm ERR! 403 403 Forbidden- GET https://registry.npmjs.org/open/-/open-8.4.0.t 
npm ERE: 46B In most cases, you or one of your dependencies are requesting 
npm ERR! 403 a package version that is forbidden by your security policy, or 
npm ERR! 403 on a server you do not have access to. 
npm ERR! A complete log of this run can be found in:

Aborting installation. pm install --no-audit --save --save-exact --loglevel error react react-dom re Deleting generated file... Deleting my-app/ from C: \Users Done. package, json
How to become a better programmer

Tags: programming, beginners, discuss, algorithms
Published: 2022-02-24 13:37:29

****
Now after a few years of entering the world of programming
I discovered and saw what is important to becoming a better programmer
Before deciding which field you would like to learn and work in
You should learn general topics and these topics will help you become more successful and make you a developer who can make the right decision
such as:
1) data structures
2) algorithms
3) object-oriented-programming 
4) problems solving 
these main topics every developer has to learn it and keep practicing solving problems and knowing what is the difference between types of data structures and algorithms
more practicing is more improving your skills as a programmer

>
006/100 Days of Code: Strapi CMS
Tags: 100daysofcode, javascript, strapi
Published: 2022-02-24 13:18:32

Ontem foi dia de explorar mais a fundo a versão atualizada do [Strapi](https://strapi.io/) e tudo o que encontrei me deixou bastante empolgado!

---
## CMS
Um CMS (Content Management System) é, como o próprio nome já diz, um Sistema de Gestão de Conteúdo, para nós desenvolvedores é como a implementação de um CRUD dinâmico onde você define os tipos de conteúdos e os relacionamentos entre eles e o próprio sistema se responsabiliza por implementá-los com a capacidade de Criação, Leitura, Atualização e Deleção.

## Strapi
O Strapi é um CMS, e do tipo headless, ou seja, ele fornece apenas o backend, que pode ser consumido por diferentes front-ends, agilizando a configuração de produtos que requerem apenas as clássicas tarefas de um CRUD ao mesmo tempo que mantém a liberdade para o desenvolvedor caprichar no design!

Apesar de já ter utilizado essa ferramenta algumas vezes no passado, as últimas atualizações conseguiram me surpreender, além da mudança visual, que agora apresenta um conceito mais clean, temos um suporte muito melhor ao desenvolvido com GraphQL e uma capacidade de extensão de componentes também melhoradas!

Entendo que a explicação completa de cada uma dessas melhorias e como elas podem ser utilizadas só pode ser compreendida em sua totalidade quando aplicada em um projeto, por isso já estou preparando um material que, com certeza, incluirá esse CMS no seu próximo projeto!😉

## Hoje
A meta é explorar um pouco mais essa ferramenta para entender melhor como se dão os relacionamentos entre os componentes criados na aplicação e até onde chega o poder do GraphQL para gerenciamento desses dados.

## Outros Canais
Fique à vontade para entrar em contato comigo por essas outras mídias sociais também:
- [LinkedIn](https://www.linkedin.com/in/joaovitoralexandre/)
- [Instagram](https://www.instagram.com/alexandrebekor/)
- [Twitter](https://twitter.com/alexandrebekor)