teleren/devto huggingface dataset:
Adding SSL when using Heroku and Namecheap
Tags: security, javascript, node, heroku
Published: 2020-06-04 09:57:44

I have fought a few hours to try to get SSL working when using a Heroku Dyno together with a domain bought on Namecheap. I didn’t want to use any Namecheap paid SSL solution, because Heroku offers SSL for free.

My goal is simple: Every user should end up on https://example.com regardless whether they visit the website with _https/http_ or _www/non-www_.

To make it more clear:

* http://example.com => https://example.com
* http://www.example.com => https://example.com
* https://www.example.com => https://example.com
* https://example.com => https://example.com

---

In the beginning I wanted to achieve everything using the Namecheap DNS settings. And even though [Namecheap introduced ALIAS records](https://www.namecheap.com/blog/alias-next-generation-host-record/) last July and me reading a lot of articles on that topic I could not get it to work. Sometimes the redirects from _www_ to _non-www_ did not work, sometimes the _https_ website did not respond. The issue is, that Namecheap does the DNS resolution, but it does not have the SSL certificates (Heroku has them).

The (in my eyes not most elegant solution, but it works flawlessly) is to use application-level redirects. That means in your application you issue an redirect to the _https_ URL when an incoming request was using _http_.

Heroku (and most other platforms) deal with the whole SSL problem (they do the SSL termination), so your application only receives _http_ requests. In order for you to know whether a request was originally using _http_ or _https_ you have to look into the x-forwarded-proto header ([Heroku documenation on that](https://devcenter.heroku.com/articles/http-routing#heroku-headers)).

Using the header value to redirect to _https_ when you have encountered an _http_ request (I am using [fastify](https://www.fastify.io/) and Node.js here):

```js
import fast from 'fastify'
const fastify = fast({ logger: true })

fastify.addHook('onRequest', async (request, reply) => {
    if (request.headers['x-forwarded-proto']) {
        if (request.headers['x-forwarded-proto'] === 'http') {
            return reply.redirect(`https://${request.headers.host}${request.raw.url}`)
        }
    }
})

fastify.listen(port, '0.0.0.0')
```

In addition to the implementation at the application level, you have to setup your two Heroku domains: One for the root domain and one for the _www_ subdomain:



![Heroku Settings](https://dev-to-uploads.s3.amazonaws.com/i/ii9j33ia0xbbj86o6ltr.png)

And now for the last part, the Namecheap DNS settings! These are the only two settings I have for that domain:


![Namecheap Settings](https://dev-to-uploads.s3.amazonaws.com/i/91dt3v1i6hxf8j2azrg1.png)

I hope this helps some of you out there! Stay safe :)
How to install SVN extension for PHP 7
Tags: php, subversion, devops
Published: 2020-06-04 09:49:49

SVN extension for PHP allows PHP scripts to communicate with SVN repositories without using direct command line calls to the SVN executable. The extension is not available with standard PHP installation. There are two ways that the extnesion can be installed. 

### 1. From PECL

As the extension is part of PECL, it can be installed like any other PECL extension. Even though the subversion executable is not required for the installation of the extension, subversion headers are required for compiling it. So it is better to install subversion, subversion-devel, and neon packages first. In a CentOS-based system, the installation is as follows:

```bash
# yum install subversion subversion-devel neon neon-devel
# pecl install svn
# echo "extension=svn.so" > /etc/php.ini
# service httpd restart
```

### 2. From Source

The extension can be compiled and installed from the source. This allows specifying PHP configurations and versions for the SVN extension. In the following section, we are discussing how to install SVN extension for PHP 7+ versions.

First, download and extract the extension from the PECL repository. Type the following commands in your terminal.

```bash
# wget https://pecl.php.net/get/svn-2.0.3.tgz
```
The only version of the SVN extension which supports PHP versions higher than 7 is the 2.0.3 . It is still in the beta phase and is not recommended to use in a production environment.

Extract the tar file.

```bash
# tar -xvzf svn-2.0.3.tgz
```
Navigate to the extracted folder

```bash
# cd svn-2.0.3
```

Now we can compile the extension from here.

First, prepare the build environment using phpize . Run the following command from your terminal.

```bash
# /your/path/to/phpize
```
Compile and install

```bash
# ./configure
# make
# make install
```
Finally, the extension needs to be added to php.ini

```bash
# echo "extension=svn.so" >> /etc/php.ini
```
Now check the phpinfo(); or use php -i|grep 'SVN' to see whether the extension is installed.

During the compilation process, if you get an error like

```bash
configure: error: Cannot find php-config. Please use --with-php-config=PATH
```
Use :

```bash
# ./configure --with-php-config=<your path to php-config file>
```
Learning and facing challenges as a webdev
Tags: webdev, career, beginners, codenewbie
Published: 2020-06-04 09:45:07

Some of you know I’ve been creating content for developers in YT :video_camera: .

I believe my latest one provides great tips for all of us, especially junior and mid level devs.

**More precisely:**
I had a wonderful opportunity to talk with some established Youtubers, who create development-related content (Web Dev Simplified, Program With Erik, James Q Quick).

We discuss topics like:
* how they got into web development
* how do they face challenges
* how to stop comparing yourself to others
* how to make learning fun

An entertaining and educational listening to both beginner and more experienced devs.

{%youtube 4DHw3ILUIaw %}

Timestamps:
00:00 - Beginning
00:50 - Introduction round
02:35 - Why do you have Youtube channels?  Why do you want to help others?
09:05 - How and why did you start learning web development?
17:35 - Your most challenging projects and what you've learned from them?
23:45 - Dealing with bugs and failures, both technically and psychologically
30:25 - Imposter syndrome and how to deal with it
41:30 - What is a habit that makes you a better developer?
46:05 - Summary

Guests
🤩  Kyle from Web Dev Simplified: https://www.youtube.com/channel/UCFbNIlppjAuEX4znoulh0Cw
🤩  James from James Q Quick: https://www.youtube.com/channel/UC-T8W79DN6PBnzomelvqJYw
🤩  Erik from Program With Erik: https://www.youtube.com/channel/UCshZ3rdoCLjDYuTR_RBubzw

**DeveloperHabits**
📷 Youtube: [developerHabits](https://www.youtube.com/channel/UCJLZwePkNHps5Bv7VwISyTA)
👉 Twitter: [https://twitter.com/developerHabits](https://twitter.com/developerHabits)
👉 IG: [https://www.instagram.com/developerhabits](https://www.instagram.com/developerhabits)

Oh and...! If you are interested in coding, growth mindset and are willing to share your experiences, ideas, then please do PM me in Twitter :)!
The easiest way to update Jenkins
Tags: devops, jenkins, linux, update
Published: 2020-07-16 12:01:11

---
title: The easiest way to update Jenkins
published: true
date: 2020-06-04 09:18:11 UTC
tags: devops, jenkins, linux, update
canonical_url: https://boobo94.xyz/devops/update-jenkins/
---

Hi dears, I hope you’re happy to come here, because I’ll show you the easiest way to update Jenkins. Not all of us are Devops daily, but sometimes we face this situation so show the next two commands and have fun:

```
$ sudo apt-get update
$ sudo apt-get upgrade 
```

I hope this article was helpful. If you consider it useful, please give it a share.

The post [The easiest way to update Jenkins](https://boobo94.xyz/devops/update-jenkins/) appeared first on [boobo94](https://boobo94.xyz).
asyncdispatch is now on npm packages!
Tags: react, javascript, redux
Published: 2020-06-04 08:55:59

# async-dispatch middleware

[![npm](https://img.shields.io/npm/v/async-dispatch.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/async-dispatch)

> async-dispatch is a middleware can be added with no time to privilage the asynchronous into your store

For more informatiom about the future of redux-logger, check out the [discussion here](https://github.com/IbrahimShamma99/asynDispatch-middleware/issues).

## Table of contents

- [async-dispatch middleware](#async-dispatch-middleware)
  - [Table of contents](#table-of-contents)
  - [Install](#install)
  - [Usage](#usage)
  - [To Do](#to-do)
  - [License](#license)

## Install

`npm i --save async-dispatch`

## Usage

```javascript
import asyncDispatchMiddleware from "async-dispatch";
import { createStore } from "redux";
import { applyMiddleware } from "redux";

const store = createStore(
  rootReducer,
  applyMiddleware(asyncDispatchMiddleware)
);
// Note passing middleware as the third argument requires redux@>=3.1.0
```

Then applying this middleware is simple as

```js
const LoginReducer = (state = intialState, action) => {
      login(action.userData).then((data) => {
        if (data.error) {
          action.asyncDispatch({
            type: actionTypes.ERROR,
            message: data.error,
          });
        } else {
          action.asyncDispatch({
            type: actionTypes.SUCCESS,
            user: data,
            message: "Logged successfully",
          });
        }
      });
      return { ...state };
})

```

## To Do

- [ ] Adding types

## License

MIT
Scaffold new tables and keep the existed ones?
Tags: efcore
Published: 2020-06-04 08:37:44



I wish there were a built-in way to add entities and update an existing context, but there doesn't seem to be. I overcame this by using the --context option in the package manager console and just gave it a temporary name, e.g. --context TempContext. This worked and generated the new table and the temp context. Then I just copied the public virtual DbSet<NewEntityType> NewEntityType { get; set; } property and the modelBuilder.Entity<NewEntityType>(entity => block from the OnModelCreating method in the temp context to my existing one. After that, I deleted the temp context. It's pretty straightforward.
Understanding HTTP Request/Response Cycle
Tags: beginners, ruby, html, todayilearned
Published: 2020-06-04 08:28:26

There exist what may be considered as 3 main elements of a HTTP request:

📶 Request line
📶 Headers
📶 Body

<img src="https://images.pexels.com/photos/3541555/pexels-photo-3541555.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="http request/response cycle"/>

The request line is made up of a HTTP method, the URI( path of the resource), and the HTTP version.

The headers are made up of metadata and components of information about the request being sent such as cookies and authentication tokens. 

The body contains information that is being sent to the server ("payload"). Examples of information sent to the server may include form data.
Install Nginx on Linux with ssl certificate
Tags: devops, nginx, ssl, linux
Published: 2020-07-16 12:00:40

---
title: Install Nginx on Linux with ssl certificate
published: true
date: 2020-06-04 08:26:34 UTC
tags: devops, nginx, ssl, linux
canonical_url: https://boobo94.xyz/devops/install-nginx-on-linux-with-ssl-certificate/
---

Because all you need is already in place on Digital Ocean, I’ll just attach you some useful materials:

[https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-centos-7](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-centos-7)

[https://www.digitalocean.com/community/tutorials/how-to-set-up-let-s-encrypt-with-nginx-server-blocks-on-ubuntu-16-04](https://www.digitalocean.com/community/tutorials/how-to-set-up-let-s-encrypt-with-nginx-server-blocks-on-ubuntu-16-04)

[https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-centos-7](https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-centos-7)

[https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04)

The post [Install Nginx on Linux with ssl certificate](https://boobo94.xyz/devops/install-nginx-on-linux-with-ssl-certificate/) appeared first on [boobo94](https://boobo94.xyz).
Request/Response Cycle 📶
Tags: beginners, todayilearned, ruby, architecture
Published: 2020-06-04 08:14:42



A database allows for one to create applications that save information. The request/response cycle is a process which makes it possible for a database to interact with an application. 

<img src="https://images.pexels.com/photos/290386/pexels-photo-290386.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940" alt="request/response cycle">

The request/response cycle with a database may involve the following events:

1️⃣ A request for a URL is sent from the browser to the router

2️⃣ Router maps the URL to a controller action to handle the request

3️⃣ Upon receiving the request, the controller action asks the model to fetch the data from the database.

4️⃣ After receiving the data, the model returns the data to the controller action

5️⃣ Upon receipt of the data from the model, the controller passes the data to the view

6️⃣ The view uses the data received as it renders the page as HTML

7️⃣ Controller sends the HTML back to the browser.
How to Post data json use apikey
Tags: axios
Published: 2020-06-04 08:09:00

I will share to you about my experience although not too much 
but i hope this is important for you as javascript developer

const axios = require('axios');
const express = require('express');

const app = express();

var postData = {
    'this':'this data will you post'
}

let axiosConfig = {
    headers: {
        'Authorization': 'Bearer your-apikey',
        'Response-Format': 'JSON',
        'Content-Type': 'application/json',
        "Access-Control-Allow-Origin": "*",
    }
};

axios.post('https://link apikey', postData, axiosConfig)
    .then((res) => {
        console.log(`RESPONSE RECEIVED: ${postData}`, res);
    })
    .catch((err) => {
        console.log("AXIOS ERROR: ", err);
    })

axios.get('https://link apikey')
    .then(response => {
        console.log(response.data.created_at);
    });

    try {
        
    } catch (error) {
        
    }

axios.all([
    axios.get('https://link apikey'),
    axios.get('https://link apikey')
])
    .then(axios.spread((user1, user2) => {
        console.log('Date created: ', user1.data.created_at);
        console.log('Date created: ', user2.data.created_at);
    }));
Handle API driven content links in Nuxt js
Tags: javascript, vue, webde, tutorial
Published: 2020-06-04 08:04:51

# The problem
Internal links in Nuxt are are handled via the `nuxt-link` component (`<nuxt-link>`, `<n-link>`, `<NuxtLink>`, `<NLink>`). Not only does the `nuxt-link` component provide navigation between page components it also enhances performance with smart prefetching. However when pulling page content from an API, we are unable to wrap our links with the `nuxt-link` component.

# Exploring the issue
I spent some time exploring the issue, searching for how I could instruct Nuxt to re-evaluate internal links but to no avail. Eventually I settled on intercepting my API output, adding an `onclick` to all internal links that would prevent the default link behaviour and instead use Nuxt’s router push function:

```
<a 
    href="/some/internal/link
    onclick="event.preventDefault(); window.$nuxt._router.push(this.getAttribute(\'href\'))"
>
    Link text
</a>
```

This did work but it didn’t feel right, so I decided to take to Twitter to ask if anyone else had experience in solving this issue:

{% twitter 1268272837523124228 %}

Not long later I had a reply from a developer called [Alex Lichter](https://twitter.com/TheAlexLichter), a member of the core Nuxt JS team who pointed me in the direction of [Nuxt Interpolation](https://github.com/daliborgogic/nuxt-interpolation):

{% twitter 1268282548964274177 %}

# What is Nuxt interpolation?
Nuxt interpolation is a module by [Dalibor Gogic](https://twitter.com/daliborgogic_) for binding links to catch the click event, In catching the click event, Nuxt Interpolation with determine whether the link is internal or external. If the link is internal, the link will be handled by Nuxt’s router push method. Nuxt Interpolation is will also determine any links where the target is `_blank` and add `rel="noopener”` for improved security.

# How to use Nuxt interpolation?
To use Nuxt Interpolation in your Nuxt App, first you’ll need to open your terminal and change directory to the root of your Nuxt App, upon doing so, install Nuxt Interpolation via NPM:

```
npm i nuxt-interpolation
```

Once the dependancy is installed, you’ll need to open your `nuxt.config.js` file and add `nuxt-interpolation` to the modules array:

```
{
  modules: [
    ['nuxt-interpolation']
  ]
}
```

Once you’ve added `nuxt-interpolation` to your modules array, you’ll be able to the directive in your app. To use `nuxt-interpolation` simply add the `v-interpolation` directive to any element you’d like `nuxt-interpolation` to take effect:

```
<div v-interpolation v-html="content" />
```

# Conclusion
Nuxt interpolation is a fantastic module for handling API driven content links, it’s very simple to install and use and I’ll be using it not just this current project but in future projects as well, I’m sure.
If you’ve found this article useful, please give it a clap and follow me on [Medium](https://medium.com/@wearethreebears), Dev.to and/ or [Twitter](https://twitter.com/wearethreebears).
AI And Data Science Is Useful To Combat Coronavirus- Is That True?
Tags: ai, datascience
Published: 2020-06-04 07:45:00

One of the most threatening viruses Covid-19 is spread across the world and it affects at least 160 countries within a three-month span. It has emerged as one of the biggest challenges to face the 21st-century world. But thanks to the AI technology that is helping to save people through various ways. AI technology can help to educate, warn, and empower people to become more knowledgeable about the intensity of corona spread and significantly reduce the impact.

Apart from AI, you have a lot of technologies like cloud, mobile, analytics, robotics, Machine learning, and also high-speed internet to effectively deal with all kinds of pandemic situations. But AI plays a vital role in mitigating the COVID-19 pandemic situation. Developments in AI apps such as speech recognition, natural language processing, data analytics, machine learning, deep learning, chatbots, and facial recognition are not only used for diagnosis but also for contact tracing and vaccine development. Let us see how it helps.

**Use Of AI And Data Science To Combat Coronavirus-**

*1. AI To Track And Forecast Outbreaks-*
If we can track the virus, it will be easier to fight against it. With the analysis of news reports, social media platforms and government documents, AI can learn and detect an outbreak. The canadian startup BlueDot tracks the infectious disease risks by using AI, actually it’s AI noticed and warned about the threat several days before the WHO issued their public warnings.

*2. Diagnosis Through AI-*
Immediate diagnosis is always a winning measure towards the fight of any disease. And hence immediate diagnosis that response measures such as quarantine can be implemented to further limit the spread of infection. Because of the huge number of cases, there is a barrier to rapid diagnosis. AI has improved this diagnostic time through technology such as that developed by LinkingMed, a Beijing-based oncology data platform and medical data analysis company. Pneumonia is a starting complication of COVID-19 infection that can now easily be diagnosed by the analysis of a CT scan within 60 seconds with 92% accuracy and a recall rate of 97% on test data sets. This is possible due to the AI model that analyzed CT images and quantified in terms of number, volume and proportion.

Know more at- [https://solaceinfotech.com/blog/ai-and-data-science-is-useful-to-combat-coronavirus-is-that-true/]
World need great ideas and ideas need MindMillers to make it successful
Published: 2020-06-04 07:37:06

[https://mindmillers.com]MindMillers.com is an idea acceleration platform that uses crowdsourcing to help you find and develop the next big thing in your entrepreneurship journey.

[https://mindmillers.com]MindMillers’s open-innovation community help deliver significant new ideas to market faster while reducing general research & development costs. We effectively use intelligent software applications & global network community to give significant boost to your startup journey.

The goal of the Mindmillers is to develop a dedicated open-social community offering assistance with essential skills, to validate the preliminary problem-solution fit and product-market fit, prior to scaling it to considerable business as well as self-sustainable organisation.

**About MindMillers:

MindMillers Foundation was founded in year 2018 as a nonprofit organization. It is aimed to cater exclusive community support & development in the innovation & startup ecosystem across the globe.
MindMillers acts as a catalyst to connect entrepreneurs, professionals and students, , who work for innovation and welfare of the society by contributing knowledge, skills and opportunities to others.

**“World need great ideas and ideas need MindMillers to make it successful “ **

“Our vision is to become world’s leading platform for startups and ideapreneurs offering mentorship and community support to turn ideas into great organization “

We offer free platform for accelerating innovation and removing boundaries. Our core values are…
- every idea is neo
- everyone is different
- technology & innovation drives the civilization and humankind
- disagreement doesn’t mean my way
You have an idea!!
Turning your idea into a reality is a tedious task. It requires comprehensive research and effort before it turns into reality.
MindMillers community can turn your idea into a successful business & help you with followings
- Market & Patent Research
- Develop prototype
- build a right team/Co-Founders
- Technical mentorship & consulting
- Access to millions of Research Papers/Journals partnered with global universities
- Case studies/Articles/Stories
- Collaboration platform to share/receive updates/notifications in Realtime.
Your Monthly TYPO3 Maintenance Checklist
Published: 2020-06-04 07:23:13

TYPO3 maintenance is a routine task that’s critically important for all the websites to undergo in order to maintain and improve websites’ speed, performance, and security.

Neglecting regular maintenance of your TYPO3 website could result in a lot of technical problems that will tear down your TYPO3 website’s performance. 

Read on the blog for the important monthly checklist you must follow on a monthly basis for better maintenance and functioning of your TYPO3 website.

Monthly TYPO3 Maintenance Checklist 

- Backup of your TYPO3 Website
- Update TYPO3 Minor Updates
- Update TYPO3 Extensions
- Clear website cache
- Remove unused pages/content/data
- Check the TYPO3 website Health Report
- Monitor website security
- Check website performance speed
- Complete website audit and testing

Read on the blog at https://t3terminal.com/blog/typo3-maintenance-checklist/ for in depth information
Laravel Model Events & Observers Tutorial

Tags: laravel, php
Published: 2020-06-04 07:23:11

{% youtube 7GUaH6BI_V0 %}
[Laravel Model events](https://www.youtube.com/watch?v=7GUaH6BI_V0 "Laravel Model events") allow you to tap into various points in a model’s lifecycle, and can even prevent a save or delete from happening.

The model has the following events at the time of writing:
* retrieved
* creating
* created
* updating
* updated
* saving
* saved
* deleting
* deleted
* restoring
* restored