teleren/devto huggingface dataset:
Charting the Starchart
Tags: webdev, opensource, javascript, mysql
Published: 2023-01-20 01:13:37

## New Project 
Recently, I’m participating in a project called [Starchart](https://github.com/Seneca-CDOT/starchart). It’s going to be an easy way for [Seneca](https://www.senecacollege.ca/home.html) developer community to obtain SSL certificates for their websites as they develop websites.
Unlike the usual complicated method, they simply need to fill a few boxes and click a button to get one.
This is a bran new project still in its planning stage, so there’s a lot of works to do. Because I’m interested in databases, I want to take on building that part of the project with others. 

## What do I do?
The tech stack we use would use [Prisma](https://www.prisma.io/) to interact with a MySQL database for storing data we will be using. Because Seneca IT will handle upkeep of the database, we don’t need to worry about it. As Prisma is new to me, I have a lot of learning to do, and it should be an enlightening experience.

Since we need to keep track of certificate creation, we need a database table for information of certificates, like date pf creation. We also need some user information on a user table to store things like email. These are to help use email users when their certificates are about to expire. The table will need to be related via a foreign key. Perhaps something like user IDs. The primary key for the tables might be user IDs. We will need to discuss to hush out the detail before we build the database tables.

Another thing to figure out is how to have MySQL run in [Docker](https://www.docker.com/) container, for developers to work with during development. I think this is another thing I need to look into. I have used existing Docker setup through simple commands for other projects before, but I haven’t had any experience of setting it up myself.

## What ELSE to do? 
If I have the spare attention for other things, I suppose I can try to help tackle front-end of the project.
Having worked on other large scale projects’ front-end, such as HTML and CSS, makes me feel a bit more comfortable with doing so.
TIL: Astro
Tags: todayilearned
Published: 2023-01-20 01:04:45

On Tuesday, we took a look at [Astro](https://astro.build/) at Syracuse JavaScript meetup. Here are some thoughts.
- Geared towards simple websites, such as blogs, marketing sites, or small e-commerce sites.
- Has it's own component syntax that builds on JSX for templating. The script portion of the component
  is defined in a separate front-matter section (`---`), similar to Svelte or Vue single file components.
- Markdown posts with front-matter have first class support.
- Has directory-based routing and layouts.
- Vue, React, Svelte, and several other libraries can all be used in Astro simultaneously!
  
In summary, Astro looks like a good option if you want to build a simple website with all the DX of React/Vue/Svelte components. I might look into switching my blog to Astro, since it can also be hosted on Github Pages and looks like conversion almost comes for free.
O que é Salesforce? ☁
Tags: crm, salesforce, braziliandevs
Published: 2023-01-20 00:52:44

- A Salesforce é uma solução de gerenciamento de relacionamento que conecta as empresas aos clientes;

---


## Para que serve?

- É uma plataforma de CRM que oferece aos seus diferentes departamentos uma visão única e compartilhada de cada cliente;
- Além disso, a Salesforce fornece produtos para a melhoria do marketing, vendas, atendimento ao cliente, dentre outros.

---

## O que é CRM? 

- Customer Relationship Management ou Gestão de Relacionamento com o Cliente;
- Deu origem ao salesforce;
- Abrange qualquer tipo de empresa;
- Diz respeito a todo um processo utilizado pelas empresas para gerenciar os negócios com os clientes, bem como aumentar as vendas, automatizar processos complexos e mais!
- As empresas contratam suas ferramentas;
- Existe CRM local e na nuvem;
- Salesforce é 100% na nuvem;
- Tem licença para todo tipo de cliente;

---

## Lead, Conta e Oportunidade

- Lead: cliente em potencial;
- O lead se transforma em uma conta;
- Conta = cliente! Não necessariamente comprou para virar uma conta, depende de empresa para empresa;
- Oportunidades são negócios;

---

## Oportunidade de Venda

- B2B ou B2C;

Business to business (PJ para PJ), business to customer (cliente, pessoa física);

---

## Existem as Etapas da Venda

- Uma empresa tem várias transações acontecendo ao mesmo tempo, com diferentes empresas, em diferentes processos.

- Além disso, vale lembrar sobre o conceito de funil de vendas, que se divide em fases!

- Então, existe uma fase de negociação, de assinatura de contrato, várias outras, até, enfim, as vendas forem fechadas, que são pouquíssimas.

---

## LTV

- Quanto que o cliente dá de lucro para a empresa.

---

## CAC - custo de aquisição por cliente

- Valor investido na conversão de cada cliente no período.

---

## Taxa de Abandono

---

## ICP - Ideal Customer Profile = perfil de cliente ideal

---

## Salesforce = plataforma de CRM

- Tudo na nuvem!
- Salesforce funciona como se fosse um prédio;
- Multi tenancy;
- Paga-se por licença de usuário;
- As licenças possuem limites. Se você quiser mais, tem que comprar;
- Há diferentes tipos de suporte para salesforce!

---

## Papéis dentro do ecossistema do Salesforce

- 2010: Developer e Administrator;

- 2023: Isso mudou muito! Hoje temos uma sequência enorme de carreiras que dá para seguir dentro do salesforce. Temos developer, administrator, QA, vendas, arquitetos, analista de negócio, analista funcional, consultores, dentre outros!

- Além disso, o Salesforce possui nuvens para cada setor de problema da empresa;
Hash Maps
Tags: hackerrank, javascript, python, algorithms
Published: 2023-01-19 23:14:31

It’s not really a secret that I love using hash maps, and one of my goals this week was to teach myself how to use them in Python.

Essentially, a hash map is a data structure has key/value pairs. In both Javascript and Python, to create a hash map you would create an empty object like so:
`obj = {}`

In JavaScript to check if your object contains an element you would say:
`if (obj[elem])`

But in Python, you have to check for what’s not there first, so it would be:
`if num not in obj:`

In both languages you increment `obj[elem]`, marking it `= 1` if it wasn’t there before, or `+=1` if it was.

This creates an object which holds a key that corresponds to your array or string element, and a value that is equal to the number of times that value occurs. 

When I came upon today’s algorithm exercise: “Given an array of integers, where all elements but one occur twice, find the unique element...” I knew immediately I would use a hash map.

To me, any algorithm that questions instances for unknown multiple elements = hash map. I love them because it’s a simple piece of code that’s easy to remember under pressure and can be utilized to solve many different algorithms.

Once I created my hash map like the above, I looked into ways to iterate over my obj in a one liner and came up with next(). Next() returns the next item of an iterator and when given an if statement made it so I could return the unique (single) element that had a value of 1:
`return next(num for num in a if obj[num] == 1)`

My final code is below. I created an object, iterated through the input array, and added in a new key/value pair or updated the value in my object. Then I iterated through it again to return the key for which the value was equal to 1:

`    obj = {}
    for num in a:
        if num not in obj:
            obj[num] = 1
        else:
            obj[num] += 1      
    return next(num for num in a if obj[num] == 1)`
The Impact of Season Depression (SAD)
Tags: mentalhealth, stigma
Published: 2023-01-20 00:51:44

As I get older (I'll be 48 in March), I have come to recognize the huge impact that Seasonal Affective Disorder (SAD) (aka Seasonal Depression) has on my life, my relationships, and my work. Depression is so much more than just feeling "down" or "sad". It impacts nearly every facet of your life and while dealing with perpetual depression is hard enough, having that depression be magnified in the winter can make life seem somewhat hopeless.

Throughout my career as a web developer, I've always LOVED working on freelance projects; whether they be for another company/interested party or just a tinkering project for me, freelance time has always been rewarding. Earlier this week, I complained to my wife that I just didn't have any desire to work on anything outside of my day job because nothing sounded fun. Luckily, I have an amazing wife who recognizes when I'm affected by SAD more than I do, and she simply reminded me that my lack of drive was likely due to my brain.

Seasonal depression (or the "winter blues") affects millions of people across the world. And it's not as though you have to hate winter to be impacted by it. I love winter. I love snow. I chose to move to Boston, MA, USA. I then chose to move to Reno, NV, USA (which despite being in the desert still sees plenty of snow each winter). But I can't ignore the impact that the season has on my psyche, my desire to do anything more than survive, and my relationships with others.

If you're a manager of people, be sure to watch for different behavior in the winter from your team members. If a person who was very productive, outgoing and a real benefit to the team suddenly becomes complacent, moody or withdrawn when the seasons change, it's highly likely they suffer from seasonal depression. If you're lucky enough to work for an amazing company that offers free mental health benefits (Chatbooks partner with Tava Health, for instance), take advantage of those benefits for yourself and for your team members.

As with most things where mental health is concerned, the absolute worst thing you can do is turn a blind eye to it. It's also not sufficient to ignore behaviors, but it is vital to be empathetic. Some suggestions to help would be:

- Increase your interactivity with people during the winter months
- Use a ["happy light" ](https://www.prevention.com/health/mental-health/a25940709/happy-light-lamp-therapy/)
- Make excuses to leave your house, even if it's cold/snowy/blustery
- If you're a remote worker, look for additional ways to interact with your team at work and your neighbors and friends

I'm not a doctor, I don't play one on TV, nor did I stay at a Holiday Inn Express last night. I don't have any great revelations about how to suddenly make SAD less impactful. But I do have a voice to tell others what to look out for. Keep in mind, it will get better, even if it just takes until Spring to do so.
Getting to know mermaid JS
Tags: javascript, beginners, tutorial, webdev
Published: 2023-01-20 00:11:36

Mermaid is an open source tool for creating flow charts, Gantt charts and sequence diagrams using a simple markup language. It is designed to be used in text documents such as reports, presentations and web pages, and it supports multiple output formats including PNG, SVG and PDF. It is based on JavaScript and can be easily incorporated into web projects using a JavaScript library. Mermaid is a great choice for anyone who needs to create flowcharts and other types of diagrams quickly and easily.

## Exemplo

Here is a simple example of how to use Mermaid syntax to create a flowchart:

```js
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```

### Preview

![Example 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uh7kp27sckrfl8ztgowy.png)


Here, the letters A, B, C and D represent the steps in the flow, and the arrows indicate the relationships between them. Note that the syntax is easy to understand and follow. Additionally, there are many other options and features available in Mermaid to help create more complex and detailed diagrams.

## Use Case

here's an example of how Mermaid can be used to create a use case diagram:

```js
sequenceDiagram
    participant User as User
    participant System as System
    User->>System: Perform login
    System->>User: Request credentials
    User->>System: Provide credentials
    System->>User: Authenticate credentials
    User->>System: Access protected resources
```

### Preview

![Example 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3scskb0cbu9hpw7cp6n.png)


In this example, the diagram shows the interactions between the user and the system during the login process. It shows how the user initiates the process, how the system requests the credentials, how the user provides them, and how the system authenticates them. Finally, the user is able to access the protected resources.

You can use Mermaid to create use case diagrams in various ways, depending on the specific use case. I hope this has helped to show how easy it is to use Mermaid to create use case diagrams.

## LINK

If you liked it, go to the project's website and support

[Mermaid](https://mermaid.js.org/)

***

## Thanks for reading!

If you have any questions, complaints or tips, you can leave them here in the comments. I will be happy to answer!

😊😊 See you later! 😊😊

***

## Support Me

[Youtube - WalterNascimentoBarroso](https://www.youtube.com/channel/UCXm0xRtDRrdnvkW24WmkBqA)
[Github - WalterNascimentoBarroso](https://github.com/walternascimentobarroso)
[Codepen - WalterNascimentoBarroso](https://codepen.io)
PUT v PATCH
Tags: beginners, javascript
Published: 2023-01-19 20:23:03

Did you know that according to the [Internet Assigned Numbers Authority](https://www.iana.org/assignments/http-methods/http-methods.xhtml), there are **39** different HTTP methods?? 🤯 As a newcomer to coding, I've only been working with a handful of the more common methods like GET, POST, PATCH, and DELETE. 

Recently, I learned about the PUT method. Similar to PATCH, PUT updates data, but there are some important differences between the two. 

**PUT** is used to update an entity's data completely. PUT overwrites the entire entity if it already exists, and creates a new resource if it doesn't. What this means is that when working with PUT, you will need to send details for the entire resource, or you will replace the resource only with what you've sent in your PUT request. 

**PATCH** applies a partial update to the resource, meaning you only need to send the data that you want to update. After sending the PATCH request, that specific piece of information will update, without replacing the entire entity. 

What does this look like IRL? 

Let's say we have a business that offers customizable meal plans. Below is the data we use to update specific meal plans: 

 

```
{
     "protein": "Flank Steak",
     "vegetable": "Asparagus",
     "starch": "Brown Rice",
     "dessert": "Chocolate Chip Cookie"
    }
```
I need to update the starch on this meal from Brown Rice to Sweet Potatoes. If I use a PUT request and **only** send `"starch": "Sweet Potatoes"`, without the other elements, this is what I'll get in return:

```
{
  "starch": "Sweet Potatoes"
}

```
If I use a PATCH request only sending `"starch": "Sweet Potatoes"`, the response would return:

```
 {
     "protein": "Flank Steak",
     "vegetable": "Asparagus",
     "starch": "Sweet Potatoes",
     "dessert": "Chocolate Chip Cookie"
    }
```

Using PATCH, we could also add another item to the meal, like a beverage, by sending only `"beverage": "Orange Cranberry Spritzer"`. This will add a "beverage" element to the object instead of replacing the entire entity. 

```
 {
     "protein": "Flank Steak",
     "vegetable": "Asparagus",
     "starch": "Sweet Potatoes",
     "dessert": "Chocolate Chip Cookie",
     "beverage": "Orange Cranberry Spritzer"
    }
```

Happy Coding 💻

Cited Source: https://rapidapi.com/blog/put-vs-patch/
How install Jupyter?
Tags: beginners, python, linux, opensource
Published: 2023-01-19 23:58:50

#  🌰 Simple step to install and use Jupyter in windows and Linux.

---

## 🔗Related content 
### You can find video related in:
📺[YouTube](https://youtu.be/sN6y5m2qV6Y) 

### You can find repo related in:
🐱‍🏍[GitHub](https://github.com/xlmriosx/data-projects/tree/main/how-install-notebook) 

### You can connect with me in:
🧬[LinkedIn](https://www.linkedin.com/in/xlmriosx/) 

--- 

### Resume 🧾

I will install Jupyter in local machine with some simple steps.

Pre-Conditions: 
- Have Python

---

### 1st - Clone repository ⬇

We will need clone repository in our local machine.

I use following commando:

`git clone https://github.com/xlmriosx/data-projects.git`

---

### 2nd - Go to path where is script 🏄‍♂️

If your are in console and ran it the before command you can go to the path with following command:

```
cd data-projects
cd how-install-notebook
```

---

### 3rd - Run script 🙈

If you use Windows run the following script:
`powershell.exe base-notebook.ps1`

If you use Linux run the following script:
`sh base-notebook.sh`

---

### 4th - Say thanks, give like and share if this has been of help/interest 😁🖖

---
PHP Modificando propriedade privada sem modificadores
Tags: php, symfony, think, tdd
Published: 2023-01-19 23:31:21

---
title: PHP Modificando propriedade privada sem modificadores 
published: true
description: A ideia deste post é mostrar para vocês que é possível alterar um comportamento de uma classe sem passar por métodos privados
tags: #php #symfony #think #tdd
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-19 23:08 +0000
---

## Apresentação
Fala pessoal tudo bem !? A ideia deste artigo é ajudar vocês a contribuir mais com testes dentro da empresa

Vamos a seguinte hipótese imagina que te peçam para testar uma classe inchada cheio de classes e um alto acoplamento e claro essa classe não tem as propriedade sendo recebidas por construtor o que vocês

Classe exemplo:
```php
<?php

use ...
class SomeClass
{
    private AnotherClass $anotherClass;

    public function __construct()
    {
        $this->anotherClass = new AnotherClass();
        //... another calls classes

    }

    public function someMethod(Type $args): SomeType
    {
        //... any business logic 
        $this->anotherClass->doIt();

        return $someType;
    }
}
```

Pensam comigo terá um alto acoplamento e se for aceitar que essa classe seja enviada por parâmetro no seu construtor possa ser que quebre compatibilidade com outras classes que podem estar usando.

Imagina que `anotherClass::doIt` seja algo arriscado que se for chamado possa ter uma consequência grave por exemplo um update em massa para resolver esse problema você pode sobreescrever essa propriedade no seu test:

```php 

<?php

class SomeTest extends TestCase
{
    public function testAnywere(): void
    {
        $anotherClassMock = $this->getMockBuilder(AnotherClass::class)
            ->disableOriginalConstructor()
            ->getMock();
        $anotherClassMock
            ->method('doIt');

        $someClass = new SomeClass();
        $setSomeClassClosure = function ()  use ($anotherClassMock){
            $this->anotherClass = $anotherClassMock;
        };
        $doSetSomeClassClosure = $setSomeClassClosure
            ->bindTo($someClass, SomeClass::class);
        $doSetSomeClassClosure();

    }
}
```

**Obs: A ideia desta forma de testar é te dar poder para conseguir resolver algo legado e bastante arriscado, no geral o ideal seria uma reescrita deste método**
GitHub login with React Js
Tags: react
Published: 2023-01-19 22:48:40

To implement a login feature using GitHub in a React application, you will need to use the GitHub API to authenticate the user and retrieve their information.
Here is a breakdown:

1. Install the react-github-login library
`npm install react-github-login
`

2. Import the GitHubLogin component

`import { GitHubLogin } from 'react-github-login';
`
3. Add the GitHubLogin component to your React component and pass in your client_id and redirect_uri as props

```
const MyComponent = () => {
  const [isLoggedIn, setIsLoggedIn] = useState(false);
  const [accessToken, setAccessToken] = useState(null);
  const [user, setUser] = useState(null);

  const handleGitHubLoginSuccess = (response) => {
    const { code } = response;
    axios.post('https://github.com/login/oauth/access_token', {
      client_id: 'YOUR_CLIENT_ID',
      client_secret: 'YOUR_CLIENT_SECRET',
      code: code
    })
      .then(result => {
        const accessToken = result.data.access_token;
        localStorage.setItem('access_token', accessToken);
        axios.get(`https://api.github.com/user?access_token=${accessToken}`)
          .then(result => {
            localStorage.setItem('user', JSON.stringify(result.data));
            setIsLoggedIn(true);
            setAccessToken(accessToken);
            setUser(result.data);
          })
          .catch(error => {
            console.log(error);
          });
      })
      .catch(error => {
        console.log(error);
      });
  }

  const handleGitHubLoginFailure = (response) => {
    console.log(response);
  }

  const handleLogout = () => {
    localStorage.removeItem('access_token');
    localStorage.removeItem('user');
    setIsLoggedIn(false);
    setAccessToken(null);
    setUser(null);
  }

  return (
    <>
      <GitHubLogin
        clientId="YOUR_CLIENT_ID"
        redirectUri="YOUR_REDIRECT_URI"
        onSuccess={handleGitHubLoginSuccess}
        onFailure={handleGitHubLoginFailure}
        className="github-login-button"
      />
      {isLoggedIn && <button onClick={handleLogout}>Logout</button>}
    </>
  )
}

```



In this example, the component state is managed using the useState hook. The handleGitHubLoginSuccess, handleGitHubLoginFailure, and handleLogout functions are defined as arrow functions within the component. The component render the login button if the user is not logged in and a logout button if the user is logged in. The component also saves the access token and user information in local storage.
The Journey to Code Mastery w/ Marqeta's CTO, Randy Kern
Tags: programming, productivity, devops, podcast
Published: 2023-01-19 22:48:38

Randy Kern, CTO at Marqeta, thinks that every engineer should "go deep" - all the way to understanding the transistors if you have to. He implores us never to be satisfied with black boxes, believing that it's not only risky not to understand what your code is really doing, but it's not fun either.

We love this episode because Randy's joy is infectious. He reminds us why we got into software engineering in the first place. If you've been looking for a reminder yourself, this is the episode for you.

{% spotify spotify:episode:6NwBMM58sRHLOYpzEhWe2I %}

## Episode Highlights:
* (2:37) Randy's start in tech
* (8:20) New to a team? Spend a month fixing bugs
* (15:38) Learning as you go
* (23:59) What every engineer should know
* (30:37) It takes bifocals to build software
* (34:02) Tips for managers
* (40:46) Building enterprise teams

***While you’re here, check out this video from our [YouTube channel](https://www.youtube.com/c/DevInterrupted?sub_confirmation=1), and be sure to like and [subscribe](https://www.youtube.com/c/DevInterrupted?sub_confirmation=1) when you do!*** 

{% youtube ZNtX0UVd4CQ %}

### Want to cut code-review time by up to 40%? Add estimated review time to pull requests automatically!
*gitStream is the free dev tool from LinearB that eliminates the No. 1 bottleneck in your team’s workflow: pull requests and code reviews. After reviewing the work of 2,000 dev teams, LinearB’s engineers and data scientists found that pickup times and code review were lasting 4 to 5 days longer than they should be.* 

*The good news is that they found these delays could be eliminated largely by adding estimated review time to pull requests!*

### Learn more about how gitStream is making coding better [HERE](https://linearb.io/blog/why-estimated-review-time-improves-pull-requests-and-reduces-cycle-time/?utm_source=Substack%2FMedium%2FDev.to&utm_medium=referral&utm_campaign=gitStream%20-%20Referral%20-%20Distribution%20Footers).

![Start using gitstream today!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xg1l6hxt134px501bf7d.png)