teleren/devto huggingface dataset:
[Conceito] - Evite Acoplamento Temporal
Published: 2022-06-19 19:11:20

> Conteúdo original [nessa thread do Twitter](https://twitter.com/zanfranceschi/status/1538598942920740864)

---

Ei dev,

Você sabe porque a gente deveria evitar acoplamento temporal entre microsserviços algumas vezes? Dia 28 de Junho às 14:15, vou falar sobre isso no Dev Trends e ficaria muito feliz se você colasse lá! 

Pega essa teaser thread :)

cc @sseraphini

↓

![img](https://pbs.twimg.com/media/FVozk_5UYAAQNt8?format=jpg&name=360x360)

![img](https://pbs.twimg.com/media/FVozlX9VEAA0O2q?format=png&name=small)

---

Quando seu (micros)serviço depende de uma chamada HTTP pra outro serviço pra algo sensível em termos de disponibilidade p.ex., você não tem domínio de duas coisas que podem ser fundamentais pra sua autonomia:

- SLA
- Forma

---

SLA:

Se cada serviço possuir um SLA de 99,999% apenas levando em consideração a execução interna, você ignora um fato importante de que 99,999 * 99,999 (/100) é igual a 99,998. Ou seja, o último 9 vira 8, pois a conta sempre deve ser feita levando em consideração o pior cenário.

---

Forma:

Se você depende de uma API de outro serviço, questões como filtros, campos, formatos, etc. não estão nas suas mãos. São questões que precisam ser discutidas e talvez implementadas em conjunto com o time deste serviço que oferece tal API.

---

Microsserviços têm tudo a ver com autonomia de runtime e de equipes. Se essa autonomia não existir, é possível que estejamos construindo monolitos distribuídos e não microsserviços.

---
Esse é o link para você dar uma olhada na programação e se inscrever. ↓

https://agiletrendsbr.com/programacao-dev-trends-2022/

---

Se chegou até aqui, muito obrigado! Eu realmente me dedico a compartilhar um pouco de conhecimento por prazer e por saber que talvez esteja ajudando alguém. Sem você que lê minhas threads e/ou me segue, nada disso teria sentido. 

Novamente, obrigado de coração! ❤️
Como 'settar' a versão default do Node usando nvm
Tags: tutorial, braziliandevs, node, programming
Published: 2022-06-19 18:52:06

Hello, hello devs e divas!

Pra quem ainda não conhece `nvm` é um excelente utilitário pra quando estamos querendo trocar a versão do node com agilidade sem precisar desinstalar a atual e instalar a desejada. 

Por um bom tempo eu utilizei o comando:

```sh
nvm use <VERSÃO_DESEJADA>
``` 

Para alternar a versão do node pra uma mais recente, até que uns dias atrás descobri como alterar de forma bem simples a versão default do nvm.

Basta utilizar o seguinte comando alterando o trecho `<VERSÃO_DESEJADA>` pela versão que você deseja manter como a padrão, por ex `16.5.0`:

```sh
nvm alias default <VERSÃO_DESEJADA>
```

E pronto, agora você vai estar sempre utilizando essa versão do nvm em qualquer momento ou terminal que você abrir 😁.

_Originalmente postado em [https://thayto.com](https://thayto.com/blog/como-settar-a-versao-default-do-node-usando-nvm) dia 19 de junho de 2022._
None of my friends like the same stuff as me. Have you ever felt this way before?
Published: 2022-06-19 18:39:40

I often run into this problem that I need to watch anime or a horror movie or code (specifically React and C#), but I rarely find anyone with those very specific interests. 🤷‍♂️

Not to mention, with everyones calendar being so busy, with friends you always end up compromising and spending more time than needed discussing things instead of doing them.

Makes me wonder if theres anyone else in the world that wants to , for example, code on a .netcore identity component, tonight at 6pm EST.

Does any one else run into these problems? 🤔And do you wish there was something out there to help you connect with others on your terms. Whatever code is created is owned by all collaborators.

I launched https://www.iwannagoapp.com/ to solve this issue. Its a Zoom + Meetups clone social network. Like ChatRoulette but where you know in advance what the activity is , and everyones wearing pants. 😭

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

I know its sort of a chicken and egg thing with social networks and everyone says they're almost impossible to make work. Which is kinda why Im bootstrapping this.

My request is , if you've had a rough week, please focus all that energy into ripping this idea to shreds. 🙃

Tell me mostly why you think this idea is stupid, why it doesn't have enough merit on its own or why students/young pros wouldn't care -- any issues you have at all. And any advice on the landing page would be great too if you are so kind :) Thank you muchly!

p.s if you wanna code tonight , gimme a shout, also posted it on WannaGo 🎉 - !
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gp3jpbfx2fz6cofcm1cm.png)
 
https://www.iwannagoapp.com/activities/c664009b-669d-4b49-a1a5-b8063b380965
Movie recommendation for Programmers and Founders (Discussion)
Tags: webdev, startup, beginners, programming
Published: 2022-06-19 18:28:36

It's the weekend!
While we never stop writing codes and building products, sometimes rest is needed. 

Rest and Movie recommendations, please.


For me,

 **1. Start-Up**

"Young entrepreneurs aspiring to launch virtual dreams into reality compete for success and love in the cutthroat world of Korea's high-tech industry." 

-- IMDb

![Startup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s64yz25m9vfsj8hy1pqc.jpeg)

**2. Silicon Valley**

"Follows the struggle of Richard Hendricks, a Silicon Valley engineer trying to build his own company called Pied Piper."

--IMDb

![Silicon Valley](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/anbze6wrjdydf1jda2wf.gif)


And definitely Animes😊

Recommend a Movie or Series or Anime in the comment section.
Container VS Virtual Machines
Tags: docker, containers, virutalmachine, vm
Published: 2022-06-19 18:24:50

To understand the difference between the containers and virtual machines, we must first understand the concept of Virtualization.

### What is Virtualization?
Virtualization is technology that lets you create useful IT services and projects using resources that are traditionally bound to hardware. It is a process in which the normal computer resources like CPU, RAM, Disk Space, etc. can be "virtualized" and can be used as multiple resources.

**Both Containers and VMs are virtualization tools.**

### What are containers?
If we discuss in short then, Containers are the technologies that allow you to package and isolate applications with their entire runtime environment—all of the files necessary to run.
Before containers, in any development process the developers had to install the packages and tools required in development at there respective machines. Since different machines have different OS, it creates a great scope of error and bugs in all these installations.
Containers solve these problems by creating an isolated environment with all these files and configurations and every developer can use this instance of software ( called as image ).

### Difference between Container and VMs

To understand the difference between these two we should look how OS is framed;

Any Operating System has to layers above it's hardware; viz. OS Kernel Layer and Applications Layer. OS kernel interacts with hardware and applications are based on these kernel layers.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9s0mfg9aa7skhc8elm0d.png)
 
The key difference between Containers and VMs is that a Container Environment virtualizes the Applications Layer whereas the VMs virtualize the Applications Layer + OS Kernel layer

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

This means that VMs virtualize the complete operating system. Thus when we setup the VM then it did not use host's OS kernel, it boots up on it's own.

*KEY DIFFERENCES*
1. Containers are smaller in size as they just virtualize the applications layer while the VMs are big in size, generally few gigabytes. 

2. Second is speed, we can run the containers pretty quickly as compared to VM, because they every time you start them, have to put the operating system kernel and the applications on top of it.

3. The third difference is compatibility, so you can run a virtual machine image of any operating system on any other operating system host, but you can't do that with Containers.
 
That's it! This was the short and sweet look at the key differences between a container and a virtual machine.

To learn more, I have pinned some great articles here!
a. https://www.atlassian.com/microservices/cloud-computing/containers-vs-vms
b. https://www.redhat.com/en/topics/containers/containers-vs-vms
c. https://www.redhat.com/en/topics/containers
d. https://www.redhat.com/en/topics/virtualization/what-is-a-virtual-machine
Paracetamol.test.js🧪| #5: Testea este código JavaScript
Tags: javascript, testing, webdev, spanish
Published: 2022-06-19 18:24:04

## **<center>¿Cuál es la diferencia entre test A y test B?</center>**
#### <center>**Dificultad:** <mark>Básico</mark></center>

```js
// arr.test.js
const f = (arr) => {
  return arr.some((item) => {
    return item > 3;
  });
};

//test A
test("[1,2,3,4,5] => true", () => {
  const res = f([1, 2, 3, 4, 5]);
  expect(res).toBeTruthy();
});

//test B
test("[1,2,3,4,5] => true", () => {
  const res = f([1, 2, 3, 4, 5]);
  expect(res).toBe(true);
});
```

A. `test A y test B son iguales, ambos test pasan`
B. `test B no pasa las pruebas, test A si pasa las pruebas`
C. `toBeTruthy no es un matcher de jest`
D. `Ninguna de las anteriores`

Respuesta en el primer comentario.


---
Create a Google Chrome extension with ReactJS
Tags: javascript, typescript, react, tutorial
Published: 2022-06-19 18:20:18

Lets Create a Google chrome extension with ReactJS by using the Plasmo framework. The Plasmo framework allows us to build multi-browser compatible extensions with ReactJS. They have various quickstarts for other tools you may have already used such as NextJS, Stripe, Redux, Tailwind CSS, Supabase and Firebase

{% embed https://youtu.be/Fa2nFDw-dBw %}
Day 22 - Multi-level Inheritance
Tags: 100daysofcode, solidity, web3, blockchain
Published: 2022-06-19 18:16:00

{% embed https://github.com/Envoy-VC/30-Days-of-Solidity noreadme %}

This is Day `22` of `30` in Solidity Series
Today I Learned About Multi-level Inheritance in Solidity.

## Multi-level Inheritance

It is very similar to single inheritance, but the difference is that it has levels of the relationship between the parent and the child. The child contract derived from a parent also acts as a parent for the contract which is derived from it.

**Example**: In the below example, contract A is inherited by contract B, contract B is inherited by contract C, to demonstrate Multi-level Inheritance.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

// Defining parent contract A
contract A {
    string internal x;
    string a = "Multi";
    string b = "Level";

    // Defining external function to return concatenated string
    function getA() external {
        x = string(abi.encodePacked(a, b));
    }
}

// Defining child contract B inheriting parent contract A
contract B is A {
    string public y;
    string c = "Inheritance";

    // Defining external function to return concatenated string
    function getB() external payable returns (string memory) {
        y = string(abi.encodePacked(x, c));
    }
}

// Defining child contract C inheriting parent contract A
contract C is B {
    function getC() external view returns (string memory) {
        return y;
    }
}

// Defining calling contract
contract caller {
    // Creating object of child C
    C cc = new C();

    // Defining public function to return final concatenated string
    function testInheritance() public returns (string memory) {
        cc.getA();
        cc.getB();
        return cc.getC();
    }
}
```

Output:

when we call the testInheritance function, the output is "MultiLevelInheritance".

---
How To Install Hyperledger Fabric v2.4 on Ubuntu 20.04
Tags: ubuntu, web3, hyperledger, blockchain
Published: 2022-06-19 18:11:51

**Hyperledger Fabric** is one of the leading enterprise grade blockchain platforms. In this article we will cover Prerequisites and Hyperledger Fabric v2.4 installation on Linux Ubuntu 20.04 LTS.

## Step 1: Install curl, git

Install the latest version of [git ](https://git-scm.com/downloads)and [curl ](https://curl.se/download.html)if it is not already installed.

`sudo apt update
sudo apt-get install git
sudo apt-get install curl`

## Step 2: Install Docker

Install the latest version of Docker if it is not already installed.

`sudo apt-get -y install docker-compose`

Once installed, confirm that the latest versions of both Docker and Docker Compose executables were installed.

`docker --version
Docker version 20.10.12, build 20.10.12-0ubuntu2~20.04.1`

`docker-compose --version
docker-compose version 1.25.0, build`


Make sure the Docker daemon is running.

`sudo systemctl start docker`

Optional: If you want the Docker daemon to start when the system starts, use the following:

`sudo systemctl enable docker`

Add your user to the Docker group.

`sudo usermod -a -G docker <username>`

## Step 3: Install Golang

`curl -O https://dl.google.com/go/go1.18.3.linux-amd64.tar.gz
tar xvf go1.18.3.linux-amd64.tar.gz
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin`

Now, you have to open and edit you **bashrc **file. In most cases, the bashrc is a hidden file that lives in your home directory.

`nano  ~/.bashrc`

Add following two lines, at the end of the file:

`export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin`

Create new directory where you will install Hyperledger Fabric

`mkdir fabric-network`

## Step 4: Install Hyperledger Fabric

To download a specific release, pass a version identifier for Fabric and Fabric CA Docker images. The command below demonstrates how to download the latest production releases - Fabric v2.4.4 and Fabric CA v1.5.3

`curl -sSL https://bit.ly/2ysbOFE | bash -s -- <fabric_version> <fabric-ca_version>`

`curl -sSL https://bit.ly/2ysbOFE | bash -s -- 2.4.4 1.5.3`

Download the latest release of Fabric samples, docker images, and binaries.

`curl -sSL https://bit.ly/2ysbOFE | bash -s`

Congrats, you have installed Hyperledger Fabric with all dependencies. 

To test the our installation, we will run test network that comes with fabric-samples

`cd fabric-samples/test-network
./network.sh up createChannel -ca -c mychannel -s couchdb`

The above command will create a channel(mychannel) with certificate Authorities and bring up couch-db as state database.

Using following Docker command we can check all running containers

`docker ps -a`

You should be able to see the containers up and running.


![Hyperledger Fabric Test Network Containers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nosb16y7vvhrknwuc23e.png)

Congratulations, you have installed and setup Hyperledger Fabric. 

If this tutorial helps you, please hit the Clap button or comment if you have any suggestion or feedback.
Diagrams with Mermaid
Published: 2022-06-20 06:55:34

---
title: Diagrams with Mermaid
published: true
date: 2022-06-19 18:00:45 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/2022/diagrams-with-mermaid/
---

I have been wanting to produce a diagram of the architecture of my side project for some time, but I have put it off as never sure what the correct tools is for this job.

[Mermaid](http://mermaid-js.github.io/mermaid/#/) is a tool that lets you create diagrams from code and text. I first came across this tool about a year ago for use in a project. I had forgotten about this tool until the other day, when I was thinking about this problem again.

Is it possible to embed a mermaid diagram in the markdown used in a github repo? Well the answer is yes, so lets look at how that works.

A simple mermaid diagram looks like this:

```
graph TD;
    A[fff]--->B;
    A--->C;
    B--->D;
    C--->D;

```

which renders like this:

![](https://www.funkysi1701.com/images/mermaid.png)

Lets look at what it is doing.

TD means the chart is top down.

A is the name of a node in the chart, [fff] is a label being applied to it.

Then we just define the relationships between the different nodes, you can have <—, —> or —, or even  
 <—>

Lets look at my architecture. I have a database (cosmosDB), I have a website running on Azure Static Web Apps, I have some Azure functions for getting data into and out of my database. I also have Application Insights monitoring the whole thing. I also have a console app for doing some data import stuff. This produces a diagram like this:

![](https://www.funkysi1701.com/images/mermaid2.png)

The code to produce this and display it on my [github repo](https://github.com/funkysi1701/Blogv2/) is simply

graph TD
    A[Azure Static Web App]---B[Http Fn]
    B---D[Database]
    C[Timer Fn]---D
    D---E[Import Console App]
    F[App Insights]---A
    F---B
    F---C



Pretty nice for a few lines of code to show what system talks with what.

There are improvements that can be made to the diagram, for example changing the shapes of the different services.

eg ![](https://www.funkysi1701.com/images/mermaid3.png)

What diagrams are you going to build?
Agile Sprint improvements
Tags: productivity, agile, product
Published: 2022-06-19 17:54:53

I found this good sprint improvements/achievements which can be used as goals for improving productivity in agile process.

- Decrease number of High priority Bugs in production from 2 to 0 KPI
- Increase Automation test coverage from 80% to 90%
- Reduce the average number of new bug reports from 72 per month to 60 per month
- Increase the crash-free ratio from 96% to 99% for the new release
- Reduce average QA rejections per-feature from 1.7 to 1.0
- Increase code coverage from 35% to 50%
- Increase Sprint velocity from 42 to 60 points
- Reduce the average number of bugs per feature from 1.7 to 1
- Reduce average code review time by 30%
- Reduce "design-blocked" flag to <2% of planned features
- Set up and implement automatic CI and CD with CloudBees
- 100% of logged errors reported to Sentry
- Reduce Travis build times <5m for all projects
- Reduce "design-blocked" flag to <2% of planned features
- Create the refactoring plan
- 80% of components ported from AngularJS to React
- 100% of reporting routes (/api) migrated to new paths
- Reduce the response time for old APIs from 890 ms to 300 ms (on average)
- Proactively find >20 bugs
- Implement the new QA automation tool and run new process on 50% of code base
- Reduce critical bugs reported from 5 to 2
Halmos' tips for writing
Tags: halmos, writing
Published: 2022-06-19 17:13:40

Paul Halmos was a mathematician who among other things was recognized by his excellent written exposition.

His article on how to write mathematics left a lasting impression on me, and this year I decided to read it again, and capture some notes for my future reference.

[https://pgpbpadilla.github.io/halmos-writing](https://pgpbpadilla.github.io/halmos-writing)
How Template Literal Types work in TypeScript
Tags: javascript, webdev, tutorial, typescript
Published: 2022-06-19 17:11:49

Template Literals are common in Javascript: they let us easily combine variables and strings in Javascript. **TypeScript** also introduces the concept of **Template Literal Types**, where we can enforce types on the inputs for Template literals. That gives us controls to ensure that text is in a certain format. Let's look at how they work.

## Template Literal Types in TypeScript

A perfect example of when a template literal type might be useful is for creating IDs of certain formats. For example, let's say we have an ID which starts with 'ga-' or 'ua-', followed by a string or number. We can define a new type using type literals for that like so:

```typescript
type startOfId = "ga-" | "ua-";
type ID = `${startOfId}${string | number}`;
```

That means that the first part of `type ID` needs to conform to type `startOfId`, while the second bit can be a `string` or `number`. The entire type `ID` must be a string, since a template literal implies a string type.

**Now we can use our type on variables we want to conform to this pattern**. For example:
```typescript
type startOfId = "ga-" | "ua-";
type ID = `${startOfId}${string | number}`;

let newId:ID = "ga-12abc3456";
```

## Combining with Generic Types

If you want to get even fancier, you can combine template literal types with [generic types](https://fjolt.com/article/typescript-generics). Below, we have two types, `genericType` and `user`:

```typescript
type genericType<Type> = {
    name: `${string & keyof Type} object property`
}

type user = {
    name: string,
    age: number,
    description: string
}
let myObject:genericType<user> = {
    name: "age object property"
}
```

Since `genericType` accepts another type as an argument, we can pass in `user`, so now the `name` property in `myObject` can only be `age object property`, `name object property` or `description object property`
EFS vs. FSx for ONTAP
Tags: filesystem, aws, storag, communitybuilder
Published: 2022-06-19 17:08:45

EFS vs. FSx for ONTAP - I did this comparison for some client scenario recently and found some interesting attributes where these two services have their own merits and distinctions. Hope you find this useful!

![EFS vs. FSx for ONTAP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gv1h2ytzmw6yn3u3zfi3.png)

> Amazon EFS lock limits are recently increased. Do read here for more details: 
[EFS Lock Limits News](https://aws.amazon.com/about-aws/whats-new/2022/05/amazon-efs-larger-number-concurrent-file-locks/)
How to get the Full URL in Express on Node.js
Tags: typescript, javascript, webdev, tutorial
Published: 2022-06-19 17:07:21

In Express running on Node.js, we have access to the `request` object, and also we can send a response back to the user via the `response` object. However, we don't have access to a simple way of getting the full URL from the `request`. 

Fortunately, it is quite easy to build the full URL from the `request` object in Express. Let's look at how it works.

## Getting the full URL of a Request in Express
In express, we can display certain content on certain routes like so:
```javascript
app.get('/page', (req, res, next) => {
    // Show some content to the user
})
```

Within a route, we can use the `req` object to get the full URL. The full URL is composed of a few different pieces:
- the protocol of the current URL
- the host of the URL (i.e. the domain name)
- and the page you are on, i.e. `/page`

To combine all of these from our request, we can run the following:
```javascript
let fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;
```

**Note**: it is better to use `req.get('host')`, since it will include the port. So if you're running on `localhost:3000`, then `:3000` will be included. `req.hostname` only returns the domain, or `localhost` - which may cause issues for you in the future.

Therefore, a full URL can be found for any page our route, using the following code:
```javascript
app.get('/page', (req, res, next) => {
    // Show some content to the user
    let fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;
})
```