teleren/devto huggingface dataset:
Know your engineers to lead them to success
Tags: leadership, engineering, programming, productivity
Published: 2023-03-08 19:08:28

There are many engineers out there, and their daily routine would be something like; having coffee, checking that everything is running fine on production, hacker news, a couple of subreddits, and jumping to the biggest part of the day, where you get plugged in and build something that will make a customer or a user more efficient, fast, useful, or unfortunately get laid off (Yes, we do not mean to do that, most of the time) .

The engineers you hire at your company are of different mindsets even technically, they come from various work environments, which rules how your product or services you are offering will shape eventually, and how willing is this person to handle the tasks you give.

This is not; a bad/good engineer post and this is also not to say that an engineer can’t have all of the below, but each one of us can surely relate to one of them:

###Soldiers

Steady performers, they will turn words into action, story cards into features, they have dedicated ownership of the service they are working on, and they believe they are making it better with each change they add to it. As simple as the word ownership can be, it is not found in every engineer, but the good news is; its teachable.

### Gatekeepers

Their abilities shine when making a situation turn from red to green as soon as possible, with a customer first mentality, they fix now, and question later. whether it is a person or a team, this unit is the gate keeper of your product and the safety net from down times.

They code review religiously, and they participate in standardizing the way everybody contributes to the platform.

###Communicators

They will question a feature, and debate how it will effect the customer/user , they will come up with better solutions and evidence to back their case. one is a gem, a product owners’ best friend, since this will be the access for understanding what is happening on the technical side, and how the team can make a better product/service.

### Architects

They shine when it comes to designing a solution, taking into consideration the current state of the product and what are the next steps to implement for it to grow in the right direction and power future changes. — Be careful of over architecting.

### Explorers

They are the drivers of proofs of concept, the non-stop seekers of whats out there that can make our products better, a technology, a design pattern, or as simple as a new standard in the way we work. They believe that even if its not broken, it can be much better.

I take this as a small guide to know the engineer I am talking to, to help me understand what can be their favorite part of the day and what challenges his mind.

A CEO, product manager, or any leader, will be lucky to have all these types of engineers, every one of them is a key component of a solid productive team, and what will always be common between them is the curiosity and openness to learn more everyday.
Como criar requisição de Crud Básico em Javascript usando Fetch API
Tags: javascript, crud, api, fetch
Published: 2023-03-08 19:05:51

---
title: Como criar requisição de Crud Básico em Javascript usando Fetch API
published: true
description: como criar um crud básico com javascript usando fetch API
tags: javascript, crud, api, js, fetch
# cover_image: https://images.unsplash.com/photo-1502101872923-d48509bff386?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1332&q=80
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-08 19:01 +0000
---

Para criar um CRUD (Create, Read, Update, Delete) usando a Fetch API do JavaScript, você pode seguir os seguintes passos:

1 - Crie uma função para fazer uma requisição GET para buscar os dados do servidor:

```javascript
function getDados() {
  fetch('url-do-servidor')
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error(error))
}
```

2 - Crie uma função para enviar dados ao servidor usando uma requisição POST:


```javascript
function enviarDados(dados) {
  fetch('url-do-servidor', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(dados)
  })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error))
}

```

3 - Crie uma função para atualizar dados no servidor usando uma requisição PUT:


```javascript
function atualizarDados(id, dados) {
  fetch(`url-do-servidor/${id}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(dados)
  })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error))
}

```

4 - Crie uma função para deletar dados no servidor usando uma requisição DELETE:

```javascript
function deletarDados(id) {
  fetch(`url-do-servidor/${id}`, {
    method: 'DELETE'
  })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error))
}

```

5 - Use as funções criadas para interagir com o servidor, por exemplo:


```javascript
// Busca os dados do servidor
getDados()

// Envia novos dados para o servidor
enviarDados({ nome: 'João', idade: 25 })

// Atualiza os dados do servidor com id = 1
atualizarDados(1, { nome: 'Maria', idade: 30 })

// Deleta os dados do servidor com id = 2
deletarDados(2)

```

Lembre-se de substituir "url-do-servidor" pela URL correta do seu servidor e adaptar as funções para atender às necessidades específicas do seu projeto.


Provavelmente você obterá um erro do browser relacionado ao CORS, se ocorrer utilize a biblioteca: https://github.com/expressjs/cors se o backend foi feito em Node.js, caso contrário busque outra solução.
Onde devo armazenar os arquivos dto do Nest.js?
Tags: nestjs, dto, armazenar
Published: 2023-03-08 18:57:03

Olá Pessoal,

Hoje trago uma dica rápida de organização para os arquivos DTO (Data Transfer Object) do Nest.js.

Os arquivos DTO no Nest.js são comumente colocados em um diretório dto dentro do módulo correspondente. Por exemplo, se você tem um módulo chamado users, você pode criar um diretório dto dentro dele e colocar os arquivos DTO lá. A estrutura do diretórios pode ficar assim:

```
users/
├── dto/
│   ├── create-user.dto.ts
│   ├── update-user.dto.ts
│   └── user.dto.ts
├── users.controller.ts
├── users.module.ts
└── users.service.ts

```
Depois de criar os arquivos DTO, você pode importá-los em seus controladores e serviços, como mostrado no exemplo abaixo:

```
import { Controller, Post, Body } from '@nestjs/common';
import { CreateUserDto } from './dto/create-user.dto';
import { UsersService } from './users.service';

@Controller('users')
export class UsersController {
  constructor(private readonly usersService: UsersService) {}

  @Post()
  async create(@Body() createUserDto: CreateUserDto) {
    return this.usersService.create(createUserDto);
  }
}

```
Note que, no exemplo acima, estamos importando o CreateUserDto do diretório dto.

Espero que a dica tenha sido útil a todos !

Bons estudos.
The Upwork currency: Connects
Published: 2023-03-08 18:55:19

Hello Dev family! Today, I became aware of a feature that I found interesting on Upwork and it is called "Connects". Connects can be a form of digital currency on Upwork and it is used by freelancers to 'buy' the clients attention in the hope of an actual exchange of money if the 2 parties agree to work together. Of course, when starting out, Upwork gives the feelancer Connects so that they can start to bid for jobs/positions. I am keen to find out more about being a freelancer on Upwork and I am excited to be able to share my experience here on Dev. Thank you for reading and cheers!

#currency #upwork
C++
Tags: cpp, beginners, programming
Published: 2023-03-08 18:48:03

C++ ga kirish Cpp ozi eski tillardan biri bolib uni hozir kop dasturchilar xozirgacha ham ishlatishadi.Bu qiyin va mukammal tillardan biriga hisoblanadi.C++ kop proektlar qilsa boladi, 
c++ tilini kopincha dasturlash sohasiga endi kirib kelgan das-
turnchilar boshlaydi.C++ bu C oilasiga mansub til hisoblanadi.
Constanta
Tags: cpp, programming, beginners
Published: 2023-03-08 18:40:59

consatnta:

const - constanta - o'zgarmas. Agar o'zgaruvchi yaratib olib uni constanta qilib olsa va uni boshqa narsaga tenglashtirsa u o'zgarib qolmaydi.
Misol uchun:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2wf9fdt2vmxtjkxt8fqf.png)
Testmail.app visual inbox
Tags: javascript, react, node, tempmai
Published: 2023-03-08 18:40:47

any one can use this project for get temporary mail
This is the open source temp mail project.
You can use your testmail.app api key and namespace in this interface.

This project is for create unlimited temporary mail. and can see the receiving mail in this web site.
if this project is helpful you can give me star in my github project
can you clone the project Link: https://github.com/annise-arif/temp-mail.
My experience so far in Tech
Tags: wecoded
Published: 2023-03-08 18:38:53

<!-- ✨This template is only meant to get your ideas going, so please change/add/remove these prompts as you wish! ✨ -->

## I pledge to embrace equality in tech by not discrimating against any gender and be accommodating enough to positively impact as many who has interest in making a space for themselves in the tech world.

## My experience so far in the course of learning how to code has been amazing. I've had great people around me who have been interested in my growth and have greatly impacted me, and also encouraged me that I can be a woman of value in the tech world. 

## One of the biggest obstacles to gender equality in the tech industry is undermining the lengths to which the power of passion and dedication can take a person regardless of the person's gender.

## Diversity and inclusion initiatives have positively impacted my learning process and I do not feel inferior to other by believing that I can be all that I want to be if I set my heart to it and put in the work.

## I will commit to educating myself about frontend development and also how to make a space for myself in the tech world and be a woman of value.

<!-- Once your post is published, it will not appear on the /t/wecoded page until an admin approves it. This is an extra step to ensure there is no abuse on this important tag. -->
Deploy express server in 8 simple step using firebase
Tags: node, firebase, javascript, devops
Published: 2023-03-08 18:23:11

I wanted to create a web server but don't wanted to go with AWS so I checkout firebase and here is how I created api using firebase function and deploy it to live.

To configure an Express server for Firebase Functions, follow these steps: 

1- Create a Firebase project: Go to the Firebase Console (on the top right you can see the console button.

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


2- create a new project, and give it a name. 

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


3- Install Firebase CLI in your terminal : Enter the Firebase CLI with the following commands: Copy code 

`npm install -g firebase-tools`

4- Start Firebase project: In the 
terminal, navigate to the root directory of your Node.js project and run the following commands use the following:

`firebase init`

5- Follow the prompts to start your Firebase project. Select the Firebase features you want to use and select the Firebase project you created earlier. 

6- Install Express: Install Express using the following command: `npm install express `

7- Configure the Express server: Create a new file called index.js in your project directory and add the following code: 

`const express = require( 'express' . ); 
const app = show(); 
// Define your API methods here app.get('/hello', (req, res) => { res.send('Hello from Express!'); 
});
exports.api = functions.https.onRequest(app);
`

8- Deploy the Express server: Deploy your Express server to Firebase using the following command:
`firebase deploy --only functions`

Once your Firebase project is deployed, you should be able to access your Express server endpoints using the URL provided by the Cloud Functions. For example, we have created a route at /hello, you can access it at 
`https://<your-region>-<your-project-id>.cloudfunctions.net/api/users` 

**Note:** that you may need to configure CORS headers in your Express app to allow cross-origin requests.
.NET Monthly Roundup - February 2023 - .NET 8 Preview 1, New Visual Studio features, and more!
Tags: dotnet, visualstudio
Published: 2023-03-08 18:20:45

{% embed https://www.youtube.com/watch?v=LPFE-4nO8e0 %}

Welcome to our February .NET Monthly Roundup with Jon Galloway! In just 3 minutes, Jon breaks down the latest news from the month of February 2023 that .NET developers need to know.

### Top links
📚[All the links](http://aka.ms/dnmr-2302)

### 🔥.NET 8 Preview 1
➡️ [Announcing .NET 8 Preview 1](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-1/) 
➡️ [ASP.NET Core updates in .NET 8 Preview 1](https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-1/)
➡️ [EF Core 8 Preview 1: Raw, lazy, and on-time](https://devblogs.microsoft.com/dotnet/announcing-ef8-preview-1/)

### 🎁Visual Studio updates
➡️ [Visual Studio 2022 - 17.5 Released](https://devblogs.microsoft.com/visualstudio/visual-studio-2022-17-5-released/)
➡️ [Try Visual Studio 2022 v17.6 Preview 1](https://devblogs.microsoft.com/visualstudio/try-visual-studio-2022-v17-6-preview-1/)

### 📰Other cool news
➡️ [Sentence Similarity in ML.NET Model Builder](https://devblogs.microsoft.com/dotnet/sentence-similarity-mlnet-model-builder/)
➡️ [Updated Modern Code Generation for WinForm's InitializeComponent](https://devblogs.microsoft.com/dotnet/winforms-codegen-update/)
➡️ [Upgrading your .NET projects with Visual Studio](https://devblogs.microsoft.com/dotnet/upgrade-assistant-now-in-visual-studio/)
➡️ [Announcing the reliable web app pattern for .NET on App Service](https://techcommunity.microsoft.com/t5/apps-on-azure-blog/announcing-the-reliable-web-app-pattern-for-net/ba-p/3745270)
➡️ [Announcing NuGet 6.5 – The Sweetest Way to Manage Your Packages - The NuGet Blog](https://devblogs.microsoft.com/nuget/announcing-nuget-6-5-the-sweetest-way-to-manage-your-packages/)

### 📺Top videos
➡️ [ASP.NET Community Standup - Blazor United in .NET 8](https://www.youtube.com/watch?v=kIH_Py8ytlY)
➡️ [.NET Data Community Standup - SQLite with .NET and EF Core](https://www.youtube.com/watch?v=n3Tt0F4g4is)

### 🌐Community news
➡️ [.NET Foundation news and updates from February](https://mailchi.mp/dotnetfoundation/february2023)
➡️ [WeAreDotnet - Coming soon](https://www.wearedotnet.io/)

### What did you think?

With so much new information coming at you each month, we're looking at ways to bring you the highlights. Let us know if this helps, and how we can do it better next month!

Jon
If anybody is kind here please any give a second hand laptop I will that money when get tech job For me...
Tags: javascript
Published: 2023-03-08 17:59:44

<!-- ✨This template is only meant to get your ideas going, so please change/add/remove these prompts as you wish! ✨ -->

## I pledge to embrace equality in tech by...

## A validating experience I had in the workplace was...

## One of the biggest obstacles to gender equality in the tech industry is...

## Diversity and inclusion initiatives have positively impacted my workplace by...

## I will commit to educating myself about...

<!-- Once your post is published, it will not appear on the /t/wecoded page until an admin approves it. This is an extra step to ensure there is no abuse on this important tag. -->
CoffeeCoffeeCoffee
Published: 2023-03-08 17:59:36

For this project I wanted to create a web application that would allow users to keep track of the espresso they brew. A user would be able to add a brewing entry, edit the brewing entry and include information about the equipment used. A user would also be able to add comments to the entry.

Models

User has_secure_password has_many :brews has_many :comments has_many :brew_comments, through: :brews, source: :comments

Brew belongs_to :user belongs_to :equipment has_many :comments has_many :users_commented, through: :comments, source: :user

Comment belongs_to :user belongs_to :brew

Equipment has_many :brews

rails generate resource

I wanted to allow the user to add information about the equipment they used to brew the coffee. I created another migration Equipment that had accepted brand_model as a string.

OmniAuth I used this [blog post](https://medium.com/swlh/google-authentication-strategy-for-rails-5-application-cd37947d2b1b) to setup a social login for my web application. I followed the instructions by creating an app in Google Developers Console and started the rails server to make sure it was working properly so far. I received the following error: ` No route matches [GET] “/auth/google_oauth2`. After checking for spelling errors in the routes and views I checked the authorized redirect URIs I had listed in the credentials section of the Google Developers Console. I was finally able to find a Stack Overflow [question](https://stackoverflow.com/questions/65783394/no-route-matches-get-auth-google-oauth2-error-keeps-coming-up) with a similar issue. The suggested [solution](https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284) was to add:

# Gemfile
```
gem 'omniauth-rails_csrf_protection'
```

The next step entailed changing links to POST requests:

```
link_to "Log In with Google", "/auth/google_oauth2", method: :post
# or
button_to link_to "Log In with Google", "/auth/google_oauth2"
```
The code above worked! I ran the rails server and I didn’t get the error I kept getting earlier.
Moving from app dev to web dev. How much do you have to know to get started?
Published: 2023-03-08 17:58:17

Hi-
I'm looking to move from 5 years C# desktop app development to the web. After taking some online courses in HTML, CSS, JS, it looks like the web is an endless entity. Can someone guide me on what specific abilities I need to have in order to land a Jr. web dev position? I would assume employers want a mix of front and backend skills. Thank you.
Local Storage Bookmark Manager
Tags: react, localstorage, recoil, typescript
Published: 2023-03-08 17:53:18

Hey, I developed this bookmark manager using **React** (ts), **local storage** and **Recoil**. You can do **CRUD** operations on it.

Bookmark Manager URL - https://all-2-0-react-frontend.vercel.app


>_Using a bookmark manager can save you time and frustration by keeping all your important links in one place._
**-Chat GPT**


Feel free to use and give feedback about it.

Thank you.
  **-Metal**
🚀Using !! in Javascript
Tags: webdev, javascript, programming, beginners
Published: 2023-03-08 17:35:18

In JavaScript, the "**not not**" operator, also known as the _**double negation operator**_, is denoted by two exclamation marks (**!!**). It is a unary operator that _converts any value to its corresponding boolean value_.

## How it Works?

Well, the **!!** operator works by first converting the operand (your value) into a **boolean**. It then negates this value and negates it again, resulting in a `boolean` that reflects the truthiness of the original value.

Let's take a look at the following example:
```javascript
let x = 5;
let y = !!x;
console.log(y); // true
```

Here, the value of `x` is first converted to a `boolean`, and since `x` is a non-zero number, it is _truthy_, so the first negation results in `false`. `The second negation` then negates this value again, resulting in `true`.

## Practical Uses

Let's take a look at the following example:
```javascript
let username = "";
if (!!username) {
  console.log("Welcome, " + username);
} else {
  console.log("Please enter a username");
}
```

Here, the **!!** operator is used to check if the username variable is truthy or falsy. If it is falsy (in this case, an empty string), the else block is executed, prompting the user to enter a username. If it is truthy, the if block is executed, welcoming the user with their username.

Wanna try it yourself? What would the result of the following expressions:

`!![]`
`!!{}`
`!!null`
`!!"foo"`
`!!-1`

## Conclusion 🏁
Unless you have been using JavaScript for a while this will probably look like some advanced magic but a quick way to remember this is that, **!!** it's just a shorthand way to **convert any value** to a **boolean**.

This operator is a powerful and it can be particularly useful when dealing with certain validations, also, it is a definition commonly asked nowadays in interviews so make sure to keep it present (also, using it will make you look cool).

**_Happy learning and thank you for reading!_**

_If this article was helpful to you, don't forget to hit that ❤️ button and support me with a follow, i will keep posting more content about tech, programming, career development and more! :)_
Subscribing to server sent events with Angular
Tags: sse, angular, javascript
Published: 2023-03-08 17:16:32

In this article, I will cover how to subscribe to [server sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) from an Angular application. 

> Server sent events allow servers to send data to clients by pushing messages to the them.

Starting from a running angular application and assuming we are using [mercure](https://mercure.rocks/) as a backend, let's add all we would need to subscribe to sse topics.

### Creating the models

```typescript
  export interface User {
    name: string;
    id: string;
  }

  export interface Topic {
    getTopic(user: User): string;
  }

  export class PaymentTopic implements Topic{
    getTopic(user: User): string {
      return 'https://topics.domain.com/' + user.id + '/payments';
    }
}
```

Above we can see three models:

- **Interface user**: Holds user data 
- **Interface topic**: Declares _getTopic_ method
- **Class PaymentTopic** : Implements Topic interface (represents a topic to subscribe to).

> PaymentTopic returns a topic url with the user id. It would allow us to subscribe users only to their payments.

### Creating the service to subscribe to topic

```typescript
  export interface MessageData {
    status: string;
    message: string;
  }

  export class SseService {

    constructor() { }

    createEventSource(user: User, topic: Topic): Observable<MessageData> {
      const topicUri = topic.getTopic(user);
      const eventSource = new EventSource(environment.sse_url + '?topic=' + topicUri);

      return new Observable(observer => {
          eventSource.onmessage = event => {
            const messageData: MessageData = JSON.parse(event.data);
            observer.next(messageData);
        };
      });
   }
}
```

Method _createEventSource_ receives a user and a topic (any class which implements _Topic_ interface) and uses [_EventSource_](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) to subscribe. It will return an Observable which keeps listening to onmessage EventSource event and notifies received message to the element subscribed to it.

### Creating the component and using the service

```typescript
export class SseComponent implements OnInit {

  constructor(private sseService: SseService) { }

  ngOnInit(): void {
    const user: User = {
      id: '65PRG6RD0C87KAQV8RS8H5HHBR',
      name: 'Jose'
    };

    const topic = new PaymentTopic();
    this.sseService.createEventSource(user, topic).subscribe(
      (e: MessageData) => {
        console.log('Message received: ' + e.message);
      }
    );


  }

}
```
As we can see, SseComponent injects SseService and uses it to subscribe to payment topic. When server pushes a message to the topic it will be logged on the browser console.