teleren/devto huggingface dataset:
TIL How Easy It Is To Switch To Zsh
Tags: zsh, antigen
Published: 2020-03-06 02:52:46

With the latest MacOS release, Catalina, the default operating shell was switched from `bash` to `zsh`. This was announced pretty early on, so it wasn't a surprise and I had "Learn ZSH" on my to do list for quite some time but now that I have updated my machines, it reminds you that you need to switch to zsh. And while it is possible to hide that message, this is as good opportunity as ever to make the switch.

There are several frameworks that make it easy to switch as well. The most popular of them is Robby Russell's Oh My Zsh. It seems easy to install and but at first glance, it doesn't have the customization and control I want. I instead chose to try Antigen first. It is similar to a Vim framework called Vundle in philosophy and even allows you to build off OMZ. Antigen is a package manager for `zsh` and keeps its plugins in what it calls "bundles".

Setting up Antigen took less than 10 minutes. I first installed all of the requirements:
```
$ brew install zsh
$ brew install antigen
```

and then I copied the the `.zshrc` example from the website:

```
source $(brew --prefix)/share/antigen/antigen.zsh
antigen use oh-my-zsh

antigen bundle git

# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting

# Fish-like auto suggestions
antigen bundle zsh-users/zsh-autosuggestions

# Extra zsh completions
antigen bundle zsh-users/zsh-completions

# Load the theme
antigen theme robbyrussell

antigen apply
```

This does several things. The first two lines start antigen and set it up with a default set of configurations. Then, I add several bundles to add functionality to the shell. These often come in the form of auto-completion or set up commands that are typically in a `.bash_profile` or `.bashrc` file. Lastly, I chose a built-in theme and told `antigen` to apply those changes. When a session is started, it will install those bundles and themes, if they are not already installed, and then sets up the session.

Now you can just start a `zsh` session by running

```
$ zsh
```

This won't switch your shell permanently, it just starts a new session over your current session. This is nice because it allows you to add or remove things to your `.zshrc` file before entering entering the command that Apple gives to switch your shell over permanently.

That is just a basic zsh configuration. The next step is to move over the rest of my current bash shell functionality. My current set up is not too complex, so there are probably plugins or themes that have what I want out of the box.
What would you tell someone building their first API?
Tags: api, python, design
Published: 2020-03-06 02:28:48

Those of you who have built and designed APIs, what would you tell a fairly experienced python developer working on their first one? 

I’m working on building my first production one using FastAPI, and I’d appreciate any tips or gotchas from more experienced API developers to help newbies like me to be successful! 

Thanks!
Free workshop on .NET Core + GraphQL + Serverless
Tags: dotnet, csharp, graphql, serverless
Published: 2020-03-06 02:11:50

---
title: Free workshop on .NET Core + GraphQL + Serverless
published: true
description: This is a free workshop for learning GraphQL, Serverless and Micro services in .NET Core and C#
tags: dotnet, csharp, graphql, serverless
---

Follow me on [Twitter](https://twitter.com/chris_noring), happy to take your suggestions on topics or improvements /Chris

TLDR; This is a free workshop for learning GraphQL, Serverless and Micro services in .NET Core and C#. It is free and is under MIT license, please use to learn or teach others.

This workshop can be found at 

> https://aka.ms/graphql-workshop-dotnet

## References

[Sign up for a free Azure account](https://azure.microsoft.com/en-us/free/?wt.mc_id=devto-blog-chnoring)
To create Serverless Azure Functions you will need a free Azure account

[Starter guide .NET Core](https://dev.to/dotnet/how-you-can-get-started-with-net-core-and-c-in-vs-code-30gc)
Completely new to .NET Core? Then start here. It will tell you all about how to use the CLI to scaffold projects, run and build them.

[Serverless + GraphQL](https://dev.to/azure/how-you-can-build-a-serverless-api-using-graphql-net-core-c-and-vs-code-g5h)
This shows how you can build a GraphQL API in Net, we also show mutations. The article then proceeds to host the GraphQL API in a Serverless app.

[Serverless app in .Net](https://dev.to/azure/how-you-can-create-a-serverless-api-in-c-and-net-1ie)
Building a Serverless REST API is quite easy using Azure Functions and some great plugins in VS Code. This is the 10-20 min of coding, depending on your caffeine level ;) Getting to use .NET and C# while building is even greater

[Serverless App using CosmosDB and database bindings](https://dev.to/azure/how-you-can-build-a-serverless-net-core-api-in-no-time-with-bindings-and-cosmosdb-2eg8)
Bindings are a great feature in Serverless that takes care of connecting to your data source. Writing a CRUD API is super simple thanks to it.

## Workshop content


this workshop covers the following areas

### -1- GraphQL API

This first part covers GraphQL. You will be taught to define a schema in `gql` and learn concepts such `query`, `mutation`, `resolvers`. We will learn both how to read and write data and how to resolve nested queries

### -2- Microservices

In this part, we will learn how to build a Microservice in .NET Core and C#. We will also learn how to containerize our services and how to get them up and running with `Docker` and `docker-compose`. 

### -3- Serverless

In this part, we will learn how to serve our GraphQL API from within a Serverless function. 

### -4- Deployment

Here we will learn to lift everything to the Cloud. We will push our microservices to a so-called Azure Container Registry, a private container repo in the Cloud and from there create endpoints in the Cloud. 

We will also learn how to deploy the Serverless function to the Cloud


If you see any areas for improvement please raise issues and PRs here 

> https://github.com/softchris/graphql-workshop-dotnet/tree/master/
Design inspiration (UI/UX)
Tags: design, ui, ux, webdesign
Published: 2020-03-06 01:42:34

Are you looking for inspiration to design your websites ?
Here is a list of websites that I find inspiring and pretty!

https://www.netlify.com/
https://stripe.com/
https://www.digitalocean.com/
https://www.airbnb.com
https://www.intercom.com/
https://www.heroku.com/
https://discordapp.com/
https://www.dropbox.com/fr/
https://fr.shopify.com/
https://www.coinbase.com/
https://checkr.com/
https://www.algolia.com/
https://gusto.com/
https://mailtrap.io/

I hope this will help you in the conception of your designs! 🦄
Angular 9 and ASP.NET Core 3.1 Not Ready for Prime Time
Tags: angular
Published: 2020-03-06 01:30:42

Scenario: 

1. In Visual Studio (not code) 2019 create an ASP.NET Core 3.1 Angular solution.

2. Notice that the package.json defaults to Angular 8.

3. Now run an NG Update (to attempt to get to Angular 9).

4. Once you are ready, start the project from Visual Studio (IIExpress).

5. There are many more 'legacy' things going on with Visual Studio regarding tools that are out of date, but I'll save that for another post.

```
An unhandled exception occurred while processing the request.
AggregateException: One or more errors occurred. (One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: ))
System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions)

InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was:
Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(string sourcePath, string npmScriptName, ILogger logger)
```
Not to sing the blues, but the the entire new project npm install takes about 10 minutes. This is a long time when the day has already been uncooperative.

I didn't try all the solutions, but the ["place echo in front of ng serve"](https://www.google.com/search?q=place+echo+in+front+of+ng+serve) did not work.
Don't Leave Your Empty States Empty
Tags: learninpublic, productdesign, ux
Published: 2020-03-06 01:17:22

We design and build our apps for our imagined ideal user. This is a person that uses the app everyday, that uses all the different features, that is constantly producing and consuming. There is another really important kind of user that we need to design and build our apps for. That is a new user. When a new user first signs up and starts clicking around the app, they are going to see a bunch of _empty states_. Even if we don't expicitly design an empty state for our users, we will have implicitly built one that they will see.

Imagine a table of things that belong to the user's account. When they first sign up, they won't have any of those things. By default, a lot of apps show an empty table with just headers. That's a choice. We could also choose to take advantage of this opportunity. We can show the user what to expect, we can orient them to the UI, and we can help them imagine the value they are going to get out of the app.

This is exactly what [Freshbooks](https://www.freshbooks.com/) does on their dashboard when you first sign up.

![Freshbooks Dashboard Empty State](https://dev-to-uploads.s3.amazonaws.com/i/nb9aoo2joac0pshn337o.png)

There is no data or revenue or whatever to show. Not yet. Freshbooks jumps at the opportunity to orient me to their dashboard and get me excited about the money I'm going to start bringing in with their product.

Here is what I see when I jump to their invoicing page:

![Freshbooks Invoicing Empty State](https://dev-to-uploads.s3.amazonaws.com/i/a9ujyujlo84pj022f22h.png)

They show me a couple temporary CTAs to educate me about the product, they tell me about the high-level numbers even though they are zero, and then they fill up what would be a bunch of whitespace with placeholder invoices in different states.

In terms of MVPs and business priorities, you probably ought to focus on the _happy path_ of your ideal user, at least at first. That said, any business and app that has legs is going to constantly have new users coming in. You'd be remiss to not spend some time on that experience. The empty states across your app are a new user's first experience with your app and your business. You better make a good impression.
Websites of the three richest people in the world
Published: 2020-03-06 01:03:33

Everyone knows that a good website is a key requirement for any successful business. Maybe you can learn some from America's most successful businessmen.

1) Jeff Bezos - [amazon.com](amazon.com)
![amazon.com](https://i.gyazo.com/be7eb71315021ff6b8c898aa377005a3.png)

2) Bill Gates - [microsoft.com](microsoft.com)
![microsoft.com](https://i.gyazo.com/e35f10a59790ac1ed0bfb6f07aeffceb.png)

3) Warren Buffet - [berkshirehathaway.com](berkshirehathaway.com)
![Berkshire Hathaway](https://i.gyazo.com/dc633b2e13e23279f985e3f644a8ddc0.png)

(This post post was made as an excuse to share Berkshire Hathaway's 90's site still chugging along)
How to Build a Textual Progress Bar for Node.js CLI and Terminal Apps 
Tags: cli, node, terminal
Published: 2020-03-07 09:40:10

---
title: How to Build a Textual Progress Bar for Node.js CLI and Terminal Apps 
published: true
date: 2020-03-06 00:00:00 UTC
tags: cli, node, terminal
canonical_url: https://jagascript.com/how-to-build-a-textual-progress-bar-for-cli-and-terminal-apps/
---

I find textual interfaces extremely interesting and I’m trying to figure out how some common components can be creates

this is the time of a progress bar

![gif](https://user-images.githubusercontent.com/4562878/76140679-35db2200-605d-11ea-8258-d73dbcb8263c.gif)

to create a textual progress bar we need to understand two simple concepts

- you can control where the cursor Is programmatically
- There are ANSI escapes code to cancel the entire screen or the current line (\r)

One way to achieve this is to start a loop and on every iteration print the special escape code `\r` that will clear the line at the cursor position and then print one of the following to simulate a progress

```
[.]
[..]
[...]
[....]
[.....]
[......]
[.......]
[........]
[.........]
```

In this example, I’ll be using Node.js

```
async function main() {
  /* using 20 to make the progress bar length 20 charactes, multiplying by 5 below to arrive to 100 */

  for (let i = 0; i <= 20; i++) {
    const dots = ".".repeat(i)
    const left = 20 - i
    const empty = " ".repeat(left)

    /* need to use `process.stdout.write` becuase console.log print a newline character */
    /* \r clear the current line and then print the other characters making it looks like it refresh*/
    process.stdout.write(`\r[${dots}${empty}] ${i * 5}%`)
    await wait(80)
  }
}

main()

function wait(ms) {
  return new Promise(res => setTimeout(res, ms))
}
```

This was relatively simple but with some [custom colors](https://dev.to/jaga/how-to-show-colored-text-in-terminal-4bbg) can have a huge impact in the UX of a tool, especially it takes some time to complete and there is no other feedback for the user that everything is going ok

* * *

full code available on the repo on [github](https://github.com/kandros/textual-progress-bar)
3008 A configuration error has occurred
Tags: net, iis, web
Published: 2020-03-06 13:19:57

---
title: 3008 A configuration error has occurred
published: true
date: 2020-03-06 00:00:00 UTC
tags: net, iis, web
canonical_url: 
---

A static HTML website I look after is hosted on a Windows Server 2012R2 instance running IIS, it makes use of a `web.config` file as it has some settings that allow this site to be served from behind an Amazon Web Services Elastic Load Balancer.

Today it kept crashing with the thousands of these events in event viewer:

```text
Event code: 3008
Event message: A configuration error has occurred.
Event time: 05/03/2020 09:15:49
Event time (UTC): 05/03/2020 09:15:49
Event ID: 83032f1dc8d9486e95dfc13f9f88a22d
Event sequence: 1
Event occurrence: 1
Event detail code: 0
Application information:
    Application domain: /LM/W3SVC/6/ROOT-1789-132278733487264657
    Trust level: Full
    Application Virtual Path: /
    Application Path: C:\Sites\your-website.com\static\
    Machine name: PRODUCTION-WEB-
Process information:
    Process ID: 2104
    Process name: w3wp.exe
    Account name: IIS APPPOOL\your-website.com
Exception information:
    Exception type: ConfigurationErrorsException
    Exception message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. (C:\Sites\your-website.com\static\web.config line 4)
Request information:
    Request URL: http://www.your-website.com/default.aspx
    Request path: /default.aspx
    User host address: 172.31.38.122
    User:
    Is authenticated: False
    Authentication Type:
    Thread account name: IIS APPPOOL\your-website.com
Thread information:
    Thread ID: 5
    Thread account name: IIS APPPOOL\your-website.com
    Is impersonating: False
    Stack trace:
   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags)
Custom event details:
```

![EventViewer](https://i.imgur.com/tO2yXq5.png "EventViewer")

The fix was to change the websites application pool to use .NET CLR Version 4 rather than .NET CLR Version 2

So, open **IIS**, choose **Application Pools** from the left-hand navigation, Choose your app pool and click **basic settings** to open the dialog to change which .NET CLR Version to use.

![AppPool](https://i.imgur.com/UuKgIM7.png "AppPool")

Once this was done the errors stopped and the site stopped crashing

Success 🎉
How to use eslint with webpack / ES6 / modules
Tags: eslint, es6, webpack, javascript
Published: 2020-03-05 23:48:24

Today we are going to talk about eslint and webpack. This is not going to teach you how to install eslint in your project, I will assume that you already did.

First of all, when you are new to _eslint_ and want to _**auto-fix**_ your JavaScript files, so you run <code>npx eslint --fix . </code> but, you have this _main.js_ that webpack kindly generated for you to make your code separated by modules, work.

So, you get this result :arrow_forward:
![main.js](https://lh3.googleusercontent.com/QxtyVRiv66gUVWCdZZgZ4OzXTVxzqvIu5btgF_AUsv4WVU1lR-VKz5iQ6ptKP499-gWhAdplZ-bDr1M3kbknCow7AreYvwwOn5oZL9gP=s1600)

Even though the code still working, you are not going to pass eslint rules. We don’t need to check this file with eslint, so what do we do?

We need to create a file in the root directory called _.eslintignore_
![.eslintignore](https://lh5.googleusercontent.com/3d6fdeH74V_3XMg-tafLi0SfO3Zx7VsZpX6vw9rYqBrNNxApp_r7SMDz76xL8UIczlRhKA9PFG2Gwn-6z9Jsuex5kkpz9qiaM3_gwUNC=s1588)


As you can see, the only line of code that you need to write is _dist/main.js_


And that's it, next time you use `npx eslint .` or `npx eslint --fix .` eslint will **ignore** this file.

If you want to check it out directly from the official documentation, go to the next link https://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories

Happy Coding! :smile:
Day 1: Relearning to code
Tags: devjournal, javascript, newbie, clojure
Published: 2020-03-05 22:54:12

Hello my name is Albert Martinez, and I am a Javascript developer.

I’m going to start working on several new projects in the hopes of building up my portfolio. I want to do things differently this time. I have been programming for quite a long time but don’t have as much as I would like to show for it. This is because I learned so many obscure but nonetheless useful stuff but never wrote down what I learned.

This is my attempt at trying to document my coding journey as much as possible. I also want to develop this into a writing habit.
Facebook Coding Interview Question-FindLongestSubarrayBySum
Tags: computerscience, tutorial, beginners, webdev
Published: 2020-03-05 21:55:48


# Problem Statement 
**Given an unsorted array of integers, find a subarray which adds to a given number**

arr = [10,2,-2,-20,10]
sum = -10 

The longest subarray is [10,2,-2,-20] having the length of 4.The solution should return the starting and end indices of the found subarray, here `0,3`

**Expected Result** - `0,3`

# Naive Implementation 
Find out all the subarrays whose sum computes to given `sum S`.Then,it will check the sum of each subarray with the given `sum S` and return the indices of the longest subarray. But this approach takes O(n^2) time complexity which is generally considered bad.

# Efficient Implementation -  Efficient way of doing this is using a HashMap
**Time Complexity**  - O(n) // Much better than O(n^2)
**Space Complexity** - O(n)

```javascript

import java.util.*;
import java.lang.*;
import java.io.*;


public class MaxLengthSubArray
{
    public static void main (String[] args) throws java.lang.Exception
    {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int[] a = new int[]{10,2,-2,-20,10};
        int total= -10;

        // create a `HashMap` to store all the array elements `sum` and their 
        // `indices`
        Map<Integer, Integer> map=new HashMap<>();
        map.put(0,-1);

        // we have to keep track of the sum of the subArrays,so that is stored in 
        // this variable `sum` ie `sum` is the current sum
        int sum=0;

        //starting index pointing to the first element of the array 
        int start=0;

        // end is not pointing anything,so it is set to `-1`
        int end=-1;

        // Traverse through the entire array and calculate the current  
        // `sum`.After calculating the currentSum,we will subtract the currentSum 
        // with the  given `sum S` and check whether it is equal to 0.If, it is 
        // equal to `0` then that means we have found the subArray which will 
        //give sum S = -10
        for(int i=0;i<a.length;i++){
        sum+=a[i];
        if(!map.containsKey(sum))
        map.put(sum,i);
        
        if(map.containsKey(sum-total ) && start<i - map.get(sum-total )){
            start= i-map.get(sum-total );
            end=i;
            }
        }
    
        System.out.println(end-start+1+" "+end);
        
    }
    
}


```

If you found this article helpful, please tap the <img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/emoji/emoji-one-unicorn-695106da1194513bfa0092f1a75943f59089be7d6addbc7459bdfab80f5709e6.png" alt="drawing" width="30" height="30"/> Follow this channel for more articles on data strucures and algorithms.
Singleton Pattern
Published: 2020-03-05 21:51:26

# Singleton Pattern 
### *Single object instance*

GitHub code : https://github.com/FrancescoXX/Design-Patterns-Singleton-Javascript
___



## Creational pattern

## ⚡️Problem (we need)
- One configuration file, from different components
- Always the same file
- Guaranteed that there is only one file

___

## 💡Intent
 - Ensure a class only has one instance.
 - Provide a global point of access to it.

___

## 🔧 Apply
 - One instance of a class is required
 - It must be one access point
 - Need to manage object instances

___

## ✅Pro
- Single point of access to the instance
- Avoid global variables
- Ability to subclass the singleton class
- Configure the number of instances

___

## ⚠️Cons
- State of the singleton must be shareable between program executions

___

## 🏆 Great for
- Manage number of instances at runtime
- Provide one single unique access

___

Structure
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2kjikur9rdugv8bnb9xe.jpg)
___


GitHub code : https://github.com/FrancescoXX/Design-Patterns-Singleton-Javascript
Are you currently working on multiple projects at a time?
Tags: discuss, sideprojects, productivity
Published: 2020-03-05 21:36:49

Whether you are a 9to5er or a full-time freelancer, you probably have a few projects going on at the same time.

I'm currently a full-time frontend developer with a business on the side, while also creating small side-projects on weekends.

Curious to know how it is going for you :)
Use Emojis in Go
Tags: go
Published: 2020-03-05 21:20:49

**[emoji](https://github.com/enescakir/emoji)** is a minimalistic emoji package for Go. It makes emoji usage easier.
You don't have to remember emoji names. Your IDE's autocomplete feature handles it.

{% github enescakir/emoji no-readme %}

## Usage
```golang
package main

import (
    "fmt"

    "github.com/enescakir/emoji"
)

func main() {
	fmt.Printf("Hello %v\n", emoji.WavingHand)
	fmt.Printf("I am %v from %v\n",
		emoji.ManTechnologist,
		emoji.FlagForTurkey,
	)
	fmt.Printf("Different skin tones.\n  default: %v light: %v dark: %v\n",
		emoji.ThumbsUp,
		emoji.OkHand.Tone(emoji.Light),
		emoji.CallMeHand.Tone(emoji.Dark),
	)
	fmt.Printf("Emojis with multiple skin tones.\n  both medium: %v light and dark: %v\n",
		emoji.PeopleHoldingHands.Tone(emoji.Medium),
		emoji.PeopleHoldingHands.Tone(emoji.Light, emoji.Dark),
	)
}

/* OUTPUT

    Hello 👋
    I am 👨‍💻 from 🇹🇷
    Different skin tones.
      default: 👍 light: 👌🏻 dark: 🤙🏿
    Emojis with multiple skin tones.
      both medium: 🧑🏽‍🤝‍🧑🏽 light and dark: 🧑🏻‍🤝‍🧑🏿

*/
```