teleren/devto huggingface dataset:
Choosing Good Defaults: Boost Your Productivity
Tags: productivity, tooling
Published: 2019-11-19 18:59:09

If you've read one of my previous blog posts, you'll know that [I love tools](https://dev.to/johannes_scha/awesome-tools-that-saved-us-254h). I even love [creating my own tools](https://dev.to/johannes_scha/bespoke-tooling-building-your-own-hammer-2j06).

Over the time I've found out that the most impactful decision you can make is all about defaults. This is my decision framework.

## 1. Think About First Time Users

If you've done anything with webpack a couple of years ago, you know what I mean. Getting started was one of the hardest parts, because in order to get anything done, you needed to create and understand a complex configuration.

Good defaults make it easy for first time users to get started. If you choose your defaults well, the tool "just works".

## 2. Make Functionality Discoverable Through Defaults

If you're hiding useful settings in configurations and CLI flags, most of your users will never discover that the functionality even exists. E.g. if your tool can self-upgrade, then doing that should probably be the default. 90% of your users will never read through the documentation, so the default is how they will use your tool.

## 3. Make It Clear How To Turn It Off

Boolean flags for CLI tools are particularly difficult to turn off. Is it `--no-cache` or `--cache=off` or maybe something entirely different like `--prefer-online`? My experience is that when possible you should avoid the negative CLI flag by choosing the opposite expression, `--prefer-online` in the above case. If there is no good such expression, make sure you document how to turn the flag off.

## 4. Provide An Escape Hatch For Power Users

Your power users will quickly get tired of specifying the same flags over and over again. They might need a configuration file to save their settings. Or just have a pre-configured version of the command in an npm script so that people can run `npm run start` for your regular users and `npm run start:minimal` as an alternative.

## 5. If the Tool Is Internal, Start With Default On

If you're unsure about a new configuration, then start with turning it on by default. People will quickly tell you if that was the wrong approach and you can adjust it then. Embracing the concept of _fail fast_ that will give you the quickest feedback if the setting is useful, how it can be improved and if it's not useful at all, you can simply swap the default and carve a new release.
My first and not very successful experience with AWS
Tags: aws, amazon, beginners
Published: 2019-11-19 18:42:06

---
title: My first and not very successful experience with AWS
published: true
description: 
tags: aws,amazon,beginners
cover_image: https://cdn0.tnwcdn.com/wp-content/blogs.dir/1/files/2017/02/aws-796x445.jpg
---
Hello, today I'm gonna tell you a story about my experience with Amazon Web Services.

I started using it not so long time ago. What is AWS? Amazon provides on-demand cloud computing platform. VM instances, databases, load balancers, and more. And it's so cool 😁

So if you create an account for the first time you have the ability of 12 months "free" using several AWS services. This thing is called **Free Tier** and restricts the use of certain services. For example, the using of *EC2* (virtual machines) service is limited to 750 hours. You will not be charged for 750 hours of using your VM and that's it. 

**Unfortunately, there's is a thing I didn't know about when using EC2.**

# Standard vs Unlimited 
If you create an EC2 instance of *t2* or *t3* type, then there is a thing enabled by default which called *unlimited feature*. And it's bad in my case 💩

Ok, let's figure it out. Every EC2 VM has its own bound of CPU utilization called *baseline*. Imagine, you are using a VM for heavy tasks when the CPU is loaded above baseline, even at 100%. In that case (if you have *unlimited feature* enabled), you'll pay money for extra CPU utilization. 

But... If you have *standard feature* enabled, then your CPU utilization will not exceeds baseline bound. Meanwhile, if the CPU frequency rises above the baseline, it will immediately be reduced - great, because there is no additional cost.

Unfortunately, I didn't know that and paid almost 9 dollars. Despite the fact that I currently used only  552 hours of 750 free and the average workload per month.., attention, is **zero**. I don't know how the costs is computed on AWS 😆 I don't know why they charged me $9. **But the money was refunded to me.** Thanks to Melanie from AWS tech support ♥️.

# Thoughts
When creating VMs in EC2 - please, disable *unlimited feature* if you really don't need it enabled.

```
EC2 -> Instances -> Actions -> Instance Settings -> Change T2/T3 Unlimited -> Disable
```

That's it. Hope it helps someone of you 😉 Stay awesome! Thanks!
Using iTerm triggers
Published: 2019-11-21 04:37:27

---
title: Using iTerm triggers
published: true
date: 2019-11-19 18:17:38 UTC
tags:
canonical_url: https://atfzl.com/using-iterm-triggers
---

iTerm triggers can be used for converting text in your terminal to URLs and make them clickable. This is useful for creating JIRA issue links whenever there is a `JIRA-1234` like pattern.

## Steps:

Go to `iTerm -> Preferences -> Profiles -> Advanced -> Triggers Edit`

![iterm preference](https://blotcdn.com/blog_b4fa49aeb5e8474db144c0adb7862258/_image_cache/89d0fab1-7602-4b5b-8b05-8d22186df123.png)

Add an entry in the table

```
Regular Expression: (?i)JIRA-\d+
Action: Make Hyperlink
Parameters: https://jira.yourhost.com/jira/browse/\0¯
```

![table](https://blotcdn.com/blog_b4fa49aeb5e8474db144c0adb7862258/_image_cache/67c579d6-ec52-4d06-8c69-4ffc3cfe385e.png)

Now whenever there is a pattern with `JIRA-1234`, it will become a clickable hyperlink.
Feature Flags with Django Waffle - Building SaaS #15
Tags: python, django, saas
Published: 2019-11-19 18:04:21

{% youtube Jn4HNwztu_o %}

In this episode, we added a feature flag system to College Conductor to control when users see new features.

We used the excellent [Django Waffle project](https://waffle.readthedocs.io/en/stable/).

Show notes for this stream are at [Episode 15 Show Notes](https://www.mattlayman.com/building-saas/feature-flags-with-django-waffle/).

To learn more about the stream, please check out [Building SaaS with Python and Django](https://www.mattlayman.com/building-saas/).
Is this stack over-engineered?
Tags: css, javascript
Published: 2019-11-19 18:03:37

I am writing a to-do list and I want to keep it simple. Its a PWA in Vue.

JS: I am using
- Vue router
- Vuex
- indexdb
- Vue
- Typescript

CSS: I am using
- scss no framework very targeted css
- mobile only targeted app

There is little more to say on that front, on the test side we have Jest and acceptance tests ran by puppeteer wrapped in Jest.

Should I use local storage? There is one limitation I want to do but cant if using this route, quickly create and throw away multiple lists and persist without serialisation. Why? It just seems easier and more efficient than messing around with storing a massive string, localStorage was not really designed for storing json, thats why indexdb exists, plus a table per list and a row per item and all that. Am I just going too far?
Hey Cyber Security Experts, I have some questions!
Tags: career, cybersecurity, discuss, help
Published: 2019-11-19 18:00:07

I am thinking of expanding my knowledge on the field. Based on that thought, I am considering doing a Master.

What should one know, to be able to work on the field? Do you think a Master is a waste of resources(money, time, etc)?

Currently I am a developer, will that help me on that journey?

Thank you!
Increase maximum recursion depth in python using Context Manager
Tags: python, tutorial, beginners, productivity
Published: 2019-11-19 17:30:11

A context manager is an object that defines the runtime context to be established when executing a **with** statement. The context manager handles the entry into, and the exit from, the desired runtime context for the execution of the block of code.

Let's have a look at below example, suppose I want to calculate the Fibonacci of a number - 
```python
def fib_cal(fib_num, memo):
    if memo[fib_num] is not None:
        return memo[fib_num]
    elif fib_num == 1 or fib_num == 2:
        result = 1
    else:
        result = fib_cal(fib_num-1, memo) + fib_cal(fib_num-2, memo)
    memo[fib_num] = result
    return result


def get_fibonacci(fib_num):
    memo = [None] * (fib_num+1)
    return fib_cal(fib_num, memo)

print(fibonacci(100))
```
***Output-*** 354224848179261915075
- Let suppose if my number if bigger like - 3000
```
print(fibonacci(3000))
```
- In the above case, it’ll throw an error- 
```
RecursionError: maximum recursion depth exceeded in comparison
```
because the maximum recursion limit of the os has been exceeded. you can check recursion limit as follow - 
```python
import sys
sys.getrecursionlimit()
```
So, In this kind of situation, we can use context manager which will allow us to allocate and release resources precisely when we want to.
```python
import sys

class RecursionLimit:
    def __init__(self, limit):
        self.limit = limit
        self.cur_limit = sys.getrecursionlimit()

    def __enter__(self):
        sys.setrecursionlimit(self.limit)

    def __exit__(self, exc_type, exc_value, exc_traceback):
        sys.setrecursionlimit(self.cur_limit)


MAX_LIMIT = 10000

with RecursionLimit(MAX_LIMIT):
    print(fibonacci(3000))
```
**Output**-  4106158863079712603335683787192671052201251086373692524........6000

The `__enter__()` returns the resource that needs to be managed and the `__exit__()` does not return anything but performs the cleanup operations.

Context-managers can be used for other purposes also like- simple file I/O, like opening and closing sockets, implementing set-up and tear-down functionality during testing.

I hope you enjoyed reading this article, If you have any suggestions on your mind, please let me know in the comments.
Start of my #100DaysOfCode challenge!
Published: 2019-11-19 17:21:54

Hello everyone! If you haven't read my introduction post my name is Chase and I have currently been programming on and off for 4 years in school and some professional experience as well. 

Recently I have been feeling stuck in a rut and I needed to find a way out, thats when I stumbled upon the 100 days of code challenge. 

For me I find the challenge to be extremely interesting and its incredible to see how much people have improved just from programming for 100 days! After seeing all the posts I decided I might as well give it a try. So today begins day 1 of my 100 day journey!

Since it's day 1 I decided to start with something I know very little about but enough to where I won't have to mindlessly follow tutorials. That's why I decided to start creating a django project. My hopes for this project are that it will eventually become a great news site for viewing local and national politicians. 

Today I accomplished initializing the project (holy crap django has a lot of files) and I began working on the home screen for the site! I'm excited to see where this takes me.
I have some Steller Lumans and have no idea how to and what to do!
Tags: help, cryptocurrency, watercooler
Published: 2019-11-19 16:47:05

---
title: I have some Steller Lumans and have no idea how to and what to do!
published: true
description: 
tags: help , cryptocurrency, watercooler , 
---

I have a keybase account and Steller Foundation has started distributing some Steller Lumens among users every month. At first, I was excited, I thought I was gonna buy some cloud tools with that money 😊 but unfortunately according to India's (I live in India) laws, I can't withdraw that money to banks 😑

**I literally have no idea what to do with those Lumens. As long as I am in india those are no use to me. 😅**

I am really confused, what to do with those Lumens. 🤔

Any ideas or suggestions are highly requested 😊
How to Publish your awesome package to NPM 👏
Tags: npm, node, javascript, productivity
Published: 2019-11-19 16:33:46

For JavaScript developers, [npmjs.com](npmjs.com) is a treasure!

You can find more than 1 Million packages there. ( Yeah, I agree all of them are not useful :wink: )

We can install/download Packages like react, express, lodash etc into our projects very easily from the npmjs package repository with just one command.
Such as -

```
npm i react
```

Many a time, we want to reuse our code to different artifacts. And it's a very good practice in Software Engineering.

What we do a lot, we create an independent repo/project for the code we want to reuse and copy that project folder into a new application that does not scale well. :disappointed:

To solve this issue, we can upload/publish our own code/package to npmjs.

And then we can download/install it to a new app and just import it where we need to use it.

This is also a great way to modularize your app. 


For initializing npm, we can run this command in our project directly-

```
npm init
```

Now we can code our awesome Library and test it well before publishing to npmjs.

You should give a proper name and version in your package.json file

```javascript
{
  "name": "my-awesome-package",
  "version": "1.0.0",
}
```

To publish, you need one npmjs account, you can create it here [https://www.npmjs.com/signup](https://www.npmjs.com/signup) .

Then you can login in your terminal-

```
npm login
```

You can put your credentials and you will be logged in!

Now, let's do the final Publish...


```
npm publish
```

Awesome!
Now if you have a look on your npmjs package page after loggin in on your browser, you can see your package is listed there.
Normally you should see it here `https://www.npmjs.com/settings/{UserID}/packages`

Publish your reusable code and have fun!

Cheers!

:wave:


As I am trying to contribute contents on the Web, you can buy me a coffee for my hours spent on all of these ❤️😊🌸
<a href="https://www.buymeacoffee.com/destromas" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
#Javascript: Using the Array.prototype.map() function.
Tags: javascript, webdev
Published: 2019-11-19 16:18:02

When working with JavaScript arrays, you might want to create a new array with the results of calling a provided function on every element in the previous/original array.

JavaScript has a very nifty function called **Array.prototype.map()** that you can use to do this.

**Array.prototype.map()** accepts a **callback function** as a parameter.

The callback function produces an element of the new Array and takes **three** arguments:

+ currentValue - This is the current element being processed in the array.
+ index (*optional*) - This is the index of the current element being processed in the array.
+ array (*optional*) - The original array that **map** was called upon.
+ thisArg (*optional*) - Value that you can use as **this** when executing the **callback**

### Example usage: ###

```javascript
const names = ['mike', 'john', 'anne'];
const namesUppercase = names.map(name => name.toUpperCase());
console.log(namesUppercase);
namesUppercase = ["MIKE", "JOHN", "ANNE"]
```
Immutability Benefits
Tags: functional, typescript, javascript
Published: 2019-11-19 15:53:23

Please add to the conversation by writing a little bit about why you feel Immutability is such a good idea.  Please!

I recently used an Angular component, whereby it contained a table of data, immutable data. I found out later that the only way to change any row being displayed was to make a copy of the row to be edited by the user, show it in another control, then to mutate the entire collection with the new value inserted once the user made the change.

In the past, we would just mutate the data and save it off to the data store. Never had issues with that in 25+ years.   

I feel the work to get the immutable data to mutate was way more work than just changing the row that needed it.
Angular : Components
Tags: angular, typescript
Published: 2019-11-19 15:50:47

**Why Components?**

The demand for more and more features within Web applications is increasing exponentially. This means that to keep up with the demand we must focus on an "assembly" line approach to software creation. 

Each station in an assembly line adds another component to the product; where, each component is sourced independently from other components. Each component is only responsible for one thing,n works flawlessly and just snaps into the overall product.

This is how we want to train ourselves in Angular design; lots of Small parts that have these features.

1) Each component will do only one thing.
2) Each component will work every time, in the same way.
3) Each component will be completely isolated unto itself.

Angular's CLI (command line interface) makes creating components super easy.  In Visual Studio code click on Terminal. In the Terminal Session (usually a PowerShell session).

**To Create a Component, Simply type in** 

*['ng g component componentName'](https://angular.io/cli/generate)* 



A new component shows up in the current directory and you are ready to start creating small parts.

Follow the 3 suggestions above and you are well on your way to creating very good applications!
Time Traveling State Debugger - Reactime - Now Supporting Concurrent Mode, Routers, and more
Tags: javascript, webdev, react, gatsby
Published: 2019-11-19 15:49:12

*Chrome dev tool for tracking and visualizing state changes in React applications*



**Intro**

Developers need robust tools for debugging their apps. Redux DevTools provides time-traveling debugging, and that’s fine and great and all, but what if you’re using Hooks, or Context API, or regular old stateful class-based components? What if you’re experimenting with new features like Concurrent Mode and Suspense?

Well my bionic friends, you’re in luck. This is where Reactime comes in.


**Introducing Reactime 3.0 - Supercharged for the Future of React**

Reactime is an open-source Chrome developer tool - inspired by Redux DevTools - which allows developers to visually inspect the state of their app at any given moment, step forwards or backwards through time, import and export a snapshot of their current state, persist state across refreshes, yada yada yada… you get the idea.

The real magic happens when you introducing scaling. Because Reactime runs a realtime d3 visualiser which visually grows a tree displaying all of your state “branches”, you can easily figure out where a bug is halting your processes and how best to move forward. Not to mention, it now has added support for experimental React features like Concurrent Mode and Suspense, as well as expanded support for hooks like useContext, useReducer, useEffect, and more, and support for React Router, visually persisting state changes across different pages. (please clap)

**How does it work?**

Reactime 3.0 works by recording and caching snapshots of your app’s state and browser history at any given moment and constructing a historical tree based on the cache, and allows the developer to “play back” all of the state changes they’ve made on a given branch, providing a really granular look at what’s going on during different DOM events. It also provides the diff between each snapshot and captures the changes as downloadable JSON.

**How Reactime helps**

The React community is growing every day, and with new developers comes new challenges, tools and technologies. Reactime aims to bridge the gap between new ideas and amazing products, especially with the advent of Concurrent React and the implications it will have on the build process moving forward.

We’d love for you to try Reactime out - play around, break things, put in a PR, and let us know what you think! If you’re interested, please visit our [github](https://github.com/open-source-labs/reactime) and try out our [chrome extension](https://chrome.google.com/webstore/detail/reactime/cgibknllccemdnfhfpmjhffpjfeidjga).
Authenticating Your First React App
Tags: authentication, react, javascript
Published: 2019-11-19 15:48:03

---
title: Authenticating Your First React App
published: true
description: Learn how to authenticate a React app using Auth0's new SPA SDK, React Context, and React Hooks.
tags: #authentication #react #javascript #reactjs
canonical_url: https://auth0.com/blog/authenticating-your-first-react-app/
---
Auth0 provides many tools to integrate authentication into our applications. When building JavaScript apps in the past, Auth0 has recommended using the auth0.js library. Recently Auth0 has created a new upgraded library to work with authentication in Single Page Apps (SPAs). This new library was released on July 2, 2019, and is called the Auth0 Single Page App SDK.

[In this tutorial ⚛️](https://auth0.com/blog/authenticating-your-first-react-app/?utm_source=dev&utm_medium=sc&utm_campaign=spasdk_react), we will integrate this Auth0 SPA SDK with the popular JavaScript library, React. We will be building it using React Context and Hooks.

![Authenticating Your First React App](https://thepracticaldev.s3.amazonaws.com/i/8msesph1mcsq86tk3gix.png)
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2019-11-19 15:46:25

---
title: Top 5 DEV Comments from the Past Week
published: true
description: Highlighting some of the best DEV comments from the past week.
tags: bestofdev
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--7VrAA2ln--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/qmb5wkoeywj06pd7p8ku.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.

@lewiskori shares an awesome achievement in **[What was your win this week?](https://dev.to/jess/what-was-your-win-this-week-3jb6)**:
{% devcomment hnon %}

Replying to **[Explain Open Source like I'm five](https://dev.to/peter/explain-open-source-like-i-m-five-264e)**, @xtrp offers a truly context-appropriate explanation:
{% devcomment hk2h %}

While the **[What did you have the hardest time learning?](https://dev.to/ben/what-did-you-have-the-hardest-time-learning-4e2m)** thread had plenty of purely technical challenges, @olistik offered an additional lesson that can be very hard to truly learn:
{% devcomment hld4 %}

As DEV's founder and a very prolific commenter, I typically shy away from highlighting @ben in these "top comment" threads.  That said, he provided a wonderful bit of advice in response to **[Feeling excluded and sad for not getting positive feedback - How should I react?](https://dev.to/sloan/feeling-excluded-and-sad-for-not-getting-positive-feedback-how-should-i-react-38jg)**:
{% devcomment hkc8 %}

Finally, @arielrodriguez chimed in to the **[Two string methods every JavaScript developer should know.](https://dev.to/itz_giddy/two-string-methods-every-javascript-developer-should-know-10e3)** thread to share some advice on the topic of manipulating objects:
{% devcomment hn5j %}

See you next week for more great comments ✌
What are your saboteurs?
Tags: watercooler
Published: 2019-11-19 15:30:42

---
title: What are your saboteurs?
published: true
description: 
tags: watercooler
---

I recently took this saboteur assessment: https://www.positiveintelligence.com/assessments/

@peter and @ben both agree my results are spot on 😅

![](https://p193.p3.n0.cdn.getcloudapp.com/items/L1uYAy1Z/Image+2019-11-19+at+10.28.45+AM.png?v=147ab1a392a9450d8966aa34a0c6f289)

It takes about 2 minutes to complete the assessment if you want to give it a go ;)