teleren/devto huggingface dataset:
Tipagem fraca, forte, dinâmica e estática
Tags: python, javascript
Published: 2020-09-03 01:41:17

A uma grande confusão acerca de qual a diferença entre os diferentes denominações a cerca da tipagem, o intuito desde post é deixar mais claro este conteúdo.

# Tipagem estática
A tipagem deve estar explicitado qual o tipo de dado para variável e não pode ser alterado, como no caso da linguagem c.
```c
int velocity = 4;
```
Neste caso você não pode alterar o tipo da variável, você pode criar uma nova variável com um novo tipo de dado e fazer casting para o novo tipo, mas não fazer a variável ``velocity`` receber outro tipo de dado que não seja o dela.
```c
int velocity = 4;
float newVelocity = (float) velocity;
```

# Tipagem dinâmica
Este tipo de tipagem pode ser inferida pela linguagem sem ser escrita de forma explicita o tipo de dado, por exemplo a linguagem php.
```php
$users = 5;
```
O php já trata a variável com o tipo inteiro sem precisar estar explicito o tipo dela. É possível além disso alterar o valor da variável para outro tipo.
```php
$users = 5;
$users = 'cinco';
```

# Tipagem fraca
Essa se trata quando o tipo do dado não é bem definido, a linguagem pode alterar o tipo por alguma ação, sem intervenção direta do programador, como é o caso da linguagem javascript.
```js
const numberOne = "5"
const numberTwo = 5
console.log(numberOne + numberTwo)
// 55
```
Neste caso mesmo o dado ``numberTwo`` sendo number ele é convertido para string para que possa fazer a concatenação com a string.

# Tipagem forte
Quando na linguagem os tipos estão bem definidos, sendo necessário a alteração do programador para ser convertido a algum tipo de dado especifico, como é o caso da linguagem python
```py
number_one = "5"
number_two = 5
print(number_one + number_two)
# Traceback (most recent call last):
#  File "<stdin>", line 1, in <module>
# TypeError: can only concatenate str (not "int") to str
```
Como os tipos são bem definidos e a soma entre string e inteiros não é permitida, python lança o erro de que não pode fazer a concatenação desses dados, pedindo que o programador explicite a conversão dos dados. Por exemplo.
```py
number_one = "5"
number_two = 5
print(int(number_one) + number_two)
# 10
```
Depois da conversão intencional da variável pode ser feita a soma das variáveis sem erro.
Caesar Cipher
Tags: javascript
Published: 2020-09-03 02:41:51

```
class CaesarCipher {
  constructor(shift) {
    this.shift = shift;
    this.chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  }

  encode(str) {
    return str
      .replace(/[a-z]/gi, (c) =>
        this.chars[(this.chars.indexOf(c.toUpperCase()) + this.shift) % 26]
      );
  }

  decode(str) {
    return str
      .replace(/[A-Z]/g, (c) =>
        this.chars[(this.chars.indexOf(c) + 26 - this.shift) % 26]
      );
  }
}

let c = new CaesarCipher(5);
c.encode('Pizza'); //=> "Wpggh"
c.decode('Jhuhyf'); //=> "Canary"
```
A/B Testing as a PRO!
Tags: design, ux, testing, showdev
Published: 2020-09-03 01:33:23


![A/B Testing Image](https://dev-to-uploads.s3.amazonaws.com/i/71f6uyberslunkuccxri.jpeg)

Hey! Today, I decided to write a little more about the practice of A/B testing and the positive impacts that it can bring to your business. 

## First of all, what is A/B testing?

This type of test is a quantitative research technique used in digital products to collect metrics about the behavior and approval of people who are using two variants, as the name says, A and B. Precisely on websites and applications, A/B testings are used to monitor the impact that visual or content changes on pages cause on browsing behavior, which can bring more or less results.

It is important to remember that are several types of tests to collect information about the use of the product, such as heat maps, usability tests or interviews. However, it is up to a deep study with a UX Researcher to choose the ideal test to use when deciding to collect answers about the user's behavior.

## How to improve my business using this practice?

For context, Netflix performs several A/B testing on its platform in order to collect usage data and also to test your hypotheses. One of the easiest examples of viewing A/B testing on Netflix are series and movie banners. You know? Those big banners which appears at very top of the screen? So, most likely the images that appear in your account are not the same as mine. That said, Netflix tries to choose the right images for each type of audience.

If you want to know more about the Netflix testing process [here is a link](https://netflixtechblog.com/selecting-the-best-artwork-for-videos-through-a-b-testing-f6155c4595f6?gi=e1b48180a6d) explaining everything.

![A/B test on Netflix with different “How to Train Your Dragon” banners - Source: Netflix](https://dev-to-uploads.s3.amazonaws.com/i/1oa6z7rybpelkwqbosv9.png)

What many people do not know is that this type of test does not end when we finish the experiment. The results however generate many insights about the use of the product. Through the results, we can understand when a given situation, what the person likes, and several other behaviors that are being taken as changes happen during navigation.

The more we know people, the more assertiveness we are able to bring when creating digital products, thus we can make content that aggregates and satisfies even more, therefore, the navigation time is longer and conversion rates increase.

I think it is important to highlight that after the test, it is very important to document everything and save data in addition to the results, for example, “What was the tested hypothesis?” and also “Who is the public exposed to?”, so we can have an accumulated history about what was tested in order to revisit it when there is a needed to pursue new tests and propagate the product with continuous improvements.

---
GitHub Codespaces Extensions
Tags: github
Published: 2020-09-03 00:27:47

Tried out setting up a custom GitHub Codespace to launch using two VSCode extensions.  The scenario is for learning the bioinformatics WDL language.  In my ['learn-wdl'](https://github.com/openwdl/learn-wdl) Repo, I have a set of customization files so that my Codespace will include required dependencies (JDK and other files). I customized a [MSFT-built Java Codespace](https://dev.to/lynnlangit/containers-for-github-codespaces-2ef5) for this.  

I wanted to add the two available WDL extensions.  First I located them, by searching (shown below).  I took note of the name of each extension as well.

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

Then I updated my `devcontainer.json` file to include those two extension names (shown below) and saved/pushed my updates to this file.

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

Next I closed the existing Codespace and deleted it.  Finally I launched a fresh Codespace for this Repo and voila! My WDL syntax highlighting was installed and working (shown below).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/f7ja78dry87bk90a65ek.png)
OpenPGP proof
Published: 2020-09-03 00:00:24

This is an OpenPGP proof that connects [my OpenPGP key](https://keyoxide.org/ccac77cbe126b44fea94e64b1467C69143891976) to [this dev.to account](https://dev.to/glabrie). For details check out https://keyoxide.org/guides/openpgp-proofs

[Verifying my OpenPGP key: openpgp4fpr:https://keyoxide.org/ccac77cbe126b44fea94e64b1467C69143891976]
How to get the attribute value of a DOM element in JavaScript?
Tags: javascript
Published: 2020-09-03 00:00:00

---
  title: How to get the attribute value of a DOM element in JavaScript?
  published: true
  tags: JavaScript
  date: Thu Sep 03 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/get-elements-attribute-value-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-fa890ae4751a04e2c4a5023820daff4b.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/get-elements-attribute-value-javascript)
  
To get the attribute values from a DOM element, you can use the `getAttribute()` element method in JavaScript.

Let's say you have an `h1` html tag with custom attribute `data-color` like this,

```html
<h1 data-color="red">Heading</h1>
```

Here, you can get the value of the `data-color` attribute in the `h1` tag using the `getAttribute()` like this,

```javascript
// first get the reference to h1 element
const h1 = document.querySelector("h1");

// get the data-color sttribute value
// using the getAttribute() method
const value = h1.getAttribute("data-color");

console.log(value); // red
```

- The method accepts a valid attribute name as an argument.
- The method returns the corresponding value for the attribute as a string if supplied a valid attribute name and `null` if not.

See live example in [JSBin](https://jsbin.com/nukucamubu/1/edit?html,js,console,output).

### Feel free to share if you found this useful 😃.

---
Introducing: Learn AWS With Me
Tags: aws, beginners, cloud
Published: 2020-09-03 19:38:13

---
title: Introducing: Learn AWS With Me
published: true
date: 2020-09-03 00:00:00 UTC
tags: aws, beginners, cloud
canonical_url: https://www.ceoraford.com/posts/introducing-learn-aws-with-me/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/6jvsogjexp78yx3uq213.png
series: Learn AWS With Me
---

## **AWS aka A World of Stress**

I've been getting into the cloud engineering space for some time now and AWS has been my main focus. There are lots of other people like me who are trying to learn more about AWS which is not easy at all.

AWS has a plethora of services available. Trying to figure out what services are the most relevant and important can be difficult. If you, like me, don't have a networking background or if you don't have much backend engineering experience, AWS can be even more confusing. And we haven't even talked about navigating AWS documentation.

AWS really feels like a A World of Stress. I don't mean to scare you away with all these things. What I want to do is cut away the confusion surrounding AWS as much as possible. That's why I'm starting this blog series called "Learn AWS With Me".

---

## **What to Expect**

What should you expect from this series? Am I going to explain _every_ AWS service? lol no. There is not enough time in the world to be able to do that.

One question I've seen all over the internet is "What AWS services should I learn?" In this series, I'll point out which services you should learn, explain them (probably using lots of pop culture references and memes), and even sprinkle in some core networking concepts that tie in with AWS well.

Examples of services and features I'll cover are:

- AWS Lambda
- Elastic Beanstalk
- Elastic Cloud Compute (aka EC2)
- Simple Storage Service (S3)
- VPC
- and more 😎

---

I know the feeling of being lost all too well. I really want to help beginners (or not beginners) to overcome that. If there are any specific features, you'd like me to cover, please let me know! If you want to be notified when the first post drops, just follow me here so you can get the notification.
Review-apps in gh-pages
Tags: actionshackathon
Published: 2020-09-02 21:56:47

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon, please fill out all sections.)


### My Workflow
[Note]: # (Make sure to include the name of your GitHub Action and share where it's being used!)
For projects with multiple developers working at the same time, It's vital to have an easy way to test every change being introduced. This `sauloxd/review-apps` tries to solve this problem, at least for static web applications, like a storybook app. It doesn't have any server involved, It's just good ol' JS/CSS/HTML.
But it's not meant to manage just the "production" version of a single branch, like the main branch, but instead, it manages all versions on each pull request open! That way, you can validate easier the interactions you are building, together with the QA team. Cool! No more `ngrok` or other hacks to share your localhost app. No more maintaining an S3 or any other 3rd party deployment service!
Everything is self-contained in your own repository, in the GitHub pages branch! yay


### Submission Category: 

[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)
*DIY Deployments* Focused on generating an app instance per PR to help QAing the changes being introduced.

### Yaml File or Link to Code

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)

{% github https://github.com/Sauloxd/review-apps %}

### Additional Resources / Info

Here is an example of one project using this action! 
https://github.com/Sauloxd/saulo.dev
https://sauloxd.github.io/saulo.dev/

[Note]: # (Be sure to include the DEV usernames of your collaborators, if any. )

[Reminder]: # (Submissions are due on September 12th (11:59 PM PDT) and winners will be announced on September 23!)
PKCE
Tags: pkce, oauth, oidc
Published: 2020-09-04 07:48:32

---
title: PKCE
published: true
date: 2020-09-03 00:00:00 UTC
tags: PKCE,OAuth,OIDC
canonical_url: https://www.loginradius.com/engineering/blog/pkce/
---

If you are working with OAuth and OIDC authorization code flow and want to setup PKCE flow then this artical will help you to understand everything about PKCE.

   
[Read On](https://www.loginradius.com/engineering/blog/pkce/)
JavaScript Array Iteration, a curious case!
Tags: javascript
Published: 2020-09-02 23:55:38

var box = [];
box['size'] = 9;
box['0'] = 'Cool';
box.push = 'coffee';
for(var i=0 ; i<box.length ; i++){
console.log(box[i]);  // ???
}


What could be the console.log output here?
How to switch between Python 3 versions
Tags: python, ubuntu
Published: 2020-09-02 23:29:58

---
title: How to switch between Python 3 versions
published: true
description: 
tags: python, ubuntu
cover_image: http://lifeofajenni.com/wp-content/uploads/2017/02/spyder.jpg
---

I'm new in the Python world, and the big change I know it happened this year 2020 (in the Python world, because in the real world many many odd things happened), is that Python 2.7 versions are deprecated and Python 3.x versions are now the mandatory.

But, in this I'm seeing that there's an apparent fragmentation, in which still is the use of `3.6.x` but also you may use frameworks or libraries that are currently using `3.7.x` or `3.8.x` and those versions have implemented features not yet supported in `3.6.x`, and by some odd reasons you may have projects in any of those versions, and you need to handle it with your applications mean while develop.

Then, I found out that with a feature available in Ubuntu, called `update-alternatives` you may switch of Python version anytime you want, without delete or make any manual symlink for binaries.

For example, you have your environment as it comes, with python `3.6.x`, and you check it with

```
$ python3 --version
Python 3.6.8
```

And let's say now want to use `3.7` and work with it in our environment, so we proceed to install it, as usual

```
$ sudo apt update -y && sudo apt install python3.7
```

Now we need to configure our `update-alternatives` in order to be able to switch of versions

```
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
```

So, the alternative #1 will be 3.6 and alternative #2 3.7.

To check or configure the alternative of Python to use we need to run the command `sudo update-alternatives --config python3`, and the result will be similar to

```
sudo update-alternatives --config python3

There are 2 choices for the alternative python3 (providing /usr/bin/python3).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/python3.7   2         auto mode
  1            /usr/bin/python3.6   1         manual mode
* 2            /usr/bin/python3.7   2         manual mode

Press <enter> to keep the current choice[*], or type selection number: 
```

And we are prompted to enter a number between 0 and 2, in this example, to select wether Python 3.6 or 3.7. And we may see that the default option is 3.7 at selection `0`.

After you select the option that you wan to use, you may check the python version 

```
python --version
```
AWS Certified Developer - Associate Exam Tips (2020)
Tags: aws, certification, developer
Published: 2020-09-02 23:23:48

In June 2020, I passed the AWS Certified Solution Architect Exam after almost preparing for 5 months ( an hour or so everyday) and I was so pumped that I decided to take another AWS exam. I started preparing for the Developer Associate exam at the end of June and cleared by July end.

Here is my badage: [AWS Badge](https://www.youracclaim.com/badges/2f8b7d13-cea5-421c-99eb-53c157c75558)


Developer associate is Developer focused and its bit different than the solution architect exam. I found Developer associate exam harder than the Solution Architect, but YMMV.

So here are my tips and preparation topics:


- You success in exam depends upon recognizing keywords in the questions.  All answers may look similar but keywords will lead to right answer. Pay attention to words. For example: 'low cost', 'encryption at rest vs encryption in transit'.

- Know how to do Read Capacity Units (RCU) and Write Capacity Units (WCU) calculations. You might get one or two questions on determining RCU/WCU. Don't forget to pay attention to strongly consistent/ Eventual consistent keyword in question.

- Sometimes you may find answer to questions in other questions. While reviewing see if any other question has answer to it. 

- Use all the time available for the exam. If finished early, spend time in reviewing all questions.

- Attempt as many mock exams you can. This will prepare you on time management and questions patterns. Questions will be verbose in real exam.

- There could be command level questions like what this command do, when to use etc.

-  You need to understand the concepts very well and should have some hands on. It is easy to eliminate two answers.

- Know CI/CD services like CodeDeploy, CodeBuild, CodeCommit. Understand BuildSpec and AppSpec difference. Code Deploy lifecycle hooks. CodeDeploy Deployment Types for Lambda, ECS and EC2.

- Cloudformation, KMS, SQS, SNS, ECS, API gateway, IAM (Inline policies/ Managed Policies) and Lambda (Concurrent execution Limit, 

- DynamoDB. Local Secondary Index vs Global. DynamoDB Accelerator. DynamoDB Streams. SCAN vs Query. 

- Amazon S3, EC2, Elastic Beanstalk and its deployment types. Knows CORS.

- CloudWatch, CloudTrail, App X-Ray

- You might also get architecture level questions but not much.

Good Luck!
Xamarin Tips - Screenshot your Android Phone from ADB
Tags: xamarinforms, android, adb
Published: 2021-08-12 08:43:16

---
title: Xamarin Tips - Screenshot your Android Phone from ADB
date: 2020-09-02 23:00:00 UTC
tags: XamarinForms,Android,ADB
published: true
canonical_url: https://mikegrant.org.uk/2020/09/03/xamarin-tips-screenshot-from-adb.html
---

Having the ability to take a screenshot directly from your command prompt will save you a lot of time over the duration of a project. When I’m building an app I know I regularly take screenshots to show features, bugs or just general UI weirdness to others and the time I lose taking it, transferring it to be emailed or shared on Teams is frustrating. A handy one liner can be used to speed this process up.

## Taking a screenshot on your Android device

1. Using the adb command prompt from Visual Studio (Or if you have ADB in your path)

```
adb exec-out screencap -p > screenshot.png

```

That’s it! Your screenshot is now saved to the location specified.
A program to calculate the area of a triangle using python
Tags: dev, python, mathematics, programming
Published: 2020-09-02 22:56:07

Yo! guys today am dropping a snippet to calculate the area of a triangle using Python Programming..

Just like other programming languages like; C++, Java, JavaScript and the rest you can do a lot of mathematical stuff with the Python Lang.

Tho forks may not want to do this but will like to just work with another approach other than this.  

__1.__ The First thing to do is to print a message on the screen telling the user about your program.

Using the print statement in Python, we can easily print messages to the user's screen.


```print ("A Program to calculate the Area of a Triangle");```


__2.__ The next thing to do is to wait for the user's command, by printing on the screen __press any button to continue__.

```input("Press any button to continue...");```

with python version 2.x we can easily use

```raw_input("Press any button to continue");```

__3.__ Tell the user to enter the base of the angle, which will be stored in a variable called __'angleBase'.__

```angleBase = input("Enter Angle Base\n");```
__4.__ Request for the height of the angle, which will be stored in a variable called __'angleHeight'.__

```angleHeight = input("Enter Angle Height\n");```

__5.__ I then declared two variables called __'isHeightANumber'__ and __'isBaseANumber'__ and assigned them to the language(Python)'s function called __"isdigit()".__

```
isHeightANumber = angleHeight.isdigit();
isBaseANumber = angleBase.isdigit();
```

__What is the work of isdigit()?__

__"isdigit()" is a python function which checks if a variable value(s) are/is a digit(s).__


__The last part of the code is shown below__

__Before Processing/ Calculating the user data, i tried to verify that the fields are not empty or void by using the__ 
```if statement and the not equal (!=) operator```

```if  angleBase!="" and angleHeight!="":```

__Also i consider checking and validating by making sure what the user entered is a number by using the__ 
```if statment and isdigit()
   if isBaseANumber and isHeightANumber:```
        
__The last part is all about declaring a variable called areaOfATriangle which will calculate the area of the input entered by the user, if the base and height entered by the user are/is a number, it will print out the area of the triangle, if not it will show the__ 
```else statement```
 __which says "Angle Base and Height must be a number"__

```areaOfATriangle = int(int(angleBase) * int(angleHeight) / int(2));```

```print("Area of a triangle whose base = ", angleBase, " and height = ", angleHeight, " is = ", areaOfATriangle);```
     
```else:
       print("Angle Base and Height must be a number");
else:
       print("Height and Base can't be empty.");
🤖 DEV Bot, Once a day, I promise.
Tags: actionshackathon, javascript, showdev, news
Published: 2020-09-02 22:05:27

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon, please fill out all sections.)


### My Workflow
[Note]: # (Make sure to include the name of your GitHub Action and share where it's being used!)
A simple workflow that collect's the trending Github repos, and trending on Product Hunt, Hacker News and Designer News, every 7pm UTC.

### Submission Category: 

[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)
Wacky Wildcards, I guess

### Yaml File or Link to Code

{% github dephraiim/trendsdeveloper no-readme %}

### Additional Resources / Info

Example Post.
{% link https://dev.to/dailydeveloper/top-10-developer-trends-wed-sep-02-2020-4194 %}

> I used a different account because I consider my account as my personal blog. Hope I didn't break any rules.