teleren/devto huggingface dataset:
Difference between var, let and const
Tags: beginners, webdev, javascript, programming
Published: 2021-04-12 18:02:57

Let’s find out what are the differences between var and let in JavaScript.

We can use var or let to declare a variable in JavaScript. Since there are few differences when using these two, we need to have an idea about the difference between using var and let.

&nbsp;
### var

'var' is used to declare a variable before ES6. Due to its loose behaviour 'let' statement was introduced in ES6 (ECMAScript 2015).

- A variable declared with the var has the global scope or function scoped (optionally, initializing it to a value).

- Can be accessed using window object.


#### example 1 - globally scoped

```js
var x = 10;

if (x === 10) {
    var x = 20;

    console.log(x);
    // expected output: 20
}

console.log(x);
// expected output: 20

```


#### example 2 - function scoped

```js
var i = 10;

function printAmount(){
    var i = 50; // function-scoped variable
    console.log(i);
    console.log('window object ---> i: ' +  window.i); // logs 10
}

console.log(i); // logs 10

printAmount(); // logs 50

```


&nbsp;
### let

'let' statement was introduced in ES6 (ECMAScript 2015).

- The scope of a variable declared using let is limited to the block in which it is declared (declares a block-scoped local variable, optionally initializing it to a value).
- Does not get added to the global window object even when it is declared outside any block.

```js
let x = 10;

if (x === 10) {
    let x = 20;

    console.log(window.x); // no global scope, but block-scoped, thus logs 'undefined'
    console.log(x);
    // expected output: 20
}

console.log(x);
// expected output: 10

```

&nbsp;
### const

Constants are block-scoped, much like variables declared using the let keyword. The value of a constant can't be changed through reassignment, and it can't be redeclared. Introduced in ES6 (ECMAScript 2015).

#### example

```js
const number = 10;

try {
  number = 75;
} catch (err) {
  console.log(err);
/*  expected output: TypeError: invalid assignment to const `number'.
    On Google Chrome: TypeError: Assignment to constant variable.
    Note - error messages will vary depending on browser. */
}

console.log(number);
// expected output: 10
```
Kotlin SpringBoot – Configure Spring Security
Tags: kotlin, springboot, springsecurity
Published: 2021-04-12 18:02:43

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-springboot-configure-spring-security

Kotlin SpringBoot – Configure Spring Security

In the tutorial, JavaSampleApproach will show you how to configure Security for Kotlin SpringBoot web application.

<!--more-->
<h2>I. Technologies</h2>
– Kotlin 1.2.20
– Apache Maven 3.5.2
– Spring Tool Suite – Version 3.9.0.RELEASE
– Spring Boot – 1.5.10.RELEASE
– Bootstrap
<h2>II. Goal</h2>
We create a Kotlin MVC Web Application as below:

<img src="https://grokonez.com/wp-content/uploads/2018/02/kotlin-spring-security-project-structure.png" alt="kotlin spring security - project structure" width="331" height="304" class="alignnone size-full wp-image-10651" />

With 5 urls:

– '/': access with everyone.

<img src="https://grokonez.com/wp-content/uploads/2018/02/kotlin-spring-security-home-page.png" alt="kotlin spring security - home page" width="411" height="169" class="alignnone size-full wp-image-10652" />

– '/user': must authenticate and be accessed with user ROLE {USER, ADMIN}

<img src="https://grokonez.com/wp-content/uploads/2018/02/kotlin-spring-security-user-page.png" alt="kotlin spring security - user page" width="395" height="180" class="alignnone size-full wp-image-10653" />

– '/admin':  accessed by user with role Admin

<img src="https://grokonez.com/wp-content/uploads/2018/02/kotlin-spring-security-admin-page.png" alt="kotlin spring security - admin page" width="410" height="177" class="alignnone size-full wp-image-10654" />

– '/login': login page

<img src="https://grokonez.com/wp-content/uploads/2018/02/kotlin-spring-security-login-page.png" alt="kotlin spring security - login page" width="598" height="303" class="alignnone size-full wp-image-10656" />

– '/403': HTTP Error 403 Forbidden

<img src="https://grokonez.com/wp-content/uploads/2018/02/kotlin-spring-security-access-denied.png" alt="kotlin spring security - access denied" width="291" height="164" class="alignnone size-full wp-image-10657" />
<h2>III. Practice</h2>
<strong>Step to do</strong>:
– Create Kotlin Spring Boot project
– Create Controller
– Create View Pages
– Configure WebSecurity

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-springboot-configure-spring-security
Animations in Swift
Tags: swift, beginners, ios, animations
Published: 2021-04-12 16:57:47

I believe that an attractive design helps users take the initial step of choosing your application from its competition. It does not really matter what your product is, there are so many frameworks/libraries that help you to create great animations these days.

Although you can always use a third party library to do all the animations in your application, having a good foundation of inbuilt libraries is always a plus so you can have the tools to customize your animations and accomplish your vision.

Swift has a powerful background setup for you to fulfill all your design dreams and it also backs it up by having the best in industry graphics support in all its devices. 

I have divided all the animations I have learnt into 2 parts:
* UIView Animations
* Core Animations

Let's morph our animation skills in Swift from Rachel to Grizzly! :sweat_smile:

![Rachel to Grizzly Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ou0z1k12eo3wpolmnv8f.jpeg)
Kotlin – Convert Object to/from JSON with Jackson 2.x
Tags: kotlin, json, jackson
Published: 2021-04-12 17:53:09

Kotlhttps://grokonez.com/kotlin/kotlin-convert-object-tofrom-json-jackson-2-x

Kotlin – Convert Object to/from JSON with Jackson 2.x

This tutorial shows you how to use Jackson 2.x to convert Kotlin object to/from JSON.

<!--more-->
<h2>I. Technology</h2>
- Java 1.8
- Kotlin 1.1.2
- Maven 3.5.1
<h2>II. Overview</h2>
<h3>1. Goal</h3>
Convert <strong>JSON string</strong>/<strong>JSON file</strong>/<strong>JSON url</strong> to <code>Person(name:String,age:Int,messages:List)</code> Kotlin Object, then convert <code>Person</code> object to <strong>JSON string</strong>/<strong>JSON file</strong>.
<h3>2. Steps to do</h3>
- add Dependency:
<pre><code class="language-html">&lt;dependency&gt;
	&lt;groupId&gt;org.jetbrains.kotlin&lt;/groupId&gt;
	&lt;artifactId&gt;kotlin-stdlib&lt;/artifactId&gt;
	&lt;version&gt;1.1.2&lt;/version&gt;
&lt;/dependency&gt;

&lt;dependency&gt;
	&lt;groupId&gt;com.fasterxml.jackson.module&lt;/groupId&gt;
	&lt;artifactId&gt;jackson-module-kotlin&lt;/artifactId&gt;
	&lt;version&gt;2.8.8&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
- import <code>com.fasterxml.jackson.module.kotlin.*</code>
- use ObjectMapper instance:

More at:

https://grokonez.com/kotlin/kotlin-convert-object-tofrom-json-jackson-2-xin – Convert Object to/from JSON with Jackson 2.x
DAZN platform down on sunday
Tags: dazn, bugs, ux
Published: 2021-04-12 17:50:04

Last Sunday, DAZN (one of the most known streaming platforms in Europe) crashed and subscribers were unable to regularly watch the portal’s flagship product: FOOTBALL.

The result was an apology post published on the DAZN facebook page (you can see it below) in which a supplier was blamed, and customers left with no alternatives, so they have bombarded the company with refund requests.

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

The post says:

> We are very sorry about what is happening today on the DAZN platform. The problem is caused by the failure of the authentication service provided by one of our external partners which was not able to quickly resolve by applying the necessary backup procedures, despite having received timely information and immediate collaboration from DAZN.

😱

I also did not appreciate the communication from DAZN which caused thousands of comments by their customers asking for refunds. How to say … Are you putting your hands on? Ok, I ask you for a refund!

**Continue to the original article: [https://inspector.dev/dazn-platform-down-on-sunday/](https://inspector.dev/dazn-platform-down-on-sunday/)**
iText PDF + Kotlin SpringBoot RestAPI + MySQL
Tags: itext, pdf, kotlin, mysql
Published: 2021-04-12 17:46:01

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/itext-pdf-kotlin-springboot-restapi-mysql

iText PDF + Kotlin SpringBoot RestAPI + MySQL

In the tutorial, we show you how to create a Kotlin SpringBoot RestAPIs application that uses Spring JPA & iText PDF library to extract data from MySQL records to a PDF file in table format.

Related posts:
- <a href="https://grokonez.com/java-integration/use-spring-jpa-mysql-spring-boot">How to use Spring JPA MySQL | Spring Boot</a>

<!--more-->
<h2>Technologies</h2>
- Kotlin
– SpringBoot
– iText 5.0.6
– MySQL
<h2>Practice</h2>
Project Structure ->

<img src="https://grokonez.com/wp-content/uploads/2018/10/kotlin-springboot-restapi-download-pdf-file-spring-jpa-mysql-itextpdf-project-structure.png" alt="kotlin-springboot-restapi-download-pdf-file-spring-jpa-mysql-itextpdf-project-structure" width="313" height="470" class="alignnone size-full wp-image-15330" />
<h3>Create Kotlin SpringBoot project</h3>
Use SpringToolSuite to create a Kotlin SpringBoot project with below dependencies:

More at:
https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/itext-pdf-kotlin-springboot-restapi-mysql
Kotlin GridView example: Show List of Items on Grid | Android
Tags: kotlin, android, gridview
Published: 2021-04-12 17:36:01

https://grokonez.com/android/kotlin-gridview-example-show-list-of-items-on-grid-android

Kotlin GridView example: Show List of Items on Grid | Android

<code>GridView</code> is an Android <code>ViewGroup</code> that can show items in a 2-dimensional, scrollable grid. The grid items will be inserted to the layout using an <strong>Adapter</strong>. In this tutorial, we're gonna create an Android App that can show List of Items on a Grid using <code>GridView</code>.

More Practice: <a href="https://grokonez.com/android/kotlin-gridview-example-show-item-details-android">Kotlin GridView example: Show Item Details | Android</a>

Related Post: <a href="https://grokonez.com/android/kotlin-listview-example-android">Kotlin ListView example | Android</a>

<!--more-->
<h3>I. Technologies</h3>
- Android Studio 3
- Kotlin 1.1.51
<h3>II. Overview</h3>
<h5>1. Goal</h5>
We will build an example that uses <code>GridView</code> to show list of food items like this:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-gridview-goal.png" alt="kotlin-gridview-goal" width="287" height="522" class="alignnone size-full wp-image-9668" />
<h5>2. Project Structure</h5>
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-gridview-project-structure.png" alt="kotlin-gridview-project-structure" width="386" height="386" class="alignnone size-full wp-image-9669" />
<h3>III. Practice</h3>
<h5>1. Set up Project</h5>
- Create <strong>New Project</strong>:
<img src="https://grokonez.com/wp-content/uploads/2017/12/kotlin-gridview-create-project.png" alt="kotlin-gridview-create-project" width="273" height="402" class="alignnone size-full wp-image-9662" />

- Add each item insides <a href="https://grokonez.com/wp-content/uploads/2017/12/sample_images.zip">sample_images</a> to <strong>res</strong>/<strong>drawable</strong> folder.

More at:

https://grokonez.com/android/kotlin-gridview-example-show-list-of-items-on-grid-android
Day~5,6 & 7 of #100DaysOfCode
Published: 2021-04-12 17:27:32

Hello Everyone,
I have been sick for the last two days that's why I was not working on anything, today I am back to work. Today I have created the models in my Django project one for tags and one for notes now logged-in users can add todo and they can also create a new tag for the notes but I haven't figured out how I can link notes with tags.

![Screenshot_2021-04-12 Keep Notes 📕.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1618247680271/XjVI-pOr1.png)

![Screenshot_2021-04-12 Keep Notes 📕(1).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1618247689149/BonZRkA3G.png)

I didn't learn anything new in react today but I made a small project in react from  [this](https://youtu.be/a_7Z7C_JCyo) video, I did few practice questions of python from hackerank.
Hide useQuery
Tags: react, query, tutorial, javascript
Published: 2021-04-12 16:57:19

I always wrap [React Query](https://react-query.tanstack.com/guides/queries)'s `useQuery` hook in a custom hook and never use it directly within a component. To see why, let's have a look at an example:

```javascript
function TodoList() {
  const { data: todos = [] } = useQuery(
    ['todos'],
    () => fetchTodos()
  );

  return (
    <ul>
      {todos.map(todo => (
        <li>{todo}</li>
      )}
    </ul>
  );
}
```

The `TodoList` component is quite simple: It fetches a list of to-dos from our backend and renders them within an unordered list. By using `useQuery` directly, this component has to:

- specify a unique query key,
- be aware of the `fetchTodos()` function,
- and provide a sensible initial value `[]` while the request hasn't completed yet.

The component is intended to render a to-do list, yet it is responsible for very technical decisions like these. In contrast, let's encapsulate the use of `useQuery` in a custom hook:

```javascript
function TodoList() {
  const todos = useTodos();

  return (
    <ul>
      {todos.map(todo => (
        <li>{todo}</li>
      )}
    </ul>
  );
}

function useTodos() {
  const { data: todos = [] } = useQuery(
    ['todos'],
    () => fetchTodos()
  );
  return todos;
}
```

By introducing a custom `useTodos()` hook, we:

- provide a layer abstraction by separating what we want to do (*get a list of to-dos*) from how we do it (*by using React Query*),
- make the list of to-dos reusable throughout our application,
- make it possible to easily switch React Query for a different library later on,
- and improve the readability of our `TodoList` component.

The choice of a sensible query key, how a resource is fetched, and the configuration of `useQuery`'s options are implementation details that should always be hidden from components that only want to consume the resource managed by it.

I've used this pattern for quite a while, both in personal projects and at work. It has served me tremendously well. The pattern ties in with and is a concrete instance of [Kyle Shevlin](https://twitter.com/kyleshevlin)'s great post [useEncapsulation](https://kyleshevlin.com/use-encapsulation), which I can highly recommend for a more general view on this topic.
Whats the Difference: Monolithic vs Micro-services
Published: 2021-04-12 16:50:53

## Lets start with what Monolithic is:

The monolithic web module is a way of grouping all the services into one platform. As Thorntech.com explained it: 
"In a typical client-server architecture, a monolithic product lives on the server, where it handles HTTP requests, executes logic, and interacts with the database. It contains a single executable that performs all of the server-side functions for an application" (Mike Chan, Thorntech.com). 

What this means is that a monolithic client-server based architecture is one big block. In monolithic, everything is managed and served from the exact same place. The size and simplicity of monolithic architecture is both its best and its worst features. 

## So then what are Micro-services?

Micro-services in the whole is completely opposite. They are smaller, modulars of code that is deployed independently from the rest of the code. This allows each service to be used for one specific tasks. A great example of a service that uses this architecture is Netflix. At first, Netflix was a monolithic style of a service. But as they expended to streaming platforms, they use Micro-Services to independently get content from multiple places (Thorntech.com) 

I found this photo on the web that helps explain the difference a bit more: 

I also made a quick demonstration of how using docker in hand with micro-services to deploy a simple to-do app: 
https://www.youtube.com/watch?v=SWhbqpik1lk


Sources: 
https://www.thorntech.com/microservices-vs-monoliths-whats-right-architecture-software/#:~:text=While%20a%20monolith%20is%20a,rest%20of%20a%20product's%20components.&text=Microservices%20components%20are%20modular%2C%20so,independently%20of%20any%20other%20code.
Presenting TypeIt: A VSCode extension for content creators
Tags: showdev, vscode, plugins, tools
Published: 2021-04-12 16:43:41

---
title: Presenting TypeIt: A VSCode extension for content creators
published: true
description: TypeIt is a VSCode extension that retypes your code so you can record it.
tags: showdev, vscode, plugins, tools
cover_image: https://i.imgur.com/Aglek4n.png
---

Today I wanted to share with you a side-project I've been working on with @paulasantamaria. 

It's called **TypeIt: Typing animations for content creators**

TypeIt is a VSCode extension that retypes your code so you can record it.

# Why TypeIt?
Sometimes we just want to write code at our own pace, test it, and, once we are comfortable, share it online as code snippets or tutorials. We may not want to memorize and write the code all over again just to record it. That's when TypeIt comes in. Use it to automatically retype the code you want to share.

Plus, you can choose different modes, adjust the typing speed and even retype multiple documents in parallel!

This video demonstrates how TypeIt can be used to create and share content:

{% youtube 1_GBQnNuZ5Q %}

# More info
If you want to learn more about it, you can visit our [website](https://typeit.uppernauts.com/).

---

# We would love to hear your thoughts 💬
What do you think about TypeIt?
Would you try it?
Let us know if you have any questions or feedback in the comments below👇
FlutterGuide
Tags: flutter, learnflutter, flutterguide
Published: 2021-04-12 16:35:58

Flutter Guide - This application might help you to learn about Flutter if you are a beginner in this space.

This application contains Widgets which are available in "Flutter Widgets of the Week".

Users / Beginners can able to see how the widget works, source code of the widget, information about the widget & sample YouTube videos ( Official Flutter YouTube Community) of each & every widget.

Currently the application supports 6 widgets, ASAP I'll be adding all the widgets. Also, this application shows video tutorials from official Flutter YouTube Community for references.

Open Sourced on GitHub. ("https://github.com/kurubaran18/FlutterGuide")

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

Soon, this application will be available on Google Play for Android users. For, iOS support contact me for installation process.

Contact Details : kurubaran.18051998@gmail.com [ Note : Please add subject as "Flutter Guide iOS Installation Support" ]

Thanks & Regards,
Kurubaran Anandhan.
Comparing Flask and Django
Tags: python, django, flask, beginners
Published: 2021-04-12 16:27:36


Python is one of the most widely used programming languages, thanks to its clean, readable code and adaptability. It is also in high demand due to its wide variety of web frameworks, which can quickly transform your project from a mere concept to an amazing reality. There are numerous frameworks, but only two stand out: **Flask** and **Django**.

Now let's compare Flask and Django based on some of the core framework's features:

#The Database:
Django has a robust Object Relational Mapping (ORM) framework that supports a variety of relational databases such as SQLite, PostgreSQL, MySQL, and Oracle, as well as managing and generating database migrations.
Flask makes no promises on how data is stored, but there are several libraries and extensions available to assist with this: Flask-SQLAlchemy, Flask-Alembic, Flask-Peewee, and so on.

#Administrator:
Django has a powerful admin screen, which is a desktop application with a user interface for handling data based on the templates. Django excels in this field as well. It enables you to easily execute _CRUD operations_ on your templates when building out an application without writing any additional code. 
Again, Flask does not come with anything like this by itself, but the Flask-Admin extension has the same functionality.


#Views and Routing:
Both frameworks support mapping URLs to views and feature and class-based views, but Django fits a URL pattern, the request object, which contains the HTTP request content.
Flask makes use of Werkzeug to provide URL routing and request/response handling. It requires that the item in Flask be global in order for it to have easy access to it (as long as you import it).
URLs are typically specified alongside the view (via a decorator), but they can be broken out into a centralized position, similar to the Django pattern.

#Security:
Django has built-in defense against a variety of standard attack vectors such as CSRF, XSS, and SQL injection. This security features help to protect the code from bugs. In addition, the Django development team proactively discloses and promptly patches identified security bugs. Flask, on the other hand, has a much narrower code base, which means there is less surface area to strike. However, when security flaws in your hand-crafted app code emerge, you will need to correct and patch them.


##Conclusion: 
It isn't so much about the right structures as it is about personal preference. Simply enjoy yourself when coding.
SAP Ariba training
Tags: sap, sapariba
Published: 2021-04-12 16:15:32

SAP Ariba Training

Upskills toward the SAP Ariba with HKR’s SAP Ariba Training. This Training will make you get Practical Knowledge on every module. Our expertise team will train you with real time cases and Practical sessions.

Key Features:

Flexible Timings
Hands On Experience
24/7 Support
Certified & Industry Experts Trainers
Real Time Use Cases
Flexible Payments

About HKR Trainings: 
HKR Trainings excel at providing you the best online classes with high quality facilities at a low price without any compromise on quality. What can you expect from us? A dedicated learning platform with 24*7 support, best in class training materials to help you learn advanced techniques and practical knowledge of all IT Technologies.
Our courses are specifically curated for both professionals as well as job-seekers. Online classes conducted by the best knowledgeable and certified trainers helps you earn certification at your convenience.

Contact Info:
HKR Trainings,
+91 9711699759
1 (818) 665 7216
https://hkrtrainings.com/sap-ariba-training