teleren/devto huggingface dataset:
How I came up with a new app idea
Tags: programming, devops, android, code
Published: 2020-05-05 13:28:36

If you want to come up with a new product idea, you need to start with THE CUSTOMER you want to build the business around.

You see, programmers spend millions of hours learning programming languages such as html, css, node, js,…..You cannot spend all this time learning these languages just for learning sake.

The aim of programming is to solve problems for customers. We learn to code so that we can build tools and software for people.

HOW TO CHOOSE THE RIGHT PROBLEM TO SOLVE WITH YOUR PROGRAMMING KNOWLEDGE.

step 1: “choose a customer. Then build a solution for that customer”
I chose ‘taxi drivers’ as my customer. (here, you don’t need to think about which customer to choose.

 Any profession that first comes to your mind is your customer. Because the method presented below will work for any type of customer eg. teacher, musician, etc,… you choose to build for)

Before step 2, I don’t have the product I want to build for taxi drivers in mind, but I know I want to build something for taxi drivers.

step 2: “listen to the story of the customer”

The story of the customer refers to how the customer performs his/her day to day duties. In my case I met a few taxi drivers in my community, had a chat with them and listened to their story. Below is a typical taxi driver’s story

“we wake up early in the morning and wipe our taxis with water and rag. Then we drive to the filling station to fill our petrol tank. Then we drive on the road and look at people on the roadside to see if they need to go somewhere quickly. Then we ask them how much they will pay for us to take them there.
 If they pay for what we want to receive, we pick them up. When we get to their destination, we collect the money from them in cash. Then we move on to find other people”

step 3: “identify key points(takeaways) from the story”

Some of the takeaways from the taxi driver’s story are 1)“wipe our taxis with water and rag” 2)“Then we drive on the road and look at people on the roadside to see if they need to go somewhere quickly.” 3)“we collect the money from them in cash”

step 4: “ pick a product from the list and build”

I build my taxi app ( I am not here to market it and it is not on the app market either) using the second takeaway from the story. Then I showed the working prototype to the taxi drivers to see how they would respond.

After learning to program, you have to build products for the market. This is a simple way of coming up with the right product for the market and how I came up with my app idea.

1. pick a customer
2. listen to the story of the customer
3. take away key points from the story
4. pick a product from the list and build
Does anybody know how many USB devices I can connect on my Macbook Pro 2018?
Tags: watercooler, hardware, help
Published: 2020-05-05 13:27:23

hey there, I've been trying to find some specification on how many USB devices I can have connected to my MacBook Pro 13" 2018. It comes with 3 thunderbolts/USB-c ports, but with USB hubs it can be expanded. 

My question is, how many devices can I have connected at the same time? I can't seem to find any information about that online...
Swiss and Fetch
Tags: customelements, fetch, api, swiss
Published: 2020-05-05 13:24:33

*[Swiss](https://swiss.netlify.app/) provides a functional way of defining custom elements* 

Here is a way to hydrate a custom element from a web request using fetch.

HTML part 

```html
<s-users id="listusers" num=10></s-users>
```

JS part 

```js

function liUsers (user) {
  return `
    <li>
     <img src=${user.picture.thumbnail}></img> ${user.name.first}
    </li>`
} 

function Users (el) {
  let data = null
  let users = listusers.getAttribute("users")
  users &&  ( data = JSON.parse(users))
  const view = `
    <ul>
      ${data && data.map(liUsers).join('') || "Loading.." } 
    </ul>`
  return  view 
}

async function fetchUsers (numUsers) {
  const response = await fetch(`https://randomuser.me/api/?results=${numUsers}`) 
  const data  = await response.json()
  console.log(data.results)
  return data.results
}

function displayUsers (numUsers) {
  fetchUsers(numUsers).then((data) =>  {
      listusers.setAttribute("users", JSON.stringify(data))
    }
  )
}

function main () {
  swiss.element("s-users", Users, ["users"])
  const numUsers = parseInt(listusers.getAttribute("num"))
  displayUsers (numUsers)   
}

main()



```
You can play with it here : [Swiss&Fetch](https://flems.io/#0=N4IgtglgJlA2CmIBcBWA7AOgIxoDQgGMB7AOwGciFlDLYBDABzPihHwDMIEzkBtUEnTCIkIDAAsALmFhsaJSfAXUAPGQC0AV2YAnMgAJoAXgA6IWBDKTt8PWf0lNYIwDYAfCoD0Gm3rcmSfTlmBAJJCFIeUQAGJCwAZnVYgCZkkABfXAEhETEAKx58YgUlSWoA9k0SMIjAiwBVXQMACl8ASn1gAP19HXhrHUCAA26e-RULf0Cx8YgwAHN9Mh0CIwASYF8MBggwzT6MSXEnACNBLnSPTzn5t30NrcFhDE49SXTRnq9JkZJ0-QCFSqNVI+katha8FgHS60wQkn0UDokjo+iMDk0sFgo3h+l8BnRFis+Iw836AEFJJIdBATppFM0zPizG1Rvj9AAyDk9ZqI5Go9EAKQAygB5ABy2zoengrSabVZ02KVn0ADcIPAAO5o-S-GYqTFTGY9DZIlGc7lmugYMCMZoNeUYPJECAkZoAcndHQAPt6ASAADJEOhQV3zDAYez-T7jTyGvW9fr7abqrUAv6AwRkACe1X0lWq4VB7H6BHE4L0+majjAFbIMNGyoRfTIDEi8B1dE1dAgCJLkjLzSGUkkTCQnk8OjoJCgRDAW2EnkYEE8AH4W5jJGR1sAa3X0kMOo3IgirT10V2e834K3206KG7FT1lZR4BhYER5s0rRgN7At0+iYDIEP5-luAQfCQQKFrUiKWAw9DZnWVZ7vKnSjP2ZZ1tWTh1m0hziEozTfvyHRGHc6HTDMRLWE0GDMJIlLUrS9KykyTRmLg+gihK9HMSQ8wQOw2YkSiCoxpBPSKpB0EgoEtqulWDbTGQmqWGQGBQvAwgKIyIA+BxbBgk0XG8OxEJmAAuoBTYYrWTQ6gw0rMAAkrpNEkmSjFUjSdIMmYNYsoBoatohyE4fZEIdD0EGZgpj6ZnIxBgDsCA6NQJx0CcULBFpclRCAsTROoAAsWBINEGRZCATy5BgBBkIU8iKMoogZJZ+AWCQADWUT8DVOTUKp6lyPssiiCOY4TlUDDdeGyXeGpjUAAJYBgyTYJ4IWSIt6n3nIkjZgwuRkAQNIMGU6SWekQA)
Internshala Student Partner program
Published: 2020-05-05 13:12:10

A 70-day work-from-home transformational program aimed at building the leaders of tomorrow. Any college student from any degree, stream, and year of study can apply for this program.

FEW HOURS LEFT...

🎊 Hurry up 🎊

Link to apply:

https://internshala.com/isp?utm_source=ISP18&utm_medium=1121473&utm_campaign=Sagar%20Institute%20Of%20Research%20%26%20Technology%28SIRT%29
Daily Challenge #237 - Delete Extra Occurrences
Tags: challenge
Published: 2020-05-05 13:05:20

---
title: Daily Challenge #237 - Delete Extra Occurrences
published: true
series: Daily Challenge
description: Make your photo gallery tolerable!
tags: challenge
---
Alice and Bob were on a holiday. Both of them took many pictures of the places they've been, and now they want to show Charlie their entire collection. However, Charlie doesn't like these gallery sessions, since the setting usually repeats. He isn't fond of seeing the Eiffel tower 40 times in a row. He tells them that he will only sit during the session if they only show the same setting at most N times. Luckily, Alice and Bob are able to encode each setting as a number. Can you help them to remove numbers such that their list contains each number only up to `N` times, without changing the order?

Given a list `lst` and a number `N`, create a new list that contains each number of `lst` at most `N` times without reordering. For example if `N = 2`, and the input is `[1,2,3,1,2,1,2,3]`, you take `[1,2,3,1,2]`, drop the next `[1,2]` since this would lead to 1 and 2 being in the result 3 times, and then take 3, which leads to `[1,2,3,1,2,3]`.

####Examples
`delete_nth([1,1,1,1],2)` # return `[1,1]`

`delete_nth([20,37,20,21],1)` # return `[20,37,21]`

####Tests
`delete_nth([1,1,3,3,7,2,2,2,2])`, `N= 3`

`delete_nth([20,37,20,21])`, `N = 1`

Good luck!
***
_This [challenge](https://www.codewars.com/kata/554ca54ffa7d91b236000023) comes from JustyFY on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Next.js Building a Car Trading App
Tags: react, javascript, typescript
Published: 2020-05-05 12:58:44

We are going to build a Car Trading application using Next.js.

The application has a FAQ, search page, a list of cars with filters and a car details page.

All the search and list filters are stored in the URL.
I hope you find it helpful :)

{% youtube Hy4Por0yfqE %}
7 Outstanding A/B Testing Ideas to Upgrade Your Product Page
Published: 2020-05-05 12:47:29

A/B testing means comparing the result of changes made in a website to improve the rate of conversion. Even the slightest changes like changing the color of CTA buttons could potentially increase sales and conversions. This testing methodology is also used by giants like Google and Amazon.
A/B testing is simple and provides necessary insight for your website’s product page for what works and what does not. Insights on the habits and behavior of your customers provide you important information to create high-converting marketing strategies. A properly done A/B testing will give the best version of your product page. These A/B testing methods can foster the growth of your eCommerce business.
Testing the various pricing options, images and videos, social proof, including necessary details, etc are some of the outstanding ways to optimize the product page. The fact that A/B testing is an important strategy for eCommerce growth and it is also known to Google who once tested 50 different shades of blue color to find the highest converting one. But it’s not a one-time process, you constantly have to research and update your product pages to see what makes people click on Buy Now CTAs of your website.
Read the full blog on 

[7 Outstanding A/B Testing Ideas to Upgrade Your Product Page](https://www.mconnectmedia.com/blog/outstanding-ab-testing-ideas-upgrade-product-page/) on [Mconnect Media](https://www.mconnectmedia.com/).
Kubestack - Fast path to GitOps for EKS, AKS and GKE
Tags: kubernetes, devops, podcast, automation
Published: 2020-05-06 07:07:33

---
title: Kubestack - Fast path to GitOps for EKS, AKS and GKE
published: true
date: 2020-05-05 12:00:00 UTC
tags: Kubernetes, DevOps, Podcast, automation
canonical_url: https://share.transistor.fm/s/4dea4ccc
---

{% spotify spotify:episode:6o85d6zJPpJJ5JIpMDALW3 %}

Kubestack - [https://www.kubestack.com/](https://www.kubestack.com/)  
  
Kubestack is the open-source Terraform framework for DevOps teams that want to automate infrastructure, not reinvent automation.  
Developed by Phillip Strube **- ** [https://twitter.com/pst418](https://twitter.com/pst418)

- Director of Technology at Container Solutions
- Previously CoreOS and Exoscale

**Kubestack Overview**
- Kubestack brings GitOps to infrastructure
- Scalable for even small teams to manage
- Decouple Applications form Infra
- Multi everything - cluster, region, and cloud
- Inheritance Model 
  - The desired configuration is set for the _apps_ infrastructure environment.
  - _Ops_ inherits configuration from _apps_.
  - The inherited configuration can be overwritten
  - The _ops_ environment serves the purpose to test and validate configuration before it is applied to the _apps_ environment. Configuration drift risks rendering this protection ineffective

**EPISODE DISCOUNTS**  
Use the discount code **podbyte20** good for all our products in all formats from [Manning Publications](https://www.manning.com/)
ERP Implementation Failure
Published: 2020-05-05 11:43:38

To be clear, the number of failures in implementing ERP is due to failure to achieve the main business goals effectively, which involves the following:

<li>Implementation on time</li>
<li>Operational efficiency assurance</li>
<li>Higher productivity assurance</li>
<li>Operational cost reduction</li>                                            <li>Sales and revenue growth</li>                                         <li>Spending plan exceedance</li>
.
.
.
Read Original Blog: <a href="https://www.odooimplementation.com/blog/erp_implementation_failure">ERP Implementation Failure</a>
Performance matters
Tags: java, performance, optional, codequality
Published: 2020-05-05 11:39:26

---
title: Performance matters
published: true
description: 
tags: #Java, #Performance, #Optional, #CodeQuality
---
![Performance](https://dev-to-uploads.s3.amazonaws.com/i/7fhnxykm9sgbhq3553pp.jpg)

> Good performance starts with good code.

Sometimes a small change in your code can make a significant amount of performance improvement.
So let not your code stink, be careful next time while you write code.

The API of Optional typically has two methods that can cause confusion: orElse() and orElseGet().

```
1.  public T orElse(T other)
2.  public T orElseGet(Supplier<? extends T> other)
```

Clearly, orElse() takes any parameter of a type T whereas orElseGet() accepts a functional interface of type Supplier that returns an object of type T.

Now, based on their [Javadocs](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html#orElse-T-):

. orElse(): returns the value if present, otherwise return other
. orElseGet(): returns the value if present, otherwise invoke other and return the result of its invocation

### orElse()

**orElse()** is evaluated even when having a non-empty Optional.
For example, 

```
String name = Optional.of("dev.to")
  .orElse(processData());

public String processData() {
    LOG.info("process data method - start");
     
    // DB process/update complex business logic 
     
    LOG.info("processData method - end");
    return "processed string";
}
```
On executing our code, we'll find below messages printed in the console:

```
process data method - start
processData method - end
```
The variable name will hold **dev.to** at the end of the code execution.

With it, we can easily infer that the parameter of **orElse()** is evaluated even when having a non-empty Optional. It can easily cause Hugh performance downgrade if `else` part is having some DB processing or complex business logic.

### orElseGet()

Now, let's try writing similar code using **orElseGet()** 

```
String name = Optional.of("dev.to")
  .orElseGet(() -> processData());

public String processData() {
    LOG.info("process data method - start");
     
    // DB process/update heavy processing 
     
    LOG.info("processData method - end");
    return "processed string";
}
```
The above code will not invoke processData() method.

Using **orElseGet()** for our case will, therefore, save us some time involved in computing.

So to summarize this blog we can considering factors involve.

* What if the method would execute some additional logic? E.g. making some DB inserts or updates

* Even when we assign an object to orElse() parameter

> String name = Optional.of("dev.to")
  .orElse("Other");

we're still creating “Other” object for no reason

And that's why it is important for us to make a careful decision among orElse() and `orElseGet()` depending on our needs – by default, it makes more sense to use `orElseGet()` every time unless the default object is already constructed and accessible directly.
Javascript interviews: undefined V/s null
Tags: javascript, career, beginners
Published: 2020-05-05 11:39:25

Hey fellow devs!

Having conducted interviews for **Javascript developers** over the *past several years*, I am now starting a new playlist series on my YouTube channel focussed on Javascript interviews for beginner developers. I would be covering questions from multiple sources online, especially this dev.to post:

{% link macmacky/70-javascript-interview-questions-5gfi %}

In this week's video, we look into one of the basic questions: **undefined ** v/s **null**. We discuss how to answer this question using the **keywords** that the interviewer is interested in hearing. Here's the video:
{% youtube XKDsb08-TMA %} 

Feel free to discuss your views about the topic in the comments or suggested topics that you have come across in your experience with interviews.

Cheers!
Starting Full Stack Open Course
Tags: fullstackopen, javascript, react, graphql
Published: 2020-05-05 11:31:24

Hello everyone. I have made the decision to start blogging more frequently as a way to see my progress over time and reflect back. This is my first post in a blog about the [Full Stack Open Course by the University of Helsinki](https://fullstackopen.com/en/). 

I have been putting off taking this course for a long time. Their other course for Java, which can be found [here](https://java-programming.mooc.fi/), was awesome. I personally learned more from that course than anything else.  

So, back to Full Stack Open. The course was just updated, which is the perfect time to start. I always thought that I should wait and learn a lot before attempting this course, but I decided to just start. I'm working part-time currently, which is great because I will more time for the course. I already did part 0, almost done with part 1 too. I will try writing a post either every week or after every part I finish, but I will decide that later, depending on my progress.

That is all for now, I am extremely excited, there is also a [Telegram](https://t.me/fullstackcourse) group which I've already joined. If you are in the same shoes as me, and you're thinking about taking this course, just do it. Now is the perfect time.
Javascripts async and loops
Tags: javascript, async, todayilearned, node
Published: 2020-05-05 11:31:02

---
title: Javascripts async and loops
published: true
description: Javascripts async might not loop the way you think
tags: javascript, async, todayilearned, node
---

Thanks to async/await many pieces of code became much more declarative. But there is one tricky scenario that I just bumped into: I needed to do a handful of API requests in a loop and refresh the list view afterwards. Easy peasy?

```js
async updateAllItems (listOfItems) {
  listOfItems.forEach(async (item) => {
    await collection.updateItem(item.id, { status: 'coolNewStatus' })
  })
  const newItems = await collection.allItems()
  return newItems
}
```

What's the problem here? Some people might have seen it already (unlike me in the last couple of hours): newItems will be loaded before the loop ended because we're not actually waiting for it to end. Simply throwing another `await` in front of it doesn't cut it either.

There are at least three possible solutions, depending on your style.

✅ Sticking to the procedural approach:
```js
async updateAllItems (listOfItems) {
  for (const item of listOfItems) {
    await collection.updateItem(item.id, { status: 'coolNewStatus' })
  }
  const newItems = await collection.allItems()
  return newItems
}
```
Why are people so afraid of for-loops anyway?

✅ Promise.all
```js
async updateAllItems (listOfItems) {
  await Promise.all(listOfItems.map(item => {
    return collection.updateItem(item.id, { status: 'coolNewStatus' })
  }))
  const newItems = await collection.allItems()
  return newItems
}
```
A little lispy, isn't it?

❌ await async
```js
async updateAllItems (listOfItems) {
  listOfItems.forEach(await (async (item) => {
    await collection.updateItem(item.id, { status: 'coolNewStatus' })
  }))
  const newItems = await collection.allItems()
  return newItems
}
```
This does NOT work. Why? No idea. Do you have any idea?

Anyways, I hope this helps you with your next async race condition. Cheers 🥂
Scheduled deployments using GitHub Actions on Zeit Now
Tags: github, devops
Published: 2020-05-05 11:27:49


### What are Github Actions?

Github Actions allow creating workflow around the Github repository. For example, you can manage triggers to run tests, create software build after a merge, basically have your manage your entire CI/CD process from Github actions and many other cool things too.

Check this [Github repo](https://github.com/sdras/awesome-actions), which has examples curated by the community.

### Why Schedule builds

It's been a while since GitHub actions where announced, but I didn't have any use case to implement it any of my projects, until now 😅.

I had built a [static site](https://covid-dashboard.now.sh) that shows COVID-19 stats, but most of the data it showcased was retrieved at build time rather than runtime. I didn't want the client to call more than 200 REST API calls (because the endpoint of all the countries where different). So, I needed to build and deploy the project after a definite time to make sure the stats data were not stale.

### Implementing Scheduled Builds

Well, the deployment part was taken care of by Zeit Now. Where I had deployed the project, and they offer a generous free plan. So I created a deploy webhook from Zeit's dashboard. Using the webhook, I can trigger the redeployment without any merge to the master branch, or going to the deployment dashboard.

![Creating webhook from Zeit's Dashboard](zeit-dashboard.png)


Still, I have to visit the link to trigger a redeployment. And this is where GitHub's actions come to the rescue. It allows you to run tasks in ubuntu/mac/windows in their cloud platform.

The workflows that you create must be in the .github/workflows directory of your repository. I just had to write a YAML script that hits the webhook using curl and schedule that to run once every 6-hour using a cronjob.

![Code snippet of the workflow](featured-image.png)

Note: `${{ secrets.zeit_develop_webhook }}` is a secret variable containing the webhook URL, to create secret variable go to <br /> `Github Repo Settings > Secrets > Add a new secret`



Read more about such post on
[jibin.tech/blog](https://jibin.tech/blog/)
What note/snippet app do you use?
Tags: note, snippet, vscode, productivity
Published: 2020-05-05 11:18:58

Hi everyone, for quite some time now I'm in search of a great snippet and note-taking app.

For notes currently, I'm using <a href="https://simplenote.com/">Simplenote</a> it's awesome for short notes because it has a mobile app to so I can access them anytime, but it isn't really good for code snippets :/ 

It would be ideal if the snippet manager had a vscode integration and but not mandatory uses GitHub gists.