teleren/devto huggingface dataset:
Insertion sort algorithm
Tags: algorithms, codenewbie, python, programming
Published: 2021-06-21 22:54:52

## Definition of insertion sort

Insertion sort is a type of sorting algorithms that works like *the process of sorting playing cards*, it **divides** the array into two parts, part of *sorted numbers* and other of **unsorted numbers**, the numbers that are in the wrong order ( *numbers that exist in the unsorted part* ) are inserted to the sorted part in the correct position.

## Time and Space complexity of insertion sort

| time Complexity 	| Space Complexity 	|
|-----------------	|------------------	|
| O(n<sup>2</sup>)          	| O(1)             	|

## Algorithm explanation using an example
let's suppose we have an unsorted array [**7**,*4,12,3*],
the sorted part is 7 (bold styling), the unsorted part is from 4 to 3 (italic styling).
1. (4 < 7) that's why we will insert 4 in the sorted part before 7
so the array will be \[**4,7**,*12,3*]
2. (12 > 7) therefore will keep it in the same position so the array will be [**4,7,12**,*3*]
3. since 3 is smaller than 12,7 and 4, it will be in the first position, so the final array is [**3,4,7,12**]

## Implementation of insertion sort algorithm using python

if you're not familiar with python, you can find the implementaion of insertion sort algorithm in other programming languages:

+ [javascript] (https://initjs.org/insertion-sort-in-javascript-6c48563b4643) 
+ [c++](https://www.tutorialspoint.com/cplusplus-program-to-implement-insertion-sort)
+ [c#] (https://www.tutorialspoint.com/insertion-sort-in-chash)
+ [java] (https://www.javatpoint.com/insertion-sort-in-java)
+ [php] (https://www.w3resource.com/php-exercises/searching-and-sorting-algorithm/searching-and-sorting-algorithm-exercise-3.php)

=> python:

```python
def insertionSort(items: list) -> list:
    """
        [ name ]            => insertion sort
        [ type ]            => sorting algorithms
        [ time complexity ] => O(n^2)
        [ space complexity ]=> O(1)
        [ params ]          => (items) list to sort
        [ return ]          => sorted list
        [ code reference link ] => ("https://www.geeksforgeeks.org/insertion-sort/")       
    """
    for i in range(1, len(items)):
        key = items[i]
        j = i - 1
        while j >= 0 and key < items[j] :
                items[j + 1] = items[j]
                j -= 1
        items[j + 1] = key
    return array
```



## References and useful resources

+ [https://www.geeksforgeeks.org/insertion-sort/](https://www.geeksforgeeks.org/insertion-sort/)
+ [https://www.tutorialspoint.com/data_structures_algorithms/insertion_sort_algorithm.htm](https://www.tutorialspoint.com/data_structures_algorithms/insertion_sort_algorithm.htm)
+ [https://www.youtube.com/watch?v=JecAk1FAOck](https://www.youtube.com/watch?v=JecAk1FAOck)
+ [https://www.youtube.com/watch?v=OGzPmgsI-pQ](https://www.youtube.com/watch?v=OGzPmgsI-pQ)
+ [https://www.youtube.com/watch?v=JU767SDMDvA](https://www.youtube.com/watch?v=JU767SDMDvA)

Special thanks to [geeksforgeeks](www.geeksforgeeks.org).
Have a good day :)
\#day_9
Avoiding Mutations and Side Effects Using Functional Programming
Tags: javascript, devops, beginners, programming
Published: 2021-06-21 22:53:39

* The issue in the previous posts was with the `splice` call in the `tabClose()` function. Unfortunately, splice changes the original array it is called on, so the second call to it used a modified array, and gave unexpected results.
This is a small example of a much larger pattern - you call a function on a variable, array, or an object, and the function changes the variable or something in the object.

* One of the core principles of functional programming is to not change things. Changes lead to bugs. It's easier to prevent bugs knowing that your functions don't change anything, including the function arguments or any global variable.

* Let's try to master this discipline and not alter any variable or object in our code.

* Let's fill in the code for the function `incrementer` so it returns the value of the global variable `fixedValue` increased by one.
```
var fixedValue = 4;

function incrementer () {

}
```
* Answer:
```
var fixedValue = 4;

function incrementer () {
  return fixedValue + 1;
}

console.log(fixedValue); will display 4
console.log(incrementer()); will display 5;
```
* The function `incrementer` did not change the value of fixedValue(which is 4). and `incrementer` function should returned a value that is one larger than the `fixedValue` value.
List of Open Source Projects ML 
Tags: opensource, datascience, machinelearning, beginners
Published: 2021-06-21 18:18:05

List of Open Source Projects ML
Open source is an vast ocean if you are willing to dive in there, here is a list of some open-source projects to which you can contribute as an open-source contributor. Anyone can contribute to these repositories from beginners to experts based on their understanding and skills.

I have not explained about the projects, attaching GitHub links of the repositories where you will find all the necessary information and steps for contribution.

1. [Apple Foliar AI]
(https://github.com/smaranjitghose/AppleFoliarAI)

2. [Hands-on-ML-Basic-To-Advance](https://github.com/Niketkumardheeryan/Hands-on-ML-Basic-to-Advance-)

3. [Health Check](https://github.com/kritikaparmar-programmer/HealthCheck)

4. [Code Trophs](https://github.com/CodeTrophs)

5. [klar EDA](https://github.com/klarEDA/klar-EDA)

6. [Kitabe](https://github.com/Praful932/Kitabe)

7. [Operationlizing-ML](https://github.com/vaibhavirohilla741/Operationalizing-ML)

8. [Face-X](https://github.com/akshitagupta15june/Face-X)

9. [Automatic Attendance Management System](https://github.com/Swarnimashukla/Automatic-attendance-management-system)

10. [CoinShift-Imaging-Box](https://github.com/CoinShift-Imaging/CoinShift-Imaging-Box)

11. [Image Processing CV](https://github.com/geekquad/Image-Processing-OpenCV)

12. [Forest Trees Tagging](https://github.com/CodeFlow201/forestTreesTagging)

13. [CamOps](https://github.com/Developer-Student-Clubs-VSSUT-Burla/CamOps)

14. [EduHelp](https://github.com/CrewMates-Open-Source/EduHelp)

15. [Plant Disease Detection](https://github.com/imskr/Plant_Disease_Detection)

For getting started with open source , make sure you are sure about your skills and confident enough to contribute and solve the issues out there. And most important is you have to be patient for grabbing the issues and also for doing changes which are requested by admins.

Anyone reading this post knows about more repositories can comment and increase this list. 

Thank You. Hope it will help you !.
Dica rápida: Criando commits vazios no Git
Tags: git, sre, devops
Published: 2021-06-21 22:34:53

Esta é uma dica ótima para todo mundo que vive criando arquivos com "este é um teste", "este é outro teste", "mais um teste", "teste número X" em seu repositório com o intuito de disparar *triggers* e *webhooks* dos servidores para seus *jobs* e *pipelines*.

Ao invés de fazer isso, apenas digite utilize a opção `--allow-empty` ao seu *commit*. Assim:

```bash
$ git commit --allow-empty -m "Disparando trigger"
```

Após isso, realize o seu *push* normalmente para o *origin* e pronto.
Authentication vs Authorization
Tags: javascript
Published: 2021-06-21 22:33:00

As a developer, authorization and authentication are two terms that you might have come across. Although they are related, they mean different things, confusing if the basic idea is not well understood.

To define it, `authentication` answers the question, `'Who are you?'` while `authorization` answers the question; `'What are you allowed to do?'`.

*Authentication can be defined as the process of verifying that the user is whom they say they are.*

Some common examples of authentication are 
- password authentication
- biometric authentication
- multi-factor authentication 

*Authorization is the process of allowing users to perform specific actions based on the permission(s) they have.* An example is a role-based authorization. Allowing different users to perform specific actions based on their roles; user or admin.

We can try to understand these concepts better with this scenario.

Before you board a plane, you have to show a means of identification along with your boarding pass to show that you are whom you say you are; this is authentication. The flight attendant verifies the details you give them, and then if it matches, you are allowed to board.
Once you have successfully boarded, you cannot tell the crew member you would like to fly the plane because you are not allowed to as a passenger. You do not have the permission and the authorization to do so. Only an authorized pilot can do so.

So this explains the difference between authentication and authorization.
Light Indicator Status with AutoHotKey
Tags: productivity, keyboard, tutorial
Published: 2021-06-21 22:26:22

Languages: [🇪🇸] [Español](https://dev.to/equimancho/indicadores-de-estado-con-autohotkey-49jl) - [🇺🇸] [English](https://dev.to/equiman/light-indicator-status-4jge)

---

If you don't have light indicators on your keyboard or device. AutoHotKey can rescue us with a simple script to know the state of modifier keys.

Create a file called `key-indicator.ahk` with this script:

```cpp
~*CapsLock::
~*NumLock::
~*ScrollLock::
~*Insert::
Sleep, 10   ; drastically improves reliability on slower systems

msg := ""
msg := msg "Caps: " (GetKeyState("CapsLock", "T") ? "ON" : "OFF") "`n"
msg := msg "Num: " (GetKeyState("NumLock", "T") ? "ON" : "OFF") "`n"
msg := msg "Scroll: " (GetKeyState("ScrollLock", "T") ? "ON" : "OFF") "`n"
msg := msg "Insert: " (GetKeyState("Insert", "T") ? "ON" : "OFF")

ToolTip, %msg%
Sleep, 750  ; SPECIFY DISPLAY TIME (ms)
ToolTip     ; remove
return
```

Save the file and open it with AutoHotkey. You will get a screen notification status near your mouse pointer.

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

---

If you are using the `CapsLock` as `Backspace` and `CapsLock` enabled/disable with `Alt` key.

```cpp
CapsLock::Backspace
!CapsLock::CapsLock ; Alt+CapsLock -> Enable/Disable Caps Lock
```

Change the first line from `~*CapsLock::` to `~*!CapsLock::` on script file.

---

**Sources:**

- [AHK Board - Another on screen caps lock indicator](https://autohotkey.com/board/topic/100990-another-on-screen-caps-lock-indicator/)

---

**That’s All Folks!**
**Happy Coding** 🖖

[![beer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkgsx4aw6qn9i9ax6as9.png)](https://github.com/sponsors/deinsoftware)
function decodes any %## encoding in the given string
Published: 2021-06-21 22:04:26

function to convert a string with special characters to  url format. This function decodes any %## encoding in the given string. Plus symbols ('+') are decoded to a space character.

Use it when you need to get a utf-8 string to be handled lik a URL

```php
function to_utf8( $string ) {
	// From http://w3.org/International/questions/qa-forms-utf-8.html
		if ( preg_match('%^(?:
		  [\x09\x0A\x0D\x20-\x7E]            # ASCII
		| [\xC2-\xDF][\x80-\xBF]             # non-overlong 2-byte
		| \xE0[\xA0-\xBF][\x80-\xBF]         # excluding overlongs
		| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
		| \xED[\x80-\x9F][\x80-\xBF]         # excluding surrogates
		| \xF0[\x90-\xBF][\x80-\xBF]{2}      # planes 1-3
		| [\xF1-\xF3][\x80-\xBF]{3}          # planes 4-15
		| \xF4[\x80-\x8F][\x80-\xBF]{2}      # plane 16
	)*$%xs', $string) ) {
			return $string;
		} else {
			return iconv( 'CP1252', 'UTF-8', $string);
		}
	}
```
Javascript Operators with AutoHotKey
Tags: javascript, typescript, productivity, keyboard
Published: 2021-06-21 22:00:40

Languages: [🇪🇸] [Español](https://dev.to/equimancho/operadores-de-javascript-con-autohotkey-3o74) - [🇺🇸] [English](https://dev.to/equiman/javascript-operators-with-autohotkey-37kn)

---

If you are a software developer and the major time write code in JavaScript (or TypeScript) this post can be useful.

With AutoHotKey you can remap some key behavior to write quick and easy all those operators used day to day.

---

You need to have installed [AutoHotKey](https://www.autohotkey.com/) and create a file called `js-remapkeys.ahk` with this script.

```cpp
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

!7::Send {&}{&}                             ; Alt+7         &&          Logical AND
!+7::Send {&}{&}{=}                         ; Shift+Alt+7   &&=         AND Assignment
!8::Send {*}{*}                             ; Alt+8         **          Math Power
!9::Send {=}{>}                             ; Alt+9         =>          Arrow
!+9:: Send {(}{)}{space}{=}{>}              ; Shift+Alt+9   () =>       Arrow Function, implicit return
!^9:: Send {(}{)}{space}{=}{>}{space}{{}{}} ; Ctrl+Alt+9    () => {}    Arrow Function, explicit return
!\::Send {|}{|}                             ; Alt+\         ||          Logical OR
!+\::Send {|}{|}{=}                         ; Shift+Alt+\   ||=         OR Assignment
!=:: Send {=}{=}{=}                         ; Alt+=         ===         Strict Equality
!+=:: Send {!}{=}{=}                        ; Shift+Alt+=   !==         Strict Inequality
!,:: Send {<}{/}{>}{left 1}                 ; Alt+,         </>         HTML Close Tag
!^,:: Send {<}{/}{>}{left 2}                ; Ctrl+Alt+,    </>         React Component Tag
!.:: Send {?}{.}                            ; Alt+.         ?.          Optional Chaining
!+,:: Send {<}{=}                           ; Shift+Alt+,   <=          Less than or equal to
!+.:: Send {>}{=}                           ; Shift+Alt+.   >=          Greater than or equal to
!+;:: Send {?}{:}{left 1}                   ; Shift+Alt+;   ?:          Ternary Operator
!/:: Send {?}{?}                            ; Alt+/         ??          Nullish Coalescing
!+/:: Send {?}{?}{=}                        ; Shift+Alt+/   ??=         Nullish Coalescing Assignment
```

Save the file and open it with AutoHotkey. 

Finally, we will have a powered keyboard for JS/TS development.

![js-keys](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzyt2k5w8om04tr0huvl.gif)

---

**That’s All Folks!**
**Happy Coding** 🖖

[![beer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkgsx4aw6qn9i9ax6as9.png)](https://github.com/sponsors/deinsoftware)
Day 392 : All Night
Tags: hiphop, code, coding, lifelongdev
Published: 2021-06-21 21:41:08

_liner notes_:
- Saturday : Got up early cause I couldn't sleep, so I finished up some work for the radio show. After that, I worked on my side project. Got quite a bit done. Then it was time to do the radio show. As usual, had a great time! The recording of this week's show is at https://kNOwBETTERHIPHOP.com

![Radio show episode image of a photo showing packaging of the Czarface and MF DOOM 3 inch vinyl record with the artwork of an illustration of a person half robot and half MF DOOM with their fists at their chest with the words June 19th 2021 Backpack included](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cbkgci35mb75ghfcejh3.jpg)

- Sunday : Pretty much spent the day working on my side project. Earlier in the day, finished some post radio show promo work. Finished up the HACO section of the site and added the ability to ban users and invite them to a video call. Didn't finish the video call part, just being able to let a user know they have been invited. Then I ended the night watching a new show called "Kevin can F Himself". Pretty interesting story. Then I watched the first episode of the new season of "Rick and Morty". Pretty wild episode as I would expect.

- Professional : Today was basically Meeting Monday. I got to speak with the Product Manager of the product that I'm the Product Specialist of (that's a lot of product! haha). Spoke about some things coming up. Had our weekly team meeting. Good to catch up with everyone. Then there was a company wide meeting. At the end of the meeting, there were some slides and I saw a person with my same last name! haha I reached out on Slack, but they are in another timezone. Had my one to one with my manager. Had a good talk about things to do for the week. Then I proceeded to get started on some of those things.

- Personal : So, I got the invite and ban system working on the user site, and started working on the dashboard where I'll be able to control those things by adding the appropriate data to the database. Then I started to rethink how I implemented it on the user site. I'm thinking there could be a better way. We'll see. Don't want to spend too much time on it. I've got a deadline.

![Coastline of Great Ocean Road, Australia with a green mossy landscape that leads out into the ocean](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tln2xtthpbp9qvjgiho3.jpg)

Pretty much going to do the same thing I'll be doing for the rest of the week. Finish up my side project for launch. Got a few more things to complete before I feel ready. Going to work on it little by little. Not trying to be coding all night, even though I probably will. haha

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube jA0CohOKmwY %}
Devtron, Heroku for Kubernetes, Open-source Delivery Workflow
Tags: showdev, kubernetes, devops, opensource
Published: 2021-06-21 20:32:57

A completely Opensource software delivery workflow for Kubernetes. Mainly written in Go. 

{% github devtron-labs/devtron %} 

It is an End-to-End Opensource project that we started building almost 3 years ago. It enables excellent cooperation between devs and ops teams. I really think it will be a useful tool for people who need to manage and work on Kubernetes. 

I'll be happy if you can check the project out, use it, and give some valuable feedback. Maybe you can do one better and contribute, that will be the best thing ever. Would love to hear from you people, cheers.
June 14 - June 21 Weekly Status
Published: 2021-06-21 19:32:15

This week I modified [code](https://github.com/AleksandrGushchin/av-scenechange) to test the algorithm. Namely, I added command line arguments for downsampling video, outputting the result of the work as a json file, as well as calculating the speed of the algorithm. After that I tested the algorithm on my dataset. Based on the test results I made a blog post, where I put the data and charts. During the testing I changed the min_key, max_key command line parameters and made charts for each part of the dataset (documentaries, 4K and complex videos from YouTube) based on these data.
Let's Learn .NET - Blazor - Free Live Stream Event
Tags: dotnet, blazor, beginners, webdev
Published: 2021-06-21 19:02:52

[Let's Learn .NET](https://aka.ms/letslearndotnet) is a monthly beginner series that walks through the fundamentals of using C# and .NET. This month, we are looking at Blazor and how to use it to build web apps completely in C#.

Blazor lets you build interactive web UIs using C# instead of JavaScript. Blazor apps are composed of reusable web UI components implemented using C#, HTML, and CSS. Both client and server code is written in C#, allowing you to share code and libraries. Together, we will learn all about Blazor and why you would use it to build web apps, and then we will build our first client web app with Blazor and .NET.

{% youtube 4Xzx7Cm9ykg %}

## When
**Friday, June 25th at 8:30 AM - 10:30 AM Pacific**

## Where

Streaming live for FREE on [Microsoft Learn TV](https://docs.microsoft.com/learn/tv/?WT.mc_id=dotnet-17847-jasingl). Sign-in, ask questions, and learn how to start building accessible apps.

## What
Come learn something new and leave with something that we all built, together, live with experts. Here is the agenda for the event:

**Introductions (5 mins):**
- Meet the team!

**Fundamentals (20 mins):**
- Blazor101 
   - What is ASP.NET Core? How does Blazor fit in?  
   - Why would I build apps with Blazor? 
   - How does Blazor Work? 
- Pre-requisites & installation  

**Workshop I (35 mins):**
- [Build a web app with Blazor](https://docs.microsoft.com/en-us/learn/modules/build-blazor-webassembly-visual-studio-code?WT.mc_id=dotnet-22477-jasingl)

**Q&A (10 mins):**
- Get your questions answered live!

**Workshop II (35 mins):**
- [Publish a Blazor web app](https://docs.microsoft.com/en-us/learn/modules/publish-app-service-static-web-app-api-dotnet?WT.mc_id=dotnet-22477-jasingl)

**Q&A (10 mins):**
- Get your questions answered live!

## RSVP Today
Head to [aka.ms/letslearndotnet](https://aka.ms/letslearndotnet) to RSVP today!

## Looking for more?
- [Blazor resources](https://aka.ms/Blazor_Resources)
- [.NET 101 Videos](http://dot.net/videos)
🦋How to Create a Convex Bottom AppBar in Flutter
Tags: flutter, programming, tutorial, android
Published: 2021-06-21 18:52:39

Photo by <a href="https://unsplash.com/@byrdman85?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Ashley Byrd</a> on <a href="https://unsplash.com/@byrdman85?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>

Hello and welcome to my post about Flutter Package Testing. Each week I will test another package published under pub.dev. If you want to see the first post of this series head over to How to validate Emails in Flutter.

##Convex Bottom AppBar
This week's widget is a UI Widget to bring your AppBar experience to a new level. The Convex Bottom AppBar widget made you create - who guessed it - a bottom appbar for your flutter app. The widget provides you with a fast to implement appbar and seven predefined styles.

##The purpose
In nearly every app you have multiple screens. By providing your users a better experience, you need a fast way to change between the most important pages in your app. This is often been solved by using a bottom-appbar. Using the Convex Bottom AppBar, you got this feature out of the box including animation and style adjustment using predefined styles.

##Up Next
Package Scope, An Example, Limitations, Installation, Score, Rating and more

##[Continue Reading](https://levelup.gitconnected.com/how-to-create-a-convex-bottom-appbar-in-flutter-a52d8239dd25)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lf74fujxog40xl9cslh6.gif)
🦋How to Create Signin Buttons in Flutter
Tags: flutter, programming, tutorial, ios
Published: 2021-06-21 18:45:57

Photo by <a href="https://unsplash.com/@rcc_btn?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Bastian Riccardi</a> on <a href="https://unsplash.com/@rcc_btn?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>

Hi there, and welcome to my post about Flutter Package Testing. Each week I will test another package published under pub.dev. If you want to see the first post of this series head over to How to validate Emails in Flutter.

##Flutter Signin Button
To create simple Sign-in Buttons for Social Media the package Flutter Sign-in Button is a good choice. You often see them when you’re on a login page and there is also an option to sign in with your social media account like Facebook or Twitter. The package also supports mini Buttons. These can be used when you want to display a share button for several social media platforms at once.

##The purpose
The purpose of this package is very clear: You can use them any time when you want a user to connect to a social media platform. It doesn’t care if he wants to sign in with his account, share a post or visit an author’s social media account. For these and more reasons the package gives a clear and recognizable look for the supported social media platforms.

##Up Next
Package Scope, An Example, Limitations, Installation, Score, Rating and more

##[Continue Reading](https://levelup.gitconnected.com/how-to-create-a-convex-bottom-appbar-in-flutter-a52d8239dd25)

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