teleren/devto huggingface dataset:
💻 Dependency Injections with Koin
Tags: kotlin, security
Published: 2021-10-04 13:41:55

#### 📙 Learn how to implement common dependency injection scenarios with Koin and Kotlin.

### <br>

Inversion of Control (IoC) is a broad term to describe how responsibility for some aspect of a system is lifted out of the custom code written by the end developer and into a framework. [Martin Fowler describes a framework in terms of IoC](https://martinfowler.com/bliki/InversionOfControl.html):

> Inversion of Control is a key part of what makes a framework different from a library. A library is essentially a set of functions that you can call, these days usually organized into classes. Each call does some work and returns control to the client.

A framework embodies some abstract design, with more behavior built-in. In order to use it, you need to insert your behavior into various places in the framework, either by subclassing or by plugging in your own classes. The framework's code then calls your code at these points.

Dependency injection (DI) is one specific example of IoC where classes no longer directly instantiate member properties by creating new objects but instead declare their dependencies and allow an external system, in this case, a dependency injection framework to satisfy those dependencies.

[Koin](https://insert-koin.io/) is a dependency injection framework for Kotlin. It is lightweight, can be used in Android applications, is implemented via a concise DSL, and takes advantage of Kotlin features like delegate properties rather than relying on annotations. 

In this post, we'll look at a simple application taking advantage of Koin to inject dependencies into our custom classes.

## Prerequisites

To build the sample application, you'll need to have JDK 11 or above, which is available from many sources, including [OpenJDK](https://openjdk.java.net/install/), [AdoptOpenJDK](https://adoptopenjdk.net/), [Azul](https://www.azul.com/downloads/), or [Oracle](https://www.oracle.com/au/java/technologies/javase-jdk11-downloads.html).

The code for the sample Koin application can be found [here](https://github.com/mcasperson/KotlinKoinExample).

## The Gradle Project Definition

We start with the Gradle build file, which includes dependencies for Kotlin and Koin, and makes use of the [shadow plugin](https://github.com/johnrengelman/shadow) to create self-contained uberjars:

```groovy
buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0'
    }
}

plugins {
    id "org.jetbrains.kotlin.jvm" version "1.5.21"
}

apply plugin: 'kotlin'
apply plugin: 'com.github.johnrengelman.shadow'

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.21"
    implementation "io.insert-koin:koin-core:3.1.2"
}
```

To build the uberjar, run this command from Bash or PowerShell:

```bash
./gradlew shadowJar
```


[Read more...](https://auth0.com/blog/dependency-injection-with-kotlin-and-koin/?utm_source=content_synd&utm_medium=sc&utm_campaign=kotlin)
Homebrew installation problem on my M1 Mac
Tags: webdev
Published: 2021-10-04 13:40:45

Hello! I am experiencing problem with installing 'homebrew'. At first, it showed error saying the Command Line tools installation failed. After that, I had installed the command line tools downloading and it was successful. Right now, it has been showcasing the same error again and again ( error image attached here with this message: ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqyjgv90s8gu7j7y5iov.png ). Could you please help me with this?
Don't overcomplicate things
Tags: webdev, javascript, discuss, programming
Published: 2021-10-04 13:34:10

Wen working with the code, the programmer all the time faced with abstraction. This is common use technique that is used to simplify some things in one place and delegate realization to another place. It is very useful and cool. If I use 
```javascript
  const cardItem = arr.find(item => item.name === 'card')
```
I teach myself what this method does. What should I use as parameters and values that I expect to receive? And then use it all over the place, doesn’t dig into details of realizations hidden behind this method. This is greate.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i2rmpjdhj54443qmhg86.gif)
All the frameworks, language features are based on good abstractions. Abstraction gives us the power and clean way to do complex things. 

But can over-abstraction is be bad?
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8x08p3y087y7diw1vy4u.gif)

It can be where we can make things are not obvious and can confuse or just struggle other developers or even for us in the future. Let looks at the example:

In this case we use some custom function to add query for <a/> tag
 ```javascript
 <a href={customRoute(ACCOUNT_DETAILS_PATH, 
        { pathQuery: { sid: active.sid }, })} />
```
So we use some customRout() method that adds some more logic for this that takes 2 params, URL and object. 
What difficulties it can add to your code? Let say a new developer comes to our project. He sees that code and he will need to dig into that function to know the implementation or what the API is. Inside that function we can see something like this:
```javascript
export function customRout(
  routePath: string,
  params?: {
    path?: Record<string, any>;
    query?: Record<any, any>;
  },
) {

const normalizedPath = replacePathParams(routePath, params?.path);

  if (params?.query) {
    return addQueryParams(normalizedPath, params.query);
  }

  return normalizedPath;
}
```
We have some extra logic to handle all params and also have some more abstractions with addQueryParams and normalizedPath. And that abstraction can have more inside..

This is another example that does the same thing but using template literal instead
 ```javascript
 <a href={`${ACCOUNT_DETAILS_PATH}?sid=${active.sid}`}/> 
```
it is clear and not abstracted. It’s readable well for every developer. Not no need to learn API or so. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ncgrhtwfky9j6wc65b1k.gif)

The main point is to avoid over-complexities and unnecessary abstraction in the code. It will save time and brain energy for everyone in the project. And let you focused on really good abstractions in a place where they need.
Show Git Branch on Bash
Tags: bash, git, github
Published: 2021-10-04 13:28:20

![bash](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hjkgimxqotu6iioq0gtv.png)

**TL;DR**

Add the following line to end of your `.bashrc` to make your bash show the current branch you're on:

```bash
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\e[91m\]\$(__git_ps1 ' [%s]')\[\e[00m\]\$ "
```
Git Good
Tags: codenewbie, github, tutorial
Published: 2021-10-04 13:17:04

A fundamental aspect of any code-base is collaboration. Developers from various backgrounds can integrate their knowledge in creating the perfect product required.

Besides, documentation of self progress is also something useful as it portrays one's journey.

Luckily, there are complete systems and databases that take care of such progress. Following is an idea about this, namely **Git** and **GitHub**.

## Getting Git

Git is essentially a "version control system", which simply means that it tracks various updates and amends in a code-base by maintaining a certain flow of the code through various **branches** and **forks**. These are essentially kind of a copy of the actual code that we can work on while preserving the original code.
This is essential, because we don't want the actual code to be useless until we finish our job. We want to fix or upgrade it separately and then **merge** the changes back to the original.
Following is a common visualization.

![Branches example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07q6smy5mnkhckivxy3o.png)

**Git installation** is pretty straightforward; just head on to the [site](https://git-scm.com) and install it according to your OS. It has no prerequisites. Make sure that you also have your Git Bash with the bundle.
Git Bash is basically a terminal that is a bit personalized for Git. Windows users are recommended to use it over your cmd/powershell. Although the VSCode terminal is also very supportive.

## GitHub

GitHub is essentially a site that manages code-bases. There are other websites as well, like GitLab and BitBucket. But GitHub is far too popular.
You can simply create an account on it which is completely free up until certain restrictions.
These however can be bypassed if you're a college student by getting a **pro**. [This](https://github.com/SrijanSriv/references/blob/master/Pdfs/Github%20Account%20and%20Developer%20Pack.pdf) explains how they can get a pro account for free.

## The Basics

Git has certain common commands. Usually, we want to do one of these things with version control:

* **Create A Repository** that has some code that we created.
* **Contribute To A Repository** that exists already, possibly on some other user's account.

These might get confusing if not payed attention to, since once we go into larger code-bases, version control might not be our primary focus. Hence, it is recommended that we learn this early on and have it in practice.

## Sources

* [FreeCodeCamp](https://www.youtube.com/watch?v=RGOj5yH7evk) has an amazing video that explains not only the basics but a bit more about SSH and the lot.
* For Hindi speakers, [CodeWithHarry](https://www.youtube.com/watch?v=gwWKnnCMQ5c) is always a treasure trove.

Other than that, you could always check out [here](https://github.com/SrijanSriv/references/blob/master/Readmes/Git.md) for any related hacks that I find interesting.


:wave:
I make my first contribution to HacktoberFest 2021
Published: 2021-10-04 13:11:01

---
title: I make my first contribution to HacktoberFest 2021
published: true
description: We will talk about what HacktoberFest is and how to contribute. The HacktoberFest 2021 is a really good way to get into open source, boost your CV and help out your fellow programmers.
tags:
cover_image: https://i.ytimg.com/vi/vxXqXanqsh0/maxresdefault.jpg
---

{% youtube vxXqXanqsh0 %}

We will talk about what HacktoberFest is and how to contribute. The HacktoberFest 2021 is a really good way to get into open source, boost your CV and help out your fellow programmers.
AWS Snowball
Tags: webdev, aws, cloud, serverless
Published: 2021-10-04 12:54:45

AWS snowball, I guess that you have never heard of this .It's kind of a fun name, but it basically  a huge box. The basically allow transfer of data in and out of AWS data center. 
![Capturessss](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3l32zwjy48g1w1966ci8.PNG)
 
###Why is AWS Snowball

1. Physical data transport solution that helps moving 
TBs or PBs of data in or out of AWS.
2. Alternative to moving data over the network (and paying network fees).
3. Secure ,tamper resistant ,uses KMS 256 bit encryption.
4.Tracking using SNS and text messages. E-ink shipping label.
5.Pay per data transfer job
6.Use cases: Large data cloud migrations ,DC decommission, disaster recovery.
7.If it takes more than a week to transfer over the network , use Snowball devices!

Snowball Process
1.Request snowball devices from the AWS console for delivery
2.Install the snowball client on your server
3.Connect the snowball to your server and copy file using the client.
4.Ship back the device when you're done (goes to the right AWS facility)
5.Data will be loaded into an S3 bucket
6. Snowball is completely wiped
7.Tracking is done using SNS ,text message and the AWS console

###Diagram

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c17e8ywgsj5pxf6j3pr1.PNG)



### Snowball Edge
1.Snowball Edges add computational capability to the device
2.100TB capacity with either:
    .Storage optimized - 24 vCPU
    .Compute optimized - 52 vCPU & optional GPU
3.Supports a custom EC2 AMI so you perform processing on the go.
4.Supports custom Lambda functions
5.Very useful to pre-process the data while moving
6.Use case: data migration, image collation, IoT capture, machine learning 
 
### AWSSnowMobile 
This is used for transferring large data up like extra byte. Each snowmobile has 100PB of capacity (Use multiple in parallel).It is way better than snowball and can transfer more than 10PB
Reasons Why Google Data Studio is Amazing
Tags: datascience, gcp, googlecloud
Published: 2021-10-04 10:58:49

Data Studio is Google’s reporting reply to all the users who want to create impressive visualization on top of different data sources and go beyond the data and dashboards of Google Analytics. The data widgets in Data Studio are prominent for their variation, customization choices, live data, and interactive controls (such as column sorting and table pagination). Data sources could be a variety of products which include Google products (Analytics, AdWords, Search Console, Sheets, YouTube, and more), database connectors, and file upload, and community connectors to popular marketing services.

With Google Data studio, one can go from data to insight to wisdom via great visualization supported by the GCP cloud service. It is a comprehensive suite of data analytics tools from Google and with a couple of built-in functionalities like flexibility, scalability, collaboration, and advanced analytics. Data Studio not only is BI workloads backed by the power and scale of BigQuery but also accelerated by BigQuery BI Engine, an in-memory analysis service for fast, interactive visual analytics.

Data Studio handles the authentication, access rights, and structuring of the data in an organized manner. Once a data source is connected to Data Studio, underlying dimensions and metrics are easily available for calculations, transformations, and visualizations.

With Data Studio, one can turn data into compelling visuals with out-of-the-box, community-built, or custom visualizations. The Data Studio service console is not readily available within the GCP console like other services; however, users can open the data studio console via its web URL. Once ready for delivery, include them into dashboards, reports, or data stories and get blazing fast insights when they’re connected to both BigQuery, Google’s MPP analytics data warehouse, and to BigQuery BI Engine, an in-memory analysis service with sub-second query response, high concurrency, and smart performance tuning. Data Studio reports can be easily shared with anyone within and outside the organization, depending on the report configuration. It also comes with the report scheduling option where recipients can receive the report in their inbox at a particular scheduled interval.

The following are the features of Data Studio:
- Visualized data through highly configurable charts and tables.
- Easily connects to a variety of data sources.
- Shares dashboards with the team and or with the external world.
- Speeds up report development within built sample reports.
- Usability: Data Studio was designed to support so many easy-to-use features, which seasoned analytics teams are sure to enjoy them.

Hope this was helpful.
Best job oriented programming language for Future
Tags: webdev, javascript, beginners
Published: 2021-10-04 12:44:48

Today’s life is difficult for all students because present education is hard. Most don’t know about programming education. But who knows coding doesn’t know about a programming career.

The most common question asked by people that Is codding has a bright career? The answer is yes. In the programming line, there are many good opportunities for the career. There are many options for beginners and Experts and mainly jobs under programming languages.

The second question Is programming language is hard? Programming/coding language is easy if it is studied carefully. In the world, there is nothing impossible. If you have skills of learning new things and have time to practice and one main thing if you have patience you can easily learn coding in a short period. 

Top 3 Programming Language Mainly used in Jobs

•	PHP

 PHP (Hypertext Preprocessor) is well known as the most common language that is used to develop interactive and dynamic websites. This is mainly embedded into HTML language to make website functionality easier without any external files. This server-side language around for more than 25 years. The Top websites which use Wikipedia, Tumblr, Word Press, etc. The basic fact is 83% of websites on the internet are improved from PHP.
 
•	PYTHON
Python language is an easy and famous language among all developers because of its simplicity and versatility. Python did programming in Object-Oriented & Procedural paradigms. Google, Amazon, Instagram, Facebook, etc. Mainly used the python language. Python programs are mostly smaller than other languages. The latest version of python was released in 2019 on 18 December Python 3.7.6 Python language used for machine learning and deep learning for data science and mathematics. 
 

•	JAVA
For many years Java is one of the most popular languages for Developers. Java is the most common language used in applications (android application, web application, desktop application, & many more). Java syntax is easy to understand and similar to C/C++ syntax. Netflix, Pinterest, Airbnb, etc. use Java language for working.
 
 
 
TOP 5 Jobs for Programming Languages
 
1.	Web developer
2.	Computer programmer
3.	Front-end developer
4.	Software application developer
5.	Back-end developer
 
For a good income get training from experts and learn coding in fewer Periods. You can’t able to learn coding until you work on live project and Cbitss has both things expert trainers and live projects for all language PHP, JAVA, etc.
The Complete Web Component Guide: Part 1 — Custom Elements
Tags: javascript, webdev, tutorial, programming
Published: 2021-10-04 12:42:52

[![](https://cdn-images-1.medium.com/max/2000/1*KE5bZMF41HQnn2bupDozcQ.png)](https://medium.com/front-end-weekly/the-complete-web-component-guide-part-1-custom-elements-a627af805df8?source=rss-f6e6b5239e7f------2)

Become an expert in the future of Web Development

{% medium https://javascript.plainenglish.io/the-complete-web-component-guide-part-1-custom-elements-a627af805df8 %}
Block Element Modifier
Tags: css, webdev
Published: 2021-10-04 12:35:48

> ## It is popular naming convention for ***Classes*** in **HTML** and **CSS**. It was invented at Yandex to develop sites that should be launched fast and supported for a long time. It helps to create extendable and reusable interface components.

***

##  Block
### It is an independent component in HTML that has its own meaning and can be reused. It is more of like a *parent element*.
### Examples: `<header>`, `<nav>`, `<form>` etc.

```
<header class="header">

<nav class="nav"></nav>

</header>

```

*** 

##  Element
### Elements are the child element of the **Block** component. It is mostly the text part inside the block. **Block and Elements are seperated by 2 double underscores `(block__element)`**.
### Examples: `<input>`, `<h1>`, `<button>` etc.

```
<header class="header">

<h1 class="header__title"> Introduction </h1>

</header>

```

***

##  Modifier
### As the name suggests it ***modify*** the appearance, state, behaviour of elements. **Elements and Modifiers are seperated by single undersocre (elements_modifiers)**
### Examples: `<disabled>`, `<color>`, `<active>` etc.

```

<form class="form">

<input type="text" class="form__name_disabled" disabled>

</form>
```
> NOTE: Some places you will find elements and modifiers are separated using a single underscore (element--modifiers).


***
##  Rules `<block-name__element-name_modifier-name>`

###  1. Names are written in lowercase Latin letters.
###  2. Words are seperated by a hyphen (search-form).
###  3. The **element** name is seperated from the **block** name by a double underscore (header__title).
###  4. The **element** name is seperated from the **modifier** name by a single underscore (form__input_disabled).
> ###  A double hyphen inside a comment (--) may cause an error during validation of an HTML document. So it is mostly avoided.

***

##  References
### [BEM Methodology](https://en.bem.info/methodology/)

## Contact 
-  [Twitter](https://twitter.com/Vanshsh2701)
Data Visualization with D3, React, visx and Typescript: 1 - Introduction
Published: 2021-10-04 12:31:32

{% youtube S7dgrcXwpE4 %}

This is the first video of a series that I'm creating to teach you about data visualization using some technologies like D3, React, visx and Typescript. I hope you like it.

I'm creating this course because I heard a few times that professionals with data visualization skills are rare, and when they appear on the market, they get hired pretty quickly.

Data visualization is a way of telling a history with an image. It is important for humans, because that's the way we can actually understand the data that is presented to us. 

One example I like to give is that we know, by common sense, that the life expectancy is going higher over time, but how do we quantify and prove it? How do we let other people know about it with just a few seconds of their time?

What if I showed you this data, would you be able to get the essence of it?

https://ourworldindata.org/grapher/life-expectancy?tab=table&time=1770..2019&country=Africa~Asia~Europe~OWID_WRL~Americas~Oceania

Now, if I give you this, you would probably get it really fast, right?

https://ourworldindata.org/grapher/life-expectancy?tab=chart&time=1770..2019&country=Africa~Asia~Europe~OWID_WRL~Americas~Oceania

This transformation is actually what we are going to learn! How to get RAW datasets and transform them in beautiful data visualizations using the power of D3.

By the way, this course is not for complete beginners, you should have previous knowledge of JavaScript, a little bit of Typescript, and React.

With this, we will create, by the end of this course, a beautiful chart, that you can customize and add to your portfolio!