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

Finally, we are here in the last part of this article. Please make sure that you read 3 previous parts and then continue to read this one. 
In 3 last parts ([part 1/4](https://dev.to/antonnguyen97/failover-architecture-on-aws-part-1-4-mbi), [part 2/4](https://dev.to/antonnguyen97/failover-architecture-on-aws-part-2-4-1eic), [part 3/4](https://dev.to/antonnguyen97/failover-architecture-on-aws-part-3-4-2e6)), we got an SSL certificate using Certificate Manager, configured load balancer, launch templates and an auto-scaling group. The last step is to attach the DNS name of the load balancer to our domain name in Route53.

So navigate to Route53 and then click to your domain and then hit “Create Record set”, create the subdomain or leave just domain itself depends on what kind of an SSL certificate you own. Now, we need to choose our load balancer Alias, hit “Yes” near to “Alias” and in “Alias Target” chose your load balancer it will something like “dualstack…” and then hit “Create”. In the end you must have something like this:

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

Finally, you can type your domain into a web-browser (https://your-domain.com) search bar and see how load balancer works. You can clearly see which server the load balancer will send you to.

Remember, all these configurations in Route53 may take several minutes to be "Live" on Internet, do not rush to be upset if your site is not working yet.

In my example web-pages will look like this:

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kl1vzvoytuy5n9ynr7yf.png)
 
As we can see load balancer works well and our connection is secured.
In the end of it all we have built a high availability production environment. All these will make us sure that our service will always on, auto-scaling group will be guarantor of our confidence.
This was the easiest way to configure failover architecture on AWS. 

Here in [Appus Studio](https://appus.software/) we have several solutions for building a more complex and extensive configuration depends on how cool and large the project is.
 
I hope that I helped you figure out some points. Thanks for following me in the last four parts!
Svelte: An introduction
Tags: svelte, javascript, frontend, webdev
Published: 2020-06-18 15:52:48

Svelte is one in a sea of frameworks and libraries to build User Interfaces.

Even if most, if not all of them follow the same principle of creating components that are readable, reusable and composable to build dynamic and complex layouts, there are always differences in the inner works and syntax.

In this post, I will share how is the syntax, how reactivity works in Svelte, and what ends up in the bundle after the build process. For that, I will create a Simple Counter with increment and decrement.

##First, The Syntax

This is all the code that we need for creating our counter, update the value and render the new value.

![Code Snippet from Simple Counter](https://dev-to-uploads.s3.amazonaws.com/i/zs04q64iyixpecsxxn75.png)

###The Script

The script tag is where we add all our javascript to manipulate our component. 

In this case, we only manipulate the value of the count variable.


###The Styles

The style script is where we add all our styles for this component. All styles inside the component will be scoped to itself, so even if you add styles to <p>, it will only apply in the <p>'s inside itself by adding a class with "svelte-component_generated_hash".


###The HTML

The rest of our code will be seen as HTML.

In the end, we will have something like this as our DOM.

![HTML Snippet of the browser](https://dev-to-uploads.s3.amazonaws.com/i/0k30ih8n5gy2w6ik4g76.png)

As you can see, we have a super clean DOM with all our declared HTML and scoped styles.


##How can we achieve reactivity in Svelte

Reactivity is the process that triggers the rendering process for the DOM to reflect the changes in our variables values.

Reactivity in Svelte works based on assignments, in our case we have a variable that we want to change based on clicks in the increment and decrement buttons.

Now let's take a look at our "script" tag.

![Script snippet from Simple Counter](https://dev-to-uploads.s3.amazonaws.com/i/z6pidhlui3dwzuiit873.png)

We have:
- One variable called count
- Two functions called increment and decrement

Both of our functions perform an assignment in our count variable. This will do trigger a re-render and update the DOM with our new value.

Here is the documentation related to reactivity:

> To change component state and trigger a re-render, just assign to a locally declared variable.
Update expressions (count += 1) and property assignments (obj.x = y) have the same effect. - [Svelte Docs](https://svelte.dev/docs#2_Assignments_are_reactive)


## What's Next

After this, we will move into more real live use cases like communication between components with props and events.


---

I will be posting more content related to Svelte and how to work with it in the next weeks, feel free to follow me here and in my [twitter](https://twitter.com/marcomonsanto2).

Thanks for reading this blog post, I hope that I could explain in an easy way this introduction to Svelte.
How to make a VM instance in GCP
Tags: googlecloud, aws, beginners, devops
Published: 2020-06-18 15:52:18

Hi Guys today we are gonna see How to create a VM instance in GCP(Google cloud platform)

# Prerequisites
1. Having a google cloud account

# Getting started
There are tow method to create a vm instance

## Creating from a custom image(OS) 
![Google cloud console](https://dev-to-uploads.s3.amazonaws.com/i/rmkxyyzbch7prross5tc.png)
Go to <a href="https://console.cloud.google.com">Google cloud console</a>
![Google cloud console](https://dev-to-uploads.s3.amazonaws.com/i/jgpi53b6a1rkk5bzas8f.png)
Then click on that 3 dots in the leftend top and click on compute engine then vm instances
![Google cloud vm instance](https://dev-to-uploads.s3.amazonaws.com/i/2acljv88dc4rlzlf63ze.png)
This will take you to a page like this(the above picture) and then wait for it to load then click on create
![Vm instace](https://dev-to-uploads.s3.amazonaws.com/i/3tucjk21cru0ughr3gbc.png)
![vm instance](https://dev-to-uploads.s3.amazonaws.com/i/53li40b9cth0noi3e4qr.png)
Then click on create and your VM instace will be created!!!
it may take a minute to create the server(vm instance)
![Vm instance](https://dev-to-uploads.s3.amazonaws.com/i/ogsldatcma0jgl8phuz1.png)

## Creating a image via a prebuilt image
![Google cloud console](https://dev-to-uploads.s3.amazonaws.com/i/rmkxyyzbch7prross5tc.png)
Go to <a href="https://console.cloud.google.com">Google cloud console</a>
![VM](https://dev-to-uploads.s3.amazonaws.com/i/itiyzho9d8p4qmnf2sd0.gif)
Then click market place 

![GCP marketplce](https://dev-to-uploads.s3.amazonaws.com/i/zu3o6n7j7oihiz1lu96h.png)
As you can see this is the GCP market place there are a varitey of os/images/cmswhile some cost and some are free

![Open litespeed Wordpress](https://dev-to-uploads.s3.amazonaws.com/i/qdvk9ef3ooayg9alk3l9.png)
I am gonna choose openlitespeed-wordpress and click deploy
![settings](https://dev-to-uploads.s3.amazonaws.com/i/4whcfqxkwvbmweumf4za.png)
![settings](https://dev-to-uploads.s3.amazonaws.com/i/zk5v2q8xmjekhemam9sm.png)
Choose the setting you like and click create
![Created](https://dev-to-uploads.s3.amazonaws.com/i/7fz6ibxwnulf3rl3brsx.png)
As you can see guys our VM machine has been created 

# Conclusion 
In this post we have coverd how to Create a VM instace in GCP(google cloud platform) hope you liked it if you have any question just comment below!!!
100% Remote work
Tags: remote, work
Published: 2020-06-18 15:44:30

# Working from the office
Since 2016 I have worked in an office. I gained 2 work from home days that I used on Tuesday and Thursday. I thought this was a really nice balance of in office and work from home `WFH`.

# Turn of events
Since the worlds most recent turn of events, a lot of companies have been forced to have their employees WFH for the foreseeable future. Including the company I work at. Making the sudden change from the office to full remote can be difficult. I know there are a lot of lucky people who have the opportunity to still work from home during these times. 

I believe that is where the work force was bound to go. Full remote where possible. Companies can no longer keep sourcing talent locally and think that it's the best. Maybe the best employee lives in a different state or different country!

This is the beauty of working from home. It allows companies to expand their work force to be stronger and more diverse too!

What are your thoughts on the sudden shift in remote work?
30 Days of CSS Girls- 3: Beating Heart
Tags: css, webdev, beginners, javascript
Published: 2020-06-18 15:38:51

Day 2 of the coding challenge was some light reading, so I didn't build anything new. But day 3 picked up from the first day's challenge of making a heart.

Day 3 challenge:
- The heart is now white on a colored background ✅
- Add shadow to the heart. You may try a few techniques such as drop-shadow, border, outline, box-shadow. ❌
- (Optional) Add a beating animation ✅

Instead of focusing on the shadowing, I used this challenge to learn more about CSS animations and keyframes. This was my first time learning about keyframes. 

####What are keyframes?
Like the word implies, CSS animations allow you to animate an element. CSS keyframes allow you to specify what the animation does. 

For anyone struggling with the concepts, the following [YouTube video](https://www.youtube.com/watch?v=8kK-cA99SA0) by DevTips cleared up any confusion. Travis has a series on CSS animations that I plan on coming back to.

It took me about an hour to get through the CSS Animation & Keyframes video, as I paused and rewound several times throughout the video and took notes along the way.

####Hurdles:

I also found myself struggling to center the heart within its background. Why is centering so hard in CSS? There has to be a better, more reliable way to center all things, including those that overlap. Right?

Sizing things is also a challenge. In the last challenge's blog post, [dippas](https://dev.to/dippas) suggested using `rem` over `px`, but it was more difficult than expected to estimate the margins needed to center the `.heart` element.

###What's next?
Going forward, I plan to continue prioritizing learning over speed. This may mean I spend three days on one challenge, rather than speed through.

I'm also streamlining the challenges themselves to avoid overloading too many new concepts on one day. This might lead to splitting one day's challenge over several days.

I'm also building a playlist of relevant YouTube videos to get through each day. By the end of the 30ish days, I will be able to share a series of articles and videos for anyone looking to complete the 30 days of CSS challenge.

####My attempt at a beating heart

{% codepen https://codepen.io/jasterix/pen/eYJdGOZ %}
Mid Meet Py - Ep.12 - Interview with Dani Papamaximou
Tags: chat, python, diversity, community
Published: 2020-06-18 15:38:23

---
title: Mid Meet Py - Ep.12 - Interview with Dani Papamaximou
published: true
description: We meet in the middle of the day, in the middle of the week to chat about Python! This week, we have Dani Papamaximou - organizer of Django Girls Birmingham and Python Midwest joining us.
tags: chat, python, diversity, community
---
PyChat:
[Dropping pytz?](https://twitter.com/pganssle/status/1271878126235197440)
[PyData MCR](https://twitter.com/PyDataMCR/status/1271902376962785280)
[CPython - old parser is dead](https://twitter.com/pyblogsal/status/1271115432590807041)
[TutorialDB - a small scale OS search engine for programming/dev tutorials](https://tutorialdb-app.herokuapp.com/about/)

Mid Meet - Hall of Fame:
Dani Papamaximou - organizer of Django Girls Birmingham and Python Midwest
[Follow Dani on Twiter](https://twitter.com/DaniQuietNow)

PyPI highlights:
Recently wanna try using [Pre-commit](https://pre-commit.com/)
[HTTPrunner](https://docs.httprunner.org/) HTTP(s) testing framework in Python

[Listen to MidMeetPy podcast](https://anchor.fm/midmeetpy)
Fast JSON & Rails
Tags: rails, ruby
Published: 2020-06-18 15:38:20

When designing a backend it is important to consider how data will be constructed when a response is being prepared for a client. As any given schema becomes more complex and intertwined, the data that you will want provided to your frontend will likely necessitate information on more than one object or class per fetch. 

Active Model Serializer was released about six years ago and accomplished that specific goal for Ruby & Rails: combine multiple objects/classes in a JSON response to be used for your HTTP requests. Data serialization "is the process of translating data structures or object state into a format that can be stored" [Serialization - Wikipedia](https://en.wikipedia.org/wiki/Serialization). While this tool was widely used and did accomplish its goal, new players have entered Ruby's serialization scene and have proven that we've come a long way over the last six years.

Netflix released its Fast JSON API about two and a half years ago, and over that time it has proven to be much faster than Active Model Serializer. According to Netflix's docs, these are the results from benchmark times for 250 records: 

```
$ rspec
Active Model Serializer serialized 250 records in 138.71 ms
Fast JSON API serialized 250 records in 3.01 ms
```

In addition to being very fast, it is extremely user-friendly. To set up Fast JSON API, simply add the gem to your Gemfile and bundle install: 

```
gem 'fast_jsonapi'
$ bundle install
```

You're then ready to create your serializers. This can be done from the terminal with the command:

```
rails g serializer Model-Name attribute attribute attribute
```

Once your serializers are generated, the next step is to add the appropriate 'belongs_to' and 'has_many' relationships (any modifications you would make to your models without Fast JSON API would be the same with it).

Each serializer can now be called from your controller actions and you can pass it a single instance of a class or many at once. For example: 

```
ModelSerializer.new(model_instance)
```

I am a big fan of Postman and like to check how my data is formatted there, but feel free to confirm layout is as you intended by performing any valid request to your backend. 

Because Fast JSON API recognizes the 'belongs_to'/'has_many' relationships, you are able to see full picture relationships with one fetch. If I created a database of dog owners and dogs (where a dog could only have one owner), one fetch for a specific dog owner could include an array of each of her/his dogs (with all of their data).

Fast JSON API has definitely made my life easier when linking backends and frontends and I hope it does for you too!
CodepenChallenge GSAP Sliding: Penguin Fast Click Game
Tags: codepen, html, css, javascript
Published: 2020-06-18 15:27:05

<p>This is a simple screen clicking game</p>

<p>Click the screen as fast as you can, to make the penguin jump</p>

<p>The entrance, and exit of the penguin is where the sliding happens. This is inspired by the default template, when you click the 'Start a Pen' at the challenge screen.</p>

<p>I used parallax effect at the background.</p>

<p>Except for the fonts, I made all of the assets. Although, these images are just in base64 image.</p>

{% codepen https://codepen.io/takaneichinose/pen/MWKbKYP %}
Test downloaded files with RSpec and System Tests
Tags: rails, rspec, chrome
Published: 2020-06-18 15:26:53

## Scenario

You have a download button, that downloads a dynamically generated file, and you want to test that the file is downloaded correctly. A request test is not sufficient, because the file changes, depending on the actions performed by the user in previous steps, so you want to test that in a system test.

## Solution

The solution is based on the fact that you are using `rspec`, `selenium-webdriver` and Chrome to run you tests.

First of all, you need a custom driver, that is able to manage downloads. You can add the following to the `rails_helper`:

```ruby
Capybara.register_driver :selenium_chrome_headless do |app|
  browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
    opts.args << '--headless'
    opts.args << '--disable-site-isolation-trials'
  end
  browser_options.add_preference(:download, prompt_for_download: false, default_directory: DownloadHelpers::PATH.to_s)

  browser_options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })
  Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end
```

and implement a `DownloadHelper` module:

```ruby
module DownloadHelpers
  TIMEOUT = 10
  PATH = Rails.root.join('tmp/downloads')

  def downloads
    Dir[PATH.join('*')]
  end

  def download
    downloads.first
  end

  def download_content
    wait_for_download
    File.read(download)
  end

  def wait_for_download
    Timeout.timeout(TIMEOUT) do
      sleep 0.1 until downloaded?
    end
  end

  def downloaded?
    !downloading? && downloads.any?
  end

  def downloading?
    downloads.grep(/\.crdownload$/).any?
  end

  def clear_downloads
    FileUtils.rm_f(downloads)
  end
end
```

Now, you have a driver, that is able to manage downloads. Use it and clean the downloads before and after each test. So, magain, in the `rails_helper.rb`:

```ruby
config.before(:each, type: :system, js: true) do
  clear_downloads
  driven_by :selenium_chrome_headless
end

config.after(:each, type: :system, js: true) do
  clear_downloads
end
```

and here is a small example of usage in a system test:

```ruby
visit the_page_with_download_button_path
find("Download as PDF").click
wait_for_download
expect(downloads.length).to eq(1)
expect(download).to match(/.*\.pdf/)
```

If you want, the driver above is available as `selenium_chrome_with_downloads` and `selenium_chrome_headless_with_downloads` in the [so_many_devices](https://github.com/renuo/so_many_devices#chrome-with-downloads-capabilities) gem, kindly offered by [Renuo](https://renuo.ch).
Hurry! 1 hour left at this price! FREE - Ultimate AWS Certified Developer Associate 2020 Masterclass
Tags: aws, webdev, news, azure
Published: 2020-06-18 15:17:44

Hi Folks, I just came to know about FREE - Ultimate AWS Course in Udemy.

Hurry! 1 hour left at this price!

**Below is Udemy Deal link:**

https://www.udemy.com/course/aws-certified-developer-associate-masterclass/?couponCode=A86BF8215E4C16678A93


**Below is Original Post:**

https://www.ozbargain.com.au/node/545365


**What is UDEMY ?**

[Udemy](https://about.udemy.com/?locale=en-us) is the leading global marketplace for teaching and learning, connecting millions of students to the skills they need to succeed.

**What is AWS ?**

Like [Azure](https://azure.microsoft.com/en-us/),  [Amazon Web Services (AWS)](https://aws.amazon.com/what-is-aws/?nc1=f_cc) also provides cloud computing services. AWS is the world’s most comprehensive and broadly adopted cloud platform, offering over 175 fully featured services from data centers globally.

**What is  AWS Certified Developer - Associate ?**

[AWS Certified Developer - Associate](https://aws.amazon.com/certification/certified-developer-associate/) is certification exam by AWS.

Abilities Validated by the Certification:

- Demonstrate an understanding of core AWS services, uses, and basic AWS architecture best practices
- Demonstrate proficiency in developing, deploying, and debugging cloud-based applications using AWS

Hope this helps.

:smile: , :+1:
Recursion, corecursion and thunks
Tags: java
Published: 2020-06-18 15:16:16

Java does not support tail calls.

The usual workaround is a type like the following.

~~~
class Thunk<A> {
     boolean isDone();
     Thunk step();
     A finish();
}
~~~

Looked at mathematically this type is really a corecursive definition sort of like a stream datatype.

~~~
exists b. (b -> (b + a))
~~~

It happens there exists a dual recursive datatype.

~~~
forall b. ((a -> b) -> (b -> b) -> b
~~~

You can apply the math to a simple factorial function like so.

~~~
 <C> C fact (int m, int n, Function<Supplier<C>,C> y, Function<Integer, C> result) {
     if (n < 1){
          return h.apply(m);
     }
     return y.apply(() -> fact(m *n, n -1, y, h));
}
~~~

At first it appears we have gained nothing from this approach except a degree of indirection. But in fact this lets us delay and thunk an evaluation step or just evaluate it directly.

I'm still not sure this is the best approach for tail calls on the JVM but I remain hopeful recursion schemes will bring a better answer than the ordinary one.
Disadvantages Of python
Published: 2020-06-18 15:07:14

Slow speed:
Python uses interpreter that loads it line by line instead of compiler that executes the whole file at once. This makes compilation slower and tends to perform slowly. This is the major reason competitive programmers don't use python. C++ provides more computation per seconds instead of python. Moreover this is why python is not extensively used in application development.
Error detection in codes:
Since python uses interpreter the error in codes does not come up during code compiling. Python uses dynamically typed variables which makes testing more hectic. All these errors came out to be a run-time error which no developers want in their program. This makes python less usable for GUI applets developments.
Weak in mobile devices:
We have seen python in web servers and desktop applications along with scripts that its used for. But it is not considered favorable for mobile devices because it uses more memory and slow processing compared to other languages.
Moving on with this article on advantages and disadvantages of Python,
Large memory consumption:
Python design structure is such that it uses large memory while processing as compared to other languages as C/C++. This makes Python a complete no no for development under tight memory restrictions.
Conclusion:
The language is seen as a less suitable platform for cellular development and game development. It's far frequently used on desktop and server, but there are the handiest several mobile packages that were used majorly with Python. Every other drawback Python has is the runtime errors. The language has a whole lot of design limitations .Python executes with an interpreter instead of the compiler, which speeds down the performance.
Lets look into the Final thoughts.
Final thoughts:
Although there are many disadvantages with python but we can clearly see that the advantages outweigh the disadvantages by a fair margin. Every programming language has its own forte and areas of interest that developers tend to get excited about. Python has its own areas where it is being used extensively. Although in the areas like web development JavaScript is mainly used, similarly in game development unity or real engine is used. Python finds it usages in scripting, data processing, numerical mathematics and research.

Retrieved from
https://translate.googleusercontent.com/translate_c?depth=2&hl=fa&nv=1&prev=search&rurl=translate.google.com&sl=en&sp=nmt4&u=https://www.edureka.co/python-programming-certification-training&usg=ALkJrhj5ANtR2kPOizRAlT0uMmJekxL1mw