teleren/devto huggingface dataset:
.NET Standard
Tags: dotnet, ptbr, braziliandevs, dotnetstandard
Published: 2021-02-23 12:09:03

Olá Devs! 👩‍💻👨‍💻

Estava estudando gRPC. Escrevi um "Server" com netcoreapp3.1 e pensei em fazer uma implementação de "Client" utilizando o ".NET Framework 4.8". Não vou entrar em detalhes sobre o "Client" e os motivos da escolha, simplesmente fazia sentido. 

Comecei a montar meu "Client", mas... A versão do Framework gRPC que eu queria utilizar, não é compatível com o ".NET Framework 4.8" e veio a lembrança sobre o tema do post: **".NET Standard"**.

### Visão geral do .NET Standard
_".NET Standard é uma especificação formal das APIs do .NET que estão disponíveis em várias implementações do .net. A motivação por trás da .NET Standard era estabelecer uma maior uniformidade no ecossistema do .NET."_

### O que é o ".NET Standard" ???
O ".NET Standard" foi a forma encontrada para unificar as plataformas ".NET" de forma eficiente, com o objetivo de evitar uma possível fragmentação e proporcionando a escrita de um código único para qualquer plataforma. Quem segue o padrão, terá o mesmo conjunto consistente de APIs, que é determinado de acordo com a versão do ".NET Standard".

### Eu preciso saber disso ?
Sei que a coisa mudou um pouco depois do ".NET 5", mas vale lembrar que é necessário entender minimamente sobre o assunto. Na minha visão é um tema importante para quem trabalha com ".NET".

### Comparando Versões
Fazendo um comparativo, rolou uma mudança bastante agressiva da versão 2.0 para a versão 2.1. Um detalhe importante é que esse salto de versão decretou o fim da compatibilidade com o ".NET Framework".

![.NET Standard 2.0](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hp3qwtcfi46no82yg8uz.png)

![.NET Standard 2.1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4453v7u19m1ug3vuntz.png)

### Considerações finais
Essa mudança acabou afetando o que eu estava querendo fazer, mas como existem alternativas, acabei partindo para outro caminho e resolvi o meu problema. Para uma boa parte dos casos teremos alternativas, mas temos que ter atenção para determinar se já não é a hora de migrar para ".NET 5.0". Sendo possível e viável, acho que a migração vale o esforço.

**Mais detalhes sobre as versões**
🎯 .NET Standard 2.1
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard2.1.md

🎯 .NET Standard 2.0
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard2.0.md

🎯 Repositório
{% github https://github.com/dotnet/standard %}

### <a name="links"></a>Links e Referências:
👉 [gRPC] (https://grpc.io/)
👉 [.NET Standard - A formal specification of the APIs that are common across .NET implementations] (https://dotnet.microsoft.com/platform/dotnet-standard)
👉 [.NET Standard - Visão geral do .NET Standard] (https://docs.microsoft.com/pt-br/dotnet/standard/net-standard)
👉 [.NET Core e .NET Standard: Qual a diferença] (https://www.infoq.com/br/news/2017/11/dotnet-core-standard-difference/)
👉 [Novidades do .NET 5] (https://docs.microsoft.com/pt-br/dotnet/core/dotnet-five)


"O passado é história, o futuro um mistério e o presente uma dádiva."
*Provérbio chinês*

Até a próxima!👊
Building modules in Python
Tags: technology, codereuse, modules, python
Published: 2021-11-02 18:41:39

---
title: Building modules in Python
published: true
date: 2021-02-23 09:00:00 UTC
tags: Technology,codereuse,modules,python
canonical_url: 
---

So recently I’ve been involved in a lot more development work as a result of changing direction in my career. And honestly it’s been really interesting. Most recently I’ve been doing a lot of work with Python, which up until now was a language that I was familiar with but hadn’t done much with.

And I have to tell you, I’ve really been enjoying it. Python really is a powerful language in it’s flexibility, and I’ve been doing a lot of work with building out scripts to do a variety of tasks.

As mentioned in previous blog posts, I’m a big fan of DevOps and one of the things I try to embrace quickly is the idea of packaging code to maximize re-use. And to that end, I recently took a step back and went through how to build python modules, and how to package them up for using a pip install.

How to structure your Python Modules?

The first thing I’ve learned about Python is that it very much focused on the idea of convention. And what I mean by that is that Python focuses on the idea of using convention to define how things are done over have a rigid structure that requires configuration. And putting together these kinds of modules is no different.

So when you go through the setting up of the configuration, you would use the following structure:

- {Project Folder}
  - {Module Folder}
  - \_\_init\_\_.py
  - {Module Code}
- setup.py
- requirements.txt

From there the next important part of the setup is to create a setup.py. As you start to flush this out, you are going to be identifying all the details of your package here along with dependencies that you want pip to resolve. A great post on project structure is [here](https://docs.python-guide.org/writing/structure/).

```

import setuptools 
  
with open("README.md", "r") as fh: 
    long_description = fh.read() 
  
setuptools.setup( 
    name="kevin_module", 
    version="1.0.0", 
    python_requires = '>=3.7',
    packages = setuptools.find_packages(),
    author="...", 
    author_email="...", 
    description="...", 
    long_description=long_description, 
    long_description_content_type="text/markdown", 
    license="MIT", 
) 

```

And next is the requirement for a readme.md, which will outline the specifics of your package. This where you are going to put the documentation.

Next the important part is how to implement the \_\_init\_\_.py, this is important and is basically a manifest for the namespace of the library. Below is the sample.

```

from .{python code file} import {class}

```

From there you can actually use a utility called twine to bundle the package, and information on twine can be found here. Below is the command to create the bundle. There is a great post on that found [here](https://anweshadas.in/how-to-upload-a-package-in-pypi-using-twine/).
Random integer generation in an interval with Modern OOP Perl
Tags: perl, oop, random
Published: 2021-02-23 11:45:18

I always have to search [how to generate a random integer number between a range](https://stackoverflow.com/a/21806398/954777) because this is a common task that I use a lot in tests, but really, I can't memorize it.

Though, this is how I would do it in 2021.

```perl
use v5.16;
use strict;
use warnings;

# Class definition
package Random::Range {
  use Zydeco;
  class Integer {
    method pick ( Int $min, Int $max ) {
      return $min + int ( rand ( $max - $min ));
    }
  }
}

# Script
say Random::Range->new_integer->pick(1, 100);
#==> 42 
```

So what did we do here? We used the [`rand`](https://perldoc.pl/functions/rand) function where we applied the `int` function, so we would get an integer, not a fractional number. The small calculation makes possible to restrict the result to the desired interval.

All of this is glued into a minimal Zydeco class that adds a very nice object-oriented interface. You maybe don't need Zydeco, this simple one-liner would work:

    perl -le 'my @interval = (1, 100); print $interval[0] + int ( rand ( $interval[1] - $interval[0] ))'  

Note this is not cryptographically secure and should only be used in simple cases: if you need a secure implementation, please check some [appropriate solutions on CPAN](https://metacpan.org/search?q=math+random+secure).

Art: digital painting by myself.
Your Website Sucks
Tags: books, productivity, webdev, tutorial
Published: 2021-02-23 11:33:23

🎉 It's out: https://flurly.com/p/your-website-sucks

Learn the 5 pillars of creating a website that gets you the results you want.

## Hey, your website sucks!

A pretty bold statement. One I firmly believe in and stand by.

At the time of writing, there are over 2 billion websites on the internet. 400 million of those are active. 

And I'm sure that **_all of them suck_**.

Working as a Developer and CRO Specialist for companies like Accenture and marketing agencies, I have a lot of experience creating and/or reviewing websites for clients like Audi, Virgin Media, and Porsche.

Even though there's an amazing amount of great working, good looking websites out there, not one of them is perfect.

That's why I'd love to help you improve yours!

In this e-book, we'll go through 5 different pillars of creating a website that gets you the results you want.

There are still a **_ton_** of different things you can work on to improve your website, but these 5 ones are the ones I've found had the most long-term impact.

## Chapters

1. **Target Audience**
2. **Value Proposition**
3. **SEO**
4. **Design & Layout**
5. **Page Speed**

Not convinced just yet? **Read a sample chapter before committing**

https://flurly.com/p/your-website-sucks
How to structure a DDD project in Symfony flex
Tags: symfony, php, ddd, architecture
Published: 2021-02-23 11:23:56

In order to keep our code clean and follow the DDD pattern we are going to see how we must structure our files and classes in a Symfony Flex project.

As we see [in our previous article our Controllers will be stored in `app/` folder](https://dev.to/victoor/ddd-and-hexagonal-architecture-with-symfony-flex-30l9) because they are attached to the framework itself, but the rest of the code will be in our `src/` folder.

This folder will contain our different domains and inside each domain we will store our domain, application and infrastructure code.

If we take a look, for example, to the Lead domain we find something like this.

```
└─ Leads
   ├─ Application
   │  ├─ Create
   │  ├─ CreateLeadCommand.php
   │  └─ CreateLeadCommandHandler.php
   ├─ Domain
   │  ├─ Event
   │  │  └─ LeadCreatedEvent.php
   │  ├─ Exception
   │  │  └─ DuplicatedLeadException.php
   │  ├─ ValueObject
   │  │  ├─ LeadCreatedAt.php
   │  │  ├─ LeadEmail.php
   │  │  ├─ LeadName.php
   │  │  └─ LeadUuid.php
   │  ├─ Repository
   │  │  └─ LeadRepository.php
   │  └─ Lead.php
   └─ Infrastructure
      └─ Persistence
         ├─ Doctrine
         │  ├─ Lead.orm.xml
         │  ├─ ValueObject.LeadCreatedAt.orm.xml
         │  ├─ ValueObject.LeadEmail.orm.xml
         │  ├─ ValueObjectLeadNameType.php
         │  └─ ValueObjectLeadUuidType.php
         └─ DoctrineLeadRepository.php
```

As you can see, inside the `Leads` folder we have an `Application`, `Domain` and `Infrastructure` folder to store code depending on the software layer it belongs.

- In the domain folder we store our code and interfaces that has no dependencies with other folders or code.
- In the application we store our use cases, usually services, commands or queries with their own handlers.
- And in the infrastructure code we have implementations of the repository interfaces. Code that interact with our database or outside services. Also, we store here all configurations files needed for doctrine or Symfony.

---

This is a basic and clear way to structure your project in Symfony following DDD and Hexagonal Architecture. You can change some things like subfolder to group classes by type or not, as you prefer, but what it's really important it's to follow the same structure in all your domain and don't mix application, domain and infrastructure code together.

Remember that the entry point it's your application layer, then you go to the domain layer and with an interface you can finally call infrastructure code. If you follow this order everything will be testable and clean.

In the next article we will talk about Commands and Query and how to create the Command Bus in Symfony.
Top Reasons to Choose Node.js to Build eCommerce Marketplace
Tags: node, javascript, npm, sql
Published: 2021-02-23 11:02:50

It is a challenging task to build an eCommerce marketplace in a world where there are lots of eCommerce giants such as eBay and Amazon. With so many platforms obtainable for building a marketplace, selecting the proper platform will be the initial step for accomplishing this challenging task. Although it was utilized as a scripting language in the past, JavaScript has become quite popular at present. JavaScript is used by more than 70% of eCommerce developers throughout the planet.

The most notable part regarding JavaScript is that it can become a front-end scripting language plus a server-side programming language. This helps to make Node JS an appropriate platform for creating multi-vendor marketplaces.

 
What exactly is Node JS?

Node JS happens to be a cross-platform, open-source JavaScript runtime environment that can execute JavaScript code outside a browser.

Node JS developers can use this platform to write command-line tools for developing dynamic page content before dispatching the page to the user’s browser. This platform functions well for building eCommerce marketplaces and also for online endeavors and content administration. It is quite popular for developing acute and dynamic database-triggered mobile and web apps.

 
Who uses Node JS?

Quite a few brands have faith in Node JS development company to provide a remarkable customer experience. Below, we have mentioned a list.

    GoDaddy

    Microsoft Store

    eBay

    PayPal

    Groupon

    Uber

    Netflix

    Walmart

At present, Node JS is responsible for powering over 82,000 websites, and amongst these, over 20% happen to be business sites.

 Let's see here in details why Node JS is considered the best platform for building a multi-vendor eCommerce marketplace.https://www.rlogical.com/blog/top-reasons-to-choose-node-js-to-build-ecommerce-marketplace/
Best Python interpreters you must know about
Tags: python, productivity, programming, beginners
Published: 2021-02-23 10:57:57

`Hello World!` New episode of the series! - [Pieces of advice](https://dev.to/devlorenzo/series/11340) - I tried to make an exhaustive list with all python compilers I used. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0lgjom452koyxdjs1lzl.png)
 
---

## 1. [Repl](https://repl.it/languages/python3)

#### Pros:
One of the most used in all programming languages (easy switch in other languages - it's really professional)
Fast compile rate
Easy to save your code
Multiplayer mode (also in free plan) / They have a blog

#### Cons:
Limited storage with free plan
You have to sign in to use the IDE
Markup is not ideal

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hh49sp46v4x0kdeb2i2.png)
 

---

## 2. [Programiz](https://www.programiz.com/python-programming/online-compiler/)

#### Pros:
Nice UI (Look more professional and modern than others)
Good markup
They have a good free course about python

#### Cons:
Bugs sometimes (or slow compile time)
You can't save your code

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

## 3. [Tutorialspoint](https://www.tutorialspoint.com/execute_python_online.php)

#### Pros:
You can save and share your code
Available in all programming languages (more than 75)
You can customize it

#### Cons:
UI seems a little bit old
Not really engaging

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

---

## 4. [W3School](https://www.w3schools.com/python/trypython.asp?filename=demo_compiler)

#### Pros:
W3school have a lot of resources, you can quickly change a code you searched and then copy it into your complete code
You can quickly customize it

#### Cons:
Good for quickly changing a code you need to copy, it's not a complete compiler
You can't save and share your code

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

---

Hope this helped and thanks for reading!

> Please smash that like button to make me understand that you want the series to continue 

[Check this article to discover how programmers love to code](https://dev.to/devlorenzo/how-do-you-love-to-code-2l29)
{% link https://dev.to/devlorenzo/how-do-you-love-to-code-2l29 %}

---

## **[Subscribe to my Newsletter!](https://chipper-motivator-3112.ck.page/05710ea3d3)**
A loooong, and fun, weekly recap for you 
Free PDF version of my articles
Highly customizable inbox
That's --> free <-- and you help me!
Underrated Articles on Dev.to from Last Week
Tags: top7, webdev, bestofdev, meta
Published: 2021-02-23 10:32:10

Hey fellow devs !

Every day thousands of articles are published on dev platforms, and sometimes, amidst that chaos, some quality articles go unnoticed. 

*Underrated Articles on dev.to* - is a series, focused on giving the spotlight 🔦🔦 to these articles. 

Every week, we will try to bring those articles on the table, that delivered undeniably good content - but remained in the shadow :(

We begin the list with this week's -

##Top 5 underrated articles you must read :-

![alt](https://media.giphy.com/media/MEdOEhp1j6jxdbWU8H/giphy.gif)


## 1. 'this' keyword in JavaScript

Admit it, 'this' keyword in JavaScript is something we all struggle with 😣. Read this article by Debajit to get your concept clearer, and get done with 'this' 😎
{% link https://dev.to/debajit13/this-keyword-in-javascript-2gh %}
 
## 2. Visual Studio Code Snippets

Visual Studio Code has become the first preference for developers all around the globe; No doubt it is the best editor out there. Here is an amazing article by Saransh to boost your productivity with VS CODE.
🔥🔥

{% link https://dev.to/saranshk/visual-studio-code-snippets-boost-productivity-with-shortcuts-4if6 %}

## 3. Ways to Fix Coding Burnout

Burnout grows slowly and can take hold of our life by causing worsening feelings of physical/emotional fatigue. So, it's very important to take breaks 🌞🌄 and not to let things happen to you. In this article, Cory noted his keen observations and fixed coding burnouts.
{% link https://dev.to/itscorykelley/coding-burnout-and-how-to-avoid-it-jim %}

## 4. Essential Javascript Array Methods
JavaScript arrays are really important in modern JS. Read this article by Kapeel kokane and up your JavaScript game 💪💪

{% link https://dev.to/comscience/8-must-know-javascript-array-methods-in-6-minutes-7jj %}

## 5. Fantastic Four Git Shortcuts

Github is a really powerful tool that can enhance your productivity, as well as your teams' - if utilized properly. Here is an amazing article by Ben, explaining his workflow of Git.
{% link https://dev.to/bholmesdev/4-git-shortcuts-that-define-my-workflow-1fem %}


*That's all for this week! These were our personal favorite underrated posts from last week, and we hope you liked them. Tell us about your favorite posts that went underrated in the comments below!* ❤️
![alt](https://media.giphy.com/media/UTj6uNKzYFmJGbKdgH/giphy.gif)

If you are interested in CSS tips and tricks and explainers dev content, make sure to follow us on Twitter [@XenoxDev] (https://bit.ly/37EZi4X).
Scraping all the Links from a Website using Beautiful Soup
Published: 2021-02-23 10:29:52

Here is a simple and uncomplicated way to get just the links from a website. This is very useful many times for just being able to count the number of links, use it later in a high-speed web crawler or any other analysis.

First, we import Beautiful soup and the requests module.

The code does that and also retrieves the HTML contents of the URL and uses Beautiful soup to get it ready for being able to query on it.
BeautifulSoup has a function findAll and we will use the CSS selector 'a' to select all the hyperlinks we can find on the page.
Notice how we are appending all the links we find into an array.

Putting the whole code together this is what it will look like.
The codes below check for hyperlinks that only point to elements within the page and ignores them.


And when we run it, we simply get all the links.
In more advanced implementations you will need to even rotate this string so Wikipedia cant tell its the same browser! Welcome to web scraping.

If we get a little bit more advanced, you will realize that Wikipedia can simply block your IP ignoring all your other tricks. This is a bummer and this is where most web crawling projects fail.

Overcoming IP Blocks

Investing in a private rotating proxy service like Proxies API can most of the time make the difference between a successful and headache-free web scraping project which gets the job done consistently and one that never really works.

Plus with the 1000 free API calls running an offer, you have almost nothing to lose by using our rotating proxy and comparing notes. It only takes one line of integration to its hardly disruptive.

Our rotating proxy server Proxies API provides a simple API that can solve all IP Blocking problems instantly.

With millions of high speed rotating proxies located all over the world,
With our automatic IP rotation
With our automatic User-Agent-String rotation (which simulates requests from different, valid web browsers and web browser versions)
With our automatic CAPTCHA solving technology,
Hundreds of our customers have successfully solved the headache of IP blocks with a simple API.

The whole thing can be accessed by a simple API like below in any programming language.
Weedow Searchy 0.1.0 released
Tags: kotlin, java, webdev, spring
Published: 2021-02-23 10:24:58

I'm happy to share with you the release 0.1.0 of [Weedow Searchy](https://github.com/Kobee1203/weedow-searchy).

Searchy is a Spring-based library that allows to automatically expose endpoints in order to search for data related to Entities, whatever the database used.

Searchy provides an advanced search engine that does not require the creation of Repositories with custom methods needed to search on different fields of Entities.

We can search on any field, combine multiple criteria to refine the search, and even search on nested fields.

It supports the following data access layers:
* [JPA](https://github.com/Kobee1203/weedow-searchy/blob/dev/jpa)
* [MongoDB](https://github.com/Kobee1203/weedow-searchy/blob/dev/mongodb)

![query](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0sjiqesh9seuu6dij3s5.gif)

_Examples of queries_:

GET /search/person

GET /search/person?`firstName=John`

GET /search/person?`address.zipCode=78370`

GET /search/person?query=`firstName='John' AND lastName='Doe'`

GET /search/person?query=`birthday != '1981-03-12T10:36:00'`

GET /search/person?query=`NOT(firstName='John' OR firstName='Jane')`

GET /search/person?query=`address.street IMATCHES 'RUE*' AND (vehicles.brand='Renault' OR vehicles.brand='Porsche') AND job.active = true AND (job.salary >=50000 AND job.salary<610000) AND characteristics.key = 'hair' AND vehicles.features.value.description IMATCHES '*Navigation Services*'`

There is a ["Getting Started"](https://github.com/Kobee1203/weedow-searchy#getting-started-in-5-minutes) section that describes step by step the creation of an application with the library.

Searchy provides several features described in the documentation:
* DTO Mappers
* Validators
* Entity joins handling
* Converters
* ...