teleren/devto huggingface dataset:
JS / explain for loop leak
Tags: tutorial, interview, javascript, learning
Published: 2020-05-29 00:43:38

`var` is not block scoped, meaning that `var` in a for loop will leak into the parent scope, which is not something we necessarily want. Typically we want a placeholder value that we need to work with only inside the loop. 

```js
for (var i = 0; i < 3; i++){
    console.log(i);
}
// 0
// 1
// 2

console.log(i); // 3
```

The above is equivalent to this:

```js
var i;
for (i = 0; i < 3; i++){
    console.log(i);
}
// 0
// 1
// 2

console.log(i); // 3
```

That was a pretty benign example. Let's now take a look at the more consequential examples. Here, we are going to increment a counter and print each number with a staggered timeout delay.

```js
for (var i = 0; i < 3; i++){
    setTimeout(function(){
      console.log(i)
    }, 1000 * i)
}
// 3
// 3
// 3
```

Not what you might expect, right? The catch is that `i` is bound to whatever `i` is at the time of execution. Because of the `setTimeout`, by the time the function executes, `i` has already been mutated at every iteration. 

One quick way to fix this is by using `let`. What do we know about let? It’s block-scoped. As a note, you couldn’t use a const for this because the variable needs to overwrite itself as we iterate through. When we use let, it’s going to scope `i` to our curly brackets.

```js
for (let i = 0; i < 3; i++){
    setTimeout(function(){
      console.log(i);
    }, 1000 * i)
}

// 0
// 1
// 2
```

If you're having a hard time understanding why `let` works like this, check out this equivalent representation:

```js
for (var i = 0; i < 3; i++) {
    let j = i;
    setTimeout(function(){
        console.log(j); // j remembers what it was at each iteration
    }, 1000 * i);
}
```

Before ES6, we had no `let` and `const`, which meant that developers had to use a clever trick using a closure.

```js
var funcs = [];

for (var i = 0; i < 3; i++) {
    var returnFunctionWithBoundInteger = function(i){
        return function(){
            setTimeout(function(){
                console.log(i);
            }, i * 1000);
        }
    }
    funcs[i] = returnFunctionWithBoundInteger(i);
}
for (var j = 0; j < 3; j++) {
    funcs[j]();
}
```

This enclosing function (aptly named `returnFunctionWithBoundInteger`) is important because at each iteration, we want to lock in an `i` value for the returned function. Remember: functions follow lexical scope; they remember variables in their original referencing environment even when invoked outside of their original position in the code. Therefore, at each iteration, we are storing an inner function that remembers the `i` it had access to at each iteration. If you need a refresher on closures, check out this [resource](https://dev.to/icncsx/js-explain-closures-5edh).

Fun fact: debugging a loop leak was one of the first interview questions I bombed. I changed the `var` to `let`, and the interviewer asked me to keep `var` and find another solution. I couldn't figure it out, even though I vaguely new about closures. For loop leak is actually a pretty common interview question, so I hope you don't make the same mistake I did.

Warmly,
EK
Long-Distance Relationships vs. Quarantine
Tags: career, covid19, love, relocation
Published: 2020-05-29 14:21:27

---
title: Long-Distance Relationships vs. Quarantine
published: true
date: 2020-05-29 00:00:00 UTC
tags: career,covid19,love,relocation
canonical_url: 
series: living_overseas
---

Opting for the often exciting life-style choice of working overseas isn’t without its drawbacks.

I never wanted a long-distance relationship. Neither did my partner. They’re preternaturally difficult and I have a poor track record. But, despite being 1500 km apart, monthly business trips, comparable timezones, and discount airlines made it barely tolerable. Along came COVID-19.

March was out of the question. My flight in April was cancelled, and a few weeks ago my May flight got cancelled. Depending on where you are, some limitations are finally lifting. Limited international flights will resume in June and expand through July and beyond.

But, none of this means our relationship was quarantined. I’ve been contemplating this post for some time, but a [recent BBC morsel](https://www.bbc.com/news/world-52196670) made me pull the trigger. This is for all you star-crossed lovers out there.

Some ideas based on how we’ve been passing the time:

- Use [Skype](https://www.skype.com/), [WhatsApp](https://www.whatsapp.com/) (or any other service) to video call each other
  - While doing "mundane" activities like cooking, chores, going to bed, etc. it _almost_ feels like you're doing it together
- Sending pictures and text/voice messages more than normal
- Use [Uber Eats](https://www.ubereats.com/) (or similar regional option) to order food for each other and have dinner together (candle optional)
- Watch the same movie or TV show
  - YouTube, share a Netflix account, or one of the countless competitors
  - Investigate support software (e.g. “youtube party”, “netflix party”) allowing you to synchronise video streams, etc.
  - Take the opportunity to share each other’s favorites, classics from childhood, etc.
  - Bonus points for video chatting at the same time.  I like to place the camera adjacent to my seat so I turn to look at them like they were sitting next to me
- Online video games (or board/card games- where possible), sending each other daily "challenges", etc.

Hopefully this quarantine will turn out to be a once-in-a-lifetime experience. But, it’s reminded me that many other couples go through a similar situation if work/school takes them elsewhere.

Anyone else come up with other good ways to stay connected with your significant other?
What Do You Wish You Knew About Accessibility?
Tags: a11y, discuss
Published: 2020-05-28 23:57:03

---
title: What Do You Wish You Knew About Accessibility?
published: true
description: Have an accessibility-related question or a topic you want to learn more about? Comment to help me plan some new posts!
tags: #a11y, #discuss
---

What do you want to learn about accessibility? I'm going to be working on some new posts, so leave a comment if there's an accessibility topic you want to see me cover - whether's it's a primer on what accessibility is or something really specific, like making an accessible calendar component!

Even if I don't get to writing about the topic you are curious about, you might inspire someone else to write about it.
Simple Execute Shell Android In React Native
Tags: reactnative, android, shell, react
Published: 2020-05-28 23:37:38

Hello Bruh, execute the shell is in my opinion very important, to find out detailed information on android.

<b>Getting Started</b>
```javascript
$ npx react-native init nameYourProject
```
```javascript
$ cd nameYourProject
```
```javascript
$ npm install react-native-android-shell --save
```

Edit App.js file
replace code, using within code
## Example
```javascript
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import AndroidShell from 'react-native-android-shell'

class demo extends Component {
    constructor(props) {
        super(props);
        this.state = {
            result: ''
        };
    }

    componentDidMount() {
        AndroidShell.executeCommand("ls", (result) => {
            this.setState({ result: 'yeu : ' + result });
            console.log('Result :', result);
        });
    }

    render() {
        return (
            <View style={{ alignItems: 'center', flex: 1 }}>
                <Text>{this.state.result}</Text>
            </View>
        );
    }
}

export default demo;
```
Breaking: Is What a Technician Found Written Inside 5G Antenna Confirming Our Fears?
Published: 2020-05-28 23:28:51




For some time now the issue of either 5G networking technology is harmful to the health of both humans and animals alike have been greeted with mixed reactions.

Some school of thoughts are very optimistic in their claims that the 5G networking technology is a killer agent; others says there is nothing wrong with 5G technology.

Is 5G technology actually an upgrade of 4G technology?

There are some persons who claimed the 5G networking technology is never an upgrade of 4G; according to them, 5G is like multiplying 4G by ten times.

Who among these categories of people is right in their claim?

There is this theory that is 5G networking technology deployed for the purpose of heating up humans to death thereby reducing the population of the world, and secondly, to speedily network the remaining humans on the surface of the earth.

Corona virus was introduced as a means of creating fear ad panic thereby allowing for massive vaccination of humans; through this vaccination, those who survived and lives have been micro chipped.

Recently, I came to discover that the name “COVID-19” has no relationship with the novel corona virus; COVID-19 means “Certificate Of Vaccination IDentity” with 19, 1 = a and 9 = i for AI = Artificial Intelligence.

Now hear this: Some field technicians who were hired to install the 5G mask somewhere in the UK were asked never to open the antenna; but one of the technicians decided to open one of the antenna unit, guess what he found? COVID-19 was boldly inscripted on the mother board of the antenna.

Watch the video at: https://www.efogator.com/2020/05/breaking-is-what-technician-found.html
Import any Deno module directly from GitHub or NPM
Tags: deno, npm, typescript
Published: 2020-05-28 23:07:44

The creators of Deno dropped us a very welcome goodie today.  I started using Deno about a week ago and instantly fell in love with it.  I really wished there was a way to directly reference modules from GitHub without having to register the repo with [deno.land/x/](http://deno.land/x/) first.

I visited [deno.land/x/](http://deno.land/x/) today and noticed this:

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

Today that has been solved.  They now allow us to reference any arbitrary github repo or NPM package.  Here's how:

To import the `amqp` module from GitHub, for example:

```Typescript
// import from master
import { amqp } from "https://deno.land/x/gh:lenkan:amqp/mod.ts";

// import version
import { amqp } from "https://deno.land/x/gh:lenkan:amqp@v0.9.1/mod.ts";
```

Likewise, to import the `numbers` package from NPM just use the following:

```Typescript
// import latest
import { numbers } from "https://deno.land/x/npm:numbers/index.js";

// import version
import { numbers } from "https://deno.land/x/npm:numbers@v0.7.0/index.js";
```
Do you agree on 'Your biggest supporter is a stranger'?
Tags: discuss, career, webdev
Published: 2020-05-28 19:16:30

---
title: Do you agree on 'Your biggest supporter is a stranger'?
published: true
description: 
tags: discuss, career, webdev
---
Recently I read this article:
{% link https://dev.to/ugglr/junior-developers-checklist-for-landing-a-remote-job-2ldb %} 

and came across a thoughtful comment:
{% comment p814%}

I decided the topic might deserve to get extended a bit. 

Many believe, that Rule number #1 is not to reveal your future plans to anyone, as they might want to secretly dismantle them by stalking you on your code-related online presence, creating a bad rep for you on your projects feedback, putting a pressure on you by irritating you in daily communication, etc..

Have you ever experienced someone from your closest network to stay in your way to success? If so, could you re-call some examples from real life and what were the reasons (you were aware of)? Jealously? Competition?

Ultimately, is it true, your biggest career opportunities came from complete strangers and your closest network wasn't involved to find them?
81/100 100daysofcode Flutter
Tags: 100daysofcode
Published: 2020-05-28 22:56:09

day 81/100 of #100daysofcode #Flutter
Learning Flutter , courses Udemy from
@maxedapps

Today implements modalroute,setings ( navigator with arguments) , implements provider, fetch data, and some ui, preprare for next section " firebase'
https://github.com/triyono777/100-days-of-code/blob/master/log.md
My Vue Talk at Mississauga .NET User Group
Tags: speaking, vue, webdev
Published: 2020-06-13 10:08:38

---
title: My Vue Talk at Mississauga .NET User Group
published: true
date: 2020-05-28 22:34:32 UTC
tags: Speaking,Vuejs,WebDevelopment
canonical_url: http://wildermuth.com/2020/05/28/My-Vue-Talk-at-Mississauga-NET-User-Group
---

![Mississauga User Group](https://wilderminds.blob.core.windows.net/img/mississauga.jpg) I recently offered my speaking skills on Twitter since I'm stuck at the house. My wife really wants me out of the house, but luckily I like the sound of my own voice enough that virtual talks fill that same void.

Since I'm doing these talks on Zoom, I'll be uploading the talks to YouTube to share them with as large of an audience as possible. This is the first of them.

The talk today was about Vue.js and how to use it with and without the Vue CLI. As promised here are links from the talk:

> [Slides](https://www.slideshare.net/shawnwildermuth/getting-started-with-vue-234707792)

> [Code](https://github.com/shawnwildermuth/PresentationDemos/tree/master/MississaugaDNUG/2020)

> [CoreCodeCamp (an example of Vue multi-app)](https://github.com/shawnwildermuth/corecodecamp)

Here's the video:

<iframe src="https://www.youtube.com/embed/qagslNUiuao" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>

[![Creative Commons License](http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png)](http://creativecommons.org/licenses/by-nc-nd/3.0/)

          This work by [Shawn Wildermuth](http://wildermuth.com) is licensed under a [Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License](http://creativecommons.org/licenses/by-nc-nd/3.0/).  
          Based on a work at [wildermuth.com](http://wildermuth.com).

* * *

If you liked this article, see Shawn's courses on [Pluralsight](http://shawnw.me/pscourses).
 ![](http://feeds.feedburner.com/~r/ShawnWildermuth/~4/nI2EXsqdf3w)
I Think I Overestimated How Hard C++ is.
Tags: cpp, codenewbie, discuss
Published: 2020-05-28 22:29:53

#It's like I'm a Noob Again
I'm new to C++. I've been avoiding it for a while, I even learned other languages to get my mind off it. It bugged me that I thought I couldn't learn it. I tried hard with C and failed. I wasn't used to how not readable it was. It was very difficult to read unlike, ruby, python, and js. I couldn't understand writing everything in the main() function to execute the code. I felt kind of stupid, and I didn't like that so I didn't try again.
 
#A Little While After...
I was kind of forced to spend more time coding now that we're quarantined. So, I decided to try being a noob again. I realised that if others could do it I probably could too. So today is officially day one. I tried not to think about how it wasn't going to be readable and tried C++ instead. 
#Turns Out... It's Not As Hard As I thought
C++, IMHO, is **WAY** more readable than C. It's still less readable than python, but it's manageable for me. Not only that, but like a million other things became super easy. Like looping on a condition, I can just use a label and call the goto statement. If I'd known that this is what I'd be doing I would've tried C++ a long time ago.

Did anybody make the same mistake I did? Do you have any advice concerning learning C++?, 'cause I'd love to hear it. Please write about it in the comments.
VirtualBox 6.1.x Windows 10 2004 Upgrade Problem Resolution
Tags: howto, windows10, virtualbox
Published: 2020-05-28 22:08:13

---
title: VirtualBox 6.1.x Windows 10 2004 Upgrade Problem Resolution
published: true
description: 
tags: #howto,#windows10,#virtualbox
---

Original post: [Virtualbox 6.1.x Windows-10 2004 Upgrade Problem Resolution](https://bobonmedicaldevicesoftware.com/blog/2020/05/28/virtualbox-6-1-x-windows-10-2004-upgrade-problem-resolution/)

This is just a quick note that will hopefully save someone time.

When I upgraded Windows 10 (64-bit) from 1909 to 2004 I found that Virtualbox 6.1.x no longer worked properly. All of my guest instances (Ubuntu, Mint, etc.) failed to start. Specifically, they just *hung with a blinking cursor* and there were no errors in the logs.

There were no reports on this problem on the [VirtualBox on Windows Hosts](https://forums.virtualbox.org/viewforum.php?f=6) forum.

It turns out that when Windows 10 2004 is installed it enables the **Windows Hypervisor Platform** feature. 

To check this setting run *OptionalFeatures.exe* from a Windows command shell. You'll see this:

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

The resolution to the hang problem is to disable this feature. Doing this is simple:

1. **Uncheck** the Windows Hypervisor Platform checkbox (above).
2. **Reboot**. Even though it's not indicated when you do step #1, a reboot is required to disable the feature.

That's it!
Day 142: Mad World
Tags: hiphop, code, coding, lifelongdev
Published: 2020-05-28 22:06:37

_liner notes_:
- Professional : Sat in on a presentation practice session. Really good info. Got to give some feedback. Had our team meeting. Good to see everyone. In the afternoon, had a chat with a coworker. Went through, researched and wrote an outline for a workshop I'll be giving. Going to have it checked out to make sure it meets all the goals. Also did some more research on open-wc.

- Personal : Last night, really didn't feel like coding. Just seemed like a mad, mad world.

![Green cliffs of County Clare, Ireland overlooking the ocean](https://dev-to-uploads.s3.amazonaws.com/i/gys5kzhveh65c9r3fl1j.png)

Might do some coding and listen to tracks for this week's radio show. Pretty much it.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube VCjT4SLDmt0 %}
First Test Post
Published: 2020-05-28 21:52:28

First Test Post
================
Dennis Wollersheim
29.05.2020

# test

``` r
remotes::install_github("DaveParr/dev.to.ol")
```

    ## Using github PAT from envvar GITHUB_PAT

    ## Skipping install of 'dev.to.ol' from a github remote, the SHA1 (58625095) has not changed since last install.
    ##   Use `force = TRUE` to force installation
Are people ready for PWA?
Tags: discuss, pwa
Published: 2020-05-28 21:13:31

Hi!

Do you think people are ready to use a product that is only accessible with a PWA?

People are now trained to search on stores and install the app even when there is a website, only the app is the real product.

In other words, do you think a product can be profitable with a Progressive Web App only? Or definitely needs a native or desktop apps...
Gitlab CI/CD
Tags: devops, gitlab, docker
Published: 2020-05-28 21:08:10

```yaml

variables:
      MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
      MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
      DOCKER_DRIVER: overlay2
      #IMAGE_PATH: $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME
      IMAGE_PATH_GITLAB: $CI_REGISTRY_IMAGE
      IMAGE_PATH_DKHUB: $DKHUB_REGISTRY/$DKHUB_REGISTRY_USER/$CI_PROJECT_NAME
      CI_BUILD_NAME: $CI_PROJECT_NAME

cache:
      key: mavenrepo
      paths:
      - ./.m2/repository

image: docker:19.03.1

services:
- docker:19.03.1-dind

stages:
      - build
      - deploy
      - push

mvn_build:
      image: maven:3.3.9-jdk-8
      stage: build
      only:
            - master
      script:
            - "mvn $MAVEN_CLI_OPTS clean install -Dmaven.test.skip=true -s ci_settings.xml"
      artifacts:
            paths:
            - target/$CI_BUILD_NAME*-exec.jar

mvn_deploy:
      image: maven:3.3.9-jdk-8
      stage: deploy
      only:
      - master
      before_script:
            - echo "Project-> [$CI_PROJECT_NAME]"
            - echo "IMAGE_PATH  = $IMAGE_PATH"
      script:
            - 'mvn $MAVEN_CLI_OPTS deploy -Dmaven.test.skip=true -s ci_settings.xml'
      when: on_success

.push_img_gitlab:
      stage: push
      only:
           - master
      before_script:
            - docker version
            - echo "IMAGE_PATH_GITLAB = $IMAGE_PATH_GITLAB"
            - docker login $IMAGE_PATH_GITLAB -u $GITLAB_REGISTRY_USER -p $GITLAB_REGISTRY_PAT
      script:
            - docker pull $IMAGE_PATH_GITLAB || true
            - docker build --tag $IMAGE_PATH_GITLAB:$CI_COMMIT_SHORT_SHA .
            - docker push $IMAGE_PATH_GITLAB:$CI_COMMIT_SHORT_SHA
      when: on_success

push_img_dockerhub:
      stage: push
      only:
            - master
      before_script:
            - docker version
            - echo "IMAGE_PATH_DKHUB = $IMAGE_PATH_DKHUB"
            - docker login -u $DKHUB_REGISTRY_USER -p $DKHUB_REGISTRY_PAT $DKHUB_REGISTRY
      script:
            - docker build --pull -t $IMAGE_PATH_DKHUB .
            - docker push $IMAGE_PATH_DKHUB
      when: on_success

```
100 Days of SwiftUI — Day 8
Tags: 100daysofswiftui
Published: 2020-05-29 20:10:12

---
title: 100 Days of SwiftUI — Day 8
published: true
date: 2020-05-28 20:51:03 UTC
tags: 100daysofswiftui
canonical_url: https://zeitschlag.net/100-days-of-swiftui-day-8/
---

[Today](https://www.hackingwithswift.com/100/swiftui/8) was about structs and I enjoyed it. I learned (again), what methods with the `mutating` keyword do: they mutate the properties of a struct, simple as that.

Truth is: I haven't used structs that often, most of the time, I'm still a fan of classes. But in SwiftUI, the seem to be _the_ thing, so I'm glad, that Paul explained them so well.

I'm looking forward to tomorrow (again).

<!--kg-card-end: markdown-->
Automating boilerplate code - How do you do it?
Tags: discuss, watercooler, strategy
Published: 2020-05-28 20:43:09

---
title: Automating boilerplate code - How do you do it?
published: true
description: Everyone approaches projects differently, from templates to scripts, how do you automate your boilerplate? 
tags: discuss, watercooler, strategy
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/s8entlzpnmivlmdy9zto.jpg
---

Everyone approaches projects differently, from templates to scripts, how do you automate your boilerplate?
How do YOU keep track of weekly 1:1s?
Tags: discuss, management, leadership, productivity
Published: 2020-05-28 20:41:09

I've been utilizing Confluence to keep track of weekly 1:1s with my team for a bit now and honestly neither party finds it intuitive to work with in the slightest.

Curious what methods, tools, techniques, software etc is out there that others are using to keep track of weekly 1:1s.
Generating Synthetic Patient Data
Tags: healthcare, datascience, commandline, terminal
Published: 2020-05-31 20:22:30

---
title: Generating Synthetic Patient Data
published: true
date: 2020-05-28 20:30:56 UTC
tags: healthcare,data-science,command-line,terminal
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/2600/1*1pP1pLzS-rC3AqiAv4mH7A.jpeg)](https://towardsdatascience.com/generating-synthetic-patient-data-b7901c3bd397?source=rss-fc0227505fc6------2)

A quick look at using Synthea

[Continue reading on Towards Data Science »](https://towardsdatascience.com/generating-synthetic-patient-data-b7901c3bd397?source=rss-fc0227505fc6------2)