teleren/devto huggingface dataset:
My #100DOC - Day 28
Tags: 100daysofcode, challenge, log
Published: 2020-09-23 17:49:06

### Day 28: September 23, 2020

#### **Today's Progress**: 
1. **[Continued with The Complete JavaScript Course](https://github.com/pablohs1986/javaScriptCompleteCourse2020_Schmedtmann)** (1h 30min):<br>I continued with the Budget App project. I added HTML to the DOM, replaced parts of strings and manipulated the DOM using inserAdjacentHTML method.
    
#### **What I learned**: 
* Adding big chunks of HTML into the DOM.
* Replace parts of strings.
* How to do DOM manipulation using the insertAdjacentHTML method.

#### **Total time**:
1h 30min.
The `finally` Block in `try-catch-finally` Executes Always
Tags: javascript, java, kotlin
Published: 2020-09-23 17:41:51

_This article shows Javascript examples. I tried this in Javascript, Java, and Kotlin. A more Kotlin-centric approach in my personal [blog](https://iamvishnu.com/posts/finally-block-executes-always)._

---
Recently I was exploring some source code and came across a code that implements a Mutex.


Here's what it looks like (from [kotlinx-couroutines-core](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/sync/Mutex.kt#L111))

```kotlin
    lock(owner)
    try {
        return action()
    } finally {
        unlock(owner)
    }
```

I was wondering how they are going to release the mutex lock within the `finally` block once the `return action()` inside the `try` block is executed.

I never wrote a `finally` block before, so this got me a little confused.

A search revealed that many people have come across this situation. There's a [question in StackOverflow](https://stackoverflow.com/q/65035/816416) which has around ~2.4k upvotes and bookmarked ~500 times.

It is true. The `finally` block gets executed always, except some unforeseen situations like the process getting killed, which is mentioned in the [accepted answer](https://stackoverflow.com/a/65049/816416) in the StackOverflow question.

I looked up in the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch) and found this:

> _"Note that the `finally`-block executes regardless of whether an exception is thrown. Also, if an exception is thrown, the statements in the `finally`-block execute even if no `catch`-block handles the exception."_

### Let's try out a `try` block!

So I created a [small JSBin snippet](https://jsbin.com/mucipov/edit?js,console) to test that:

```javascript
function tryExample(){
  try{
    return "Returned from try{}";
  } finally {
    console.log("Inside finally{}");
  }
}

console.log(tryExample());
```

This code will print: 
```
Inside finally{}
Returned from try{}
```

## One more thing, if the `finally` returns something, then the `return` within the `try` block won't work.

When I posted this on LinkedIn, my colleague [Afsal](https://medium.com/@afsalms7) pointed out another interesting thing -- if we return from the `finally` block, then the `return` statement within the `try` block won't execute.

That was another discovery.

I created [another JSBin snippet](https://jsbin.com/xivupuh/edit?js,console) to test that:

```javascript
function finallyReturnsExample(){
    try{
        return "Returned from try{}"
    } finally {
        console.log("Inside finally{}")
        return "Returned from finally{}"
    }
}

console.log(finallyReturnsExample());
```

The output will be:
```
Inside finally{}
Returned from finally{}
```

So a new lesson learned - **the `finally` block always executes (except for a few conditions) and if a `finally` block returns, the `try`/`catch` won't return.**
Is it wildly irresponsible to quit and take a few months off?
Tags: burnout, career, advice, quitting
Published: 2020-09-23 17:30:13

---
title: Is it wildly irresponsible to quit and take a few months off?
published: true
description: I think I'm burning out and I don't have the ability to focus on working much less on living.
tags: burnout,career,advice,quitting 
//cover_image: https://direct_url_to_image.jpg
---

Hi there. I'm a developer of about 5 years experience, a bit over 2 and a half at my current one. I fear though I am very close to burning out right now if I haven't already. I feel anxious waking up for work, dread the weekend ending before Friday's workday has even finished, and generally can't do any work due to lack of concentration. It's infuriating and extremely anxiety inducing.

I am unsatisfied in my position and I am sick of the midwest and south and just more rural conservative areas in general. I feel if I want to get out of this rut I'm in I need to move positions and locations. This said, I don't know where I want to move or the kind of position I want to move to. It feels a bit silly to job hunt until then. 

Even if I figured it out and started job hunting, I need a long break between jobs to recharge I'm pretty sure. Searching with a gap worries me as well as searching with an address not local to wherever I would be applying to. One of the bigger worries I have right now is I'm transgender(male to female) and have started transitioning. I worry that job searching mid-transition is going to be very difficult. I also am very worried about health insurance during the interim, I know COBRA is a thing but we have a pretty good insurance policy so I worry it will be very expensive.

I have some money saved up and have been thinking of converting my car into a mini-camper of sorts and doing some road tripping and camping. I figure that kind of change of pace will be really in helping me to recharge.

I feel like quitting without a backup plan is very irresponsible and will limit my ability to find work later but not doing so will be problematic too. Does anyone have any kind of advice or experience they can share with me? I feel like I know the answer to what I need but am just too scared to do it. 

Thanks a lot for reading!
Deciding on a Tech Stack: Backend
Tags: strapi, node, javascript, api
Published: 2020-09-23 17:17:28

For the backend, I wanted to use a headless CMS. 

I have used the [new CMS, Strapi,](https://strapi.io/) before so I decided with that.

![Strapi Homepage](https://dev-to-uploads.s3.amazonaws.com/i/ugwu9yfu6psqjz96aked.jpg)

#### Here are a few of the reasons why I went with Strapi:

- An open-source CMS. (I don’t want to spend more than 10$/month in hosting)
- A NodeJs backend. 
 - I want to get a better understanding of Javascript and I thought this could help.
 - Headless/ API driven.
- I want to better understand API’s and specifically how authentication works with one. 
- Strapi’s documentation, community, and company.
 - Strapi has a vibrant community. 
 - Their documentation is great. There are some typos, which I have worked on and as I work on this project, I figured I will be able to make edits as I have time.
 - It seems like Strapi has a great company foundation and will be around for a long while.
- Strapi’s API
 - I love Strapi’s API that comes out of the box. It takes zero configuration to build a fully functional REST API and Strapi comes with many features, like image optimizations, that I won't have to build.

Here is another article I wrote about Strapi with a video overview of the Strapi API:
{% link https://dev.to/cwraytech/a-great-nodejs-backend-option-for-frontend-developers-or-no-coders-43d0 %} 

Well, this is the tech stack of my personal portfolio! You can follow the [Frontend](https://github.com/cwray-tech/portfolio-frontend) and [Backend](https://github.com/cwray-tech/portfolio-backend) repos on Github to see how they develop through this project.

Look out for more blogs in this series as I continue to document the process of building my portfolio.😊
Observables as Event Engines
Tags: angular, typescript, javascript
Published: 2020-09-23 17:17:06

The observable and subscriber go together to create the components of cross component notification system.  It's the archetype of the classic Event and Event Handler model. In Angular all EventEmitters are Observables.

>Note that the DOM doesn't support the Observable internally. Everything in the DOM still uses the older Event and Event Handler model. 

**Subscribers and Observables**

```typescript
export class test{
  private subscriber: Subscriber<boolean>;
  const observable$: Observable<boolean> = 
    new Observable<boolean>(
      sub => {
         this.subscriber = sub;
      }
   )
}
```
This pattern above has two variables, one is a Subscriber, the other is an Observable. the observable is a const because other code will subscribe to the observable, it cannot change without destroying the subscriptions. 

The subscriber is used internally to this module only. This is why we use the private keyword.

When a new Observable is created it will pass the subscriber as shown in the lambda expression.

```typescript
new Observable<boolean>(
// the lambda expression accepting a subscriber.
      sub => {
         // expose this globally 
         this.subscriber = sub;
      }
   )
```  
**How do we make change Notifications?**

In the test class instance ... we use the subscribers next function as shown here:

```typescript
this.subscriber.next(true);
//later 
this.subscriber.next(false);
```
**Subscriptions**

```typescript
let test = new Test();
test.observable$.subscribe(valid=>{
   //this is the event handler
});
```

Simple, terse, and highly responsive.

**Easier Implementation?**

In Angular, yes there is an easier implementation.

```typescript
someEvent: EventEmitter<boolean> = 
    new EventEmitter<boolean>();
``` 
The recommendation is to allow the event emitter to be decorated with @Output. This allows consumers access for subscription via properties exposed at the HTML layer. While this solution works it has an extra layer of indirection.

```html
//myHandler is an indirect reference to the javascript code.
<app-other (eventEmitter)='myHandler'></app-other>
```

**Use ViewChild Instead of Output**

A @ViewChild can also wire up subscriptions as easily. We like this method better as it is more direct. Like this:

```typescript
@ViewChild(otherComponent) other:OtherComponent;

//direct reference via a lambda expression
other.someEvent.subscribe((valid)=>{
    //do something with the valid event
});
```
In the code above the HTML doesn't wire up the EventEmitters indirectly, rather they are wired up directly in one line of code.

**Summary**
If we are using Angular, we will use EventEmitters. If not, we will use the other pattern instead. 

JWP2020
Project Risk Management: strategies and techniques
Published: 2020-09-23 16:58:14

Working as the Project Manager is a great opportunity to challenge your soft and hard skills. One of the “sharpest” sides that you can face is working with risks. I would rather say that working as the project manager is all about risks and decision-making on how you will manage them.

Before getting to know how exactly you can use Risk Management strategies, let’s define what it is. Risk management is the process of making and implementing management decisions aimed at reducing the probability of an adverse result and minimizing possible losses caused by its implementation.

Here are some types of risks and strategies that you can use while handling tricky/ challenging situations:

1. Mitigating Risk
As part of the implementation of this strategy, it is supposed to take certain actions that involve a decrease in the probability of risk implementation.
Another response option when the probability of risk cannot be reduced is to decrease the damage that may be caused by the implementation of the risk scenario. Preventive measures to reduce the probability of risk or its consequences in most cases are much more useful than reactive measures.

2. Avoiding Risk
To implement this strategy, it is necessary to change the project plan in such a way so that the potential threat that risk implementation may cause would be in general excluded. For example, if the probability of failing to reach certain goals of the project is unacceptably high, then it is much cheaper to completely exclude these goals from the project at all, rather than deal with negative consequences afterwards. Some project risks can be avoided by clarifying the requirements for the project, requesting additional information, as well as conducting an examination in questionable areas.

inner what-is-api3. Transferring Risk
This risk management strategy involves transferring the consequences of the risk scenario and the damage to a third party. The risk itself and its consequences, of course, will not disappear, but financial losses can be avoided. Transferring responsibility for risk, as a rule, means paying a premium to the party that has accepted the risk.

4. Retaining Risk
The strategy is to not react to it in the event of a risk scenario. This may seem strange, but not all risks should be reduced or insured.
In some cases, these are too small risks to take them into consideration. The amount of damage from such risks is much smaller than the development and implementation of measures to eliminate them or reduce the likelihood of their appearance.
In other cases, on the contrary, these are too big risks, the effect of the implementation of which makes the further implementation of the project pointless or inappropriate.

While working with risks it’s very important to identify, categorize, and assess them. It helps you to manage and manipulate any number of risks that may appear in the software development flow. Moreover, using these simple tips may help you to cope with obstacles not only in IT but in your daily life.

Read and look more in https://webspaceteam.com/.
Installing MySQL and MySQL Workbench on Linux
Tags: mysql
Published: 2020-09-23 16:55:36

Simple Guideline on installing MySQL and Workbench on Ubuntu , Pop_OS or any Debian Linux.

Install MySQL

Update apt to ensure you get the latest packages and install mysql-server
```
$ sudo apt-get update
$ sudo apt-get install mysql-server
```

Next to setup and Configure MySQL
```
$ sudo mysql_secure_installation
```
Selecting Y ('yes') for all the setting is reasonabe.

To access MySQL

```
$ sudo mysql -u root -p
```

Install MySQL Workbench

Download the installer which is compatable for your system and Linux version .

[click here to download](https://dev.mysql.com/downloads/workbench/)

Just click on the deb file and install or use dpkg command to install
```
$ sudo dpkg -i path_to_deb_file
```

To Uninstall MySQL and MySQL Workbench

If u want to remove both this softwares completely from your system use the following commands

To remove MySQL
```
$ sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
$ sudo apt-get autoremove -y
$ sudo apt-get autoclean
```

To remove MySQL Workbench
```
$ sudo apt-get remove mysql-workbench-community
or
$ sudo dpkg -r mysql-workbench-community
$ sudo dpkg --purge mysql-workbench-community
```

To Start, Stop, Restart or check Status of MySQL Service
```
$ sudo service mysql start 
$ sudo service mysql stop
$ sudo service mysql restart
$ sudo service mysql status
```

To Access MySQL without SUDO

When we try to access MySQL without sudo ERROR 1045 (28000): Access denied for user 'username'@'localhost' (using password: NO)

this error pops up

Follow this steps to overcome this error
```
$ sudo mysql  -u root -p
Enter password:
mysql> show databases;
mysql> use mysql
mysql> select user, host, plugin from mysql.user;
mysql> update user set plugin="mysql_native_password" where User="root";
mysql> flush privileges;
mysql> exit;
$ mysql -u root
mysql> SET GLOBAL validate_password.policy=LOW;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Enter_password';
mysql> exit
$ sudo service mysql restart
```

now we can access MySQL by using

```
$ mysql  -u root -p
```
Code Complete 2: Statements (Part 4)
Tags: codenewbie, codequality, computerscience
Published: 2020-09-23 16:55:14

A statement is an instruction for the computer program to perform an action. There are many different types of statements that can be given in a computer program in order to direct the actions the program performs or to control the order that the actions are carried out in.

##**Chapter 14: Organizing Straight-Line Code**
**Statements That Must Be in a Specific Order**
Organize code so that dependencies are obvious; if one method initializes data, create and call an Initialize() method.

**Statements Whose Order Doesn't Matter**
Statements that operate on the same data, perform similar tasks or have ordering dependencies should appear together.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/s8liygqnwjmumaz192cf.jpg)

**Chapter 15: Using Conditionals**
**if statements**
For both readability and performance, write the nominal path through the code first, then the unusual cases.
Simplify complicated conditional expressions with calls to methods that return boolean values.

**Case statements**
Some case statements only work on data of certain types; don't create a "phoney variable" to use a case statement.
Use the default statement to detect legitimate defaults, or to detect errors, and nothing else.

**My Key takeaways in these two chapters are;**
<ul><li>The strongest principle for organizing straight-line code is ordering dependencies.</li>
<li>Dependencies should be made obvious through the use of good routine names, parameter lists, comments, and—if the code is critical enough—housekeeping variables.</li>
<li>If code doesn’t have order dependencies, keep related statements as close together as possible.</li>
<li>For simple if-else statements, pay attention to the order of the if and else clauses, especially if they process a lot of errors. Make sure the nominal case is clear.</li>
<li>For if-then-else chains and case statements, choose an order that maximizes readability.</li>
<li>To trap errors, use the default clause in a case statement or the last else in a chain of if-then-else statements.</li>
<li>All control constructs are not created equal. Choose the control construct that’s most appropriate for each section of code.</li></ul>
DevTools tips: Inline source editing
Tags: devtools, javascript, tips, chromium
Published: 2020-09-23 16:53:20

One of the cool features of Chrome/Chromium DevTools, is the ability of modifying js scripts code directly in the source inspector!

Just open the Source panel and start hacking in the code of one the listed scripts.
Save your modifications with `ctrl-s` (`cmd-s` on Mac) and check the result in your app!

This may come in handy if you you want to try out simple modifications on the front-end without rebuilding the whole app or even refreshing the page!

Check it in action 👇

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/79zfd6w0h01zicw1bn1q.gif)
Command to open current folder in vscode
Tags: vscode, tips, beginners, codenewbie
Published: 2020-09-23 16:36:45

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

`code .` - Run the command to open the folder in vscode.

---

**Thanks for reading 💙**  
Follow **@codedrops.tech** for daily posts.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Twitter](https://twitter.com/codedrops_tech) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript  
**[codedrops.tech](https://www.codedrops.tech/)**
Git Comfortable
Tags: git, github, gitcommands
Published: 2020-09-23 16:32:41

Have you ever wanted to share your code without "command + c and command + v"? Or started a project on one computer but wanted to continue on another? Well let me introduce you to "Git". 

**Git? Git What?**
To know Github, is to know Git. Git is a "version control system", that is used among newly and tenured software developers, and powered through repositories. It is highly recognized because of the simplicity it allows. Git gives people the ability to take their code on the go, by being remote friendly, or offline completely. 


**Terminology**
![Git Branch Picture](https://dev-to-uploads.s3.amazonaws.com/i/6ttsuytzxq4ss6tqt502.jpeg)

Within Git, there are 'commits'. Commits are what happens when you save the work and progress you have created. Every 'commit' is on what is known as the branch. The main link that all the commits are on, are known as the master branch, but there are other branches that are able to be created within the master branch, for people who want to try different styles of the same project, without making that the final version.  

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1d7g1lvhfcurhmblnq1u.gif)

Since this is an introductory to "Git", I do not want to overwhelm you with all that is great about "Git". But I do want to start the layering, and understanding of the different commands and terminology. 

**Git Commands**
create a local repository ------> git init [name of project]
add a specific file ------------> git add [file name]
add all files in folder ---------> git add .
commit the files ---------------> git commit -m "comments"
submit changes to the origin ---> git push
set up w/ a partner ------------> git remote add [name] [link]
pull from partner --------------> git pull [name]

 
Git has a lot of commands, that make it easier to do just about everything. And since it is so popular, what you don't know, Google will. So the best way to "Git Comfortable" is to "Git Practicing". 

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



**Sources**
Class Slides - Git Illustration

https://i.redd.it/8341g68g1v7y.png

https://en.wikipedia.org/wiki/Git

https://git-scm.com/
Data and machine learning ebook set for $0.84 from O'Reilly
Tags: database, datascience, machinelearning
Published: 2020-09-23 16:25:42

You can buy some nice ebooks about data and AI for $0.84 from O'Reilly. Check it out: 

[LINK](https://www.humblebundle.com/books/data-ai-oreilly-books?partner=tomaszs)
Preptember check-in: more maintainer resources for Hacktoberfest
Tags: hacktoberfest, opensource, github, discuss
Published: 2020-09-23 16:19:06

---
title: Preptember check-in: more maintainer resources for Hacktoberfest
published: true
description: Hacktoberfest is just a few weeks away! Here'
tags: hacktoberfest, opensource, github, discuss
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/2ph1gpihx5yvew74givp.png
---

Hello, fellow open source maintainers!

With [Hacktoberfest](https://hacktoberfest.digitalocean.com/) just around the corner, I'm sure that many of you have been reflecting on how you can best prepare for contributions from participants next month and are also wondering how you can lend your help and expertise to open source newbies. 

## **Here are a few Hacktoberfest resources and opportunities for maintainers.** 

### 1. DEV's Looking for contributors thread

You know you _want_ contributors submitting PRs on your project to help it improve and evolve, but how can you get the word out? Drop a link to your project and any other info about it in this thread to get more eyes on your repo!

{% link https://dev.to/devteam/whos-looking-for-collaborators-hacktoberfest-2020-jl89 %}

### 2. This Preptember guide for maintainers 

This post is full of great tips for getting your repos in tip-top shape for contributions — during Hacktoberfest or any time of year.

{% link https://dev.to/devteam/preptember-start-getting-ready-for-hacktoberfest-this-month-58cn %}

### 3. Raise.dev's Hacktoberfest Helpdesk

Head to [https://raise.dev/hacktoberfest](https://raise.dev/hacktoberfest) to sign up for [Raise.dev](raise.dev)'s Hacktoberfest Helpdesk as a maintainer mentor! Some of team DEV/Forem will be participating weekly — hope to see you there!

### 4. "Getting the Most Out of Open Source" Tech Talk from @nickytonline via @DigitalOcean

On October 1st, our very own @nickytonline will be presenting a free talk for both maintainers and contributors on how to have the best experience in the open source community. Register [here](https://www.digitalocean.com/community/tech_talks/getting-the-most-out-of-open-source).

_Any other tips for open source maintainers looking to maximize their Hacktoberfest experience? Drop them in the comments below!_