teleren/devto huggingface dataset:
What is a reverse proxy and how it works?
Tags: node, beginners, webdev, codenewbie
Published: 2020-07-26 08:26:23

This article was originally published at https://www.blog.duomly.com/6-most-popular-backend-questions-and-answers-for-beginners/#what-is-reverse-proxy-and-how-it-works

---

### What is a reverse proxy and how it works?

{% youtube MYubx9GmK1Q %}

I think that at first, I should explain what proxy is, also called the forward proxy. Let’s take a look at the visualization of the forward proxy.

![What is a forward proxy?](https://dev-to-uploads.s3.amazonaws.com/i/0wn6m1vt29hfifovsvzj.png)

In this image, you can see how the communication with the forward proxy looks like. The request is sent from the client, and then the request takes over the proxy server, which communicates with the servers to get the data and send them back. 

There are a few reasons why the forward proxy can be used. 

First of all, it’s used to avoid browsing restrictions, for example, companies sometimes limit access to the internet, and the proxy can be used to overcome it. 

The second idea is why the forward proxy may be used to stay anonymous on the internet because when we send the request through the proxy, the only visible IP is the one form the proxy server.

Now, let me explain what the reverse proxy is, and for that, let’s take a look at the other graphic.

![What is a reverse proxy?](https://dev-to-uploads.s3.amazonaws.com/i/tf1mff1shuykshhcs45e.png)

In the case of the reverse proxy, the proxy server is between the network and the application origin server with data. When the client does a request, it’s sent to the network, and then it’s grabbed by the reverse proxy server, then the request sent to the origin server, and the response is returned.
The main advantages of using the reverse proxy server are: 

- preventing the attacks like DDoS, because the attackers won’t be able to hit the origin servers of the application, just the proxy server; 
- helps in caching content; 
- provides the SSL encryption; 
- can help to distribute the requests to multiple origin servers; 
- can add basic HTTP access authentication to a web server that doesn’t have one.

There exist the third-party reverse proxy servers like Cloudflare.


<a href="https://www.duomly.com/?code=lifetime-80">![Duomly - Programming Online Courses](https://dev-to-uploads.s3.amazonaws.com/i/k00bacsgkavhcziauwrg.png)</a>

Thank you for reading, 
Anna from Duomly
Handling server/application crashes
Tags: crash, discuss, server
Published: 2020-07-26 08:22:19

I'll need some practical advice on this.
The crash can happen anytime. When it crashes there is probably multiple if not thousands of operations running if it's a popular application.

Like a simple example would be signing up. Steps include checking the user, creating record, create token, send verification mail, dispatch some events, those events doing their jobs and bunch of other stuff. The crash can happen in more complex scenario creating multiple insert/update queries and stuff.

This is what i could figure out.
Creating logs of two state of each operation. Like `starting_op1` and `done_op1`. So when the server boots up again, it can restore where it left off by checking what started but couldn't finish.
But if I push logs of each operation, it creates an overhead and potential latency in some applications where it matters. Plus If I'm using something like redis(even with persistence) for the state logs, the server crash can affect these logs too, provided that not many will use a second server for this.
let's understand git diff
Tags: git, webdev, codenewbie, productivity
Published: 2020-07-26 08:12:10

Have you ever used git diff command? git diff is *multi-use* command which will help you to find out the *difference between git data sources*. These data sources can be *commits, branches, files*. 

First understand some key-terms,

**Working directory:** Git working directory implies the area where we do all our changes. Git continously monitor this area for changes. If you execute command 'git status' you can see the changes present in working directory. 

**Staging area(also known as git index):** staging area contains all the changes which are ready for the commit. You can add/remove files from staging area using command **_git add_** or **_git rm_**.

**HEAD:** It is pointer which points to the **_last commit_** of your current branch.

**Local Repository(.git):** Once we commit the changes from staging area usin **_git commit_** command they will get stored in your local repository.

**tracked file:** It is any file which git tracks actively. For example:Files which are already commited or files present in staging area.

**untracked file:** A newly created file which is not under git's version control.

Now lets move to the **_git diff_** command,  

**git diff:** It shows only those changes of **_tracked files_** which are present in **_working directory_**. 

**git diff --cached:** It shows only those changes of **_tracked files_** which are present in **_staging area_**.

**git diff HEAD:** It shows all changes of tracked files which are present in **_working directory_** and **_staging area_**.

**git diff branch1..branch2:**  Git will compare the **HEAD** of both branches and display a 'diff' recap that you can use to see modifications. It will show you all the commits that 'branch2” has that are not in 'branch1'.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/puv60ffrwb1a10qyitqq.jpg)

**git diff branch1...branch2:** Using 'git diff' with **three dots** compares the **HEAD** of the second branch with the common ancestor of the two branches. (It will show the changes made only in branch2).
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uqvdfmcglex4dxof6yby.jpg)
**Note:** If we provide file name at the end of all the above commands, the diff operation will be scoped to the specified file.

I hope this is helpful.
Angular Latest version upgrade to v10 and CLI Update
Published: 2020-07-26 08:04:58


Angular 10.0.0 is finally here. While upgrading to Angular 10 version remember few things before running `ng update` command.

1. Its always advisable to update your app to its next major version.
2. That is if you are using Angular 7 or Angular 8 or Angular 6,5, 4 etc versions, Do not try to update to Angular 10 Directly.
3. First Update your Angular app to Angular 9.
4. Then use `ng update` command.

On June 25, 2020 Angular version 10.0.0 is released.

Just `update @angular/core and @angular/cli` by using ng update command.

`ng update @angular/core @angular/cli`

## Angular CLI version check
To check the Angular CLI version use to below command

`ng -version`

## Update Angular CLI version Globally
First you need to uninstall the existing angular cli packages followed by npm cache verify command to clear the cache related problems.

And the install the Angular CLI version again by using npm install -g @angular/cli@latest

To update Angular CLI version globally in your system use the below commands

```
npm uninstall -g angular-cli
npm cache clean or npm cache verify (if npm &gt; 5)
npm install -g @angular/cli@latest`

```

## Update Angular CLI version Locally
To update Angular CLI version in your local projects use the following commands.

Navigate to your local Angular project folder and execute the below commands.

```
rm -rf node_modules
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install

```
#100DaysOfCode | Day 2
Tags: challenge, 100daysofcode, python, codenewbie
Published: 2020-07-26 07:55:06


▄█ █▀█ █▀█ █▀▄ ▄▀█ █▄█ █▀ █▀█ █▀▀ █▀▀ █▀█ █▀▄ █▀▀
░█ █▄█ █▄█ █▄▀ █▀█ ░█░ ▄█ █▄█ █▀░ █▄▄ █▄█ █▄▀ ██▄

Heyyyyya
I'm here again to share my last day experience in dev.to!
today was a little bit hard for me cuz I only solved 1 problem from exercism, the level of that problem was Easy but I failed to solve it.

I spend my whole day to solve that problem but to be honest it was so tough for me to solve.
So yeah I couldn't to solve at least 2 problem but I think it's worth it.

so let's look at my code challenge, I know I know It seems so easy for most of the senior developer or python programmer but take it easy and encourage me through my journey, hahaha....

**Problem: **
```
Given a string representing a matrix of numbers,
return the rows and columns of
that matrix.

So given a string with embedded newlines like:

```text
9 8 7
5 3 2
6 6 7
```

representing this matrix:

```text
    1  2  3
  |---------
1 | 9  8  7
2 | 5  3  2
3 | 6  6  7
```

your code should be able to spit out:

- A list of the rows,
  reading each row left-to-right while moving
  top-to-bottom across the rows,
- A list of the columns,
  reading each column top-to-bottom while moving
  from left-to-right.

The rows for our example matrix:

- 9, 8, 7
- 5, 3, 2
- 6, 6, 7

And its columns:

- 9, 5, 6
- 8, 3, 6
- 7, 2, 7
```

and I couldn't find a solution for it, so finally I read the others code and their solution to understand how to solve it, and here's the solution for it:


**Solution:**

```python
class Matrix:
 def __init__(self, matrix_string):
    self.matrix = [[int(x) for x in line.split()] for line in  matrix_string.split("\n")]
        

    def row(self, index: int):
        return self.matrix[index -1]
      

    def column(self, index: int):
        return [x[index -1] for x in self.matrix]
```


I didn't know about split() method and that was my first Inline for __LOOOOOOOOOOOOOOOP__ ever! 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cecs9gwmw6dachu7nirx.png "First time when you see Inline loop")<figcaption>__When you see Inline Loop for the first time!__</figcaption>

I couldn't even understand Inline loop at first when I saw.
finally I got it but I'm not comfort with it, need to practice and play ...

That was my previous day experience briefly, I hope you enjoy my post and the way I'm writing my experience ;)


I know I'm still not a good writer but I'll  do my best.
If you have any Idea about me and the way I'm write or any advice to improve my coding skills just let me know and Leave a comment below.
Thank you for spending your time to read my post .
I appreciate it
__*Code* With *♥* __
Updating `rsync` on macOS, so you're not stuck with 14 year old software
Tags: terminal, macos, unix
Published: 2020-07-26 07:51:56

`rysnc` is a very useful command line utility to synchronize folders between locations. You can use it to transfer large folders between drives or remote locations. I use it to deploy Node apps to my Droplet almost everyday.

Unfortunately, macOS (even Big Sur!) ships with version `2.6.9`—a version that came out 14 years ago (in 2006).

```
rsync --version
// rsync  version 2.6.9  protocol version 29
// ...
```

Fortunately, updating `rsync` is very easy. We'll use [Homebrew (brew.sh)](https://brew.sh/) for macOS to do so.

Here's how to do it in 2 steps and 5 minutes.

1. Install Homebrew
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```
> snippet from https://brew.sh/

2. Update `rsync`
```
brew install rsync
```

Now, checking the version should return a newer version of `rsync`. Your version might differ if you're reading this in the future (or the past?).
```
rsync --version
// rsync  version 3.2.2  protocol version 31
// ...
```


A grand benefit of updating to a newer version is the implementation of the `--info=progress2` flag, which prints the progress of the `rsync` operation allowing you to ensure the process is working. Extremely useful.

Optionally, you can create an alias, making `rsync` print with progress every-time. Here's a preset of flags I always use.

```
alias rsync="rsync -az --info=progress2"
```

[`rsync` flags and documentation.](https://linux.die.net/man/1/rsync)

Now, enjoy your super-powered `rsync` on macOS and [follow me on Twitter](https://twitter.com/al5ina5). :)
CDK Patterns on the AWS Architecture Blog
Tags: aws, cdk, architecture, serverless
Published: 2020-07-26 07:41:17

I recently worked with AWS on an article talking about how we use AWS CDK, CDK Patterns and AWS Well Architected within Liberty IT.

AWS posted it on their Architecture blog:

![Arch blog preview](https://dev-to-uploads.s3.amazonaws.com/i/q66zosy9izpod8mh9omw.png)

To view the article visit [this link](https://aws.amazon.com/blogs/architecture/liberty-it-adopts-serverless-best-practices-using-aws-cdk/)
Five Best Free HTML Email Templates Download 

Tags: html, css, webdev, computerscience
Published: 2020-07-26 07:40:33

To find the best free Email HTML website templates, you would probably need to spend countless hours searching the web. You might be born under the lucky star, however, for all the rest, we did all the hard work for you. There are numerous high-quality free html email templates out there so you can imagine how difficult it was choosing only the top-performing ones.

1. Simplicity – Responsive Email Templates
Simplicity is a Responsive email template designed for Multipurpose activity. This email template is fully editable with online Builder like StampReady, MailChimp, CampaignMonitro etc. Feel free to change any layout, images, elements, background and colors which beautifies your Email. StampReady, MailChimp, CampaignMonitor compatible Files and HTML with Inline CSS Included.
2. Webber Responsive Email + Online Template Builder
New Email Builder Save templates multiple times in your account Export HTML, MailChimp or Campaigns monitor files Drag&drop modules Remove / Duplicate modules Change background / text colors Instant Text Editor Replace (background) Images

3. Ruler – Responsive Email + Online Template Builder
Ruler is one of the best email html templates which you can use for your own project.

4. Raniel – Responsive Email with 200+ Modules + MailChimp Editor + StampReady + Online Builder
Raniel Business, Startup, Multipurpose Fashion & Ecommerce Responsive Email. 200+ Modules compatible with MailChimp + Stampready + Campaing Monitor, plus 10 premade templates based on the 200+ Modules will help you to create a wondefull responsive E-mail template for promoting your eshop, product, business and services.

5. Petras 200 – Multipurpose Email Set with MailChimp Editor, StampReady & Online Builder
Petras include 200+ modules compatible with Mailchimp + Stampready + campaign Monitor, plus 10 premade templates based on the 200+ Modules will help you to create a wonderfull responsive Email template for promoting your eshop, products, business and services.

Download all these five free html email templates 
Original Source : https://prosourcecode.com/free-html-email-templates/
How to install Ghost locally
Tags: ghost, blog, website
Published: 2020-07-26 07:40:26

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

A best way to get started with Ghost, which is easier ways create your own blog.

#1. Overview
Running Ghost locally is the easiest way to do some local development. 

#2. Prerequisites
To install Ghost locally you will need the following:
* A computer running MacOS, Windows or Linux
* A supported version of Node.js
* Either yarn or npm to manage packages
* A clean, empty directory on your machine

#3. Install Node in Mac
In the terminal app in MacOS. Run following commands.
* `brew update`
* `brew install node`
* `npm -v`

#4. To Uninstall node and NPM
* `brew uninstall node`

#5.Instal Ghost CLI
* `npm install ghost-cli@latest -g`

#6. Install Ghost local
cd(change directory) to the folder where you want ghost to be installed locally.
* `ghost install local`

#7. Test it
Once the install is finished you'll be able to access your new site on `http://localhost:2368` and `http://localhost:2368/ghost` to access Ghost Admin ✨
That's it! You're done.

#8. Other Commands

Ghost runs in a separate background process and remains running until you stop it or restart your computer. So you may find these commands useful for taming it:
* `ghost stop` to stop Ghost
* `ghost start` to start Ghost
* `ghost log` views logs
* `ghost ls` to list all running Ghost blogs


#9. Setup an admin account

In the url `http://localhost:2368/ghost/` go through the admin creation process, the you'll be able to see the admin dashboard.

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

#10. Conclusion!
Congratulations, now you have successfully setup the ghost blog locally! ✌️ 

Go to following Url to see your local blog!
`http://localhost:2368/`

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

> Note: Local installs are not for productions.

Hopefully you are able to install Ghost for suitable blogging platform for you after playing around with it. 😃

**Thank you for reading! 😊**
An Overview of GPT-3
Tags: ai, nlp, datascience, machinelearning
Published: 2020-07-26 07:33:06

##**So what is GPT-3?**
*GPT-3* or *Generative Pertained Transformer-3* is a neural language model from *OpenAI*. OpenAI launched this beta service last month. This has helped the people to understand the various amazing things that GPT-3 is capable of performing. GPT-3 has been built by feeding it with most of the web contents including coding tutorials, literature works etc. This model has around *175 billion parameters* as compared to its predecessor *GPT-2* which had only *1.5 billion parameters*.

------------

##**What is GPT-3 capable of?**
* GPT-3 requires only a few-shot demonstration via textual information, as it is already trained with a huge amount of data.
* It can develop the suitable widgets for our website using the text input we give.
* It is capable of writing stories, code, poems, etc.
* Furthermore, it has the ability to write any piece of article in a particular personality's essence. *For eg: Write a news report in the style of J.K. Rowling*.
* It is generally difficult to distinguish between the human written and GPT-3 generated articles.
* GPT-3 has been quite impressive in the beta test run and has found its place in various fields. OpenAI is planning to commercialize this product later this year.

-------------------------------------------------------

Similar to any other product, GPT-3 also has some drawbacks like;
=> Reply with the wrong answer to invalid questions.
=> GPT-3 lacks the power of reasoning and common sense. This is clearly illustrated in *Kevin Lacker's blog*.
>The blog link:- [Kevin Lacker's blog](https://lacker.io/ai/2020/07/06/giving-gpt-3-a-turing-test.html)

------------

##**Will this affect us?**
It is a human tendency to exaggerate the negative effects of technology. But it also turns into a benefit in the long run as we can equip ourselves to overcome the negative sides.

Here, the loss of job in many fields, like web development, the writing industry, news reporting etc. have been of concern due to the enhancements in AI. It is a bitter truth that some people will surely get affected by this new technology. But the point to note here is that the one with skills need not worry as they can survive this by constantly evolving and adapting himself into the new technologies. *The thing to remember is, "change is constant."*

There is no doubt that GPT-3 is a huge technical achievement in the field of AI. But more accurate and interesting advancements are yet to come.
Is Node.js really single-threaded?
Tags: javascript, beginners, codenewbie, node
Published: 2020-07-26 07:22:49

Many developers wonder at some point in their Node.js programming journey that, is Node.js really single-threaded? If it is, how is it able to do asynchronous execution? Some people understand it in terms of even loop, but there is more to it. I hope you understand what event loop is since you are reading this. But, if you don’t, check out this <a href="https://www.youtube.com/watch?v=8aGhZQkoFbQ" target="_blank">awesome talk</a> by Philip Roberts. 

In Chrome, Javascript runs in a single thread. You are sharing the same thread for rendering as well as your code execution. Chrome actually employs <a href="https://blog.chromium.org/2008/09/multi-process-architecture.html" target="_blank">multi-process architecture</a>, which means that each tab, plugin in your browser is getting a new process. And any crash or block is not effecting others. When JS code is executed in the browser, it is essentially blocking the browser painting or render since there is no thread to do the same. But before it picks something from the callback queue after the current call stack is empty, browser paint actually takes precedence. That’s about the browser. But, how do things go in a backend JS runtime, Node.js?

The answer to the above question, Node.js is single-threaded similar to Javascript. So, your JS code is running in a single thread(main thread) in consensus with the event loop and callback queue. But, Node.js is not purely Javascript code. Some of it is C++ code, some things when done asynchronously like network calls, file system tasks, DNS lookup, etc. are actually not handled by the main thread. Node.js does this optimization of using C++ code(which has access to multiple threads) internally for these tasks, which helps in reducing the execution time when used correctly. Node.js actually does offload the asynchronous tasks to C++ code, where it has the provision to use multiple threads to speed up execution, but if you force it to be sync(using only the synchronous version of the API), you are binding it not to do this optimization.
Resetting a Form
Tags: html, javascript
Published: 2020-07-26 07:03:54

Let's look at a function we used to have a lot but somehow seems a bit faded for no good reason!

The form reset option was usually a button at the bottom of your form, to reset the whole input.

I work for a company that uses a lot of pre-population based on cookies, but sometimes this information is not what you want in the inputs so people can reset the whole form.

## HTML Reset Method

One method to reset a form a just by using the `reset` input type and your `HTML` would look like this;

```html
<form>
  <input type="text" />
  <br /><br />
  <input type="text" />
  <br /><br />
  <input type="text" />
  <br /><br />
  <input type="reset" />
</form>
```

Try and type something in the fields and press the reset button, this will reset the whole form.

## JavaScript Reset Method

Another way to do this is with `JavaScript`, for instance, after a submit.

Let's add the following button:

```html
<button type="button" onclick="myReset()">JavaScript</button>
```

```js
function myReset() {
  var form = document.querySelector('form');
  form.reset();
}
```

Alternatively even easier we can use the following action:

```html
<button type="button" onclick="reset()">JavaScript #2</button>
```

View these methods on Codepen.

<p class="codepen" data-height="265" data-theme-id="dark" data-default-tab="html,result" data-user="rebelchris" data-slug-hash="mdVgPVM" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="Resetting a Form">
  <span>See the Pen <a href="https://codepen.io/rebelchris/pen/mdVgPVM">
  Resetting a Form</a> by Chris Bongers (<a href="https://codepen.io/rebelchris">@rebelchris</a>)
  on <a href="https://codepen.io">CodePen</a>.</span>
</p>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>

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

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)