teleren/devto huggingface dataset:
COVID-19 Tracker
Tags: django, webdev, javascript, mapbox
Published: 2022-02-14 19:53:41

Hello Everyone,

📢

I hope everyone is staying safe.

Today I have launched a new website to track covid-19 cases around the world, and on the website, you can find the statistics of each country, geographic coordinates over the map, filtering results based on the dates, etc. Every 24 hours, the website will show updated daily results for each country.

Please visit the website at 👉 [https://covid19tracker.info](https://covid19tracker.info)

To share my development work with the community, I have made the complete development open-source on my GitHub and if you've any new ideas or suggestions and would like to contribute to this project, then feel free to raise a PR request.

**GitHub link** - [https://github.com/anshumanpattnaik/covid-19-tracker](https://github.com/anshumanpattnaik/covid-19-tracker)

If you like the project work, please give stars ⭐ to this repository that will encourage me to continue further & do more development and add new features to this website.

To generate traffic, please share the website link on your social media so everyone will be aware of this Covid-19 Tracker website.

Thanks
Getting Started With Modern JavaScript
Tags: javascript, beginners, webdev, luxacademy
Published: 2022-02-14 19:50:57



## Introduction to modern JavaScript_

### A Brief History On Javascript

JavaScript was created  by  Brendan Eich  in 1995 it was initially known as LiveScript but later on changed to JavaScript so as to position it as a companion to java programming language. 

### What is JavaScript?
JavaScript is a scripting language, its one of the popular programming languages. Initially js was mainly used  for making webpages interactive such as form validation, animation, etc. Nowadays, JavaScript is also used in many other areas such as server-side development, mobile app development and so on.

### Basics in JavaScript


1. Variables
2. Datatypes
3. comments
4. Functions
5. Objects
6. Arrays

####Variables
variables are containers that store data values,in JavaScript you can declare variables using 3 keyword var, let  or  const .JavaScript is a loosely -typed language you don't have to  specify datatype when declaring variables .

`var name ='jules'`
`const nationality = 'Kenyan'`
`let age = 12`
 
####Datatypes
The term datatypes refers to the type of values a program can work with.JavaScript variables can hold a number of data types 
 

```
let year = 1995; // datatype is a number
let name = 'jules is a kenyan '; // datatype is a string 
let isAHoliday= true // datatype boolean ,takes true or false
const price  = 45.55 // datatype float ,a number with decimals
```

####Comments
comments are block of statements that don't get executed.They make our code more readable to others so be kind and comment*smiles

```
// this a single line comment
/* 
   this is
   a mutiple-line 
   comment

*/
```
*

####Functions
A function is block of code that performs a specific task.
Advantages of using functions is 

1. Can be reused- define a code once use it many times.
2. Can use the same code many times with different arguments
   to produce different results

```
function name (){

//code to be executed
}

```

####Objects
JavaScript objects are  variables that contain many values written in form of `key:values`

```
let student ={
    name :'jules',
    age: 12;
    height: 153
}
```
####Arrays
JavaScript arrays stores multiple values in a single variable

```
// empty array
const myList = [ ];

// array of numbers
const numberArray = [ 2, 4, 6, 8];

// array of strings
const stringArray = [ 'eat', 'work', 'sleep'];

// array with mixed data types
const newData = ['work', 'exercise', 1, true];
```
Introduction to Modern JavaScript.  
Published: 2022-02-14 19:40:08


[](
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrt68314cb83czlaguy9.png))
**<u>JavaScript 101:</u>**
**_This is an introduction for Javascript begginers._**
Javascript i a powerful and flexible programming language that is basically designed to interact with webpage contents. It allows us to add dynamic behavior to the webpage and add special effects to the webpage. On websites, it is mainly used for validation purposes. JavaScript helps us to execute complex actions and also enables the interaction of websites with visitors.

The core ecosystem of JavaScript consists of 3 main components 
which are ECMAScript, JavaScript Engine, and the JavaScript Runtime . NodeJS and Google Chrome can use the same JavaScript Engine and yet have very different implementations of JavaScript for developers.

JavaScript is Case sensitive that is there is quite a big difference between these two words; nameString and namestring.
Semi-colons in JavaScript are used to terminate statements.
in JavaScript,<b>console.log()</b> is a special object included in browsers for developers to test and debug code in the interactive terminal.

<u>**Short History on the emergence of JavaScript.**</u>
JavaScript was introduced by NETSCAPE Communications with the aim of web design to help designers.
**NETSCAPE** later acquiesced JavaScript to **EMCA** international, in 1996, to establish the scripting language standards. in 1997 **ECMA** released ECMA-262 initial version of ECMAScript (**ES**) language.
The ECMAScript standards grant rules on the JavaScript features and architecture and ensures their is consistency between any new release version and the previous JavaScript version.
Following ECMAScript edition release in 1997, EC6 is the greatest update that aid JavaScript developers a great deal. Some of the main advantages of this version release is that it saves developers time and helps them write concise codes.

Some great features associated with the version include:
 1. classes creation.
 2. Arrow functions.
 3.let and const Keywords to declare variables.
 4. Default value parameters.

<b>u>JavaScript Source Code Editors.</u></b>
Most of the JavaScript code editors have syntax indentation, autocomplete, debugging and more features included.
Commonly used editors are:
   1.Visual studio  Code.
   2.Notepad ++
   3.Atom
Example of a hello world program in JavaScript.
 Type the word 'My first JavaScript program.'
console.log('My first JavaScript program');
log()- is used to print the values to the console.

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


JavaScript have Various area of concern that a beginner should go through in the process of learning to obtain enough skills. These areas  helps the learners to understand the language well and under stand it's structure in the best way.
The fundamentals area include:
  a. Data types
  b. Variables
  c. Methods
  d. Libraries
  e. Conditionals(loops)
  f. Scope
  g. Arrays
  h. Iterators
  i. Objects
Rapyd Developer Newsletter: December, 2021
Tags: fintech, payments, programming, python
Published: 2022-02-14 19:30:27


**[Explore Community](https://community.rapyd.net)** 

## **Discover**
**[97 Things Every Programmer Should Know](https://www.youtube.com/watch?v=3F3PZuN50s4)** `/videos`
Find ways to live your best developer life in this Rapyd Developer YouTube video with Kevlin Henney.

**[How to Integrate Checkout Using Python](https://www.youtube.com/watch?v=yL5TK4JfP7s)** `/videos`
Learn how to integrate Rapyd Hosted Checkout into your shopping cart.

**[How Avi Built the Ultimate Checkout Experience](https://www.rapyd.net/blog/avi-wolicki-winner-of-rapyd-hackathon-circuit-2-the-ultimate-checkout-experience/?utm_medium=email&_hsmi=196269002&_hsenc=p2ANqtz-9Ywc6KVuB4U8EIYNt02wD4AmrnDrve4DfEBHmdSLSkLwb9EmGmplRcC7J4mMjCLfJ0k9ViiN-rWeSEKDfx9Xeg21UCrg&utm_content=196269001&utm_source=hs_email)** `/posts`
Read what a cybersecurity expert, hackathons, and hosted solutions have in common.

**[Languages for Hosted Pages](https://community.rapyd.net/t/languages-for-hosted-pages/1318)** `/community`
Retrieve the most updated supported languages with a GET request.

```
https://sandboxapi.rapyd.net/v1/hosted/config/supported-languages  
```

##**Changelog**

**Client Portal:** Request Payment Methods - Updates to improve how clients request access to payment methods based on country and category rather than one specific payment method.

**Reports and Reconciliation:** Interchange - Enhancements to interchange reporting to now offer more detailed client reports with a breakdown of each card network transaction and interchange fees.

##**Share**
Let us know what you would like to see more or less of in this newsletter, or take this short [survey](https://rapyd.sjc1.qualtrics.com/jfe/form/SV_3avr0lw9WjuJNWK). Have what it takes? Then apply to become a Rapyd [Champion](https://docs.rapyd.net/build-with-rapyd/docs/developer-champions).

Talk code with us on [Twitter](https://twitter.com/RapydPayments) or [community](https://community.rapyd.net/).
Ultimate Python Guide
Tags: python, beginners
Published: 2022-02-14 18:46:35

1. ## **INTRODUCTION**
Python is a programming language that is used to write code for:

- data science

- machine language

- web development

**Reasons to use python**
 - It's easy to understand the code
- has a simple syntax
- enables users to write fewer lines of code
- the code is portable 

2. ## **Getting started with python**

 **Installation**
you can access the downloads from the python site.[](https://www.python.org/downloads/) 
after download, install to your machine
**how to check installation**
run the code below in CMD

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8o56ll88xid6q1128acf.jpg)
 The result should be as follows;

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

3. ## ** Writting first code**
python files have the extension .py example hello.py 
 we can write our hello world code in cmd editor
in the file saved as hello word.py
print("Hello, World!")
 Output 

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

4. ##Components of python

-  variables
they are used to store data values in python
example
 `x = 5
y = "John"
print(x)
print(y)`
Output will be

```
5
John
```

- lists
they are used to store multiple variables
`list1 = ["apple", "banana", "mango"]
print(list1)`
output

```
apple
banana
mango
```

- Sets
they store multiple items in a single variable
 example
`set = {"apple,mango, banana"}
print (set)`
Best Time to Buy and Sell Stock
Tags: beginners, python, dsa
Published: 2022-02-14 18:41:59

##Instructions
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

####Example

```
Input: prices = [7,1,5,3,6,4]
Output: 5
```
Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.
Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.

##Approach
To make a profit, you buy low and sell high. Therefore, we are looking for days where the price is low and when its high, we determine the difference and get maximum profit.

We can get a list of all the differences between prices on adjacent days using list comprehension then determine the max profit by finding the max between the prices.

```python
def maxProfit(prices):
    diff_prices = [prices[i+1] - prices[i] for i in range(len(prices) - 1)]
    max_profit = 0
    current_profit = 0

    for profit in diff_prices:
        current_profit += profit
        if current_profit < profit:
            current_profit = profit
        max_profit = max(max_profit, current_profit)
    return max_profit
        
```
##Approach 2
We will use two pointers, left and right, where the right is at left+1 to get the differences and update the pointers. Whenever we encounter a new minimum we will automatically update the left pointer to that value.

Python Implementation.

```python
 def maxProfit(self, prices: List[int]) -> int:
        maximum_profit = 0
        left = 0
        right = left+1
        while right < len(prices):
            if prices[right] > prices[left]:
                profit = prices[right]- prices[left]
                maximum_profit = max(profit,maximum_profit)
                right +=1
            else:
                left=right
                right +=1
        return maximum_profit
```
Docker, instalação
Tags: docker, backend
Published: 2022-02-14 18:33:38

Instalação  Linux Ubuntu
Via configuração de repositórios, pois isso facilita posteriormente a atualização desses mesmos pacotes.

- 1. Removendo versões antigas: sudo apt-get remove docker* containerd runc
- 2. Atualizando os pacotes: sudo apt-get update
- 3. Habilitando HTTPS para o apt:
- sudo apt-get install \
-     apt-transport-https \
-     ca-certificates \
-     curl \
-     gnupg \
-     lsb-release
- 4. Adicionando uma chave de acesso ao repositório remoto:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
- 5. Adicionando o repositório:
 echo \
   "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
   | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- 6. Última versão estável do Docker Engine - Commmunity:
sudo apt-get install docker-ce docker-ce-cli containerd.io
- 7. Adicionando um usuário ao grupo de usuários docker
- - dar as devidas permissões ao nosso usuário: sudo groupadd docker
- 8. Adicionar seu usuário a este novo grupo: sudo usermod -aG docker $USER
- 9. Para ativar as alterações realizadas aos grupos, você pode realizar logout e login de sua sessão, ou executar no terminal: newgrp docker
- 10. Caso o parâmetro Active esteja como stop/waiting ou no nosso caso, como inactive , rode o comando start para iniciá-lo: sudo systemctl start docker
- 11. Habilite o daemon do Docker para iniciar durante o boot : sudo systemctl enable docker
- 12. Validando a instalação: docker run hello-world

. Desinstalando o Docker Engine: sudo apt-get purge docker-ce docker-ce-cli containerd.io
. Para remover containers , volumes e configurações personalizadas que não são removidas automaticamente pelo apt-get , utilize os seguintes comandos:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
Async/await inference in Firefly
Tags: programminglanguages, firefly, javascript, computerscience
Published: 2022-02-14 18:25:40

Firefly is a new general purpose programming language that tries to achieve convenience and safety at the same time, by using pervasive dependency injection. There is no global access to the file system, the network, other processes or devices. Instead, you access these through a system object that is passed to the main function, which in turn can pass this object to other methods. The idea is to give the programmer fine grained control over which parts of the code can access what (Log4Shell anybody?), without introducing monads or other explicit effect tracking.

Continue reading: https://www.ahnfelt.net/async-await-inference-in-firefly/
Python 101: Getting Started With Modern Python
Published: 2022-02-14 18:13:43

Python is one of the top most sorted out programming language with a vast usage from web development  to data science and Machine Learning. Being a scripting language, python is not only easy to learn but also easy to write as it has English-like syntax.

Python has various data types which includes numerical values, string, data structure which includes list, tuple, set and dictionary.
Declaring a variable in python is as easy as below:
`name = Wambua`
You can define several variables in a raw as below:
`a, b, c = 1, 2,3`
To display an output in python, you use the function `print`
For example

```
name = 'Otieno'
age = 12
print(name)
```
Integers and floats are numerical data type in python. If you want know the type of data you are dealing with you use the function `type()`. For example:

```
age = 33
type(age) #int
```
String is another data type in python. Unlike other languages, python does not have a `character`. It therefore treats a character as a string of length 1.
To know the length of a string, python uses the function `len()`

```
name = 'Daniel'
result = len(name)
print(result) #6
```
Functions are blocks of code that do a specific job. In python, functions are defined as below:

```
def add_2(x):
return x+2

```
To call a function, you just have write the name of the function followed by parenthesis then passing the argument if any.

```
add_2(5)
```
 
Data structures in python are containers for storing data for processing. These includes 

-List
-Dictionary
-Tuples
-Set
We shall discuss in details the functionalities of the above data structures. Keep learning!!
Introduction to Modern Python
Published: 2022-02-14 17:42:20

Among the many programming languages in use today, Python is one of the top most commonly used languages. It has continued to gain popularity with the rise in technology, more so that has got to do with data. 

Python was first released by **Guido Van Rossum**, a Dutch programmer, in 1991. Since then, there has continued to be more releases with the improvements made in its development. It is meant to be an easy to learn language.
There are several IDES and core editors that support the language including Anaconda Jupyter, VS Code and PyCharm just to mention a few. One must have one of the environments installed in order to start coding, most of which are available online and are easy to set up.


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

Some python characteristics, which make it among the most preferred languages include its simplicity and portability, it has huge libraries and is object oriented. Being an open-source language, Python is freely usable and distributable, even for commercial uses.

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


Python has been implemented in artificial; intelligence, designing desktop applications, automation, web development as well as data wrangling, exploration and visualization. It has proven to be a functional and advantageous.

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

The four programming techniques that python supports include:
1.	Object-oriented programming
2.	Functional oriented programming
3.	Imperative oriented programming 
4.	Procedural oriented programming


As a beginner, they are several key concepts you have to grasp. These will make it easy for you to understand tough concepts as you advance in the language. You have to understand and differentiate between keywords, identifiers and literals. Once you understand what each of the above does, it becomes easier to structure a project.
 For example, Literals are given in different formats, you have to understand the difference between a string and a Boolean. This way, you know when to use what and you are able to minimize errors.
You also learn how to work with operators, use loops and conditional statements, different data types and data structures. Most importantly, you know how to invoke functions. 


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

These are some of the basic skills that you would learn in Python 101. By playing around with the basics you gain more expertise and what appeared difficult becomes a hobby, before you realize, you are applying python to solve real-life problems and predict the future. Isn't that fun!
Two Sum
Published: 2022-02-14 17:41:00

##Instructions
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.
###Example

```python
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].
 
```
##Approach

We can use a hashmap to store the elements and check if the difference exists and return the indices of the elements.
####Breakdown
We initialize an empty dictionary, iterate through the nums array, check the difference between target and a given element. 

```python
def twoSum(self, nums: List[int], target: int) -> List[int]:
        hashmap={}
        for (count,num) in enumerate(nums):
            difference = target-num
            if difference in hashmap:
                return [hashmap[difference],count]
            hashmap[num]=count
        return
```
The enumerate() method adds a counter to an iterable and returns it in a form of enumerating object. 
Syntax: 
`enumerate(iterable, start=0)`
The counter starts at 0 by default although you can specify the preferred index value from which the counter should start.

The solution to similar problem 3Sum can be found [here]().
Partner SAGA
Tags: architecture, microservices
Published: 2022-02-14 17:34:39

Como falado no post anterior, o uso da arquitetura baseada em micro serviços vem crescendo ao longo dos últimos anos. É inquestionável os benefícios do uso desta arquitetura, entretanto o uso dela traz consigo algumas problemáticas e uma delas é o gerenciamento de dados.

O padrão SAGA é uma das possíveis soluções para este problema, há duas maneiras de implementação de um SAGA, são elas: **Coreografia** e **Orquestração**. No decorrer do post irei explicar um pouco mais sobre cada uma delas.

Com o partner  SAGA, todo serviço que realiza a transação publicará um evento. O serviço seguinte que executa a próxima transação em cadeias será acionado pela saída da transação anterior e continuará até a última transação encadeadas (Coreografia) ou também podemos ter uma micro serviço responsável por gerenciar todas as chamadas para  as transações existentes (Orquestração), um ponto importante sobre o SAGA é que toda transação deverá ser desfeita caso encontre algum problema, dentro do panorama SAGA essa ação de desfazer é chamada de:  **Compensação**.

## Coreografia

Nesta forma de implementação cada um dos micro serviços envia e ouve eventos de outros micro serviços, ou seja a decisão de ação que será feita dependerá do evento anterior. A seguir mostrarei em diagrama como funcionaria a implementação do SAGA seguindo a estratégia de coreografia.


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

> O fluxo em azul são as operações responsáveis por envio de eventos (linhas tracejadas) e persistência no banco de dados, já o fluxo em vermelho são as ações compensatórias aquelas que tem como função de desfazer uma ação já realizada.


Orquestração

Uma outra implementação do padrão SAGA é a orquestração, nela teremos um serviço responsável por publicar e ouvir eventos para os outros micro serviços. Esse micro serviço orquestrador deverá ter a inteligência para que dependendo do retorno que receba, realizar a compensação de uma ação. A seguir um diagrama representando a implementação da SAGA em Orquestração.


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

> O orquestrador envia e escuta eventos de todos os outros micro serviços e dependendo da resposta, ele realiza uma solicitação de compensação. Por exemplo: Caso o pagamento não for aprovado o orquestrador vai solicitar compensações para o o micro serviço de estoque devolver o item, o micro serviço de entrega cancelar a entrega e o micro serviços de pedidos ter seu status alterado. 

Por fim, SAGA é uma das muitas soluções para quando se trabalha com micro serviços. Entretanto, há muitas outras tão boas quanto, por isso é necessário analisar qual partner aplicar, todos eles terão seus prós e contras.

_links úteis: https://bit.ly/3HJwdW1 
https://bit.ly/34JrXHH 
https://bit.ly/3LrgVHE_

_Escrito por: Hennan Gadelha_