teleren/devto huggingface dataset:
How to Schedule task/script in Windows 10 ?
Tags: windows10, productivity
Published: 2020-04-29 10:33:34

Hey guys,
  Last week I posted a python script on how to sort files w.r.t filetype extensions. And the only problem I faced with that script is I need to run that script manually. 
So in order to solve that problem, I used *TaskScheduler* which is inbuilt feature in *windows 10* and *created* a task to run the script for every regular intervals.

It is very easy to create task and set triggers, and will see in step by step.

Step 1: Open *Task Scheduler* app

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

Step 2: Click on create task option on right side panel

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

Step 3: Enter the name of the task, description(optional) and security options

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

Step 4: Next, go to triggers and click on "NEW" and set *settings* as required

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

Step 5: Now, go to action and Enter the location of script that you want to schedule and click on *ok*

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

That's it, this task is automated to run for every regular time intervals
Putting Typescript into Practice
Tags: typescript, react, javascript
Published: 2020-04-29 10:32:52

After a few weeks of studying and brushing up on areas like Data Structures and Algorithms, I've recently finished a course on Typescript. After this, I started to revisit my favourite side project: a [WCAG-compliant colour palette app](https://github.com/lexedwards/react-color-contrast). I've been creating a Colour Picker UI component and realised that I wanted to break it off from the central system.

Why?

Well, two reasons:

1. I don't need the values from the colour picker to be cluttering my central app state.
1. I can easily add in a hook to relay the value object from the component, complete with methods that include pre-formatted values that work with the utility I'm using: 'color-convert'.
So, without further delay, here's my [little colour picker](https://github.com/lexedwards/Typed-ColorPicker):

![Color Picker Screenshot](https://res.cloudinary.com/driueouct/image/upload/c_scale,w_200/v1588154864/Screen_Shot_2020-04-29_at_10.45.54_f4rzwz.png)

It's not entirely spit-polished just yet, as I've discovered styling range input can be a bit tricky. There's a slight bug within mobile browsers where the sliders' border is styled rather than the fill. However, I completely removed the component and was able to implement Typescript onto it. The UI is completely tied together, with the gradients adjusting visually, along with a hook that emits an object with hex, rgb, hsl, and lab colour codes.

Here's what I've learnt:

* My typing hygiene transposing the component wasn't the best. My previous JSX wasn't the best at ensuring types, and the data passed; specifically my abstractions!
* I completely forgot about the purpose of a *.d.ts file, so once I slapped my forehead for the oversight, VScode reopened all my files and told me to remove my explicit imports.
* The new CRA --template typescript CLI worked wonders to get set up quickly, but I can't tell you how many times I was opening docs to find out what components were what types.

Most importantly, I found VScode was incredibly informative with errors. Suddenly my abstractions were too abstract and needed a rewrite, which made them more transparent. My state was interfering with handling invalid hex codes, and so I had to insert some middleware. All of this didn't run into errors in regular React + JSX; but given TSX, it made me double-check all my assumptions.
Bookmator: markdown + filesystem recursion
Tags: markdown, filesystem, documentation, showdev
Published: 2020-04-29 10:14:29

Hi, sis and bros.

Yesterday, I released a tool to generate a **markdown** file from **filesystem tree**.

This tool can be useful to maintain **big markdown** files, because it lets us split our contents in different files and folders.

## Installation

```sh
$ npm install --global bookmator
```

## Usage

Suposing this file tree:

```
/README.md
/README/0.introduction.md
/README/1.contents.md
/README/2.end.md
```

We could generate our README file like this:

```sh
$ bookmator compile README.md
```

The tool, everytime it matches a `md` file, will look always for a folder named the same way but without the extension (`.md`). When it is found, the contents of the file are replaced by the contents in the markdown files of the folder. These inner files can follow the same pattern too.

That is all, this is a very simple tool.

Happy documentation!
DronaHQ no-code platform adds to Marketplace Pandemic Response Apps for remote work
Tags: nocodedev, showdev, nocode, digitalization
Published: 2020-04-29 09:49:54

> “COVID-19 is expediting the digital transformation timelines for even the businesses that were not used to a digital way of work. What might seem overwhelming now is going to become mainstream and we all must be equipped to keep creating value for the customers, the employees, and the business,” says Divyesh Kharade, DronaHQ Co-founder. 

We are launching [COVID-19 response apps](https://www.dronahq.com/expediting-remote-work-with-no-code-apps-amid-the-pandemic/?utm_campaign=covid-response-appsutm_medium=press-release&utm_source=dev-to) that enable organizations to counter workplace disruptions brought on by the pandemic. 

The apps released aim to facilitate remote work with apps like:
- employee wellness tracking,
- health logs recording for employees and visitors,
- leadership connect,
- pandemic awareness and safety tips, and
- WFH time and task management.

[Visit for more information.](https://www.dronahq.com/expediting-remote-work-with-no-code-apps-amid-the-pandemic/?utm_campaign=covid-response-appsutm_medium=press-release&utm_source=dev-to)
Route Model Binding in Laravel
Tags: laravel, excerpts, beginners
Published: 2020-04-29 09:42:01

Route Model Binding provides a mechanism to bind/inject a model instance in the route. It's a neat way to validates a model Id injected in the route by injecting a Model instance.

**Implicit Binding**
In this method, we directly inject the model instance by passing the type hinted variable as a parameter in the closure. The type hinted variable name should match the route segment name.


```
Route::get('api/posts/{post}',function(App\Post $post){
return $post->title;
});
```

Here, the `{post}` URI segment in the URL matches the type hinted `$post` variable. 
Laravel will then automatically inject the model instance that has an `id` field matching the corresponding value from the request URI, i.e `{post}`, if not matched a 404 HTTP response will be automatically generated.

In default case the default column looked for is the `id` column but can be changed by using the `getRouteKeyName()` Eloquent function.

```
public function getRouteKeyName(){
return 'slug';
}
```
Now the route will have `slug` instead of `id`.

**Explicit Binding**
In this method, we explicitly bind a model to the segment of the route.

Explicit binding can be done by using `Router::model()` method. This can be used inside `boot()` method of **RouterServiceProvider** class.


```
//RouteServiceProvider.php
public function boot(){
parent::boot();
Route::model('post',App\Post::class);
}
```


This bounds all `{post}` parameters to the `App\Post` model, meaning a `Post` model will then be injected in the route.

The difference between **implicit** and **explicit** binding is explicit binding allows putting extra logic.

Another way of explicit binding is by overriding `resolveRouteBinding()` method on the Eloquent model itself.

```
//App\Post model
public function resolveRouteBinding($value)
{return $this->where('slug',$value)->first()??abort(404);
}
```
Flutter: Difference Between Stateful and Stateless Widget
Tags: flutter, widget
Published: 2020-04-29 09:23:29

📲 As we know that all the User Interface(UI) components in Flutter are known as widgets. The widgets can be just of two types.
- 1️⃣ Stateful Widgets 
- 2️⃣ Stateless Widget

Let's discuss how they differ:
# ⚡ **Stateless Widget**
A stateless widget can not change their state during the runtime of an app which means it can not redraw its self while the app is running. Stateless widgets are immutable.
## 🤔 How to create a Stateless Widget ?!
🤔 How to create a Stateless Widget ?!
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vispo79w7q3tiwzml3ud.png)

Let's understand this code snippet.
The name of the stateless widget is **HomeScreen**, inside which we have to override the build method. The build method takes the **BuildContext** as parameters and returns a widget. Below there is the place where you can design the UI of the **HomeScreen**.
> The build(…) function of the StateLessWidget is called only ONCE. To redraw the StatelessWidget, we need to create a new instance of the Widget.

## 😕 Where to use?!
A stateless widget is used where you are not required to redraw a widget again & again, such as AppBar, scaffold, & icons, etc.

# ⚡ **Stateful Widget**
A stateful widget can redraw itself multiple times, while the app is running which means its state is mutable. For example, when a button is pressed, the state of the widget is changed.

## 🤔How to Create a Stateful Widget?!
Look at the structure of the stateful widget:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/33xhzdgu9tainuea8yw6.png)
Let's understand this code snippet.
Here we have a class of **HomeScreen** which extends from a **Statefulwidge**t & it has to return the instance of the class **_HomeScreen** in the **createState()** method. The class **_HomeScreenState** extends from **State<>** which takes **HomeScreen** as a template input.

Now, this **_HomeScreenState** overrides the build method and returns a widget. Below there you can add the UI of the app, which is stateful and can be called multiple times using **setState** method.
## 😕 Where to use?!
Let's say you have a timer on the top of your app & the state of it is changing every second. If your entire app is in a stateful widget then its rebuilding the entire app every second which is pretty expensive. If you just extend the TimeText to a stateful TimerText then an only tiny piece of app is updating every second now.

👋 That’s all folks, thanks! if you like this post, don’t forget to leave a comment! 🤩
Multi-tenancy in Laravel: Migrations, Testing, and switching tenants
Tags: laravel, database, testing
Published: 2020-04-29 09:13:39

In this video, we discuss how we can achieve multitenancy in Laravel using the database-per-tenant approach. We cover:

- Managing multiple DB connections
- Migrating & seeding tenants & admin databases
- Running tests against tenant & admin databases
- Connecting to the correct tenant on requests/jobs

{% youtube 592EgykFOz4 %}
Ruby on Rails is not MVC - it is RCMV
Tags: ruby, rails, mvc
Published: 2020-04-29 09:13:12


![Rails is not MVC](https://dev-to-uploads.s3.amazonaws.com/i/m26mtjj267j4qpbjudvl.jpg)

Found it at amazing [RailsBridge pages](http://installfest.railsbridge.org/job-board/the_request_cycle). Would be interested to see similar paintings for React and other application frameworks.
Ruby - suppress those warnings you can't do anything about
Tags: ruby, inthirtyseconds, testing
Published: 2020-04-29 08:59:14

Ever encountered a situation where you get warnings from code in gems you are requiring?

```
...
/home/qortex/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/amazing_print-1.0.0/lib/amazing_print/formatter.rb:29: warning: mismatched indentations at 'end' with 'else' at 27
...
```

It doesn't feel good, right? Depending on your toolchain and CI/CD pipelines, it can lead to annoying noise.

I started encountering some of those warnings when running RSpec with the `warnings` flag on (which is useful because it helps catching some smells in code).

# Fix them?

In those cases, you do not own the codebase the warnings originate from. So you are out of luck because you *can't* fix them by yourself. You have to submit a PR, and/or wait for the maintainers to release a fix - if they ever do. It can take time.

Sometimes, the warnings are [just expected](https://github.com/jeremyevans/sequel/issues/1686) and should be silenced.

# Suppress them!

So now you think the warnings can be safely ignored, and you would like to suppress them.

A gem does exactly that, it's called [warnings](https://github.com/jeremyevans/ruby-warning) and has been made by the well-known and amazing rubyist [Jeremy Evans](http://code.jeremyevans.net/).

Just put `gem 'warning'` in your Gemfile, and silence warnings from all your required gems with a simple snippet:

```ruby
require 'warning'
Gem.path.each do |path|
  Warning.ignore(//, path)
end
```

In a RSpec context, you typically put that at the top of your `spec_helper.rb` file.

In any other context, just put that before requiring the gems that output warnings.

You can also be more precise in the warnings you'd like to ignore, by targeting them specifically. For example, to silence the exact warning shown above:

```ruby
# first param is a regexp matching the message
# second param is a regexp matching the file path
Warning.ignore(/.*mismatched indentations.*/, /.*amazing_print.*/)
```
Why you should know how to program?
Tags: beginners, programming, webdev, javascript
Published: 2020-04-29 08:47:00

It will help you to have better mental agility and will force you to think of more than one solution for the same problem, and problem-solving is the most important skill in life, don't you think?

Learning how to program will give you a different vision of things, it gives simple solutions to complex problems. Once Steve Jobs said, "Everyone in this country should learn to program on a computer ... because it teaches you to think." And I think you are not wrong. 😏

Knowing how to program gives you a series of benefits that many people are unaware of:

1️⃣ You will develop skills for solving logical problems. Stimulating your creativity and critical thinking.

2️⃣ You will have greater employment opportunities. Currently, there is not enough talent to cover labour demand in the technology sector.
⠀
3️⃣ It will give you greater adaptability to the current lifestyle and will help you better understand new technologies 💻
⠀
4️⃣ Entrepreneurship will become a tangible option.
⠀
5️⃣ It will improve self-esteem and self-confidence. The ability to tackle any technological problem makes you a superhero. And the feeling of solving a code bug, it's an inexplicable feeling, it's great.

I hope this with my post you will cheer up and enter the world of code. I wish you a very productive and happy coding day 😁😉
⠀
React Router 6 and more ...
Tags: beginners, react, webdev, javascript
Published: 2020-04-29 08:34:45

---
title: React Router 6 and more ...
published: true
description: Learn routing in React in general and also have a sneak peak at React Router v6 alpha
tags: #beginners #react #webdev #javascript
---

Hi ... it's been a while since I was active here. I've had a lot to do. Just released my Beginner Gatsby course and also produce videos each week on my Youtube channel. My idea is to start posting my Youtube videos here to remind you of my free content in that channel. =) 

You can check out my channel here: https://www.youtube.com/user/Weibenfalk

I post mostly stuff in #react and #frontend .. But sometimes I do backend stuff and try out new libraries and more. 

For example ... this week I try out the alpha build of React Router v6:

https://youtu.be/J4faOAn6NGA

{% youtube J4faOAn6NGA %}

If you're interested in my premium courses check out my course page: 
https://www.weibenfalk.com 

There's my new Gatsby course and it's discounted 50%. I also have my pretty popular React Movie course there where you can learn the fundamentals and intermediate React.
Introducing postcss-px-to-viewport: open-source software to create scalable interfaces on any display
Tags: css, frontend, postcss
Published: 2020-04-29 08:30:27

Most mobile and cross-platform web developers have encountered the problem at some point: you need your web app to scale neatly to the device screen size, regardless of which of the many thousands of devices there are out there, but your units only have one design layout width, mainly mobile. 

Grappling with this problem in one of our projects our leading frontend developer Dmitriy Karpunin came up with the idea of using a post-processor to convert CSS values from one set of units to another, and that’s how postcss-px-to-viewport, a plug-in for PostCSS that converts px values to viewport units (vw, vh, etc.), was born.

[Learn more about a new tool for creating scalable interfaces on any display](https://evrone.com/postcss-px-viewport)
Automating Web Performance testing with Puppeteer
Tags: webperf, node, puppeteer, javascript
Published: 2020-04-29 08:24:31

---
title: Automating Web Performance testing with Puppeteer
published: true
description: 
tags: webperf, node, puppeteer, javascript
---

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

[This Github repository](https://github.com/addyosmani/puppeteer-webperf) has recipes for automating Web Performance measurement with Puppeteer. 

* Get a DevTools performance trace for a page load
* Get a DevTools trace with screenshots
* Get a DevTools trace and extract filmstrip screenshots
* Get a DevTools trace for a user interaction
* Get Runtime performance metrics
* Generate a Lighthouse report
* Extract Lighthouse performance metrics
* Emulate a slow network
* Emulate a slow network and CPU
* Test your site renders with JavaScript disabled
* Get Navigation Timing API metrics
* Measure First Paint and First Contentful Paint
* Measure Largest Contentful Paint w/PerformanceObserver
* Measure Cumulative Layout Shift w/PerformanceObserver
* Measure SPA metrics with Next.js
* Get DevTools-specific metrics: Frames Per Second
* Measure memory leaks
* Override requests with Request Interception
* Block third-party domains
* Code Coverage for JavaScript and CSS
* Save network requests to a HAR file
When using multiple JS classes which is a better way of writing code? 
Tags: discuss, javascript, node
Published: 2020-04-29 08:02:26

I have multiple JS classes in my project, and some of them are dependant on the others. Is it better to export from a module and use it as import in another module (or) create an instance of the class I need and use it as required(here I have an HTML file where I've included all the scripts I need)?

Am I missing any fundamental of export/import? Please feel free to correct.
 
PS: I'm using Node.js

Thank You
A different kind of blog post
Tags: javascript, node, beer
Published: 2020-04-29 08:01:38

---
title: A different kind of blog post
published: true
description: Trying out a different type of post writing
tags: javascript, node, beer
---

I enjoy blogging, but was suffering of a little bit of a writer's block. Writing short tutorials, walkthroughs, tips and tricks seemed to be getting more and more redundant because a specific answer is usually a Stackoverflow answer away.

Writing about a mini project however was a lot of fun which I had done in [the past](https://mindthecode.com/blog/exploring-image-recognition-with-node-and-alpr). So I decided a different approach and rather than writing a end-to-end clearcut tutorial to achieve something I instead wrote about my outset, decissions, considerations and fails while working on a personal project dealing with a dataset.

I really enjoyed writing it and while doing it gave me a lot of new inspiration for future code adventures. Of course I have no idea whether other developers might enjoy reading such posts, but I think the main point is that writing these type of posts helps you grow as a developer as you have to put into words what is the chaos that's in your head.

If you want to read the post, [it's here](https://mindthecode.com/blog/developer-adventure-a-quest-to-find-a-large-dataset-of-beers)!
How to Fix Youtube Buffering — Easy Guide
Published: 2020-04-29 07:55:36

Youtube is one of the most popular video platforms that attracts millions of viewers everyday. The most frustrating thing you can face while trying to enjoy streaming Youtube is buffering. Although we all have access to fast internet these days, such problems as buffering still occur and there are few reasons for it. I will explain those reasons to you and give you some tips on how to fix Youtube buffering.

<b>Why Is Youtube Buffering</b>

Youtube buffering usually appears because of your internet connection problems and this doesn’t mean that you have slow internet in general. Doesn’t matter how fast your internet is, you can still face Youtube buffering issues.

<b>Some most common reasons why Youtube keeps buffering:</b>
- You don’t have enough bandwidth for internet to watch HD Youtube videos;
- Browser or app issues on your devices;
- ISP is throttling your internet connection.

<b>Troubleshooting and Fixing Youtube Buffering problems</b>
- <a href="https://www.speedtest.net/">Test your internet speed</a>. Check what speed you get while watching Youtube. There is a possibility that your ISP is experiencing temporary technical issues.
- Test if your ISP is throttling Youtube. Youtube is a bandwidth heavy platform and often is throttled by ISPs.
- Restart your router and make sure its software is up to date.
- Restart your device. This will ensure that there are no app or cache issues and restarting always help to solve 50% of the problems right?
- Try using another browser.

The biggest problem of these is the ISP throttling and some ISPs like to do that a lot. Although you can easily fix it by investing in a VPN.

<b>How to stop ISP throttling Youtube</b>
ISP throttling means that your internet service provider limits your internet connection speed on purpose. This often happens when you use bandwidth heavy platforms such as Youtube, Netflix or Torrents. ISPs can see all of their users’ activities online and how much data they use and some ISPs when they see people using heavy bandwidth platforms limits their internet speed.

The easiest way to bypass ISP throttling Youtube is to use a VPN. VPN encrypts your traffic and changes your IP address, by doing so it hides your activities from ISP and any other third party members, when your ISP doesn’t know what you are doing online they won’t be able to throttle.

<b>VPN for throttling</b>

All you need to do is get a secure VPN which can ensure anonymity, this means the VPN has to have strict no logs policy, strong encryption, fast servers and built in kill-switch. One of the best VPNs that will ensure anonymity from your ISP — <a href="https://surfshark.com/deals?coupon=BESTSHARK">Surfshark</a>. Surfshark is quite cheap, supports an unlimited number of devices, doesn’t collect logs, has fast servers, is easy to use and set up on devices, offers 30-day money back guarantee and right now you can <a href="https://surfshark.com/deals?coupon=BESTSHARK">get it with 83% discount</a>.

Source: https://medium.com/@georgeraffel974/how-to-fix-youtube-buffering-easy-guide-9c3aa1d8c329