teleren/devto huggingface dataset:
Implement Nuxt/Vue Micro-Service
Tags: vue, nuxt, typescript, microservices
Published: 2021-05-08 08:46:40

Here I've explained the basics of micro-service architecture for the front end and how to choose your services.
{% link https://dev.to/ifarhad/front-end-microservice-architecture-38 %}

In this post, we consider a shopping website that has three main parts and we name it myshop.com.

- Account
- Shop
- Profile

Account service will mount on myshop.com/account that has the following routes

- /account/login
- /account/register
- /account/forget-password


Shop service will mount on myshop.com/shop that has the following routes

- /shop/products
- /shop/product/:id
- /shop/basket


Profile service will mount on myshop.com/profile that has the following routes

- /profile/orders
- /profile/edit-profile

As we discussed before each service will be a Nuxt project. for the first step, we will create 3 Nuxt projects.

I created in following directories

- /home/farhad/projects/nuxt-account
- /home/farhad/projects/nuxt-shop
- /home/farhad/projects/nuxt-profile

For the next step, we need a router to handle each request with desired Nuxt project.

I have developed this router and published it on npm.

let's install it and see how to use it.

create a new project
install geshniz-router package
create index.ts file and add the below code:

‍‍‍```javascript
import {NuxtService, App} from 'geshniz-router'

const app = new App(4000, '0.0.0.0')

const account = new NuxtService({
    evn: 'dev',
    name: 'Account',
    mountPath: '/account',
    rootPath: '/home/farhad/projects/nuxt-account/'
})

const shop = new NuxtService({
    env: 'dev',
    name: 'Shop',
    mountPath: '/shop',
    rootPath: '/home/farhad/projects/nuxt-shop'
})


const profile = new NuxtService({
    env: 'start',
    name: 'Profile',
    mountPath: '/profile',
    rootPath: '/home/farhad/projects/nuxt-profile'
})

app.registerService(account)
app.registerService(shop)
app.registerService(profile)

```
Then run it with 
``` 
ts-node index.ts
```
or compile it with the tsc and run it with node.

Now If you check 127.0.0.1:4000/profile/orders, the response comes from the nuxt-profile project and as well as other requests.


let's explain App class and NuxtService class

App class instance accepts two parameters for creating a web server, Ports and hosts, respectively and has one method for registering NuxtService instance class in routes.

```typescript
new NuxtService({
    env: '', // dev or start
    name: 'Profile', // only a name
    mountPath: '/profile', 
    rootPath: '/home/farhad/projects/nuxt-profile'
})
```
If you are working only on one service you can set others to be in production mode by setting env property to be 'start'
also, nuxt projects could out main project's directory.

After registering the new Nuxt service instance with the App class, **all incoming requests for the mountPath route will be handled by this service**.

*I took the cover photo myself, a beautiful park in Tabriz.*
Improve code quality with few clicks
Published: 2021-05-08 08:45:01

#[SonarLint](https://www.sonarlint.org/)

*SonarLint is an IDE extension that helps you detect and fix quality issues as you write code. Like a spell checker*

Supported languages!
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gyrguqt6czw8f3eahjl7.png)
 
#Installation
**VS Code:** 

* Open VSCode and click on the sidebar Extension menu
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cla0bwtienrkpi0l70fa.png)

* Type **SonarLint** and choose the extension from SonarSource
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a8cs27yups0fzyhwxxj7.png)

* Click on Install
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2mf6y8y3l65bn7nzr4en.png)

* Reload VSCode

You can check here [How it works](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarlint-vscode) 


Start writting code 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q0g2yvr4wt84orzpv8bt.png)
 
# Conclusion
Help to grow other developers and yourself.

Love and best wishes to all creators.

_If you found this article interesting please consider following me on [Twitter](https://twitter.com/ByteNebula), [facebook](https://www.facebook.com/NebulaByte-100116265295910)_
Ngx Slick Carousel In Angular Material Card with Custom Arrows
Tags: angular, material, css, slider
Published: 2021-05-08 08:19:29

Angular Material is a UI component-based framework with use to build web applications in an attractive interface. So here we try to make a carousel slider help of Ngx-slick-carousel npm with an angular material card.



In these elements, we used font awesome CDN for left and right-click action. Also, we used SCSS to make this element user-friendly. Here we used icon and CSS properties ts file and IMG binding in the same ts. These fully responsive and mobile-friendly elements.

Make it yours now by using it, downloading it, and please share it. we will design more elements for you.

[Source Code](https://w3hubs.com/ngx-slick-carousel-in-angular-material-card-with-custom-arrows/)
hopOn -  Car Sharing and Rental App
Tags: flutter, googlecloud, firebase, mobile
Published: 2021-05-08 08:14:01

<p align ="center"> 
<i> A car sharing & rental app using <a href="https://flutter.dev/">Flutter, </a><a href="https://firebase.google.com/">Firebase </a> & <a href="https://cloud.google.com/">Google Maps APIs</a> 🔥</i>
</p>
<br><br>

### About the App 🚘
  - hopOn is flutter based application for car sharing and rental services.
  - The two main functions that app includes are -
    1. Rent a nearby car 
    2. Give your car on rent
  - The app uses 3 Google Maps API
    1. Geocoding API (provides geocoding and reverse geocoding of addresses)
    2. Places API (returns information about places using HTTP requests)
    3. Directions API (returns JSON or XML-formatted directions between locations)
    4. This app has been completed with the detail study which includes Wireframe, methods, API study etc. All the information has been provided in the Github repository.

### Wireframe✒️ 
https://www.figma.com/file/3ALznWfTL7k7nPWyPuMfKT/Vehicle-Sharing-App?node-id=520%3A2

### Thank you!
   - Feel free to ask your doubts and contribute to this project.
   - Find the app video with the detail explaination about methods and resources(Firebase, GCP etc.) on Github - https://github.com/Singh-Shivani/hopOn/
   - Do ⭐ the repo.
   - Keep hustling & Stay safe❤️
Do you use subdomains?
Tags: watercooler, webdev, domain
Published: 2021-05-08 07:41:52

---
title: Do you use subdomains?
published: true
description: 
tags: watercooler, webdev, domain
cover_image: https://qodeinteractive.com/magazine/wp-content/uploads/2021/04/Subdomains-and-Subdirectories-%E2%80%93-Whats-the-Difference.jpg
---
Subdomains are the part of a domain that comes before the main domain name and domain extension. They are created to organize and navigate to different sections of the website.

Do you use subdomains for your personal domain like `awesomeproject.mydomain.com`? 

If so, could you elaborate on your reasons why do you prefer them over subdirectories like `mydomain.com/awesomeproject` or buying a dedicated domain like `awesomeproject.com`?
Send Email using Node.js
Tags: node, javascript, nodemailer
Published: 2021-05-08 07:40:42

Want to send email using node.js ??,
Its simple here are some steps that will allow you to send email using node.js using nodemailer.

### STEP 1 - Install nodemailer
Use following command to install nodemailer
```
npm install nodemailer
```
### STEP 2 - Create Transporter
import nodemailer and create transporter
```
var nodemailer = require('nodemailer');

let transporter = nodemailer.createTransport({
    service: 'gmail' // here I am using gmail service
    auth:{
       user: 'emailid@gmail.com,
       passoword: 'your gmail app passsword'

    }
});
```
> Remember the password you are going to use is not the password for email rather you will have to generate application password provided by gmail. [Click here](https://support.google.com/accounts/answer/185833?hl=en) to see how to generate application password  

### STEP 3 - Create Options
```
let mailOptions = {
  to: 'myfriend@yahoo.com',
  subject: 'Sending Email using Node.js',
  text: 'That was easy!'
};
```

### STEP 4 - Send Email

```
transporter.sendMail(mailOptions, function(error, info){
  if (error) {
    console.log(error);
  } else {
    console.log('Email sent: ' + info.response);
  }
});
```

> IF YOU LIKED THIS ARTICLE MAKE SURE TO FOLLOW ME ON DEV.TO AND ON [INSTAGRAM](https://www.instagram.com/rawasaditya/)


[![Aditya Rawas Coffee](https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-1.svg)](https://www.buymeacoffee.com/adityarawas)
Node.js : Debugging Your NodeJS Application
Tags: node, webdev, development, debugging
Published: 2021-05-08 07:23:18

You can use the node-inspector. Run this command to install it via npm:
```
npm install -g node-inspector
```
Then you can debug your application using
```
node-debug app.js
```
The Github repository can be found here: https://github.com/node-inspector/node-inspector

**Debugging natively**
You can also debug node.js natively by starting it like this:
```
node debug your-script.js
```

To breakpoint your debugger exactly in a code line you want, use this:
```
debugger;
```

If you've older version of node.js for example in node.js 8 use the following command:
```
node --inspect-brk your-script.js
```

Then open `about://inspect` in a recent version of Google Chrome and select your Node script to get the debugging
experience of Chrome's DevTools.

With all that being said, I highly recommend you keep learning!

Thank you for reading this article. Please feel free to connect with me on [LinkedIn](https://www.linkedin.com/in/www-rajeshkumaryadav-com/) and [Twitter](https://twitter.com/rky_com).

<a href="https://www.buymeacoffee.com/rkycom" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
COVID-19 Vaccination Slot Booking Script
Tags: python
Published: 2021-05-08 07:20:38

Update:
We are getting all kinds of attention now - which I do not want to handle. So there won't be any additional commits to this project. It has been put on indefinite hold.

Important:
This is a proof of concept project. I do NOT endorse or condone, in any shape or form, automating any monitoring/booking tasks. Use at your own risk.
This CANNOT book slot automatically. You will need to enter the OTP and Captcha.

Do NOT use unless all the beneficiaries selected are supposed to get the same vaccine and dose.
There is no option to register new mobile or add beneficiaries. This can be used only after beneficiary has been added through the official app/site.

API Details (read the first paragraph at least): https://apisetu.gov.in/public/marketplace/api/cowin/cowin-public-v2
BMC Link: https://www.buymeacoffee.com/pallupz
And finally, I know code quality isn't great. 
Suggestions are welcome.

Noteworthy Forks
https://github.com/bombardier-gif/covid-vaccine-booking : I haven't tried this personally but, it looks like a promising, completely automated solution that would require a bit more setting up.

Usage:
For the anyone not familiar with Python and using Windows, using the covid-vaccine-slot-booking.exe executable file (EDIT: EXE is not working at the moment due to unresolved errors) would be the easiest way. It might trigger an anti-virus alert. That's because I used pyinstaller to package the python code and it needs a bit more effort to avoid such alerts.

OR

Use Python 3.7 and install all the dependencies with:

pip install -r requirements.txt
Then, run the script file as show below:

python src\covid-vaccine-slot-booking.py
If you're on Linux, install the beep package before running the Python script. To install beep, run:

sudo apt-get install beep
If you already have a bearer token, you can also use:

python src\covid-vaccine-slot-booking.py --token=YOUR-TOKEN-HERE
Third-Party Package Dependency:
tabulate : For displaying data in tabular format.
requests : For making GET and POST requests to the API.
inputimeout : For creating an input with timeout.
FACEBOOK GET ACCESS TOKEN FROM COOKIE
Tags: python
Published: 2021-05-08 07:12:54

Only with cookies you can retrieve fb access token very easily and there are no checkpoints. :D 
==========================================================
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vzshlws99lqq4zndon6d.PNG)

how to install ? 

pkg update && pkg upgrade
pkg install python git
pip install requests
git clone https://github.com/penucuriCode/fb-token
cd fb-token
python main.py
Emojify – Create your own emoji with Deep Learning
Published: 2021-05-08 07:06:09

Emojis are ways to indicate nonverbal clues. These clues have become an essential part of online chatting, product review, brand emotion, and many more. It also lead to increasing data science research dedicated to emoji-driven storytelling.

With advancements in computer vision and deep learning, it is now possible to detect human emotions from images. In this deep learning project, we will classify human facial expressions to filter and map corresponding emojis or avatars.
About the Dataset:
The facial expression recognition dataset consists of 48*48 pixel grayscale face images. The images are centered and occupy an equal amount of space. This dataset consist of facial emotions of following categories:

0:angry
1:disgust
2:feat
3:happy
4:sad
5:surprise
6:natural
Facial Emotion Recognition using CNN:
In the below steps will build a convolution neural network architecture and train the model on FER2013 dataset for Emotion recognition from images.
Make a file train.py and follow the steps:
1. Imports:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovyvtye8g1xo7cm5j97v.png)
2. Initialize the training and validation generators:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ig3vafvu9c83f4tveoo2.png)
3. Build the convolution network architecture:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4lsek40p9vn3rnm040k7.png)
4. Compile and train the model:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d425urktbr35hh6kkipn.png)
5. Save the model weights:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q439ekopyvfc8di6m0s8.png)
6. Using openCV haarcascade xml detect the bounding boxes of face in the webcam and predict the emotions:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ld93lis7unvjmjj7b6c3.png)
Code for GUI and mapping with emojis:
Create a folder named emojis and save the emojis corresponding to each of the seven emotions in the dataset.

Paste the below code in gui.py and run the file.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/odi8xos2pcq8kkzw1zvk.png)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5cmqza74e2o81xqnfw74.png)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r2atpmgw3q7hmcjdligp.png)
Summary:
In this deep learning project for beginners, we have built a convolution neural network to recognize facial emotions. We have trained our model on the FER2013 dataset. Then we are mapping those emotions with the corresponding emojis or avatars.

Using OpenCV’s haarcascade xml we are getting the bounding box of the faces in the webcam. Then we feed these boxes to the trained model for classification.
Do you code on weekends?
Tags: watercooler, webdev, productivity, coding
Published: 2021-05-08 06:56:09

---
title: Do you code on weekends?
published: true
description: 
tags: watercooler, webdev, productivity, coding
cover_image: https://img.freepik.com/free-vector/man-working-fall-concept-illustration_203587-53.jpg?size=626&ext=jpg
---
Many devs strictly believe that resting and family time is equally important as work, leaving weekends code-free:

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

Do you code on weekends?
If so, what type of projects are you working on?
WordPress: modify user capabilities dynamically with functions.php
Tags: wordpress, authorization, php, security
Published: 2021-05-08 06:56:04

[WordPress](https://wordpress.org/) provides variety of user [roles and capabilities](https://wordpress.org/support/article/roles-and-capabilities).

It is able to modify user capabilities with `functions.php` dynamically. In other words, in terms of security, it is able to act as `administrator` when there is a way to edit [`functions.php`](https://developer.wordpress.org/themes/basics/theme-functions) such as [FTP](https://en.wikipedia.org/wiki/File_Transfer_Protocol).

Here is a code example.

```php
# functions.php
function custom_user_cap() {
	// get user
	$user = new WP_User( <user-ID> );
	//$user = new WP_User( '<user-login-name>' );
	//$user = wp_get_current_user();

	// modify capabilities	
	// for example, those to manage users
	$user->add_cap( 'list_users' );
	$user->add_cap( 'edit_users' );
	$user->add_cap( 'create_users' );
	$user->add_cap( 'delete_users' );
}
// register action
add_action( 'admin_init', 'custom_user_cap' );
```

Adding it to `functions.php` gives the user, which is got by ID, login name or login information, the capabilities to manage users even if they is just a `reader` or an `editor`.

Wordpress user capabilities list is [here](https://wordpress.org/support/article/roles-and-capabilities/#capabilities).
Quick Introduction to typedef in C++
Tags: cpp, typedef, programming, tutorial
Published: 2021-05-08 06:45:25

C++ is a strongly typed language which means we take types very seriously in the C++ community! While types are important and reduce bugs, it gets tiresome pretty quickly when there's an inbuilt type with a long name that you’ve to use repetitively throughout your code. 

```c++
// Examples

unsigned long num;

std::pair <std::string,double> product_one; 
```

Introducing `typedef` declarations, easy effortless way to declare and use types in your file. `typedef` declarations can be considered as nicknames✨ that you give to an inbuilt type and whenever you want to say `inbuilt-type`, you say their _nickname_ instead. 

```c++
typedef unsigned long UL; 
UL num; // Equivalent to unsigned long num;

typedef std::pair <std::string,double> PRODUCT
PRODUCT product_one("notebook",54.5); 
// Equivalent to std::pair <std::string,double> ("notebook",54.5);
```

In contrast to the `class`, `struct`, `union`, and `enum` declarations, `typedef declarations` _do not introduce new types_, they simply introduce new names for existing types. What’s more exciting is that you can declare any type with `typedef`, including pointers, functions and array types. 

```c++
typedef struct {int a; int b;} STRUCT, *p_STRUCT;
 
// the following two objects have the same type
pSTRUCT p_struct_1;
STRUCT* p_struct_2;
```

`typedef` declarations are _scoped_, that is you can declare a `variable` with the same name as of the `typedef` in the same file in a different scope and you’ll face no type errors whatsoever!

```c++
typedef unsigned long UL;   
int main()
{
   unsigned int UL;   
   // re-declaration hides typedef name
   // now UL is an unsigned int variable in this scope
}

// typedef UL back in scope
```

However, I would highly advise against this practice because it eventually makes your file less readable and more confusing which is not something you’d want to do.🤷

>In summary, you can use `typedef` declarations to construct shorter and more meaningful names to the types that are already defined by the language or for the types that you have declared. 

Hopefully this article gave you a brief introduction to typedef and you had fun reading it. To get more information on the topic, refer the docs [here](https://en.cppreference.com/w/cpp/language/typedef). 

Thanks for giving this article a read and I'll see you in the next one 😄
FUSE
Tags: fuse, filesystem, operatingsystem, unix
Published: 2021-05-08 06:44:14

**Filesystem in Userspace (FUSE)** is a loadable Unix kernel module that allows non-privileged users to create their file systems without editing the kernel code. The code of these file systems is run on userspace programs – FUSE helps them link to the kernel interface.
FUSE is available on several operating systems, including Linux, macOS, and Android.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a069wnyzzgo6mq6ztqz4.png)
FUSE is built on two main components: the fuse kernel module and the libfuse userspace library. The libfuse **library** provides functionality to mount and unmount file systems.![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wrxu97eni3rtan3fhrcy.png) It also enables reading and responding to kernel requests.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t7r36eobi2w5leaup245.gif)
How to unregister service workers in Firefox
Published: 2021-05-08 06:42:22

---
title: How to unregister service workers in Firefox
published: true
description: Remove services running in background
tags: 
---

Just a quick post because the Google search results for this are out of date.

To stop (unregister) service workers in Firefox, go to

    about:debugging#/runtime/this-firefox

Unfortunately there's no way to filter (as there is for cookies), so if you've been running that Firefox instance for a while, you'll likely have tens or hundreds of registered service workers.
7 Data Science Research Papers on Covid-19- You Should Read
Tags: datascience, machinelearning, deeplearning, python
Published: 2021-05-08 06:30:03

During the Covid-19 Pandemic, lots of researchers are giving their contributions and published research papers. That’s why I thought to share some Data Science Research Papers on Covid-19 with you. These research papers are on various topics such as monitoring patient monitoring using deep learning or predict the country-wise Covid-19 using neural networks.

So without any further ado, let’s get started-

**[Click to continue reading...](https://www.mltut.com/data-science-research-papers-on-covid-19/)**