teleren/devto huggingface dataset:
JavaScript scope
Published: 2020-09-04 15:34:59

The scope is at the base closure. Scope manages the availability and lifetime of the variables and parameters and defines the idea of a global and local variable. In other words, the scope is an encapsulation mechanism for code blocks, functions, and modules. ES6 and CommonJS modules also create a scope, unless the variable is explicitly exported from these modules. Scopes can be nested, and we can use the terms "outer" and "inner" scope for nesting. The inner scope can access the variable of its outer scope. The variables declared inside the global scope are called "global variables" and can be accessed from any scope. Browser supplies `window` and `document` global variables. Code block does not create scope for `var` variables; only the function body does.

Static scoping (lexical scoping) - means that the "inner" scope can access the variable of its outer scope. The variables' accessibility is determined statically by the variables' position within the nested function scope and consists of outer scopes.

Closures are an essential service to the programmer because they can reduce naming collisions and provides automatic memory management.
Some programming languages with C syntax have block scope (a list of statements wrapped with curly braces), so variables defined in a block are not accessible from the outside. JavaScript has a block syntax, but it does not have block scope. JavaScript does have function scope, which means that the variables and parameters defined in a function are not accessible outside of the function, and a variable defined within a function is accessible everywhere within that function. The variables defined in a function can be released when the function execution is finished.
Learn to develop Apps on Nocode.
Tags: node, womenintech
Published: 2020-09-04 15:34:13

I am a chemical engineer myself, who learnt to build apps without writing a single line of Code since I lacked the coding knowledge. 
Learn to build an app in under a day without writing a single line of code. It's hands down faster than native development.
You can check it out at- https://no-script.in/
kotlin learning notes Ⅱ—— class and object
Tags: kotlin
Published: 2020-09-04 15:32:23

#class
Classes in Kotlin are declared using the keyword class:
```
class Runoob {  // class name is Runoob
    // .......
}
```
We can use constructors to create class instances just like normal functions
```
val site = Runoob() // in Kotlin ,there don't have new keyword
```
# getter & setter
The following example defines a person class with two variable variables lastName and no. lastName modifies the getter method and no modifies the setter method：
```
class Person {

    var lastName: String = "zhang"
        get() = field.toUpperCase()   // Convert variable to uppercase
        set

    var no: Int = 100
        get() = field                
        set(value) {
            if (value < 10) {      
                field = value
            } else {
                field = -1       
            }
        }

    var heiht: Float = 145.4f
        private set
}

// test
fun main(args: Array<String>) {
    var person: Person = Person()

    person.lastName = "wang"

    println("lastName:${person.lastName}")  // output:lastName: Wang

    person.no = 9
    println("no:${person.no}") // output:no: 9

    person.no = 20
    println("no:${person.no}") // // output:no: -1

}
```
#abstract class
Abstract members have no implementation in the class.
Note: there is no need to annotate an abstract class or member with an open annotation.
```
open class Base {
    open fun f() {}
}

abstract class Derived : Base() {
    override abstract fun f()
}
```
#inner class
Inner classes are represented by the inner keyword.
The inner class will have a reference to the object of the outer class, so the inner class can access the external class member properties and member functions
```
class Outer {
    private val bar: Int = 1
    var v = "member property"
    /**inner class**/
    inner class Inner {
        fun foo() = bar  // outer class number
        fun innerTest() {
            var o = this@Outer 
            println("inner class can use outer class number,eg:" + o.v)
        }
    }
}

fun main(args: Array<String>) {
    val demo = Outer().Inner().foo()
    println(demo) //   1
    val demo2 = Outer().Inner().innerTest()   
    println(demo2)   //inner class can use outer class number,eg:member property
}
```
Community Hangout and Update - 2020-09-06
Tags: phalcon, phalcon4, phalcon5, hangout
Published: 2020-09-04 16:00:11

---
title: Community Hangout and Update - 2020-09-06
published: true
date: 2020-09-04 15:31:35 UTC
tags: phalcon,phalcon4,phalcon5,hangout
canonical_url: 
---

Join us this Sunday 6th September at 10:00 EST (14:00 UTC) for a community hangout and update.

### New Blood

- [Riu](https://github.com/riu)
- [Tacxticx88](https://github.com/tacxticx88)

### v4

- What happens with v4
- Keep 4.0.x branch for bug fixes
- 4.1.x branch with limited functionality added (no more NFRs)
- Label issues to be fixed

### v5

- phalcon/phalcon
- Investigate Symfony/Yii/Laravel, investigate organization (repo) options for v5. Modules, sub-repositories etc.
- Introduce benchmarks for every commit/release
- How do we track things    
  - New project for v5
  - Labels, issues etc.
- Additional repos    
  - Incubator
  - Devtools
  - Migrations
- Find what will happen with Volt, PHQL Annotations compilers

[https://youtu.be/0LtGupXPv7Y](https://youtu.be/0LtGupXPv7Y)

Looking forward to seeing everyone there!

* * *

Chat - Q&A

- [Discord Chat](https://phalcon.io/discord)
- [Forum](https://phalcon.link/forum)

Support

- [OpenCollective - Support Us](https://phalcon.io/fund)
- [Store - Merchandise](https://phalcon.io/store)

Social Media

- [Telegram](https://phalcon.io/telegram)
- [Gab](https://phalcon.io/gab)
- [MeWe](https://phalcon.io/mewe)
- [Parler](https://phalcon.io/parler)
- [Reddit](https://phalcon.io/reddit)
- [Facebook](https://phalcon.io/fb)
- [Twitter](https://phalcon.io/t)

Videos

- [BitChute](https://phalcon.io/bitchute)
- [Brighteon](https://phalcon.io/brighteon)
- [LBRY](https://phalcon.io/lbry)
- [YouTube](https://phalcon.io/youtube)

<3 Phalcon Team
JavaScript closures
Tags: javascript, typescript
Published: 2020-09-04 15:19:03

The closure is a function that remembers the variables from the place where it was defined, regardless of where it will be executed later. In other words, a closure is a function bundled with its lexical scope. Callbacks, event handlers, higher-order functions can access variables from the outer scope thanks to that. The closure is created at runtime during the function creation, and the JavaScript engine needs to keep the variable from the outer function available until the inner function has been called. In some cases, closures can be referred as a "nested functions" or "ghost"/"memory" of the past function calls.

Function from the inner scope has access to variables defined in the outer scope because of the lexical (static) scoping. Even function executed outside of its lexical scope can access the variables defined in its lexical scope.

How can you identify a closure? If a function uses a variable that is not defined inside the function scope, it is probably a closure.
Blame alert: Tags users whose code has been altered
Tags: actionshackathon, git, github, javascript
Published: 2020-09-04 15:09:10

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon, please fill out all sections.)


### My Workflow
GitHub action which tags users whose code has been altered in a PR. It uses `git blame` to determine who is the author of the code which has changed.

This alerts the specific collaborator responsible of creating the code in the first place and makes him/her pay extra attention. 

### Submission Category: 

Maintainer Must-Haves

### Yaml File or Link to Code

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)

```yml
name: CI
on:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.base_ref }}
          fetch-depth: 0
      - name: Blame Alert
        uses: molleer/blame-alert@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
{% github molleer/blame-alert %}

### Additional Resources / Info
[@actions/checkout@v2](https://github.com/actions/checkout)
Gatsby commenting system in Node
Tags: gatsby, node, howto, commenting
Published: 2020-09-04 15:05:35

---
title: Gatsby commenting system in Node
published: true
description: How to add a simple commenting system to your Gatsby blog
tags: Gatsby, Node, Howto, Commenting
---

I wrote a how to on this topic in my blog. Using an open source library written in Node you can add a drop in commenting system to your Gatsby blog.

It’s one step before completely rolling your own. But you still get to own your own comments. 

Hoping it can be helpful to others. Blog post is [here](https://seifi.org/gatsby/add-comments-to-your-gatsby-blog-using-schnack.html)
kotlin learning notes Ⅰ—— basic grammer
Tags: kotlin, android
Published: 2020-09-04 15:04:12

#Defining constants and variables
We use var keyword as modifier to modify a variable, and use val keyword modifier to modify a non variable. it needs to be noted here that val is defined as a non variable rather than a constant. There is a difference between the two. You can compare the variables modified by val to the final in Java, which will be better understood.
```
var age: Int = 10
val greet String = "Hello world"
```
Both constants and variables can have no initialization value, but they must be initialized before they are referenced
The compiler supports automatic type determination, that is, the compiler can determine the type without specifying the type.
It should be noted here that kotlin is very intelligent. If your variable type can be inferred by the program, it doesn't matter if you don't write the variable type. For example, the number above is assigned to 10. Since this 10 can be inferred to be an int type, and "Hello world" can also be inferred to be a string type, the two can be written as follows:
```
var age = 10
val greet = "Hello world"
```
#Null checking mechanism
In kotlin, there is a concept of null security. As long as the variable is decorated with a question mark "?", then the variable is declared as a variable that can be null. If it is not decorated with? The program will default to be null. Once it is null, the editor will report an error before it is compiled and run, resulting in the failure of compilation, and it will not be found until the program runs down.
```
// with? Indicates that it can be null
var age: String? = "23" 
//Throw NullPointerException
val ages = age!!.toInt()
//return null without processing
val ages1 = age?.toInt()
//if age is null, return -1
val ages2 = age?.toInt() ?: -1
```
*note:
!! Indicates that the object is executed without being null*
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/x7vcycmtul5gxrio5fya.png)
#function
It's very simple to declare a function. You just need to use fun keyword to decorate it, followed by the name of the function, and the parameters of the function are in brackets. Note here that the writing of the parameters is the same as that of the previously declared variables.
```
fun greeting(str:greet):String{
    return greet;
}
```
#String template $
$ represents a variable name or value
$varname represents the value of the variable
${varName.fun ()} represents the method return value of the variable:
```
var a = 1
val s1 = "a is $a" 

a = 2
val s2 = "${s1.replace("is", "was")}, but now is $a"
```
# range expression
The range expression is formed by the rangeTo function with the operator form.. supplemented by in and !In.
Here are some examples of using range expression:
```
for (i in 1..4) print(i) // “1234”
for (i in 4..1) print(i) // nothing output

if (i in 1..10) { // equate to 1 <= i && i <= 10
    println(i)
}

// Use step to specify the step size
for (i in 1..4 step 2) print(i) // “13”

for (i in 4 downTo 1 step 2) print(i) // “42”

//Use the until to exclude the end element
for (i in 1 until 10) {   // i in [1, 10) exclude 10
     println(i)
}
```
Is it OK to use the same recording for multiple conference talks?
Tags: devrel
Published: 2020-09-04 14:57:51

In DevRel it's generally accepted that you write a talk and deliver it at multiple conferences. In-person, you still get a unique delivery each time. No harm, no foul. 

Now in the 🦠 era of pre-recorded talks, is *re-recording* the same talk each time expected or appropriate?

My instinct is that re-recording is redundant, but at the same time, it feels a little bit like 'cheating' to send the same recording done for one conf over to another.

Since all confs usually put recordings online, then attendee at conference Y could already have chosen to view my same talk from conf X anyway, so does it make a difference if they see it in advance on youtube or 'live' on conf Y's platform?

Doing live Q&A for each conf is obviously where the value lies for attendees, since they still get the interaction with the speaker that way, and I'd never propose to skip that bit (heck, it's the closest we manage to human interaction without getting on ✈️)

Just a Friday afternoon's random & rambling thoughts. Comments welcome :-)
Top 5 React State Management Libraries
Tags: react, javascript, redux, webdev
Published: 2020-09-04 14:39:52

# 1) Redux

Redux is a predictable state container for JavaScript apps. As the application grows, it becomes difficult to keep it organized and maintain data flow. Redux solves this problem by managing application’s state with a single global object called Store. Redux fundamental principles help in maintaining consistency throughout your application, which makes debugging and testing easier.

# 2) Mobx 

MobX is a simple, scalable and battle tested state management solution. MobX is a standalone library, but most people are using it with React.
State is the heart of each application and there is no quicker way to create buggy, unmanageable applications than by producing an inconsistent state or state that is out-of-sync with local variables that linger around. Hence many state management solutions try to restrict the ways in which you can modify state, for example by making state immutable. But this introduces new problems; data needs to be normalized, referential integrity can no longer be guaranteed and it becomes next to impossible to use powerful concepts like prototypes.

MobX makes state management simple again by addressing the root issue: it makes it impossible to produce an inconsistent state. The strategy to achieve that is simple: Make sure that everything that can be derived from the application state, will be derived. Automatically

# 3) Flux

Flux is the application architecture that Facebook uses for building client-side web applications. It complements React's composable view components by utilizing a unidirectional data flow. It's more of a pattern rather than a formal framework, and you can start using Flux immediately without a lot of new code

# 4) RxJS

RxJS is a library for composing asynchronous and event-based programs by using observable sequences. It provides one core type, the Observable, satellite types (Observer, Schedulers, Subjects) and operators inspired by Array#extras (map, filter, reduce, every, etc) to allow handling asynchronous events as collections.

# 5) React Recoil

Recoil is using what is called Atoms to manage the state of each component. They are extremely easy to created and even easier to use as they are using the exact same API than useState. Also, Atoms can be created very easily as they can be identified by ids. Then, easy for you to manage the stage of each component by just adding a dynamic value to the key of each Atom
What would you add to Markdown? 🤔
Tags: discuss, markdown
Published: 2020-09-04 02:06:09

# Markdown 🔥

The language we use most likely at least of ones per day. If your job includes GitHub, then it's most likely more. Its what drives our README's, issues, pull requests, its the goto for creating posts here on Dev too.

While there has been some extended syntax to it since John Gruber created it. For instance CommonMark, GFM, and more, even Dev has an added extension with the Liquid tags.

If you had the change to add a new syntax that would be used on your favorite sites, what would you add? I would like to have an aligning extension that lets us align text, images, and more much more than adding.

```html
<p align="center"></p>
```

Which isn't supported on all platforms. Since most remove HTML tags server-side when the content has uploaded. which to be fair is something they should never trust user-uploaded content. 👍

So, what would you add to Markdown?
Comment down below with your extension and start the discussion. 🙂




[john gruber]: https://daringfireball.net/projects/markdown/
[commonmark]: https://commonmark.org/
[gfm]: https://github.github.com/gfm/
Ecommerce Development Trends In 2020 That You Must Know
Tags: ecommerce, apps
Published: 2020-09-04 14:33:02

Ecommerce has changed the way of shopping that we were following for many years. 2019 was a great year for the ecommerce industry. The overall income of ecommerce amounted to more than 3.53 trillion USD by the end of 2023. These numbers shows the growth of global ecommerce. Hence if you’re thinking of growing an ecommerce business, you must know the latest trends in the ecommerce industry. Here we will see the best ecommerce trends in 2020.

#Ecommerce Trends In 2020-
*1. Re-commerce-*
Recommerce is also known as Reverse Commerce and has proved that trendsetter by taking the concept of sustainability to a higher level. According to the data collected, it will explode in the years to come.

A number of factors play into this growing trend, includes:

An increased focus on sustainability
The ability to attain sought-after products for less money
The need to keep ahead of trends in fashion and other industries
Re-commerce promoted a thrift culture in the apparel industry with an estimated market size of 51 billion dollars by 2023. As we are in the mid of 2020, it’s clear that the market for used goods is still alive and well. From special sites like Poshmark to general platforms like Facebook Marketplace, the need for re-commerce goods is spread far and wide.

*2. Contextual and Programmatic Advertising-*
Context and programmatic advertisements will see an ascent this year. Social media sites are already playing a big role in ecommerce advertisements. Programmatic advertising uses datasets to choose the target audience. These ads are shown to the audience based on the previous shopping. They are then retargeted after a timeframe to create higher ROI. Simply, it binds the perfect audience to the perfect ad at the perfect moment. As compared to the basic retargeting efforts, ecommerce store owners can effectively reach to the audience by the use of programmatic advertising. In videos, AI powered context advertisements effectively mix with the content and these are the most recent ecommerce trends. Facebook allows you to choose the audience category. You can target them with appropriate ads.

Know more at- [https://solaceinfotech.com/blog/ecommerce-development-trends-in-2020-that-you-must-know/]
354 hits at @jsDelivr
Tags: webdev, javascript, npm, devops
Published: 2020-09-04 14:18:36

fullview.js had 354 hits at @jsDelivr CDN in the last month: 
https://www.jsdelivr.com/package/npm/fullview/ 

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

https://github.com/seeratawan01/fullview.js
What kind of typesetting system do you want?
Tags: tex, latex, kinx, ruby
Published: 2020-09-04 14:14:24

Hello everybody!

This time, a typesetting system is a main topic. Are you using TeX, or LaTeX? It is very famous and good solution.

And also this article is related to our Kinx.

* Reference
    * First motivation ... [The post of introduction](https://dev.to/krayg/kinx-as-a-script-language-4iko)
        * Kinx, I wanted a scripting language with a syntax of C family.
    * Repository ... https://github.com/Kray-G/kinx
        * I am waiting for pull requests.

# Introduction

Please look at this pdf file.

https://github.com/Kray-G/kinx/blob/master/examples/typesetting/typesetting.pdf

This was generated by Kinx Typesetting library. This library is not completed yet, and it is still on a very very
early stage. But I have felt I would like to introduce this small system's output.

LaTeX is never used for this output! I never even installed it, but I did use KaTeX though.

The LaTeX system is quite huge, so I don't think it is easy for your personal use even if it is a great system.

I will try to improve the Kinx library for a small usecase and a personal use. Especially for the people who feel LaTeX is too huge to use it easily.

# Conclusion

This is just introducing the system.
This system is still on a baby stage, but if you have some interest in the system, please push a star of the project.

See you!
Shortcut to convert a number from decimal to binary
Tags: javascript, webdev, beginners, codenewbie
Published: 2020-09-04 14:07:41

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

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

Micro-Learning ● Web Development ● Javascript ● MERN stack  
**[codedrops.tech](https://www.codedrops.tech/)**
What are the Javascript Trends for The Next Decade?
Tags: javascript, discuss, watercooler
Published: 2020-09-04 13:54:05

I just stumbled upon npmtrends.com, the website that records the download count of npm packages and serves it with a line chart. Then, I compare the big three JS frameworks (React, Vue, Angular) and found out that React popularity was increasing very fast in the last 3 years.

You can see the details in the image below.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/26ow84a4thrw2wh8kemq.jpg)

or go to the source: https://www.npmtrends.com/react-vs-vue-vs-@angular/core.

Now, I wonder what are the javascript trends for the next decade? 

Will React still dominate the web-application stack? 

Will other JS frameworks can compete with React?

Share your opinion below!