teleren/devto huggingface dataset:
How do you curb burnouts when coding?
Published: 2023-03-20 14:45:59


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mrh8uyxvam97ux6zg5pv.jpeg)
For the past few years I’ve been able to extensively study software development and I can now deploy them to various servers. Along the way I was motivated by each step until users could access and start using these applications. 


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

It’s been very difficult lately to keep up with the pace alongside studying new technology that can easily implement new features, I drop my laptop screen after every 20 mins of coding when I stumble on an error which I do often, therefore it will really mean a lot for you to share your experience on how to stay motivated and keep up even after all this exhaustion. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2ik1p82rm41hpyode7i.jpeg)
What are your goals for the week of Mar 20-25?
Published: 2023-03-20 14:26:33

What are your goals for this week?
 
- What are you building? 
- What will be a good result by week's end?
- Are you attending any events this week?
- Did you meet your goals last week?

I'll start with how I did last week.

**Last Week's Goals**

It was Spring Break so mostly Family Time.

- [:white_check_mark:] Continue Job Search.
- [:white_check_mark:] Continue new project. Plan to wrap up Phase 1, this week.
- Blog. have stuff in draft.
- [:x:] Yard work. Did very little. Despite it being Spring Break. The temps dropped to 40s most the week. Even 30's a couple days. So I did some brush removal but not a lot.
- [:white_check_mark:] Attend Axe-Con Wed and Thursday. It was great working on a blog of some take a ways.

**Monthly Goal**

- Gain more followers here. I would like to have more followers on DEV than I had on the bird site. * Almost there, about a dozen to go. 

EDIT: DEV follower count == Bird site follower count

**This Week's Goals**


- Continue Job Search.
- Wrap up phase 1 of new project.
- Blog.
- Yard work.

**This Month's Goals**

- Gain more followers here. I would like to have more followers on DEV than I had on the bird site. 


You've read my goals so I'll throw that question back to you.

What are your goals for the week?

```
-$JarvisScript git push
```
¿Es Scrum el problema o la forma en que lo implementamos? Analogia de exploraciones
Tags: scrum, agile
Published: 2023-03-20 14:17:44

Podcast donde con 3 amigos compartimos nuestras idea de por que scrum constantemente en proyectos. son 2 horas.. pero creo que valen la pena

{% embed https://www.youtube.com/watch?v=-rhxc6mN4-A %}
Write your custom Hook
Tags: react, reactnative, hooks, javascript
Published: 2023-03-20 14:17:14

---
title: Write your custom Hook
published: true
description: Use custom hooks for your development, abstract common logic/state used across multiple Components. 
tags: react, reactnative, hooks, javascript
# cover_image: ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jh9uj6pnivy35z0x7tx3.png)
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-15 13:23 +0000
---

This is a step-by-step guide on how to create custom hooks in React. Custom hooks are a fantastic way to encapsulate logic and functionality that can be reused across multiple components in your application.

Creating custom hooks can make your code much more efficient, reusable, and easier to read. The article does a great job of breaking down the process into simple steps that anyone can follow, making it an excellent resource for React developers of all levels.

If you have common code used across multiple components. You must be wondering why need hook in the first place, why not use good old functions which are available from in Vanilla JS. 

With Hooks you can listen to events, such as is device online or offline (very useful for mobile apps), listen for window resize events or create a hook which communicates between webview.

Some of rules for writing hooks. 
1. Your hook name should shart with `use`. React have naming convention which it uses to differentiate between Components and Hooks. For ex - Component name should always start with Capital letter. 

2. Hooks only work in Functional components. 

3. Hooks do not work conditionally. For ex - you cannot put hook inside if else block. 

4. Hooks re-render with components. Every time, props or state changes, it re-renders hooks l.e hook will have latest props and state value. 


Lets build a hook which tracks cursor and returns its x and y coordinates. 

##### Step 1: Declare hook
```
import { useState, useEffect } from 'react';

function useTrackCursor() {
  const [coord, setCoord] = useState({
    x: 0,
    y: 0
  })

  useEffect(() => {
    function handleResize(event) {
      setCoord({
        x: event.pageX,
        y: event.pageY,
      });
    }

    window.addEventListener('mousemove', handleResize);
    return () => window.removeEventListener('mousemove', handleResize);
  }, []);

  return coord;
}

export default useTrackCursor;
```

##### Step 2 : Consume Hook in components. 

```
import useTrackCursor from "../hooks/trackCursor";

const HomeScreen = () => {
    const {x, y} = useTrackCursor();
    return (
        <div className="App">
            <header className="App-header">
                <p> X Co-ordinate : {x}</p>
                <p> Y Co-ordinate : {y}</p>
            </header>
        </div>
    )
}

export default HomeScreen;
```
 
Hooks let you reuse common stateful logic between different components. 

If you're interested in learning more about React, React Native and JS, check out my Linkedin profile [here](https://www.linkedin.com/in/rameshvishnoi/). And feel free to share it with anyone who might find it helpful!

Happy coding!
Como limitar o consumo de memória e processamento do WSL2
Tags: windows, wsl2, linux
Published: 2023-03-20 14:16:35

Ao utilizarmos o WSL2 no Windows, por padrão, o consumo de memória e de processamento fica sem restrição e esse comportamento pode acabar afetando o desempenho do Host.

Para contornarmos tal situação, podemos criar um arquivo de configuração chamado '.wslconfig' na pasta de usuário localizada em: `c:\users\<username>\.wslconfig`.

Agora informe as restrições desejadas conforme exemplo:

```
[wsl2]
memory=4GB # limita a memória da VM.
processors=2 # limita o uso da VM para 2 processadores virtuais
```
Após salvar as alterações, reinicie o serviço executando o seguinte comando como Administrador:

```
Restart-Service LxssManager
```

Para mais informações, consulte a documentação em: [Microsoft](https://learn.microsoft.com/pt-br/windows/wsl/wsl-config#wslconfig)
Escaping jinja2
Tags: help, jinja2
Published: 2023-03-20 14:15:23

Hello Experts,
I want to escape '\' in jinja template am using in terraform, I tried multiple ways but somehow it's not happening!
Below is the code snippet :

```
{%- if mrecords['type'] == "TXT" %}
                        {%- if mrecords['values'] is defined -%}
                            {%- set txtrecord_set = namespace(value=[]) -%}
                            {%- for txtrecord in mrecords['values'] -%}
{%- set txt_value = '"' ~ '\' ~ '"' ~ txtrecord ~ '\' ~ '"' ~ '"'  -%}                              
                                {%- set txtrecord_set.value = txtrecord_set.value | append(txt_value) -%}
                            {%- endfor -%}

```
Error:

```
Unable to parse statement "if": Unable to parse statement "for": Unable to parse statement "set": Malformed 'set'-tag args. (Line: 63 Col: 66, near "' ~ txtrecord ~ '' ~ '")
```
Como evitar SQL Injection utilizando client do BigQuery
Tags: bigquery, sqlinjection, node, javascript
Published: 2023-03-20 14:05:28

Depois que o ES6 introduziu `Template String` no Javascript, ficou muito fácil fazer interpolação de valores. Porém quando falamos em construção de queries em formato de string, utilizar essa abordagem não é tão interessante quanto se parece.

Utilizar template string na construção de queries, pode abrir uma porta muito grande para SQL injection. Temos formas de evitar isso.

Utilizando o [client BigQuery para NodeJS](https://github.com/googleapis/nodejs-bigquery), vou mostrar pra vocês 2 caminhos para escrita de queries.

### :x: Com template strings

```javascript
// Params
const gender = "M";
const states = ["WA", "WI", "WV", "WY"]
   .map((state) => `'${state}'`)
   .join(", ");

// Query
const sqlQuery = `SELECT name, sum(number) as count
  FROM \`<YOUR_TABLE_NAME>\`
  WHERE gender = '${gender}'
  AND state IN (${states});`;

// Run the query
const [rows] = await bigquery.query(sqlQuery);

console.log("Result -> ", rows);
```

### :white_check_mark: Com parameterized queries
Ref: https://cloud.google.com/bigquery/docs/parameterized-queries

```javascript
const gender = "M";
const states = ["WA", "WI", "WV", "WY"];

// Query
const sqlQuery = `SELECT name, sum(number) as count
  FROM \`<YOUR_TABLE_NAME>\`
  WHERE gender = @gender'
  AND state IN UNNEST(@states);`;

const options = {
  query: sqlQuery,
  params: { gender, states },
};

// Run the query
const [rows] = await bigquery.query(options);

console.log("Result -> ", rows);
```

Podemos setar tipos 😍
```javascript
// ...
const options = {
  query: sqlQuery,
  params: { gender, states },
  types: {
    gender: 'STRING',
    states: ['STRING'],
  },
};
// ...
```

Com parameterized queries utilizamos o client da forma correta, assim como o BigQuery recomenda e evitamos SQL injection.

Espero ter te ajudado.
How Generative AI Will Affect Website SEO Design
Tags: webdev, discuss, ai
Published: 2023-03-20 14:00:00

So you wanna make sure your website ranks high on Google? Yeah, we all do. That's where search engine optimization (SEO) comes in. But now, with the rise of generative artificial intelligence (AI), there are even more things to keep in mind when designing a website that'll rank well in search results. Basically, generative AI can create content, images, videos, and other things that look super realistic, like a human did it. I have been trying to think how this will change the way website development and content will need to evolve. There aren't a lot of hard resources to pull from, but these have been some thoughts. 

One way generative AI is changing SEO is by being able to understand natural language. Bing and other search engines are using chatbot-style technology to understand what people mean when they search for things. So, you'll want to make sure your website uses natural language in your content and metadata. That'll help it show up higher in the search results for specific stuff people are looking for.

Generative AI is also good at analyzing lots of data quickly and accurately. That's why websites that use data-driven approaches to content creation and optimization will be better off. Instead of just guessing what people like, you can use analytics tools to understand what people actually want and do on your website.

Finally, generative AI makes it possible to have more personalized search results. As AI gets better at understanding each person's preferences and behavior, search engines can deliver more relevant results. This means that websites that are optimized for individual users, rather than just generic audiences, will be more likely to rank well in the search results. You can make your website more personalized by doing things like optimizing your content, targeting keywords, and using other on-page optimization techniques.

So, that's how generative AI is changing the way we think about SEO. If you want your website to be successful in the future, you'll want to focus on natural language, data-driven optimization, and personalized content. It's important to keep up with the latest trends in AI and SEO so your website can stay ahead of the competition and rank higher in search engines.
Python Tkinter Project - Make a Number Guessing Game with Buttons
Tags: beginners, python, tkinter, gui
Published: 2023-03-20 13:28:47

Hi Welcome to this new tutorial from MOO ICT. Here we will be making a number guessing game using python and tkinter. The main feature of this game is that it will have 3 clickable buttons, each button will display random number. The computer will have a secret number variable that will contain one of the buttons random number. User will need to click on the right button to guess the computers secret number. If they do it will display a text to say you guessed it correctly if not you can continue to play. I didn’t do an end to this game on purpose so you can make it or end it anyway you want to.


Lesson objective’s –
Make a number guessing game with Python and Tkinter
Use multiple GUI components in the game
Add buttons to lists
Use random to pick a random button and pick random numbers for the buttons
Use local and global variables
Use functions and Events in the game

YouTube Tutorial
{% youtube 3CKSo-2fStM %}

[Number Guessing Game with Python Source Code](https://www.mooict.com/python-tutorial-make-a-gui-number-guessing-game-with-tkinter/)
Python Tkinter Project - Make a Magic 8 Ball App
Tags: python, tkinter, gui
Published: 2023-03-20 13:24:35


Hi Welcome to this new tutorial from MOO ICT. In this tutorial we will be making a small magic 8 ball style application using python and tkinter. This is a continuation tutorial on our Python Tutorial Series. For this application we will making this step by step in the video tutorial below. Before we start please make sure you have the PILLOW framework installed on your python. This framework allows us to use the ImageTk and Images function to load and display images to the Tkinter window.

Lesson Objective –

Make a Magic 8 Ball APP using python and Tkinter
Create functions and events and link them to the button and the entry box
Use various colours on the GUI in tkinter
Use OS library to loop through a folder and load the images to a list
Use lists and random to choose a random answer for the user input
Check user input and show error message if the entry box is empty
Bind Click button and Enter Key Event for the application

YouTube Tutorial
{% youtube pESM_q5S-Rk %}


[Download 8 Ball images/Source Code here](https://www.mooict.com/make-a-gui-magic-8-ball-app-with-python-and-tkinter/)


**See MOO ICT website or the YouTube Channel for more tutorials on this topic. **

Thank for checking this out and Happy Coding.
Docusaurus - Or the simpliest way to do a technical documentation
Tags: tooling, productivity
Published: 2023-03-20 13:23:00

When we work on projects, whatever they have a huge number of features or simply they are exposed to the clients, we want to have them documented to help other devs or customers to be able to use it easily.

Often, this documentation is really small, put all other the place, lost in a middle of a Confluence... or it never exists!

So today we will see how Docusaurus will help us to manage this kind of issue.

---

## What is Docusaurus?
**Docusaurus** is an open source project which helps to create a technical documentation from Markdown files.

Once compiled and deployed, you will have a static web site with contains all your documentation with a great presentation without losing time on configurations or deployment.

---

## Why docusaurus?
Because it's principal objective is turned on **the quick and simple creation of a technical documentation** and not only a static web site!

Other tools *(that I've talked about before)* are more focused on creating a static web site or blog, but not a technical documentation, which makes it a huge difference.

For example, Docusaurus will display two navigation bars.

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


One on the left to display all the topics and subtopics of your documentation.

One on the right to display all the titles and subtitles of the current documentation page.

A simple feature which can make all the difference!

Some other useful features :
- **search bar is directly integrated**, you don't need to install an external plugin
- **internationalisation** is available and can easily be setup
- **blog**, if you want to post some articles about your project ...

I will stop here about all the features because there are a lot of them! 

---

## Conclusion
To end this post, Docusaurus is really a tool which  must be tested because it has everything to simplify your life and create easily a documentation for all your projects.

---

## Links
- Docusaurus : https://docusaurus.io/

---

I hope it will help you! 🍺

---

<center><h3>You want to support me?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
Docusaurus - Ou la manière la plus simple de créer votre documentation technique
Tags: productivity, french, tooling
Published: 2023-03-20 13:22:00

Quand on travaille sur des projets, qu'ils soient gigantesques par leur fonctionnalité ou simplement car ils sont exposés à des clients, on veut qu'ils soient documentés afin que les autres devs ou les clients s'y retrouvent sans encombres.

Bien souvent, cette documentation est éparpillée, perdue dans un confluence impossible à retrouver... ou tout simplement elle n'existe pas!

Aujourd'hui on va donc voir comment Docusaurus va nous aider simplement à gérer ça!

---

## Qu'est-ce que Docusaurus?
**Docusaurus** est un outil open source qui permet la création d'une documentation à partir de fichiers Markdown.

Une fois compilé et déployé, il vous expose l'ensemble de vos fichiers markdown en une belle documentation technique sans que vous ayez eu à perdre du temps sur de nombreuses configurations. De plus, avec les outils et exemples déjà présents, il n'y a que peu de chance aussi que vous perdiez du temps sur son déploiement!

C'est con à dire comme ça, mais ça fait un sacré gain de temps sur le long terme!

---

## Pourquoi docusaurus?
Son objectif principal est véritablement tourné vers la **création simple et rapide d'une documentation technique** et non d'un site statique! Ce qui est une grande différence.

D'autres outils *(dont j'ai déjà pu parler par le passé)* sont plus tournés vers la création d'un site statique ou d'un blog, donc les fonctionnalités, notamment vis à vis de l'organisation et de la navigation, sont complètement différents.

Par exemple, Docusaurus va proposer deux barres de navigation.

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

Une sur la gauche, pour permettre de naviguer dans les différents sujets et sous sujets.

Une sur la droite, pour permettre de naviguer entre les différents points et sous points de la documentation actuelle.

Autre point très utile, **la recherche directement intégrée dans votre documentation!** Pas besoin d'aller chercher un module externe pour cela, c'est déjà présent pour vous! Idem pour l'**internationalisation** et l'intégration d'un **blog** à côté! 

Je vais m'arrêter là pour les détails des fonctionnalités car il y en a pas mal et le plus simple est d'aller les tester par vous même!

---

## Conclusion
Pour conclure, Docusaurus est véritablement un outil qui mérite d'être testé car il a tout ce qu'il faut pour vous plaire. Simple et efficace, il pourra rapidement devenir votre allié pour faciliter la documentation de tous vos projets.

---

## Liens
- Docusaurus : https://docusaurus.io/

---

J'espère que ça vous aidera! 🍺

---

<center><h3>Vous voulez me supporter?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
Creating an Effective Data Breach Response Plan: Steps for Organizations
Tags: security
Published: 2023-03-20 13:13:40

In today's digital age, data breaches have become a common occurrence for organizations. Hackers and cybercriminals are always looking for vulnerabilities in data security systems, and a single breach can cause severe financial, legal, and reputational damage to an organization. It is essential for companies to have a robust [data breach response plan](https://essert.io/rapid-ccpa-compliance-roll-out-managed-privacy-services/) in place to ensure that any breaches are handled promptly and effectively.

A data breach can occur when sensitive or confidential data is accessed, stolen, or compromised by unauthorized parties. This can include financial data, personal identifiable information (PII), intellectual property, and other critical data. The impact of a data breach can be far-reaching, including financial losses, loss of customer trust, and legal liabilities.

A data breach response plan outlines the procedures for identifying and containing a breach, assessing the damage, and communicating with affected parties. The plan should include a step-by-step process that outlines the roles and responsibilities of employees, management, and IT staff in responding to a data breach.

The first step in responding to a data breach is to identify and contain the breach. This may involve shutting down affected systems or networks, disabling user accounts, and preventing further unauthorized access. Once the breach has been contained, organizations should assess the damage and identify the data that has been compromised. This includes identifying the type of data that has been breached, the number of affected individuals, and the potential impact of the breach.

Once the damage has been assessed, organizations need to communicate with affected parties promptly. This includes notifying affected individuals, regulatory agencies, and law enforcement agencies as required. Organizations need to provide clear and concise information about the breach, including what information has been compromised, what steps are being taken to remedy the situation, and what actions affected individuals can take to protect themselves.

In addition to responding to the breach itself, it's essential to conduct a thorough investigation into the cause of the breach to identify any vulnerabilities in the organization's data security policies and procedures. This may include reviewing security protocols, updating policies and procedures, and conducting training and awareness campaigns for employees.

In conclusion, a data breach response plan is essential for organizations to minimize the impact of a breach. The plan should include a step-by-step process for identifying and containing the breach, assessing the damage, and communicating with affected parties. By having a data breach response plan in place, organizations can respond promptly and effectively to a breach, protecting their reputation and minimizing the risk of financial and legal liabilities.