teleren/devto huggingface dataset:
Merge sort algorithm
Tags: algorithms, beginners, computerscience, codenewbie
Published: 2021-06-23 21:38:31

## Definition of the merge sort algorithm

merge sort is an efficient algorithm, and one of Divide and Conquer algorithms that splits the giving array into two halves, and then merge them in a sorted manner.

## Time complexity of merge sort

| best-case  	| average case 	| worst-case 	|
|------------	|--------------	|------------	|
| O(n log n) 	| O(n log n)   	| O(n log n) 	|

## Space complexity

The space complexity of merge sort is **O(n)**

## Advantages of using merge sort algorithm

+ Fast for large arrays unlike selection, insertion, and bubble sort it doesn't go through the whole array many times.  

## Disadvantages of using merge sort algorithm

+ extra space to store subarrays
+ slow for small arrays
+ the algorithm does the whole process even the array is already sorted

## Implementation of merge sort using python

```python
def MergeSortAlgorithm(arr: list) -> list:
    """
        [ name ] => merge sort
        [ type ] => sorting algorithms
        [ time complexity ] => O(n log n)
        [ space complexity ] => O(n)
        [ params ] => ( 
            arr {list} list to sort
        )
    """
    n = len(arr)
    if n > 1:
        #getting the middle of the giving array 
        mid = n // 2
        # left half 
        leftHalf  =  arr[:mid]
        # right half
        rightHalf =  arr[mid:]
        # sort left half
        MergeSortAlgorithm(leftHalf)
        # sort right half
        MergeSortAlgorithm(rightHalf)
        
        i = k = j = 0

        while i < len(leftHalf) and j < len(rightHalf):
            if leftHalf[i] > rightHalf[j]:
                arr[k] = rightHalf[j]
                j+=1
            else:
                arr[k] = leftHalf[i]
                i+=1
            k+=1
        # inserting to the sortedArray the rest of the leftHalf
        while i < len(leftHalf):
            arr[k] = leftHalf[i]
            k += 1
            i+=1
        # inserting to the sortedArray the rest of the rightHalf
        while j < len(rightHalf):
            arr[k] = rightHalf[j]
            k+=1
            j+=1
```

## References and useful resources

+ [https://getrevising.co.uk/grids/merge-sort-advantages-and-disadvantages](https://getrevising.co.uk/grids/merge-sort-advantages-and-disadvantages)
+ [https://www.tutorialspoint.com/data_structures_algorithms/merge_sort_algorithm.htm](https://www.tutorialspoint.com/data_structures_algorithms/merge_sort_algorithm.htm)
+ [https://www.geeksforgeeks.org/merge-sort/](https://www.geeksforgeeks.org/merge-sort/)
+ [https://www.interviewbit.com/tutorial/merge-sort-algorithm/#:~:text=Merge%20sort%20is%20one%20of,results%20into%20a%20sorted%20list.](https://www.interviewbit.com/tutorial/merge-sort-algorithm/#:~:text=Merge%20sort%20is%20one%20of,results%20into%20a%20sorted%20list.)

Thank you so much for your time! :)
\#day_11
PNG files can be animated via network latency
Tags: webdev, png
Published: 2021-06-23 21:07:01

I saw this online and thought it was pretty neat. Check out this image:

https://www.da.vidbuchanan.co.uk/adamation/image.png

It's not overly useful, but you might learn something. [Here is an interesting post](https://pyokagan.name/blog/2019-10-14-png/) related to the subject.

Happy coding. ❤️
How does Microsoft Azure work?
Tags: cloud, tutorial, codenewbie, computerscience
Published: 2021-06-23 20:26:04

### How does Azure work?

<img width="100%" style="width:100%" src="https://media.giphy.com/media/MB6mmz21wDPZc2827I/giphy.gif">

Behind the scenes Azure uses a technology called **Virtualization!**

**Virtualization!** separates the tight coupling between the computers hardware and it's operating system using an abstraction layer called **Hypervisor!**

**Hypervisor** emulates all the functions of a real computer, such as CPU and a Virtual machine. 
- It can run multiple Virtual machine's or (VM's) at the same time.
- Optimize the capacity of the hardware and each virtual machine can run any compatible software 

<img width="100%" style="width:100%" src="https://media.giphy.com/media/xT0BKL21U5nnlW4m6k/giphy.gif">

Interesting isn't it?

#### _Let's try to know more about how does it work?_

<img width="100%" style="width:100%" src="https://media.giphy.com/media/xT1R9XWlRXt08xfDX2/giphy.gif">

### So, how does it work?
- Each data center has many blocks with servers. 
- Each server will include a **Hypervisor** to run multiple virtual machine's
- A network switch will be provided to connect all of these servers.
- One server from each block will be running a special software called **Fabric controller.**

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1624478498219/YRt020jiC.png)

- Each **Fabric controller** will be connected to another software known as **Orchestrator**
- **Orchestrator** will be responsible for everything that happens within Azure
(Including responding to a user's request!) 
- Users make a request using Orchestrator's web API
- The web API can be called by many tools including the user interface of the Azure portal!


<img width="100%" style="width:100%" src="https://media.giphy.com/media/xTk9ZZvJbApGt3vy3C/giphy.gif">

When a user creates a request to create a Virtual machine -> Orchestrator packages everything required for a service. -> chooses the best server block -> Sends the package and request to Fabric controller!

Once the Fabric controller has created a virtual machine -> User can connect to this virtual machine!


 
>You're now familiar about how Azure works in realtime! 
>It's that simple and easy to understand!!

<img width="100%" style="width:100%" src="https://media.giphy.com/media/5eG28RENYdnMrrHuwq/giphy.gif">

>Thanks a lot for reading!
 
<img width="100%" style="width:100%" src="https://media.giphy.com/media/Pnh0Lou03fv92J4puZ/giphy.gif">

------
Simple Lazy Loading
Tags: javascript, webdev
Published: 2021-06-23 19:40:36

---
title: Simple Lazy Loading
published: true
tags: javascript, webdev
cover_image: https://res.cloudinary.com/dzynqn10l/image/upload/v1631845930/JS%20Bits/lazyload_cover_-_Twitter_skdbot_1_levqmv.webp
---
Typically we need to write JavaScript to handle image lazy loading, often in the form of a scroll handler or intersection observer:

```html
  <img class="lazyload" src="placeholder.jpg" data-src="pine.png">
  
  <script>
    document.addEventListener('scroll', () => {
      const scrollTop = window.pageYOffset;
      const lazyImages = document.querySelectorAll('.lazyload'); 
    
      lazyImages.forEach(img => {
        if (img.offsetTop < (window.innerHeight + scrollTop)) {
          img.src = img.dataset.src;
          img.classList.remove('lazyload');
        }
      });
    });
  </script>
```

But now there's an experimental feature where you can simply use `loading="lazy"` to achieve the same result:

```html
<img src="pine.jpg" loading="lazy">
```
With the loading attribute set to `lazy`, the browser will do all the heavy lifting and will only load the image sources once the user scrolls near the image. We don't even need to use placeholder images to keep our markup valid!

As of now, this feature is supported in Chrome, Edge, and Firefox. Come on, Safari - get with it!

### Here's a video using this in action:
<a href="https://www.tiktok.com/@js_bits/video/6977049064646970630?lang=en&is_copy_url=1&is_from_webapp=v1" target="_blank">
  <img src="https://res.cloudinary.com/dzynqn10l/image/upload/v1631845930/JS%20Bits/lazyload_cover_-_Twitter_skdbot_1_levqmv.webp" alt="lazyloading TikTok" width ="190" />
</a>



----------
Check out more #JSBits at my blog, [jsbits-yo.com](http://jsbits-yo.com/). Or follow me on [Twitter](https://twitter.com/JS_Bits_Bill) and [TikTok](https://www.tiktok.com/@js_bits?lang=en)
Top 5 Reasons a Doctor Needs a Powerful Website
Tags: python, productivity, react, javascript
Published: 2021-06-23 19:39:36

There are many reasons why even a busy, “at capacity” doctor or medical practice marketing plan needs a powerful and effective website as the cornerstone of an Internet presence.

#1. Referring doctors also use the Internet for due diligence.
 
No doubt your CV is sterling, but your online presence is instantly available and it speaks volumes to professional colleagues about you and your work.

#2. Stand out among the competition. 

“Being invisible” online is simply your gift of new business to another practice.

#3. Protect, maintain and grow market share. 

The Internet is a primary consideration in healthcare marketing. This is where prospective patients—customers—survey their options.

#4. Change your patient mix for more desirable patients and cases.

Simply being busy is no assurance of attracting an optimal balance of cases and patients. Internet marketing can influence this mix.

#6. Protect and extend your professional reputation. 

Having no presence available online could be a negative signal to others. Your story—whatever your healthcare colleagues and the public know about you—is strongly influenced by what you present online.

##### Thanks You
 
######I will design medical website, healthcare website, hospital website. 
visit 👉 https://www.fiverr.com/s2/6d75e576bc
1 millions vue leaflet marker ? YES 
Tags: vue, leaflet, javascript, awesome
Published: 2021-06-23 19:31:27

Hi everyone !

![1 million markers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4x2pppybybe8809r50x.png)
1 Million Markers
## Before read
I have use two scripts for initialize my own Vue components.
Thanks to :
- https://github.com/eJuke/Leaflet.Canvas-Markers
- https://github.com/voluntadpear/vue-choropleth

## Dependencies
- `vue2-leaflet`
- `leaflet`

## Installation 
[npm package](https://www.npmjs.com/package/@simerca/vue2-leaflet-marker-canvas)

`npm i @simerca/vue2-leaflet-canvas-marker`

## Use

```html
<template>
    <LMap>
        <LTileLayer :url="https://tile.openstreetmap.org/{z}/{x}/{y}.png">
        <LCanvasMarker :markers="markers"/>
    </LMap>
</template>
```

```js
import L from leaflet;
import {LMap, LTileLayer} from 'vue2-leaflet';
import {LCanvasMarker} from 'vue2-leaflet-canvas-marker';
export default {
    computed:{
        markers(){
            let markers = []
            for(var i = 0; i < 1000; i++){
                let lat = Math.random()*360 - 180
                let lng = Math.random()*360 - 180
                var icon = L.icon({
                    iconUrl: 'img/marker-icon.png',
                    iconSize: [20, 18],
                    iconAnchor: [10, 9]
                });
                markers.push(L.marker([lat, lng], {icon:icon}).bindPopup(`Hello ${i}`))
            }
            return markers
        }
    }
    components:{
        LMap,
        LTileLayer,
        LCanvasMarker
    },
}
```

## Your welcome !

Star me on github !

https://github.com/Simerca/vue2-leaflet-canvas-marker
From Front End to DevOps with no CS degree
Tags: beginners, devops, webdev
Published: 2021-07-21 07:57:24

---
title: From Front End to DevOps with no CS degree
published: true
date: 2021-06-23 19:03:17 UTC
tags: beginner, devOps, webdev
canonical_url: https://www.nocsdegree.com/front-end-dev-ops-no-cs-degree/
---

 ![From Front End to DevOps with no CS degree](https://www.nocsdegree.com/content/images/2021/06/Pauline-YouTube-interview-2.png)

Pauline Narvas joins me for an interview on YouTube about being a self-taught web developer, getting hired and learning DevOps.

Pauline went from being the old girl in her high school computing class (and putting up with the jerks that told her she didn't belong) to getting hired as a developer for major UK companies like BT. She has learned not only front end development but also DevOps as she has delved into the world of AWS and kubernetes.

Pauline gives an enthusiastic account of being a woman in tech, learning to code and the joys of lifelong learning. Feel free to listen on the [podcast](https://share.transistor.fm/s/0520286d) or watch on YouTube.

<iframe width="200" height="113" src="https://www.youtube.com/embed/Kdh9GoPSMWw?list=PLRWC-Wmmcj0mN8CIkohVm85I199nRW4xs" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
How I Created These Generative Underline Pen Strokes
Tags: codepen, sketch, react, svg
Published: 2021-06-23 19:02:23

*(Scroll down to see a live demo, or see it on [CodePen](https://codepen.io/ykadosh/pen/bGqJKqJ))*

I created a small React component that adds a randomly generated pen stroke underline to a given word.

The strokes are rendered using an SVG `<path/>` element. They vary in thickness and shape, and they take the width of the text that they underline.

### Rendering The Strokes

I used an SVG element with a single `<path/>` to render the strokes. The `<path/>` has a `d` attribute specifying a series of commands and coordinates, defining the shape of the path. The `path` element is the most powerful SVG element, and I use it often when creating SVG graphics. You can learn more about it in [this great MDN tutorial](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths).

I'm using the `Q` command, which is a simple command for generating curves. I'm randomly generating a series of 2-4 curves alternating from left to right, each of which is angled a bit differently, and placed a bit lower that the previous one.

Here's the code:

```js
// Draw the lines
while (line++ < lines) {
  const y = line * (height / lines); // Draw every line lower than the previous one
  d += ` Q ${random(30, 70)}` + // The x coordinate of the curve's center
       ` ${random(y - 5, y + 5)}` + // The y coordinate of the curve's center
       ` ${line % 2 === 0 ? random(-5, 15) : random(85, 105)}` + // The x coordinate of the curve's end, alternating between right to left based on the current line number
       ` ${random(y - 2, y + 2)}`; // The y coordinate of the curve's end
}
```

### Maintaining Stroke Width Consistency

SVG elements can scale up/down, but they maintain the ratio given by their `viewBox` attribute. That includes the stroke width.

For example, if our `viewBox` is defined to be a `100x100` square (i.e. `viewBox="0 0 100 100"`), and we set the `width` and `height` of the element to be `200x200`, everything inside the SVG will scale by a factor of 2. A `stroke-width` of `10px` will be rendered as `20px`.

Since the SVG element takes the width of the given word, the stroke width can scale up or down based on the word's length. To avoid that, i'm using the following CSS rule:

```css
vector-effect: non-scaling-stroke;
```

### Maintaining Stroke Height Consistency

The issue described above can also affect the coordinates of the `<path/>` itself, not just the width of the stroke.

In my case, I wanted the SVG's height to remain consistent, and let the width change based on the word's length instead of maintaining the ratio given in `viewBox`.

To do that, I used the following attribute:

```jsx
<svg preserveAspectRatio="none">
```

See it live on CodePen:

{% codepen https://codepen.io/ykadosh/pen/bGqJKqJ %}
Setting the Request Method with Axios
Tags: javascript, node, axios
Published: 2021-06-23 19:01:56

[Axios](https://masteringjs.io/axios) is our recommended JavaScript HTTP client. While we are opposed to unnecessary outside dependencies, Axios has several advantages over `fetch()`:

* Axios is isomorphic, fetch is not
* Axios throws an error when a request fails
* Automatic JSON and Form-Encoded Serialization and Parsing
* [Interceptors](https://masteringjs.io/tutorials/axios/interceptors) and instances

Another reason is that Axios has neat helper methods that allow you to set the request method, like `GET` or `POST`. For example, below is how you can send an [HTTP GET request with Axios](https://masteringjs.io/tutorials/axios/get).

```javascript
const axios = require('axios');

const res = await axios.get('https://httpbin.org/get?answer=42');

res.data.args; // { answer: 42 }
```

Want to [send a `POST` request](https://masteringjs.io/tutorials/axios/post)? That's easy, just change `get()` for `post()` and pass the request body as the 2nd parameter.

```javascript
const res = await axios.post('https://httpbin.org/post', { hello: 'world' });

res.data.json; // { hello: 'world' }
```

## Calling [Axios as a Function](https://masteringjs.io/tutorials/axios/call)

If you prefer the [named parameters](https://masteringjs.io/tutorials/fundamentals/parameters) approach that `fetch()` uses, you can also set the request method by setting the `method` option as shown below.

```javascript
let res = await axios({
  method: 'GET',
  url: 'https://httpbin.org/get?answer=42'
});

res.data.args; // { answer: 42 }
```
Top pygame projects
Tags: beginners, python, learning
Published: 2021-06-23 18:53:22

Being a beginner myself, I recently got started on python and eventually Pygame. It is a collection of Python modules for video game development. If you want to become a game developer, learning Pygame is an excellent way to start.
To know more about it : https://www.pygame.org/docs/
For basic system setup and getting started: https://realpython.com/pygame-a-primer/

Here are top pygame project ideas-

##Flappy Bird
Flappy bird was popular few years ago. It is a simple game where the player controls the flight of the bird with a click and prevents it from crashing into obstacles. 
https://pygamezero-bird.readthedocs.io/en/latest/

##Snake game
Its an old favorite game which can be made using pygame. In the snake game, the player controls a snake which gains points by eating fruits present on the screen. The snake grows every time it eats fruit.
https://www.pygame.org/project/433

##Sudoku
Sudoku is a puzzle game where you have a 9×9 grid. The grid has nine squares, and you have to enter 1-9 digits in every square, row, and column. Sudoku’s catch is that the player can’t repeat a number in a row, column or square. 
https://thecodezine.com/sudoku-pygame-building-using-python/

##Dodge racing
This is also a popular game. It is basically a scrolling game where the player drives a car and dodges other incoming cars by changing lanes.
https://www.pygame.org/project/1523

##Ladybug Run
It is a clone of the very famous action maze chase- pacman game. The player controls the character through an enclosed maze. The objective of the game is to eat all of the dots placed in the maze while avoiding obstacles.
https://www.pygame.org/project/478

_For more games and ideas, visit -https://code-projects.org/t/pygame/_
Error-driven Development?
Tags: webdev, computerscience, discuss, development
Published: 2021-06-23 18:40:09

So… it is a beautiful Wednesday and an idea popped into my head. Error-driven development😲😲😲!!! Did a quick google search on it and realized it wasn’t just me that has gotten the revelation at some point😒. 

The unwritten consensus is that error-driven development is a pun on TDD and somewhat a methodology that enforces you to write errors and exceptions when things go or could go wrong as well as writing tests. Other ideas about the term range from the iteration of errors being a key force into the etymology of agile and how fixing and studying these errors over time could make you a better developer.

That was informative for me but I was however inspired in an unfamiliar direction.

And here are my thoughts:

Yes. Error-driven development should be a software development methodology. Which takes some ideas from other software methodologies such as agile, TDD, etc. 

So, my thoughts are, it should not be an alternative to TDD. Rather, it is a variation. Here are some principles I came up with:


* Error-driven development is based on the principle that to disrupt is to forget. So on the successful pass of a test case, it forgets that the test case has been passed by invalidating it with the next most interesting insight. 

* Error-driven development would eventually disrupt the original requirements rather than build or extend the requirement.

* Hence, there is a requirement in the beginning but the requirements are forgotten as iteration increases. 

* Unlike the Agile methodology, error-driven development does not iterate or consider changes based on business value. Instead, it iterates based on the quality of insight. The most insightful knowledge gained from the last-passed test case is the point for invalidation.

* Error-driven development is then best suited for non-commercial products. And experimental or research-based project and programs of a long-span whose primary aim is to gain insights(It is amazing that software development which is science is largely concerned with commercial value and have less interest in experiments and hypotheses testing anyway).

So, let’s discuss. Is error-driven development worth a try based on these principles?
WebSocket Postman - Making Your First Web Socker Call with POSTMAN Demo.
Tags: testing, postman, qa, beginners
Published: 2021-06-23 18:12:58

In this video, we are going to learn about the WebSocket Postman and how to make WebSocket call in postman.

What is Web Socket?
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection.


{% youtube Xpc-pPA55GM %}

✅API Testing - 
https://www.learnapitesting.com

✅Cypress Tutorial with LIVE Projects -
http://cypresstutorial.com

#websocketpostman #websocket #postman
Instalando asdf e Golang no Ubuntu 20.04
Tags: asdf, linux, go, portugues
Published: 2021-06-23 18:00:27

## Sobre

Estava tentando testar essa ferramenta para gerenciamento de linguagens e ferramentas, segue o caminho que trilhei da instalação até ter o executável da linguagem que desejava, golang no caso, disponível na linha de comando:

## Instalação
```
# sudo apt install curl git
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.1
```

## Configuração

Abra o arquivo ~/.bashrc e adicione as seguintes linhas:
```
#
# asdf - language/tools version manager
#
source ~/.asdf/asdf.sh
source ~/.asdf/completions/asdf.bash
```
Execute:
```$ . .bashrc```

Pronto, basta testar:

```$ asdf info```

## Golang

Para instalar a linguagem Go por exemplo, basta:

```
$ asdf install golang 1.16.5
$ asdf global golang 1.16.5
$ asdf shell golang 1.16.5
```

E para verificar a instalação:

```$ go version```
Um pouco sobre minha paixão literária
Tags: leitura
Published: 2021-06-23 17:30:18

Tenho atualmente 25 anos, e desde muito novo gostei de ler.
Mas essa paixão só ficou mais fervorosa depois dos 20.

Turante muito 'muito' tempo li de forma errada, queria ler rápido para abar rápido e assim adquirir mais conhecimento rápido. 

Mas no em tento não funciona assim, quando você lê, é um dialogo entre você e o autor e isso precisa de calma.

Quando era mais novo eu não conseguia me concentrar para ler, ai recorri a 'técnicas' de leitura dinâmica e coisas do gênero. No piorou nunca funcionaram comigo.

Então passava os olhos pelas letrar lia, mas devido à minha pouca concentração nada ficava armazenado e pior, me frustrava muito, ficava buscando alguma técnica mágica, isso não existe.

Bom então como eu me tornei um leitor 'de verdade', é uma coisa bem simples, na verdade. Primeiro calma, como disse anteriormente é uma conversa entre você e o leitor, eu leio na velocidade que eu falo um pouco mais lento, na verdade, enquanto isso imagine a história isso faz com que você ocupe a sua mente com somente a história que você esta lendo.

Isso provoca um milagre na sua mente, quando você começar a ler e a história simplesmente colar no teu cérebro isso é incrível, no primeiro livro ou segundo pode dar uma sensação de tédio, mas com o tempo isso é substituído por uma sensação de satisfação por quilo que esta lendo.

Algumas, pessoa vão pensar isso é muito lento, eu preciso que uma técnica para ontem, primeiro isso não existe, segundo a velocidade e a quantidade de leitura só aumentam devido à frequência. Espero que gostem deste conselho!