teleren/devto huggingface dataset:
Refactoring 006 - Rename Result Variables
Tags: refactorit, webdev, beginners, tutorial
Published: 2022-06-15 13:05:36

*'Result' is a very bad generic name. Just Fix it*

> TL;DR: Use the last call as a semantic guide.

# Problems Addressed

- Bad naming on variables

# Related Code Smells

{% post https://dev.to/mcsee/code-smell-81-result-45ko %}

{% post https://dev.to/mcsee/code-smell-79-theresult-429k %}

# Steps

1. Name the variable with the same name as the last function call.

# Sample Code

## Before

[Gist Url]: # (https://gist.github.com/mcsee/c4f1e90fb0a61724ea5993e04d572b5c)
```javascript
function doubleFavoriteNumber(n) {
    return this.favoriteNumber * n;
}

var result = doubleFavoriteNumber(2);

// Many lines after we have no idea what does 
// result holds

// var result ???
```

## After

[Gist Url]: # (https://gist.github.com/mcsee/5a9bbc54b45798a610f0a76b8c25a583)
```javascript
function doubleFavoriteNumber(n) {
    return this.favoriteNumber * n;
}

const favoriteNumberDoubled = doubleFavoriteNumber(2);

// Many instructions after

// We can use favoriteNumberDoubled knowing its semantics
```

# Type

[X] SemiAutomatic

As with many name heuristics, we can replace the variable with another refactor *rename variable*

# Why code is better?

A variable scope can last a lot.

Assignment and usage might be very far away from each other.

# Tags

- Naming 

# See also

[What is in a name?](https://dev.to/mcsee/what-exactly-is-a-name-part-i-the-quest-61k)

# Credits

Image by [HeungSoon](https://pixabay.com/users/heungsoon-4523762/) on [Pixabay](https://pixabay.com/)

* * * 

This article is part of the Refactoring Series.
Two Out of Three
Tags: leetcode, dsa, theabbie
Published: 2022-06-15 13:00:48

Given three integer arrays `nums1`, `nums2`, and `nums3`, return _a **distinct** array containing all the values that are present in **at least two** out of the three arrays. You may return the values in **any** order_.

**Example 1:**

**Input:** nums1 = \[1,1,3,2\], nums2 = \[2,3\], nums3 = \[3\]
**Output:** \[3,2\]
**Explanation:** The values that are present in at least two arrays are:
- 3, in all three arrays.
- 2, in nums1 and nums2.

**Example 2:**

**Input:** nums1 = \[3,1\], nums2 = \[2,3\], nums3 = \[1,2\]
**Output:** \[2,3,1\]
**Explanation:** The values that are present in at least two arrays are:
- 2, in nums2 and nums3.
- 3, in nums1 and nums2.
- 1, in nums1 and nums3.

**Example 3:**

**Input:** nums1 = \[1,2,2\], nums2 = \[4,3,3\], nums3 = \[5\]
**Output:** \[\]
**Explanation:** No value is present in at least two arrays.

**Constraints:**

*   `1 <= nums1.length, nums2.length, nums3.length <= 100`
*   `1 <= nums1[i], nums2[j], nums3[k] <= 100`

**SOLUTION:**

    class Solution:
        def twoOutOfThree(self, nums1: List[int], nums2: List[int], nums3: List[int]) -> List[int]:
            nums1 = set(nums1)
            nums2 = set(nums2)
            nums3 = set(nums3)
            checklist = set.union(nums1, nums2, nums3)
            op = []
            for num in checklist:
                ctr = 0
                if num in nums1:
                    ctr += 1
                if num in nums2:
                    ctr += 1
                if num in nums3:
                    ctr += 1
                if ctr >= 2:
                    op.append(num)
            return op
What is XML?
Tags: xml, devops, tools
Published: 2022-06-15 12:54:47

**What is XML?**

XML (Extensible Markup Language) is a markup language similar to HTML, but without predefined tags to use. Instead, you define your own tags designed specifically for your needs. This is a powerful way to store data in a format that can be stored, searched, and shared. Most importantly, since the fundamental format of XML is standardized, if you share or transmit XML across systems or platforms, either locally or over the internet, the recipient can still parse the data due to the standardized XML syntax.

**XML Sample:**

```
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>
```

Use online tools which helps to validate, view and analyze XML data.

[XML Formatter](https://jsonformatter.org/xml-formatter)

![XML Formatter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4b6usy5e5i3ilgcc5poi.png)

**Why XML is used?**

XML has a variety of uses for Web, e-business, and portable applications.

The following are some of the many applications for which XML is useful:

**Web publishing: **

XML allows you to create interactive pages, allows the customer to customize those pages, and makes creating e-commerce applications more intuitive. With XML, you store the data once and then render that content for different viewers or devices based on style sheet processing using an Extensible Style Language (XSL)/XSL Transformation (XSLT) processor.
Web searching and automating Web tasks: XML defines the type of information contained in a document, making it easier to return useful results when searching the Web:
For example, using HTML to search for books authored by Tom Brown is likely to return instances of the term 'brown' outside of the context of author. Using XML restricts the search to the correct context (for example, the information contained in the <author> tag) and returns only the information that you want. By using XML, Web agents and robots (programs that automate Web searches or other tasks) are more efficient and produce more useful results.

**General applications:** 
XML provides a standard method to access information, making it easier for applications and devices of all kinds to use, store, transmit, and display data.
e-business applications: XML implementations make electronic data interchange (EDI) more accessible for information interchange, business-to-business transactions, and business-to-consumer transactions.

**Metadata applications:** 
XML makes it easier to express metadata in a portable, reusable format.

**Pervasive computing:** 
XML provides portable and structured information types for display on pervasive (wireless) computing devices such as personal digital assistants (PDAs), cellular phones, and others. For example, WML (Wireless Markup Language) and VoiceXML are currently evolving standards for describing visual and speech-driven wireless device interfaces.

I recommend [XML Validator](https://codebeautify.org/xmlvalidator) to validate XML to makes your life easier.
Software em vários idiomas
Published: 2022-06-15 12:53:24


Muitos softwares, durante o seu tempo de vida, precisam ser disponibilizados em vários idiomas, para expandir o software do cliente em diferentes regiões. A grande maiora dos softwares são escritos para usuários de um determinado idioma.

Os utilizadores interagem com o software através do texto escrito nos formulários, tabelas, menus, gráficos, relatórios e nas mensagens (erro e sucesso). Se estes textos estiverem diponíveis em várias línguas, poderá ser usado em vários países.


Como traduzir um software? 

Existem várias formas de traduzir um software, nas quais podemos destacar:
- API de tradução;
- Frramentas de tradução;
- Implementação manual.

Ferramentas e/ou APIs para tradução de software
- Translate-api;
- Google translator API;
- Amazon Translate;
- SYSTRAN Translator;
- DeepL Translator.

Sugestão para a Tradução Manual

- Criar fircheiros de tradução, contendo as Labels e mensagens nas línguas diponíveis;
- Atribuir cada texto nas variáveis;
- Substituir os textos do software pelas variáveis;
- Carregar ou importar os ficheiros correspondentes a linguagem.


Exemplo
Implementação de uma Ferramenta de Geração de Fontes de dados, em Inglês e Português.
Linguagem de Programação: Python



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


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


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


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


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


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


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


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


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


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



Código fonte:  https://github.com/ortizdavid/data-source-generator

Para mais artigos: 
https://www.dev.to/ortizdavid
https://www.medium.com/@ortizaad1994
Arquitectura de Software
Published: 2022-06-15 12:50:39

A arquitectura de software é focada na organização dos componentes de software, suas responsabilidades e relacionamento entre eles.

Arquitectura de software ajuda a satisfazer os requisitos não funcionais ou atributos de qualidade do software, tais como: 
- Escalablidade; 
- Estabilidade;
- Segurança;
- Portabilidade;
- Acessibilidade;
- Interoperabilidade;
- Outros objectivos que possam agregar valor ao negócio.

## Padrões de Arquitectura
- Cliente-Servidor;
- Modelo em Camadas;
- Peer-to-Peer;
- Microserviços;
- Orientada a Eventos;
- Orientada a Serviços (SOA);
- Publish-Subscribe (Pub/Sub);
- Pipe-and-Filters;
- Serverless.

## Diferença entre Arquitectura e Design de Software
**Arquitectura**: Estrutura de alto nível. Padrões organizacionais, casos de usos críticos, serviços do sofware ou representação de módulos.
**Design**: Estrutura de baixo nível, ou organização de código. Focado na organização de Classes, Objectos, Métodos, Interfaces, Funções, Traits, Protótipos de acordo a linguagem. Em outras palavras, princípios de Design Patterns.
O Design pode fazer parte da Arquitectura.

## Ferramentas para desenho de Arquitectura
- Star UML;
- Astah UML;
- Archimate;
- DrawIo;
- Edrawsoft;
- LucidChart;
- Microsoft Visio;
- Microsoft PowerPoint.

**Observação:** Não existe a melhor arquitectura, que se enquadra a todos os problemas. A arquitectura deve se adequar a necessidade actual da Empresa. É possível combinar diferentes padrões arquieturais. 
A adoção de uma arquitectura inadequada pode acrescentar complexidade no desenvolvimento, na implantação e na manutenção do software.

**Sugestão:** No caso de aplicações muito complexas e corporativas é recomendado ferramentas como o Archimate, por oferecer um excelente ferremental e boa documentação.

**Exemplo:** Representação da Arquitectura de um Sistema de Recrutamento e Seleção.
Tipo: Arquitectura em Camadas
Ferramementa: Astah Professional



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

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

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

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


Para mais Artigos: 
[](https://www.dev.to/ortizdavid)
[](https://www.medium.com/@ortizaad1994)
Speed Up Your Javascript With These Simple Methods
Tags: javascript, webdev, react, beginners
Published: 2022-06-15 12:45:23

If your Javascript code is running slower than you'd like, or if you just want to know how to make your code faster regardless, stick around for some easy to implement ways of making your Javascript run faster

##Bottom of Webpage
To make your webpage's loading faster, make sure your Javascript code is at the bottom of your HTML webpage's `body` tag.

##Web Workers
If your webpage uses time-intensive Javascript operations, web workers can save you a lot of time. Using web workers can mean the difference between an unresponsive and slow webpage, and a smooth running and fast webpage.

Web workers are separate threads created by your main Javascript code to work in parallel with the main process. 
You can read about web workers and their JS implementation [here](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers)

##Saving DOM Elements
When manipulating the same DOM element multiple times, to speed up your code, you should define it once and then keep referencing it.
**No**
```Javascript
const el1 = document.getElementById("demo");
el1.style.color = "green";

const el1 = document.getElementById("demo");
el1.style.color = "blue";

const el1 = document.getElementById("demo");
el1.style.color = "pink";
```

**Yes**
```Javascript
const el1 = document.getElementById("demo");
el1.style.color = "green";

el1.style.color = "blue";

el1.style.color = "pink";
```

##Reduce Library Dependancies
Loading libraries in JS can take up a lot of time, make sure to remove any unneeded library dependancies in your Javascript code.

##Reduce Loop Activity
In Javascript, loops can take quite a lot of time to finish running. A simple way to make your JS loops run faster is by defining the loop parameters before the loop itself.
**No**
```Javascript
for (let g = 0; g < arr.length; g++) {
```

**Yes**
```Javascript
let arrlen = arr.length;
for (let g = 0; g < arrlen; g++) {
```

This will speed up your for loop because now, instead of getting the length of the "arr" array every single iteration, it will get that value once and reuse it throughout every iteration.

##Avoid Global Variables
Global variables can slow down your JS code. When defining a variable for the first time, make sure to add the `var` prefix to make it a local variable instead of a global one.
**No**
```Javascript
v1 = 9
```

**Yes**
```Javascript
var v1 = 9
```

#Conclusion

I hope that these were helpful.
Pure CSS Fashion Woman
Tags: codepen, html, css, webdev
Published: 2022-06-15 12:37:18

---
title: Pure CSS Fashion Woman
published: true
tags: codepen,html,css,webdev
---

{% codepen https://codepen.io/AsyrafHussin/pen/jOZaNVE %}

<p>Speed Code Video
<a href="https://twitter.com/asyrafhussin4/status/1529347326321434625" target="_blank">https://twitter.com/asyrafhussin4/status/1529347326321434625</a></p>
Plus One
Tags: leetcode, dsa, theabbie
Published: 2022-06-15 12:30:37

You are given a **large integer** represented as an integer array `digits`, where each `digits[i]` is the `ith` digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading `0`'s.

Increment the large integer by one and return _the resulting array of digits_.

**Example 1:**

**Input:** digits = \[1,2,3\]
**Output:** \[1,2,4\]
**Explanation:** The array represents the integer 123.
Incrementing by one gives 123 + 1 = 124.
Thus, the result should be \[1,2,4\].

**Example 2:**

**Input:** digits = \[4,3,2,1\]
**Output:** \[4,3,2,2\]
**Explanation:** The array represents the integer 4321.
Incrementing by one gives 4321 + 1 = 4322.
Thus, the result should be \[4,3,2,2\].

**Example 3:**

**Input:** digits = \[9\]
**Output:** \[1,0\]
**Explanation:** The array represents the integer 9.
Incrementing by one gives 9 + 1 = 10.
Thus, the result should be \[1,0\].

**Constraints:**

*   `1 <= digits.length <= 100`
*   `0 <= digits[i] <= 9`
*   `digits` does not contain any leading `0`'s.

**SOLUTION:**

    class Solution:
        def plusOne(self, digits: List[int]) -> List[int]:
            carry = 1
            i = len(digits) - 1
            while carry > 0 and i >= 0:
                val = digits[i] + carry
                digits[i] = val % 10
                carry = val // 10
                i -= 1
            if carry > 0:
                digits.insert(0, carry)
            return digits
SaaS Development With Laravel Framework
Tags: laravel, saas, webdev, productivity
Published: 2022-06-15 12:01:58

Laravel has emerged in the development market with the great advancements in its versions offering optimal features and functionalities that eventually lead your project to the next level.

With continuous innovation in Laravel Framework, today it has entered into SaaS Development process and have been providing effective results. 

SaaS Development is the future of technology transformation and it is going to change the complete usage as well as approach towards the technology. Laravel as one of the promising technology stack has the potential to contribute and develop potential solutions fulfilling your project expectations.

Discover the full article to get clear understanding on the topic - https://masteringbackend.com/posts/why-is-laravel-best-for-saas-products/
Permutations II
Tags: leetcode, dsa, theabbie
Published: 2022-06-15 12:00:47

Given a collection of numbers, `nums`, that might contain duplicates, return _all possible unique permutations **in any order**._

**Example 1:**

**Input:** nums = \[1,1,2\]
**Output:**
\[\[1,1,2\],
 \[1,2,1\],
 \[2,1,1\]\]

**Example 2:**

**Input:** nums = \[1,2,3\]
**Output:** \[\[1,2,3\],\[1,3,2\],\[2,1,3\],\[2,3,1\],\[3,1,2\],\[3,2,1\]\]

**Constraints:**

*   `1 <= nums.length <= 8`
*   `-10 <= nums[i] <= 10`

**SOLUTION:**

    class Solution:
        def permuteUnique(self, nums: List[int]) -> List[List[int]]:
            n = len(nums)
            ctr = {}
            for num in nums:
                ctr[num] = ctr.get(num, 0) + 1
            nums = set(nums)
            paths = [([num], { **ctr, num: ctr[num] - 1 }, 1) for num in nums]
            while paths[0][2] < n:
                curr, currCtr, l = paths.pop(0)
                for num in nums:
                    if currCtr[num] > 0:
                        paths.append((curr + [num], { **currCtr, num: currCtr[num] - 1 }, l + 1))
            return [perm[0] for perm in paths]
Internet Explorer is officially out of support!
Tags: internetexplorer, ie, ie11, internetexplorer11
Published: 2022-06-15 11:38:49

As of today, (June 15, 2022) [Microsoft no longer supports Internet Explorer 11](https://docs.microsoft.com/en-us/lifecycle/announcements/internet-explorer-11-end-of-support) (the final version of IE)!  [Internet Explorer mode](https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/) still exists in Edge but you no longer need to worry about compatibility with the world's least compliant browser.

There was a time in my career where I worked for a company that once forbid folks from running anything other than IE6.  If you were caught running FireFox, HR would write you up for it.  Since then, FireFox, Chrome, Safari, and (eventually) Edge have successfully built a following and helped push the internet forward.

I am excited about the prospect of an IE-free future. :)
Making JS Library
Published: 2022-06-15 11:34:20

## I need Your Help
iam making a professional open-source js library called functionality.js
i want you guys to star it to appear in the search ❤
### Usage
- functions easy to use
- light weight
- usefull functions you use daily
  - e.g isOdd(), isPrime(), randomNumber(1, 50), randomColor()
### comments
please any one that have an idea for the library share it in the comments

[Library repo](https://github.com/Ali-Eldeba/functionality.js)
QaraTMS — open source test management system
Tags: testing, documentation, opensource, laravel
Published: 2022-06-15 11:33:27

Hello everyone!

**[QaraTMS](https://github.com/a13xh7/QaraTMS)** is my open source test case, test suites, test plans and test runs management tool.

I think the main problems of paid tools are: 

- Prices
- Overloaded interface and functionality - for example, one of these systems has as many as 20 fields in the form for creating a test case. Or a pop-up form in the Test Run, in which you need to specify the result of passing the test every time, even if the test passed. What if there are hundreds of tests? How much time will it take to close this form every time?
- There is no module to store documentation. For tests, too, sometimes you need documentation, such as descriptions of test scripts, settings in the admin panel. And the test case editor is not suitable for creating and editing full-fledged documents.
- And just my desire to be able to store information locally and not to depend on third-party services. What if it closes in a year or changes the terms of use?

Free TMS systems look too outdated and uncomfortable to work with. 

So I thought writing my own TMS is a good idea. I chose laravel framework for this purpose. 

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

## How to work with QaraTMS.

**Create Project**.

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

**Create Test Repository**. Test suites and test cases are located in test repository. You can create several test repositories for different project modules - web, admin, API, etc.

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

**Add test suites and test cases**. 

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

**Create test plan**, select cases you need to test.

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

**Start new test run**.

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

Also, there is **documentation module** where you can store your project's documentation. 

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

And **users and permissions** page. 

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

At this moment that's all. There will be updates and API for auto tests soon. 

**Github** - [https://github.com/a13xh7/QaraTMS](https://github.com/a13xh7/QaraTMS)
Subsets II
Tags: leetcode, dsa, theabbie
Published: 2022-06-15 11:30:41

Given an integer array `nums` that may contain duplicates, return _all possible subsets (the power set)_.

The solution set **must not** contain duplicate subsets. Return the solution in **any order**.

**Example 1:**

**Input:** nums = \[1,2,2\]
**Output:** \[\[\],\[1\],\[1,2\],\[1,2,2\],\[2\],\[2,2\]\]

**Example 2:**

**Input:** nums = \[0\]
**Output:** \[\[\],\[0\]\]

**Constraints:**

*   `1 <= nums.length <= 10`
*   `-10 <= nums[i] <= 10`

**SOLUTION:**

    class Solution:
        def gensets(self, nums, i, curr):
            if i == len(nums):
                self.subsets.add(tuple(curr))
                return
            self.gensets(nums, i + 1, curr)
            self.gensets(nums, i + 1, curr + [nums[i]])
        
        def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
            nums.sort()
            self.subsets = set()
            self.gensets(nums, 0, [])
            return list(self.subsets)