teleren/devto huggingface dataset:
npm vs npx - which to use when?
Tags: todayilearned, tutorial, beginners, node
Published: 2020-03-31 08:56:07


Let's see what is the difference between these two.

##What is npm##

**npm** (Node package manager) is the world's largest software registry. It is installed with [Node.js](https://nodejs.org) which means that you have to install Node.js to get npm installed on your computer.
npm includes a CLI that can be used to download and install packages.

To start working with npm first we need to create package.json (this file holds various metadata relevant to the project. File is used to give information to npm that allows it to identify the project as well as handle the project's dependencies) file by executing this command:

```javascript
npm init -y
``` 

This command will create package.json file in the current directory with default settings because we used -y flag.

To add packages from npm registry we can run this command:

```javascript
npm i eslint
```

The command will add eslint linter to our project (it will create node_modules package and update package.json file with eslint as a dependency) - and basically, this is the main job of npm.

This is how package.json looks like after eslint installation:

```json
{
  "name": "dev.to",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "eslint": "^6.8.0"
  }
}
```

Ok, so we have dependency included in our package, but how to use it? Well, this is the point where npx can jump in.

##What is npx##

**npx** is also a CLI tool whose purpose is to improve the experience of using packages from the npm registry (since npm version 5.2.0 npx is pre-bundled with npm - tnx [StefanT123](https://dev.to/stefant123) for pointing this out). With npx it is easy to run any sort of Node.js based executable. Let's see examples:

To execute eslint we have two choices:

```javascript
./node_module/.bin/eslint --init
```
Although, all node executable is located in .bin directory running the command above is not so user friendly, instead, we can use npx:

```javascript
npx eslint --init
```

Much better!

If for some reason you do not want to use npx, you can install eslint globally:

```javascript
npm install -g eslint
```

Now package will be installed in node_modules in user directory on your machine which means that you can run eslint globally in any directory.

Of course, there are a lot of use cases for npm and npx usage, I pointed out just basic ones.

Thank you for reading!
How Do You Learn New Frameworks?
Tags: ask, discuss
Published: 2020-03-31 08:46:58

This week I started learning [Svelte][0] to better understand how to write it idiomatically. I am doing this for research purposes :smile: The first thing I thought about doing was going through the documentation but I also wanted to have fun. So I decided to just [stream][1] the process of rewriting a simple site. That was more fun 😄

This made me curious. How are you learning new frameworks?

[0]: https://svelte.dev/
[1]: https://www.youtube.com/watch?v=nmBQMmEymjM
A Glance At Seed Funding For Startups in India
Published: 2020-03-31 07:51:19

We are not challenging large tech corporations that can go great guns with a $100 million support — this is more directed at small firms like your startup. You have obtained a great idea. It extends into a full-blown company. But how will your firm broaden? This is a tough question. If you have just commenced a firm, you might classify that your resources are comparatively humble – but this is not generally an obstacle to securing more. But how do you attain financing or identify companies that can go about seed funding for startups in India?

The importance of the initial capital injection by a lender and their capacity to certify the firm model, build a pilot, as well as relate along the first consumers is fundamental for an entrepreneur. In this blog, we will review seed funding for startups in India.

It may appear that evolving a marketplace startups isn’t as tricky as functioning some other web apps. Technically saying, that’s true. Yet, when it comes to marketplaces, you confront a diversity of other issues that can wipe out your product from the very origin. What model should you adopt? How will you portray sellers and buyers? How will you remember them? All those questions are vital and need distinct consideration.

Reference Link:- https://www.startuppaisa.com/blog/seed-funding-for-startups-in-india/
The RxJS concatenation strategies, pt 2/4
Tags: javascript, rxjs
Published: 2020-03-31 07:50:58

The [previous article](https://dev.to/e4r/the-rxjs-concatenation-strategies-pt-1-4-394g) of this mini-serie was about the first concatenation strategy in the amazing RxJS world, which was a direct sequential events concatenation.

Today, I’ll dig deep into the mergeMap merging strategy.

Differently enough from the *concatMap* , which enqueues all the events by the input events’ order, the mergeMap operator emits events by overlapping the order. Let’s see the marble diagram below:

![mergeMap marble table](https://miro.medium.com/max/875/1*nOCnnpYBU2wZQSa48JlfNg.png)


Here let’s suppose that a user types in **“A”, “B” ** and **“C”** in a textbox attached to a Subject that emits values.

Plus, there is another Subject that takes in a stream of values, and emits three new values combining the letter typed by the user and a sequential number (1,2,3) in an interval of a second each. 

So, **if a user types “A”**, the value emitted immediately will be **“A1”**, then **“A2”** after a second, and finally **“A3”** after three seconds.

Here, there isn’t a proper concatenation, is more like attaining to the word meaning: it’s merging all the emissions consequently, even if the event before hasn’t finished and even if they're overlapping each other. 

This is especially true with HTTP requests. In this case, if we consider A1, A2, A3, B1 and so on as HTTP requests, **they will be started consequently**, and A2 will be started even if A1 isn’t completed.

Hope that this merging strategy is a bit more clearer now.
The next article will talk about the next concatenation strategy: *switching*.
In Home Isolation Project #1
Tags: angular, javascript, css
Published: 2020-03-31 07:45:19

During those difficult times I am looking at something to pass my time in more productive way than usual. 

I decided to finally tackle Angular it self. My goal was simple. A personal website with few components.

I have used a Angular Material and Bootstrap to help with the designs. 

Here is a link to repo: 
https://github.com/kbuczynski-nashpl/kbuczynski-nashpl.github.io/tree/code-master

Tell me what you think.

Any feedback is appreciated !
CURL request without protocol on expressJS server?
Published: 2020-03-31 07:37:46

I want to know how wttr.in achieve this. If you curl that domain the result will show on your terminal. I'm curious, how to achieve this on my current domain name which serve a COVID-19 stats from terminal. May be you can help me to achieve this?

Here's the repository: warengonza.ga/covid19-tracker-cli-repo
NPM CI is better than NPM install in your CI/CD
Tags: node, gradlew, gitlab
Published: 2020-03-31 07:37:15

---
title: NPM CI is better than NPM install in your CI/CD
published: true
description: A better and faster way to build your pipelines, specially whit Gradlew and the node plugin. 
tags: NODEJS, gradlew,gitlab 
---

### A better and faster way to build your pipeline in a node project in general is to use the NPM CI command.

    
##### npm ci 
   The command offers massive improvements to both the performance and reliability of builds for continuous integration / continuous deployment processes, providing a consistent and fast experience for developers using CI/CD in their workflow.

npm ci don't use the  package.json to install modules, it uses the package-lock.json file. This ensures reproducible builds—you are getting exactly what you expect on every install.


Example to implement in the Gradlew with the NodeJS plunging:

in the build.gradle file
```

task npmCi(type: NpmTask) {
    dependsOn npmSetup
    npmCommand = ["ci"]
    inputs.file("package.json")
    inputs.file("package-lock.json")
    outputs.dir("node_modules")
}
npm_run_build.dependsOn npmCi

assemble.dependsOn npm_run_build

```


And for the .gitlab-ci.yml
Replace the npmInstall in the build and other parts that you're using npmInstall
```
script:
        - ./gradlew npmCi
        - export NODE_ENV=production
        - ./gradlew --build-cache build
```



{% gist https://gist.github.com/leamsigc/68d3f891d9298c35de273caa2b21e453 %}
Font family recommendation
Tags: productivity, discuss, motivation
Published: 2020-03-31 06:49:11

Hi everyone :coffee:

In theese days, I work remotely because of the pandemic. So I have a little more time in the morning and I spend this time having breakfast in front of the computer and review the codes I wrote. I noticed that I was bored with the font family I used this morning. I think I need to change this to increase my productivity :) I am currently using __"Consolas, 'Courier New', monospace"__. Which font family do you use when writing code? By sharing here, we may increase someone's productivity.

My code editor looks like below

![My text editor](https://dev-to-uploads.s3.amazonaws.com/i/38f7v01c5qq3j4dlgzq5.png)
What are common programming errors or "gotchas" in Java?

Published: 2020-03-31 06:38:46

The treatment of InterruptedException, it is a common bug I’ve seen in nearly every Java Project I’ve ever joined. It is a mistake made by seasoned senior developers. It is something simple to fix, though not simple to understand. It is an ideal case for an idiomatic solution, but the most commonly seen example is flawed. Flawed rather like the way naive singleton implementations are flawed, it is subtle and manifests in ways that are difficult to diagnose. How often have you see this code?

try{
 //...
  }catch (InterruptedException e) {
    LOGGER.info("Interrupted!", e);
  }
}
It is wrong in two ways, it consume the exception and continues which ignores the interruption and is heading towards an disorderly halt. Unless you can correctly handle the interruption, then InterruptedException should be progergated not consumed. In most cases perform as orderly shutdown of your processes as is possible, including the shutdown of any sub processes and close any resources, then restore the interrupt status.

try{
 //...
} catch(InterruptedException e) { 
   subProcess.shutdown();
   resource.release();
   Thread.currentThread().interrupt(); 
}

Regards
https://www.quickpayportal.pro/
วันนี้มีคนติดเชื้อ Covid-19 กี่คน ?
Tags: covid19, thailand, information
Published: 2020-03-31 06:21:22

อยากตื่นมาแล้วรู้ว่า "แต่ละวัน" มีคนติดเชื้อใหม่กี่คน, ตายกี่คน แบบเป็นตารางให้ดูย้อนหลังเป็นรายวันได้ง่ายๆ

หาหลายเว็บแล้วยังไม่เห็นมีใครทำ
5.How to match word and non word characters.
Tags: regex, java
Published: 2020-03-31 05:26:33

The expression **\w** matches every word character and **\W** matches all non word characters.
Word characters include alphanumeric characters ([a-z][A-Z][0-9]) and underscore(_).
 
e.g:- String Pattern : \\\w\\\w\\\w
      Test String : **Dev**.to


**Note:** Use \\\ instead of \ in Java.

*Sample code in Java:*

import java.io.*;
import java.util.Scanner;
import java.util.regex.*;
class RegexSearch{
        public void tester(String Regex_Pattern){
                Scanner sc = new Scanner(System.in);
                String Test_String = sc.nextLine();
                Pattern p = Pattern.compile(Regex_Pattern);
                Matcher m = p.matcher(Test_String);
                while(m.find()){
                        System.out.print(m.group());
                }
        }
}
public class Main {
        public static void main(String[] args){
                RegexSearch obj = new RegexSearch();
                obj.tester("\\\w\\\w\\\w");
        }
}

**Input:** Devv.to
**Output:** Dev

[You can view the code here also.](https://onlinegdb.com/SkpjXLewL)
   

       👍 Have a nice day,Coders. 👍
My VSCode, Visual Settings (Theme, tab layouts,etc)
Tags: vscode, themes
Published: 2020-03-31 05:18:52

---
title: My VSCode, Visual Settings (Theme, tab layouts,etc)
published: true
description: 
tags: vscode, themes, 
---

Now this doesn't really need a huge write up but I'll just link you to a [Gist](https://gist.github.com/barelyhuman/cab9d7598b3251d3aee04201cb1c137a) that'll give you the whole `settings.json`.

Changed my mind,
I'm gonna link a few things that I'm using anyways.

### Theme
I switch between these 2 themes 

[Material Theme](https://marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme)

[Ayu Theme](https://marketplace.visualstudio.com/items?itemName=teabyii.ayu)


### Font 
It's a custom Ubuntu Mono font with Ligatures added, You can find it at [lemeb/a-better-ligaturizer](https://github.com/lemeb/a-better-ligaturizer), or customize any of your own fonts to use ligatures as well

[Fira Code Mono](https://github.com/tonsky/FiraCode) is another one that I like.

### Plugins 
[Music Time - Control Spotify with your code editor](https://www.software.com/music-time)

[PolaCode - For Epic Code screenshots](https://marketplace.visualstudio.com/items?itemName=pnp.polacode)

And that's about it, I do have other language specific plugins but I don't think I need them posted here.
Scrollable tabs with Bootstrap 4
Tags: css, design, html
Published: 2020-03-31 05:00:51

##Introduction

This post is about creating scrollable tabs using bootstrap.

Whenever a requirement of creating a tab bar comes up, we tend to think of how this would look in mobile view. If we are short of time, we look for options like plugins or does bootstrap has what I need which I can leverage and customize later on.

Same happened with me and I found out Bootstrap 4 doesnot give me such a component.

Then, I used the existing bootstrap 4 markup for tabs customised it to my needs and made it scrollable.

### what I used?
 Bootstrap 4.4.1
 Small JavaScript code (3 liner)
 Default template for tabs from bootstrap

### And this is how it looks like https://codepen.io/miteshkamat27/pen/QWbYPPW

I hope it reduces your pain in search of a scrollable tab bar.

Cheers !!!
Send Emails with GitHub Actions
Tags: github, devops
Published: 2020-04-06 13:46:14

---
title: Send Emails with GitHub Actions
published: true
date: 2020-03-31 03:39:00 UTC
tags: GitHub, devops
series: actions
cover_image: https://waylonwalker.com/send-email-with-github-actions.png
canonical_url: https://waylonwalker.com/blog/send-email-with-github-actions/
---

Here is one useful thing that you can do with GitHub actions no matter what language you use, send email. You might want to know right away when your ci passes. You might want to give your team a nice pat on the back when a new release is deployed. There might be subscribers wanting to see the latest release notes in their inbox as soon as the latest version is deployed. Whatever it is, its pretty easy to do with an action right out of the actions marketplace.

## Mail on Star

Here is a silly example that sends an email to yourself anytime someone stars your repo.

``` yaml
name: Mail on Star

on:
  watch:
    types: [started]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "email"
  email:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - name: ✨ Send email, you star
        uses: dawidd6/action-send-mail@v1.3.0
        with:
          server_address: smtp.gmail.com
          server_port: 465
          username: quadmx08
          password: ${{ secrets.GMAIL_PASS }}
          subject: Your a star ✨
          body: ${{ github.actor }} just starred your mail-on-star repo!!! ${{ github.repository }}
          to: ${{ secrets.GMAIL_ADDRESS }}
          from: ${{ secrets.GMAIL_ADDRESS }}
```
Input bindings with Azure Durable Functions
Tags: azure, serverless, tutorial, wecoded
Published: 2020-03-31 01:56:54

Durable Functions is an extension built on top of the Azure Functions platform and it gives you the ability to define how multiple individual functions can be orchestrated to work together in a workflow.

The Activity functions in Durable Functions are just like normal Azure Functions, so they can use input and output bindings.

In this video, I walk through a simple example of using a blob input binding.

{% youtube JPPMQx2Cjnk %}

I plan on creating more content around Azure; it's great to share what I've been learning.

If you have any feedback at all, please let me know in the comments below or reach out to me on socials.

Thanks for reading and possibly watching!
Container With Most Water 💧 
Tags: beginners, career, interview, codenewbie
Published: 2020-03-31 01:20:05

Here is a fun problem dealing with arrays.

Given n non-negative integers a1, a2, ..., a(n), where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.

Note: You may not slant the container and n is at least 2.

![](https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/17/question_11.jpg)

The above vertical lines are represented by an array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.

Example:
Input: [1,8,6,2,5,4,8,3,7]
Output: 49

Looking at this problem there are two ways I would attack it. The first being a brute force approach and iterating through possible combinations of walls to find the boundary that holds the most water.

##Brute Force Approach 👊
Looking at a double for loop approach, the most important factor for this problem is the smallest wall. Iterating with two indices you can pick the smallest wall and multiply that wall by the distance between the two indices. 

{% gist https://gist.github.com/austinmsuarez/270abbf08a6604d59691d08e1de9e2b5 %}

##Two pointer approach:
Looking to see how we can improve upon this process we can two different pointers to yield us a better BigO notation of O(n).

{% gist https://gist.github.com/austinmsuarez/41c8c2f8ca15ec9fa24fcf4d03484ff1 %}


Hope you liked this post, please follow and clap for more! Throw your implementations in the comments below! 🙏
8 Terms that Define a Relationship--Do You Agree with these Definitions?
Tags: html, css, 100daysofcode, codenewbie
Published: 2020-03-31 01:02:56

This is Day 10 of 100DaysOfCode, and I have been doing projects in order to cement my understanding of the foundations of HTML and CSS. This project is a project that defines Relationship terms. The purpose of the project was to get used to using Links and Lists. Link to project here:https://codepen.io/tummytucker94/pen/JjdxwBy?editors=1000
My shell
Published: 2020-03-31 00:29:10

I use fish shell.

I use the following plugins:
b4b4r07/enhancd
franciscolourenco/done
jorgebucaran/fish-nvm
joseluisq/gitnow
jethrokuan/fzf
rafaelrinaldi/pure

For enhancd I use the fzy fuzzy finder over the other options because fzy does not take over the whole screen and it does not cause an annoying "awk" bug when I use it.

Edit: The awk bug is caused by the default macOS awk. It is fixed by installing the GNU awk, using `brew install gawk`.

Edit 2: I do also have fzf installed because with the jethrokuan/fzf plugin, I can fuzzy search through my command history!
What changes have you made in this pandemic as a programmer to make your day more productive?
Tags: discuss, productivity, challenge, todayilearned
Published: 2020-03-30 23:52:59


## For me
- 10 minute HIIT workout before I start my day
- Added virtual background to the Zoom app
- Added a [second monitor](https://amzn.to/38QD0L7)
- Consolidated my meetings to only on Wednesdays
- Got a [standing desk](https://amzn.to/2WS0hdv)
- Bought [Wes Bos React course](https://advancedreact.com/) which my manager agreed to reimburse. YAY!
- Changed my working hours to 8-4 so that I can spend more time with my family
- I have started asking more questions on Slack channels. People have started noticing my work.

I will keep updating this list.

#### Your turn!

--- 

I write about programming, personal finance, and productivity - so click the **+FOLLOW** button if it interests you!
Resumo View Binding Android Studio 3.6 (Google IO 19)
Published: 2020-03-30 23:50:26

## Resumo View Binding Android Studio 3.6 (Google IO 19)

O **View Binging** foi apresentado no **Google I/O'19** (https://youtu.be/Qxj2eBmXLHg?t=242), trazendo grandes benefícios, ao, se comparar, com outros modelos de acesso a view. Agora é só aguardar o Android Studio 3.6 para podermos utilizar esta funcionalidade.

#### Comparativo dos modelos de acesso ao componentes da View

Conforme imagem abaixo, o view binding é considerado Elegante, verificado em tempo de compilação e não impacta no tempo de build.

![](https://gist.githubusercontent.com/viniciusalvesmello/4016e6c2dda86e65c879a4c1c05cda5f/raw/b5a13d9b9cb138fe572249656e2bf8002e1f016b/comparativo.png) 

#### Resumo do View Binding

- Conforme imagem abaixo, podemos destacar do View Binding:
	- Disponível a partir do Android Studio 3.6;
	- O gradle é responsável por criar as classe de binding;
	- 100% verificada em tempo de compilação;
	- Totalmente integrado com o Android Studio 3.6;
	- Compatível com Data Binding.

![](https://gist.githubusercontent.com/viniciusalvesmello/4016e6c2dda86e65c879a4c1c05cda5f/raw/b5a13d9b9cb138fe572249656e2bf8002e1f016b/definicao.png)

#### Exemplo de uso do View Binding

No exemplo da imagem abaixo podemos verificar que o Gradle criou automaticamente uma classe com o nome do xml mais "Binding", logo, "profile.xml" virou "ProfileBinding". Com isto, não precisamos mais informar qual o layout, do resources, uma determinada activity ou fragment está relacionada, informando, apenas, a classe de binding.

![](https://gist.githubusercontent.com/viniciusalvesmello/4016e6c2dda86e65c879a4c1c05cda5f/raw/b5a13d9b9cb138fe572249656e2bf8002e1f016b/exemplo.png)


**Link da documentação do View Binding**: https://developer.android.com/topic/libraries/view-binding
Day 105 : Anniversary
Tags: hiphop, code, coding, lifelongdev
Published: 2020-03-30 23:39:12

_liner notes_:
- Saturday : Did the show from my house again this week. What was good was that I didn't have to break down and set back up my equipment to do the show. Got to find a bright spot in this situation. Also realized that this show marked our 12 year Anniversary of us doing the radio show. Had a really good time hanging out with everyone. Thanks to everyone that supports us. The show's recording at https://kNOwBETTERHIPHOP.com

![Joseph Lowery with his hand raised and holding a microphone with the words March 28th 2020, We ain't going back.](https://dev-to-uploads.s3.amazonaws.com/i/l7pvonpw5fg0eqj5gck8.jpg)

- Sunday : Tried to relax a little. I bought another domain name. haha I also spun up a new project and did some research for a side project.

- Professional : Today, I had some meetings. Found a post that a co-worker did that is similar to what I was working on. Looks like there were some new things added to the API so I'm going to see if I can incorporate it into what I have and refactor my code.

- Personal : So, I spun up a new projectand added Firebase Authentication to it. I want to use phone verification because I want to check the number before allow a person to even be able to sign in. All the other authentication options allow for anyone to sign up and I don't want to use email/password.

![Ice Age Trail in Wisconsin with Stone walls on both sides](https://dev-to-uploads.s3.amazonaws.com/i/90vkitnvj1eq5saj8w5z.png)

Going to try and figure out the authentication for my project to night and go to bed early. Plus "Dispatches from Elsewhere" is on tonight.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube agp3YKLpNO8 %}