teleren/devto huggingface dataset:
Failover Architecture on AWS(Part 1/4)
Tags: aws, devops, cloud
Published: 2020-06-18 15:06:11

# **INTRODUCTION**

Nowadays it is important to have highly accessible architecture on production servers to prevent unpleasant situations e.g. service unavailability. So, here in [Appus Studio](https://appus.software/) we have some good solutions for it and in this article, I will show the easiest way to configure the failover system in AWS.

**Let’s take a look how our sсheme will look like:**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qnpzfeq8czl4ob5h34bp.jpg)
 
In this example, we will use services such as EC2, Route53 and Certificate Manager.
Let’s clarify our next steps:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. Request SSL certificate on Certificate Manager
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. Create Classic Load Balancer
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3. Create Launch Template
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4. Create Auto Scaling group
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5. Attach DNS name of Load Balancer in Route53

After we have outlined our action plan, we can start configuring all of this.
So let’s request for SSL certificate on the Certificate manager. In the search toolbar enter "Certificate Manager" and click on it. Next, you have to choose to import your own SSL certificate or you can request it right here on AWS. The important thing here is you have to own domain name and make sure that you can create a recordset. 
Before requesting your certificate, you need to transfer the domain name under the management of AWS. In this article, I will skip that part and you can find a lot of information on how to do it, just  "google" it :)
Now, I will request an SSL certificate on AWS. Choose “Request a public certificate” and then hit “Request a certificate”. Then you have to enter your domain e.g. appusthebest.com or you can generate a wildcard SSL certificate by entering *.appusthebest.com it will allow you to have as much as you want subdomains for appusthebest.com, but this certificate will not work for appusthebest.com. In my case, I will create a wildcard SSL certificate for the corporate domain and hit “Next”. For verification, I will choose “DNS validation”. Next, we will need to add a tag to our certificate, you can add anything that you want, in my case this will be Key=Name and Value=appus.thebest then left-click on “Review” and “Confirm and request”. Since the domain name is managed by AWS  this is very convenient to confirm that we are truly the owner of the domain name. All I need is to click the arrow near to the domain, then the tab comes off and then click on create a CNAME record in Route53. Once it is confirmed you can see on the Status bar “Issued”. Congrats, we just requested an SSL certificate for our Load Balancer.
 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/v7eyrja7erb9szdqifla.png)

On this the first part of the article ends and in the next part I will show how to configure the load balancer. See you!
3 Things to make your Kubernetes Deployment look good
Tags: kubernetes, bestpractices
Published: 2020-06-18 14:42:11

Kubernetes Do's and Don'ts for **Cloud Native Application Developers**.

**What is Kubernetes?**

Kubernetes, a "Container Orchestration Platform", runs container workloads efficiently in a distributed environment.

Application workloads might mean Microservices or Macroservices that run in an isolated environment and interact with other services.

![Pod-Service Communication](https://dev-to-uploads.s3.amazonaws.com/i/i34q6hjx0wq8m0lizpea.png)


**#1 Use Service**

**Pods** are the smallest deployable units of computing that can be created and managed in Kubernetes.

Application runs inside pod in a container. As Kubernetes assigns internal IP Address to each pod, all deployed applications can easily communicate over Pod IP within the cluster.

However, pods may be rescheduled in case of failures that leads to a new IP assignment. So relying on Pod IP for application networking is not preferred.

**Service** acts as an internal Load Balancer to the pods defined within. Service enables pod discovery and traffic routing. Now application can communicate with the service over ClusterIP without worrying about Pod IP.

**#2 Define container resource limit**

Always define container resource limits as per expected application's footprint. Computing resources are CPU and Memory. Missing limit declaration may exhaust entire node resource and may lead running pod eviction.

**#3 Handle Errors Gracefully**
Application should handle the errors gracefully instead of an abrupt exit. Kubernetes will restart terminated containers repeatedly unless pod restartPolicy is set to "Never".


`foo.yaml` : Create a foo-pod with two containers. One container can be your main application and another container may be supporting application to the main application (or sidecar).

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: foo
  labels:
    app: foo-lab
spec:
  containers:
  - name: foss
    image: foss:v1
    resources:
      limits:
        memory: "128Mi"
        cpu: "200m"
    ports:
      - name: foss
        containerPort: 8080
  - name: fox
    image: fox:v1
    resources:
      limits:
        memory: "128Mi"
        cpu: "200m"
    ports:
      - name: fox
        containerPort: 8081
```


`foo-service.yaml`: Create foo-services with two ports to point two different ports exposed by the foo-pod.

```yaml
apiVersion: v1
kind: Service
metadata:
  name: foo-service
spec:
  selector:
    app: foo-lab
  ports:
  - name: foss-tcp
    port: 80
    targetPort: 8080
  - name: fox-tcp
    port: 81
    targetPort: 8081
```


`bar.yaml`: Create a bar-pod and use environment variable to point foo-service.

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: bar
  labels:
    app: bar-lab
spec:
  containers:
  - name: bar
    image: bar:v1
    env:
    - name: FOSS_SERVICE
      value: foo-service:80
    - name: FOX_SERVICE
      value: foo-service:81
    resources:
      limits:
        memory: "128Mi"
        cpu: "200m"
    ports:
      - name: bar-port
        containerPort: 8080
```
How I deployed my Gatsby site to AWS S3 - 4
Tags: aws, gatsby, webdev, showdev
Published: 2020-06-18 14:41:49

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7bv8mzmbmn04wtk6g10o.jpeg)

Welcome to part-4 of the series. We had created an IAM account in the previous part, we will start with getting the access keys from our AWS S3 bucket. So, go to you IAM login and click on Users. Click on the **Administrator** link.

![Administrator](https://ik.imagekit.io/thewebdev/thewebdev-fixes/5/1_eeZrK-LOR.png)*Administrator*

You can read rest of the blog from my blog site. The link is below.

https://thewebdev.tech/thewebdev-fix-5
How to Get Consistent Line Breaks in VS Code (LF vs CRLF)
Tags: engineering, styling, tutorial, crlf
Published: 2020-06-18 14:43:11

---
title: How to Get Consistent Line Breaks in VS Code (LF vs CRLF)
published: true
date: 2020-06-18 14:40:05 UTC
tags: Engineering,Styling,Tutorial,crlf
canonical_url: https://qvault.io/clean-code/line-breaks-vs-code-lf-vs-crlf/
---

 ![broken piece of wood in snow](https://qvault.io/wp-content/uploads/2020/06/photo-1519473473068-89e0fea77e1e-300x198.jpeg)

The post [How to Get Consistent Line Breaks in VS Code (LF vs CRLF)](https://qvault.io/clean-code/line-breaks-vs-code-lf-vs-crlf/) appeared first on [Qvault](https://qvault.io).

Ever had the problem where you submit a pull request and the diff is waaaaay bigger than it should be? The code looks identical but GitHub is telling you that it’s all different! This is typically due to a difference in line endings. Unix systems (Linux and Mac) default to the LF (line feed) character for line breaks. Windows on the other hand is “special” and defaults to CR/LF (carriage return AND line feed).

![Michael Scott condescending to the Windows OS](https://qvault.io/wp-content/uploads/2020/06/12bb747ebc3c94d638257f18ab25d307-300x244.jpg)

## The Quick Fix

If you are here to quickly fix a single file that you are having problems with, you are in luck. At the bottom right of the screen in [VS Code](https://code.visualstudio.com/) there is a little button that says “LF” or “CRLF”:

![](https://qvault.io/wp-content/uploads/2020/06/Screen-Shot-2020-06-18-at-8.29.36-AM.png)

Click that button and change it to your preference. Voila, the file you are editing now has the correct line breaks.

## The Big Fix

If you want new files to automatically have the correct line endings, then you can set the following setting in the top level of your settings.json file:

For LF:

```json
{
    "files.eol": "\n",
}
```

CRLF:

```json
{
    "files.eol": "\r\n",
}
```

If you set it in your global settings.json file it will apply to your entire machine. If you just want it set for the project you are working on, then edit the settings.json in the .vscode directory at the root of your project. **.vscode/settings.json**

Note: This setting will not automatically fix all files in your project that have the wrong line endings! It only applies to new ones. To fix the old ones go through and use the manual method.

## Thanks For Reading

Hit me up on twitter [@wagslane](https://twitter.com/wagslane) if you have any questions or comments.

Follow me on Dev.to: [wagslane](https://dev.to/wagslane)

The post [How to Get Consistent Line Breaks in VS Code (LF vs CRLF)](https://qvault.io/2020/06/18/how-to-get-consistent-line-breaks-in-vs-code-lf-vs-crlf/) appeared first on [Qvault](https://qvault.io).
Coding in Kindergarten
Tags: codenewbie, computerscience
Published: 2020-06-18 14:32:33

Instead of using laptops or tablets . . . i am using images, arrows and robots to teach kids how to code. It's easy cause you only need to combine fantasy with new technologies. 

You gonna be amazed how smart your kid is and how many things can achieve only in the age of 4. 

Why your kid need this:

1. Can explore, interact and communicate.
2. Can combine maths with calculating steps. 
3. Develop language and numerical skills.
4. Can do debugging with complex challenges.

* You can contact me via emai: antonia.symeonidou@outlook.com for video call lesson.
Creating Kubernetes Clusters with Terraform: Learning Provisioners
Tags: terraform, cloud, aws, route53
Published: 2020-06-18 14:24:14

---
title: Creating Kubernetes Clusters with Terraform: Learning Provisioners
published: true
description: Learning Terraform: Part VI
tags: terraform, cloud, aws, route53
cover_image: https://assets.mkdev.me/posts/covers/000/000/012/original/mkdev_article.png
---
In the last part of the Terraform Lightning Course we are going to learn how to provision servers with Terraform. To make it fancier, we are going to provision single node Kubernetes clusters with k3s.

{% youtube tcLvHoUe-NM %}

***

**Terraform Lightning Course**

* Part I: [Infrastructure as Code](https://dev.to/mkdev/infrastructure-as-code-and-how-terraform-fits-into-it-40bl)
* Part II: [Terraform Fundamentals](https://dev.to/mkdev/terraform-fundamentals-state-management-and-dependency-graph-creating-the-first-server-1756)
* Part III: [Configuring Terraform Templates](https://dev.to/mkdev/configuring-terraform-templates-variables-and-data-resources-5b99)
* Part IV: [Multi-cloud Terraform Environment](https://dev.to/mkdev_me/creating-multi-cloud-terraform-environment-with-the-help-of-remote-state-backends-and-aws-s3-1l0)
* Part V: [Refactor Terraform code with Modules](https://dev.to/mkdev_me/refactor-terraform-code-with-modules-1o21)
* Part VI: [Learning Provisioners](https://dev.to/mkdev_me/creating-kubernetes-clusters-with-terraform-learning-provisioners-2o6o)

*You can always hire [our mentors](https://mkdev.me/en/specializations) and learn directly from them!*
Handwriting long polling
Tags: javascript, tricks
Published: 2020-06-18 14:07:28

---
title: Handwriting long polling
published: true
description: how to write long polling connect in javascript
tags: JavaScript, Tricks
---

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vaee4954xeoavlus09p3.jpg)

Generally speaking we should use long connect in some real time communication scenes like: chat, web game etc.

`WebScoket` is useful tech to implement real time communication also `Server Side Events` is.

How to implement **long polling** manual? let's begin


### The flow:

1. A request is sent to the server.
2. The server doesn’t close the connection until it has a message to send.
3. When a message appears – the server responds to the request with it.
4. The browser makes a new request immediately.

### The code:

```javascript
async function subscribe() {
  let response = await fetch("/subscribe");
  if (response.status == 502) {
    await subscribe();
  } else if (response.status != 200) {
    notify(response.statusText);
    await new Promise(resolve => setTimeout(resolve, 1000));
    await subscribe();
  } else {
    let message = await response.text();
    notify(message);
    await subscribe();
  }
}
subscribe();
```

`subscribe` will await request response

If response **502** maybe network error will try call `subscribe` again. 

If response not ok(response status not equal 200) will notify error message and after one second try call `subscribe` again. 

Else if response ok  notify response body and immediately call `subscribe` again

Simply say `subscribe` function makes a fetch, then waits for the response, handles it and calls itself again.



Hope it can help you :)
How to: Move Azure Resources into another Azure AD
Tags: azure, ad, subscriptions, management
Published: 2020-06-25 11:09:26

---
title: How to: Move Azure Resources into another Azure AD
published: true
date: 2020-06-18 14:00:00 UTC
tags: azure,ad,subscriptions,management
canonical_url: https://seankilleen.com/2020/06/how-to-move-azure-resources-into-another-azure-ad/
---

I recently completed some work for a client. The work had been done within my company’s Azure org, but I wanted to ensure the client had full control of their resources in a secure way.

Here are the steps we took:

- Had a zoom meeting with the client to set up their Azure subscription / AD.
- Made me an owner of their AD and Subscriptions (temporarily, to ensure I had no troubles with transfers).
- Created a new subscription within my company’s AD to hold the transfer items. This is because you can transfer a subscription but not resources from within a subscription. Called this the “Transfer Subscription”.
- Transferred resources into that subscription (had to leave a few metric alerts behind as they didn’t transfer).
- Waited (nervously) for the transfer to complete. This is the first time this was happening and it was using a running web site.
- It worked! Wow, that’s cool.
- Transferred the transfer subscription into their Azure AD
- Transferred the resources from the transfer subscription into the client’s subscription
- Deleted the transfer subscription
- Set up the metric alerts again.

Then, I checked Azure DevOps to make sure things still ran correctly. I needed to:

- Go into each release job to specify the new azure subscription. The first time I did this, I had to authorize the new azure subscription. The second time, I had to select the existing subscription that I’d just authorized. The UX was slightly confusing; for a few minutes I was accidentally attempting to re-authorize the same subscription rather than select it, which resulted in an error.)
- Go into Service Connections. Deleted the existing service connection for our container registry. Added a new service connection to the new subscription’s container registry that we’d transferred, and gave the service connection the same name as the old one I’d just deleted.

With that, the transfer was complete! Whole thing took roughly an hour, and that’s factoring in my caution and the time to move the resources.

What experience have you had moving resources in the cloud? Sound off in the comments!
Next Gen Data Viz DataGrid & Charting 
Tags: react, angular, webdev, javascript
Published: 2020-06-18 13:46:17

# Next Generation DataGrid & Chart Data Visualization available for Angular, React, Web Components. 

Live Demo: https://www.htmlelements.com/demos/grid/grid-chart-dynamic-data/ React #angular #react #webcomponents #javascript

![Grid Chart Data Viz](https://scontent.fsof3-1.fna.fbcdn.net/v/t1.0-9/104412668_3649944538355817_5332616229131240134_o.png?_nc_cat=106&_nc_sid=730e14&_nc_ohc=sy3AldYYy7QAX_-2wQ-&_nc_ht=scontent.fsof3-1.fna&oh=a315ebc1410b77e19c0b64caf184abb9&oe=5F0F2072)
SSIS Data Flow Components 1.13 Now Support Dynamics CRM OAuth 2.0 Authentication
Tags: ssis, oauth, dynamicscrm, authentication
Published: 2020-06-18 13:46:04

---
title: SSIS Data Flow Components 1.13 Now Support Dynamics CRM OAuth 2.0 Authentication
published: true
description: Devart released SSIS Data Flow Components 1.13 with support for Dynamics CRM OAuth 2.0 authentication and some other improvements.
tags: SSIS, OAuth, DynamicsCRM, Authentication
---
*Devart released SSIS Data Flow Components 1.13 with support for Dynamics CRM OAuth 2.0 authentication and some other improvements.*

Devart, a recognized vendor of world-class data connectivity solutions for various data connection technologies and frameworks, announced the release of [SSIS Data Flow Components 1.13](https://www.devart.com/ssis/) with support of OAuth 2.0 authentication for Dynamics CRM and some improvements for other cloud sources and databases.

The new version of SSIS Data Flow Components for Dynamics CRM allows users to connect to Dynamics CRM using OAuth 2.0 authentication. They can perform web login to Dynamics CRM instead of specifying their user id and password in the connection settings. This also means that when users store an OAuth 2.0 connection in their SSIS package, an OAuth 2.0 refresh token is stored instead of user id and password.

**The release also includes such enhancements as:** 

- The new version of SSIS Components now support Dynamics CRM MultiSelect Option Set columns and PostgreSQL composite types;
- SSIS Data Flow Components for Magento now can obtain and load order items information for sales orders, and thus, allow importing new sales orders into Magento 2.x;
- Devart improved the web login process in SSIS Data Flow Components for BigQuery, allowing users to use the system default browser;
- SSIS Data Flow Components for Mailchimp now support the Opened table, providing access to the information about subscribers who opened a campaign email.

To learn more about the recent release, visit https://blog.devart.com/dynamics-crm-oauth-2-0-support-and-other-improvements-in-ssis-components-1-13.html

**About Devart**

Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration, and backup solutions. The company also implements Web and Mobile development projects.
For additional information about Devart, visit https://www.devart.com/
good books/sites for Regex
Published: 2020-06-18 13:44:56

Hi,

Regex is something i'm using more and more, but can never seem to get the syntax right. the syntax looks spot on but doesn't do what i want or in the order i want it. does anyone know of any good sites or books to teach myself. 

It would be good to have a tutorial-based one where i can have a go, get it right then move on (it's how i personally learn best)
Magnetic Proximity - Card Component.
Tags: javascript, css
Published: 2020-06-18 13:40:34

I have always wanted to write a card component that comes closer to your mouse as you move towards it, begging to be clicked. Although this isn't quite that, its close.

Despite what looks like complex behaviour the css and JavaScript involved is pretty simple and more css than JS.

I wrote this in lit-element as I feel that its so vanilla you can port this to whatever framework you like, (**You can just use it, its a custom element after all**).

If your browser doesn't support this, nothing will happen, so thats nice.

### What is supposed to happen?
- mouse comes closer (actually what happens is the card moves away, not sure how to fix), card moves in that direction which is sort of parallax with mouse. 
- If moved far away, card sits back in static position
- movement should reduce when user is on card

{% codesandbox q195o %}
Kadane's Algorithm and Its Proof - Max/Min Sum Subarray Problem
Tags: algorithms, interview, programming
Published: 2020-06-18 13:33:46

I have previously published an article on max/min subarray sum problem using Sliding Window technique. Now it is time to one-up it with Kadane's Algorithm, which also handled arrays with negative numbers. It is slightly more complex than Sliding Windows Technique but it is a frequent ingredient of many programming interview questions. It is also a prime example of Dynamic Programming.

* You can find the full writeup here: https://quanticdev.com/algorithms/dynamic-programming/kadanes-algorithm
* If you prefer a video instead: https://www.youtube.com/watch?v=4csAswCkXZM
#AzureFunBytes Episode 3 - Cloud Shell with @StevenMurawski Reminder - 2PM EDT Thursday 6/18/2020
Tags: beginners, twitch, azure
Published: 2020-06-18 13:20:05

Today [@StevenMurawski](https://twitter.com/StevenMurawski) will join me to solve three problems!  Thurs 6/18/2020 2PM EDT 

1. How can I reduce my local workstation requirements? 
2.  How do I create resources with Azure CLI and Powershell. 
3. How do I destroy resources?

Steve and I will discuss his tenure in technology with me and even answer some questions.

![AzureFunBytes logo](https://res.cloudinary.com/practicaldev/image/fetch/s--pxlTjTrD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/699md0mmakw0cbutamyq.jpg)

---

AzureFunBytes! - Byte-sized content with a live Twitch show! Learn about
Azure fundamentals with me!

Live stream is available on Twitch at 2pm EDT today. You can also find the recordings there as well.

https://twitch.tv/azurefunbytes
https://twitter.com/azurefunbytes

Join me, ask questions and learn about Azure Cloud Shell!

Microsoft Learn: [Azure Fundamentals](https://cda.ms/1jV)
Microsoft Azure: [$200 Free Credit](https://azure.microsoft.com/free/?WT.mc_id=blog-devto-jagord)
Leetcode and Kotlin complaint
Tags: leetcode, kotlin
Published: 2020-06-18 13:13:30

Dear Leetcode,

Stop using val as a field in your tree nodes. If we are going to have to write two extra characters to get around the fact that val is a keyword in Kotlin, then let's just use value.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/y2df3i2o1wh8krwxghjy.png)

Am I the only one annoyed by this?

{% kotlin https://pl.kotl.in/tZy5Kzs46?theme=darcula %}