teleren/devto huggingface dataset:
How do YOU speed up Docker (Compose) on Mac?
Tags: discuss, devops, docker
Published: 2019-12-10 18:35:17

Hey everyone!

As I see, the performance of `docker`/`docker-compose` is a pain point for many developers and devops folks. I'm on the list, for sure. I still have Docker Compose running super slow on my fresh Mac Air.

How about you? Are you okay with your Docker's performance? And what tricks helped you to configure it nicely?
Completing Account Deactivation - Building SaaS #18
Tags: python, django, saas
Published: 2019-12-10 18:01:38

{% youtube IRq_kJWEWDc %}

In this episode, we finished the account deactivation flow.  We looked at how to log out and mark an account as inactive.  The deactivate customer is presented with a nice deactivated page to let them know there subscription was canceled successfully.

Show notes for this stream are at [Episode 18 Show Notes](https://www.mattlayman.com/building-saas/completing-account-deactivation/).

To learn more about the stream, please check out [Building SaaS with Python and Django](https://www.mattlayman.com/building-saas/).
How to debug a Cloud Function deployment error
Tags: firebase, cloudfunctions, gcp, serverless
Published: 2019-12-10 17:49:11

___
**TL;DR**: Just go to the [Google Cloud Console](https://console.cloud.google.com/projectselector2/projectselector/functions/list); select your project; choose a function you'd like to debug; and click on "view logs".
___

When deploying a [Cloud Function](https://firebase.google.com/docs/functions) using [Firebase Tools](https://github.com/firebase/firebase-tools), you might get the following error:

```
Error setting up the execution environment for your function. Please try deploying again after a few minutes.
```

It doesn't give you many details. At first, I thought it might be just a network issue because it was asking me to deploy again after a few minutes.

After failing for a couple of days, I've decided to look into the Firebase Console to see the log details. The error messages there, however, didn't help very much either.

That's because the Firebase console is just a UI connecting to services provided by the Google Cloud Platform. Their integration isn't very good yet.

However, if you go to the [Google Cloud Console](https://console.cloud.google.com/projectselector2/projectselector/functions/list), you can find detailed logs which will help you to debug your code:

- Go to the [console](https://console.cloud.google.com/projectselector2/projectselector/functions/list)
- Select your project
- Choose a function you'd like to debug
- Click on "view logs"

That's it! Happy debugging! :)

---

[Follow me on Twitter](https://twitter.com/ceolinwill)
Concorrência limitada em gorrotinas
Tags: go, goroutines
Published: 2019-12-10 17:36:54

Uma das coisas que me fascinaram quando comecei a aprender Go foram as Gorrotinas. A "facilidade" de criar processos concorrentes me motivou a tentar identificar onde poderia utilizar nas minhas apps pra conseguir ganhar desempenho.

Eis que eu encontrei a oportunidade numa app que estava construindo, basicamente eram feitas várias queries em tabelas do MySQL e precisava indexar tudo no Swiftype (uma engine de busca textual semelhante ao ElasticSearch).

A primeira versão ficou mais ou menos assim:
![versão simples](https://thepracticaldev.s3.amazonaws.com/i/u5bb6s6l2rph65kidxwj.png)


## Concorrência sem limite
Na função <code>main()</code> todos os registros do tipo document são listados, depois iterados e um a um são indexados no Swiftype.
O processo todo demorava um tempo longo com 80k registros para serem indexados um a um, pois cada chamada à API do Swiftype precisava esperar um retorno antes de ir para a próxima. Decidi usar gorrotinas para indexar todos os registros de forma concorrente e diminuir o tempo de execução. Alterando a função <code>indexAll()</code> para utilizar gorrotinas, ficou desse jeito:

![concorrencia não limitada](https://thepracticaldev.s3.amazonaws.com/i/t8hpf6bkpzggglfkmuoj.png)

Essa abordagem funcionou bem durante um pequeno momento até que começaram a estourar erros. Uma coisa que não havia levado em consideração é que existe um limite de conexões socket que o sistema operacional pode manter. Dessa forma serão criadas gorrotinas para cada registro a ser indexado, além disso pode gerar problemas de falta de memória, entre outros problemas.

Decidi então criar uma solução limitando o número de gorrotinas ativas, só poderia ser criada outra quando uma das ativas terminassem, pra ficar sempre o mesmo número de gorrotinas até que todos os registros fossem indexados.

## Concorrência limitada
![concorrencia limitada](https://thepracticaldev.s3.amazonaws.com/i/lz2bshib9ph7tp7trv6h.png)

O channel bufferizado age como uma fila, onde são adicionados os tokens das gorrotinas, quando o channel fica cheio não são criadas novas gorrotinas, até que alguma das que estão em execução terminam e o token é removido do channel, abrindo espaço para uma nova gorrotina ser criada.

## Conclusão
Dessa maneira uma execução que demoraria vários minutos levou no máximo 2 minutos. É claro que existem muitas outras abordagens para o mesmo problema, mas essa me deu uma oportunidade de usar gorrotinas de uma maneira simples e eficaz.

Agradeço o tempo que você investiu lendo esse post e espero que seja útil para você, deixe um ❤️ ou 🦄 caso tenha curtido!
Se tiver alguma maneira diferente de resolver o problema ou tiver alguma dúvida não deixe de comentar!
Package Cohesion: Reuse-Release Equivalence Principle
Tags: packageprinciples, reusereleaseequivalence, package, cohesion
Published: 2019-12-10 17:36:34

---
title: Package Cohesion: Reuse-Release Equivalence Principle
published: true
description: 
tags: package principles, reuse release equivalence, package, cohesion
---

Package cohesion is a way of composing packages that makes them reusable and easily maintainable. There are three package cohesion principles, reuse-release equivalence, package common reuse and common closure. 

Let's look at the reuse-release equivalence principle. 

REP states: 

> The granule of reuse is the granule of release 

However, I prefer the longer definition of: 

> All classes in a package must be reusable, and all packages must be released via bug tracking, version control and other forms of release. 

A good example of this is the `io` package in Java. It's a package that is easily usable in complex input/output situations. All classes in the `io` package depend on either default types or types included in itself. 

For example, we would only include classes from the `io` package if we used `ByteArrayOutputStream` or `IOException`.

{% gist https://gist.github.com/Naomi-Dennis/95de1fa26dbbad73dfcdd8108cc8e101 %}

An example of a package breaking the REP, is if the package needs other packages to be used. Take the example below: 

{% replit @Naomi_Dennis/example1%}

Exploring the files menu, we can see that the the Player package is dependent on the Armor and Weapon packages, limiting its reusability. The Armor and Weapon packages are _more_ reusable since it does't depend on other packages. Like the Math package, a reusable package should be useable in a different project. If the Player package was exported to a different project, it wouldn't be usable since the Armor and Weapon packages are not defined. 

We can fix this by combining the classes into one GameObjects package. 

{% replit @Naomi_Dennis/repexamplerefactor %}

### In Conclusion

The reuse-release equivalence principle is great for ensuring that packages can be used across multiple projects. One major benefit of this principle is a single package can be used across multiple versions of a project since all changes are inclusive. 

One thing we didn't talk about is releasing a package. That largely depends on the developers as there are many different bug tracking, version control, documentation tools, support tools, etc. that are available and it's largely based on preference. The gist of the idea, is, as packages are created and made reusable they should be released to the wider project and/or public.
Laravel And Vue Tutorial | Create Your Own Twitter Application
Tags: laravel, vue, follow, unfollow
Published: 2019-12-10 17:06:40

Hello artisan, in this tutorial, i will show you how we can create a simple twitter application using laravel 6 and vue js. In this tutorial i will also show you how to create follow-unfollow system in laravel using vue js. 

I am using Axios to send a network request. We simply build an application in which, the user can post the tweet and appears in his timeline. Also, one user can follow or unfollow each other. 

 If currently signed in user follow any other registered user then he can also see the following user’s tweet in his timeline. The very basic app, but the very powerful web app to understand laravel and vue.js fundamental concepts.

I am putting this Laravel and Vue Example project on Github so you can check it out there. Git repository for this project

#Read post #https://www.codechief.org/article/laravel-and-vue-tutorial-create-your-own-twitter-application
Edge's lost "E"
Tags: edge, browsers, useragent
Published: 2019-12-10 16:17:22

It's not news that Edge is rebranding itself. We've all read about its new icon (and maybe ranted about its similarity to Firefox's), but I'm not here to talk about that. I'm here to talk about its _other_ lost E...

I was looking at the user-agent string for the new Edge, the one using the Chromium renderer:

```
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3974.0 Safari/537.36 Edg/80.0.345.0
```

And I noticed something... interesting. For comparison, here is the current Edge's (the one using EdgeHTML) user-agent string:

```
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362
```

Did you see it? There's a lot there -- and I could spend a whole post ranting about all the spoofing going on here (and in all major browsers' user-agents, to be honest), but look at the last browser name. Old Edge declares itself as "Edge," nothing weird there, but new Edge declares itself as "Edg." This will ensure that any user-agent-sniffing scripts looking for "Edge" won't target the new, Chromium-powered browser.
Day 7 - More Modules - Learning Node JS In 30 Days [Mini series]
Tags: node, javascript, codenewbie
Published: 2019-12-10 16:07:59

__Today we’re going to learn about some more about `module`__

We are using files as last post.

{% post nerdjfpb/day-6-learning-node-js-in-30-days-mini-series-758 %}

Now it can happens that in our song folder there are two different functions.


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/5bwqggqqfbyaw60v5l6p.png)


Now how to send this both module, as per we know from last posts we can’t send both functions using this module.exports

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/qbmlyouqpolw3qkvybga.png)

Adding `module.exports.VARIABLE_NAME` we can send it to other file

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/itjrgotohoxk7ucd66xj.png)


By using `Song.VARIABLE_NAME` what we’ve send from `song.js` file we can call the functions

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/acz27ne1icxncyj9har6.png)


This is not all, there are some others way you can do it to. What if you have 100 functions in the same file are you going to write one by one ?

Now we can just use module.exports as a object ! Example –

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/jx44v57cz3lo2gur1ctc.png)


app.js will be the same and if we run it now then same result

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/i4aovgr2d2ololrkqjxb.png)


now we can modify code a bit. When the name are same in es6 version we can write just once.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/z3hdmppeycvajql7rkja.png)


So, do you feel you know a bit about module now ?

You can see the graphical version here
{% instagram B55cCyPg0zc %}

Originally it published on [nerdjfpbblog](https://blog.nerdjfpb.com/day7-nodejsin30days/). You can connect with me in [twitter](https://twitter.com/nerdjfpb) or [linkedin](https://www.linkedin.com/in/nerdjfpb/) !
Giving Thanks for Diversity in Tech: Claire Tolbert
Published: 2020-01-07 00:31:42

---
title: Giving Thanks for Diversity in Tech: Claire Tolbert
published: true
date: 2019-12-10 15:59:27 UTC
tags: 
canonical_url: https://www.thisdot.co/giving-thanks-for-diversity-in-tech-claire-tolbert
---

![image1](//images.ctfassets.net/zojzzdop0fzx/1jLlaGKYHPjKxLI28dfZaQ/e7acfbb5bffc48b7d180944cc93a781c/image1.jpeg)

Claire Tolbert is a Dallas-Fort Worth-based Performance Engineer with Alkami, a fintech software company.  She divides her working hours pretty evenly, between .NET development and production fire triaging.

Claire is passionate about education within technology.  But not all of her social and educational work is done behind a screen- she has also served as the Dallas Director of Women Who Code (Dallas-Fort Worth), a non-profit organization dedicated to uplifting women who want to pursue successful careers in tech, and create a more inclusive tech industry.

To Claire, inclusion is “the ability to ask a question in a meeting and not feel stupid.” She adds that, “None of us knows everything! Some days, I'm the person answering the questions, others I'm asking them. I think the least I can do to make everyone feel more included is to make everyone feel comfortable asking more questions.”

And when asked what she would share with another woman who is interested in pursuing a career in tech, Claire said that she would tell them, “You can do it. You ARE strong enough. You ARE smart enough. Your compassion, your drive, your skillset, and your fire are all things that are unique to you and make you an asset to any team.”

Not enough time to stop by a Women Who Code DFW event?  You might catch Claire out at brunch with her friends- they’ll be the table laughing the loudest (her words, not ours!)- or you could join her for a board or video game! 

Want to keep up with what Claire is doing in the coming year?  Check her out by searching her Twitter handle, which also happens to sound very much like a 90’s children’s sitcom: [@JustAskClaire](https://twitter.com/JustAskClaire).
Starting React today?
Tags: react, beginners
Published: 2019-12-10 15:28:46

React is intimidating, daunting even. And yet it is very simple. That's a paradox, right? And it is pretty annoying for beginners, and for me as everyone takes me for a fool. So let's talk about why it feels so damn hard to learn, and how I would start again today.

**TL;DR**: react is not hard, the ecosystem is. And the ecosystem is like that because it has to answer the many questions React left unanswered. If you're starting today, start a small project with just React, feel the pain, restart the project, add a library, feel other problems, repeat :D

## Why does React feel so hard to learn?

But first, what is React anyway? React is a JavaScript library for building user interfaces, UI for short. If you've tried to learn React, you might know that already 😃 What this library does is build HTML and allow you to "react" to user interactions. And that's it, it doesn't even come with a way to deal with data from any source.

Even though, it does "little" it does it very clearly. The library enforces the concept of *component*. The components can either "draw" HTML tags or other components. Of course, the sub components can do the same. Therefore we end up with a tree structure that builds our UI.

React does contain other concepts, but really that's the gist. And that's the issue. Because it only does the UI, it does not answer the needs for a fully fledged Single Page Application. And thus, the community began to address them which led to the creation of the React Ecosystem. Each piece of the ecosystem comes with its own limitations which led to other patterns and libraries, and so on and so forth...

With this plethora of libraries, best practices and patterns, how does one create solid basis for learning React?

## Start like it's 2013 🤘

There is no better way to start learning a new tool than when it is rudimentary. Unfortunately for you, it's not the case anymore with React. But you can still emulate that with create-react-app 👍

```sh
# make sure you have node installed
npx create-react-app learning-iteration-1
cd learning-iteration-1
npm start
```

The recipe is quite straightforward:
 1. pick a small project idea
 2. use only react to build it
 3. feel the pain, if there is no pain then switch project 🎉
 4. start again and introduce a single library / pattern that will solve a pain point
 5. repeat from 3.

Here are some challenges that you want to solve in your project:
 - synchronize two components that are not parent / children
 - load data from the web
 - make a big tree and have only few components update
 - leave your best idea in comments 😍

With this method, you will build up your knowledge rather than being overflowed by contradictory information. You will be able to forge your own mind on which solutions to adopt.

Hope you will find those suggestions useful 🙇‍♂️
And follow me if you want to read more react things 😃
Day 20 of⚡️ #30DaysOfWebPerf ⚡️: Remote Debugging
Tags: webperf, webdev, performance, devtools
Published: 2019-12-10 15:15:57

{% twitter 1204418771286405121 %}
{% twitter 1204418772020420608 %}

---

This article was originally published on [sia.codes](https://sia.codes/). Head over there if you like this post and want to read others like it, or sign up for my [newsletter](https://buttondown.email/sia.codes) to be notified of new posts!
Rule of three
Tags: software, development, programming
Published: 2019-12-10 15:08:46

---
title: Rule of three
published: true
description: The “rule of three” is code refactoring rule of thumb to decide when a replicated piece of code should be replaced by a new procedure
tags: software, development, programming
cover_image: https://images.unsplash.com/photo-1550985543-49bee3167284?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1334&q=80
---

Sometimes called “1, 2, refactor”, the “rule of three” is code refactoring rule of thumb to decide when a replicated piece of code should be replaced by a new procedure. It states that the code can be copied once, but that when the same code is used three times, it should be extracted into a new procedure. 

> “Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior”
> ― Martin Fowler

This is a rule that has really served me well in recent years when I’ve come up against challenges on when something should be refactored.

As developers it’s all too easy to spend too much time trying to engineer perfection, when really, all we needed to do was what was asked of us.

We also have to recognise that we can’t always plan for the future and by refactoring or abstracting code too early, you may find that you back yourself into a corner which results in, you guessed it, two versions of the code, each with slight differences to accommodate the tight coupling.

It really only makes sense to defer the decision to refactor once you know a bit more about what it is you’re trying to do.

After all, you can’t plan for what you don’t know. You can only deal with the information that you have right now, so we should programme for that.

> “Whenever I have to think to understand what the code is doing, I ask myself if I can refactor the code to make that understanding more immediately apparent.” 
> ― Martin Fowler

This is, being a rule of thumb means that there are exceptions to this rule, there are good times to refactor as well as bad. This rule prevents you refactoring before you have enough information.

If you find yourself in a situation where you’re asking whether it’s too early to refactor, it probably makes sense to apply this rule.
Iterations in Javascript
Tags: javascript
Published: 2019-12-10 14:54:48

---
title: Iterations in Javascript
published: true
description: Using "for" loops
tags: javascript
cover_image: https://ferrariwebdevelopment.s3.us-east-2.amazonaws.com/assets/20191020-for-loops.jpeg
---

## Using "for" loops

In programming we often need to iterate on a series of values. For example, we
may have to print out all the numbers in an array. Or we may have to multiply a series of numbers together.

One common way to iterate on a list is to use a `for` loop.
A `for` loop in Javascript has this structure:

```
for (  <1. initialize a counter>;
       <2. condition>;
       <3. increment the counter>) {

  <4. statement>

}
```

In *step 1* we initialize a counter that will be used to keep track of our iteration. We typically set this to a variable called `i`
The variable name can be anything, but it's common to use the letter `i` for *iterator*. If you need more than one variable, you can use other names, like `j`, `k`, or anything else.

In this example below, we initialize the iterator to `0`:

```js
let i = 0
```

*Step 2* is the condition that allows our loop to continue looping. As long as the condition is `true`, our loop will keep going.
An example of a condition is:

```js
i < array.length
```

Here we assume we have an array and check its length.
If the iterator `i` is less than the array length, the condition evaluates to true so we keep on looping.
If the iterator `i` reaches a higher value than the length of the array, the condition evaluates to false, and the loop stops.

In *step 3* we increment the iterator. If the iterator was `0` at the beginning of the loop, in step 3 we may want to increment it to `1`.
We do this with this syntax:

```js
i++
```

If the iterator starts at 1, this code will increase it by 1 and will assign the value back to the iterator, so the iterator is now 2.
We don't have to increase it every time, we can decrease it or add 2 every time, like so:

```js
i--    // decrease by 1
i + 2  // increase by 2 every time the loop executes
```

What we do depends on what we need to achieve in our loop.

*Step 4* is the statement that will be executed each time the loop iterates. This can be any Javascript expression and it's the operation we need to complete for each iteration.

Let's see an example of loop in action.

Say we want to print out all the elements of an array. We set up a function called `printArrayElements` that takes an array as an argument and sets up a loop. The loop goes through all the elements and prints them to the console one by one.

```js
const printArrayElements = array => {
  for (let i = 0; i < array.length; i++) {
    console.log("Array element:", array[i]);
  }
}

printArrayElements([1, 2, 4, 5]);
printArrayElements(['a', 'b', 'c', 'd']);
```

Tomorrow we will look at more complex examples of looping, but all `for` loops
work the same way under the hood.

---

*I write daily about web development. If you like this article, feel free to share it with your friends and colleagues.*

*You can receive articles like this in your inbox by [subscribing to my newsletter](https://cesare.substack.com).*
What is Domain Authority?
Published: 2019-12-10 14:37:57

Domain Authority is a ranking factor given by Moz Link Explorer tool which grades from 0 to 100 points. It’s similar to the Page Rank which used be considered and provided by Google earlier. Domain Authority is an essential factor in SEO Rankings.

Link Explorer is a tool to check Domain Authority of any website. Before this, Moz has OSE (Open Site Explorer) which was used to check the domain authority.

On 05th Mar 2019 Moz has launched Domain Authority 2.0 which has an improved algorithm. There was a massive noise from the top businesses in the launch of DA 2.0, as it has affected many companies domain authority. Some of the top companies DA has drastically gone down.

https://mac19.bcz.com/2019/11/28/what-is-domain-authority/