teleren/devto huggingface dataset:
Sending emails in Deno using SMTP module
Tags: webdev, productivity, typescript, tutorial
Published: 2020-08-06 14:41:48

Hey Developers! 

I have created a tutorial for sending emails from your deno project using third party module called smtp.

-----
## Introduction

* You can send email from your deno application.
* Where we use this thing?
   * Sending verification email to the user after his registration on our project.
   * Sending emails like monthly newsletter, blogs, etc.

## Getting Started

* Packages: 
   * SMTP third party module - https://deno.land/x/smtp/
   * Dotenv third party module - https://deno.land/x/dotenv

* Importing packages
``` TypeScript
import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";
import "https://deno.land/x/dotenv/load.ts";
```
* Creating an instance of SmtpClient
``` TypeScript
const client = new SmtpClient();
```
* Accessing environmental variables
``` TypeScript
const { SEND_EMAIL, PWD, RECV_EMAIL } = Deno.env.toObject();
```
* Configuring & Creating the connection
``` TypeScript
const connectConfig: any = {
  hostname: "smtp.gmail.com",
  port: 465,
  username: SEND_EMAIL,
  password: PWD,
};
await client.connectTLS(connectConfig);
```
* Sending the e-mail to the rec. account
``` TypeScript
await client.send({
  from: SEND_EMAIL,
  to: RECV_EMAIL,
  subject: "Welcome!",
  content: "Hi from Vuelancer!",
});
```
* Finally, closing the smtp client connection
``` Typescript
await client.close();
```
## Run the app

``` sh
$ deno run --allow-read --allow-env --allow-net server.ts
```
# Or else clone this repo and sculpt it!

* you can find the entire code on my github account
{% github Vuelancer/deno-email-smtp %}

~ Thank You! 

### Support Me
* Youtube Channel -https://www.youtube.com/channel/UC0hmXRqXYVO0mocVt5D3GkQ

* Github - https://github.com/vuelancer

* Scrimba - https://scrimba.com/@selvakumardhivakar

* Patreon - https://patreon.com/vuelancer
Set Up Ruby on Rails Server on Ubuntu Server 20.04
Tags: rails, ubuntu, restful
Published: 2020-08-06 14:36:50

Installation and running processes for the Rails Server we have created for the [Yusufreis](https://github.com/StarBuckR/yusufreis) are as described below.

### Downloading Files
Download the Server's files at first.
```
git clone https://github.com/starbuckr/railsserver
```

Then, go to the directory where our project is located and install necessary packages.
```
cd railsserver
sudo apt install ruby ruby-dev ruby-bundler nodejs npm libsqlite3-dev zlib1-dev
sudo npm install yarn -g
yarn install --check-files
```

### Configuring Rails Server's Settings
If the Ruby version you are currently using is not 2.5.5, you need to change the `ruby ​​'2.5.5'` line in the Gemfile. For example, if your Ruby version is 2.7.0 we need to edit it as this.
```
ruby '2.7.0'
```

After installing packages, configure Gem and database settings.
```
sudo bundle install
rails db:migrate
```

### Running The Server
In order to run the server, use `rails server` or `rails s` command.
```
rails s
```

If you want to connect the server from other local machines, you need to change running ip address.
```
rails s -b 0.0.0.0
```

You can then access this server from any device connected to that network. For example, if the ip address of our Ubuntu Server machine is 192.168.1.56, you can access the server by entering the address `192.168.1.56:3000` in your browser.
What is the Arctic Vault program?
Tags: news
Published: 2020-08-06 14:28:52

This post is to cover the broader audience about the Arctic Vault program.

According to the **Github Archive Program Site**,

> It is a hidden cornerstone of modern civilization and the shared heritage of all humanity. The mission of the GitHub Archive Program is to preserve open-source software for future generations.

When I first got the badge and looked into their website, I couldn't really understand what this is all about. So I didn't pay much attention to it for some time until my friend shared a video about the program.

Check this official video:

{% youtube fzI9FNjXQ0o %}

So this program is basically storing the precious open-source software and all the public repo's written in the open-source software languages for the future generation for almost **1000 years**. Isn't it amazing?

The archive is located in a decommissioned coal mine in the Svalbard archipelago, closer to the North Pole than the Arctic Circle.

Github took a snapshot as of 02/02/2020 and the data is stored in [silver halide](https://en.wikipedia.org/wiki/Silver_halide) film and encoded to last for 1000 years.

During this pandemic situation, having this kind of safe storage of our open-source software for future generations is really a need of the hour.

I have a public repo of a gem called [Data Store](https://github.com/ChintuKarthi/data_store_gem) in rails which earned me an **" Arctic Code Vault Contributor badge "**

![Arctic Code Vault Contributor Badge](https://dev-to-uploads.s3.amazonaws.com/i/qh4crvi6lh3owy09gkd0.png)

And this is going to be stored in the vault for the future generation for 1000 years which makes me proud of myself as a developer 😇 and this kind of recognition make us give back to the community more often.

For more details of this program check the [official page](https://archiveprogram.github.com/).

Image source: Github Archive Program
Wait for injectable service init() in Angular
Tags: help, angular, async
Published: 2020-08-06 14:12:55

Hey Angularists,

  I'm learning Angular and I still cannot figure out one important thing to do properly.

What I'm trying to achieve is to create global `@Inject`able Service that has some initialization function that needs to finish before the Service should be used.

Right now the Service does its initialization in the constructor, as AFAIK services do not use `ngOnInit()` functions. Let's say the initialization calculates some random prime number which takes about 200ms to finish.

Unfortunately when the Service is injected into a Component and a public function of the Service that's supposed to return this prime number is being called in the `onInit()` of the Component the returned value is always `undefined` as the constructor of that Service did not finish yet at that time.

Of course if there would be some async function to call (e.g. an HttpClient) I would return a `Promise` or `Observable` and subscribe to it in the Component. However the constructor does not call any of it.

I also tried `EventEmitter` and emit `true` at the end of the constructor work when the initialization is done while subscribing to it in the Component `OnInit` function. This however does not work for me for some reason and it never receives the emitted event.

I come from C# and I simply find it amusing that DI can provide you with an uninitialized object. ;)

I found possible solution with `APP_INITIALIZER` and ProviderFactory but I find it too complex so I wanted to know about other options.

Any advice and help on how this should be **properly handled** in Angular is welcome. Thanks in advance!

**Edit:** I figured out that when I hide the property behind a function call `getPrime() { return this.prime; }` it works. However it's still a mystery to me how a non-static property can be read before the constructor has finished...
How to SSH a Linux instance using PuTTy... 
Tags: linux
Published: 2020-08-06 14:03:59

1- Launch the Linux instance in AWS https://dev.to/its_mukeshp/launch-ec2-instance-in-aws-4f0o and download the .pem file in your computer.
2- Download the PuTTY and PuTTYgen from https://putty.org
3- Open PuTTYgen then click on load and select the .pem file from your computer and then click on Save private key. Name the key accordingly the key will be in .ppk format.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wqbpvctlragfd5nnybsl.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1bok4uqikocjjq1yjobw.png)
4- Copy the IPv4 Public IP form EC2 Instance. 
5- Open PuTTy and paste the Ipv4 Public IP in Host Name(or IP address).
6- Click on + sign of SSH and then Auth

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

7- Click on Browse and select the .ppk file form your computer.
8- Click on Open, one window will open click on yes.

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3bmz881fea5ckha64bg3.png)
9- Black screen will open with login as: type ec2-user on that screen and enter.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/fsbaynn0bzt9xwudsyh9.png)
Ubuntu 20.04 üzerinde Ruby on Rails Kurulumu
Tags: rails, ubuntu, restful
Published: 2020-08-06 14:03:27

[Yusufreis](https://github.com/StarBuckR/yusufreis) programı için oluşturduğumuz Rails Sunucu için kurulum ve çalıştırma adımları aşağıda anlatıldığı gibidir.

### Dosyaların İndirilmesi
Öncelikle Sunucunun dosyaları indirilir.
```
git clone https://github.com/starbuckr/railsserver
```

Daha sonra projemizin bulunduğu dizine girip, gerekli paketler yüklenir.
```
cd railsserver
sudo apt install ruby ruby-dev ruby-bundler nodejs npm libsqlite3-dev zlib1-dev
sudo npm install yarn -g
yarn install --check-files 
```

### Rails Sunucunun Ayarlarının Yapılması
Eğer hali hazırda kullandığınız Ruby versiyonu 2.5.5 değilse, Gemfile içerisindeki ruby '2.5.5' satırını değiştirmeniz gerekir. Örnek olarak eğer Ruby versiyonunuz 2.7.0 ise bu şekilde düzenlememiz gerekir.
```
ruby '2.7.0'
``` 

Paketleri kurduktan sonra Rails sunucunun Gem ve veritabanı ayarları yapılır.
```
sudo bundle install
rails db:migrate
```

### Sunucuyu Çalıştırma
Sunucuyu çalıştırmak için, dosyaların bulunduğu klasörde `rails server` veya `rails s` komutu çalıştırılır.
```
rails s
```

Eğer sunucunuza, aynı ağdaki başka bir makineden bağlanmak isterseniz, çalıştırırken kullandığı ip adresini değiştirmeniz gerekir.
```
rails s -b 0.0.0.0
```

Daha sonrasında o ağa bağlı herhangi bir cihazdan bu sunucuya erişebilirsiniz. Örnek olarak, Ubuntu Server makinemizin ip adresi 192.168.1.56 ise, tarayıcınızdan `192.168.1.56:3000` adresine girerek sunucuya erişebilirsiniz.
Headless CMS - looking for JAM-stacker 👩‍💻👨‍💻
Tags: react, webdev, showdev
Published: 2020-08-06 14:00:01

I've been building all kind of web apps for quite some time now. Occasionally, I also develop websites for small and medium-sized businesses. Over the last years, all my clients wanted me to use a CMS so that they are able to update content, typically images and particular text elements, themselves. Unfortunately, changing an image in WordPress was already a big challenge for them and in the end, they've always asked me to do it.

For me, this is not a great situation either, since I prefer working with modern technologies such as NodeJS and Sapper as I can deliver much better quality with them. I've tried several headless content management systems as an alternative to traditional systems but most of them were to complex for the clients as well.

Therefore, I've built my own CMS over the last months. I put a focus on a clean and simple layout without noise as well as a great developer experience.

![media library](https://dev-to-uploads.s3.amazonaws.com/i/m9i45bbezg9z3ffounon.png)

![builder](https://dev-to-uploads.s3.amazonaws.com/i/3ufuas0vlnmj9ielxala.png)

![activity](https://dev-to-uploads.s3.amazonaws.com/i/suapoeir3zlnw5jnfnao.png)

It's already working pretty well and comes with a bunch of cool features such as automatic image resizing. I would like to get some feedback from other developers. Therefore I'm looking for a few developers who would like to spend a few hours playing with the CMS and give me feedback. Would be great if you had a basic understanding of typical JSM stack technologies like Gatsby, NextJS or Sapper. I've already built a blog template and a Javascript SDK that helps you get started.

If you are interested, feel free to send me an email to hello@timo.engineer 🙂
Google Lorem ipsum phone partially demystified 
Published: 2020-08-03 23:01:22


I can finally see the secret behind the [lorem-ipsum phone](https://store.google.com/intl/en/lorem-ipsum/) page. It  ~~is happening~~ [happened](https://www.theverge.com/2020/8/3/21352032/google-pixel-5-4a-5g-price-release-date-specs) **today**. Why are they so secretive about it?

![lorem-ipsum phone secret revealed](https://dev-to-uploads.s3.amazonaws.com/i/i8zzfx7fabv8ecorrmi7.png)

Do you want to verify it yourself?


*Alternative 1*: As you see in Google's colorful logo below, the word google has 6 letters and there are 6 clickable gray zones on the [lorem-ipsum phone](https://store.google.com/intl/en/lorem-ipsum/) page. 

![Google image](https://dev-to-uploads.s3.amazonaws.com/i/nzhkk1cg0i0u6g8nxpaa.png)

*Alternative 2*: Right click on the phone image and click on "Inspect Element (Q)" and look for a class with the name: `what-are-you-looking-at__content__massive__body`.


**What do the rest of Latin words mean?  [Google Translate](https://translate.google.com/translate?sl=auto&tl=en&u=https%3A%2F%2Fstore.google.com%2Fintl%2Fen%2Florem-ipsum%2F) reveals not so much about the rest? Do we need to know more about [Latin](https://www.bilinual.com/language-learning/) or [Javascript](https://store.google.com/intl/en/static/js/main.min.js) to demystify the rest?**
Improving Go playground
Tags: go, discuss, contributorswanted, news
Published: 2020-08-06 13:54:11

Greetings, Go devs.

I often find myself thinking that I often encounter a situation when I need to do some small prototyping (playing with goroutines, etc) and Go's playground often is faster solution than a dedicated IDE window. Unfortunately play.golang.org is very primitive (goplay.space is better but not much), so I've decided to try to create something a bit better.

A few months ago decided to try to create a better version of Go playground that will have a small valuable set of features that make prototyping comfortable enough, such as basic code autocomplete (stdlib only supported), syntax check, snippets and examples. Also as Go in WebAssembly trend starts to grow, WebAssembly support was added.

In addition, user can customize the editor by enabling font ligatures, selecting editor font and some other small subset of options.

I would like to know your opinion and get some feedback.

URL: https://goplay.tools/
Source Code - https://github.com/x1unix/go-playground (contribution is appreciated)
Angular Subject Matter Expertise takes time
Tags: angular
Published: 2020-08-06 13:51:39

SME = Subject Matter Expert. Companies want people that are SMEs (in general).  With compressed schedules and ever increasing smart end-users the demand strips the supply. 

**How Long does it Take?**

Over 20 years ago, an office mate and I discussed this very topic. Our environment was constantly churning in new people as others left. We became the mentors for the new folks. 

The code was complex as is any current medium to large web site is today.  We both agreed it takes a full year to kind-of sort get comfortable and at least another 6 months to enter into the start of expert mode.  

Nothing has changed in all those years, except that the complexity is even higher now. Learning never ceases in this industry. Work hard and diligent and things will get better.

JWP 2020
Staircase Challenge Revisited: Python Version
Tags: python, codenewbie, challenge, career
Published: 2020-08-06 13:48:18

I've just started picking up Python for my new job, and I've found the best way for me to practice new syntax is to tackle old problems in a new language. In this post, I'll explore various ways to solve the [Staircase Problem](https://www.hackerrank.com/challenges/staircase/problem) in Python. 

## The Problem
In this problem, we are given a number of levels, n, and are asked to print out a staircase with n levels ascending from left to right, like this:

```python
staircase(4)

// Result:

   #
  ##
 ###
####
```

If you haven't already. [check out my original post](https://dev.to/jessesbyers/staircase-challenges-repeat-iteration-and-recursion-strategies-2f67) for more discussion of the problem and general strategies to tackle this problem. Rather than repeat, I'll just focus on my Python solutions in this post.

### String Repeat Strategy and Solution
My first strategy was to build a single loop, and print out a string of repeated characters at the end of each iteration. Python makes it really straightforward to repeat characters in a string using the `*` symbol.

```python
def staircase(n):
    for i in range(1,n+1):
        print(' '*(n-i)+'#'*(i))
```

### Iteration Strategy
Another option is to use an iteration strategy with nested loops to build out a staircase based on a character's position in each column and row. The `range()` function in Python makes it really easy to set up the nested loops for rows and columns.

```python
def staircase(n):
  for row in range(n):
    string = ""
    for col in range(n):
      if col <= row:
        string += "#"
      else:
        string = " " + string
    print(string)
```

### Recursion Strategy
This can also be solved recursively. Although this is certainly not a very straightforward solution, it did give me a chance to practice the Python syntax for conditional logic and ternary statements. While this code produced the correct output in a repl sandbox, it does not pass the HackerRank challenge. I believe this is due to the high runtime.

```python
def staircase(n, row=0, string=""):
  if n == row:
    return

  if n == len(string):
    print(string)
    return staircase(n, row+1)

  add = "#" if len(string) <= row else " "
  staircase(n, row, add+string)
```

*How would you solve this in Python? What are your favorite Python syntax tips and tricks for solving code challenges in Python?*
🚢 When do you ship? (Technical or Business/Product reasons acceptable)
Tags: discuss, watercooler
Published: 2020-08-06 13:46:35

---
title: 🚢 When do you ship? (Technical or Business/Product reasons acceptable)
published: true
tags: discuss, watercooler
series: career questions for data folks
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/nzrsj8vb95j9mohhhjr9.png
---

Do you have a checklist of requirements? (Technical or Business/Product)

👇 Discuss 👇
Daily Challenge #277 - Over the Road
Tags: challenge
Published: 2020-08-06 13:44:22

---
title: Daily Challenge #277 - Over the Road
published: true
series: Daily Challenge
description: Given your house number address and length of street n, give the house number on the opposite side of the street.
tags: challenge
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/9k6vw333lqjuebn6rkf7.png
---
You've just moved into a perfectly straight street with exactly n identical houses on either side of the road. Naturally, you would like to find out the house number of the people on the other side of the street. The street looks something like this:
```
1|   |6
3|   |4
5|   |2
```
Evens increase on the right; odds decrease on the left. House numbers start at 1 and increase without gaps. When n = 3, 1 is opposite 6, 3 opposite 4, and 5 opposite 2. 

**Given your house number address and length of street n, give the house number on the opposite side of the street.**

###Examples
over_the_road(address, n)

`over_the_road(1, 3)` = 6
`over_the_road(3, 3)` = 4

###Tests
`over_the_road(3, 5)`
`over_the_road(7, 11)`


Good luck!

***
_This [challenge](https://www.codewars.com/kata/5f0ed36164f2bc00283aed07) comes from rge123 on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
MVP For a Learning Data Structures Project, Come Take A Look!
Tags: webdev, showdev, computerscience, algorithms
Published: 2020-08-06 13:37:04

## A New Way to Learn Data Structures
Hi there! Over the past few weeks, I've been working on an open-source side project in my free time to help people learn more about data structures and how they work. I call it, [Data Structure Visualizations](https://chasserush.github.io/DataStructureVisualizations/) (I know, not the most creative name but it's a work in progress). 

I wanted to build a resource that has plenty of information on particular data structures explained in simple terms that both newbies and experienced developers alike could benefit from. Since I'm a bit of a visual learner, I thought, "Oh, some visualizations would be nice too," so I built out some visualizations using gsap and svg's that show how exactly a method in a data structure would work to give users another way of learning about it without simply reading a bunch of text. Take a look at the animation for adding to a queue here!

![animation](https://dev-to-uploads.s3.amazonaws.com/i/eaz0pul5dp3mzg42ezsb.gif)

Just as a forewarning, this project is still very much a work in progress. I only have a few data structures completed already with more in progress (particularly HashMaps), but I figured I'd put this out in the world to get some feedback on it and maybe this will help out some people who want to learn more about the data structures that are up there so far.

Thanks everyone and let me know what you all think!

Github repo: https://github.com/ChasseRush/DataStructureVisualizations
Project: https://chasserush.github.io/DataStructureVisualizations/
Stack Overflow Raised $85 Million to Invest in Teams
Tags: news, stackoverflow
Published: 2020-08-06 13:36:24

> If you have a coding question, chances are a Google search will take you to Stack Overflow. The programming-oriented Q&A website is the 45th most popular site in the world, according to Alexa Rank. “No other company or organization has the size of community that we have in the technology industry,” says CEO Prashanth Chandrasekar. “Every developer knows who we are.”

> The Covid-19 pandemic’s shift to remote work has only bolstered Stack Overflow’s spot in engineering circles. From April to June, an average of 200,000 new users signed up each month, the best quarter in the 12-year-old New York City-based startup’s history, Chandrasekar says. With that demand has come more venture capital interest: Stack Overflow announced on Tuesday it has raised $85 million in a Series E funding round. 

## **Full story on [Forbes](https://www.forbes.com/sites/kenrickcai/2020/07/28/stack-overflow-qa-website-raises-85-million-series-e/#3c972ae65752)**
Refactoring How Deep?
Published: 2020-08-06 13:35:48

When we first take the refactoring plunge we eventually want to ask "How deep should this go?".  The answer is simply; go as deep as possible to get code that does only one thing!  Doing this, by nature, turns almost everything into functional programming styles (with just a tiny bit more effort to achieve pure functions).

We begin to see (over-time) that programming is nothing more than an ordered set of functions, composable anywhere (if we've made them reusable in our own libraries).

In addition, we ensure that each function is bullet proof, and all of a sudden, down the road we pick up immense speed in creating applications.

We also become familiar with what good coding patterns should look like and can immediately refactor code into smaller functions.

If we then see the pattern of "hey this does that same thing as that other thing we did last week" except it's for a different type of data, then we're in luck... it's time to look into implementation of generic functions.  Those that work on any collection regardless of type.

Deep Refactoring is always good, it forces us into creating composable software.  Composable Software is just 'pulling in parts where we need it.'  We are composing an application [the same way car are built](https://en.wikipedia.org/wiki/Assembly_line).

TIP: Avoid callbacks! Why? When we have a lot of smaller functions each callback has to push the stack and then on return pull it.  When you are debugging this you have to go with the Unwind when single stepping. It's not fun to do that. 

JWP 2020