teleren/devto huggingface dataset:
Learning FastAPI with a sample python library
Tags: python, fastapi, coding
Published: 2023-01-04 14:20:35

---
title: Learning FastAPI with a sample python library
published: true
description: basics of working with fastAPI using a sample pypi package
tags: #python #fastAPI #coding
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mb4kznx8p04b8ctr6r70.png
---
#### what is it about
While I was learning about flask found a very good way to create API with fastAPI.

So wanted to share what I tried out with that framework using a sample pypi package created for encoding reserved characters.

#### what are we building
API which allows us to encode reserved characters or give a template on what to encode. This is exposed as API though the fastAPI framework.

clone the repo 
```bash
https://github.com/uptownaravi/LearnfastAPI.git
```
switch to the fast folder

setup virtual environment
```bash
python -m venv venv
.\venv\Scripts\Activate.ps1
```
this creates a virtual environment where we can install our packages and run the code. 
I am using windows so Activate.ps1
if you are using linux run ./venv/bin/activate

run the pip requirements 
```bash
pip install -r .\requirements.txt
```
this installs the fastapi, uvicorn for the api and the sample library encodepacakge

start the server
```bash
uvicorn main:app --reload
```
> The good thing about fastAPI is we can interact through UI in a browser instead of relying only on cli to run the api

check the url http://127.0.0.1:8000/docs

![fastAPIWebPageScreenShot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4qoxqu76evyxel5kx8e.png)

expand the second section and click on the try it out button

![tryoutencodeapi](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/czl592wtpk7xse4x623m.png)

add details to the data field and click on execute

![encodeAPIOutput](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zij8kcgdqvly6jg7wijb.png)

#### what happened in the above step
if you check the main.py file
```python 
@app.get("/encode/{data}")
def encodedata(data: str):
    encodedata = enc.encoded(data)
    return f"encoded value of {data} is {encodedata}"
```
we are calling the Encode class to update the reserved character like mypass#50 into mypass%2350.

as we are exposing this as api we can visit the url http://127.0.0.1:8000/encode/mypass%2350 to get the output as well

this can be extended by adding the required endpoints to the main.py with supporting python files.

> Will add more examples as I explore more on fastAPI


#### reference 
fastAPI - https://fastapi.tiangolo.com/
Which notification would you like to get today?👇
Tags: testing, testdev, mentalhealth, devops
Published: 2023-01-04 14:20:05



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

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

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdn18mywk3q6bo4lrhao.png)
How Can Your E-Commerce Website Generate Leads?
Tags: leadgenerate, lead
Published: 2023-01-04 14:13:23

Every eCommerce business owner is aware that for their items and brand to succeed, sales are required. By 2023, it is predicted that eCommerce would account for 22% of all retail sales worldwide. They need new customer sales, which are essential but occasionally difficult to come by.

Many are prompted by this to inquire what they can do to help your eCommerce website generate leads.

**What are eCommerce marketing leads?**
A lead is generally someone who expresses interest in what you have to offer, such as your goods, name, or services, by taking some sort of action. Every action a lead appears to take yields insightful data. This information can be used to instantly alert your lead generation strategic plan and convert a lead into a valuable paying customer.

**Types of Leads Generate**
1. Maximum usage of Search Engine Optimization (SEO)

2. Design Pay-Per-Click Campaigns (PPC)

3. Boost Your Social Media Followers

4. Create Worthwhile Content

5. Give Customized Attention

6. Optimum Usage of Email Marketing

7. Improvise Conversion Rates (CRO)

8. Offer Product Discounts and Various Deals

9. Use urgency in your copy

Due to the intense competition in the eCommerce sector, it is difficult to create distinctive brands. To succeed, you must first have a thorough understanding of who your ideal client is. Then, combine eCommerce lead-generation tactics to improve the number of targeted users coming to your site. Use retargeting efforts to close deals more quickly because eCommerce sales cycles aren't that long. https://pitdesigns.com/how-to-generate-leads-for-your-ecommerce-website/
Stream from Mac to TV using Elmedia
Tags: stream, mac, movies, software
Published: 2023-01-04 14:10:41

The holiday season is the perfect time to upgrade your movie-watching experience by experimenting with 4K streaming movies. An experience that will transport you to a world of stunning visuals and captivating stories. 

Streaming media from your Mac to your TV can be a convenient way to enjoy your favorite movies, TV shows, and other content on a larger screen. One way to do this is by using the Elmedia Player.
Elmedia Video Player is a versatile media player that supports a wide range of file formats and has built-in support for streaming to Chromecast and other devices (https://www.elmedia-video-player.com/best-4k-movies/)
Configurando o SCA para quebrar pipelines
Tags: veracode, security, tutorial, beginners
Published: 2023-01-04 14:10:36

O uso do SCA Agent-Based em um [pipeline](https://dev.to/m3corp/como-adicionar-sast-e-sca-em-uma-validacao-de-pr-4918) é muito interessante para registrar todas as falhas encontradas no LOG e criar fluxos automatizados de verificação, mas caso seja de interesse da equipe, é possível também utilizar ele como um definidor de quebra de fluxo, totalmente personalizável. 

Para fazer o gerenciamento das opções, no [portal da Veracode](https://web.analysiscenter.veracode.com/) acesse a aba de "**Scans & Analysis**" e clique em "**Software Composition Analysis**", selecionando a aba "**Agent-Based Scan**".

Nessa tela vamos ver a listagem de todos os Workspaces que criamos, bastando selecionar qual queremos personalizar as regras. 
![Agent](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aa2bpfy7oykejytaabj0.png)
Com o Workspace selecionado, vamos clicar em "**Rules**" no canto inferior direito. Nessa nova tela, selecionamos a aba "**Custom Rules**" e clicamos em "**Edit**":
![Rules](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ye0ukfellbl957m1j06x.png)
Agora cada uma das opções permite edição. 
Caso queira que para algum desses controles o pipeline quebre, altere em "**Level**" de "**Warning**" para "**Error**". Caso precise de algum controle diferente dos padrões, selecione "**Add Control**".

Depois de personalizar basta clicar em "**Save**" no mesmo local onde estava o botão "**Edit**". 

As modificações vão começar a funcionar no próximo scan.
Como fazer um scan pelo portal
Tags: veracode, beginners, tutorial, security
Published: 2023-01-04 14:09:32

Para começar, precisamos escolher qual o perfil de aplicação onde vamos fazer a análise.
Para localiza-lo no [portal da Veracode](https://web.analysiscenter.veracode.com/), clicamos em "**My Portfolio**" e em "**Applications**". 

Na lista selecionamos o perfil, nesse caso o chamado "**Teste-App**"
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/utpwe3ikhdh5kvqya488.png)

Dentro do perfil, clicamos no botão localizado no canto superior direito, onde está escrito "**Start a Scan**" e selecionamos "**Start a Static Scan**"
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hyu02jc84t2egar39ghr.png)

Nessa tela podemos utilizar algumas opções para identificar a análise, como atribuir um nome e informações adicionais como data de lançamento. Por padrão, deixamos o **auto-scan** habilitado depois do **Prescan**. Na etapa de **Prescan** a Veracode válida quais os módulos e se consegue ou não fazer a análise do pacote enviado.

Marcando essa opção, assim que ela fazer essa validação, já inicia a análise dos pacotes enviados.
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwrjpy29tg2jikachqiy.png)Basta clicar em "**Save and Continue**" depois de personalizar. 

Agora temos a tela de Upload dos arquivos. É sempre importante levarmos em conta o [guia de empacotamento](https://docs.veracode.com/r/c_comp_quickref) nesse processo, já que isso é o que vai garantir que a analise seja feita corretamente. 
Para esse exemplo, vou usar uma aplicação chamada [NodeGoat](https://github.com/M3Corp-Community/NodeGoat-JS), feita utilizando Node Js, então precisamos apenas subir um ZIP com todos os arquivos do projeto.
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4t2xqc4x9tw1sbjj72k.png)Assim que o upload terminar, basta clicar em Next para iniciar a análise. 

Agora é só aguardar ela ser concluída.
Setting Up Nodejs with Typescript
Tags: node, typescript
Published: 2023-01-04 14:05:31

Initialize and Install Typescript

```jsx
npm init -y
npm install -D typescript @types/node
```

Update the `package.json` with a build script and change the type to module.

```jsx
{
  "type": "module",
  "scripts": {
    "build": "tsc"
  },
}
```

Create a `tsconfig.json` file and use the **`NodeNext`**option to handle ES Modules with interop between CommonJS modules.

```
{
    "compilerOptions": {
      "module": "NodeNext",
      "moduleResolution": "NodeNext",
      "target": "ES2020",
      "sourceMap": true,
      "outDir": "dist",
    },
    "include": ["src/**/*"],
  }
```

Use ES Modules

```jsx
//hello.ts
export const hello = 'Hello World!';

//index.ts
import { hello } from './hello.js';
```

Use CommonJS Modules

```jsx
//hello.cts
module.exports = 'Hey!';

//index.ts
import hola from './hello.cjs';
```

Next run

```jsx
npm run build
node dist/index.js
```
[Reference](https://www.youtube.com/watch?v=H91aqUHn8sE)
useTransition - Web Dev Simplified
Tags: webdev, javascript, react, beginners
Published: 2023-01-04 14:00:14

**App.js Code**

``` react
import { useState, useTransition } from 'react'


export default function App() {
    const [isPending, startTransaction] = useTransition();

    const [input, setInput] = useState("");
    const [list, setList] = useState([]);

    const LIST_SIZE = 20000;

    function handleChange(e) {
        setInput(e.target.value);

        startTransaction(() => {
            const l = [];
            for (let i = 0; i < LIST_SIZE; i++) {
                l.push(e.target.value);
            };
            setList(l);
        })
    }

    return (
        <>
            <input type="text" value={input} onChange={handleChange} />

            {isPending ? 'LOADING...' : list.map((item, index) => {
                return <span key={index}> {item} </span>
            })}
        </>
    )
}
```
**Output**

![Output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vd1pfybpaj54v7mmobuh.png)


![Output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sjli8b1ad6md5r2muvq5.png)



Thank You.
You can follow us on:
[Youtube ](https://www.youtube.com/c/ULTIMATEPROGRAMMING)
[Instagram](https://www.instagram.com/full_stack_web_developer1/)
Maximizing Your Leaderboards with Highscore's New Category System and Meta Field
Tags: webdev, opensource, github, news
Published: 2023-01-04 14:00:00

Hi everyone! Before the holiday, I released a new version of [Highscore](https://github.com/EmilienLeroy/HighScore/), an open-source leaderboard for indie game developers. This release includes a new category system and some additional small features. If you're not familiar with [Highscore](https://github.com/EmilienLeroy/HighScore/), it's a great tool for indie game developers to track and compare the scores of their games. I hope you'll check it out and let us know what you think!

## Category system

One of the main features of this release is the new category system, which allows you to create an unlimited number of leaderboards using a single field for the score. To use it, simply add the `category` field with the name of the desired category. Scores submitted with a category will not appear on the main leaderboard, but you can now retrieve all scores for a specific category by including the `category` field in your request. This is a great way to track scores for different groups or categories within your game or application.

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

## The meta field

This release also introduces a new field called the `meta` field in the score model. This field allows you to pass in any object with your data, with no restrictions on what you can include. For example, you could use this field to attach additional stats or metadata to a score, such as the number of turns taken or the difficulty level of the game. The `meta` field is a flexible and powerful way to add more context and information to your scores, and can be used to tailor your leaderboards to your specific needs.

![meta](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13mopjz8k4mis96wg5ru.gif)

## Privacy policy view

Highscore now includes a default privacy policy that can be customized using environment variables. You can view the privacy policy by accessing the endpoint `/privacy`. Using the environment variables, you can configure the country, email, and website information included in the policy. By providing a clear and transparent privacy policy, you can help build trust with your users and ensure that their personal information is protected.


![privacy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/czmo05zh24ieh0jipq7a.png)

## What's next

The next release of [Highscore](https://github.com/EmilienLeroy/HighScore/) is expected to include a new achievement system, which will allow you to add goals and milestones to your game. In addition, we will be adding websocket events, which will allow you to listen when new scores are added.  We hope these new features will be useful and help you get even more out of Highscore. 

Thanks for reading!
Registro di guerra Lupo solitario
Tags: angular, gestionale, luposolitario, librogame
Published: 2023-01-04 13:59:56

---
title: Registro di guerra Lupo solitario
published: true
description: Un gestionale del libro game lupo solitario
tags: angular, gestionale, lupoSolitario, libroGame
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7my5nrakgpt0thgkyz5.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-04 08:36 +0000
---

Nelle vacanze di natale ho trovato un vecchio libro di quando ero adolescente, più precisamente un libro game (una storia a bivi). 

Ai tempi mi ha fatto piacere la lettura, facendomi vedere che non tutti i libri erano noiosi.

Il volume in questione era "I signori delle tenebre", primo numero della collana "Lupo solitario".

Detto questo, volevo farlo leggere anche alle miei figlie ma sapevo che si sarebbero fermate alle istruzioni iniziali, dove bisognava crearsi il personaggio.
Poi la pagina del registro di guerra, dove si dovevano segnare tutti i dati era tutta scarabbocchiata.

Quindi ho fatto **un gestionale in Angular che crea e gestisce il personaggio**, per adesso solo basato solo sul primo volume.
Man mano che vado avanti con i volumi aggiornerò anche il gestionale. 

**Il progetto è open source e il codice si trova su github** {% embed https://github.com/camizzilla/lone-wolf %}.

La webApp non è collegato a nessun database, quindi non salva nessun dato. **Il salvataggio dei dati avviene tutto in locale sul vostro browser o è possibile scaricare una file Json**.

**Lo potete trovare a questo indirizzo**: {% embed https://camizzilla.github.io/lone-wolf/ %}
Arrow function explained simply
Tags: webdev, javascript, beginners, programming
Published: 2023-01-04 13:53:23

Arrow functions are a concise and expressive way to write function expressions in JavaScript. They were introduced in ECMAScript 6 (ES6) and have become a popular feature of the language due to their simplicity and flexibility.

One of the main advantages of arrow functions is their concise syntax. They allow developers to write shorter and cleaner code, especially when working with higher-order functions (functions that operate on other functions). For example, consider the following code that uses a traditional function expression to filter an array of numbers:

```javascript
const list = [1, 2, 3, 4, 5];
var odds = numbers.filter(function(n) {
return n % 2 !== 0;
});
```

This code can be rewritten using an arrow function as follows:

```javascript
const list = [1, 2, 3, 4, 5];
const odds = numbers.filter(n => n % 2 !== 0);
```
As you can see, the arrow function is much shorter and easier to read.

Another advantage of arrow functions is that they do not have their own "this" value. This means that they inherit the "this" value of the surrounding context, which can make it easier to work with "this" in certain situations.

Arrow functions are not appropriate for every situation, and it is important to understand when to use them. In general, they are best suited for small, concise functions that are not intended to be reused.

Overall, arrow functions are a useful and powerful feature of JavaScript that can help developers write cleaner and more expressive code. Whether you are just starting out with JavaScript or you are an experienced developer, it is worth taking the time to learn about arrow functions and how they can improve your code.
Número de Documento en vez de RUT para Identificar
Tags: chile, idea, spanish
Published: 2023-01-04 13:51:14

Personalmente creo que utilizar el número de documento es mejor que utilizar el RUT para verificar la identidad de una persona.

En Chile normalmente se da el RUT para comprar, obtener puntos y otros trámites importantes. 

![rut](https://user-images.githubusercontent.com/292738/210567220-0670cbb0-7d13-499d-9738-3192a800e973.png)

El drama del RUT es que es constante, no puedes cambiarlo. En contraste con el número de documento que se cambia cada vez que solicitas un nuevo carnet de identidad en el registro civil.

Debido a que muchas empresas todavía no tienen niveles de seguridad suficientes como para asegurar que un dato tan personal e identificativo como el RUT no sea filtrado si sus bases de datos son afectadas por ataques.

Lo mejor sería utilizar un número que si se puede alterar, pero que permita identificar a la persona.

Actualmente hay una forma de verificar si el número de documento es válido.

https://www.registrocivil.cl/principal/servicios-en-linea/consulta-vigencia-documento-1

![validar](https://user-images.githubusercontent.com/292738/210568835-ce336da0-5cdd-4d27-9de5-f52052ad7fc8.png)

Aunque la experiencia deja mucho que desear. 

Ojalá en el futuro el registro civil provee una API Rest o similar para poder validar un número de documento. 

Así más empresas ya no dependerán de un número de RUT, si no solo de documento para verificar la identidad de una persona.
About javascript!
Tags: javascript, webdev, beginners
Published: 2023-01-04 13:49:49

JavaScript is a programming language that is widely used to create interactive websites and web applications. It is a powerful tool that allows developers to add dynamic features to their websites, such as animations, form validation, and real-time updates.

One of the most exciting things about JavaScript is its ability to interact with the Document Object Model (DOM), which is the structure of a webpage. This allows developers to manipulate the elements on a page in real-time, creating a more engaging user experience.

One of the key features of JavaScript is its object-oriented nature. This means that developers can create custom objects and reuse code, which helps to make their programs more efficient and scalable.

In addition to its power and flexibility, JavaScript has a large and supportive community of developers. This means that there are many resources available for learning the language and getting help when you need it.

Overall, JavaScript is an essential tool for any web developer looking to create interactive and engaging websites. Whether you are just starting out or you are an experienced developer, there is always more to learn and explore with JavaScript. So, it's always a good idea to keep yourself updated with the latest trends in JavaScript.
How SDN is used in 5G and 6G networks
Tags: sdn, networking, network
Published: 2023-01-04 13:37:46

I've been curious about how the latest 4G and 5G networks work and how SDN has changed the traditional networking systems. In this article I have tried to brief about how SDN is used in 5G and 6G networks

**Software-Defined Networking **(SDN) is a network architecture that allows network administrators to manage network traffic flows and configure network behavior centrally, using software. It separates the control plane (which makes decisions about how to route traffic) from the data plane (which forwards traffic based on the decisions made by the control plane)

In 5G and 6G networks, SDN can be used to improve network efficiency and flexibility. Some potential applications of SDN in 5G and 6G networks include:

1. Dynamic resource allocation: SDN can be used to allocate network resources, such as bandwidth and power, to different users or applications in real-time based on their needs. This can help to improve network utilization and optimize the performance of 5G and 6G networks.
2. Network slicing: SDN can be used to create virtual networks (called "slices") that are customized to meet the specific requirements of different users or applications. This can enable 5G and 6G networks to support a wide range of services, such as low-latency gaming, high-definition video streaming, and mission-critical IoT applications.
3. Network orchestration: SDN can be used to automate the deployment and management of 5G and 6G networks, reducing the complexity and cost of network operations.
4. Interoperability: SDN can be used to enable 5G and 6G networks to interoperate with other networks, such as 4G, Wi-Fi, and satellite networks, allowing for seamless connectivity across different technologies.

I have been studying about latest networking technologies and tools, thanks for reading this article I hope this information is helpful! Let me know if you have any questions
TYPESCRIPT IN RAMEN (Making a new Javascript Framework)!!
Tags: webdev, javascript, programming, api
Published: 2023-01-04 13:33:34

Thanks to wonderful community I was able to add typescript in ramen, It was already in one of our todos and now the whole codebase is written in typescript! and not just that ramen now also have 1 example of Authentication which proves that ramen can be used in a lot of different scenarios, You can save / read cookies and do a lot of more stuffs. I'm pretty happy with the progress which I'm making in ramen Although I would love any pull request from the community members if they want to help, Since I'm just a beginner in Typescript concepts. But yeah! This is turning out to be way better than what I actually expected. I would love to know more and more stuffs which I can add in this framework, Let me know in the comments maybe? I don't really know but yeah whatever :3

Future Plans:
* Add file uploads and downloads
* plan other stuffs hehe I don't what else am I supposed to add

Keep up the good work Armaan! :D

![cat happee :)](https://media.giphy.com/media/Byp2MtxE5Tyla/giphy.gif)