teleren/devto huggingface dataset:
LEVEL UP with JavaScript! LVL 5
Tags: javascript, webdev, tutorial, beginners
Published: 2021-09-04 17:54:57

### In this blog series tutorial, I will be covering some of the basic JavaScript programming concepts.

This is geared toward beginners and anyone looking to refresh their knowledge.

### See the [<strong>Previous Level Here</strong>](https://dev.to/devcronin/level-up-with-javascript-lvl-4-3k4m)

Level 5 will cover: 

* Concatenating Strings with Plus Equals Operator
* Constructing Strings with Variables
* Appending Variables to Strings
* Find the Length of a String
* Use Bracket Notation to Find the First Character in a String


## Concatenating Strings with Plus Equals Operator

As we did with the compounded assignment (+=) operator before, now we will use it to concatenate a string on an existing variable. 

Remember, spaces only exist if we add them.


```JavaScript
let iroh = "dragon, "; 

iroh += "of the west."; 

console.log(iroh);

"dragon, of the west"

```

## Constructing Strings with Variables

In JavaScript, it is common to build longer, more complex strings. 

To do this we will be using the concatenation operator (+) to insert one or more variables to construct the string.

```JavaScript
let mySpell = "magic missile"; 

let spellDescription = "I cast " + mySpell + ", and three glowing darts home in on my target."; 

console.log(spellDescription)

"I cast magic missile, and three glowing darts home in on my target."

```

## Appending Variables to Strings

Variables can also be appended to strings using the (+=) operator.


```JavaScript

let alignment = "Chaotic "; 

let alignmentTwo = "Good";

alignment += alignmentTwo; 

console.log(alignment);

Chaotic Good

```

## Find the Length of a String

To find the length of a string we use ".length" after the string but before the end (;). 

Length is given in the number of characters start with the index of zero.

It can also be used on string variables or string literals.


```JavaScript

let game = "Dungeons and Dragons";

let gameLength = game.length; 

console.log(gameLength);

20

```

## Use Bracket Notation to Find the First Character in a String

In JavaScript counting starts at 0, and is referred to as Zero-based indexing. 

By using bracket notation ([]) we can get any character at a specific index in a string.

```JavaScript
let character = "Wizard"; 

let firstLetter = character[0];

console.log(firstLetter);

"W"

```



### Thank you for reading my blog! This is the Fifth of my series on JavaScript so if you would like to read more, please follow!


### See the [<strong>Next Level Here</strong>](https://dev.to/devcronin/level-up-with-javascript-lvl-6-3cd2-temp-slug-8704470)


## [<strong>Support and Buy me a Coffee</strong>](https://www.buymeacoffee.com/ZachCronin)
Inventory of Developer Discord Sidebars
Published: 2021-09-04 17:51:13

I've been doing some research on developer-centric Discord server setups. I had grabbed a snapshot of several servers I'm currently in, so I compiled them into a single image here in case it's useful to others.

By no means exhaustive, scientific, or in any particular order:

![developer discord sidebars](https://user-images.githubusercontent.com/15697/132104024-bc89f7a9-f142-4437-bf5e-7cc0542c54a5.png)

[full res](https://user-images.githubusercontent.com/15697/132104024-bc89f7a9-f142-4437-bf5e-7cc0542c54a5.png)
Instagram bot using python
Tags: python, programming, algorithms, actionshackathon
Published: 2021-09-04 17:38:09

Ever worried😟 about not getting more likes👍 or followers🥰 for your Instagram page. Forget about it. In this python project, we will work on an Instagram automation module, which will boost the followers and likes for your Instagram page or post.

You can give your criteria such as what comments to leave, whom to follow, types of posts to like, etc. This automation automatically opens the browser, logs in, and starts doing the tasks as you instructed.

It also tracks and saves the list of users that were followed which will be useful for you to evaluate later and unfollow them after some time.

The advantage of such automation is, it logs every action performed by itself. It mentions the post-it liked, location, commented or not, description, etc.

https://www.linkedin.com/posts/niteshtaliyan_automation-python-selenium-activity-6680706674166181888-sWP3


If you have any doubts you can DM me😊

Follow for more @niteshtaliyan 💪
website - https://www.niteshtaliyan.tech
instagram - https://www.instagram.com/nitesh_taliyan
LinkedIn - https://www.linkedin.com/in/niteshtaliyan
forEach / break / continue
Tags: javascript, looping
Published: 2021-09-04 17:34:12

Photo by <a href="https://unsplash.com/@dmey503?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Dan Meyers</a> on <a href="https://unsplash.com/s/photos/loop?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>

A short Q&A on loops of the standard and functional variety, breaking out of them, and skipping iterations.

All code below assumes the following header:

```js
const { log } = console

const oneThousandItems = () =>
  Array.from({ length: 1000 })
```

So, the question is:

> "At the end of each run, what will the value of `index` and `count` be?" 🤔

### 1. `for` vs. `forEach`, full-loops

```js
// 1a)
function forLoop() {
  let index = 0
  let count = 0
  for (; index < 1000; index += 1) {
    count = count + 1
  }
  log('index === ', index)
  log('count === ', count)
}

// 1b)
function usingForEach() {
  let index
  let count = 0
  oneThousandItems().forEach(
    (_, _index) => {
      index = _index
      count = count + 1
    }
  )
  log('index === ', index)
  log('count === ', count) 
}
```
Next up, breaking-out of loops:

### 2. `for` vs. `some` vs. `every`, broken loops

```js
// 2a)
function breakLoop() {
  let index = 0
  let count = 0
  for (; index < 1000; index += 1) {
    if (index > 499) { 
      break
    }
    count = count + 1
  }
  log('index === ', index)
  log('count === ', count)
}

// 2b)
function usingSome() {
  let index
  let count = 0
  oneThousandItems().some((_, _index) => {
    index = _index
    if (index > 499) { 
      return true
    }
    count = count + 1
  })
  log('index === ', index)
  log('count === ', count)
}

// 2c)
function usingEvery() {
  let index
  let count = 0
  oneThousandItems().every((_, _index) => {
    index = _index
    count = count + 1
    if (index < 499) { 
      return true
    }
  })
  log('index === ', index)
  log('count === ', count)
}
```
Finally, skipping to the next iteration:

### 3. `for` vs. `forEach`, skipped loops

```js
// 3a)
function continuedLoop() {
  let index = 0
  let count = 0
  for (; index < 1000; index += 1) {
    if (index > 249) continue 
    count = count + 1
  }
  log('index === ', index)
  log('count === ', count)
}

// 3b)
function usingForEach() {
  let index
  let count = 0
  oneThousandItems().forEach(
    (_, _index) => {
      index = _index
      if (index > 249) return 
      count = count + 1
    }
  )
  log('index === ', index)
  log('count === ', count)
}
```
If you need a little help, I made a corresponding [interactive version](https://zansh.in/looping.html) of the article that offers some *very* basic visuals.

I'm not sure if they help intuit what's going on, but they give the answers at least! Did they meet your expectations?
Revising ES6 & API {Day - 22}
Tags: 100daysofcode, beg
Published: 2021-09-04 17:30:17

#100daysofcode {Day - 22}

Revising ES6 & API with practice. Trying to learn ES6 deeply 😐😐
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pdjt46nc74v61seklbos.png)
#javascript #programming #webdev
Instagram automation by python
Tags: devops, python, programming
Published: 2021-09-04 17:19:34

Ever worried😟 about not getting more likes👍 or followers🥰 for your Instagram page. Forget about it. In this python project, we will work on an Instagram automation module, which will boost the followers and likes for your Instagram page or post.

You can give your criteria such as what comments to leave, whom to follow, types of posts to like, etc. This automation automatically opens the browser, logs in, and starts doing the tasks as you instructed.

It also tracks and saves the list of users that were followed which will be useful for you to evaluate later and unfollow them after some time.

The advantage of such automation is, it logs every action performed by itself. It mentions the post-it liked, location, commented or not, description, etc.

https://www.linkedin.com/posts/niteshtaliyan_automation-python-selenium-activity-6680706674166181888-sWP3

https://dw71fyauz7yz9.cloudfront.net/video-upload__a18c95bb85907dbb6f6ca98e54928e7e/thumbs-video-upload__a18c95bb85907dbb6f6ca98e54928e7e-00001.png

<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:ugcPost:6680705525824466945?compact=1" height="284" width="504" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>

If you have any doubts you can DM me😊

Follow for more @niteshtaliyan 💪
website - https://www.niteshtaliyan.tech
instagram - https://www.instagram.com/nitesh_taliyan
LinkedIn - https://www.linkedin.com/in/niteshtaliyan
Unity On M1 Mac
Tags: gamedev, unity3d, beginners
Published: 2021-09-04 16:23:37


Unity is available on MacOS, but the question still sits in the back of your mind: "how will it perform/install on an M1?".

tldr; **pretty well**, but with one hiccup along the way.

Today's post is going to be a quick fix for:
```
Install failed: Validation Failed
```
building on a few open threads on the official game forums, 
* [Install failed: Validation Failed](https://forum.unity.com/threads/install-failed-validation-failed.1147151/)
* [Share your Unity Hub 3.0 Beta Feedback Here](https://forum.unity.com/threads/share-your-unity-hub-3-0-beta-feedback-here.1130638/page-5#post-7369118)

In my experience installing this software, using administrative mode did not resolve my issue. Some quick guesses can solve our issue, after trying a few defaults:
* re-installing unity hub.
* `sudo`.
* restarting laptop.

I decided to try a manual installation of the Unity Files. **This worked**. Quickly:
* Visit [Unity Archive](https://unity3d.com/get-unity/download/archive).
* Find the **Version** you want.
* Download that Version to your computer (I would suggest creating a `/UnityEditor/` Dir in a designated workspace).
* Open **Unity Hub**.
* Go To **Installs**.
* **Top Right** Select **Locate**.
* Find the manually downloaded Version.
* Select that **Version**.
* And now you will be able to launch that Version of Unity From Unity Hub.

I expect that through feedback these issues will be fixed over time. But I know that fixing random issues can be non-fun so hopefully this helps out anyone who encounters the same or a similar problem.

Have a great day :)
Using nprogress with next-js to show page is loading
Tags: nextjs, nprogress
Published: 2021-09-04 16:16:53

---
title: Using nprogress with next-js to show page is loading
published: true
description: in this blog i will write about showing progess when moving one page to another on a next js app using nprogress
tags: #nextjs #nprogress
 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7l85r2kz4vbaalkadej9.png
---
## using next js with nprogress
![nprogress](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7l85r2kz4vbaalkadej9.png)
using next js should be one of the most awesome thing ever, i have used it and i loved it.

so nprogress had support for *next js* and other js frameworks

here is how it works.
put this in `_app.js`.

`import NProgress from 'nprogress';`
`import Router from 'next/router';`
`import 'nprogress/nprogress.css';`

`NProgress.configure({
  minimum: 0.3,
  easing: 'ease',
  speed: 800,
  showSpinner: false,
});`

`Router.events.on('routeChangeStart', () => NProgress.start());`
`Router.events.on('routeChangeComplete', () => NProgress.done());`
`Router.events.on('routeChangeError', () => NProgress.done());`
Implement pinch gesture
Tags: javascript, mobile
Published: 2021-09-04 15:59:17

To recognize the gesture, we use two events ``'touchestart'`` and ``'touchend'``.
*Start* will fire first, and we have to check exactly how many touches we need. In this case, two should be enough.
*End* will fire twice. The first will contain only one touch data. The second one will be empty.
What we do is save the coordinates of the *start* touches and compare them with the *end* ones. If the *end* touch is outside the range between the *start* touches, this means that we are zooming in, otherwise, we are zoomin out.
[Live example](https://codepen.io/alekseikorolev/full/ZEypeYw) (*use on phone*)
Benefits of Learning Java 
Tags: javacourses, javatraining, javascript
Published: 2021-09-04 15:51:38

Java's Popularity and High Salary:
One of the most widely used programming languages on the planet is Java. Java developers are in high demand due to the widespread use of the language, and they are among the highest-paid professionals in the industry.

Java is a simple language to learn:
Because it has a syntax that is comparable to English, Java is simple to learn and understand in a short period of time. You can also learn from Seven Mentor Pvt. Ltd. This course will help you how to get started with Java and become an expert with it.

Java has a large user base:
There is a significant online community of Java users, ranging from beginner to advanced to expert, who are especially helpful in the event that assistance is necessary.

Java comes with a set of powerful development tools:
In Java, there are numerous integrated development environments (IDEs) that provide programmers with various tools for software development. Eclipse, NetBeans, IntelliJ IDEA, and other powerful Java IDEs are critical to Java's success.

Debugging, syntax highlighting, code completion, language support, automated refactoring, and other features in these IDEs make developing in Java easier and faster.

Java was chosen by nearly 90% of Fortune 500 organizations to develop a large number of back-end applications for the Android operating system. It's also important in Apache Hadoop data processing, Amazon Web Services, and Windows Azure, among other things.

Java is Free: 
The fact that Java is free to download under the Oracle Binary Code License is one of the reasons it is so popular among individual programmers. This means that Java is free for development and testing environments, but a nominal price is required for commercial use.
Java is a versatile programming language:
Java is extremely adaptable, as it can be used to develop apps for the web, mobile, desktop, and other platforms. Java also includes a number of properties that make it highly versatile, such as dynamic coding, multiple security features, platform-independent characteristics, network-centric design, and so on.

If you want to learn Java from the ground up without any prior programming knowledge, then Best Java Training in Nagpur is for you. This course is designed for total beginners who want to learn how to program in the Java programming language. This course is for anyone who is interested in learning to code, regardless of whether they are in high school or in their first year of college.
Business $ Management
Published: 2021-09-04 15:50:19

*Most of the examples are found by myself*

Maintaining a Checklist

Offer services or products related to your main Product.
Like offer Vet consultation with Pet Supplies.

Never take loan on stuff that will definitely degrade in value over time.
Never pay rent instead purchase on lease if you have stable source of income and you gonna stay there.

Set a goal (Quarter or Yearly)

Benchmark Your Services
Ways to Increase your Profit :-
Increase your prices. Despite low production cost [apple](https://www.investopedia.com/financial-edge/0912/the-cost-of-making-an-iphone.aspx) keep very high prices even with no industry leading specs (hehe)

Increase the no of customers. This can be done in many ways will try to add some if I came across in future.
Digital Marketing.

Increase how often your customers make purchases. Amazon offers Subscribe & Save option which lets amazon ship those products at regular intervals automatically.

Increase the amount customers purchase. Companies not gonna offer Single one at discounted price but give 2 at price of 1. Flipkart Groceries pushes you to buy more and more with Freebies and discount.

Increase efficiency of Product and Service creation. Thats what Management is for.

>Edit 1

Leadership:-
1. Do not Give up.
2. Team is what gonna bring success to the project/ company.
3. Continuously teach and learn.
4. Steer calmly in difficult phase or failure.
5. Get manageable peeps and get rid off some others.
Standard Delegates In Kotlin
Tags: kotlin, standarddelegates
Published: 2021-09-04 15:46:47

**1. lazy property** - it used to create an object that is initialized only first access  to the property value and store value and return it. By default lazy is synchronized the value is computed only in one thread ,and value will be same in all thread 


```kotlin
/* immutable variable*/
val ourValue:String by lazy(){
    println("Hello World") 
    callAnother() /* this will run only first access*/
    "Hello what is going on "
}

 fun callAnother(){
    print("another fun ")
}
``` 


```kotlin
 fun main(args: Array<String>) {
     println(ourValue) 
     println(ourValue)
     println(ourValue)
    //  ourValue = 90 // value can't change
    
}
/* 
output 
Hello World
another fun 
Hello what is going on
Hello what is going on
Hello what is going on
*/
``` 

**2.  Observable Properties:** lambda will be triggerd every time when value of property will be changed. 


```kotlin
import kotlin.properties.Delegates
class Person{
    /* mutable variable  */
    var ourValue: String by Delegates.observable("Hello World"){ property ,oldValue,newValue ->
         print("\n prop $property ")
         print("\n oldValue $oldValue ") 
         print("\n newValue $newValue ")
    }
}
``` 

```kotlin
fun main(args: Array<String>) {
    val p = Person()
    print(p.ourValue)  // Hello World 
    p.ourValue = "change world"

}

// output
// Hello World
//  prop property ourValue (Kotlin reflection is not available)
//  oldValue Hello World
//  newValue change world
``` 
**3. vetoable** - it 's simmilar to obervable , only change is when assign the value **onChange** (callback)
 is called if return true then new value will be assigned otherwise old value.


```kotlin
class Person1{
    var ourValue by Delegates.vetoable("Hello") {
        property, oldValue, newValue -> 
        newValue.length > oldValue.length  /* condition should be true to assign new value */
    }
}
``` 

```kotlin
fun main(args: Array<String>) {
    val p1 = Person1()
    p1.ourValue = "World"  // Hello
    p1.ourValue = "Worlds"
    println(p1.ourValue) // Worlds 


}
``` 

**4. notNull -** this delegates is used to be initialized later. it's similar to **lateinit**. It can be used with primitive data type which lateinit not support 


```kotlin
var fullname: String by Delegates.notNull<String>()

fun main(args: Array<String>) {
    // can't access without initialization , gives exception 
    print(fullname) //  java.lang.IllegalStateException
    fullname = "Justin Bieber"
    print(fullname) // Justin Bieber
}
```
A simple yet handy configuration compositor and locator!
Tags: node, kubernetes, microservices, javascript
Published: 2021-09-04 15:43:24

I finally dipped my toes in opensource, with my simple unopinionated yet capable configuration utility config-discovery!

* Will not force you on any conventions such as directory and specific files.
* Uses fluent interface, no strange incantations.
* Fit for containerized deployments where configurations maybe split between ConfigMaps and Secrets.

[Github](https://github.com/SiegfredRodriguez/config-discovery)
[NPMJS](https://www.npmjs.com/package/config-discovery)

Some of its features include the ability to define a source priority for your configuration, including environment and directly from an object!

```
let Config = require('config-discovery');

....

let configuration = new Config()
    .fromFile('/configs/config.json')
    .orFile('/configuration/config.json')
    .orFile('/etc/my_configs/config.json')
    .orEnv(prototype)
    .orObj(configObject)
    .get();

```

Compose a configuration from multiple sources, including the environment!

```
let prototype = {user: 'DB_USERNAME', password: 'DB_PASSWORD'}

let configuration = new Config()
    .fromFile('/configs/config.json')
    .orFile('/configuration/config.json')
    .orFile('/etc/my_configs/config.json')
    .thenPatchWith()
    .env(prototype)
    .get();

// or from another file

let configuration = new Config()
    .fromFile('/configs/config.json')
    .orFile('/configuration/config.json')
    .orFile('/etc/my_configs/config.json')
    .thenPatchWith()
    .configFile(/etc/secrets/credentials.json)
    .get();

// or from another object

let configuration = new Config()
    .fromFile('/configs/config.json')
    .orFile('/configuration/config.json')
    .orFile('/etc/my_configs/config.json')
    .thenPatchWith()
    .object(secretsJson)
    .get();
```
Delegated properties In Kotlin
Tags: kotlin, delegation
Published: 2021-09-04 15:43:08

Delegate is just class ,that help us to seperate all logic of getter and setters so it can be reused .
 if want to use same code for more than one property ,then don't need to apply same code for every property  ex:


```kotlin
/* dont need to write this code */
class User{
    var firstName:String? =null 
        set(value){
            if(value!= null )
                field = value.trim()
        }
    
    var lastName:String? = null 
        set(value){
            if(value!= null )
                field = value.trim()
        }

}
``` 

use this code 

```kotlin
class User{
        var firstName:String? by TrimDelegate()       
        var lastName:String? by TrimDelegate() 

        // to print object 
        override fun toString():String{
            return "$firstName $lastName"  
        } 
}
``` 

create custom Delegate class and name it **TrimDelegate**

```kotlin
class TrimDelegate {
    private var trimmedString:String ? = null 

    // thisRef is calling object 
    operator fun setValue( thisRef:Any,property:KProperty<*>, value:String?){
        // (thisRef as User).firstName // to access member 
        value?.let { 
            trimmedString = it.trim()
         }   
    }
    operator fun getValue(thisRef:Any, property:KProperty<*>):String?{
        return trimmedString
    }

}
``` 


```kotlin
fun main(args: Array<String>) {

    val user1 = User()
    user1.firstName = "  justin "
    user1.lastName = " Bieber    "
    print(user1.firstName ) // justin 
    print("\n$user1")//justin Bieber

}
```