teleren/devto huggingface dataset:
Mejora tu aplicación usando validaciones
Tags: webdev, api, security, architecture
Published: 2023-07-04 15:11:21

> _Son como gorilas en un club, verifican que se tenga la edad, el código de vestimenta y la actitud correctos antes de dejar entrar._

Podemos definir las validaciones como un conjunto de reglas que se aplican a los datos que viajan hacia o desde una aplicación.

El objetivo principal de estas reglas es garantizar la calidad, seguridad y consistencia de los datos. Por lo tanto, es altamente recomendable crear interfaces con validaciones, ya que, entre otras cosas, nos ayudan a:

- Prevenir ataques de seguridad.
- Mejorar la experiencia de usuario.
- Facilitar el mantenimiento y la escalabilidad.

Existen diversas formas y niveles de implementación de estas validaciones, así como una amplia variedad de herramientas que se adaptan según la complejidad y el formato de los datos. Algunos de los enfoques más comunes incluyen verificar:

- Los tipos de contenido en la solicitud (Content-type).
- Los parámetros y los cuerpos de las solicitudes.
- Las cabeceras y los códigos de respuesta.
- Los formatos y las estructuras de los datos.

Incluso si solo estás consumiendo una API, agregar validaciones en tu aplicación aportará un gran valor, ya que proporcionarás [retroalimentación inmediata](https://dev.to/gajaguar/optimistic-ui-y-el-equilibrio-entre-rapidez-y-precision-4cio) al tiempo que evitarás realizar solicitudes innecesarias.

---

El uso de validaciones de datos en las APIs es una práctica altamente recomendable que mejora considerablemente la calidad de las aplicaciones y genera confianza en los usuarios.
AWS Amplify for beginners
Tags: aws, serverless
Published: 2023-07-04 15:03:39

AWS Amplify is a development platform provided by Amazon Web Services (AWS) that simplifies the process of building full-stack applications. It offers a range of tools, services, and libraries to accelerate the development of web and mobile applications.

To create an app using AWS Amplify, you can follow these general steps:

1. Set up the AWS Amplify CLI:
   - Install the Amplify CLI on your local development machine. The CLI is available for Windows, macOS, and Linux.
   - Configure the CLI by running `amplify configure`. This will guide you through setting up your AWS credentials and region.

2. Initialize an Amplify Project:
   - Create a new directory for your app and navigate to it in your terminal or command prompt.
   - Run `amplify init` to initialize a new Amplify project. This will prompt you to provide details such as the app name, environment, and default editor.
   - Select the AWS profile and region to associate with your project.

3. Add Backend Services:
   - Use the Amplify CLI to add backend services such as authentication, APIs, storage, and databases.
   - For example, you can run `amplify add auth` to add authentication, or `amplify add api` to add a GraphQL or REST API.
   - Follow the prompts to configure the specific details of each service.

4. Deploy Backend Services:
   - Once you have added the desired backend services, run `amplify push` to deploy your backend resources to AWS.
   - The CLI will create the necessary AWS resources and configure them based on your specifications.

5. Integrate Amplify into your App:
   - Depending on the type of app you are building, you can use Amplify libraries and SDKs to integrate with your frontend code.
   - Amplify provides libraries for JavaScript frameworks like React, React Native, Angular, Vue.js, and more.
   - Install the necessary Amplify libraries via npm or yarn, and follow the documentation and examples to integrate Amplify functionality into your app.

6. Build and Deploy your App:
   - With Amplify integrated into your app, you can now build and test your application locally.
   - Once you are ready to deploy, run `amplify publish` to build and deploy your app to a hosting environment provided by Amplify.

These steps provide a general overview of creating an app using AWS Amplify. The specific implementation details and configurations may vary based on your app requirements and the backend services you choose to incorporate. It is recommended to refer to the official AWS Amplify documentation, guides, and examples for more detailed instructions and to explore the various capabilities and features offered by Amplify.
MySQL usar tipo SET para validar
Tags: backend, database, mysql
Published: 2023-07-04 15:00:57

Cuando diseñamos un sistema y tenemos una lista restringida de opciones, el modelo ER nos mostrará una relación de 'muchos a muchos'.

Consideremos el caso de Usuario - Roles:

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

El diagrama nos indica que debemos crear tres tablas.

---

Como alternativa, en MySQL nos proporciona el tipo _SET_. 

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

Dicho campo acepta ninguno, uno o más valores de la lista.

```
mysql> insert into user(email,name,password) 
values('a@greatsolutions.consulting','A','A');
Query OK, 1 row affected (0.04 sec)

mysql> insert into user(email,name,password,roles) 
values('b@greatsolutions.consulting','B','B','');
Query OK, 1 row affected (0.04 sec)

mysql> insert into user(email,name,password,roles) 
values('c@greatsolutions.consulting','C','C','editor,user');
Query OK, 1 row affected (0.04 sec)
```

Por el contrario, nos da error cuando intentamos insertar un valor diferente.

```
mysql> insert into user(email,name,password,roles) 
values('d@greatsolutions.consulting','D','D','root');
ERROR 1265 (01000): Data truncated for column 'roles' at row 1
mysql>
```

---
## Documentación

https://dev.mysql.com/doc/refman/8.0/en/set.html
How to masterJavascript
Tags: webdev, javascript
Published: 2023-07-04 14:32:33

A very big achievement i will declare to myself once i become better in js. i have been trying for 6 months. I was expecting by this time to be a guru. how you guys get to know javascript so well? i know some guys who are good like they aare really good at it. How do you get to that high skill level?
Avoid using "array[index]" for getting Array elements
Tags: javascript, typescript, frontend, node
Published: 2023-07-04 14:26:47

Hey there, fellow developers! 👋 

Let's talk about something that might ring a bell for many of us: `accessing elements in an array`. We all know that familiar way of grabbing array elements using `Property Accessors` like `array[index]`. It's pretty straightforward, right?

```typescript
const arr = [7]

const firstElement = arr[0]
// 7 ✅
```
<br>
## Problems
Well, here's the catch. Have you ever wondered what happens when you tweak the index? Let's say you change `arr[0]` to `arr[1]`. In that case, the value you'd expect from `arr[1]` suddenly becomes... `undefined`! 🤯 

```typescript
const arr = [7]

const firstElement = arr[1]
// undefined ❌
```

Yep, the second element you were counting on just vanishes into thin air. It might sound like a minor hiccup, but guess what? Many developers forget to guard against it!

Now, here's where it gets interesting...

TypeScript, which is a tool that helps catch sneaky bugs, somehow fails to detect this issue. TypeScript still thinks the type of `arr[1]` is a solid number, despite it being `undefined`.

First case:
![Typescript Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jxwl5qpmt8rq3mqenml.png)

Second case:

![Typescript Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tv2e7wqsci87o3kk9ro5.png)

And you know what's even riskier? When TypeScript considers potentially unsafe data as perfectly safe values, it can trigger nasty errors that are a real headache to debug. 😫
<br/>
## Solutions
But hey, fear not! I've got a couple of solutions that can save the day:

### 1. Use `Array.at()`

First case:

![Typescript case](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgpzo2z0wr47f284s7ei.png)

Second case:

![Typescript case](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lq2l1aii5qkq7ord8e3r.png)

It's an alternative method to access array elements, apart from the traditional property accessors. By replacing `arr[0]` with `arr.at(0)`, TypeScript will smartly infer the type as `number | undefined`. 

This method knows how to handle those pesky `undefined` elements, making your code safer. If you're curious, you can find a polyfill (a code snippet that adds support for new features) for it on GitHub: [link to polyfill](https://github.com/tc39/proposal-relative-indexing-method#polyfill).

### 2. Always add fallback

![Typescript case](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60mx6u4hyv8q8gg03r6g.png)

TypeScript will strongly encourage you to add a fallback value whenever you encounter a potentially `undefined` element. You can go for `value = arr.at(0) || fallback`. 

This way your fallback value will save the day.

## Conclusion

By keeping these considerations in mind and implementing these nifty solutions, you'll be dodging bullets and making your code rock-solid. 🛡️ So, let's make sure those pesky `undefined` array elements don't catch us off guard! Hope you find these tips useful for your projects! ✨
BOW breaks robot coding barrier with world’s first common robotics engine
Tags: programming, python, robots
Published: 2023-07-04 14:19:57



Robotics software company BOW has launched the world’s first common robotics engine. It translates between different languages used to code and control robots, making it possible to program robots in Python and C++ and create applications that can be deployed easily across multiple robot platforms. Developers can register for BOW’s Beta programme at 
https://www.usebow.com/.
My experience learning code for the first time
Tags: beginners, webdev, productivity, html
Published: 2023-07-04 14:19:53

I got into web development because I wanted to write technical articles in the information technology sphere. When I investigated the various facets of technology, I discovered that my natural abilities were best suited for technical writing, but if I didn't learn to code, what kind of technical writer would I be?   This, together with my enthusiasm for data science, motivates me to learn how to code.  

In retrospect, one might say I found writing code intellectually intriguing and sapping as well. Before I experienced code I expected to be met with a lot of statistical stuff and math, which I must say is not my strongest suit. Encountering Hyper Text Markup Language(HTML), I found myself dealing with symbols to specify tags; now this is on the intriguing side. On the sapping aspect, the more I wrote code, the lesser I could comprehend the last code forcing me back and forth between the texts.

Another highlight of this magnificent experience was the Integrated Development Environment (IDE) I was using. As a novice coder, I found the auto-completion of tags and suggestions in between lines of code to be really helpful in the Visual Studio Code editor (VS CODE).

There are always two sides to every coin and in as much as I have found coding to be broad, I can say with full confidence that it is a project worth being embarked upon.
EC2 Auto Scaling and how it works.
Tags: aws, beginners, devops, architecture
Published: 2023-07-04 14:05:22

**Problem:** Your web application uses EC2, and the web traffic is periodic, unpredictable, or continuously changing. If you have fixed EC2, then during the pick hour, the fixed VMs are unable to handle the traffic, and conversely, at normal hours, the VMs will be unutilized. 

**Solution:** Using AWS Auto Scaling, we can easily mitigate this issue. AWS Auto Scaling continually monitors your applications to make sure that they are operating at your desired performance levels. When demand spikes, AWS Auto Scaling automatically increases the capacity of constrained resources so you can maintain a high quality of service. It allows you to only pay for the resources you actually need. So you can optimize the cost. 
How it works:
Suppose you have a  website www.reza.com and you want to run this site by using aws auto scaling feature. 

**Services needed for this requirement:**
1. Route53
2. Application Load Balancer
3. Target group
5. Auto Scaling group
6. EC2

**Step 1:** 
Deploy your website in ec2. See the status of your instance is running and functioning. Create a image from the instance, so that you can use this image for creating the launch template.   
**Step 2:** 
Create target group and registered the instance. 
**Step 3:**
Create auto scaling group
- Provide a name to identify the group
- Create launch template. Provide template name. Select the image from AMI (previously created from instance), use same configuration for the others filed (network, key, security group) from your ec2. 
- Set VPC, Availability Zones and subnets  
- After creating auto scaling group, open the auto scaling group, go the auto scaling tab and set the Dynamic scaling policies by using EC2 CPU utilization metric. 

**Step 4: **
Create internet-facing Application Load Balancer, Set network mapping and Security groups from EC2 configuration. 
Listeners and routing- protocol http, port 80 redirect to protocol https, port 443

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/115g7vjjtnav0fju8mo0.png)

Add another listener
protocol https, port 443 forward to created target group


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73v3jw6el1kz2gre3wwd.png)

Finally, from the route53, you just point your website to the load balancer.
Journey to Becoming a Vimmer Vol1 ~Neovim~
Tags: vim, neovim
Published: 2023-07-04 14:02:37

# Setting Neovim Environment
## Introduction
When I saw a YouTube video about live coding where vimmer code, I was amazed at the speed of coding.
This article is a record until I became a Vimmer.

## Prerequisite
- This article was inspired by [this](https://zenn.dev/takuya/articles/4472285edbc132)
- Using Macbook
- Using Iterm2

## Install NeoVim
### What is Neovim
> Neovim is a refactor, and sometimes redactor, in the tradition of Vim
https://neovim.io/charter

### How to install
```shell
brew install neovim
```

### Setting alias with `vim`
`~/.config/fish/config.fish`
```shell
alias vim='nvim'
```
I make Neovim available for 'vim' command

## Make Hack(Nerd Font) enable in Iterm2
### What is Nerd Font
Nerd Fonts is a tool that further enhances fonts suitable for programming and text editing, and incorporates symbols and icons to provide more visual information and help work.

### Download hack font
1. Go to https://github.com/ryanoasis/nerd-fonts/releases
2. Download `Hack.zip` file
3. Add Hack to Fonts
`cp ~/Downloads/Hack/*.ttf ./Library/Fonts`
4. Select `Hack Nerd Font Mono` in Iterm2 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvm931uc7ueehdpc98yu.png)

## references
https://github.com/neovim/neovim/wiki/Installing-Neovim
https://www.nerdfonts.com
Criando uma politica
Tags: sdelements, beginners, tutorial, security
Published: 2023-07-04 13:55:00

Para criar uma nova politica de segurança, na barra superior clique em **Manage** e depois em **Risk Policy**.

Clique no ícone de **+** e depois responda o formulário conforme as necessidades:
![Policy Form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/axww0rdixmcktqf7lr3k.png)

Caso tenha duvidas sobre as opções, pode consultar uma explicação mais detalhada na [documentação](https://docs.sdelements.com/release/2023.1/guide/docs/risk_policies/).
Criando uma fraqueza
Tags: sdelements, beginners, tutorial, security
Published: 2023-07-04 13:55:00

Mesmo com a imensa biblioteca que já vem por padrão na ferramenta, e que está sendo constantemente atualizada, pode ser necessario criar uma fraqueza (ou Weaknesses no original) personalizada para alguma necessidade especifica do seu projeto. 

Para fazer isso, na barra superior clique em **Library** e depois em **Weaknesses**. Clique no botão **+Add Weaknesses** no canto superior direito.
No formulário, defina um titulo, risco e coloque uma descrição:
![Form Fraqueza](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zfefm4trsocluvrihbt0.png)

É possível vincular a um projeto ou adicionar um CWE.
Top 20 AWS Lambda Interview Questions
Tags: beginners, aws, devops, git
Published: 2023-07-04 13:25:30

## **Introduction**

AWS Lambda, the popular serverless computing service, has transformed the way developers build applications in the cloud. Learning AWS Lambda opens up opportunities to build serverless applications, optimize costs, achieve scalability, and integrate with other [AWS services](https://technogeekscs.com/courses/aws), making it an essential skill for professionals across different technical domains.
According to statistics, over 100,000 customers use AWS Lambda. This range of businesses includes startups and large enterprises.

In these [AWS Lambda Interview Questions](https://technogeekscs.com/aws-devops-interview-questions/), we will explore the important aspects of AWS Lambda in a simple manner. We will cover topics such as understanding its event-driven architecture, triggers, scaling, monitoring, and security to provide you with the essential knowledge.

Whether you’re a beginner or an experienced professional, these AWS Lambda interview questions will help you showcase how AWS Lambda actively contributes to building scalable and efficient serverless applications. Get ready to succeed in your AWS Lambda interviews with confidence and show your expertise in this modern technology.
 

> _**Enroll in our AWS Certification Training for Solutions Architect Certification and learn how to use AWS Lambda with S3 to build scalable and reliable applications.**_

## **AWS Lambda Interview Questions For Freshers**
**What is AWS Lambda?**
AWS Lambda is a serverless computing service provided by AWS (AWS Full Form: Amazon Web Services). It helps developers deploy and run their code without the need to provision or manage servers. With AWS Lambda, you can primarily focus on writing the code for your application or service, while AWS takes care of all the underlying infrastructure and scaling requirements.

Want to learn more about AWS interview questions? Please visit our page [Click here to Read more](https://technogeekscs.com/top-20-aws-lambda-interview-questions/).
Day 4
Published: 2023-07-04 13:13:46

Okay so I absolutely love Linked Lists. When I was studying DSA back in the first place, I loved it then also. I was able to solve all the questions today. Also I did an extra day's work from Striver's DSA sheet.

Here are the problems that I solved completely today :

Reverse a LinkedList		
	
Find the middle of LinkedList		
	
Merge two sorted Linked List (use method u…		
	
Remove N-th node from back of LinkedList		
	
Add two numbers as LinkedList		

Find intersection point of LinkedList		
	
Detect a cycle in Linked List		
	
Reverse a LinkedList in groups of size k.		
	
Check if a LinkedList is palindrome or not…		
	
Find the starting point of the Loop of LL		
	
Flattening of a LinkedList
	
Delete a given Node when a node is given.
Support for password authentication was removed. Please use a personal access token instead.
Published: 2023-07-04 13:07:03

While pushing some codes into your GitHub repository you may encounter the error **"Support for password authentication was removed. Please use a personal access token instead."** as shown in the picture below



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vg44dnbnb1tufy752xw.png)

Starting from August 13, 2021, GitHub has stopped accepting passwords for verifying Git operations on user accounts. Instead, you will need to use a Personal Access Token (PAT) in place of your password. To add a PAT to your system, you can follow the steps outlined below.


**Step 1:** Go to your **GitHub Account** and then go to the **Settings**(click on your profile account and you will find the Settings option there)

**Step 2:** Scroll down and at the sidebar you will see the **Developer Settings** option. Click on **Developer Settings**.


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

**Step 3:** Click on **Personal access tokens** and then click on **Tokens (classic)**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/51v3o8zuxa4nhw0ry65b.png)

**Step 4:** Click on **Generate new token** and then click on **Generate new token (classic)**

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

Step 5: Fill-up the **Note** field, select **No expiration** and then select the checkboxes as shown in the picture


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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9zz6nzqcdiccv7j6gnag.png)

**Step 6:** Click on the **Generate token**. Your token is created!. 

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

**Step 7:** Copy the token and paste it on the password field of the terminal.

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

Your code got successfully pushed into your repository! 


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


However, after applying your token you may face this error.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jlspmqvzfo8djhu9jik.png)

Visit this blog(https://dev.to/shafia/common-github-issues-beginners-may-face-29bb) and follow the steps given in **Error 3 Solution 1**.

Happy coding!
Rubyist Hangout Thread
Tags: discuss, ruby, watercooler
Published: 2023-07-04 13:00:00

Hey folks, this is a weekly hangout thread.

This is an area for **Rubyists to discuss _Ruby_**, but since Ruby is 28 years old, and things don't change so quickly, this is also just **a hangout thread for Rubyists to share whatever you feel like** within our community guidelines.

So what's up this week?
How to Create a PDF Document in .NET using the PDF Library
Tags: pdf, dotnet, csharp
Published: 2023-07-04 12:36:05

Learn how easily you can create a PDF document in a console app using the Syncfusion .NET PDF Library. In this video, I will explain how to add text, images, and tables to a PDF document. The PDF library allows you to create, read, and edit PDF documents. It also offers functionalities to merge, split, stamp, form-fill, compress, and secure PDF files, and convert Word, RTF, Excel, and HTML files to PDF. 

PDF documents can be digitally signed using x509 certificates such as .pfx files with private keys and support for hardware security module (HSM), online certificate status protocol (OCSP), certificate revocation list (CRL), and Windows Certificate Store to offer authenticity and integrity. 

PDF document supports both AES and RC4 encryption algorithms as per the ISO 32000 standards and PDF 2.0 security to protect documents against unauthorized access. 

_Product overview_: https://www.syncfusion.com/document-processing/pdf-framework/net/pdf-library

_Explore our tutorial videos_: https://www.syncfusion.com/tutorial-videos

_Example project_: https://github.com/SyncfusionExamples/create-a-pdf-document-in-net-C-Sharp


{% youtube PvUdu1hpRLQ %}