teleren/devto huggingface dataset:
Why I use k_board instead of termion 💻
Tags: rust, terminal, programming, software
Published: 2023-10-15 23:26:16

I used to use Termion for managing my dynamic menus, but the truth is that the crate's weight was too much for my production projects.

While searching on the official crates.io website, I came across a crate that served the same purpose as Termion but was lighter and had a lower-level logic. I'm talking about [k_board](https://crates.io/crates/k_board).

I compared them in terms of syntax, and I find k_board even more comfortable than Termion.

Official termion example in crates.io:

```rust 
fn main() {
    let stdin = stdin();
    let mut stdout = MouseTerminal::from(stdout().into_raw_mode().unwrap());

    write!(stdout, "{}{}q to exit. Click, click, click!", termion::clear::All, termion::cursor::Goto(1, 1)).unwrap();
    stdout.flush().unwrap();

    for c in stdin.events() {
        let evt = c.unwrap();
        match evt {
            Event::Key(Key::Char('q')) => break,
            Event::Mouse(me) => {
                match me {
                    MouseEvent::Press(_, x, y) => {
                        write!(stdout, "{}x", termion::cursor::Goto(x, y)).unwrap();
                    },
                    _ => (),
                }
            }
            _ => {}
        }
        stdout.flush().unwrap();
    }
}

```

Official k_board example in crates.io:

```rust
fn main() {
    std::process::Command::new("clear").status().unwrap();
    println!("[*] I use k_board lightweight software");
    println!("[ ] I use heavyweight software");
    for key in Keyboard::new() {
        match key {
            Keys::Up => {
                std::process::Command::new("clear").status().unwrap();
                println!("[*] I use k_board lightweight software");
                println!("[ ] I use heavyweight software");
            }
            Keys::Down => {
                std::process::Command::new("clear").status().unwrap();
                println!("[ ] I use k_board lightweight software");
                println!("[*] I use heavyweight software");
            }
            Keys::Enter => {
                break;
            }
            _ => {}
        }
    }
}
```

I've done a comparison between the two, and I'm making the information available to you.


|Topic  | termion 2.0.1 | k_board 1.1.3|
|----------|----------|----------|
| Size    |   [22.9 KiB](https://crates.io/crates/termion/2.0.1) | [15.9 KiB](https://crates.io/crates/k_board/1.1.3)   |
|"hello world" size compiled|19MB|4,7MB|
| Dependencies    | [5](https://crates.io/crates/termion/2.0.1/dependencies)   | [0](https://crates.io/crates/k_board/1.1.3/dependencies)   |
| License    | [MIT](https://crates.io/crates/termion/2.0.1)   |  [GPLv3](https://crates.io/crates/k_board/1.1.3)        |
[off-topic] Top 5 Playlists Que Eu Escuto Enquanto Estou Programando
Tags: playlist, braziliandevs
Published: 2023-10-15 23:11:37


Hoje vou trazer algo meio aleatório aqui 😅 mas é que eu curto muito codar escutando música _~~(e fazer tudo também)~~_. Então, pensei: por que não criar um post no dev.to para compartilhar as playlists que costumo ouvir enquanto estou programando ou até mesmo criando conteúdo. 

Eu vou indicar músicas rap/trap que geralmente é estilo de música que eu mais escuto. 

Vou fazer um top 5 aqui 💟

1. [Alee](https://open.spotify.com/intl-pt/artist/6rk6Izp6o42fUdE0jRqAP4?si=XicjNFFITbCevyN55jybTA) Esse artista maravilhoso que na verdade não é nem o álbum, geralmente dou play em todas, descobri ele faz pouco tempo.
2. [Flora matos - Do Lado De Flora](https://open.spotify.com/intl-pt/album/4GWoodiAMapPzgitxYvygx?si=3C6Z5ekFQoiKvIUTs9fOfg) A verdade é que a Flora se encaixa em todos os momentos da sua vida, mas esse álbum "DO LADO DE FLORA", é perfeito pra codar!
3. [Tasha e Tracie - Diretoria](https://open.spotify.com/intl-pt/album/062ycDqIDtT21UFyKlHDvO?si=oG6L3IfzSb2GPjSgP9t5VQ) Maravilhosas, se você quer se sentir incrível e determinado a resolver TODO e QUALQUER bug, escute Tasha e Tracie.
4. [Nill - Regina](https://open.spotify.com/intl-pt/album/04zQ2qk2AsRPZppeI6TvWl?si=s951N5UCQDe-BHZi_n0K3A) Ai esse álbum, tenho poucas palavras pra ele pois amo demais!
5. [Boombap](https://open.spotify.com/playlist/1g4Bekw7Xnq2AV7Md9XFZE?si=559e07af66f84d23) Essa playlist de Boombap simplesmente perfeita, eu ultimamente to viciada nela escutando 39393x por dia!

_Tudo que eu recomendei aqui tem o selo Ana Laura de qualidade, faça bom proveito!_

`bjs!`

<img src="https://media.giphy.com/media/dhqoWmDRG3MeXwVTK5/giphy.gif" />
Postmortem: Outage Incident on Thavmasios Online Store
Tags: postmortem, webdev, programming
Published: 2023-10-15 22:51:00

The Slightly Inconvenient Flash Sale Day
Duration: June 20, 2023, 10:30 AM - June 20, 2023, 1:45 PM (UTC)

Impact: Imagine Black Friday, but on a random Tuesday. Thavmasios Online Store experienced a partial outage, leaving around 35% of our dear customers experiencing service hiccups. It was like Black Friday decided to sneak up on us incognito.

Root Cause: Our store couldn't handle the rush of shoppers during an unexpected flash sale. In simple words, it's like your kitchen sink getting clogged because someone decided to wash a whole watermelon down it.

Timeline:
- 10:30 AM (UTC): Oh, the horror begins! Our monitoring dashboard showed errors and latencies rising like your electricity bill in winter.
- 10:35 AM: Bam! An automated alert woke up our sleepy engineers.

- 10:45 AM: Our tech superheroes grabbed their capes (or in this case, laptops) and began investigating.

- 11:00 AM: Our initial suspect? The database, feeling a bit overwhelmed by all the attention. We thought, "Maybe it needs some more friends," so we scaled it up.

- 11:30 AM: Despite our efforts, our database didn't seem satisfied. It was a real diva, still causing trouble.

- 12:00 PM: With a raised eyebrow, we turned our gaze towards the load balancer. Was it lost in a maze? We thought, "Maybe it's routing everyone to Narnia?" So, it was reconfigured.

- 1:00 PM: The load balancer looked innocent, so we sent our distress signal to the infrastructure team.

Resolution:
Root Cause: Our lovely website, unprepared for stardom, couldn't handle the sudden rush. It was like trying to fit an elephant through your front door.

Resolution: Finally, we got our act together. We optimized the database, introduced caching like it's a treasure hunt, and upgraded the load balancer to work faster than a caffeine-loaded squirrel.

Corrective and Preventative Measures:
Improvements:
- We're introducing auto-scaling, like an all-you-can-eat buffet, for critical systems to handle traffic bursts.
- Our monitoring is getting an upgrade, so we can spot traffic storms on the horizon and batten down the hatches.
- Database queries are going on a diet and hitting the gym. They need to be lean and mean.
- We're giving our servers a superhero sidekick in the form of a failover mechanism.

Tasks:
- Auto-scaling solutions are being rolled out for our infrastructure components.
- We're boosting monitoring and alerting for swift responses during traffic spikes.
- A database performance review is underway, along with query optimizations.
- A failover mechanism is being documented and put in place, just in case things get a bit too exciting again.

Conclusion:
This incident was a wake-up call, like coffee spilled on your favorite book. We're taking steps to ensure our store can handle even the wildest shopping sprees. 



So, fear not, dear shoppers! The Thavmasios Online Store is evolving to provide a smoother shopping experience, even during the most unexpected shopping extravaganzas.
Terminal Game Project: Escape the Dungeon
Tags: python, beginners
Published: 2023-10-15 21:59:40

Hi all!

My name is Tim and I'm learning Python via Codecademy. I just finished my first python project, which was to make a little terminal game.

My game is called "Escape the Dugeon." It was mostly inspired by my love of escape rooms and classic RPG games like Dungeons and Dragons. I learned a lot creating this game. As I was doing a final pass over all the code and cleaning things up, I realized that I had already learned a dozen different ways that I could have made things more efficient. This was a really fun little project!

Here's a link to the Github project page for it:
https://github.com/EldritchTiminy/Escape.the.Dungeon.git

This was coded in python 3, so you will need that installed to run the program.

Thanks for taking the time to check it out!
Toggling Mobile Navigation Visibility with CSS: The Checkbox Hack
Tags: webdev, beginners, css, frontend
Published: 2023-10-15 21:33:30

In a mobile-first world, creating an intuitive and responsive navigation menu is crucial. The checkbox hack allows you to develop mobile flyout menus without JavaScript. This article will guide you through developing several styles of mobile navigation menus using the checkbox hack.

## Basics of Checkbox Hack

The checkbox hack is based on three components:

1. A **`<label>`** element.
2. An associated **`<input type="checkbox">`**.
3. A CSS rule that targets the **`:checked`** state of the checkbox.

The idea is to toggle the checkbox state by clicking on the label, and then using the **`:checked`** CSS pseudo-class to style or reveal a sibling element.

## Basic HTML Structure

```HTML
<input type="checkbox" id="menuToggle">
<label for="menuToggle">☰ Menu</label>
<nav>
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">Portfolio</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Contact</a></li>
  </ul>
</nav>
```

## Different Styles of Menus

**Side Menu (Left to Right)**

```CSS
nav {
    position: absolute;
    top: 0;
    left: -300px; /* width of the menu */
    width: 300px;
    height: 100vh;
    transition: 0.3s;
}

#menuToggle:checked + label + nav {
    left: 0;
}
```
{% codepen https://codepen.io/joxx/pen/ZEVNxdb %}

**Sliding Menu (Top to Bottom)**

```CSS
nav {
    position: absolute;
    top: -100vh;
    left: 0;
    width: 100vw;
    height: 100vh;
    transition: 0.3s;
}

#menuToggle:checked + label + nav {
    top: 0;
}
```
{% codepen https://codepen.io/joxx/pen/xxmNWBg %}

**Splash Menu (Centered)**

```CSS
nav {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 80vw;
    height: 80vh;
    transition: 0.3s;
    background-color: rgba(0,0,0,0.7);
    color: white;
    border-radius: 15px;
}

#menuToggle:checked + label + nav {
    transform: translate(-50%, -50%) scale(1);
}
```
{% codepen https://codepen.io/joxx/pen/MWZZejp %}

## Enhancements and Notes

- You can further style the label as a hamburger icon, and change it to a close icon when the menu is open using CSS.
- For better accessibility, ensure to provide fallbacks or alternatives for users who may not be able to interact with this kind of menu.
- Although the checkbox hack is clever and works in most modern browsers, for more complex interactions or larger projects, JavaScript frameworks or libraries might be more suitable.

## Conclusion

The checkbox hack offers a lightweight method to create interactive components without relying on JavaScript. Whether you choose a sidemenu, a top-down sliding menu, or a splash menu, you can achieve a smooth user experience on mobile devices. Experiment with styles and transitions to fit the look and feel of your website!
Dia 11 - #100DaysOfSwift
Tags: ios, swift
Published: 2023-10-15 21:20:58

#Protocolos
São uma forma de descrever quais propriedades e métodos algo(structs, classes, enums) deve ter, então quando escrevemos um código dizendo que algo conforma com um protocolo o Swift vai fazer com que implementemos todas as propriedades e métodos que existem nesse protocolo. É uma forma de tratar dados de uma forma mais geral.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ro0wu7qnlpi5hps1slr8.png)<figcaption>Método **comprar** que só permite livros como parâmetro</figcaption>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dg94atat0zegdxxcs765.png)<figcaption>Método **comprar** que aceita qualquer item que conforme com o protocolo **Adquirivel** como parâmetro</figcaption>

Assim como as classes, protocolos podem herdar de outros protocolos, isso ajuda a diminuir duplicação de código e a adicionar restrições quando necessário.

---

#Extensions
Permitem adicionar métodos à tipos existentes pra fazer coisas que eles não foram criados originalmente pra fazer.

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

Outro uso para extensions é organização de código.
**Conformance grouping** é quando se adiciona uma conformidade de protocolo a uma extensão, adicionando todos os métodos necessários dentro dela.

**Purpose grouping** é quando se cria extensões para realizar tarefas específicas.

---

#Protocol extensions
São como extensions normais, mas ao invés de estender um tipo específico como Int, podemos estender um protocolo inteiro para que todos os tipos em conformidade recebam as alterações.

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

Protocol extensions podem fornecer implementações pros métodos dos nossos próprios protocolos, permitindo o uso da técnica de programação orientada à protocolo.
COMPLETED HACKTOBERFEST #OPENSOURCE
Tags: hacktoberfest23, hacktoberfest, opensource, productivity
Published: 2023-10-15 21:19:42

**IF YOU WANNA CONNECT WITH ME FOR A PROJECT REGARDING WEBDEV**
_CONTACT ME ON mavrickrishi@gamil.com_
[GITHUB PROFILE LINK](https://github.com/MAVRICK-1)
Frontend face-off: React vs. Vue in 2023
Tags: vue, webdev, javascript, react
Published: 2023-10-15 21:12:00

Hey, listen up! The web dev landscape's buzzing, and there's a rumble in the jungle between React and Vue. Yeah, you heard me right. As we hit 2023, the question on everyone's lips is: React or Vue? So let's settle the score, shall we?

## The speed factor

First off, let's talk about performance. React's got Fiber, and Vue 3's got its Composition API. Both are zippy, but React edges ahead for large scale apps. It's like having a sports car that also handles like an SUV—best of both worlds.

## Learning curve

Vue often gets kudos for being beginner-friendly. It's like the welcoming neighbor who brings you a plate of cookies on your first day. React? More like the guy who challenges you to a chess match—you'll learn, but you've gotta work for it.

## Ecosystem and Community

React's got the backing of Facebook, and a colossal community to boot. Vue's the indie darling that could, propelled by the community's sheer willpower. Both have matured, but React's ecosystem is like a sprawling city while Vue's is more like a tight-knit town.

## Flexibility vs. Opinionation

Vue guides you like a GPS with a set path, while React is like a compass—you choose the direction. For structured minds, Vue's a godsend. For the free spirits, React's your canvas.

## State Management

You ever wrestle with state management? Of course, you have. React gives you options like Redux, MobX, or even WebCrumbs (wink, wink). Vue has Vuex, which works seamlessly but gives you fewer paths to wander down.

## Future-Proofing

Both libraries are evolving, but React's growing integration with server-side rendering and motion UI is a glimpse of the future. Vue's catching up but at a 'Sunday stroll' pace.

## So, who wins?

Look, there's no definitive winner here. It's like asking someone to choose between pizza and tacos. What it boils down to is personal preference, project requirements, and how you groove with the community.

### Curious about making React development easier?

Head over to the [WebCrumbs GitHub repository](https://github.com/webcrumbs-community/webcrumbs). Join a growing community of developers who are taking React to the next level. No kidding, we're the shortcut you've been looking for.

{% embed https://github.com/webcrumbs-community/webcrumbs %}
My Hacktoberfest 2023 Pledge
Tags: hacktoberfest23, hacktoberfest, beginners, hackathon
Published: 2023-10-15 21:05:44

Hacktoberfest 2023: An Amazing Experience

Hacktoberfest 2023 was an amazing experience. I had the opportunity to contribute to several open source projects, learn new skills.

As a beginner in programming, Hacktoberfest was a great opportunity to start contributing to open source projects. I chose projects that were relatively simple, but still challenged me. It was a great way to learn how to use new features and techniques.

In addition to learning, I also had the opportunity to meet people from all over the world. Hacktoberfest is a global event, and I was able to interact with people from different countries. It was a very enriching experience, and helped me learn about different cultures and perspectives.

Some of the things I learned during Hacktoberfest:
- How to write quality code
- How to work in a team
- How to collaborate with people from all over the world

Some of the things I thought were the coolest about Hacktoberfest:

- The opportunity to learn new skills
- The chance to meet people from all over the world
- The feeling of seeing my work being used by other people

If you are thinking about participating in Hacktoberfest, I highly recommend it! It is an amazing experience that will help you grow as a developer.
What is Open Source
Tags: opensource, beginners, newbie, hasanelsherbiny
Published: 2023-10-15 21:00:00

## What Is Open Source?
Open source software is a software whose source code is made available to the public, allowing anyone to view, use, modify, and distribute it
The most important thing of open source software is that it is released under a license that grants these freedoms. 
this concept is based on the principles of collaboration - transparency and comunity drven development.

## Benefits Of Opensource
- Free Redistrbution : Users are free to share  and copy open source software without restrictions.
- Source Code Access: The source code of the software is public and accessible,allowig users to understand how the software works and make modificatons if they want
- derived Works: Users can create new works by modifying the original source code.
- no Discrimination: Open source licenses do not discriminate against individuals or groups  ensuring equal access and usage rights
- integrity of the Author's Source Code: Derived works must acknowledge the original author's work and cannot misrepresent it
- no Restricions on Usage: Open source software can be used for any purpose  including commercial applications.

## Why you should go for open source?

- innovation: Open source has baved ground for innovation. 
It allows developers from around the world to collaborat on projects, leading to the creation of cuttingedge solutions and technologies.

- cost Savings: Organizations can leverage open source software to reduce licencing costs and build powerful solution without the burden of high fees
- community Collaboration: Open source foster collaboration within a global community of developers, leading to rapid development and improvement of software

- customization: The availablity of source code enables users to tailor software to meet specific needs
- Transparency: The transparency of open source code provides a higher level of trust and security as users can inspect the code for vulnerabilities
- Education: Open source software serve as an educatinal resource, allowing developers to learn from the work of others and share their knowledge

## Things To be aware of
when choosing open source there are some concerns you should have

- Maintainers' Burnout: Maintaining open source projects can be overwhelming for individuals, leading to burnout and project abandonment
- Licensing Complexities: Understanding and complying with open source licenses can be challenging for both developers and organizations
- Security Concerns: Open source software is not immune to security vulnerabilities, and maintaining up-to-date, secure code can be a significant task
Meditação no cotidiano com Convidadas - Meditantes PodCast #2
Published: 2023-10-15 20:48:17

Meditação no cotidiano com Convidadas - Meditantes PodCast #2

No ar o segundo episódio do Meditantes PodCast com apresentação de Domício Shanti-Rham e participação de convidados. 

Ouça, veja, curte, participe, compartilhe... 

Saiba mais em: https://youtu.be/-D0r_Lc9bos

#meditação #méditer #meditation #meditazione #meditación #nachdenken #meditar #muse #meditativo #meditantespodcast #meditantes #podcast #shantirham


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r2lz5jty2xpnz1euiqcb.jpg)
Docker Memo -MySQL
Published: 2023-10-15 20:43:14

## Goal
I just need a MySQL instance for development purpose, but with persisted data.

## Storage
There are 2 ways to persist MySQL data, [docker volume](https://docs.docker.com/storage/volumes/), or mount a directory on the host machine. For my purpose, I use docker volume.

## Create Volume
``` bash
$ docker volume create sumpdatavolume
$ docker volume ls
(... snip ...)
local     sumpdatavolume
```

### Run MySQL
Run MySQL, create a test db and table.
``` bash
$ docker run --name sumpdatamysql -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=myrootpswd -v sumpdatavolume:/var/lib/mysql mysql
$ docker exec -it sumpdatamysql bash
bash-4.4# mysql -pmyrootpswd
mysql> create database test;
use test;
create table test(id int, name varchar(10));
insert into test(id, name) values (1,"John"), (2, "Mike");
select * from test;
+------+------+
| id   | name |
+------+------+
|    1 | John |
|    2 | Mike |
+------+------+
```

### Check persistent data

Remove the existing container and recreate MySQL using the same docker volume.
``` bash
$ docker stop sumpdatamysql
$ docker rm sumpdatamysql
$ docker run --name sumpdatamysql -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=myrootpswd -v sumpdatavolume:/var/lib/mysql mysql
$ docker exec -it sumpdatamysql bash
mysql -pmyrootpswd
use test;
select * from test;
+------+------+
| id   | name |
+------+------+
|    1 | John |
|    2 | Mike |
+------+------+
```
As shown above in `select` statement, the same data is there.
What's this hype about AI?
Tags: ai, discuss
Published: 2023-10-15 20:35:23

Everybody seems to be talking about AI as if it is the end of everything. I found this article on [AI Solutions](https://itsallaboutai.com/ai-solutions-101/), and it seems to focus on AI making things better. 

What are your thoughts on AI? How are you using it within your business?