teleren/devto huggingface dataset:
Remote Back-End in Terraform
Tags: DevOps, infrastructure, aws, terraform
Published: 2020-05-03 02:47:07

A "backend" in Terraform determines how the state is loaded and how an operation such as apply is executed.

By default, Terraform uses the "local" backend, which is the normal behavior of Terraform you're used to, but, if you're working in a team, or you don't want to keep sensitive information in your local disk, or you're working remotely, it's highly recommended to store this 'state' in the cloud, and we're going to see in this article how it can be done storing the backend in an S3 bucket.

---

### TL;DR

To configure your remote state in Terraform, you need two instances:

 - An s3 bucket where the terraform.state file is stored.
 - A dynamo table with a lock id to prevent two or more users perform changes to the state at the same time.

When you call `terraform plan`, or `terraform apply` it locks the access to the state using the Lock ID in the dynamo table and then uses the terraform.state file to apply the changes to your infrastructure. When the changes are done, the terraform.state file is updated and the table is unlocked to allow new operations.

---

### Create S3 Bucket

The code to create the S3 bucket is the following:

```yml
provider "aws" {
  region = "us-east-1"
  version = "~>2.59"
}

resource "aws_s3_bucket" "enterprise_backend_state" {
  bucket = "my-backend-bucket"

  lifecycle {
    prevent_destroy = true
  }

  versioning {
    enabled = true
  }

  server_side_encryption_configuration {
    rule {
      apply_server_side_encryption_by_default {
        sse_algorithm = "AES256"
      }
    }
  }
}
```

---

### Create the Dynamo Table

The code to create the dynamo table is the following:

```yaml
resource "aws_dynamodb_table" "enterprise_backend_state" {
  hash_key = "LockID"
  name = "backend-lock-table"
  billing_mode = "PAY_PER_REQUEST"
  attribute {
    name = "LockID"
    type = "S"
  }
}
```

---

Once you have an s3 bucket and the dynamo table you're ready to tell Terraform to store the state in s3 bucket from now on:

```yaml
terraform {
  backend "s3" {
    bucket         = "my-backend-bucket"
    key            = "dev/terraform.tfstate"
    region         = "us-east-1"
    dynamodb_table = "backend-lock-table"
    encrypt        = true
  }
}
```

That's it. You can do `terraform init` to execute the configuration. You'll notice Terraform will no continue storing the state on your disk. You´re ready to start collaborating with your team on the same infrastructure.
Simulación
Tags: writing
Published: 2020-05-03 02:20:20

“La SIMULACIÓN es el proceso de construir un modelo de algún sistema
real, en estudio, y llevar a cabo experiencias con él, con la finalidad de
aprender el comportamiento del sistema en sus distintos aspectos o de
evaluar distintas estrategias para el funcionamiento del sistema, sin tener
necesidad de experimentar con el sistema mismo.” R. E. SHANNON en 1975 
La simulación reproduce un conjunto de características precisas, que son propias del estado real (del sistema), con el objeto de imitar dicho estado en todos, o casi todos sus aspectos. Es decir, construir modelos. Además permite realizar ensayos que demandarían meses o años, respecto del fenómeno en estudio (sistema), en minutos.
 
## **Metodología de la simulación** 
- El **MÉTODO ANALÍTICO O ENFOQUE ANALITICO**: Método tradicional, desarrollado y manejado por especialistas.
- La **DINÁMICA DE SISTEMAS** (DS) O ENFOQUE SISTEMICO: Elaborado con el
objeto de facilitar su entendimiento y manejo por parte de personas no iniciadas.

### **Método Analítico**
Este método considera todo con el máximo detalle hasta lograr la
total integración de sus partes. Es decir, va de las partes al todo.
El proceso de simular digitalmente un fenómeno (sistema) determinado utilizando el método analítico, comienza con el empleo de series de números generados en forma aleatoria, denominados TABLAS DE NÚMEROS AL AZAR o simplemente, NÚMEROS AL AZAR. 
Estas tablas poseen una función de distribución de probabilidad uniforme y se trata, generalmente, de números comprendidos entre el 0 (cero) y el 1 (uno). 
Generalmente es necesario modificar la función de distribución de la tabla de números al azar para transformarla en la que posee la variable a simular. La tabla resultante de esta transformación, es la denominada **MUESTRA ARTIFICIAL**
 
### **Dinámica de Sistemas**
Este método desmiembra a los sistemas hasta llegar a sus componentes elementales. Es decir, va del todo a las partes. El objetivo básico de la Dinámica de Sistemas es llegar a comprender las causas estructurales que provocan el comportamiento del sistema. Esto implica aumentar el conocimiento sobre el papel de cada elemento del sistema, y ver como diferentes acciones, efectuadas sobre partes del sistema, acentúan o atenúan las tendencias de comportamiento implícitas en el mismo.
A diferencia de otras metodologías esta no busca predecir el futuro, mas bien busca conocerlo y comprobar la consistencia de nuestras hipótesis y la efectividad de las políticas.
How to stay motivated while studying data structures and algorithms
Published: 2020-05-03 02:03:14

If you're like me, you might find it difficult to study data structures and algorithms. It's especially hard in the beginning because you probably won't be very good at them, which will make you want to do them even less. That's what it's like for me. I'm not very where I want to be in terms of data structures and algorithms skill level. To get better will require practice, but how can I practice if I never want to do them?
Here are some tips on how to stay motivated:
1) Realize you won't stay motivated very long. Motivation is great in the beginning but it slowly fades away because keeping up long motivation is tiring.
2) Set up a routine! Instead of relying on pure motivation, build up a routine. It could be just completing 1 Leetcode problem a day. You can set a minimum you need to accomplish for the day.
3) Try not to memorize problems but instead figure out how you worked up to that problem. What were the steps that lead you to that solution?
4) Occasionally come back to problems you've done before. Refreshing your memory of how you solved a certain problem is a good idea, and it won't take you very long if you already know how to solve it.
5) Give yourself time. Cramming 8 hours a day may work for you but you have to ask yourself if you're actually retaining anything.

Thank You for reading. If you have some experience doing algorithm and data structure interviews leave a comment down below! I would love to hear about your experience!
Published Articles to Gitlab
Tags: showdev
Published: 2020-05-03 01:58:46

Earlier I had posted about my project to auto publish to dev from gitlab. This hasn't made it that far, it can save existing articles. Like other attempts I don't think it will post new articles. 

{% link https://dev.to/jessekphillips/hobby-project-dev-to-api-59ln %}

I wanted to get my articles in version control. I didn't really want unpublished articles published. I also want to organize my articles more, and improve findability for when I want to reference them.

At this point no organization is done and since the meta file references the markdown it isn't as easy as moving files around... 

https://gitlab.com/jessephillips/blog/-/tree/master/Articles
Learn To Build Mobile Apps with Ionic Framework & ReactJS Video Series
Tags: javascript, react, ionic, tutorial
Published: 2020-05-03 01:34:54

I have been using [Ionic Framework](https://ionicframework.com/) as the framework of choice for my software development firm [Clearly Innovative Inc](https://www.clearlyinnovative.com) since v1. We have [built solutions](https://www.clearlyinnovative.com) for large clients and small clients. We have hired and trained multiple developers, who had their first development job with us, using Ionic Framework. 

> 📺 Upcoming Video Series: [Series Overview Video On YouTube Now!](https://youtu.be/Es2Td9_UoZc)

##Needless to say, we are all in on Ionic Framework.

We started with Ionic and Angular v1 and continue to do work with angular, but have move on to utilize reactjs and even VueJS to build solutions for clients and for internal projects for my other company Inclusive Innovation Incubator.

We also offer free training and host meetups teaching javascript utilizing Ionic, ReactJS, VueJS and Angular.

I have started posting content here on Dev.To more consistently and I am also posting more video content over on [YouTube](https://www.youtube.com/channel/UCMCcqbJpyL3LAv3PJeYz2bg). I encourage you to please check out some of the [video content on ReactJS](https://www.youtube.com/watch?v=Sx1LlavDgMg&list=PL2PY2-9rsgl3OHIMYb1AzVG5wADUxOmUW). 

[![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5bxfm04xiqyyzn4wdnw5.png)](https://www.youtube.com/watch?v=Sx1LlavDgMg&list=PL2PY2-9rsgl3OHIMYb1AzVG5wADUxOmUW)

There is video content on [VueJS](https://www.youtube.com/playlist?list=PL2PY2-9rsgl2bgNTX9omlDisiWh1NYInz) also but please remember **vuejs is still in beta**.

[![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/aew7u04bxh1hx84xjkai.png)](https://www.youtube.com/playlist?list=PL2PY2-9rsgl2bgNTX9omlDisiWh1NYInz)

Finally I am always looking for new idea on what kind of content people will find interesting so feel free to leave comments here or on the [YouTube Tube](https://www.youtube.com/channel/UCMCcqbJpyL3LAv3PJeYz2bg).

Thanks for stopping by and please enjoy the content!!
A different approach to productivity in the workplace
Tags: motivation, career, business, books
Published: 2020-05-03 01:12:41



_Joy Inc._ tells us the history of Menlo Innovations from the point of view of its CEO, Rich Sheridan, and how he was able to provide a workplace that has the feeling that we're all looking for. Instead of just put pressure and create almost a hostile environment for its co-workers - as many companies do - Sheridan decides to look at the situation from a different angle. What if we could bring happiness to the workplace and STILL keep our numbers high? That's what he did.

Let's see why this works so well at Menlo Innovations. It's possible to summarize Rich's approach into some key points:

### Motivated workers = more engaged workers

First, let's talk about motivation. I always find difficult to work in something that I don't love at all. Even when I get the job done, I have never felt it fulfill. In other words, I would never be able to be the best in something that I didn't see meaning, or just don't like it. Joy is the key to find meaning in that you do, thus, the key to motivation. A more motivated worker means someone who is able to drive its creativity to the maximum level, and do things that another co-worker wouldn't think or just wouldn't care enough to do.

### Flexibility in the workplace means more creativity overall

Would you rather work in a dark and windowless or in an open space where you feel more comfortable and relaxed? I'm guessing the first one. The primary goal to redesign Menlo's office was to give their co-workers more freedom to even redesign the place if necessary. That freedom in their space means freedom in their mind. A more open and enjoyable space gives you all the flexibility that you need to come up with new and fresh ideas!

### Communication is everything

This concept of workplace also brings another advantage: open communication. In Menlo, this process is done through a _high-speed voice technology which allows them to avoid conflicts and misunderstanding instructions. This goes against many companies' communication systems, which are done by email or things like that. Theses techniques can be error-prone and also since the writing is the most difficult type of communication, it's far more difficult to ensure that all the employees are on the same page.

### Teamwork - you are never working alone here

At Menlo, each employee works in pairs and each pair has its computer. This is done for a couple of reasons. First is less likely that for you to commit a mistake since you always got someone on your back, helping you out. It's also a technique for improving communication between co-workers which creates a more enjoyable space overall. Also, every week they change partners which helps them to built new relationships and gain more experience.

## Conclusion

Joy is the key to change the world. Is the only thing that can ensure that your co-worker will give their best, always. Rich Sheridan's company culture not only proves that as well serves as an inspiration that can lead to real changes in the workplace and consequently the world.
color cells for programers
Tags: codepen
Published: 2020-05-03 01:12:31

<p>I have created this code so that anbody who is looking for a big range of colours, can find it here.
You might ask me, why did you do this colour table?
Well, it isn't juste a colour table, it's a colour coded table.
Depending on which css property you chose and if you want a semi-colum at the end or not, you will just need to choose in the two scroll-down list.
The minute you made your choice, it will be applied on every single line that condains a colour tag. Usefull, isn't it?</p>

<p>If you like this project, please consider sharing it and not to forget to credit the author.</p>

<p>If you wish, an all in one version (no need of the js or the css file, all will be included in the same page), you can download it on this github page: <a href="https://github.com/HenraL/Color-Table">https://github.com/HenraL/Color-Table</a></p>

<p>If you wish to leave a review, fell free to do so here (<a href="https://forms.office.com/Pages/ResponsePage.aspx?id=DQSIkWdsW0yxEjajBLZtrQAAAAAAAAAAAANAAf0m3cRUNjNHSkk3N0xKVUpHUjAxWENFN0o4TkdTTC4u" target="_blank">https://forms.office.com/Pages/ResponsePage.aspx?id=DQSIkWdsW0yxEjajBLZtrQAAAAAAAAAAAANAAf0m3cRUNjNHSkk3N0xKVUpHUjAxWENFN0o4TkdTTC4u</a>)</p>

<p>By the way, here is the long list of options for customising:</p>

<ul>
<li>for the option "nothing" --&gt; ""</li>
<li>"color:"</li>
<li>"background-color:"</li>
<li>"border-color:</li>
<li>"border-top-color:"</li>
<li>"border-bottom-color:"</li>
<li>"border-right-color:"</li>
<li>"border-left-color:"</li>
<li>"outline-color:"</li>
<li>"text-decoration-color:"</li>
<li>"caret-color:"</li>
<li>"column-rule-color:"</li>
<li>"stop-color:"</li>
<li>"border-inline-start-color:"</li>
<li>"border-inline-end-color:"</li>
<li>"border-block-end-color:"</li>
<li>"border-block-start-color:"</li>
<li>"flood-color:"</li>
<li>"lighting-color:"</li>
<li>"border-block-color:"</li>
<li>"border-inline-color:"</li>
<li>"scrollbar-3dlight-color:"</li>
<li>"scrollbar-arrow-color:"</li>
<li>"scrollbar-base-color:"</li>
<li>"scrollbar-darkshadow-color:"</li>
<li>"scrollbar-face-color:"</li>
<li>"scrollbar-highlight-color:"</li>
<li>"scrollbar-shadow-color:"</li>
<li>"scrollbar-track-color:"</li>
<li>"scrollbar-color:"</li>
<li>"text-emphasis-color:"</li>
<li>"-moz-column-rule-color:"</li>
<li>"-moz-text-decoration-color:"</li>
<li>"-webkit-column-rule-color:"</li>
</ul>

{% codepen https://codepen.io/henry-letellier/pen/wvKepmR %}
Uma visão geral sobre Alpine.js + Tailwind
Tags: alpinejs, javascript, tailwindcss, css
Published: 2020-05-03 01:11:46

Alpine.js é um framework reativo como o Vue e o React só que com um custo mínimo, zipado o alpine ocupa 4Kb. Para quem programa e utiliza Vue a sintaxe é praticamente a mesma, como o próprio autor aponta na [documentação](https://github.com/alpinejs/alpine).

Recentemente comecei a trabalhar com o Tailwind, um framework css de "baixo nível" que utiliza classes como açucar sintático para o puro css. A primeira coisa que pensei quando conheci a ferramenta foi "por que alguém se submeteria a escrever tanta coisa no html?", veja, o código parece sujo no começo, mas os componentes pre-desenhados, o esquema de responsividade deles (melhor até que o do bootstrap), além do código estupidamente explicito, me ganhou. As telas realmente são feitas mais rapidamente e eu não tenho mais que parar, ir numa folha de estilo, procurar qual parte do código tá modificando aquilo, caçar se outra folha está sobrescrevendo o estilo, etc.

O Alpine.js é como o tailwind, deixa explícito o que está sendo feito, a curva de aprendizado é muito curta e é ótimo para ser utilizado em conjunto com o Tailwind. Abaixo o código de um simples todo list feito com o micro framework: 

{% codepen https://codepen.io/itepifanio/pen/VwvreoP %}

No exemplo são utilizados conceitos simples, o ` x-data="{ items: [], item: '' }" ` declara um escopo pro componente, como se fosse uma variável. O ` x-for ` cria o dom dinamicamente iterando sobre a variável ` items `. O ` x-model ` conecta as modificações do input com a variável item e o ` @click ` ativa o evento que insere um valor no item.  

Eu realmente estou gostando de trabalhar com ambas as ferramentas e acho que ambas me tiraram da zona de conforto das camadas de abstrações que outros frameworks oferecem, então você realmente aprende css e js utilizando o alpine + tailwind. O projeto que me fez conhecer essas tecnologias utiliza o Laravel (framework PHP) com o Livewire (uma abstração do laravel que componentiza código PHP), tailwind e alpine js, uma stack para ser comentada em outros posts.
Finally, I created a blog, Looking for Reviews and Suggestions.
Tags: gatsby, vercel, blog, react
Published: 2020-05-03 00:48:40

---
title: Finally, I created a blog, Looking for Reviews and Suggestions.
published: true
description: Blog by Ashish, built using Gatsby, Hosted on Vercel(previously Zeit)
tags: Gatsby, Vercel, Blog, React
---

Hey there ! Hope you are safe and enjoying the lockdown period wherever you are. 

I always wanted to create a blog, but Wordpress although easy, restricted me to change the things i wanted to. I wanted more control, So i tried Gatsby.

Here is a link to the blog : https://myblog.ashishkumarsinghh.now.sh/

I am looking for suggestions and improvements. Your suggestions will be helpful to you and the community both as the code will be on Github and anyone can start from there, You will not have to waste time doing the trivial stuff.
String vs &str in Rust
Tags: rust
Published: 2020-05-10 08:25:32

---
title: String vs &str in Rust
published: true
date: 2020-05-03 00:00:00 UTC
tags: rust
canonical_url: https://fullstackmilk.dev/string_vs_&str_in_rust/
---

Both contain [utf-8](https://stackoverflow.com/questions/2241348/what-is-unicode-utf-8-utf-16) encoded text, but:

- `String` [owns](https://doc.rust-lang.org/nomicon/ownership.html) the data stored within it. When the `String` is deallocated the text data it stores is deallocated as well.
- `&str` points to data that's already stored in a `String`, it doesn't store any text data of it's own. When a `&str` is deallocated the data it points to is left untouched.

In Rust terminology a `&str` [borrows](https://doc.rust-lang.org/1.8.0/book/references-and-borrowing.html) data from a `String`.

Handily, a `&str` can be shorter than the `String` it references. This helps make string handling fast and memory efficient as we can simply break up a pre-existing `String` into chunks that all just reference the original `String`, no heap allocations or data copying needed.

In the example below, text data is only allocated once when we read a file into memory. The rest of the strings are all just references to the original.


```rust
use std::fs::read_to_string;

fn main() {
    // Reads text from a file and stores it in memory in a String
    let input: String = read_to_string("src/example.txt").unwrap();

    // Remove leading and trailing whitespace. No memory is copied on this line,
    // `trimmed` just points to the parts of `input` that don't include leading
    // or trailing whitespace.
    let trimmed: &str = input.trim();

    // No text data gets copied here either.
    // Each `&str` representing a line of text simply points to data already
    // stored in `input` above.
    for line in trimmed.lines() {
        println!("{}", line);
    }
}
```

*Cross posted from [Full Stack Milk](https://fullstackmilk.dev/string_vs_&str_in_rust/).*
Check for undefined in JavaScript
Tags: javascript, beginners
Published: 2020-05-04 07:56:37

---
title: Check for undefined in JavaScript
published: true
date: 2020-05-03 00:00:00 UTC
tags: javascript,beginners
canonical_url: https://magarcia.io/2020/05/03/check-for-undefined-in-javascript
---

If you’re writing JavaScript more or less regularly, at some point you’re probably faced with a situation where there was a need to check if a variable is `undefined`.

But, what is the best way to do it?

## The intuitive way

Any programer with experience in other language will use the intuition to figure out:

```
if (x === undefined) { ... }
```

And this will work without any problem, or almost.

Comparing directly with `undefined` will work on all modern browsers. But old browsers allowed its value to be re-assigned like this:

```
undefined = 'new value';
```

With this re-assignment, a direct computation will not work as expected.

This behavior was fixed in 2009 with [ECMAScript 5](https://es5.github.io/#x15.1.1.3) :

> **15.1.1.3 undefined**  
> The value of `undefined` is **undefined** (see 8.1). This property has the attributes { [[Writable]]: **false** , [[Enumerable]]: **false** , [[Configurable]]: **false** }.

## The “safe” way

If you have to support old browsers and you’re concerned about someone re-assigning the value of `undefined` there are other ways to do the check.

### Reading the type

You can use the [typeof operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof), that will return the string `"undefined"` so you can check for it.

```
if (typeof x === "undefined") { ... }
```

**Note:** The `typeof` operator does not throw an error if the variable has not been declared.

### Using `void`

Alternatively, you can use the [typeof operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof) to check for `undefined`. For example:

```
if (x === void(0)) { ... }
```

In this example, the zero doesn’t have any special meaning. As stated on MDN:

> The **void operator** evaluates the given _expression_ and then returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined).

## Which way is better

In my time as a consultant I learned what’s the best answer for this kind of question: it depends. I would depend on the concrete use case you have but I can give you some tips.

In general, I tend to use the convention that is already present on the codebase. But if you’re writing a new code that will run only on modern browsers I’ll suggest to go for the direct comparison (it’s clear and easy to understand also for people that don’t know JavaScript). For old browsers support, I strongly recommend to create a function `isUndefined` and use the option of your choice inside. Then the code will express their purpose clearly to everyone.

(This is an article posted to my blog at magarcia.io. You can read it online by [clicking here](https://magarcia.io/2020/05/03/check-for-undefined-in-javascript).)
Data science for begginers
Tags: datascience, beginners, python
Published: 2020-05-02 23:46:03

Data analytics, Data science is one of the most essential job in XxI century.
Learn skills of Data science with me.
Python is one of the best language to learn and start career as Data scientist.
Let's do it today.

I will try to give essential informations about 5 the most important python libraries!!

Follow me and start learning it!