teleren/devto huggingface dataset:
Install Postgres on Mac/Linux
Published: 2020-06-13 18:42:45


# **Linux**
## Step 1: Installation
```
$ sudo apt update
$ sudo apt install postgresql postgresql-contrib
```
## Step 2: Test the installation

```
sudo -u posgtres psql
```
You should see:
`psotgres=# `

Type `\q` to quit

## Step 3: Create postgres user:

```
$ sudo -u postgres createuser --interactive
```
You should see prompts as shown below:

```
Enter name of role to add: test
Shall the new role be a superuser? (y/n) y
```
## Step 4: Create database

```
$ sudo -u postgres createdb test

```
Now, we need to create the same Linux user as the postgres user for authentication to succeed

```
$ sudo adduser test

```

now you can log in to your postgres database

```
$ sudo -u test psql
```
## Step 5: Assign password to the postgres user

```
$ sudo -u postgres psql

postgres=# ALTER USER test with PASSWORD 'your-new-password';

```

> Note: `test` is the name of your postgres user. If you want to connect to the postgres database programmatically you must create a password following step 5.

The connection string for the above database will be `postgres://test:your-new-password@localhost:5432/test`


# **Mac**

For Mac, what would change is the method of installing postgres

If you already have [Homebrew](https://brew.sh/) installed, you can install postgress with the command below, if you don't have Homebrew installed click [here](https://brew.sh/) to install it.

```
$ brew update
$ brew install postgresql
```

## Step 1: Create postgres user:

```
$ sudo -u postgres createuser --interactive
```
You should see prompts as shown below:

```
Enter name of role to add: test
Shall the new role be a superuser? (y/n) y
```
## Step 2: Create database

```
$ sudo -u postgres createdb test

```

```
$ sudo -u test psql
```
## Step 5: Assign password to the postgres user

```
$ sudo -u postgres psql

postgres=# ALTER USER test with PASSWORD 'your-new-password';

```
> Note: Creating a new postgres user is optional, you can make do with the default postgres user if you are want. 

If you want to use the default posgtres user, all you need to do after installing postgres is:

```
$ sudo -u postgres createdb test // or  $ createdb test

$ sudo -u postgres psql

postgres=# ALTER USER postgres with PASSWORD 'your-new-password';

```
Then, your connection string would be `postgres://postgres:your-new-password@localhost:5432/test`


Thanks for reading!
Is live coding fun?
Tags: programming, live, discuss
Published: 2020-06-13 18:41:27

---
title: Is live coding fun?
published: true
description: What would make live coding more fun?
tags: programming, live, discuss
//cover_image: https://direct_url_to_image.jpg
---

Do you think Live Coding is fun? If not... what do you think it will make it fun? 😊

I’ve seen gamers streaming and having thousands and thousands of viewers. Why can’t we (as programmers) have that? 🤔

This question is bugging me for a while now and I want to find a solution.

As a streamer myself I’d like to have more people who are engaged with the content that I’m producing and at the end have more fun AND learn more.
Why I created a social network
Tags: javascript, webdev, showdev
Published: 2020-06-13 18:28:36

A few years ago, I started getting interested in web development because of the great opportunity it provides to make an impact both on an individual and a community level. My first contributions were to the speedcubing community (see for instance the WCA [website](https://www.worldcubeassociation.org) and [repository](https://github.com/thewca/worldcubeassociation.org)). I enjoyed the experience so much that I just couldn't resist getting more into it.

Fast forward to a few months ago, I wanted to try and solve a problem that has bothered me for years, which is the apparent difficulty that exists to meet people and make new friends on this modern world. I could go way deeper into this, but it falls out of the scope of this post. So, to address the problem, I designed a social network that basically:

1. Connects people according to their interests.
2. Encourages people to go outside and meet others while doing something that they all enjoy.
3. It's as simple as possible.

In order to accomplish those 3 points, the experience goes like this:

1. Create a profile, which requires only the absolutely necessary personal information.
   - For example, the gender is not needed at all, so why request that information in the first place?
2. Select your interests.
3. Be presented with event recommendations in your area.
   - An event can really be anything: go to the cinema, play a basketball game, visit a museum, attend a hackaton, etc.
   - You are also able to create your own events.

That's the very basic functionality, but there's a bit more of stuff in order to provide a more complete experience:

- Each event has its own comments' wall so attendants to it have an easy way to communicate with each other.
- A person can send a friendship request to any other person, which has to be accepted to become friends.
- Private chats between friends.

And that's it! To build all of that, I used React and Material UI for the front end (hosted on Netlify), Node.js and Express.js for the back end (hosted on Heroku), and MongoDB for the database (hosted on MongoDB Atlas). The code is on GitHub, although it isn't open sourced yet for various reasons, but the plan is for it to be -- I can only imagine how amazing it would be to receive contributions from people as interested on the project as I am!

Please visit [Tisn - The introverts' social network](https://tisn.app) and let me know what you think about it on the comments' section below! If there's intereste on the topic, I would be very glad to post more about both the technical and the personal side of it.

Thanks for reading!
GSoC 2020: Blog 1 - Beginning of Coding Period
Tags: gsoc
Published: 2020-06-13 18:20:19

So the community bonding period of GSoC has ended and the coding period is officially underway. In my last blogpost, I had outlined the basic principles of General Relativity that go into my project. I had also mentioned, that the next blog will have details about the coding process. However, things had to be slowed down considerably, due to the announcement of closure of my academic session and some logistical issues. This has also affected my blog schedule, as I could not work on a blog, that was supposed to be up 2 weeks ago. However, I am pleased to inform that all the issues are sorted out now, leaving the rest of the summer free for me to delve into the project. Whew. I am also exceedingly grateful to my mentors, who have been understanding throughout. As for details on the code implementation for my project, I have decided to break it up across the blogs, as "Progress Reports" (bland, I know), in order to provide a better understanding of both what I am working on and my approach to it. So, read on.

## Progress so far...

Over the last few discussions with my GSoC mentors, we have discovered some logical bottlenecks in some of the EinsteinPy modules, especially the way the `metric` & `utils` modules work at the moment. Currently, the `utils` module stores most of the necessary functions required to form a `metric` class, while the `metric` module lacks support for user-defined metrics. It also handles the calculation of particle trajectory, which logically belongs inside a `geodesic` module. Since my project is on Null Geodesics, these issues are major obstacles, that must be overcome, before the work on adding support for Null Geodesic calculation begins.

As such, I am refactoring these modules, so that we have logical cohesion across EinsteinPy, whilst also adding some new features, like a brand new `metric` class, that supports defining arbitrary metrics and also adding first order linear perturbations to the metric, written in Kerr-Schild form. I have also grouped together the utility functions present in `utils` in `metric` itself. These changes can be followed at the PR link, [here](https://github.com/einsteinpy/einsteinpy/pull/512). At the moment, I am reusing some of the old tests and writing some new ones for the new features. I hope to see this PR clear all tests and be merged soon.

## Until next time...

After `metric`, comes the `coordinates` module, which will see some changes and code rearrangements too, albeit not as much as `metric` and `utils`. The basic work on this has already started and after the first PR is merged, I will open another PR with these changes.

We have lost around 2 weeks, due to the aforementioned issues on my side. Therefore, it is contingent on me to accelerate the pace of development now. Over the next few weeks, we should see some cool new feature additions to EinsteinPy. I will be detailing them here, as we proceed with the project.
Tour my pull request - Walkthrough your pull request code on github like a pro!
Tags: showdev, github, webdev, devtools
Published: 2020-06-13 17:00:12

---
title: Tour my pull request - Walkthrough your pull request code on github like a pro!
published: true
description: 
tags: showdev, github, webdev, devtools
---
![Tour my pull request](https://dev-to-uploads.s3.amazonaws.com/i/wy1z5hbrv2diqrl2332l.png)
## Link to Chrome Webstore
[https://chrome.google.com/webstore/detail/tour-my-pull-request/gfmcmkcdciebhnhcbchighdeegdaonnc/](https://chrome.google.com/webstore/detail/tour-my-pull-request/gfmcmkcdciebhnhcbchighdeegdaonnc/)

## Problem 
Explaining the code in a pull request to the reviewer with a flow is hard, especially when the number files in the PR is big and flow of code execution jumps between multiple files. 

## Solution
With Tour my pull request you can create a tour based on your flow and get your PR merged swiftly.

![Tour my pull request](https://dev-to-uploads.s3.amazonaws.com/i/inf36cbqgpzygbyedbza.png)

## Demo Video
{% youtube lKMZ3Ku530c %}

## Link to Chrome Webstore
[https://chrome.google.com/webstore/detail/tour-my-pull-request/gfmcmkcdciebhnhcbchighdeegdaonnc/](https://chrome.google.com/webstore/detail/tour-my-pull-request/gfmcmkcdciebhnhcbchighdeegdaonnc/)

## Feedbacks & Suggestion
This is an initial release, so please report me any issues or suggestions. I will try to address it. You can reach me on twitter [@sureshdsk](https://twitter.com/sureshdsk). If you like the idea, please spread the word with your colleagues and friends.
Learn to Build Mobile Apps With Ionic Framework, ReactJS & Capacitor : Firebase Account Creation, Auth and Initialization
Tags: ionic, react, tutorial, javascript
Published: 2020-06-13 18:08:49


Learn to Build Mobile Apps With Ionic Framework, ReactJS and Capacitor : Integrating Firebase Account Creation, Authentication and Application Initialization

Integrate firebase login and account creation using the authentication context created earlier in video series. Manage the initialization state to reload user if user was login in previously

{% youtube miIdPqPSO9k %}
Getting started with accessibility
Tags: help, a11y, html
Published: 2020-06-13 18:06:13

---
title: Getting started with accessibility
published: true
description: 
tags: help, a11y, html
//cover_image: https://direct_url_to_image.jpg
---

I know I need to learn more about the subejct but I'm not sure where to get started. I've heard of ARIA and a11y project other than that I know very little. 


Any tips/suggestions to learn more much appreciated.
One cool trick for your React props
Tags: react, javascript, webdev
Published: 2020-06-13 18:04:15

Here is a concise way to pass props that have the same name as the value being passed. Instead of:
```
<Component prop1={prop1} prop2={prop2}/>
```
The spread operator lets us use this cool syntax:
```
<Component {...{ prop1, prop2 }}/>
```
They can be combined too:
```
<Component {...{ prop1, prop2 }} prop3={prop3}/>
```
This syntax can look a little strange at first but should be quite clear once you see it a few times. Use with discretion for readability concerns.
Working with drafts on a Jekyll blog
Tags: jekyllrb, blog, tutorial
Published: 2020-06-13 17:46:02

Did you know that Jekyll supports drafts by default?

The process of writing a post may span to multiple days; from the time you jot down an idea, to writing the post, polishing and eventually publishing it.

Instead of creating a post, you can start using drafts for those unfinished posts that you don't want to publish yet.

To start using drafts on an existing Jekyll blog, just follow the following steps:

```sh
# Create a folder named `_draft` on the root directory of your blog 
mkdir _drafts
# Inside '_draft', create a Markdown file for your first draft
touch _drafts/my-first-draft.md
# Open this file and add some content
echo "my first draft" > _drafts/my-first-draft.md
#  Run your blog with the `--drafts` switch
jekyll server --watch --drafts
# Open http://127.0.0.1:4000 on your favourite browser to see the draft
```
And that's it!

You can now streamline your writing process using drafts! :rocket:

---

> This post was originally published on my [blog](https://diamantidis.github.io/) on June 13rd, 2020.
Nodejs cloud function deployment with private npm packages
Tags: googlecloud, node, npm, serverless
Published: 2020-06-13 17:38:29

Cloud Functions is an event-driven serverless compute platform from Google. You can run your code locally or in the cloud without having to provision servers. There are many ways to run nodejs application on cloud function. we are going to look for zip upload and deploy code from terminal.

On Google cloud platform select cloud function and create function.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8h2n6jehclcrp21s89es.png)

Fill the required information
1. Name - function name for your program.
2. Memory allocated - as required by function processing.
3. Trigger - select Http
4. Source code - zip upload.
5. Runtime - nodejs 10
6. Function to execute - It is a name of a function exported by the module specified in the directory with source code.
7. Check Advance Options if you want more control.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3xtcz6u11pucxmjlhwxp.png)

and finally upload a zipped nodejs application.

To deploy nodejs application with [private npm package](https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow), include `.npmrc` file at root level - 
```
//npm.private.com/:_authToken="<token>"
@ng-test:registry=https://npm.private.com/ 
```
you can read private npm package auth token from `~./npmrc` or [login](https://docs.npmjs.com/logging-in-to-an-npm-enterprise-registry-from-the-command-line) with `npm login --registry=https://registry.company-name.npme.io` and `npm token list`.

In `package.json` add private package name in dependencies and Google functions-framework in dev dependencies.
```javascript
{
    "name": "notification-service",
    "version": "1.0.0",
    "description": "Notification Service",
    "main": "index.js",
    "author": "Pritesh Kanthaliya",
    "license": "UNLICENSED",
    "scripts": {
        "start": "npx @google-cloud/functions-framework --target=notificationService",
        "deploy": "npx gcloud functions deploy notificationService --runtime nodejs10 --trigger-http",
    },
    "dependencies": {
        "@ng-test/hello-world": "1.0.0",
    },
    "devDependencies": {
        "@google-cloud/functions-framework": "~1.5.1",
    }
}
```
With `npm start` you can run nodejs application at local machine and test. With `npm deploy` you can deploy your code on Google cloud function. If a [cloud function](https://cloud.google.com/functions/docs/quickstart-console) is already present with the same name, it overrides the current one else it would create a new one.
Alternatives to Wordpress
Published: 2020-06-13 17:06:43

---
title: Alternatives to Wordpress
published: true
description: looking for alternatives
tags: 
//cover_image: https://direct_url_to_image.jpg
---

I've had an idea for building a site for a while and my initial thought was thatI would use Wordpress to build it, however given I know nothing about PHP I've decided against this. Ideally I'd like to be able to write the pages in markdown and style them accordingly.

What would you say are reasonable alternatives? Perhaps Gatsby + NetlifyCMS or Gridsome or Nuxt...

I currently have simple site setup with Gatsby/Forestry and my personal site is Gridsome/netlifyCMS so I've a bit of experience using/setting up those although I know more about Vue than I do React.

Anyone with experience of similar have any thoughts or suggestions?
Introduction to Data Science - Part 2
Tags: datascience, machinelearning, python, beginners
Published: 2020-06-13 17:05:19

Data Science is all about how well you understand your data. Knowing what type of data you have makes a lot of difference. By knowing your data type, you will be to apply necessary statistical measurements or you can conclude certain assumptions about the data.
 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/u4lpvxtkcuqo4q0ke28g.png)
**1. Categorical data or qualitative data** - data that can be divided into categories. Categorical data cannot be defined in numbers. Sometimes we use numbers to define categorical data, but that numbers cannot hold any value. 
Ex: You have population data of a city divided into male and female categories, you have represented 1 for male and 0 for female. Here 1 & 0 are numbers but they hold any mathematical meaning.

*i. Nominal data* - categorical data that has no order or sequence
Ex: Gender, Race, language etc.,
*ii. Ordinal data* - this is an ordered series
Ex: Education (high school, college, graduate, PhD)

**2. Numerical or quantitative data** - data which represents numerical value 
Ex: You have population data of a city and how much annual income and how many children every individual has. Number of children and annual income is considered as numerical data. It gives information about the quantity of a specific thing.

*i. Discrete data* - data that can be counted and not measured
Ex: Number of students in a class
*ii. Continuous data* - data that represents measurements
Ex: Temperature, heights of the students in a class

And just like different types of data, we have different ways to visualize the data:
*a. Nominal data* - pie chart, bar graphs
*b. Ordinal data* - stacked bar graph
*c. Discrete data* - bar graphs, scatter plots
*d. Continuous data* - box plot, histograms
Angular Libraries : FontAwesome and the fa-icon problem
Tags: angular, typescript
Published: 2020-06-13 15:23:36

In this series we have discussed importing existing components into our new Angular Library.  

Compiler errors are going to happen only because the AOT compiler is not the same as the JIT compiler. Many of us working in Dev. environments only use the JIT compiler.

**FontAwesome Module**

But one particular compile error pops up repeatedly and seems to avoid any type of fix we try.

<p class='unpublished'>
 <a href="https://www.google.com/search?q=NG8001%3A+%27fa-icon%27+is+not+a+known+element">Error NG8001: 'fa-icon' is not a known element.
</a>
</p>

```
ERROR: projects/angular-library/src/lib/actionItems.component.html:3:7 - error NG8001: 'fa-icon' is not a known element:
1. If 'fa-icon' is an Angular component, then verify that it is part of this module.
2. If 'fa-icon' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
```
**Missing Dependencies**

In an attempt to use our new 'action-items' component from our new application directory, the compiler issued a correct NG8001, as shown below. The reason was we did not export that component in our public.api.ts file. Once we did that the compile worked!  

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/w9oujtr9ayug38ovy97n.png)

**Why So Many**
```
NG8001: 'fa-icon' is not a known element:
1. If 'fa-icon' is an Angular component, then verify that it is part of this module.
// Followed by
NG8002: Can't bind to 'icon' since it isn't a known property of 'fa-icon'.
1. If 'fa-icon' is an Angular component and it has 'icon' input, then verify that it is part of this module.

```
The compiler throws an exception for anything it cannot find. All error messages in this article are missing module imports. But because this is a library the install (npm i package) is done at the root layer which updates the outer package.json. Then the lib.module must be imported and then specified in the imports section of the Ngmodule. 

[A working example of this issue on GitHub](https://github.com/Javaman2/FontAwesomeAngularLibrary)

**Summary**

Remember, if you have a Test application which is attempting to use your library (during development at first) not having the proper exports in public.api.ts can cause unexpected failures.
Javascript map, filter and reduce explained
Tags: javascript, webdev, codenewbie
Published: 2020-06-13 16:59:24

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

Javascript has given us a lot of possibilities as a developer.

But sometimes we just need to make it more flexible for ourselves without writing bunch of codes, as we all know in ES6 javascript introduced a new concept on looping through an array which are Map, Filter and Reduce.

The Map, Filter, and  Reduce is used to filter through an array of elements and then return new arrays from that element, so in this article, we going to talk about the three new arrays methods that are attached to the Es6 JavaScript.

**1. Map**

The JavaScript map method is used to loop true an array and then return new arrays, although it is similar to the for loop method. 
The Map method can make your code simpler and readable in all aspect 
Check out the examples.

<pre><code>
   let incExp = [100, 200, -200, 300, -100]
   incExp.map(cur => console.log(cur)
   // returns each element in the array
</code></pre>

Note: if the map method is taking more than one line of code you must include the return statement.

For example. 
<pre><code>
   let incExp = [100, 200, -200, 300, -100]
   let sum;
   incExp.map(cur => {
          return sum+= cur
    }
   // returns each element in the array
</code></pre>

As you can see the map method is return a new array which there are two ways to do that, if you are to just return and element there is no need for writing the return statement in your code but in cases you will have to return index, element.

**2. Filter** 

The JavaScript filter method is used to loop through and array of item return a new value based on conditional thereby pushing the truthy value as a new array.

Lets look at the examples below.

<pre><code>
   let incExp = [100, 200, -200, 300, -100]
   incExp.filter(cur => console.log(cur > 1)
   // returns new arr with the element that are true
</code></pre>

As you can see it returns an array that is greater than 1 in the element given to it.

With this you can have lots of possibilities to write a better organized and readable code.

**Reduce**

The reduce method may return different types of value based on the parameter, first it takes the array as input and then return current element, and  total element.

Lets look at the examples below.

<pre><code>
   let incExp = [100, 200, -200, 300, -100]
   incExp.reduce((cur, total) => {
          return cur + total
    }
  // returns new arr with the element that are true
  // or 

    let incExp = [100, 200, -200, 300, -100]
   incExp.reduce((cur, total) => {
          return (cur + total) + 2;
    }

</code></pre>

So far we have talk about the three methods used in JavaScript to perform loops apart from other loop methods.

**Conclusion**

Weldon guys for following up and reading this articles 
There are tons of resources out there to teach you more on the these javascript method.

have a nice weekend.

Feel free to contact me if you need any help in the future.
Kudos!!
Hello World Phaser3!
Published: 2020-06-13 16:55:25

Just recreated the hello world tutorial + particle emitter for PhaserJS 3 on Codepen.io.  Last I touched the framework was in 2014.  Pretty nostalgic.

https://www.youtube.com/watch?v=5hEB0YxLjYI&feature=youtu.be

https://codepen.io/myrtleTree33/pen/wvMWWbj