teleren/devto huggingface dataset:
Silent push for the web
Tags: security, javascript, standards, browsers
Published: 2019-10-28 17:22:56

*This was originally posted <a href="https://adactio.com/journal/16031" rel="canonical">on my own site</a>.*

After Indie Web Camp in Berlin last year, I wrote about [Seb's nifty demo](https://seblog.nl/2018/11/13/3/pushapi-without-notifications) of [push without notifications](https://adactio.com/journal/14511):

> While I’m very unwilling to grant permission to be interrupted by intrusive notifications, I’d be more than willing to grant permission to allow a website to silently cache timely content in the background. It would be a more calm technology.

Phil Nash left [a comment on the Medium copy of my post](https://medium.com/@philnash/youre-looking-for-silent-push-as-are-many-others-f6a188ce95ac) explaining that Seb's demo of using the Push API without showing a notification wouldn't work for long:

> The browsers allow a certain number of mistakes(?) before they start to show a generic notification to say that your site sent a push notification without showing a notification. I believe that after ~10 or so notifications, and that’s different between browsers, they run out of patience.

He also provided me with the name to describe what I'm after:

> You’re looking for “silent push” as are many others.

Silent push is something that *is* possible in native apps. It isn't (yet?) available on the web, presumably because of security concerns.

It's an API that would ripe for abuse. I mean, just look at the mess we've made with APIs like notifications and geolocation. Sure, they require explicit user opt-in, but these opt-ins are seen so often that users are sick of seeing them. Silent push would be one more permission-based API to add to the stack of annoyances.

Still, I'd *really* like silent push for the web—the ability to update a cache with fresh content as soon as it's published; that would be nifty! At the same time, I understand the concerns. It feels more powerful than other permission-based APIs like notifications.

Maybe there could be another layer of permissions. What if adding a site to your home screen was the first step? If a site is running on HTTPS, has a service worker, has a web app manifest, *and* has been added to the homescreen, maybe then and only then should it be allowed to prompt for permission to do silent push.

In other words, what if certain very powerful APIs were only available to progressive web apps that have successfully been added to the home screen?

Frankly, I'd be happy if the same permissions model applied to web notifications too, but I guess that ship has sailed.

Anyway, all this is pure conjecture on my part. As far as I know, silent push isn't on the roadmap for any of the browser vendors right now. That's fair enough. Although it does annoy me that native apps have this capability that web sites don't.

It used to be that there was a long list of features that only native apps could do, but that list has grown shorter and shorter. The web's hare is catching up to native's tortoise.

*This was originally posted <a href="https://adactio.com/journal/16031" rel="canonical">on my own site</a>.*
Daily Challenge #100 - Round Up
Tags: challenge
Published: 2019-10-28 17:19:18

---
title: Daily Challenge #100 - Round Up
published: true
series: Daily Challenge
description: A round up of the most popular challenges from 1 - 99. 
tags: challenge
---

We started our daily challenge series on June 28th and it has been an amazing experience seeing your comments, suggestions, and solutions these past few months. In this post, I've collected some of our most popular challenges. If you have any of these challenges in your reading list, maybe try your hand at them!

{%link https://dev.to/thepracticaldev/daily-challenge-1-string-peeler-4nep %}
Our first challenge post asked users to simply remove the first and last characters off a string. You all gave a variety of answers in CSS, Ruby, and Javascript!

@alvaromontoro got the most popular comment on this post with 43 hearts. He's been a great help to many around our community, you'll see his comments on a lot of our challenge posts.
{% devcomment ced2 %}
***
{%link https://dev.to/thepracticaldev/daily-challenge-48-facebook-likes-263l %}
We really thought this post would be trickier, but a lot of really short, thoughtful answers came in. Daily Challenge #48 asked users to write a function that mimics the syntax common on Facebook. 

@alvaromontoro got the most popular comment again, even 47 posts later! @avalander also gave a great answer using Haskell and got 15 hearts:{% devcomment eehe %}
***
{%link https://dev.to/thepracticaldev/daily-challenge-31-count-ipv4-addresses-487j %}
Daily Challenge #31 prompted users to return the number of IP addresses between a starting point and an ending point. 

@phallstrom found a cheeky solution by using Ruby's IPAddr class. @kerrishotts went above and beyond and made the function work if the points were reversed, great work!
{% devcomment dlnj %}
 ***
{%link https://dev.to/thepracticaldev/daily-challenge-60-find-the-missing-letter-49bn %}
Our 60th challenge asked users to write a function that takes an array of consecutive letters as input and that returns the missing letter in the array.

@citizen428 offered some improvements on a Go answer left by @dak425, and even left his own answer in F#!
{% devcomment f457%}
***
{%link https://dev.to/thepracticaldev/daily-challenge-42-caesar-cipher-43k8 %}
The Caesar Cipher is a well-known challenge for beginner programmers to start thinking about larger concepts like data encryption. Daily Challenge #42 asked users to work with the cipher, gave a shift key and a string and asked for the plain text. 

@ynndvn used the brute force method on this challenge post back in August and I have seen them commenting their solutions on our latest challenges. Awesome work!
{% devcomment e7fd%}

Thank you to CodeWars for allowing redistribution under the 2-Clause BSD License.

Special thanks to @peledzohar and @aminnairi for contributing to the series. Want to propose a challenge for a future post? Email yo+challenge@dev.to with your suggestions!
[Dream] Blood Billions: A social media for Blood Donors
Tags: hope, iwontquit, cloud, dream
Published: 2019-10-28 16:50:11

Its been 5 years, I have been attempting to create it, but failed in doing so. There have been many times, I quit but somehow it never died in me, no matter what. Recently, I was put down for this once more but something in me doesnt want to give up. 

What gives me hope for this project now?
Its knowing the Amazon Cloud

Why do I think it failed?
A typical server setup, where it was not scalable.

What is blood billions?
A social media for blood donors.


![](https://i.ibb.co/9tR76kw/Screenshot-2019-10-28-at-9-24-37-PM.png)
![](https://i.ibb.co/XZyXTdj/Screenshot-2019-10-28-at-9-24-31-PM.png)
![](https://i.ibb.co/d5Rq0Tw/Screenshot-2019-10-28-at-9-24-21-PM.png)
![](https://i.ibb.co/YZNmWD9/Screenshot-2019-10-28-at-9-29-58-PM.png)
![](https://i.ibb.co/cr41Zcy/Screenshot-2019-10-28-at-9-29-51-PM.png)
![](https://i.ibb.co/YPH3Wfj/Screenshot-2019-10-28-at-9-29-42-PM.png)
![](https://i.ibb.co/bQDHVBq/Screenshot-2019-10-28-at-9-29-35-PM.png)
![](https://i.ibb.co/N9R71Gc/Screenshot-2019-10-28-at-9-29-29-PM.png)
![](https://i.ibb.co/LNGXfsH/Screenshot-2019-10-28-at-9-29-11-PM.png)
![](https://i.ibb.co/YQfmtM5/Screenshot-2019-10-28-at-9-29-05-PM.png)
![](https://i.ibb.co/qMrhNR7/Screenshot-2019-10-28-at-9-28-55-PM.png)
![](https://i.ibb.co/QKv70Qv/Screenshot-2019-10-28-at-9-28-48-PM.png)
![](https://i.ibb.co/3YFBp2S/Screenshot-2019-10-28-at-9-28-33-PM.png)
![](https://i.ibb.co/7YDfDfJ/Screenshot-2019-10-28-at-9-28-26-PM.png)
![](https://i.ibb.co/KhSFQg0/Screenshot-2019-10-28-at-9-27-55-PM.png)
![](https://i.ibb.co/1281Tq5/Screenshot-2019-10-28-at-9-27-46-PM.png)
![](https://i.ibb.co/g31h8TX/Screenshot-2019-10-28-at-9-27-37-PM.png)
![](https://i.ibb.co/Lzj7kx7/Screenshot-2019-10-28-at-9-27-25-PM.png)
![](https://i.ibb.co/42MjTcM/Screenshot-2019-10-28-at-9-27-09-PM.png)
![](https://i.ibb.co/fkFRpFN/Screenshot-2019-10-28-at-9-25-27-PM.png)
![](https://i.ibb.co/9VXCB8H/Screenshot-2019-10-28-at-9-25-20-PM.png)
![](https://i.ibb.co/y42CnvV/Screenshot-2019-10-28-at-9-24-50-PM.png)
React & React Native AMA Ask Me Anything Resources
Tags: react, ama, javascript
Published: 2019-10-28 16:49:08

---
title: React & React Native AMA Ask Me Anything Resources
published: true
description: React JS AMA's for learning from others
tags: React, AMA, JavaScript
---

- [Kent C. Dodds AMA](https://github.com/kentcdodds/ama)
- [Three Minutes with Kent AMA Podcast](https://www.briefs.fm/3-minutes-with-kent/)
- [Michel Weststrate and Adam Klein AMA](https://www.facebook.com/500Tech.Ltd/videos/469082146958683/?fbclid=IwAR1Jf7C-eWNxlrgcwmH7XqlZJYdzc6YX8mE4fkwhIEpJonM50Dk0itG1Cyo)
- [Ben Alpert (@SophieBits) AMA](https://hashnode.com/post/i-am-ben-alpert-ask-me-anything-cis53jvri0201hq53dm93l4e1)
- [Kyle Johnson AMA](https://dev.to/kylessg/ive-released-over-100-apps-in-react-native-since-2015-ask-me-anything-1m9g)
- [React Native AMA](https://www.reddit.com/r/IAmA/comments/3wyb3m/we_are_the_team_working_on_react_native_ask_us/)
- [yhirano55 AMA](https://github.com/yhirano55/ama2)
- [JSComplete React Beyond the Basics](https://jscomplete.com/learn/react-beyond-basics/react-cfp)
- [React India AMA With Kent C. Dodds](https://github.com/React-IND/React-India-2019-AMA-Kentcdodds/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20sort%3Aupdated-desc%20-label%3Ahidden)
My first complete Python  beginners program
Tags: replit, python
Published: 2019-10-28 16:47:10

Una empresa de telefonía nos pide escribir un programa que le brinde información sobre
el consumo de sus clientes residenciales. Para ello se ingresa, por cada una de las llamadas realizadas en el último mes:
● Código de Cliente (int de 5 dígitos, entre 10001 y 99999, 0 = fin)
● Duración de la llamada nro. (int > 0).
● Tipo de abono (“A”, “B” o “C”).
Para calcular el importe de cada llamada, nos informan que el costo por minuto, de acuerdo
al tipo de abono, es el siguiente:
● Abono “A” => $2 el minuto
● Abono “B” => Hasta 5 minutos, $2 el minuto; Más de 5 minutos, $1,5 el minuto.
● Abono “C” => $1 el minuto con un máximo de $10 (Ej. si habla 15 minutos paga $10).
Se pide informar:
1. El importe acumulado a recaudar por cada tipo de abono.
2. La cantidad de minutos de la llamada más larga.
3. La cantidad de llamadas de menos de 6 minutos.
4. El precio promedio por llamada.
"""

{% replit @Carlos_Alberto7/ExtraneousShamelessOop %}
Show the hosts configured in your SSH config file
Tags: ssh, ruby
Published: 2019-10-28 16:28:51

---
title: Show the hosts configured in your SSH config file
published: true
description: Here's a little script that prints the hosts configured in your SSH config file.
tags: SSH,ruby
---

Recently I had to connect via SSH to several hosts. It's hard for me to remember their full domain, not to mention all the options required (identity file, port, etc.) to connect.

The SSH config file (`~/.ssh/config`) is the best place to store this information but then again I have to remember all the name I used for such hosts..

![No memory](https://thepracticaldev.s3.amazonaws.com/i/vw174lsyfd3ankgyeqww.gif)

To make my life even more comfortable, I created this little Ruby script that shows a sorted list of the hosts present in the SSH config file:

Behold! 🧙🏼‍♂️

```shell
#!/bin/zsh

cat ~/.ssh/config | ruby -e "puts STDIN.each_line.map {|l| l.match(/^Host\ (.*)$/)}.compact.map {|r| r[1]}.sort"
```
What is the best way to set up your s3 for private access?
Tags: discuss
Published: 2019-10-28 16:00:03

---
title: What is the best way to set up your s3 for private access?
published: true
tags: discuss
---

I am new in aws. What I try to achieve is that I will upload a file in s3 & that file only accessible to the specific user. Currently, I upload file from s3 and can get it from there. What will be my next step? Do I use IAM in client side or server side?
Learning multiple programming language at the same time
Tags: html, javascript, database
Published: 2019-10-28 15:52:37

Hi there again, As you know, I'm new in the programming world. I'm learning php and javascript at the same time, solving tasks and etc. Isn't it bad? Then, another questions is, I'm having trouble when solving tasks such as functions, recursion and etc. Then, I'm wasting my 6-7 hours for one simple task so that attempting to solve this problem again and again. What is your opinion for that situation? Please, it is important... I'm looking forward your answers...
React Context cheatsheet
Tags: react, cheatsheet
Published: 2019-10-28 15:45:47


The React Context API is one of the hottest features in React 16. However, it is one of those features where I see more developers struggling with, especially when consuming the context.

Since its release I’ve been facing / asking / answering the same questions over and over again: How to use a component that consumes React Context and test it with Enzyme.

This cheatsheet reflects my journey of discoveries related to React Context API and how to test it using Enzyme. If you find something wrong, missing or outdated, please let me know and I'll update it. 👩‍💻

{% codesandbox 7z3vpo3916 %}
Entity Developer and dotConnect Providers Now Support Entity Framework Core 3.0
Tags: postgres, net, ssis, entityframework
Published: 2019-10-28 15:27:04

---
title: Entity Developer and dotConnect Providers Now Support Entity Framework Core 3.0
published: true
description: Devart has recently introduced a significant update for the range of its products. The updates affected dotConnect ADO.NET data providers for Oracle, MySQL, PostgreSQL, SQLite, Visual ORM designer – Entity Developer, and  SSIS Data Flow Components.
tags: postgreSQL, .net, SSIS, entityframework
---
*Devart has recently introduced a significant update for the range of its products. The updates affected dotConnect ADO.NET data providers for Oracle, MySQL, PostgreSQL, SQLite, Visual ORM designer – Entity Developer, and  SSIS Data Flow Components.*

![Entity Framework](https://www.devart.com/entitydeveloper/images/ed-vs.png)

Devart, a recognized vendor of professional database management software for developers and DBAs, announced the release of the whole bunch of products. The new versions of ADO.NET providers and Entity Developer now feature support for Entity Framework Core 3.0. Besides, dotConnect for PostgreSQL and SSIS Data Flow Components now support PostgreSQL 12.

**Entity Framework Core 3.0 Support.** dotConnect for [Oracle](https://www.devart.com/dotconnect/oracle/), [MySQL](https://www.devart.com/dotconnect/mysql/), [PostgreSQL](https://www.devart.com/dotconnect/postgresql/), [SQLite](https://www.devart.com/dotconnect/sqlite/), and Visual ORM designer – [Entity Developer]() are now powered by the latest Entity Framework Core version. Thus, users can enjoy improved performance, better SQL generation, and other EF Core 3.0 features. Building Entity Framework Core models from databases using Scaffold-DbContext command with ADO.NET providers,  entering mapping code manually, and designing models visually via Entity Developer – all these approaches are supported.

**PostgreSQL 12 Support.** Additionally, Devart supported PostgreSQL 12 in dotConnect for PostgreSQL, Entity Developer, and [SSIS Data Flow Components v1.11](https://www.devart.com/ssis/). Also, SSIS components now support Server-to-Server authentication for Salesforce Marketing Cloud.

To get more information about recent updates, please visit the [Devart blog](https://blog.devart.com/entity-framework-core-3-0-support-in-entity-developer-and-dotconnect-providers.html).

**About Devart**
Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration and backup solutions. The company also implements Web and Mobile development projects.
For additional information about Devart, visit https://www.devart.com/
Blockstack Bets On Payouts To App Devs
Tags: blockchain, hackathon
Published: 2019-10-28 15:11:15

In a pointed backhander to Google’s now-defunct “Don’t be Evil” mantra, Blockstack is piling on an extra incentive to encourage app developers to use their decentralized computing platform.

Their call to developers is to create apps that “Can’t be Evil”, with a developer reward program that will increase payouts from $100,000 to $1 million per month in its App Mining Program by May 2020. Blockstack PBC is a public benefit corporation that wants to decentralize computing and return privacy to users.

# Blockstack at the Forefront of a Decentralized Internet
The New York-based company is healthily backed by Union Square Ventures, Y Combinator, Lux Capital, and Digital Currency Group. Now with SEC approval to issue a Reg A+ raise, the startup will begin ramping up its monthly payouts from $100,000 to $200,000 in Stacks tokens (STX) in August. That figure will hit $1 million next May.

Blockstack’s decentralized computing network and secure app ecosystem has already begun disrupting app development by supporting and funding developers.

# Blockstack Dapps
There’s now more than 270 of these decentralized applications aimed at protecting you from the ground up, including solutions for blogging, fundraising, and creative collaboration. A few of our recent favorites:

BitPatron is a decentralized, censorship-free Patreon alternative https://bitpatron.co
MyPodium is a fun audio only social network http://mypodium.net
Photo Vault is a free encrypted photo storage solution http://photovault.online

You can also check out all of the decentralized apps (there’s 270 of them!) with a Blockstack ID.
Hackable to do list
Tags: css, productivity, javascript, cxjs
Published: 2019-10-28 15:11:12

A colleague and I made a to-do app experimenting with the cxjs framework. We want to keep it as minimalist as possible, utilitarian, and productive. Tdo ( https://tdo.cxjs.io/help) is meant to be used with the keyboard. One can customize it with markdown and CSS however they want.

But I would really appreciate your feedback and criticism on how to improve it, or simplify more. :)
Javascript and Classical Inheritance
Tags: javascript, typescript, angular, react
Published: 2019-10-28 15:06:24

From OOP concepts, now over 25 years old; it was taught that inheritance was a positive concept. (In C#; Java or C++).  The main idea was to only code something one time, one place, for one concern. Emphasis on the 'is-a' relationship was taught first.  So for example, a  car, truck, sedan and sport coupe are Vehicles.  
The commonality between them abstracted to the lower base class of Vehicle. Each specific Car built itself on-top of a common base class (thus the vertical relationship) other classes could build on top of other classes ad-infinitum.

Problems were seen early; where, the number one problem was a result of violating the 'is-a' relationship. If it wasn't truly a part of the base class then it didn't belong in the vertical inheritance chain.  This caused a lot of pain in the early days; and OOPers were quick to put heavy emphasis on "is-a" relationships. For example; cars are in no way a tire and a tire is not a car, but all cars have tires.  This is horizontal inheritance or containment because cars "have-a" set of tires, cars "have-engines", they "have-radios" etc. All "has-a" relationships should be contained by the class at hand, not inherited.

**Enter Javascript Experts**
  
Javascript always favored things like containment of objects, passing functions around and other horizontal-inheritance/compositional styles. It's not surprising really that vertical-inheritance was not at the forefront.  Alas some did try to implement deep inheritance chains, many stumbling on the same thing OOPers did earlier.  They didn't follow the strict 'is-a' relationship. Plus implementation of the prototype method of inheritance was a bit obscured. Why do it that way when "we don't need it?"... Good arguments but...

**Vertical Inheritance is Good**
If we examine React and Angular both employ vertical-inheritance as a way to bring about conformity to a DSL (Domain specific Language) of their own making. Using the react component below allows you to tie-in to the react-way of doing things. 

*React Inheritance*
![react inheritance](https://thepracticaldev.s3.amazonaws.com/i/oyfvx1umc2qdvau8fsm1.PNG) 

*Angular Inheritance*
![angular inheritance](https://thepracticaldev.s3.amazonaws.com/i/x2oinn2twioayy9uc2gb.png)

So as you can see without making this article too long, Vertical-Inheritance otherwise referred to as Inheritance is good and the best JavaScript frameworks in the world use it. One caveat and probably a good idea is "just keep the depth low if possible"  We won't go into reasons why in this post other than to say "favor composition over inheritance" 75%+ of what can be done is better suited to compositional patterns anyway.
Re-render React.js Child Component By Passing Object Prop
Tags: discuss, react
Published: 2019-10-28 14:52:46

---
title: Re-render React.js Child Component By Passing Object Prop
published: true
tags: discuss, react
---

I'm working on a Quiz app,

I have a list of questions, every question must be answered in 30 seconds. And when the user click NEXT button, I want to restart the countdown.

The countdown (child component), as you can see, accepts two properties: `time` and `onComplete`.

```js
<Countdown time={30} onComplete={onComplete} />
```

I want to restart the countdown by resetting `time` value to 30. The problem is that the `<Countdown />` will not detect that change because of `React.js` **props equality check**.

So, to surpass this situation, I now passe `time` prop as an object. 

Here is an example:

```js
<Countdown time={{time: 30}} onComplete={onComplete} />
```

Now, every time I call `setTime({time: 30})` in the parent component, the countdown component detects that change and it restarts successfully.

```js
const Quiz = () => {

    const [time, setTime] = React.useState({time: 30});

    function goToNext(){
        setTime({ time: 30 });
        ...
    }

    return (

        <Countdown time={{time: 30}} onComplete={onComplete} />

        <Question current={1} />

    )

});
```

I understand why React.js does not detect equality here, and I came up with this solution after reading [this medium article](https://medium.com/@jvcjunior/reference-identity-in-javascript-react-performance-12a8354addad).


The only thing I want to know is:

**Is this a good solution for this case ? Or I can do better ?**

Waiting for your responses...

Thank you,
Why am I finding code challenges so damn hard?
Tags: question
Published: 2019-10-28 14:20:35

---
title: Why am I finding code challenges so damn hard?
published: true
tags: question
---

Hey devs from all over the world😊

I have been doing interviews lately and I still have a couple to tackle. That's why I have been on Codewars & Hackerrank, Solving some coding challenges in preparation. After all, 

> “By failing to prepare, you are preparing to fail.” ― Benjamin Franklin

As a frontend developer, I **rarely** encounter code challenges at my day to day work. Don't get me wrong! I know they are important, I am just saying they are more important in the interviewing phase. 

The issue is. I feel like I need to get better at coding challenges. I am not all bad. By Hackerrank standards, If It's an easy one I can do it. If its a medium I struggle. Some mediums are ok, others I have to look at the discussions to get ideas. If it's hard, I don't even bother.

Most interviews don't ask around the hard level anyway. In my experience, they somewhat below the medium level. Maybe because I am interviewing for junior to mid-level positions. However, solving those challenges live is a whole different story!

My strategy up till now is to solve as much as I can. But, I find myself wondering...

* Are there any other strategies out there?
* Is there a way to get better at them other than solving as much as you can?
* Are there some concepts out there (Math or programming) that someone needs to know before even trying to solve a coding challenge?
* How do you guys prepare for coding challenges in interviews?