teleren/devto huggingface dataset:
OMG! Python can't do this! Or can?
Tags: python, discuss
Published: 2019-12-13 02:25:13

I would love to know if there is anything the python language **can't do**.

I mean, in many places on the web I can find developers with problems in certain subjects and other developers simply answer _"oh yes! Python can solve this ..."_ but honestly: is there something in which **python can't find a solution?** 
Or at least some subject where **python is not a good solution**.
Lander Update #1
Tags: imadethis
Published: 2019-11-24 14:06:50

[Lander](https://landr.me) is my first project on Blockstack. It has been online for almost 8 months and during that time it became one of the most used applications out of around 300 applications.

More than 2000 users have created their profile page on Lander.

![](https://i.imgur.com/6syrDeD.png) 
<small>statistics from https://theblockstats.com</small>

I got lots of valuable feedback from different type of users. That is also a great chance to shape product with users.

As first i'am starting to work on SEO to get more visitors and exposure. To do that i will create a user directory first. I believe user count is pretty enough for that.

Additionally i think a showcase on home page consist of real user pages would be good to show new users capabilities of Lander. 

In middle term i am planning to add more social capabilities and convert it to a place where users can earn micro rewards over content they created.

Your feedback is also extremely valuable for me. Visit [Lander](https://landr.me) create your profile page and let me know what do you think.
#30DaysOfThreads - The Cyber Attack Lifecycle
Tags: security, beginners, privacy, safety
Published: 2019-12-13 02:14:29

The Cyber Attack Lifecycle describes the actions taken by an attacker from initial identification and recon to mission complete. This helps us understand and combat bad actors, ransomware, and others.

Let’s break down the steps !


### Initial Reconnaissance 🔎

Intruder selects target, researches it, and attempts to identify vulnerabilities in the target network. Some things attackers use and look for:

- Whois
- Target IP Ranges
- Web Properties, Domains & Subdomains
- Open Cloud Buckets
- Google dorking 

### Initial Compromise 📬

Attacker compromises a vulnerable host. This may be a DMZ host or something in a higher security group via email phish. This is the first step into a network and why security people always say:

**Don't click email links!**
**Don't open email attachments!**

### Establish Foothold 🧗🏼‍♀️

A compromised system is good, one that you can access is even better. Initial access or a foothold is an attackers first steps in your network. If there are network rules to block various network traffic, the attack may die here. 

### Escalate Privileges 📈

Attackers often need more privileges on a system to get access to more data and permissions: for this, they need to escalate their privileges often to an Admin. 

### Internal Recon 👀

Where are we internally , what are we looking for, and how can I get there?
Here we apply the OODA loop - a simple strategy to help you find your way forward.

- Observe - What do I see
- Orient - Where am I
- Decision - What do I need to do?
- Action - DO

### Move Laterally 👣

Once they’re in a system, attackers can move laterally to other systems and accounts in order to gain more leverage: whether that’s higher permissions, more data, or greater access to systems. 

### Maintain Persistence 🏠

Being able to return to networks again and again is one of an attackers main goals. They may not find what they’re looking for during in the first compromise and they will want to return. 

### Repeat (4-7) until (Mission) Complete 🔁 ✅

Mission complete can be any number of things, anything your mind can think up from any spy or heist movie. Real data gets stolen every day. The current “average time to detect a breach” is 197 days.

Stay safe out there!

--
Enjoyed the post? Let me know! 💛🦄🔖
Looking to build a local dev events listing site?
Tags: help
Published: 2019-12-13 01:13:42

---
title: Looking to build a local dev events listing site?
published: true
description: Hopefully in a language I know?
tags: help
---

In my city, events is completely unorganized. Devs use all sorts of event sites, from FB/meetup/personal sites/etc. Every meetup I attended, someone goes, "Did you know about X? they're meeting in two weeks!" 

Was hoping there's a open-source repo I can clone to build my own local dev events listing site that I can modify using JS or PHP, languages I'm familiar with? 

There's one that I really like written in Ruby on Rails, but I'm having issues with setup, since I'm super new to Ruby, and I'm currently chatting with their dev group. http://calagator.org/

Would love the guidance!
Ionic + OneSignal: Utilizando na web e no mobile.
Tags: ionic, onesignal, mobile, webdev
Published: 2019-12-13 00:44:58

# Contexto

Estou trabalhando em uma aplicação mobile feita em Ionic, que precisou ser portada também para web. A versão antiga dessa aplicação (web) era feita em Angular 1 e, com o objetivo de melhorar a experiência e reduzir o custo da manutenção, resolvemos utilizar a base de código do nosso app também para web.

# O problema

Para notificar no mobile usamos o [@ionic-native/onesignal](https://ionicframework.com/docs/native/onesignal) e na web o [OneSignalWebSDK](https://documentation.onesignal.com/docs/web-push-sdk). Tudo funcionava bem com um simples `ionic serve`. Entretanto, após fazer um build com `ionic cordova build browser`, o OneSignal que era injetado no objeto `window` não era aquele provido pelo OneSignalWebSDK, e sim o do cordova. Cheguei nessa conclusão após analisar vários `console.log`s e ver diferenças marcantes entre o output dos logs de desenvolvimento e de produção.

# A solução

Para solucionar precisei importar o OneSignalWebSDK programaticamente. Isto é, usando JavaScript ao invés de uma tag `<script>` no arquivo `index.html`. Este chunk de código é executado após o cordova carregar todos os seus plugins, ou seja, após a Promise `platform.ready()` ser resolvida.

# O código

`app/app.component.ts`
![app.component.ts](https://imgur.com/9DUMItn.png)

`providers/notification/notification.ts`
![notification.ts](https://imgur.com/CM5rQ5M.png)

![notification.ts](https://imgur.com/5bNGEgq.png)

![notification.ts](https://imgur.com/yQNsuSA.png)

# Problem Solved

Resolvi omitir a implementação do OneSignal do cordova pois na documentação contém o necessário para sair usando. Espero que isto resolva o seu problema assim como resolveu o meu. Obrigado!
Help! (JS scripting question)
Tags: javascript, timer, settimeout
Published: 2019-12-13 00:08:48

I've been coding for a grand total of three weeks, and have learned just enough HTML5, CSS, and JS to be dangerous.

I've created the typical click-the-smiley-face game for my JS class, and I'd like to add a feature not covered in the curriculum. Hoping someone can point me in the right direction without actually giving me the answer - I'd like to figure it out on my own as much as possible.

I'm calling the function startGame(), and when the user clicks anywhere but the designated target, it calls the gameOver() function. 

I'd like to set a timer for ten seconds that, if no selection is made, the script will automatically call the "onclick=function gameOver()" command.

I've played with various iterations and placements of setTimeout() and clearTimeout(), but can't seem to get it to work.

1) Am I on the right track? Any tips on scripting this?
2) Is it possible to display a small countdown clock in the upper right hand corner?

Thanks in advance for any help or tips you can throw my way! 

(Not sure of the rules regarding this, but I can post a link to my codepen if that's allowed.)
Width: 100% VS. width: 100vw
Tags: discuss, html, help
Published: 2019-12-13 00:08:48



Recently, I’ve noticed that using 100vw adds extra space to the right of the viewport and additionally a scrollbar to visit that extra space. It doesn’t happen with 100% so that’s what I’m currently using. 

Why does this happen? I’d like to know what the under the hood implementations of the vw and vh tags are and if they really are better for responsive design.
Angular 9 Form Validation with Template Driven Form using Bootstrap
Tags: angular, angular9, angularformvalidation, templatedrivenusingbootstrap
Published: 2020-02-07 09:35:46

---
title: Angular 9 Form Validation with Template Driven Form using Bootstrap
published: true
date: 2019-12-12 22:08:56 UTC
tags: Angular ,Angular 9,Angular Form Validation,Template Driven using Bootstrap
canonical_url: https://www.positronx.io/angular-form-validation-with-template-driven-using-bootstrap/
---

The post [Angular 9 Form Validation with Template Driven Form using Bootstrap](https://www.positronx.io/angular-form-validation-with-template-driven-using-bootstrap/) appeared first on [positronX.io](https://www.positronx.io).

**In this Angular 9 Form tutorial, we are going to learn how to implement simple validation rules with the template-driven approach using Bootstrap forms.**

To validate the form, we will also look at how to use Bootstrap UI library to facilitate our form validation task. In this Angular form example, we will create a basic form with some Input fields, such as name, email, password and hobbies.

In the previous tutorial, we implemented Angular form validation with Reactive Forms using Angular Material However, we are going to take the diverse approach in this article.

[click here to read more](https://www.positronx.io/angular-form-validation-with-template-driven-using-bootstrap/)
#2 not, and, or Python 
Tags: python, beginners
Published: 2019-12-12 21:17:56

Not
---
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/00iop0bet413dfj3m80b.png)

And
----
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/v4hxq874h6r6is5lk219.png)

Or
---
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/19q091mkhrp6na4gy64d.png)
Investigating tree height of a red black tree
Tags: computerscience, python
Published: 2019-12-12 21:16:36

I'm implementing a red black tree in python, with the aim of learning about data structures and algorithms.

In the process, I've noticed something interesting. I looked at the relationship between number of elements in the red black tree, and the depth (or height) of that tree. For this test, I fed the trees with varying amounts of elements and tracked the tree height.



For example, if the number elements is 20, I found that the height fluctuated between 4 and 5. Here's an example output:
```
Number of elements in balanced tree 20
Height of balanced tree: 5
Number of elements in balanced tree 20
Height of balanced tree: 5
Number of elements in balanced tree 20
Height of balanced tree: 4
Number of elements in balanced tree 20
Height of balanced tree: 5
```
This matched my expectation that the height would be mostly balanced, but fluctuate slightly.

However, I was surprised by the result at 85 elements. Here's a representative output:
```
Heights of 100 balanced trees with 85 elements:
[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
 7, 7, 7, 7]
```
I was so surprised by this that I ran the trial quite a few more times. Very occasionally, the resulting height would be 6. I estimate this happens 2 or 3 times out of a thousand trials.

A good follow up would be the following: Measure the likelyhood of getting a given height h as a function of number of elements, n. As in `P(h, n)`.

I hope to do that and write about it soon. It might also be useful to explain some of the terminology and concepts surrounding a red black tree, since I wrote this post assuming rather in depth knowledge of the subject. Apparently I've graduated beyond writing for the beginner tag. (Not that I'm done writing for the beginner tag, nor that there's anything wrong with writing beginner posts - it can actually be a challenge to present things at a beginner's level, and it's very important - but it's kind of exciting to see how I've progressed in terms of the complexity of topics I can take a bite of.

P.S. The code for this project is available here:
[https://github.com/erik-kristofer-anderson/Red-Black-Tree](https://github.com/erik-kristofer-anderson/Red-Black-Tree)

Also, you can play with it in repl.it [here](https://repl.it/@ErikKrisotferA/Red-Black-Tree). The code for what I talked about in this post is in the file `test_height.py`.

Note that the content at these links may change as I work on this project.
#1 JavaScript, Python hello world.. 
Tags: javascript, python, webdev, beginners
Published: 2019-12-12 20:35:28

Javascript
----------
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ksi7wxwur4sefxt7clrd.png)

Python
-------
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/6jgphj41rbs03u1ihqbr.png)
Christmas is around the corner. Build something for Someone
Tags: productivity, discuss
Published: 2019-12-12 20:19:17

Hey its time of a year where people exchange gifts and some put those gifts under the tree. Last year I wrote an article about Christmas ideas that you could actually build vs buy at the store, wrap it and put under the tree.

Here is the link for those that are interested. 


{% link  https://dev.to/joehobot/simple-christmas-gift-ideas-using-your-skills-4ji4 %}


Few things that might also work and put under the Christmas tree.


Smart Mirror is something I built and its much appreciated gift which for someone non-technical is like WOW factor but to some of us is just 5hrs of code and 10hrs of constructing that mirror + the material such as Raspberry PI + monitor + two way glass etc. 

Cost is about $100-200 + your time

Echo with Alexa - this is something super fast that can be done within a day, granted you could go and buy echo dot for $29 but you could build one with Raspberry PI and add some extra stuff onto it.

Cost is about $35 + your time
Skip React.useEffect by Providing an Inputs Array
Tags: react
Published: 2019-12-12 20:01:36

By default, `React.useEffect` runs every time that component renders.

When we combine `React.useEffect` and `React.useState` to fetch and update our component with state, we create an infinite fetching loop:

```js
React.useEffect(() => {
  fetchPokemon(index).then(pokemon => setPokemon(pokemon));
})
```

Our app will keep fetching and updating and fetching again until the we close the page.

React gives us a way to "skip" `useEffect` Hooks by tracking inputs.
We track inputs by giving `useEffect` an array as a second argument.

`React.useEffect(func, [])`

This array will contain the inputs we want to observe for changes.
React will "skip" `useEffect` calls where inputs haven't changed.

You can think about it like this:

```js
React.useEffect(func)          // Every render
React.useEffect(func, [])      // First render
React.useEffect(func, [index]) // First and every time `index` changes
```

When we update our `React.useEffect` Hook to "skip" when `index` hasn't changed, we ensure that we only make fetch requests when we get a new `index`.

```diff
function usePokemon(index) {
  let [pokemon, setPokemon] = React.useState(null);

  React.useEffect(() => {
    fetchPokemon(index).then(json => setPokemon(json));
- });
+ }, [index]);

  return pokemon;
}
```


Assignment CodeSandbox:
{% codesandbox ck1ww %}

## Assignment

Restrict redundant useEffect calls by supplying the inputs argument

1. Pass an empty array ([]) to React.useEffect as the second argument
2. Click the next button a few times. Notice how it no longer updates the Pokemon?
  * This array holds values that we'd like to track for changes. Where, before, React was calling useEffect every time this function is called, it now runs only the first time it's called.
3. Add `index` to the inputs array to be tracked for changes


---

Subscribe on YouTube:
{% youtube RySLNPo9cbM %}

Follow the 🧵 on Twitter:
{% twitter 1204123563382333441 %}
How can I update PHP mongoDB extension in Ubuntu?
Tags: help, php, apache, ubuntu
Published: 2019-12-12 19:51:24

Hello Good Developers,

I have Ubuntu with PHP 7.2.24 with FPM installed in our production server with Apache and Nginx as the reverse proxy. Currently, it has MongoDB Extension version 1.5.5 installed with it.

One of my package that is built in Laravel 6.0 requires MongoDB extension ^1.6

Now because of this dependency, I cannot install my application on my server.

Everywhere I see articles to install an extension but nowhere I see a tutorial to upgrade an extension.
I'm implementing a Red Black Tree in Python
Tags: python, computerscience
Published: 2019-12-12 19:47:58

... And you can play with it here:
[https://repl.it/@ErikKrisotferA/Red-Black-Tree](https://repl.it/@ErikKrisotferA/Red-Black-Tree)

Later I'll write a post on the what, how, and why.

Note: I've written code to remove nodes from the tree, but it's buggy so I didn't call it in the main.py file.

[EDIT] The next post in what is rapidly becoming a series is available [here](https://dev.to/erikkristoferanderson/investigating-tree-height-of-a-red-black-tree-2pbh).
Do you use Bootstrap?
Tags: discuss, css, html, webdev
Published: 2019-12-12 19:06:38

Not long ago, it felt like every site and app in the world was built on top of [Bootstrap](https://getbootstrap.com/). Now, it feels like there are a lot of other great options and even though Bootstrap is still very popular, I feel like new projects aren't using it as much. I'm curious if you're still using the framework - especially in a newer project and your reasons for or against Bootstrap usage.
[Devmates.co] Subtract Two Integers Represented as Array by 🏢Google
Tags: challenge
Published: 2019-12-12 18:23:44

Hello👋, 
*My name is [Alex](https://twitter.com/alexwawl) and I'm maker of [Devmates.co](https://devmates.co).* 😊

*We are resolving daily coding problems which asked by top tech companies together. We share our solutions, give some help if anyone stuck, support each other and just hangout together in the internet.* 🍻☕️💬

*I get this problem from our members or just searching them in the internet(leetcode forums, Glassdoor, teamblind, etc.). Sometimes this problem can be very easy, sometimes too 👷‍♂️hard, everything depends on skills but we are trying to resolve all of them and Have Fun.*  🙌 

Today I want to share problem which was asked by 🏢Google.

#####Problem:
Given a non-empty array of digits representing a non-negative integer and each element in the array contain a single digit.

Subtract two integers represented as array and return result as array.

You may assume the integer does not contain any leading zero, except the number 0 itself.

**Note**: Converting to the integer and back to the array is not allowed.

#####Example:
  __Input__: num1 = [3, 4, 5], num2 = [2,2,1]
  __Output__: [1, 2, 4]

  __Input__: num1 = [1, 0], num2 = [9]
  __Output__: [1]


🙌 Don't hesitate to share your solutions directly on [devmates.co](https://devmates.co)
Announcing Cloud Onboarding Guide Rails
Tags: serverless, jamstack, graphql
Published: 2019-12-12 18:20:07

Author: Lewis King
Date: December 11, 2019
[Originally published on the Fauna blog.](https://fauna.com/blog/announcing-cloud-onboarding-guide-rails)

---

We’re pleased to announce two new tutorials in the FaunaDB Console: *Basic CRUD* and *GraphQL*.

As new users continue to join the FaunaDB community at a growing rate, we know that the use cases for the database continue to diversify. With that growth comes new questions for how to get acclimated to FaunaDB’s unique and powerful query language. Also, some users want to dive straight into trying out GraphQL queries.

Our goal is to ensure that any user can create their first database and then add, update, delete, and modify new data within that database during their first 5 minutes as a FaunaDB user.

Over time, we plan to add more advanced use cases to our tutorial suite so that users who have been with FaunaDB since the beginning can continue to level up their skill set.

#Getting started with tutorials#
Console tutorials can be found by clicking the (?) button in the top right of the [Console](http://dashboard.fauna.com/):

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/5yicyis653td4qf3wuc1.png)

New users are automatically prompted to try out one of the two available tutorials:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/g0fw4eashvjezjkm3fb4.png)

These two tutorials are designed to cover the basic functionality within FaunaDB. The Basic CRUD tutorial also provides a primer for FQL syntax. For example, a query that users will learn and use:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/wno6whdx68jli32tqsi8.png)

Running this query in the Console provides the expected result:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/07u7emucvjs8r1aze0pu.png)

By design, these tutorial steps are relatively self-explanatory :)

#Conclusion#
With our latest Console release, users now have access to getting-started tutorials. Visit our [documentation](https://docs.fauna.com/) to learn more.

What other tutorials would you like to see implemented in the FaunaDB Console? Please reach out to me on [Twitter](https://twitter.com/lew) and on our [Community Slack](https://community.fauna.com/) and describe any other features that would make FaunaDB an obvious choice for your next project.

If you enjoyed this topic and want to work on systems and challenges just like this, Fauna is hiring!
Do you prefer video or written coding tutorials?
Tags: discuss
Published: 2019-12-12 18:17:23

I've been posting here for a little while, and maintain some tutorials over at my site [Up Your A11y](https://www.upyoura11y.com), but so far it's all written content.

I'm toying with the idea of creating some YouTube videos that cover similar content, just so people can choose the medium they prefer.

**Do people like/prefer video tutorials? What do you find most useful in a video tutorial and what are your pet peeves with them?**
The truth about using Stack Overflow || Copy & Paste Developers
Tags: webdev, codenewbie, productivity, beginners
Published: 2019-12-12 18:15:30

---
title: The truth about using Stack Overflow || Copy & Paste Developers
published: true
description: As developers, we've all copied & pasted code before, but it's a practice that can get us into trouble. Watch today's video as RealToughCandy shares with you some of the pros and cons of copying and pasting code, Stack Overflow style. 
tags: web dev, code newbie, productivity, beginners,
cover_image: https://thepracticaldev.s3.amazonaws.com/i/k53i49tmpsv6c30b994b.jpg
---

###_This video originally appeared on YouTube. [Come follow me there!](https://www.youtube.com/realtoughcandy)_

##Copying and pasting the highest-upvoted answer on Stack Overflow is a practice almost all software developers can relate to. 

Whether we were short on time, got frustrated or just didn't feel like doing it ourselves, Stack Overflow has provided millions of developers with answers to their coding problems that have saved us incalculable time and preserved our sanity.

But copying & pasting code can get us into trouble as developers. Watch today's video as RealToughCandy shares with you some of the pros and cons of copying and pasting code, Stack Overflow style.
Where do devs go online to chat?
Tags: discuss
Published: 2019-12-12 18:08:32

Aside from Twitter and Reddit, where else do developers to go chat? I've realized that I've just been in my own bubble, pounding away at my keyboard and I have not made many developer friends/buddies/communities. I have a few developer coworkers that I chat with from time to time. But where else is there for us to go to connect with one another?

Twitter contains so much noise that it's difficult to facilitate a conversation. Places like Reddit and Hacker News, to me, foster a bunch of bullies waiting to tell you that your post sucks or for moderates to delete your post because you said "I" too many times.

Are there Discord channels? Slack channels? IRC Chatrooms? (FYI: I've NEVER got a chance to learn IRC)

Lets discuss.