teleren/devto huggingface dataset:
Async Javascript & how it works👩‍💻
Tags: javascript, webdev, beginners, tutorial
Published: 2022-07-13 11:32:16

As we discussed [earlier](https://dev.to/aishanipach/execution-of-js-code-44ea), javascript is a single-threaded, synchronous language. But a lot of time we observe *async javascript* in different courses and modules, which kind of invalidates the above statement. Let's try to understand this.

We know javascript has a **call stack** which has the global execution context. When a function in executed, a new execution context is pushed to stack and popped once the function has returned.

Now there are a lot of functions made available by browser which take time and if pushed to stack can block it, also known as **blocking the main thread**. These functions, hence, were made **asynchronous**. Look at this example with `setTimeout`:


```javascript
console.log("hello, let's go!")

setTimeout(()=>{
    console.log("We are back for a quest.")
},7000)

function greet(){
    console.log("Adventure time...")
}

greet();
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3lakj06ve1lslddp4ho.png)
The callback arrow function in `setTimeout` is shown in console after 7000ms. Let's take a look how does this happen.

### Behind the scenes of Async Javascript:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkvsdque3wxmkwxs4ydf.png)
 
We'll work around this figure and understand the whole thing.

- Initially, there is the **global execution context pushed into the call stack** and the `console.log("hello, let's go!")` is executed. 

- Once we reach **`setTimeout()`** (Web API, not a part of JS), the **timer** provided by browser is set to 7000ms (as in the code) and is not executed. 

The callback function is pushed to the **task queue** once the timer goes off.

- Now, it moves forward and encounters `function greet()`. Functional programming is the strongest suite of JS and hence a **new execution context is created and pushed in the call stack**. 

- Once the function is executed and the end of script is reached, **global execution context is popped**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6r4lwb8v7z3ly2k39v9z.png)
 

The **event loop's** purpose is to check whether the call stack is empty or not. As soon as the **stack is empty (& only when it is empty) and the timer has gone up**, it removes callback function from the queue and **pushes it in the call stack for execution**.

The callback function just sits in the web APIs environment until timer goes off.

>there is also multitask queue that basically handles functions with higher priority, involving promises and change in the DOM tree. 
🌟[Using microtasks in JS by MDN Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide)
>🌟[Asyn Javascript by James Q](https://youtu.be/670f71LTWpM)
How to remove git from Android Studio Project
Tags: git, androidstudio, gitrepositories, gitremove
Published: 2022-09-04 09:32:49

---
title: How to remove git from Android Studio Project
published: true
date: 2022-07-13 11:31:51 UTC
tags: git,androidstudio,gitrepositories,gitremove
canonical_url: https://medium.com/@jayknow/how-to-remove-git-from-android-studio-project-e4cc938a6d0b
---

![](https://cdn-images-1.medium.com/max/1024/1*OjyxuWEQYu1YuurOxoFIew.png)

**Sometimes a developer wants to change the old git repository url to New or remove git tracking history and push the code as a fresh new project.**

To remove git from Android Studio Project, we need to follow two steps:

1. Removing the .git hidden folder
2. Removing git path from Version Control

#### Step 1: Removing the .git hidden folder

If we skip this step, our git tracking history is still not deleted. Now when we re-enable VCS, Our project binds with the older repository.

We can remove the .git folder by going to the project repository folder and deleting the .git hidden folder Or

Also, we can use Command-line in Android Studio Terminal:

**Windows:** rd /s /q “.git”

**Linux/Mac:** rm -rf .git

![Write the above command in the Android Studio terminal to remove the .git folder successfully.](https://cdn-images-1.medium.com/max/1024/1*k_QZzssTsW0sxSClHTG4YA.png)

By doing this step, we can still see the git section at the bottom of the Android Studio, And also you can manually check the git menu. There is no “Enable Version Control” option. So we need to do Step 2.

#### **Step 2** : Removing git path from Version Control

To remove Git binding from the Android Studio Project, you need to do the Following Steps:

- Open the **Preferences** window by clicking **File > Settings** (on Mac, **Android Studio > Preferences** ).

1. Click on **Version Control**
2. Select project path
3. Click ‘-’(minus button)
4. Click **Apply** and **Ok** to save your changes

![Follow the above steps to remove git successfully.](https://cdn-images-1.medium.com/max/1024/1*r76qzkie7Vb_RBRJcb0s1w.png)

Now we can Enable Version Control and create a new git repository. Be sure to give heart if you find this article helpful.
Top 3 Aplicativos para programar usando o celular
Tags: beginners, programming, mobile, tutorial
Published: 2022-07-13 11:30:12

## Nesse post você vai descobrir 3 opções de aplicativos para começar a criar seus primeiros código ou até utilizar como ferramenta principal para seus projetos Front-End.

___

### Como prova  que é possível realizei o teste desenvolvendo exercícios do curso Input da [Codar.me](https://codar.me/input), e abaixo você conferir todo processo de desenvolvimento através do aplicativo _<u>Spck Code Editor / Cliente Git</u>_ que se destacou comparado as outras opções.


{% embed https://youtu.be/UG9E8RC2y9g %}


___


![Dcoder, Compiler IDE : Code & Programming on mobile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgq9jhb1qsp5gegs153o.png)

- 🥉Bronze

#### Dcoder, Compiler IDE : Code & Programming on mobile

Para ter acesso a suas funções é necessário criar uma conta, após isso é possível criar ou clonar repositórios do GitHub ou criar um projeto onde será armazenado diretamente na memoria do seu dispositivo, a plataforma tem suporte a diversas linguagens e contem uma opção com a estrutura de HTML, CSS e Javascript prontos para serem utilizados sem a necessidade de criar um documentos separados e vincular entre eles. 


[Play Store Android](https://play.google.com/store/apps/details?id=com.paprbit.dcoder)

[App Store IOS](https://apps.apple.com/us/app/dcoder-code-compiler-ide/id1488496978)

___

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

- 🥈Prata

#### TrebEdit - Editor de HTML

Não é necessário de login para ter acesso as suas funções, é possível criar projetos simples de front-end e armazenar na memoria do dispositivo, não é tão intuitivo já que não tem disponível a função **autocompletar** de tags HTML e atributos de CSS sendo também necessário criar o arquivo **css** e vincular no **html** como é feito normalmente através de uma IDE para desktop.

[Play Store Android](https://play.google.com/store/apps/details?id=com.teejay.trebedit)


___


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7c6rkvjqkfae81i20vql.png)


- 🏆🥇 Ouro

#### Spck Code Editor / Cliente Git

Sem duvidas o melhor dos aplicativos listados nesse post não é necessário de login para ter acesso a suas funções e é possível criar e conectar repositórios do github além de possuir emmet e autocomplete de tags e atributos HTML e CSS na qual facilita e torna muito intuitivo e ágil o desenvolvimento também é possivel criar projetos com React, Vue e Angular entre outras integrações.


[Play Store Android](https://play.google.com/store/apps/details?id=io.spck)

[App Store IOS](https://apps.apple.com/us/app/spck-editor/id1507309511)
Benefits of Online Learning
Tags: online, onlinelearning, beginners
Published: 2022-07-13 11:23:01

You can enroll in the programme of your choosing without having to relocate to a different city or make a long commute thanks to online courses. While working to advance your profession with an online, you can remain in your current location and keep your employment.

You can connect, participate in, and communicate with your peers and teachers in a variety of ways while you learn online.

Reduced costs are another benefit of online education. Compared to traditional schooling, online education is far less expensive.

[Online education](https://www.hindustantimes.com/brand-stories/insideaiml-launches-100-job-guarantee-program-with-asktalos-101657175834785.html) is an excellent option if you want to keep working at your present employment while getting your degree. You can combine both work and school; you don't have to pick one over the other.
Reading lines from a Zstd archive in Common Lisp
Tags: zstd, commonlisp, readline
Published: 2022-07-13 11:14:36

---
title: Reading lines from a Zstd archive in Common Lisp
published: true
description: 
tags: zstd,commonlisp,readline
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

# Reading lines from a Zstd archive in Common Lisp

I have a big line-separated JSON file, compressed in Zstd format. I will call this file data.ndjson.zst.

I want my program to read the file line by line. I can use https://github.com/glv2/cl-zstd to make a binary stream from the file. Still, I can run the function read-line of a binary stream. So I need to wrap the binary stream with Flexi-stream. 

```Lisp
(ql:quickload 'flexi-streams)
(ql:quickload 'zstd)

(defpackage #:ex1
  (:use #:cl #:flexi-streams :zstd))
(in-package :ex1)

(with-open-file (f #P"data.ndjson.zst"
		   :element-type '(unsigned-byte 8)
		   :direction :input)
  (with-decompressing-stream (zstd-stream f)
    (let ((s (make-flexi-stream zstd-stream
				:external-format (make-external-format :utf-8))))
      (loop for line = (read-line s nil nil)
	    until (null line)
	    do (print line)))))
```
Printing those lines is a realistic example. So you can replace (print line) with your practical applications, for example, parse a JSON line and extract a book title.
Good to be in this community.
Published: 2022-07-13 11:13:23

Hello everybody
My name is Ayomide Gbadebo, i'am Nigerian.
I found you guys while making research in the course of improving my skills.
i'am learning web developing, with hope of tansiting to Web3 and Blockchain Development.
My interest is to know the HTML, CSS and JavaScript languages, to try to develop some project.
I hope to learn from the bank of experience of you all. Thank y'all.
Diagrama de Caso de Uso
Tags: php, software, uml
Published: 2022-07-13 10:59:22


Diagrama de caso de uso é um digrama usado para representar a interação entre os usuários e as funcionalidades do Sistema. O diagrama de caso é extraído dos requisitos fornecidos pelo cliente.

## Elementos de um diagrama de caso de uso
- Caso de Uso: Representação de um Requisito do Sistema. É representado por uma elipse com texto;
- Actor: Elemento que interage com o sistema. Pode ser um usuário ou outro sistema externo. É representado por um desenho;
- Relacionamentos: Associação, generalização, inclusão e extensão. Representado por linhas contínuas, descontínuas e setas.

## Inclusão e Extensão entre caso de usos (Include e Extend)
Se tivermos 2 casos de uso A e B, podemos ter os cenários.
- Inclusão: A depende de B, ou seja, A só acontece se B acontecer. Ex: Para filtrar as candidaturas, é necessário o Submeter a candidatura.
- Extensão: Ao executar A, podemos ir para B ou C. É um caso uso opcional. Ex: Ao visualizar uma candidatura, podemos validar ou revogar (extend).


## Como descrever um caso de uso detalhadamente?
O caso de uso pode ser descrito de várias formas, das quais podemos destacar:
- Descrição Narrativa;
- Tabela de Interação entre o actor e o sistema;
- Diagrama de Actividades;
- Fluxograma.

## Implementação de um caso de uso
Na implementação do software, um caso de uso será uma funcionalidade do sistema e os actores serão os perfis de usuário do sistema.
A implementação de um caso de uso, pode implicar a chamada de diferentes objectos, métodos ou funções. Por ex: Na inscrição de um candidato, é necessário guardar os dados pessoais e criar o perfil de usuário.

**Sugestão: **Um caso de uso também pode ser utilizado para nomear as rotas do sistema ou rotas de uma API. Ex: Submeter Candidatura --> candidaturas/submeter, Filtrar Candidaturas --> candidaturas/filtrar.

## Exemplo Prático
Criação do diagrama de caso de uso simples, para um Sistema de Recrutamento e Selecção e a Descrição do caso de uso ‘Efectuar Inscrição’.
**Ferramenta:** Astah Professional
**Linguagem:** PHP



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qm2b5p8xnkq28dtibnfh.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hx2xtxuek8wtc8xbcg3p.jpg)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z51mxc7zlbqedkeg2r1r.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e0jubxp6se347lfcd2nw.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/onnrdlagqruen4licp0l.png)



Para mais artigos: 
[](https://www.dev.to/ortizdavid)
[](https://www.medium.com/@ortizaad1994)
SOLID Principle & Clean Architecture in Flutter App.
Tags: flutter, programming, android, codenewbie
Published: 2022-07-13 10:55:26

One picture for summarizing the **S.O.L.I.D. principles**, & **Clean architecture** in a **Flutter application.** 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7251gtpuqjeibnm6xsu.jpg)


You might ask: What the heck is the S.O.L.I.D. principles? 🤔

## S.O.L.I.D. STANDS FOR:
☞ S — Single responsibility principle.
☞ O — Open closed principle.
☞ L — Liskov substitution principle.
☞ I — Interface segregation principle.
☞ D — Dependency Inversion principle.

[Source Link](https://github.com/babakoto/flutter_SOLID_principles-clean_architecture)
Managing multiple node versions with NVM
Tags: node
Published: 2022-07-13 10:48:58

While working on multiple projects, some of them may use different node versions.

This can be a real pain point when you accidentally ran npm install or npm update with a different npm version.

To address these issues, we get something unique called nvm.
It stands for: Node Version Manager.

And it can be used to switch between different node versions on your local machine quickly.

## Installing NVM

The easiest way to install NVM is by using [Homebrew](https://daily-dev-tips.com/posts/homebrew-one-package-manager-to-rule-them-all/).

Run the following command:

```bash
brew install nvm
```

Once installed, you must add it to your preferred profile file so we can use it globally.
A profile file can be one of these: (`~/.bash_profile`, `~/.zshrc`, `~/.bashrc`).

Once you have identified it, add the following lines.

```bash
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
```

This will ensure that you can run the nvm commands every time a terminal opens.

We can quickly test if it works by running the following command in a terminal.

```bash
nvm -v
```

This should output the version of nvm you are using.

## Installing and using different node versions

The idea behind nvm is that we can install and manage multiple node versions.

The first step is to install the versions we might need.

```bash
nvm install 16

nvm install lts

nvm install 12.14.3
```

The above are all accepted node versions you can install.

Once we have them installed, we can use the following command to use them.

```bash
nvm use 16

nvm use lts

nvm use 12.14.3
```

## Pro tip

Add a `.nvmrc` file to the root of your project. In there, add the version of the node this project uses.

For instance, a file could have node 12.14.3. We can then add the `.nvmrc` file and the following content.

```text
12.14.3
```

Now when you open the project in your favorite editor, you can run the `nvm use` command, and it will install the version defined in the `.nvmrc` file.

Bonus tip:
A great visual studio code plugin does this every time you open a project!

[Download the NVM VSC plugin](https://marketplace.visualstudio.com/items?itemName=abumalick.vscode-nvm)

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Jetpack compose: Custom animations
Tags: android, androiddev, programming, animations
Published: 2022-07-13 10:42:12


## Wanna learn how to design custom [animations](https://blog.canopas.com/animations-in-jetpack-compose-with-examples-48307ba9dff1) in [Jetpack Compose](https://blog.canopas.com/jetpack-compose-mvvm-state-management-in-a-simple-way-4c632fa6f554)?

This article will help you learn how to implement super cool custom animations using Jetpack compose in [Android](https://blog.canopas.com/android-drag-and-drop-ui-element-in-jetpack-compose-14922073b3f1).

### We are going to implement four different animations in this post.

1. **Heartbeat animation:** This animation contains a heart-shaped image and we will animate it in such a way that it looks like a beating heart.

2. **Wiggle animation:** In this animation, we will have a square box and we will provide a wiggling effect on the box.

3. **Flash animation:**In this animation, we will have a square box and we will provide a flashing effect on the box.

4. **[Chasing circle animation](https://blog.canopas.com/progress-animations-in-jetpack-compose-with-examples-eb76cc28fbb6)**: This animation contains multiple arcs and a circle and we will provide scaling and rotating effects on them.

Don’t worry if you didn’t get all the animations.

Check out the project on [GitHub](https://gitlab.com/cp-hardik-p/customanimations) for the complete working solution and example.

Read full version of this post on [canopas blog](https://blog.canopas.com/jetpack-compose-custom-animations-550dcdcded83).
A common pitfall when using sizeof() with pointers
Tags: clang, cpp, pointers, programming
Published: 2022-07-13 10:42:00

There is a common mistake made by new student when they use `sizeof` operator with pointers to get number of bytes allocated.

> **NOTE**: `sizeof` returns the size in bytes and 1 byte = **8 bit**

```c
#include <stdio.h>
#include <stdlib.h>

int main() {
    char *c = malloc(10);

    printf("Bytes allocated: %ld\n", sizeof(c));
    return 0;
}
```

They expect the output of above program as **_10 bytes_**. But it doesn't work like that.

The output will be

```bash
Bytes allocated: 8
```

**But why? When we allocated 10 bytes then it should output 10 bytes. Why It is showing 8 bytes?**

Then answer to this question is in the above code we are not measuring the amount of bytes allocated but the _size of pointer_ which will be 8 bytes for all 64 bit compiler and 4 bytes for 32 bit compiler. (My compiler is 64-bit)

So If one want it to get later it should be store in some variable explicitly.

Now the question how we are able to do same for an array which also behaves like pointer.

Let's check the below example.

```c
#include <stdio.h>
#include <stdlib.h>

int main() {
    int c[10];

    printf("Bytes allocated: %ld\n", sizeof(c));
    return 0;
}
```

**Output**

```bash
Bytes allocated: 40
```

The output of above program is as expected because the size of int is 4 bytes so total 4x10 = 40 bytes it returns.

In the above statement it said array behaves like pointer but it isn't. It is allocated in stack not heap that may be one of the reason that `sizeof` is able to get size of bytes allocated to an array.

---

❤️Thank you so much for reading it completely. If you find any mistake please let me know in comments.

Also consider sharing and giving a thumbs up If this post help you in any way.
935. Leetcode Solution in cpp
Tags: cpp
Published: 2022-07-13 10:39:41

```
class Solution {
 public:
  int knightDialer(int n) {
    constexpr int kMod = 1e9 + 7;
    const vector<pair<int, int>> dirs = {{-2, 1}, {-1, 2}, {1, 2},   {2, 1},
                                         {2, -1}, {1, -2}, {-1, -2}, {-2, -1}};

    // dp[i][j] := # of ways to stand on (i, j)
    vector<vector<int>> dp(4, vector<int>(3, 1));
    dp[3][0] = dp[3][2] = 0;

    for (int k = 0; k < n - 1; ++k) {
      vector<vector<int>> newDp(4, vector<int>(3));
      for (int i = 0; i < 4; ++i)
        for (int j = 0; j < 3; ++j) {
          if (isNotNumericCell(i, j))
            continue;
          for (const auto& [dx, dy] : dirs) {
            const int x = i + dx;
            const int y = j + dy;
            if (x < 0 || x >= 4 || y < 0 || y >= 3)
              continue;
            if (isNotNumericCell(x, y))
              continue;
            newDp[i][j] = (newDp[i][j] + dp[x][y]) % kMod;
          }
        }
      dp = move(newDp);
    }

    int ans = 0;

    for (const auto& row : dp)
      for (const int a : row)
        ans = (ans + a) % kMod;

    return ans;
  }

 private:
  bool isNotNumericCell(int i, int j) {
    return i == 3 && (j == 0 || j == 2);
  }
};

```
#Leetcode
#challende
Here is the link for the problem:
https://leetcode.com/problems/knight-dialer/
Jetpack compose Custom animations
Tags: android, androiddev, animations, jetpackcompose
Published: 2022-07-13 10:38:07


## Wanna learn how to design custom [animations](https://blog.canopas.com/animations-in-jetpack-compose-with-examples-48307ba9dff1) in [Jetpack Compose](https://blog.canopas.com/jetpack-compose-mvvm-state-management-in-a-simple-way-4c632fa6f554)?

This article will help you learn how to implement super cool custom animations using Jetpack compose in [Android](https://blog.canopas.com/android-drag-and-drop-ui-element-in-jetpack-compose-14922073b3f1).

### We are going to implement four different animations in this post.

https://cdn.hashnode.com/res/hashnode/image/upload/v1657707693100/47e5jaar7.gif  

{% embed https://cdn.hashnode.com/res/hashnode/image/upload/v1657707693100/47e5jaar7.gif %}. 

1. **Heartbeat animation:** This animation contains a heart-shaped image and we will animate it in such a way that it looks like a beating heart.

2. **Wiggle animation:** In this animation, we will have a square box and we will provide a wiggling effect on the box.

3. **Flash animation:**In this animation, we will have a square box and we will provide a flashing effect on the box.

4. **[Chasing circle animation](https://blog.canopas.com/progress-animations-in-jetpack-compose-with-examples-eb76cc28fbb6)**: This animation contains multiple arcs and a circle and we will provide scaling and rotating effects on them.

Don’t worry if you didn’t get all the animations.

Check out the project on [GitHub](https://gitlab.com/cp-hardik-p/customanimations) for the complete working solution and example.

Read full version of this post on [canopas blog](https://blog.canopas.com/jetpack-compose-custom-animations-550dcdcded83).
912. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-13 10:38:00

```
class Solution {
 public:
  vector<int> sortArray(vector<int>& nums) {
    mergeSort(nums, 0, nums.size() - 1);
    return nums;
  }

 private:
  void mergeSort(vector<int>& A, int l, int r) {
    if (l >= r)
      return;

    const int m = (l + r) / 2;
    mergeSort(A, l, m);
    mergeSort(A, m + 1, r);
    merge(A, l, m, r);
  }

  void merge(vector<int>& A, int l, int m, int r) {
    vector<int> sorted(r - l + 1);
    int k = 0;      // sorted's index
    int i = l;      // left's index
    int j = m + 1;  // right's index

    while (i <= m && j <= r)
      if (A[i] < A[j])
        sorted[k++] = A[i++];
      else
        sorted[k++] = A[j++];

    // put possible remaining left part to the sorted array
    while (i <= m)
      sorted[k++] = A[i++];

    // put possible remaining right part to the sorted array
    while (j <= r)
      sorted[k++] = A[j++];

    copy(begin(sorted), end(sorted), begin(A) + l);
  }
};

```

#Leetcode
#challende
Here is the link for the problem:
https://leetcode.com/problems/sort-an-array/