teleren/devto huggingface dataset:
Need help integrating stripe in react; getting 404
Tags: react, stripe, 404, express
Published: 2019-01-28 04:21:23

---
title: Need help integrating stripe in react; getting 404
published: true
description: question about stripe on react
tags: #react #stripe #404 #express
---
I'm learning how to integrate Stripe into React & Express. I'm getting a 404 error. Also, when I try to console.log the req.body, nothing appears.

on payment button click Expecting "Purchase Complete", getting "Purchase Error" (below)


    async submit(ev) {
    ev.preventDefault();
    let { token } = await this.props.stripe.createToken();
    let response = await fetch("http://127.0.0.1:3000/api/charge", {
        method: "POST",
        headers: { "Content-Type": "text/plain" },
        body: token.id
    });

    if (response.ok) {
        console.log("Purchase Complete")
        this.setState({ complete: true })
    } else {
        console.log("Purchase Error")
        console.log(response)
    }
    }

router:

      router.post("/charge", async (req, res) => {

          console.log("req.body: ", req.body)

      try {
    let { status } = await stripe.charges.create({
      amount: 14,
      currency: "usd",
      description: "Purchase 1,000 followers",
      source: req.body
    });
    res.json({ status });
     } catch (err) {
       res.status(500).end();
     }
    });

Expecting to see req.body in console (from above code) but getting nothing. I've tried adding forms of bodyParser in server/src/index.js (below).

    app.use(bodyParser.text());
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({ extended: true }));
Database models and ERDs for Newbs Part: 3
Tags: beginners, database, sql
Published: 2019-01-28 04:16:19

---
title: Database models and ERDs for Newbs Part: 3
published: true
description: A digest-size breakdown of database modeling and entity-relationship models/diagrams.
tags: beginner, databases, SQL
---

## Recap from Last Time

Last time, we looked at a mock school registry with 3 tables: students, professors, and the join table of course registrations. I also promised to do some coding and that's what I intend. So here we go!

Remember This?
![has many through](https://i.ibb.co/N2dmN9n/has-many-through.jpg)

So what's wrong with this?
- course registrations only join students to professors (no courses to be seen)
- we need to record the classes/courses themselves w/ their own id numbers, names, etc 
- you need to be able to generate a student roster for individual classes

## Fixing the Problem

So here's what I came up with.
![updated has many through](https://i.ibb.co/BgLRdfM/many-to-many-2.jpg)

So we revised the models and their relationships in the following ways:
- made it so that a single course **belongs-to** a professor
- course registrations **belongs-to** both courses and students
- a course registrations entity **has** a professor through its course it **belongs-to**

Next, we'll see what a row of the course registrations table looks like now as opposed to before

Before:

|id|professor_id| student_id| 
|-------|-------|------|
|123|37494|746384684|

After:

|id|course_id| student_id| 
|-------|-------|------|
|123|7893726|746384684|


Why all the id numbers?
_High-cardinality_ is the ideal for SQL databases and this solution promotes high-cardinality more than the previous version. It's more reasonable to store references to the model than to clone the database models for a few reasons. Especially since when you have to update or delete a model. If you made clones instead of used references, you would have to repeat the same operations in multiple places and that would lead to mistakes so references are used instead.

Introducing Foreign Keys
The course_id and student_id are the references used in my example and they have a specific name, **foreign keys**. Foreign keys don't need to be named after anything in particular but it should make sense so when I create a row in my course registrations table, I name the column for the course model's id number course_id and follow the same for student_id.

So, that's it for now but tune it next time when I finally throw some code up to show how I would set up these tables.
Nice Video: First Day of Emacs
Tags: emacs
Published: 2019-01-27 22:23:01

---
title: Nice Video: First Day of Emacs
published: true
description: 
tags: emacs
---

First words, the teacher is great. But he used Chinese, if you don't konw Chinese and you are patient you can watch and guess his idea. The slides are English.

I knew a little Emacs. After this video I feel more confidence. The teacher taught from basics. 

The Org mode and company package are useful. Org mode can fold topics easily.

![](https://thepracticaldev.s3.amazonaws.com/i/37lll4xp5q08i7hiff3p.png)

# Why Emacs

I use MS code and a little vim now. I still want to try emacs because I think it's fun and can practice some lisp.

If you prefer menu you can try spacemacs which is more friendly for new learners. It simply uses space key to give you a menu.

{% youtube 0hpVuoyO8_o %}
Day 27: Swift macOS password manager for people who hate the cloud
Tags: macos, swift, passwordmanager, cloud
Published: 2019-01-27 21:26:20

---
title: Day 27: Swift macOS password manager for people who hate the cloud
published: true
description: Follow along as I make a 100% cloudless and 100% swift password manager for macOS. That's 200% raw password managing power.
tags: macos, swift, password manager, cloud
series: Making a swift MacOS password manager for people who hate the cloud
cover_image: https://thepracticaldev.s3.amazonaws.com/i/q6r73zbfbm3mpfs98bu5.jpg
---

[<- For Day 26 go here](https://dev.to/swlkr/day-26-swift-macos-password-manager-for-people-who-hate-the-cloud-468e)

📅 01/27/2019
🚀 [3 days until launch](https://www.producthunt.com/upcoming/all-your-passwords)
🔥 26 day streak
💰 $4.99 price (it went up again)
🤑 $0 revenue
📈 0 customers
⌚️ 39.5 hours spent
😭 1 Rewrite
💻 113 files changed, 249828 insertions(+), 561 deletions(-)
🏁 Today's goal: **Attempt to set up a landing page, fix view controller memory problems, this ain't electron for a reason**

**10:48 AM**
Bought super fancy coffee beans from the hippest coffee shop I know of. Tried to use my cool pour over equipment. Didn't grind the beans enough so the coffee came out more like dirty water than coffee. 🤦‍♂️

**10:54 AM**
Landing page time. Went over to [cruip](https://cruip.com) saw the switch template, thought it was cool. Downloaded. It's too much. I talked about [twizzy](https://twizzy.app) before but I feel like now that dark mode is built into the OS, and it's not that new anymore, it's probably fine to just not worry about showcasing it on the landing page.

**11:04 AM**
I just had an amazing idea for the landing page. So this is a remix of twizzy, but instead of focusing on a light/dark toggle, clouds will appear (a maximum amount probably) and you can click to blow them away, every hundred clouds you blow away, you get a discount, up to 500 clouds for 50% off, which brings the price down to a very reasonable $2.50. This is probably the coolest landing page I will have ever made. I hope I can make it look decent in a reasonable amount of time.

**12:44 PM**
Classic. Got distracted by perf improvements in the app. Barely worked on the lander, here's what I have on the lander so far

![](https://thepracticaldev.s3.amazonaws.com/i/3bxvksolp99q8a870k46.gif)

**2:04 PM**
Fixed a ton of weird bugs related to favicons, there are still more, but it's good enough for now. Also made some progress on the lander

![](https://thepracticaldev.s3.amazonaws.com/i/pi8jerzuerq646mbs6tf.gif)

**2:24 PM**
Going to log off for a while, eat some food. Think about why I decided to make this lander so hard for myself.
A prediction on the future of WordPress themes in post-Gutenberg times
Tags: wordpress, classicpress, gutenberg, predictions
Published: 2019-01-27 19:29:08

---
title: A prediction on the future of WordPress themes in post-Gutenberg times
published: true
description: 
tags: WordPress,ClassicPress,Gutenberg,predictions
---

A couple of weeks ago I started thinking about the phase 2 and 3 of the Gutenberg overhaul to the WordPress back-end and as a designer and a theme developer for my clients I became really skeptical about it. 

There is no reason to argue if the Block Editor is good or bad. It is here. And here are my thoughts (or predictions) on [the future of WordPress themes when the Gutenberg implementation will reach 100%](https://chiotis.me/on-the-future-of-themes-and-plugins-in-post-gutenberg-years.html)

_In general my thoughts on the whole WordPress transition are negative, that is why I have started supporting and using ClassicPress for live client websites. But in this post, I kept my opinion on the Block Editor neutral._
Repeatable & Maintainable Development Environments 
Tags: ansible, vagrant, devops, repeatable
Published: 2019-01-27 19:01:33

---
title: Repeatable & Maintainable Development Environments 
published: true
description: An article I recently published on creating repeatable, maintainable dev environments
tags: ansible, vagrant, devops, repeatable
---

As my first contribution here, just thought I'd share a recent article I wrote that was published in Hacker Noon:

https://hackernoon.com/repeatable-maintainable-development-environments-45f4589c824

Let me know your thoughts :)
Git Hooks in action
Tags: bash, git, github, go
Published: 2019-01-27 18:02:30

---
title: Git Hooks in action
published: true
description: A guide to writing a git hook in bash.
tags: bash, git, github, go
---

Hi all,

I wanted to share with you an article about writing git hooks I wrote on medium some time ago.

Here's the link --> [https://medium.com/@radlinskii/writing-the-pre-commit-git-hook-for-go-files](https://medium.com/@radlinskii/writing-the-pre-commit-git-hook-for-go-files-810f8d5f1c6f)
🌎 World Record Git
Tags: worldrecordegg, git
Published: 2019-01-27 18:00:12

---
title: 🌎 World Record Git
published: true
description: World record egg, for developers. 
tags: World Record Egg, git, 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/76cgs3haqa152c3llh3j.jpg
---
TL;DR 
{% github world-record-git/world-record-git %}
Unless you've been living under a rock, you probably heard about the instagram egg phenom. An account which was puerly created with the intention of dethroning Kylie Jenner's current position of the most liked post on Instagram. 

{% instagram BsOGulcndj- %}

Well, as the title suggests. We are gonna do something similar but on github to become the most starred repo and beat Bootstrap to the kick (all horrible puns intended). 

# Why?
Why not? Bootstrap still uses jquery in 2019 🤦. 

P.S Don't forget to read the READ.ME!
Should code be like poetry?
Tags: discuss
Published: 2019-01-27 17:39:31

---
title: Should code be like poetry?
published: true
tags: discuss
---

> "Treat your code like poetry and take it to the edge of the bare minimum." - ILYO

I strongly object to this idea in this week's show. Poetry is intentionally ambiguous, allowing the reader to form their own impression, let their own emotions guide what they see.  Code should be clear and equivalent. I do kind of agree with minimalism though. 

Listen to hear all of our arguments. Plus, status updates on my food blog programming and Stephane's quest to get a totally anonymous website.

{% podcast https://dev.to/edaqa-and-stephane-podcast/17-poetry-v-good-enough %}


Do you think code is like poetry? Would you like to challenge me, a weaver of verse,  with a poetic debate on the topic? :)
What are your favourite communities?
Tags: discuss, community
Published: 2019-01-27 17:31:56

---
title: What are your favourite communities?
published: true
description: I'd love to know who you follow and why.
tags: discuss, community
---

By posting and interacting with others on DEV for the past month I have learned a lot. Not just about code or productivity but about how awesome community can be. Everyone on DEV helps others out while staying polite which is really cool. In pretty much every community I'm just a lurker who passes likes every once in a while. This is the first community that made me feel I could post things myself and be part of a conversation. 

I realised a lot of DEVs have a twitter account. In the back of my mind I knew there are some developers on twitter and followed a few. After starting out with devs on here and exploring from there I fell into a rabbit hole of a tons of communities and people that use twitter, email lists, personal blogs and sites like dev to share knowledge. I feel like I've just scratched the surface of interesting people and communities to check out.

**What are your favourite communities and/or devs and why? I'd love to discover even more awesomeness** 😁


For anyone who is looking for a nice chat with other beginners: This discuss post resulted in a telegram group 🎉. Join in [t.me/randomdevs](t.me/randomdevs) !
Adding the web-data user to another group with puppet
Tags: puppet, virtualresource
Published: 2019-01-27 17:12:35

---
title: Adding the web-data user to another group with puppet
published: true
description: virtual resources and exported resources quick info for future reference 
tags: puppet, virtual-resource
cover_image: https://thepracticaldev.s3.amazonaws.com/i/idfyegkf9boktkzc32dx.jpg
---
this blog post is mainly a note to myself for future reference.

`profile::nginx`
```
  ...
  # the user is not created here. lets say the user is prepared here.
  @user { 'www-data':
    # groups     => ['somegroup'],
    gid         => '33',
    membership  => minimum,
  }
  ...
```

`profile::other_profile_which_needs_to_add_the_group`
```
  # here the user is created aka realized but with the extra group `mynewgroup` added.
  User <| title == 'www-data' |> { groups +> "mynewgroup" }
```



`@@` means the resource is exported. also see https://puppet.com/docs/puppet/5.3/lang_exported.html
```
@@user { 'www-data':
    ...
}
```

`@` means the resource is virtual. also see https://puppet.com/docs/puppet/5.3/lang_virtual.html
```
@user { 'www-data':
    ...
}
```

further reading:

- https://serverfault.com/questions/416254/adding-an-existing-user-to-a-group-with-puppet
- https://tickets.puppetlabs.com/browse/PUP-7541
- https://blog.scottlowe.org/2013/02/08/modifying-virtual-user-resources-in-puppet/
- https://ttboj.wordpress.com/2013/05/14/overriding-attributes-of-collected-exported-resources/
- https://serverfault.com/questions/707261/can-i-accumulate-an-array-of-values-in-puppet-from-a-collector


- cover image by Gaby Stein aka steinchen https://pixabay.com/en/stage-boards-wood-theater-233085/
Final Year Research Survey
Tags: opensource, research
Published: 2019-01-27 17:03:58

I'm shehani an undergraduate at Informatics Institute of technology I would appreciate your feedback to gather data for my Final Year Research Project.
I will make sure to that all information provided will be ensured to be held confidential and will not be disclosed at any circumstance.

https://bit.ly/2sRWtIM

Thank you for your valuable time!

kind regards,
Shehani
The right way to build a geolocation app
Tags: geolocationapp
Published: 2019-01-27 16:03:46

---
title: The right way to build a geolocation app
published: true
description: From looking up directions on Google Maps to hailing a taxi via Uber, geolocation apps have become a backbone for many thriving businesses. But can you develop an app that would enjoy similar success?
tags: geolocation app
cover_image: https://www.mindk.com/blog/wp-content/uploads/2018/12/Juvo.jpeg
canonical_url: https://www.mindk.com/blog/build-a-geolocation-app/
---

From looking up directions on Google Maps to hailing a taxi via Uber, geolocation apps have become a backbone for many thriving businesses. But can you develop an app that would enjoy similar success?

Foursquare has built a loyal audience of 60 million users by letting them check into restaurants. Uber reached a market worth of $72 billion by connecting passengers and taxi drivers. Starbucks has increased sales by adding local notifications to its app. With more and more mobile app users every year, these companies will continue to grow their profit.

In this article, I’ll share the insights we’ve gained when developing a location-based app, Juvo. It’s a native iOS and Android app for local communities of Norway.

[Continue reading...](https://www.mindk.com/blog/build-a-geolocation-app/)
How software ideas are born: step-by-step guide on generating one for 2019
Tags: softwaredevelopment, webdev, softwareideas
Published: 2019-01-27 16:01:50

---
title: How software ideas are born: step-by-step guide on generating one for 2019
published: true
description: Software and web development has provided us with solutions in almost every sphere of our lives. It would seem that everything has already been invented. But this is definitely not true. 
tags: softwaredevelopment, webdevelopment, softwareideas
cover_image: https://www.mindk.com/blog/wp-content/uploads/2018/12/action-plan-brainstorming-complex-212286-min-1-720x460.jpg
canonical_url: https://www.mindk.com/blog/how-software-ideas-are-born/
---

Software and web development has provided us with solutions in almost every sphere of our lives. It would seem that everything has already been invented. But this is definitely not true. 

We are going to provide you with a step-by-step guide that will help you generate an idea to enter the software market in 2019! Helping businesses build software products for over 9 years, we know where the hardest part is. Well, as you are reading this article, you also know it!

The hardest part is to start. Since every tech startup begins with a bright software idea, it turns out to be a foundational step towards your future success. That is why we have prepared this guide.

All steps are actionable and can be executed here and now. By the end of the article, you will have enough knowledge to generate software ideas or improve the ones you already have.


[Continue reading...](https://www.mindk.com/blog/how-software-ideas-are-born/)
Market validation or how to validate the project idea before going ‘All in’
Tags: softwaredevelopment, webdev, marketvalidation
Published: 2019-01-27 15:59:43

---
title: Market validation or how to validate the project idea before going ‘All in’
published: true
description: Most business ideas sound good and look fresh in our heads, while a good many of them die after falling into customer hands. Since entering the market with a new product is almost walking the edge, market validation under real-life conditions is crucial before launching.
tags: softwaredevelopment, webdevelopment, marketvalidation
cover_image: https://www.mindk.com/blog/wp-content/uploads/2018/12/rawpixel-296612-unsplash-720x460.jpg
canonical_url: https://www.mindk.com/blog/market-validation/
---

Most business ideas sound good and look fresh in our heads, while a good many of them die after falling into customer hands. Since entering the market with a new product is almost walking the edge, market validation under real-life conditions is crucial before launching.

Although risk has become a synonym to entrepreneurship, accepting the risk to spend time, money and energy creating a product that people don’t need is a path to failure.

In this article, we will overview the best practices for validating business ideas without spending a fortune and as a result, building a better solution.


[Continue reading...](https://www.mindk.com/blog/market-validation/)
React vs Vue - what is the best choice for 2019?
Tags: frontenddevelopment, webdev
Published: 2019-01-27 15:55:45

---
title: React vs Vue - what is the best choice for 2019?
published: true
description: Front-end development can be confusing with new JavaScript libraries sprouting like mushrooms after a summer rain. Each time you start a new project, you face a tough choice - stick with your battle-tested stack or experiment with cutting-edge tech?
tags: frontend development, webdevelopment
cover_image: https://www.mindk.com/blog/wp-content/uploads/2018/12/photo-1523257106485-baaab4b06c22-min-720x460.jpg
canonical_url: https://www.mindk.com/blog/react-vs-vue/
---

Front-end development can be confusing with new JavaScript libraries sprouting like mushrooms after a summer rain. Each time you start a new project, you face a tough choice - stick with your battle-tested stack or experiment with cutting-edge tech? 

To make things easier, our R&D team prepared a detailed comparison between Vue and React, the 3rd and 4th most starred repositories on Github as of December 2018. So make yourself comfortable and read the whole guide or jump straight to the part you’re most interested in.


[Continue reading...](https://www.mindk.com/blog/react-vs-vue/)
Why does PostgreSQL have pg_locks
Tags: discuss, database
Published: 2019-01-27 12:24:26

---
title: Why does PostgreSQL have pg_locks
published: true
description: Why is it PostgreSQL maintain a non multithreaded db
tags: Discuss, Database
---
![Debugging is frustating](https://thepracticaldev.s3.amazonaws.com/i/i93sf8tvm3njhbnfmoea.gif)
Earlier this week I had an interview at [Andela](https://andela.com/), they offered us a challenge to build an API using postgreSQL and Flask. In my 3 years working as a software developer I had never interacted with PostgreSQL. 

Fast forward I started experiencing weird bugs in my API. Postgres would freeze from time to time and this was because postgres would lock my db requests. I still don't understand this, why? What is the purpose of pg_locks?
BxJS Weekly Episode 47 - javascript news podcast
Tags: javascript, node, podcast, news
Published: 2019-01-27 12:01:22

---
title: BxJS Weekly Episode 47 - javascript news podcast
published: true
description: Listen to the best javascript news of the week in a podcast form
tags: javascript, node, podcast, news
---

Hey dev.to community!

BxJS Weekly Episode 47 is now out! 🚀
Listen to the best javascript news of the week in a podcast form right here.
You can find all the mentioned links [here on github](https://github.com/BuildingXwithJS/bxjs-weekly/blob/master/links/19-04-Episode-47.md).


You can also watch or listen to this episode on:
- [YouTube](https://youtu.be/Laq3wkbWa9o)
- [Castbox](https://castbox.fm/episode/BxJS-Weekly-Ep.-47-Jan-26%2C-2019-(javascript-news-podcast)-id1378315-id124740622?country=us)
- [iTunes](https://itunes.apple.com/de/podcast/bxjs-weekly/id1441956525)

Any feedback is appreciated 😁

Additional stuff:
- [Twitch channel](https://www.twitch.tv/yamalight)
- [Discord server](https://discord.gg/hnKCXqQ)
- [BxJS Weekly github repo](https://github.com/BuildingXwithJS/bxjs-weekly)

Social media links:
- [Twitter](http://twitter.com/yamalight)
- [Medium](https://medium.com/@yamalight)
- [Github](http://github.com/yamalight)

If you enjoy my content, please consider [supporting me](https://codezen.net/support.html) 😉
npm install .staging issue
Tags: npminstall, stagingissue, npminstallfailed, npminnstallproblem
Published: 2019-01-27 09:40:03

---
title: npm install .staging issue
published: true
description: solution for npm install .staging problem
tags: npm install,.staging issue,npm install failed, npm innstall problem
---

got it solved by removing `package-lock.json’ file, .npm file , node_modules file and cleaning npm cache
Required steps:

npm install npm@latest -g
npm cache clean — force
rm -rf ~/.npm
rm -rf node_modules
rm -f package-lock.json

In npm install .staging issue, When you run npm install, it creates the node_modules folder but all the modules go into a subfolder called .staging