teleren/devto huggingface dataset:
Min-maxSum
Tags: beginners, devops
Published: 2020-08-09 18:21:47

Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.

Example 
arr=[1,3,5,7,9]

The minimum sum is 1+3+5+7=16 
and the maximum sum is 3+5+7+9=24.
The function prints
16 24
Function Description

Complete the miniMaxSum function in the editor below.

miniMaxSum has the following parameter(s):

arr: an array of  integers
Print

Print two space-separated integers on one line: the minimum sum and the maximum sum of of  elements.

Input Format

A single line of five space-separated integers.

Constraints
1<=arr[i]<10^9

Output Format


Print two space-separated long integers denoting the respective minimum and maximum values that can be calculated by summing exactly four of the five integers. (The output can be greater than a 32 bit integer.)

Sample Input

1 2 3 4 5
Sample Output

10 14
------------------------------

Here is my solution..
i am using JAVA programming language:


static void miniMaxSum(int[] arr)
{
long min=1000000000,max=-1;
long sum=0,minS,maxS;


for(int i=0;i<arr.length;i++)
{

if(arr[i]<min)

{
min=arr[i];
}
if(arr[i]>max)
{
max=arr[i];
}
}
for(int i=0;i<arr.length;i++)
{
sum=sum+arr[i];
}
minS=sum-max;
maxS=sum-min;
System.out.println(minS+" "+maxS);
}

HappyCoding❤️
I hope you like it!
Setting up redux is difficult
Tags: redux, react, javascript
Published: 2020-08-09 18:13:13

---
title: Setting up redux is difficult
published: true
description:
tags: #redux, #react, #javascript
//cover_image: https://direct_url_to_image.jpg
---

when I start a new project I always need to use a boilerplate with redux, redux saga, redux persist (or whatever I need) or to look at some old project I did because I never remember how to do that.
Is that normal or it's just me? Did you find any "solution"?
Which has more opportunities? (Short road to starting?) React, Vue, JavaScript, Python? [Front/ Back-End]?
Tags: javascript, react, vue, python
Published: 2020-08-09 18:03:03

So far, I know the basics of HHTML, CSS, kinda Vanilla JS.

Then also I know well, 
React and Vue.

For styling I know:
Css, bootstrap, sass, Vuetify, Material-UI, styled-Components 


I’m getting the hang of Python with the basics. I’m at the point of creating a Dictionary and other containers, and calling, getting data....
But, it’s not at a “you can see it” point... other than in the console....

When do you start seeing data or movement on the page????


Which should I focus on learning the most, as well as opportunities?
Quick Tip: Setup Typescript type-checking with your Pure Javascript
Tags: javascript, typescript, jsdoc, beginners
Published: 2020-08-09 17:42:04



# Today's Developer Experience (DX) Tip:

a.
install Typescript globally on your devbox
```JS
npm i -g typescript
```

b.
install these in your package.json as devDependencies
```JS
npm i -D eslint eslint-plugin-jsdoc
```

c.
create a `tsconfig.json` file in the root of your project or monorepo

```JS
cd MYROOTPROJ
tsc --init
```
("tsc" stands for TypeScript Compiler)

d.
Open the newly generated tsconfig.json and UNCOMMENT these two lines...
```JS
  "allowJs": true,  // allow javascript files to be compiled
  "checkJs": true, // report errors in .js files

```
(By doing this you'll never need to use... // @ts-check)

e.
Type your function definitions with JSDoc syntax.
Make sure the top comment line starts with: /**


# Summary
Now you have all the Typescript services, while keeping your code pure JavaScript.
The best of both worlds.

Example (see the squigglies):
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pcjwnypg2jzdgyp9k61r.jpg)


# Next Tip
How to register your own custom JSDoc tags in your project. Go here...
https://dev.to/functional_js/add-jsdoc-to-your-javascript-code-2lb0
I created an iPhone using pure CSS and only 1 DIV
Tags: codepen, codenewbie, artsy
Published: 2020-08-09 18:01:43

About a few years ago, I found a tutorial how they teach you to create an apple logo using CSS and multiple DIVs. 

This image of an iPhone - including all the elements in it, e.g. logo, camera, buttons, etc - is created using only 1 DIV:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xhlu5gw3ncxo3q0at9f0.png)

The whole source code can be found here:
https://codepen.io/thadeuszlay/pen/EyZxZj

It's an ongoing series I make: Creating images with CSS and only 1 DIV. If you have another idea what else I could make, drop a line.
How do you deal with Q&A web platform's trolls? (e. g., Stack Overflow, Quora, etc.)
Tags: discuss, qaplatforms, trolls
Published: 2020-08-09 17:44:29

We all run into bugs. The confusing error messages, the debugger which takes too long/doesn't work, Google not helping, you name it!

For most of it, we are just desperate and really need some help from an outsider/specialist. It is at that moment that we tend to turn to Stack Overflow, Quora, Yahoo! Answers, etc. and poor our ~~hearts~~ questions out.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/y4au283l0t2xf7zzf9uu.png)
<!-- {% twitter 1291620810831142914 %} -->
<!-- Embed here the pool tweet I made -->

Occasionally, the feedback we receive on those questions can be rather shameful.
{% twitter 1290679880989003776 %}

Which made me curious about your personal experience with those platforms.

Let's discuss:

## Have you been publicly shamed for publishing a question? What language/platform was it referring to? How did you react to it?

The word on the streets is that the Java and Linux communities are not really nice and welcoming of "newbies stupid questions" - which I don't think are stupid, by the way, but helps to reinforce the point.

Let me know how your experiences have been and if you hold any language-grudge for such reason. I want to know about good and bad experiences. 

May Our Lady of Clear Code bless us all.
When do you use generator based library for async programming instead of the async/await?
Tags: discuss
Published: 2020-08-09 17:39:10

---
title: When do you use generator based library for async programming instead of the async/await?
published: true
description: 
tags: discuss
//cover_image: https://direct_url_to_image.jpg
---

When I have to do some async programming I always choose the async/await syntax. But today I have read about [co](https://www.npmjs.com/package/co) lib which is based on generators. What are the pros and cons of both approaches?

Could you give me an example in which situations are generators better choice for async programming than async/await?
Are drivers for android things compatible with the regular Android OS
Tags: help, beginners, android
Published: 2020-08-09 17:30:50

Hi, so my original goal was to install an external GPS module to a single board computer running android and be able to run navigation apps using the GPS data from the GPS module. I first tried using a raspberry pi 3 running android things. I bought a GPS hat for it and found this appropriate driver 

https://github.com/androidthings/drivers-samples/tree/master/gps

However, after installing android things I decided that it wasn't exactly what I was expecting and wanted a full-fledged version of android along with access to the google play store. I am currently debating buying a Odroid single board computer and installing Android on it, not android things. My question is, would the driver above work with Android and my GPS module? The Odroid I am looking at has the same 40 pin layout as the pi so the GPS hat should connect properly.
Quick VSCode Editor Tip
Tags: javascript, vscode
Published: 2020-08-09 16:58:21

Need to switch from tabs to spaces?

Use a regex.

Find and replace `\t` with two blank spaces.

Here it is in VSCode

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9ra5scuz1g336gbz1rkn.png)
Sum All Primes
Tags: javascript, algorithms
Published: 2020-08-09 16:58:13

> A prime number is a whole number greater than 1 with exactly two divisors: 1 and itself. For example, 2 is a prime number because it is only divisible by 1 and 2. In contrast, 4 is not prime since it is divisible by 1, 2 and 4.

> Rewrite `sumPrimes` so it returns the sum of all prime numbers that are less than or equal to num.

Sometimes I forget not everything needs to be solved within one block of code. If your function tries to solve more than one problem, you should consider divvying up its tasks into other functions. 

This problem is actually asking us to do two things: check if the number is prime and add up all the primes numbers up to `num`. We can do this by using two functions. The first one is to check if the number is prime. It simply returns a boolean of `true` or `false`:

```js
const isPrime = num => {
  for (var i = 2; i < num; i++) {
    if (num % i === 0) return false
  }
  return true;
}
```

`isPrime()` takes `num` as an argument. It will then run a `for` loop starting at 2 (because we already know 1 is a prime number). If at any point during our iteration `num` is divisible by `i`, we will return `false` and the function will end there. Otherwise, the number is a prime number and we return `true`.

This function does exactly what is asked of it: check to see if `num` is a prime number. It doesn't do any more or any less, however, we still have another function to write. We need to add the sum of all the prime numbers that are less than or equal to `num`.

```js
const sumPrimes = num => {
  let primes = []

  for (let i = num; i != 1; i--) {
    if (isPrime(i)) primes.push(i);
  }
  return primes.reduce((acc, curr) => acc + curr)
}
```

You can see in this function we are using `isPrime()` to check if the number, well, is prime. If I were to have combined both of these functions into one it would have been pretty messy. 

So, `sumPrimes` takes in `num`, then it creates an empty array which we will use to store our prime numbers. A `for` loop is started but if you look closely, `i` is instantiated to `num` and from there we go *down* until `i` is equal to 0. At this point the loop will end. Inside the loop we are simply checking if `num` is prime. If it is we add it to our array. If it isn't we do nothing and keep iterating. Our return statement looks fancy schmancy using the `reduce` method but I only did that to make it look impressive. All it's doing is adding up all of our primes and returning it to us. And that's it!

Like I stated in the first paragraph of this blog post, it's important to know what a problem is asking of you. If you can read between the lines and notice it's wanting you to do more than just one thing, consider if splitting it up into separate functions would be better.
[Tutorial Linux] Terminal: Atualizando o sistema
Tags: linux, update, upgrade, braziliandevs
Published: 2020-08-09 16:53:35

Essa instrução serve para as distros Linux baseadas no Debian (Ubuntu, Mint e derivados).

## Baixando a lista de repositórios

Para atualizar os pacotes do seu sistema, digite no terminal:

```
$ sudo apt update
```

- **$** indica que você deve usar o **usuário comum** para fazer essa operação.

- **sudo** serve para pedir permissões de administrador temporariamente.

- **apt** do inglês, *Advanced Package Tool*, em português, Ferramenta de Empacotamento Avançada; é a ferramenta que nos ajuda na instalação, atualização e desinstalação de programas, entre outras funções.

- **update** serve para atualizar a lista dos **repositórios**.

> Os **repositórios** são servidores que hospedam os pacotes de software de cada distribuição Linux.

Será mostrado na tela as atualizações existentes.

![atualizando repositórios](https://dev-to-uploads.s3.amazonaws.com/i/b3ysrh5vrxepxu40gghm.gif)

## Instalando as atualizações

Para fazer a instalação dessas atualizações,

```
$ sudo apt upgrade
```

- **upgrade** é o comando que irá fazer a instalação das atualizações em si.
Does anyone know any OOP books/sites for Javascript?
Tags: oop, javascript
Published: 2020-08-09 16:33:02

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

Does anyone know any good object oriented programming books or sites for Javascript? 

I got myself to learn a lot about functional programming with the following book: https://mostly-adequate.gitbooks.io/mostly-adequate-guide/content/

A masterpiece in my opinion. I LOVED it so much! And was wondering if anyone happens to know about a similar book for OOP?

Thank you very much in advance!!
Why blogging makes you a better developer - learnings after one year
Tags: career, webdev, codenewbie
Published: 2020-08-09 16:20:11

It was one year ago when I started sketching the ideas for my first blog article. The reason? I had failed my biggest freelance project yet. Knowing that there were things I could've done differently, there was a need to share that knowledge and learnings. That's how my first blog article came to be.

(you can check it out in Dev.to - [Freelancing big projects - 9 key takeaways from my failure that you can learn from
](https://dev.to/kethmars/freelancing-big-projects-9-key-takeaways-from-my-failure-that-you-can-learn-from-4m20))

## Btw, don't be afraid
Before publishing my first article, I was super scared. Questions like "Do others need to hear about it?" or "What if they start mocking me?" etc went through my head.

Looking back, it was one of the best decisions I've made as a developer. So don't be afraid. The community's really friendly!

[All the reasons with more detailed explanations and examples can be found in my YT channel called DeveloperHabits](https://youtu.be/IWF9oNBCf1c).
{% youtube IWF9oNBCf1c %}

**Reasons, why you should start blogging as a developer**
- You get to reflect on your experiences and learn from them
- A notebook on what you've done, why you've done it - that's what a blog is
- Teaching is the best way to learn technical topics
- It ignites discussion all parties can learn from
- Meet new people and learn from them
- Advances your career as you make yourself visible
- Improves your communication and writing skills
- You get to help others


---

Oh and...! If you are interested in coding, growth mindset and are willing to share your experiences, ideas, then please do PM me on Twitter :)!

**DeveloperHabits**
📷 Youtube: [developerHabits](https://www.youtube.com/channel/UCJLZwePkNHps5Bv7VwISyTA)
👉 Twitter: [https://twitter.com/developerHabits](https://twitter.com/developerHabits)
👉 IG: [https://www.instagram.com/developerhabits](https://www.instagram.com/developerhabits)
63: Ugly Coding 
Published: 2020-07-09 13:02:55


###*THE STANDARD*
Before creating the pretty portfolio website that makes my face look nice to others, I would rather choose to know my ugly codes, that's also me, I need my ugly code, honestly, faking is such easy, but we know inside. I couldn't even step into HTML, CSS because I was not satisfied with solving problems, I solved less than 10 problems, and felt it is not enough! and I respect my standard now, really. 

---
###*I am going to challenge 'solve the 30 problems' for one month! with Javascript :)* 

Going to continue the artwork journey no matter how hard it is, no matter how inefficient it is, I am a baby coder, why do I need to be like a marathon runner? I am just learning how to walk. Sometimes, I feel vulnerable, falling down is painful, shame, BUT again, That is normal, and it is OKAY. 


---
No reject to get loved by the right people, and thanks to that the developer groups are opened to diversity, which is my biggest inspiration to consist of my creativity and happy to connect with like-minded people globally. And... SO, let me start my authentic world :)
Deploy a REACT app with Flask API backend on Kubernetes Cluster- Part 2- Complete the Jenkins Pipeline
Tags: jenkins, kubernetes, devops, react
Published: 2020-08-09 16:10:42

Previously I wrote a post explaining how we can design a Kubernetes deployment to deploy a full stack React app with Flask API backend.  

In this post I am completing the walk-through adding a deployment automation to Kubernetes cluster using Jenkins. 
This is the final part of the series where I will be going through steps to deploy the Kubernetes components described in the above post to Kubernetes cluster. I will be using a Jenkins pipeline to deploy the Kubernetes resources to a cluster and make the react app accessible from a node endpoint. For simplicity I have simplified the Jenkins steps. These steps are good for normal practice but if you want to use this in a Production environment there are some changes needed which I will try to explain as I go through the steps.

Find the whole post here:  
https://amlanscloud.com/reactappdeploy2/  

You can find the first part here:
https://amlanscloud.com/reactappdeploy/
Briefing 18
Published: 2020-07-04 16:59:30

*Original Post Date: 5/3/2020*
*Author: IvanCoHe*

## Ok so the prerelease is out. This is old news now, obviouly, BUT, you might not know about what isn't in the prerelease!

**70% OF ALL CRAFTS ARE GONE 🦀**  Ok, so only 30% of the items that will be craftable are craftable in the prerelease. This means we still have A LOT of stuff to see, which makes big hype. Also, no, Spudguns aren't craftable. You need to...

**SLAVE TRADING. NOT A JOKE.** You can trade people in survival for guns. This is not a joke. So there are these caged farmers you might find around the map? Yeah uh, those are sellable to the Market Farmers. And you can buy guns with it! 5 of them plus 30 of a specific fruit for each spudgun. This is truly big brain.

**Creative is getting all the new stuff.** That's it. Oh also, trees and rocks are parts, so @TechnologicNick was right about that. Big brain.

**The map is 10x the size**

**THERE might BE LORE.** Ok so you know that L button that can't be pressed in the prerelease? That's a Raft-styled logbook. That's all we know.

**That's it for today! This is truly a big brain move by the devs, very cool.**
New-gen SEO Analysis Tool
Published: 2020-08-09 15:22:13

![Screpy - AI-Based SEO Analysis Tool](https://dev-to-uploads.s3.amazonaws.com/i/zpd5ly9wjxhugnoz3cs2.png)

[Screpy](https://screpy.com/) is a web analysis tool that can analyze all pages of your websites in one dashboard and monitor them with your team.

[https://screpy.com/](https://screpy.com/)
Testing arduino + wifi card project 📟

Tags: beginners, arduino, architecture, iot
Published: 2020-08-09 14:58:56

# 🎯 Goal

**Goal**: Simulate a system that prevents someone his is too close to some place or device by turning on a LED.

At a later stage, user will be able to turn on/off the system remotely via a web server.

**use case** can be used to prevent your child of dangerous place or device, like a hotplate ? 

## Steps
I divide the system into 3 separate system

- LED sys
- Presence/Distance sensor
- Web server

> Use tinkercad to simulate the project. Please try it, you will love it.
> https://www.tinkercad.com/

# LED device

![](https://i.imgur.com/G5vUtgG.jpg)

## diagram (tinkercad)

![](https://i.imgur.com/p5pCgHO.png)

# Distance sensor

![](https://i.imgur.com/ZuMuTUE.png)

## Diagram

![](https://i.imgur.com/aHV3LPn.png)


## Web server + Wifi CARD

Testing server.

![](https://i.imgur.com/d6cUhZp.png)



# Final stage

In order to connect/plug PINS of the wifi card i used this diagram below. 

![](https://i.imgur.com/vxzzcFi.png)

LED + Distance sensor  + Wifi card

I set up a range distance of 40cm to active the LED.

![](https://i.imgur.com/oDyjMmV.png)


# Test

Logs show that the server can get the distance from our system.


![](https://i.imgur.com/FNkgxfq.png)

## Issues 
- Instead of set up the wifi card you need to **install the correct** driver, this is tricky, for me this one was a solution: CP210x USB to UART Bridge VCP Drivers
Link : https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

- Sometimes, a wifi card PIN must be activated to switch to OUTPUT mode.

- I order to read and write data from arduino card at the sametime i need an asynchronous code.

# Libs 

Distance sensor HCSR04
https://github.com/jeremylindsayni/Bifrost.Arduino.Sensors.HCSR04

Wifi card
https://fr.macerobotics.com/developpeur/tutoriels/esp8266-controle-dune-led-par-wifi/
Testing arduino + wifi card project 📟
Tags: architecture, beginners, testing
Published: 2020-08-09 14:52:34

# 🎯 Goal

**Goal**: Simulate a system that prevents someone his is too close to some place or device by turning on a LED.

At a later stage, user will be able to turn on/off the system remotely via a web server.

**use case** can be used to prevent your child of dangerous place or device, like a hotplate ? 

## Steps
I divide the system into 3 separate system

- LED sys
- Presence/Distance sensor
- Web server

> Use tinkercad to simulate the project. Please try it, you will love it.
> https://www.tinkercad.com/

# LED device

![](https://i.imgur.com/G5vUtgG.jpg)

## diagram (tinkercad)

![](https://i.imgur.com/p5pCgHO.png)

# Distance sensor

![](https://i.imgur.com/ZuMuTUE.png)

## Diagram

![](https://i.imgur.com/aHV3LPn.png)


## Web server + Wifi CARD

Testing server.

![](https://i.imgur.com/d6cUhZp.png)



# Final stage

In order to connect/plug PINS of the wifi card i used this diagram below. 

![](https://i.imgur.com/vxzzcFi.png)

LED + Distance sensor  + Wifi card

I set up a range distance of 40cm to active the LED.

![](https://i.imgur.com/oDyjMmV.png)


# Test

Logs show that the server can get the distance from our system.


![](https://i.imgur.com/FNkgxfq.png)

## Issues 
- Instead of set up the wifi card you need to **install the correct** driver, this is tricky, for me this one was a solution: CP210x USB to UART Bridge VCP Drivers
Link : https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

- Sometimes, a wifi card PIN must be activated to switch to OUTPUT mode.

- I order to read and write data from arduino card at the sametime i need an asynchronous code.

# Libs 

Distance sensor HCSR04
https://github.com/jeremylindsayni/Bifrost.Arduino.Sensors.HCSR04

Wifi card
https://fr.macerobotics.com/developpeur/tutoriels/esp8266-controle-dune-led-par-wifi/