teleren/devto huggingface dataset:
Aprenda como salvar uma "parte"(versão) do seu projeto no Github
Tags: git, tag, beginners, tutorial
Published: 2023-10-15 20:12:36

Se você, assim como eu, estuda programação fazendo vários projetos práticos, salvar cada parte(**versão**) vai ajudar a aumentar a sua produtividade. Cada versão será criada, através das chamadas **tags**, muito utilizada em projetos do mundo real.

Por exemplo, eu tenho 4 partes de um projeto:

- Construir a parte relacionada a Services, Context, Models, Controllers da Rest API;
- Implementar a autenticação JWT na API;
- Construir a interface do front-end com React.js e Tailwind CSS;
- Consumir a API utilizando axios utilizando React.js;

Ufa! É tanta coisa que dá pra se perder em onde começa e termina nosso projeto.


## Então, vamos salvar a primeira versão do projeto:


- Antes de tudo, tenha certeza que você já subiu as **mudanças** do seu projeto **para** a **master** lá no **repositório** **remoto**(origin). Se tu já **enviou**, vá para o **segundo passo**. 
Se não, na pasta do seu projeto abra o terminal ou git bash e digite os códigos abaixo:


```
git add .
```
```
git commit -m "Adiciona sua mensagem"
```
```
git push
```

---


- Verifique qual foi seu **último commit** e **copie** o **nome** dele com o comando abaixo. 


```
git log --oneline | nl
```

Fiz uma tabela que explica o comando anterior. 
O último commit feito é o de nome <u>5c050cf</u> que se refere ao número 1 na tabela.

|Número|Nome do Commit|Mensagem do Commit |
|------------------|-----------|--------------------|
| 1                |<u>5c050cf</u>|Edita comentário em Program.cs                |
| 2                |a4a48fc    |Edita technologies no README.md            |
| 3                |8f04cf3    | Cria Back-End da Rest API               |
| 4                |d3880b7    | Update pic repository README.md              |
      


![ultimo commit no git](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ywwu4h82ki4bz9vqeso5.png)


---

- Crie uma **tag** com uma **vesão**(v1.0.0, por exemplo) e uma **mensagem**:

```
git tag -a v1.0.0 -m "Implementacao inicial do Back-end"
```

---

- Confira se a tag foi realmente criada:

```
git tag
```


![lista de tags criadas](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6enp7cfmc8opqccakrlw.png)


---


- Por último, envie a tag para o repositório remoto:

```
git push origin v1.0.0
```


![envia ao repositorio remoto a tag criada](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0iuay4pstvf2nyd3uahy.png)


---

## Para conferir o resultado


Vá até o repositório do seu projeto lá no Github e do lado direito da página vá até **Releases** e **clique** em 1 tags:


![releases na pagina do github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l48uldyrzzyq078da1vg.png)



![tags no github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkmcng4r2krgaawzo13v.png)

---

Bom, por hoje, é isso pessoal! Qualquer dúvida ou sugestões fiquem à vontade para comentar!
The secret sauce: How WebCrumbs makes React dev a cakewalk
Tags: react, opensource, javascript, webdev
Published: 2023-10-15 20:05:48

Hey, let me spill the beans for you. You know how React is a fantastic ecosystem, but sometimes, just sometimes, it feels like you're wading through a quagmire of repetitive tasks? Well, that's where WebCrumbs comes in. Think of it as the key to a hidden treasure chest of development magic. 🗝️✨

## Automate, don't irritate

First things first: automation. WebCrumbs aims to simplify common tasks so you can spend more time coding the fun stuff. Need a responsive nav bar or a sticky footer? One click and you're off to the races.

## Modular goodies

Say goodbye to repetitive code and hello to modular components. With WebCrumbs, you can pick from a plethora of pre-designed modules, integrate them into your project, and move on with your life. It's like a toy store for devs, and every toy works flawlessly with the rest.

## Open-source haven

Now, let's talk community. You see, WebCrumbs is not just a one-man-show; it's an ever-expanding galaxy of contributors. That means it's as versatile, dynamic, and vibrant as the people who make it better every day.

## Think Wordpress, but for React

You ever use Wordpress and marvel at how easy it is? Well, WebCrumbs aspires to bring that level of ease to React. We're talking about a transformative tool that will make you wonder how you ever lived without it.

## Why choose, when you can have it all?

Security? Check. Scalability? Check. A lively, helpful community? Double-check. WebCrumbs is the whole package. It's the swiss army knife in a toolbox of sporks.

## In conclusion

Here's the deal: WebCrumbs makes React development smoother than a fresh jar of Skippy. So why get bogged down in the weeds when you could be soaring like an eagle? Take it from me, try WebCrumbs and elevate your React game.

### Ready to dive in? 

Check out the [WebCrumbs GitHub repository](https://github.com/webcrumbs-community/webcrumbs) and contribute to the growing ecosystem. Be a part of something bigger, something better. WebCrumbs—making React a cakewalk, one click at a time.

{% embed https://github.com/webcrumbs-community/webcrumbs %}
How to connect to wifi
Tags: linux
Published: 2023-10-15 19:26:33

# Export your password

`export WIFI_PASSWORD=<your-password>`

If you don't want to see your password in bash history, just add a space before above command. This is not specific to this command, for any command in bash shell.
# How to see existing wifi list
`sudo nmcli dev wifi`
# Connect to your WiFi

`sudo nmcli dev wifi connect "<your-wifi-name-or-ssid>" password "$WIFI_PASSWORD"`
Interface Segregation Principle (ISP) in Typescript
Tags: oop, typescript
Published: 2023-10-15 19:12:12

# Interface Segregation Principle In Typescript

## Introduction

`Interface Segregation Principle` is the 4th principle of `SOLID` principles. It is also known as `ISP` principle. It was first introduced by `Robert C. Martin` in his 2000 paper `Design Principles and Design Patterns`.

## Definition

The concept is simple, make the interfaces smaller and more specific to the use case. it is better to have multiple but smaller interfaces than a single large interface.

So basically, a class should not be forced to implement an interface or methods that it does not use.

## Key Concepts Of ISP

- `Cohesion`: Interfaces should be highly cohesive. It means the interface methods should be related to each other, if they are not related then they should be separated into different interfaces.
- `Responsibility`: Interfaces should have single responsibility.

## Example

Let's take an example of a `Printer` class that can print, scan and fax. So we can create an interface `MultiFunctionPrinter` that has all the methods of `Printer` class.

```typescript
interface MultiFunctionPrinter {
  print(): void;
  scan(): void;
  fax(): void;
}
```

Now we have a `SimplePrinter` class that can only print. So we can implement the `MultiFunctionPrinter` interface in `SimplePrinter` class.

```typescript
class SimplePrinter implements MultiFunctionPrinter {
  print(): void {
    console.log("Printing...");
  }
  scan(): void {
    throw new Error("Simple Printer can not scan.");
  }
  fax(): void {
    throw new Error("Simple Printer can not fax.");
  }
}
```

This is a total violation of `ISP` principle. Because `SimplePrinter` class is forced to implement the `scan` and `fax` methods that it does not use.

## Solution

To make this run smoothly, we can separate the interface into three different interfaces.

```typescript
interface Printer {
  print(): void;
}

interface Scanner {
  scan(): void;
}

interface Fax {
  fax(): void;
}
```

Now we can implement the interfaces in `SimplePrinter` class.

```typescript
class SimplePrinter implements Printer {
  print(): void {
    console.log("Printing...");
  }
}
```

If there is advanced printer class, it can implement multiple interfaces.

```typescript
class AdvancedPrinter implements Printer, Scanner, Fax {
  print(): void {
    console.log("Printing...");
  }
  scan(): void {
    console.log("Scanning...");
  }
  fax(): void {
    console.log("Faxing...");
  }
}
```

## Conclusion

`ISP` principle is very important to make the code more maintainable and flexible. It also helps to reduce the coupling between classes and not implementing unnecessary methods.


## Following the list

You can see the updated list of design principles from the following link
https://mentoor.io/en/posts/634524154/open-closed-principle-in-typescript

Join us in our Discord Community
https://discord.gg/XDZcTuU8c8
Dia 10 - #100DaysOfSwift
Tags: ios, swift
Published: 2023-10-15 18:59:38

#Classes
Classes são bem parecidas com Structs mas tem algumas diferenças importantes:

##1. Init
Classes não tem init padrão, caso tenha propriedades na classe você sempre tem que criar o seu próprio init ao cria-la.

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

---

##2. Herança
Uma classe pode ser criada herdeira de outra classe, assim ela ganha as propriedades e métodos da classe pai; É possível adicionar novas propriedades e métodos nela.


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

Por segurança o Swift sempre nos faz usar `super. init()` em classes filho, pra caso a classe pai faça algo importante no init não tenha nenhum problema.

---

###Sobrescrever métodos
Caso queira sobrescrever algum método da classe pai é só colocar a palavra reservada `override` no início da implementação do método na classe filho.

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

---

###Final Class
Classes com a palavra `final` no início não podem ser herdadas e ter seus métodos sobrescritos, geram erro em tempo de compilação. 
`final` também pode ser usado em métodos ou propriedades pro mesmo efeito, assim deixando o resto das coisas não marcadas com comportamento padrão pra herança.

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

---

##3. Cópias
**Classes** são _reference type_, quando instanciamos uma classe a RAM aloca um espaço na memória e atribui o endereço à instância criada, objetos tipo referência apontam pro mesmo endereço de memória, por isso apontam pros mesmos dados compartilhados(mudar uma classe, muda todas), já **Structs** são _value type_, cada instância cria uma cópia exclusiva dos dados, caso uma instância seja modificada a outra não é.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z8lc4dsuxqjpgh5s8xvx.png)<figcaption>Cópia de Classe</figcaption>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d5l4ywx2ayqouc7lk4o4.png)<figcaption>Cópia de Struct</figcaption>

---

##4. Deinitializers
Classes podem ter _deinitializers_, que são métodos chamados quando uma instância da classe é destruída.

---

##5. Mutabilidade
Propriedades variáveis em Classes constantes podem ser modificadas livremente, mas propriedades variáveis em Structs constantes não podem.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3t101xbftdoxvmu03gjt.png)<figcaption>Propriedade variável sendo modificada em Classe constante</figcaption>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gd0vqap48xwjx6okpudk.png)<figcaption>Erro ao tentar modificar propriedade variável em Struct constante</figcaption>
Meeting TimeCounter
Tags: javascript, meeting, timecount
Published: 2023-10-15 18:56:06

<p><img src="https://codehouse.digfish.org/wp-content/uploads/2023/10/image-1697395777743.png" alt="file" />
Allows you to manage your meeting participation spent time through a simple web application.</p>
<p>The code is available at github. You just need to have nodeJS installed in a remote server in order to run it. Hit <code>npm run server</code> to start it!
When the application is running, go to <a href="http://yourserver:3000">http://yourserver:3000</a> and then you can create users and start and stop timing and zero it if you need it. The time values for each user are stored on the server, so if something wrong happens, like a crash or freeze, you can always visit the web app again and choose your user and the app remembers the last stored value.
Github repository url: <a href="https://github.com/digfish/meeting-timecounter">https://github.com/digfish/meeting-timecounter</a></p>
<h2>Features</h2>
<ul>
<li>Create new users easily</li>
<li>Start, stop, resume and reset the timer</li>
<li>Can see the others' users current time counts</li>
<li>Stores the time count locally and on the server</li>
<li>Allows to recover the last stored time</li>
<li>When running in multiuser, if one user starts the counter it will stop automatically the other users' counters</li>
<li>
</li>
</ul>
<h2>Limitations</h2>
<p>When openning many tabs in the browser, the browser that manages the resources the tabs use, perhaps if the tab is not on focus, will freeze it in order to use the resourcings it was using elsewhere. The server stores a new time each 2.5 seconds . If you focus again the tab, the browser will restart the counting fromt he
In mobile devices, since it has more restricted resources than desktop systems, just opening a new tab will almost for sure freeze the tab where the time counter is running.</p>
<h2>This is just a proof of concept</h2>
<p>This application was only made for fun: there isn't any user authentication involved. </p>
Docker Best Practices.
Tags: docker, devops, programming
Published: 2023-10-15 18:50:15

Docker has revolutionized application deployment, but to use its full potential, you need to follow best practices. Here's a concise guide with examples for efficient containerization.

**1. Start with Official Images:**
Use official images as a base. For instance, if you're working with Node.js, start with **node:14-alpine**.

**2. Optimize Your Dockerfile:**
Minimize your image size by chaining commands together:

![dockerfile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7x5ldpi5kg0taggzdjn8.png)

**3. Use .dockerignore:**
Create a **<u>.dockerignore</u>** file to exclude unnecessary files during build:

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

**4. Multi-Stage Builds:**
For production images, use multi-stage builds to reduce image size:
![dockerfile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xjq7nxda1cpv60me19zl.png)

**5. Environment Variables:**
Use environment variables for configurations, e.g., for a Node.js app:

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

**6. Health Checks:**
Add a health check instruction to your Dockerfile:

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

**7. Resource Constraints:**
Define resource constraints in your **Docker-Compose** file:

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

**8. Logging and Monitoring:**
Use tools like Docker logs, ELK stack, or Prometheus for comprehensive logging and monitoring.

**9. Container Registries:**
Push your <u>custom images</u> to a <u>private</u> registry:

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

**10. Versioned Images:**
Tag your images for versioning:

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

---
These best practices will help you create efficient, secure, and maintainable Docker containers, improving your development and deployment workflows. 💻
Best Deals in LocalDeals
Published: 2023-10-15 18:47:50

In a world where savings matter, LocalDeals.com stands out as your go-to destination for the best deals, offering unbeatable discounts and unrivaled savings on a wide array of products and services. If you’re on the hunt for outstanding deals, you’ve just hit the jackpot.
The LocalDeals.com Advantage
At LocalDeals.com, we’re all about connecting you with the most incredible deals right in your local area. Our commitment is to provide you with a seamless experience, exceptional savings, and the opportunity to explore local businesses like never before.
Discover Unmatched Deals
Local Favorites: From your favorite local eateries to exciting recreational activities, our deals cover the entire spectrum of what your community has to offer.
Shopping Delights: Find exclusive discounts on retail products, fashion, and more, helping you stay ahead of the trends without emptying your wallet.
Services Galore: Whether it’s home services, wellness treatments, or educational opportunities, our deals cater to your essential needs.
Adventures Await: If you’re seeking unforgettable experiences, look no further. We offer exciting adventures and getaways that won’t break the bank.
The LocalDeals.com Experience
Ease of Use: Our user-friendly platform ensures that you can quickly browse, select, and purchase deals with minimal hassle.
Savings Aplenty: We believe that everyone deserves to enjoy life to the fullest, and our deals make that possible by offering substantial savings.
Community Spirit: LocalDeals.com fosters a sense of community by connecting you with local businesses and helping you discover new favorites right in your neighborhood.
How LocalDeals.com Works
Browse: Explore our diverse range of deals, all sorted by your location and preferences.
Select: Choose the deal that excites you the most, whether it’s a fine dining experience, a spa day, or any other fantastic opportunity.
Purchase: Secure your deal with a simple click, unlocking the doors to unbeatable savings.
Redeem: Follow the provided instructions to redeem your deal with the local business and enjoy a fantastic experience.
Join the LocalDeals.com Community
LocalDeals.com is more than just deals; it’s about building a vibrant community of savvy shoppers and local businesses. Together, we’re creating a win-win scenario where everyone benefits.
Why wait when you can start saving, exploring, and experiencing more with LocalDeals.com? Your next adventure, memorable meal, or extraordinary escape is just a click away. Get ready to discover the best deals that your local community has to offer. Unleash the power of savings with LocalDeals.com today!
Visit us :-https://blog.locoldeal.com/best-deals-localdeals/
Facebook: https://www.facebook.com/locoldeal
Twitter: https://twitter.com/LocolDeal
Linkedin: https://www.linkedin.com/company/locoldeal/
Instagram: https://www.instagram.caom/locoldeal/
Sample Incident Report - The problem, The fix, The lessons
Published: 2023-10-15 18:39:10

## The Postmortem
This postmortem report summarizes the incident, its impact, the timeline of events, the root cause, resolution, and proposes corrective and preventative measures to avoid similar incidents in the future. The outage was primarily attributed to the inadvertent removal of logging functionality, highlighting the critical importance of thorough code reviews and testing to ensure the stability and reliability of production systems.

**Issue Summary:**

**Duration of the outage:** The outage lasted from 10th October 2023, 14:00 UTC to 10th October 2023, 17:00 UTC.
**Impact:** The messaging service experienced a complete outage during this period, affecting all users. Messages were not being sent out as intended, resulting in a 100% user impact.
**Root cause:** The removal of essential logging during a code refactoring resulted in an inability to trace and identify issues promptly.


**Timeline:**

**Issue detection:** The outage was initially detected on 10th October 2023 at 14:00 UTC when a customer reported an inability to receive messages.
**Detection method:** Customer complaint triggered investigation into the issue.

**Actions taken:**
- Investigated server logs on the cloud service provider to identify the cause.
- Assumed potential root causes, including network issues and server misconfigurations.

![Fixing bugs in production be like](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h9at92neks58t0febhe4.jpg)


**Misleading investigation/debugging paths:**

- Initially suspected network issues and spent time investigating network configurations.
- Considered server misconfigurations as a potential cause, leading to unnecessary debugging efforts in that direction.
**Escalation:** The incident was escalated to the senior developer in charge for further analysis and resolution.
**Resolution:** Reverted to the previous working commit, which restored the logging functionality. Identified and fixed the bug causing the outage, resolving the issue by 10th October 2023 at 17:00 UTC.

**Root Cause and Resolution:**

**Root cause:** The removal of logging during refactoring resulted in a lack of crucial diagnostic information necessary to identify and address issues promptly.
**Resolution:** Reverted to the commit before the logging removal, reintroducing essential logging. Identified and fixed the bug causing the outage, ensuring that logs were available for future incident detection and debugging.

**Corrective and Preventative Measures:**

**Improvements/Fixes:**

- Incorporate thorough testing procedures to ensure crucial functionalities like logging are not inadvertently removed during refactoring.
- Implement a review process for major code changes, especially for interns or less experienced team members.

**Specific Tasks:**
- Update the development workflow to include checks for essential features like logging to prevent accidental removal.
- Implement a training program for interns to emphasize the importance of critical functionalities like logging in a production environment.
Details about Parser
Published: 2023-10-15 18:22:02

A parser is a piece of software that, in computer science, uses a formal grammar to evaluate the structure of an input text (often code). A parser generates a parse tree, which describes the syntactic structure of the input, from a stream of tokens as the input.

**Types of Parsers**

There are two main types of parsers:
**Top-down parsers**

Starting with the start symbol of the grammar, a top-down parser applies grammatical rules to construct the input string. Because they recursively descend from the root to the leaves of the parse tree, these parsers are also known as recursive descent parsers. LL(1) parsers, which can handle both left-recursive and non-left-recursive grammars, and LL(k) parsers, which can handle ambiguous grammars, are examples of top-down parsers.

**Bottom-up parsers**

Starting with the input string, a bottom-up parser uses grammar rules to create the start symbol for the grammar. As they shift input tokens onto a stack and reduce them to grammar rules until the start symbol is formed, these parsers are also known as shift-reduction parsers. The LR(0), SLR(1), LALR(1), and LR(1) parsers are examples of bottom-up parsers that can handle left-recursive grammars.

Apache-Age:(https://age.apache.org/)
GitHub:-https://github.com/apache/age