teleren/devto huggingface dataset:
Making a Custom Protocol Handler and URI Scheme! - Part 2
Tags: uri, url, python, web
Published: 2021-04-17 12:13:34

# Welcome Back,
To this miniseries! In today's post, I will be showing you how to actually execute the script! So, let's get started! BTW, if you don't know what I am talking about then go read [Part 1](https://dev.to/pybash/making-a-custom-protocol-handler-and-uri-scheme-part-1-37mh) first to understand!

# What are we making today?
Well, I thought you would ask. Today, just like I said we will be actually executing the code from the file! Excited?

![a-small-explanation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5c180blm70roiv8m28h.png)

# But How?
Basically, we will be changing or modifying the Handler's `python_open` function!

## New Prerequisites
- sys(Included in the standard library)
- subprocess(Included in the standard library)

# Let's Start
So, we are going to change the Handler's `python_open` function such that, it executes the script passed as an argument!

First, change 

```python
print(urlreq.urlopen("pytohn://something/random/file.txt"))
```
to
```python
urlArg = sys.argv[1]
urlreq.urlopen(urlArg)
```
this, and don't forget to add `import sys` at the top!

Now, our handler will read the URL passed as an argument instead of a hardcoded input! YAY!

Next, we need to edit the Handler - 
The previous code looked like this - 
```python
class PyProtoHandler(urlreq.BaseHandler):
    def python_open(self, req):
        fullUrl = req.get_full_url()
        filePath = "".join(fullUrl.split("://")[1:])
        return filePath
```

The new code will look like this - 
```python
class PyProtoHandler(urlreq.BaseHandler):
    def python_open(self, req):
        fullUrl = req.get_full_url()
        filePath = "".join(fullUrl.split("://")[1:])
        parsed_cmd = 'python {}'.format(filePath)
        subprocess.run(parsed_cmd, shell=True)
```

So, what did we change here? We created a new variable named `parsed_cmd`, which is a string containing a command that is executed by `subprocess` in the next line. And the result of the execution is printed automatically.

And, we are done with today's code!

# Lastly, Testing it!
Now we need to test our code!

We need to open our terminal(cmd or bash or whatever), locate to the directory where our code is located, run the file! So, let's do it! But remember to add a file path after the command! (depending upon your system.)

demo.py - 
{% gist https://gist.github.com/pybash1/820bc8f1467037964c98bb23b109b3af.js %}

```bash
$ python pyProto.py D:/Programming/Python/demo.py
If this printed then the code works!
```

# The End?
This was a short article since we just modified few parts of the code! But don't think it's over yet! Part 3 is coming soon! Hope to see you there! Also, I have changed the name of the file from `protoHandler.py` to `pyProto.py`. Also, there's a bonus for you, I have made a repository on my GitHub which contains code from all of my [dev.to](https://dev.to) Posts, including this one! Here is the link - [pybash1/devtoCode](https://github.com/pybash1/devtoCode)

And, Bye!!
An IDE for Data Science
Tags: datascience, ide, python
Published: 2021-04-17 12:03:10

A little over a year ago [I stated](https://dev.to/gabrielfallen/what-s-wrong-with-computational-notebooks-44oi) somewhat obvious hypothesis that JetBrains develops a specialized IDE for Data Science. Now it's [official](https://blog.jetbrains.com/blog/2021/03/30/announcing-the-eap-for-jetbrains-dataspell-our-new-data-science-ide/).
Daily Developer Jokes - Saturday, Apr 17, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-04-17 12:00:18

---
title: "Daily Developer Jokes - Saturday, Apr 17, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Saturday%2C%20Apr%2017%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258d992c4e.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ How do programming pirates pass method parameters?

___A:___ Varrrrarrrgs.
 -->
Should I learn Typescript before React?
Tags: reactnative, typescript
Published: 2021-04-17 11:56:40

The development world is quite famous for these short debates, whether to have knowledge of Typescript before React or vice-versa or is it better to have an understanding of React than Vue. So to clarify this confusion, we are writing this article to make your decision better.

<h3>What is Typescript</h3>

TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. TypeScript is designed for the development of large applications and transcompiles to JavaScript. As TypeScript is a superset of JavaScript, existing JavaScript programs are also valid TypeScript programs.  

<h3>What is React</h3>

React (also known as React.js or ReactJS) is an open-source, front-end, JavaScript library for building user interfaces or UI components. It is maintained by Facebook and a community of individual developers and companies. React can be used as a base in the development of single-page or mobile applications. However, React is only concerned with state management and rendering that state to the DOM, so creating React applications usually requires the use of additional libraries for routing, as well as certain client-side functionality.

<h3>What should you learn first</h3>

To be fair, this is something which totally varies from person to person. Some may prefer learning Typescript before React or React before Typescript. But if you think about it, it's better to learn React before learning Typescript because it helps in understanding more frameworks and is more demand-rich in the industry.

Thanks for reading. Hope this helps.
My first attempt at micro-SaaS; suggestions and feedback please.
Tags: startup, react, webdev
Published: 2021-04-17 11:49:56

One Friday evening, on pre-covid good old days, me and my friends went to a very busy fine dine restaurant in HSR Layout, Bangalore. There was a crowd in front of the restaurant, and two muscular men stood with a notepad, I gave my name and contact number, and we chilled around, occasionally pushing through the crowd to ask if our turn was up.

Later in the office, there was a free help checkup for all employees, and I went multiple times, only to come back because there was a big queue. Once the lockdown was announced, unable to go outside and chill our weekends, we saw on the TV or when we stepped outside were long queues. 

These few things made me think if there is some generic problem here that we could use technology to solve. Thus was born the idea of Simpl-Q (Simple Queue), a "generic" virtual crowd management website.

The idea was very simple. Instead of waiting in a queue, enter a link or scan a QR and wait using your smartphone. A virtual waiting room.

1. No standing in an unfair physical queue
2. No wondering if your turn is approaching.
2. Crowded businesses can use the system to make the customer waiting experience more delightful.

I worked on a basic prototype, iterated over it a couple of times (more on that, and some learnings [here](https://dev.to/daltonfury42/simplq-how-we-went-from-a-hackathon-project-to-a-fully-open-source-project-with-contributors-d0a)), and we have a fully working MVP now: http://simplq.me/



SimplQ is not a startup. It is just an idea and a MVP as of now. Honestly, it's more of a hobby project / experiment than a startup idea. We have no plans to monetize it. Our code is open source, we have around 30 active collaborators from around the globe who have contributed to the project. 

I am currently thinking of making an android app that would listen in to events on the queue that the user created ([here](https://github.com/SimplQ/simplQ-frontend/discussions/496)), and send out SMS in the background to the people when they join the queue. Otherwise thinking of how to market the app and get some real users. 

Thoughts? Looking for any feedback, ideas, or any advice. Thanks.
Manage all your home 🏡chores with this Notion Template🔥
Tags: productivity, watercooler, showdev
Published: 2021-04-17 11:02:16

Hey folks 👋🏼.
Just launched another Product on the Product hunt. It's a template that helps you optimize your housework 🏠 + your life ♥️ 

### Home Chore Manager
It's hard to make a new list for a task that repeats every day - introducing a feature that lets you set recurring tasks so that it updates on its own and relieves you of that work entirely. So now, check that task off, and be more productive! Make a proper chore list that is recurring and you'll be able to efficiently track it in the template.

{% youtube GaPn3I5GiUk %}

In this template, you'll get the following features -
### Add Chores
Add household chores you want to track and fill out these Properties

* **Frequency**: How often the chore should be repeated (Daily, Weekly, Bi-Weekly, Monthly, Seasonally, Semi-Annually, Annually)
* **Last Done**: An initial date for when you last did this chore
* **Assigned To**: For easily tracking chores for a household. Easy to  filter the tasks on a personal page to show only things assigned to yourself
* **Rooms**: Good to reference what room to do the chore in, especially useful if you want to have the same chore separated into different rooms
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bkset6v3hlodoz69jd8.png)

### Update Status
When you complete a chore, simply update the date in the Last Done
* The Do Next column will update automatically based on the frequency
* The Status will change to display Done
* The status will automatically update to let you know when the task is Due in # days, Due today, or Overdue.

### Calendar View
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oty667cmihd8hzaoi3r6.png)
Chores will be shown in the calendar view according to their Do next date. Users can use this section to keep a track of the present and upcoming day chores.

### Board view
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2b0ubso7th7m6ym4892e.png)
A board view of added chores makes it easy to move a task from one frequency to other just like those Kanban boards.

### Timeline View
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6yby6z4cwtiyq1zjiu5.png)
The timeline view lists down all the added chores. The view can be arranged for a week/month/quarter to keep track of chores.

### Want One?
![](https://media.giphy.com/media/2tRkw3A5ifszb1Wb3q/giphy.gif)
***Here is your link*** 👉 [***Home Chore Manager***](https://prototion.com/notion-for/home-chores-manager)

We are on Producthunt today. Go show some love here.
[![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73ulk3v29tdsb4lb0ie7.png)](https://www.producthunt.com/posts/notion-home-chores)
Introducing fcd: "faster cding"
Tags: terminal, showdev, package, npm
Published: 2021-04-17 10:13:05

Ever had to type out a long `cd ~/Sites/Projects/project`, find out the path is wrong, rewrite it to `cd ~/Sites/Sandbox/project`? You just wasted a minute or two. This inspired me to create a tool: `fcd`.

`fcd` is a utility which helps you `cd` faster on macOS.

You can directly use it in place of `cd` like so:

```sh
fcd /some/path/here
```

And what happens is the path to any folder with the same name as the `basename` of the input in the `dirname` of the input (basically, `/some/path/here` => `/some/path/**/here`) gets copied to your clipboard.

If this is confusing, then just read the README of the repo. And please leave a star if you find this useful!

{% github SiddharthShyniben/fcd no-readme %}
What’s New In Kubernetes 1.21?

Tags: kubernetes, technology
Published: 2021-04-17 09:49:17

In this world of technology, frameworks or development platforms are evolving to serve the best performance results to developers and users. And Kubernetes is not apart from this. It is a portable, extensible, open-source platform to manage containerized workloads and services, that facilitates declarative configuration and automation. It has large, rapidly growing ecosystem. Now, Kubernetes came with its new version Kubernetes 1.21 with some amazing features and improvements. But what are these new enhancements? Let’s dig in and find out.

#New Features Of Kubernetes 1.21-
**1. New Memory Manager-**
Container deployments are dependent on memory. And those deployments must use memory wisely, otherwise they could wind up  by draining your cluster of precious resources. Memory manager is a new feature in the ecosystem which enables guaranteed memory allocation for pods in the Guaranteed QoS class. With this, you will be able to find two different allocation strategies:

Single: NUMA is for high-performance and performance-sensitive apps.
Multi-NUMA defeats situation that can’t be managed with single-NUMA strategy
Memory manager initializes a memory table collection for every NUMA node that results in memory map objects. Memory table and memory maps are constructed like-

type MemoryTable struct {
 
        TotalMemSize uint64 `json:"total"`
        SystemReserved uint64 `json:"systemReserved"`
        Allocatable uint64 `json:"allocatable"`
        Reserved uint64 `json:"reserved"`
        Free uint64 `json:"free"`
}
 
type NodeState struct {
       NumberOfAssignments int `json:"numberOfAssignments"`
       MemoryMap map[v1.ResourceName]*MemoryTable `json:"memoryMap"`
       Nodes []int `json:"nodes"`
}
 
type NodeMap map[int]*NodeState

**2. Flexible Scheduler-**
Every workload is not the same. With release of 1.21 the scheduler will receive two new features- Nominated nodes and Pod affinity. 

Nominated nodes allow cloud native developers to define preferred node, by using .status.nominatedNodeName filed in Pod. If scheduler fils to fit incoming pod into preferred node, it will preempt lower-priority pods to make room.
Pod affinity selector allows developers to define node affinity into deployment. It allows developer to constrain which nodes pods will be scheduled on.

Know more at- [https://solaceinfotech.com/blog/whats-new-in-kubernetes-1-21/]
Laravel Validation digits Example

Tags: laravel, php, validation, example
Published: 2021-04-17 09:01:57

Hi Guys,

Today, I will learn you to create validation digits in laravel.we will show example of laravel validation digits.The field under validation must be numeric and must have an exact length of value.
more..
https://itwebtuts.blogspot.com/2021/04/laravel-validation-digits-example.html
Fitness Diet App Develop in react native by Yasir Munir for 724.one
Tags: reactnative, react, android, ios
Published: 2021-04-17 08:47:19

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a76lkuehmj0nxgom5mbi.png)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssgo6bufzmyc7mz0m59x.png)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6horrwr3xb2cdssd15lq.png)
This is a diet app, that help people to set there diet plan and select best food according to there body need. through this app a person control his fat and live a quality life.
Twitter clone app with Typetron
Tags: typetron, node, framework, typescript
Published: 2021-04-17 08:29:40

Hello fellow devs!
Need your feedback.

Really excited to present an actual working app (hopefully 😄) made with [Typetron](http://typetron.org/): [a Twitter clone app](https://github.com/typetron/example-twitter-clone). Here are some screenshots:

![Screenshot](https://raw.githubusercontent.com/typetron/example-twitter-clone/master/public/screenshot1.png)

![Screenshot](https://raw.githubusercontent.com/typetron/example-twitter-clone/master/public/screenshot2.png)

Questions you may have:
##### 1. What is Typetron?
[Typetron](https://typetron.org/) is a batteries-included (not yet, but I [will get it there](https://typetron.org/docs/)) Node.js framework written in Typescript that allows you to create web apps, especially backend APIs.

##### 2. Why did you build Typetron?
Building a framework was one of my side-projects created to learn how a web framework works and also, to learn Typescript. It was not my intention to create a competing framework 😅. After it was presented on a small local meetup, people there wanted to know more about it and therefore I created a website and added documentation. Then, after making some performance and developer-experience comparison with the other available frameworks, I decided Typetron is a good addition to the community and I continued working on it.

What do you think about it? Don't hesitate to leave a comment.

My Twitter - [@ionelLupu_](https://twitter.com/@ionelLupu_)
Typetron Twitter - [@Typetron_](https://twitter.com/Typetron_)
Website - [typetron.org](http://typetron.org/)
Combining SASS variables with CSS custom properties
Tags: css, scss, sass
Published: 2021-04-17 07:57:09

On the surface, both of these do the same thing. These will both set the background to red.

SCSS:
```
body {
  $red: #ff0000;
  background: $red;
}
```
CSS:
```
body {
  --red: #ff0000;
  background: var(--red);
}
```

But they are different.  [There's a CSS Tricks example that talks about some of these differences.](https://css-tricks.com/difference-between-types-of-css-variables/) 

There's a difference not mentioned in the article that tripped me up.

**SASS variables compile at runtime, CSS custom properties compile when they're used.**

I wanted to send a variable to a mixin, which requires a SASS variable - because it's compiling the mixin before it knows what the CSS custom property refers to.

But I also wanted a dark theme, which is much easier using CSS custom properties.

### There is a solution

You an combine them!

```
$black: #000000;
$white: #ffffff;

:root {
  --text-colour: #{$black};
  --bg-colour: #{$white};
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-colour: #{$white}
    --bg-colour: #{$black};
  }
}
```
To convert the SASS variable to a CSS custom property you put curly brackets around it, and a hash in front. If you've used template literals in JavaScript it's the same thing, just with a # instead of a $ (because we already have $ in the variable name). It's like someone just went for the next key over on a US keyboard.
How and where to start your food delivery business?
Tags: ubereats, ubereatsclone, ubereatscloneapp, ubereatsclonescript
Published: 2021-04-17 07:29:15

Online food delivery/ordering platforms like Zomato, Swiggy have seen huge growth and became popular in the industry. Especially with the people who have limited time to spend for cooking at home (i.e.,students and employees). Most of the people living in these cities where the cost of living is high and still finding affordable food can be a challenge. For that, this has opened up new business opportunities in the food industry.

Even if you're ready to start a business like Ubereats, simply you don't need to worry. Usually, launching such apps like Ubereats is quite a risky thing. When you launch such a platform, it requires months of research and app development to bring it live. That's too much work to execute. The best thing would be to use an <a href="https://www.foodesoft.com">Ubereats clone</a href> script which can customized as per your business needs.

Why I came forward to say this, the person whom i know was also trying to do the same and the Ubereats clone app saved him from having to waste a lot of money and time. Now, he could able to focus full time on the business.

Many of the software development companies that provide clones but what worked for him is Ubereats clone script called Foodesoft. Foodesoft is an app from a company called Exlcart Solutions and they are top-notch business providers in the industry right now.

For more enquiry, mail us to: support@foodesoft.com
assign in redirect
Tags: elixir, phoenix
Published: 2021-04-17 07:28:07

So, I just found out that if you are redirecting to other routes, the `assign` that you did in your `conn` wont be available to the next template.

That's because `assign` stores value in current request's connection struct and if we use 
```
conn
|> assign(:something, "sdf")
|> redirect(to: route)
```
it will never make it to another template.
Fixing "navigator is not defined" when using Codemirror with NextJS
Tags: nextjs, react, codemirror, bugfix
Published: 2021-04-17 00:03:32

If you have tried to implement CodeMirror in a NextJS project, you may have seen an error like this everytime you refresh the page:

![Navigator not defined error](https://firebasestorage.googleapis.com/v0/b/alonzoaustin-8314b.appspot.com/o/blogs%2Fnavigator%20is%20not%20defined.png?alt=media&token=8130dcb6-fb01-4338-8356-6702dd3038b2)

Instead of hoping that your user would not refresh the page or removing CodeMirror all together, you could try to fix it. Here's how.

Before starting ensure that you do have **react-codemirror** and **codemirror** installed. If not, copy and paste the following within your terminal

``` bash

// if you have npm

npm i codemirror

npm i react-codemirror

//if you have yarn

yarn add codemirror

yarn add react-codemirror

```

## Dynamic Importing

First, you need to make sure that you import `react-codemirror` and your desired themes and modes using **Dynamic imports**. To do this, import the dynamic function from NextJS normally as you would with any other npm/yarn package.

``` javascript

import dynamic from 'next/dynamic'

```

With this function imported, you can start to dynamically import react-codemirror and it's dependencies.  Keep in mind though that you have to dynamically import these outside your exported function. Create a const called **CodeMirror** and set it equal to the dynamic function. Inside the dynamic function,  import the dependencies (e.g. `import('codemirror/mode/xml/xml')`) and then return with `import('react-codemirror')`. After you have imported all of these, add an object within the function declaring `ssr: false`. In the end, it should look something like this:

``` javascript

const CodeMirror = dynamic(() => {
    import('codemirror/mode/xml/xml')
    import('codemirror/mode/javascript/javascript')
    import('codemirror/mode/css/css')
    import('codemirror/mode/markdown/markdown')
    import('codemirror/theme/material-ocean.css')
    return import('react-codemirror')
}, {ssr: false})

```

## Rendering

To include the CodeMirror element within your page/component, you first need to enclose it within brackets. After that, you can include everything else such as the value, options, and the onChange event. E.G.:

```javascript

{<CodeMirror
    className="editor"
    value={devLog}
    name= "Devlog"
    options={{
      theme: 'mdn-like',
      lineNumbers: true,
      mode: 'markdown'
    }}
    onChange={devLog => setDevLog(devLog)}
/>}

```
To ensure that it everything looks right and works the way you expect it to work (not having the textarea and editor being in two separate places or a bunch of x's), you should include the following in your **_app.js** file

``` javascript

import 'codemirror/lib/codemirror.css'

```

In the end, you and your users should be able to write code or write a markdown blog using CodeMirror without having to worry about refreshing the page only to see an error.