teleren/devto huggingface dataset:
Reducing npm package size by 83%
Tags: npm, todayilearned
Published: 2020-01-23 09:32:40

There is also a Spanish version of this post:
{% link https://dev.to/nombrekeff/reduciendo-tamano-paquete-npm-en-un-83-1d30 %}

****

NPM recently added **Unpacked Size** to the package details, I then realized one of my libraries was way too big (**350kb**) for the code it has...

I started looking into it, and realized a lot of files were being packaged and uploaded, even though they are ignored in `.gitignore`. 

The solution to this was to use [`.npmignore`](https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package) and ignore all the files you want to ignore, I knew about .npmignore but never thought of trying it out.

> As mentioned in the comments, this could also be accomplished using the [`files`](https://docs.npmjs.com/files/package.json#files) property in `package.json`.

I also used a tool called [`size-limit`](https://www.npmjs.com/package/size-limit) _that calculates the real cost to run your JS app or lib_, thanks to this I changed a couple of dependencies that were way too big for the use case, and reduced the size even more.



Some libraries I changed:

| Before    | Size      | After  | Size      |
|-----------|-----------|--------|-----------|
| cli-color | `98.7 kb` | colors | `39.5 kb` |
| requests  | `201 kb`  | phin   | `10.1 kb` |

> As you can see, this makes a huge difference _(-250 kb)_ for a little library.

I reduced the package from `359kb` to `59kb`, around `-83%` size difference :P

> ## Notice
> _If you are starting out, please don't waste time optimizing your code until you understand why and how you are optimizing, [premature optimization is evil](https://stackify.com/premature-optimization-evil/) and can cause bigger issues._
Artificial Intelligence VS Data Science VS Machine Learning
Tags: ai, ds, machinelearning
Published: 2020-01-23 09:31:15

# Artificial Intelligence

Artificial intelligence is a very wide term with applications ranging from robotics to text analysis.

# Machine Learning

Machine learning is a subset of AI that focuses on a narrow range of activities.

#Data Science

Data science isn’t exactly a subset of machine learning but it uses ML to analyze data and make predictions about the future. It combines machine learning with other disciplines like big data analytics and cloud computing. Data science is a practical application of machine learning with a complete focus on solving real-world problems."
Foundations - SOLID Intro
Tags: design, principles, learning
Published: 2020-01-21 08:50:46

You know it's easy in a world with docker containers, actor models, and micro-services to forget the principles of software development sometimes, the things that underpin our daily work. I'm going to try and create a series of posts that help people learn and serve as a reference with anyone brushing up on old concepts.

# Let's being with SOLID.

SOLID is a five letter [acronym](https://dictionary.cambridge.org/de/worterbuch/englisch/acronym) that stands for what I believe are the five pillars of clean design in software development, let's list them so we are familiar with them:

S - Single responsibility principle
O - Open closed principle
L - Liskov Substitution Principle
I - Interface segregation principle
D - Dependency inversion principle

These sometimes get further acronyms such as SRP or LSP, OCP, so if you can learn these names so that if anyone at any time says one to you, you can then map that name to one of the principles in your mind and know instantly what people are talking about.

# So what now? 
I'm thinking that I will create a blog post about each of these pillars, and hopefully some people will like it, some people may disagree. 

# After that?
Let's that be tomorrows problem.

For now, do some research (I know I will) into the principles because as I say I believe these to be the most important parts of professional software development, I'll see you tomorrow where I will write about the SRP (Exciting times) 🔥🔥🔥
Static methods in Python vs Javascript
Tags: python, javascript, static, methiod
Published: 2020-01-23 09:27:26


# Python

```python
class User():
    def __init__(self, username):
        self.username = username

    @staticmethod
    def what_am_i():
        return 'I can be called by User class and also by any User instance'

User.what_am_i()
```

---
# Javascript

```javascript
class User {
    constructor(username) {
        this.username = username;
    }

    static whatAmI() {
        return 'I can be called only by User class'
    }
}

User.whatAmI();
```

# Thing to note

> In python if we declare a static method it can be called by both the class and by any of the instances (objects) created from the class ✔️✔️✔️
---
> Whereas in Javascript though, if we declare any static methods, it can only be accessed by calling it from the class and not by its instances 📣✔️✔️✔️
#help Which videoplayer would you recommend for courses?
Tags: videoplayer, courses, html, javascript
Published: 2020-01-23 09:21:52

Hi,

I'm developing a e-learning website and searching for the right videoplayer for playing the courses.

The requirements are:

- Default buttons: play, stop, pause, rewind, forward, quality, volume, fullscreen
- View, choose and play custom sections
- Mirror screen

I've found two players but can't identify them..

https://thepracticaldev.s3.amazonaws.com/i/j1bjlqk48l89pft0ostt.png
https://thepracticaldev.s3.amazonaws.com/i/sii0q53vhfx1sto4infz.png 

Real example: https://nicestudioadm.pro/p/?id=79&video=99852600_34567065_1574011184196.mp4

Can someone help me identify these player or recommend a player?

Thank u in advanced!
Ionic 4 Cordova Geolocation and Geocoder Tutorial with Examples
Tags: ionic4
Published: 2020-01-29 11:48:40

---
title: Ionic 4 Cordova Geolocation and Geocoder Tutorial with Examples
published: true
date: 2020-01-23 09:03:10 UTC
tags: #Ionic4
canonical_url: https://www.positronx.io/ionic-cordova-geolocation-and-geocoder-tutorial-with-examples/
---

This is a step by step tutorial on how to use Cordova Geolocation and Geocoder plugin in an Ionic 4 app to get the current user device position, get current user address.

In this tutorial we are going to learn how to get users device location with latitude and longitude.

We will learn to get the users address using Geolocation and Geocoder Plugins.

We will look at how to add target platforms such as iOS, Android or Windows and create the build in Ionic for various devices.

#### Table of Contents

1. [Prerequisite](#tc_8574_01)
2. [Create New Ionic 4 / Angular Project](#tc_8574_02)
3. [Install & Configure Cordova Geolocation and Geocoder Plugins](#tc_8574_03)
4. [Get Current Location Latitude and Longitude](#tc_8574_04)
5. [Get Current Address](#tc_8574_05)
6. [Add Target Platform: Android, iOS or Windows](#tc_8574_06)
7. [Build Your Ionic App](#tc_8574_07)
8. [Conclusion](#tc_8574_08)

## **Prerequisite**

We must have the latest version of Node js installed on our device. If you are not having then follow this tutorial on: [How to Download and Install Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)

## **Create New Ionic 4 / Angular Project**

Use the command to install Ionic 4 Cordova globally on your machine.

```
sudo npm install -g cordova ionic
```

By using the following command, you can check the Ionic CLI version running on your machine.

```
ionic -v

# 5.4.13
```

Use below command to update Ionic and Cordova.

```
sudo npm update -g cordova ionic
```

Let’s start installing a brand new Ionic 4 Angular app with the help of Ionic CLI, run the following command in your terminal.

```
ionic start ionic-geolocation-app blank --type=angular
```

Get inside the project folder.

```
cd ionic-geolocation-app
```

Start the app in the browser.

```
ionic serve --lab
```

[click here to read more](https://www.positronx.io/ionic-cordova-geolocation-and-geocoder-tutorial-with-examples/)
retro adding a series post to a previous post
Tags: devto, post
Published: 2020-01-23 08:44:26

NOTABUG/FIXED you CAN turn old posts into a series :)

create a post without a series
create a 2nd post with a series
edit 1st post and add series

TEST CASE

1st post now a has a series TOC
{% link https://dev.to/osde8info/byo-chromium-browser-extension-in-2-steps-with-nocode-g1h %}

2nd post still has series TOC
{% link https://dev.to/osde8info/chromium-webstore-developer-dashboard-4o0f %}
wouldnt it be nice if devto let you set buy-me-a-kofi links ?
Tags: discuss
Published: 2020-01-23 08:27:34

wouldnt it be nice if devto let you set buymeacoffee and ko.fi links on the DEVTO settings page https://dev.to/settings ? 

PS if i get at least 10 +ve comments and or likes i will fill in the devto feature req form 

PPS here are my buymeakofi pages
* https://www.buymeacoffee.com/VbmwyiF
* https://ko-fi.com/osde8info
[Link] The Internet of Beef
Tags: productivity
Published: 2020-01-23 08:10:06

> For the knight, the conflict is the end. Growing it, and keeping it going, is something like an entrepreneurial cultural capital business model (one with no exit from the hell-market of other people; Sartre would be proud).

> If conflict in any particular theater shows dangerous signs of actually resolving itself, another must be spun up to take its place, much as businesses that hope to survive must replace markets in decline with new ones.

> As a result, on the IoB, the only meaningful transaction is the pitched battle between armies of mooks, the equivalent of a viral hit. The bloodier and stupider, the better for the instigating knights on all sides. The greater the futility, the more useful, since it reinforces a disposition towards conflict for the sake of conflict.

https://www.ribbonfarm.com/2020/01/16/the-internet-of-beefs/
Install Docker Desktop for Windows to Windows 10 running on Azure
Tags: docker, azure, windows
Published: 2020-01-23 08:06:18

---
title: Install Docker Desktop for Windows to Windows 10 running on Azure
published: true
description: 
tags: docker,azure,windows
cover_image: https://msdnshared.blob.core.windows.net/media/2017/10/docker.png
---

Do you need to install Docker Desktop to Windows 10 which runs on Azure? You just need to select right VM which support nested virtualization.

[Introducing the new Dv3 and Ev3 VM sizes](https://azure.microsoft.com/en-us/blog/introducing-the-new-dv3-and-ev3-vm-sizes/)

I usually use **"Standard_D2s_v3"** as that's the lowest cost yet runs just fine.
Just check the article above.

Steps.

1. Create VM by selecting appropriate size. **!!The default size doesn't support Docker!!**
1. Install Docker by using installer from [Docker Hub](https://hub.docker.com/editions/community/docker-ce-desktop-windows)
1. Follow the message. It installs required components and you need to restart at least one time.
1. Make sure everything runs correctly.

# Typical Issue

If you are using incorrect size, then you see:

> Failed to start the virtual machine 'MobyLinuxVM' because one of the Hyper-V components is not running.


# Troubleshooting resource

- [Logs and troubleshooting](https://docs.docker.com/docker-for-windows/troubleshoot/)
- [Get started with Docker for Windows](https://docs.docker.com/docker-for-windows/)
get paid for using a vpn ! TGTBT ?
Tags: security, vpn, watercooler
Published: 2020-01-23 07:59:02

"getting paid" must be too good to be true (TGTBT) ? well thats what mysterium offer ! (i think i read you can get up to €50/y)

ive been using protovpn for about a year now and and was happy with them until the gnu/linux client broke 

are there any other reasons (if i am happy only being able to route via US, NL or JP) to switch to mullvad or mysterium ?

vpns
* -€05/m https://mullvad.net/en/
* *€00/m https://protonvpn.com/ (US, NL & JP nodes only)
* +€50/y https://mysterium.network/

vpns on github
* https://github.com/mullvad/
* https://github.com/ProtonVPN/protonvpn-cli-ng
* https://github.com/mysteriumnetwork/mysterium-vpn
PHPNews App
Tags: php, android
Published: 2020-01-23 07:39:27

Being able to keep oneself updated with latest trends, best practices and news is very crucial especially with the web evolving so rapidly today. This is equally important to become better or what they say modern developer as opposed to obsolete developer. As the technology stack evolves, the client requirements also evolve pushing us as developers to remain abreast of latest stuff as much as we possibly can.

Two of the most common methods to stay up-to-date with latest stuff is to use some RSS/Atom Aggregator or subscription via emails at various sites. These work fine but I was personally overwhelmed by the amount of new updates and posts I used to get, it was kind of hard to keep the track of it all with that many subscriptions from various sources on different technologies. I could have minimized the subscriptions but that wouldn't save the actual purpose.

Therefore being a developer, often times, you come up with your own solution which fits your needs. I wanted just a simple and focused app on just one technology eg PHP that would give me updates from various sources in one central place without bloating me away with too many or stale posts. Since idea was simple, I didn't want to spend too much time on Android so I took the route of using JavaScript to create this app. It turned out there are quite some ways to create Native apps today using one technology that can run across devices and platforms. I found NativeScript quick and easy to get started with although there are other solutions too to make native apps such as ReactNative, Xamarin, Flutter, etc.

Over the weekend, I went on to creating this app called PHPNews and I believe end result is exactly what I wanted as it serves the purpose.

It collects information from various sources including official blogs of PHP frameworks such as Laravel, Symfony, Zend Framework and CMSs like WordPress and last but not the least our old friend planet-php.net.

Definitely give it a try and also share any suggestions or improvements.

[View PHPNews on Android PlayStore](https://play.google.com/store/apps/details?id=io.codeinphp.phpnews)
[No Code] How To Create Unique Member Dashboards in Webflow
Tags: nocode, visualdevelopment, showdev
Published: 2020-01-23 07:12:47

Howdy all :wave:

While I've been developing software for over a decade, lately I've been doing a deep dive into the whole "No Code" movement that's recently getting more attention.

I've been recording screencasts with everything I'm learning and wanted to share my latest - creating unique dashboards for every new member on your Webflow site.

While this is fairly trivial when coding it, in the NoCode space it's not.

Here’s what it walk through:

1. Full control of your sites design in **Webflow**. Using the Webflow CMS to store your member accounts and unique content for each.

2. Using **MemberStack** to provide members only access.

3. With **Zapier** gluing the two together for a quick setup that I walk you through in this 16 minute video.

Thoughts?

{% youtube Ek_Ex9tHHTg %}

Happy to answer any questions!

If you prefer a downloadable guide (185 pages w/377 screenshots) to walk through this at your own pace you can find it here: 

https://nocodequest.com/unique-member-dashboards-in-webflow-using-memberstack/
Laravel 6 | Filter Data Using Vue Js
Tags: laravel, filter, vue
Published: 2020-01-23 07:05:39

Hi Artisan,

In this tutorial, i will guide you step by step how to create vue filter list example in laravel 6. Filter is very important feature for website. Many website you will see that filter is a required thing. 

Now in this tutorial we are going to learn how we can create vue filter list using laravel using vue filter component. In this tutorial i will create a post table which contains a active field.

https://www.codechief.org/article/laravel-6-filter-data-using-vue-js
If programming languages were vehicles, weapons, superheroes, etc.
Tags: jokes
Published: 2020-01-23 06:48:57

---
title: If programming languages were vehicles, weapons, superheroes, etc.
published: true
description: 
tags: discuss, jokes
---

Programming languages all have their own distinctive style :)
I've compiled a fun list of their associatives for your entertainment:

Programming languages as Vehicles:
http://crashworks.org/if_programming_languages_were_vehicles/

Programming languages as Weapons:
https://www.behance.net/gallery/28173623/IF-PROGRAMMING-LANGUAGES-WERE-WEAPONS

Programming languages as Everyday people:
https://coresolutions.ca/blogs/core-web/if-programming-languages-were-everyday-people

Programming languages as Superheroes:
https://www.codingninja.co.uk/if-programming-languages-were-superheros/

Programming languages as Game of Thrones characters:
https://techbeacon.com/app-dev-testing/if-programming-languages-were-game-thrones-characters
Key decisions for building effective microservices 
Tags: todayilearned, microservices, graphql, architecture
Published: 2020-01-23 06:43:32


### [Do you have too many microservices? - 5 design attributes that can help](http://bit.ly/37eP35e)

- When you are developing microservices, ensure that each service relies on its own underlying data stores. If multiple services reference the same table in a DB, there is a great chance that your DB is a source of coupling. You must avoid such coupling.
- You should try to minimise the number of database tables a microservice uses.
- At the onset, be clear about whether a service needs to be stateful or stateless. 
- Understand the system-wide relationships of a microservice with other services and what impact does non-availability of a particular microservice will have on the system. 
- Design your service to be the single source of truth for something in your system.

*[Full post here](http://bit.ly/37eP35e), 9 mins read*

---

### [Walking the wire: Mastering the four decisions in microservices architecture](http://bit.ly/2veUymp)

- There should be no shared databases. If updates happen only in one microservice, you can use message queues to share data. If updates happen in two services, either merge the two services or use transactions. 
- Handle microservice security by using a token-based approach. It pushes the authentication to the client and does access control at microservice level simplifying dependencies.
- Handle microservice composition by driving flow from client browser, through orchestration or through a centralised server that runs the workflow.
- Avoid a spaghetti of dependencies by having a proper & detailed plan of how & when which microservices should call each other. Understand the impact of such an invocation on the overall performance of the system. 

*[Full post here](http://bit.ly/2veUymp), 9 mins read*

---

### [Unique benefits of using GraphQL in microservices](http://bit.ly/2sMAqqN)

- The data structure in GraphQL allows for well-defined & delineated data ownership for each request.
- You can have great control over the data loading process and therefore control how data is transferred in a very granular way.
- As GraphQL allows for request bundles composed of many requested resources, it can leverage a sort of parallel execution for data requests. This allows a single request to fulfill the requirements that would otherwise have been through multiple requests to multiple services over multiple servers.
- GraphQL can budget requests, allows the server to prioritize requests and grant them where appropriate, and reduces timed out requests in the long run.
- It saves ave processor time and effort because it utilizes Object Identifiers to cache often-requested data.

*[Full post here](http://bit.ly/2sMAqqN), 8 mins read*

---

*[Get these notes directly in your inbox every weekday by signing up for my newsletter, in.snippets().](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
Help with a beginner's project! An app with Front and Back-end.
Tags: beginners, javascript, mongodb, flutter
Published: 2020-01-23 06:36:58

Night DEV community!

This is a beginner's question and I'm really looking forward to learning from you now. 😄

**Context:**
I want to create a project to put in practice some skills that I just learned.
The idea: An APP with authentication and different views according to the user's role.

- Frot-end: React-native OR Flutter.
- Back-end: Express.js(Node.js) AND MongoDB.

**Features:**
- Users should be able to create an account/ sign in and sign out.
- There will be 2 types of users: NORMAL USER and STORE.
- Normal User = One e-mail and one password. Impossible to have two of the same. It will have access to some features on the app (CRUD operations).
- STORE = This user will have one e-mail and one password.It will have access to some features on the app (CRUD operations). The CATCH: this user will be able to create sub-users with the same access to the same features as the main STORE USER.

**Questions:**
1. I know how to authenticate using Express (JWT, Passport, Middlewares, etc). Is that a common/best practice for an app? Use the authentication on the endpoints/requests?
2. The relationship between a STORE user and it's sub-users would be one-to-few. So, should I have them *referenced* inside my schema or actually *embed* them inside the STORE schema?

Not sure if I was clear but I hope to get some insight before starting coding and figure out that I went the wrong way. 😌🤓

Thank you!
Why we should Use GetWidget Open-Source Library
Tags: flutter, opensource, guide
Published: 2020-01-23 06:26:33

Why we should use GetWidget UI Library and what are the benefits of this library?

**Some of the important point why we should use GetWidget:**

A) GetWidget is a Flutter UI Library. It is an open-source project and free to use.

B) It has 1000+ pre-built component widgets that allow you to build Flutter easier and hustle free.

C) GetFlutter will save upto 30% development time for you.

D) It is easy to use. You can import only your required components packages instead of hole dart packages that save your app size.

E) It's Architecture Schema is a good design so it is easy to understand.

You keep getting new components updates that help you build an awesome Flutter UI for your APP.

GetFlutter has an open [Roadmap](https://roadmap.getwidget.dev/) where you can see the development progress as well you can vote us regarding what the next component should we released.

**Getting Start:**

You can check out our how to start using our dart package https://docs.getwidget.dev/getting-started

Install Package from pub.dev:

https://pub.dev/packages/getwidget

Import full package:

import 'package:getwidget/getwidget.dart';

Note: dependencies: getwidget: ^1.0.0

In case you need only Specific Component of Library:

Import the required component in .dart file: eg- "Button component"

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/4w0whmd7tu7jpmsznt7d.png)

import 'package:getwidget/components/button/gf_button.dart';

Call the name of the component with its properties:

 GFButton( 
          onPressed: (){}, 
          text: "primary",  
         )

Example to add a primary button:

  import 'package:getwidget/components/button/gf_button.dart';
  
  GFButton(
    onPressed: (){},
    text: "primary",
  ),

Now you keep explore all the components on [GetWidget Docs](https://docs.getwidget.dev/) and/or you can check out on our [GitHub repository](https://github.com/ionicfirebaseapp/getwidget).
📚 Tell me your ABSOLUTE favorite books and online classes 
Tags: discuss, watercooler, books
Published: 2020-01-23 05:48:16

Hello lovely, lovely dev community. ❤️️


I am currently putting together a list of developer resources to put on my blog, [Books on Code](http://booksoncode.com), and I _must_ know:

**What are your _absolute favorite,_ can't-stop-raving-about-them books and online classes?**

I know there are plenty of resource lists out there already, but I think I rarely get to hear the books or classes that come top-of-mind to people that altered the history of their dev careers.

My ears are open!!