teleren/devto huggingface dataset:
History in cmd.exe
Tags: windows, cli, terminal, cmd
Published: 2020-01-27 16:12:58

I spend a lot of my time at the terminal for my daily work, mostly in Linux or wsl.  One big reason for using wsl over cmd.exe is the ease of walking through history that fzf provides.  This week we had a windows bug in a cli and I was stuck in vanilla cmd.exe 😭

## > Cmder

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

First off if you are stuck using cmd.exe, do yourself a favor and get cmder.  It makes life just a bit easier.  It is super confugurable and comes with several power ups that make it a bit more enjoyable than cmd.exe.

## History

**F7** - Scroll through history

**F8** - Search history based

## Example

![Example Gif](https://thepracticaldev.s3.amazonaws.com/i/tp0r6988eurx14ms5qij.gif)


## .bat

The next simple technique is to save your commands into a .bat file. Any valid command ran with cmd.exe can be saved into a bat file and called again later by running it in the terminal.

**save your command**

use f7/f8 to get your command back add `> filename.bat` at the end, hit the home key and add echo to the front.  **Do not** wrap with quotes.  This is not bash.

``` bash
echo python cmd_example.py > cmd_example.bat
```

**>> append**

``` bash
echo python cmd_example2.py >> cmd_example.bat
```

## type not cat

To ensure that you got the command right... and didn't forget that you were in cmd.exe instead of bash and add quotes. you will want to see the file contents. For this reach for **type** not **cat**.

``` bash
type cmd_example.bat
```

**results**
``` bash
python cmd_example.py
python cmd_example2.py
```
## Original Post

This was originally posed on my personal [blog](https://waylonwalker.com/blog/cmd-exe-tips/) on January 23, 2020.

## Your quick tips

Let me know what quick cmd.exe tips you have down below 👇
Links of the Week (4)
Published: 2020-01-27 16:08:47

* https://www.youtube.com/watch?v=pBuS7EUPnQA Entertaining talk about usability and the oddities of character encodings.
* https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/ A summary on Rust syntax.
* http://tomasp.net/blog/types-and-math.aspx/ I have almost zero knowledge on functional programming languages, and also no formal CS education, but a Physics one. I find it extremely interesting how theoretical CS could get.
Interview: Creating FastAPI from a collage of ideas and experience
Tags: python, opensource
Published: 2020-01-27 15:45:57

Hi there. I interviewed the creator of FastAPI (https://sourcesort.com/interview/sebastian-ramirez-fastapi) about his experience researching, designing and developing a Python API framework. I think it provides a lot of good insight into the work that goes into creating a successful open source product. FastAPI has grown pretty quickly (8k stars on GitHub) since it was released a little over a year ago and I think that is largely down to Sebastián's devotion to creating a great developer experience.

I hope there are some useful lessons here for other devs on here, and I welcome any feedback on the format/style of the interview.
The challenges I faced and solutions of my remote work journey so far
Published: 2020-01-27 15:37:06

Hello There, I'm Richard NSHIMYUMUKIZA. For this blog post, I'm going to share with you my experience with the first remote work I've ever done, it was so interesting. Deeply I will talk about the challenges I personally faced and even the solutions. Keep reading...

## The Challenges I faced!

Most of the time, when we learn new things that we don't know, it becomes bored somehow, it becomes difficult when you start working in the way you were not familiar with. So, there are many challenges I faced!

### The Internet

This is the biggest challenge I faced, Normally internet is a service that is sold by many service providers. In Rwanda, the internet that can be used in remote work can be somehow expensive for those who don't have any source of income and (I am one of those!).

It was very hard to find money for enough internet.

### The working Environment

We all know that a good environment can affect your productivity and that is a principal.
While I started working remotely I had a bad working environment and affected my work.

In the first time of my remote work, I used work from my room at home but the desk setup and enough light didn't allow me to work convenience and be productive.

### People around me.

It was so hard to tell people around me that I am doing my work. most of them used to know that when you have a job or any certain work you have to go to the office and there are hours to start and others for leaving the office, In my neighborhood there are few people know that someone can work at home.  

## The solutions!

### Internet

This is how I solved the problem of the Internet, I went to a place that has fast free internet. In Kigali city, there is a place called Klab, and that place is good for those who want to learn and work remotely so if you are in Kigali city I recommend you to join that place, it is so good.

### The working Environment.

To get the working environment, it took me also to get the Klab I told you above and there is a good place and it has a good working environment, there is a small cafeteria and also it is a quiet place, so to me it was a good environment.

### People around me.

It took me time to convince people about what kind of work I do, and how I do that work, Something that helped is to tell them how the remote work is like how you can accomplish your work and reach out a message on a phone or send the work on WhatsApp in order to let them Understand that kind of job, which you can do wherever you are.

It was a pleasure to share with you how my first remote work. 

                               
                              -- Chills --
What are your thoughts on Tailwind CSS?
Tags: discuss, css
Published: 2020-01-27 15:20:04

Photo by [Mahkeo](https://unsplash.com/@mahkeo?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](Photo by Mahkeo on Unsplash)

I'm curious what people's thoughts are on [Tailwind CSS](https://tailwindcss.com). I'm a big fan of [Refactoring UI](https://refactoringui.com/) (part of my [frontend developer resources](https://dev.to/nickytonline/frontend-developer-resources-246j)), so that's how I came across Tailwind.

The use of utility classes seems appealing, but also potentially overwhelming. On the other hand, having all these utility classes could be nice instead of going all bespoke.

I have not used it myself, but I'm planning on doing so in the very near future to take it for a test drive. I'm curious what others experience in the community has been using it.

![Dog owner asking their dog what they think](https://media.giphy.com/media/ehPJStXAXeHEBD18M5/giphy.gif)
Using Window.localStorage with React
Tags: react, localstorage, typescript
Published: 2020-01-27 15:12:32

---
title: Using Window.localStorage with React
published: true
description: 
tags: react, localstorage, typescript,
cover_image: https://thepracticaldev.s3.amazonaws.com/i/tghd5vepvnw03qs2yula.jpg
series: React and Material UI
---

# React doesn't remember anything.. localStorage does!

To make the `Home` component able to restore the last fetched matchday, I can use the `localStorage` object.

`Window.localStorage` is a small memory hosted by the clients' browser and it can be used to store some "helpers" values. To learn more about it, take a look at https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage.

# Fetching the last fetched matchday

So, in the `Home.tsx`

```typescript
constructor(props: IProps) {
  super(props);
  
  /** localStorage **/
  let matchday;
  if (localStorage.getItem('lastFetchedMatchday')) {
    matchday = Number(localStorage.getItem('lastFetchedMatchday'));
  } else {
    matchday = 1;
    localStorage.setItem('lastFetchedMatchday', matchday.toString());
  }
  /** localStorage **/
  
  this.state = {
    matchday,
    matches: [],
    competition: null,
    error: false,
    totalMatchdays: 38,
  };
}
```

The code above, before setting the initial state, checks for a record in the `localStorage`. This record is a key, value pair with the key equal to `lastFetchedMatchday`.

At line 7 I used [`Number(...)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/Number) because the value I got from `localStorage` is a `string` and it needed to be converted into a `number` (as defined with the `interface`).

# Setting the last fetched matchday

The value I fetch from the `localStorage` needs to be set somewhere in the application. It makes sense to me setting it when I select a new matchday from the `select` element.

```typescript
handleChange = (event: any) => {
  this.setState({ matchday: event.target.value }, () => {
    /** localStorage **/
    localStorage.setItem('lastFetchedMatchday', this.state.matchday.toString());
    /** localStorage **/
    this.fetch();
  });
};
```

As before, I used `this.state.matchday.toString()` because `localStorage` stores strings as I can see from the method definition

> Storage.setItem(key: string, value: string): void

# Conclusion

At this point, once picked a matchday from the select, I don't lose my last selection even if I reload the page or if I close the browser.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/xj1mc8al1dw8wu7ypmgh.gif)
Re-Programming My Life Through Programming
Published: 2020-01-27 14:57:39

So I'm not the greatest at this whole blogging thing, but I guess I'll be starting with a bit of introductions. Hi! I'm Lucas, I'm an artist, illustrator, an aspiring writer and a budding web developer in training at Juno College of Technology. Now I'll super honest, if you asked me less than a year ago if I would even think about getting into the world of programming, I would be saying that that's far beyond my world. Then again, me at that time was working in a rut at customer service jobs, but felt like I couldn't go anywhere further than that.

I definitely felt like I was stuck, my anxieties from the stresses working in that kind of environment really got to me, to the point where I couldn't focus on my passions or interests. I felt emotionally, mentally and physically drained every day and I needed a change of pace, but at the time I thought I had nowhere to turn. My creative experiences wouldn't land me a stable/reliable career, and all my other experience was all customer service related. 
Now not to get too heavy on the topic, but I will admit, being in that sort of environment was not great on my mental health. It wasn't until my partner (who has graduated from Juno a few years back) suggested that I try my hand at web dev. Not long from there, I took an online course for some basics, and despite finding it very difficult to comprehend, I found it very interesting.

 fast forward a couple months, I decide to go full force into this, I saved up some money and went to the accelerated web dev and javascript courses and it totally broke me…but at the same time I think it was the best decision I've made in a long time. It was so challenging but it helped me think in such a different way, and I learned so much from it. What I got out the most was probably the sense of comradery, just from the couple weeks there, it was definitely something special. 

Now after finishing the first week of the immersive bootcamp, I can safely say that I have made the right choice. I took a chance in spite of all my anxieties trying to hold me back, and already I feel like I've grown so much. I expect this is only going to get more challenging, but I am very much ready to tackle this and make the most of it, and at the very least, I'll be trudging through the trenches with an awesome cohort.
How often do you create a contact form for a website? How you do it? What's your stack ? What do you use to create it?
Tags: website, html, javascript, css
Published: 2020-01-27 14:57:33

---
title: How often do you create a contact form for a website? How you do it? What's your stack ? What do you use to create it?
published: true
description: How often do you create a contact form for a website? How you do it? What's your stack ? What do you use to create it?
tags: website, html, javascript, css
---
Simplifying Social Login For Your Web Applications
Published: 2020-01-27 14:31:04

<p>A standard feature in most modern web applications is the ability to log in or register using accounts that you already own on other sites such as Google, Facebook, or Twitter. Building your own integrations for each service can be complex and time consuming, distracting you from the features that you and your users actually care about. Fortunately the Python social auth library makes it easy to support third party authentication with a large and growing number of services with minimal effort. In this episode Matías Aguirre discusses his motivation for creating the library, how he has designed it to allow for flexibility and ease of use, and the benefits of delegating identity and authentication to third parties rather than managing passwords yourself.</p><p><a href='https://www.pythonpodcast.com/python-social-auth-social-login-episode-247/'>Listen Now!</a></p>
Daily Challenge #173 - Pandemia
Tags: challenge
Published: 2020-01-27 14:30:14

---
title: Daily Challenge #173 - Pandemia
published: true
series: Daily Challenge
description: [add a brief description of task]
tags: challenge
---
###Setup
In this challenge, the world has been hit with a new virus! There is a new pandemic that humanity is struggling to fight against. The continents are separated by oceans, but some infected people have traveled before the quarantine. 

You'll be given a map of the world in the form of a string:
<pre>s = "01000000X000X011X0X"

"0" : uninfected

"1" : infected

"X" : ocean</pre>

- If one person gets infected on a continent, the entire continent will get infected. 
- The first and last continents are not connected. 
- The virus cannot spread across the ocean. 
- For maps without `X`, there are no oceans so the entire planet would become infected, return `0%`
- For maps without `0` or `1`, there are no people, return `0`. 

Return the percentage of the population that are infected by the virus. 

###Example
<pre>
start: map1 = "01000000X000X011X0X"
 end:   map1 = "11111111X000X111X0X"
 total = 15
 infected = 11
 percentage = 100*11/15 = 73.33333333333333</pre>

###Tests
Which worlds are doomed? Which ones are saved?
<pre>
A: 01000000X000X011X0X
B: 01X000X010X011XX
C: XXXXX
D: 00000000X00X0000
E: 0000000010
F: 000001XXXX0010X1X00010
G: X00X000000X10X0100</pre>

Good luck!

***
_This [challenge](https://www.codewars.com/kata/5e2596a9ad937f002e510435) comes from JJason on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Pay Down Technical Debt In Your Data Pipeline With Great Expectations - Episode 117
Published: 2020-01-27 14:23:49

<p>Data pipelines are complicated and business critical pieces of technical infrastructure. Unfortunately they are also complex and difficult to test, leading to a significant amount of technical debt which contributes to slower iteration cycles. In this episode James Campbell describes how he helped create the Great Expectations framework to help you gain control and confidence in your data delivery workflows, the challenges of validating and monitoring the quality and accuracy of your data, and how you can use it in your own environments to improve your ability to move fast.</p><p><a href='https://www.dataengineeringpodcast.com/great-expectations-technical-debt-data-pipeline-episode-117/'>Listen Now!</a></p>
Can I run a server with the JAMstack model?
Tags: jamstack, jamuary
Published: 2020-01-26 22:07:22

A core principle of the JAMstack is that sites are not dependent on servers (i.e. origin servers in the traditional sense). Unlike conventional server side rendered sites, sites built on the JAMstack are rendered in advance (pre-request) and served to users directly from a CDN or edge server. Advancements in CDN technology has made it possible for JAMstack sites to run traditionally server side logic like authentication and role based redirects at the edge. In spite of these advancements, modern CDNs are not on par with full fledged origin servers. A notable difference between the two is in their level of configurability.

As opposed to servers that are configurable by the developer to the most minute detail, CDNs are preconfigured by the service provider like Fastly, Netlify and Akamai. Because custom logic available on the CDN is a low level implementation unique to the CDN, developers cannot add further functionality to the CDN. Without an application server or a language runtime, it is simply not possible to run a custom NodeJS, or Python backend on a CDN.

Running a server however doesn't preclude a site from being JAMstack. Sure, you can't run a server directly on the CDN, and rendering a site entirely server side isn't exactly JAMstack-like. But running a server that provides a service via an API perfectly falls within the realm of possibilities on the JAMstack. Often, within the JAMstack model, functionality is outsourced to external services in order to avoid the burden of having to build custom functionality. However, building custom logic for your application and running a separate server for it counts as JAMstack so long as the backend is decoupled from the frontend.
Implementing Spark in Spring-boot 
Tags: springboot, spark, restapi
Published: 2020-01-27 14:11:07

I am here to share you guys the integration of spark in the spring-boot application.

Usually spark is useful in multi-node/cluster environment.If you are using a single node cluster and using sparing-boot to submit jobs and getting workflow results to show somewhere in your web application.Then this approach will be straight forward way.The spring rest-api will launch spark jobs and the computed results will be given as a response.


{% github yashwanth2804/spring-spark-example %}

#Job Submissions

## Typical way

1. CLI

```
# Run application locally on 8 cores
./bin/spark-submit \
  --class org.apache.spark.examples.SparkPi \
  --master local[8] \
  /path/to/examples.jar \
  100

```
2. CURL

```
curl -X POST -d http://master-host:6066/v1/submissions/create --header "Content-Type:application/json" --data '{
  "action": "CreateSubmissionRequest",
  "appResource": "hdfs://localhost:9000/user/spark-examples_2.11-2.0.0.jar",
  "clientSparkVersion": "2.0.0",
  "appArgs": [ "10" ],
  "environmentVariables" : {
    "SPARK_ENV_LOADED" : "1"
  },
  "mainClass": "org.apache.spark.examples.SparkPi",
  "sparkProperties": {
    "spark.jars": "hdfs://localhost:9000/user/spark-examples_2.11-2.0.0.jar",
    "spark.driver.supervise":"false",
    "spark.executor.memory": "512m",
    "spark.driver.memory": "512m",
    "spark.submit.deployMode":"cluster",
    "spark.app.name": "SparkPi",
    "spark.master": "spark://master-host:6066"
  }
}

```


# Springboot rest api

```
http://localhost:8056/api/mongodb

```
My journey into tech
Tags: webdev, career, bootcamp
Published: 2020-01-27 14:09:09

I have always enjoyed working with computers. When I was a little kid, I would play around with my parent's computer, breaking it several times. I would play with any and all programs that were available (Paint! Microsoft Power Point! You name it)! As I grew up, I suddenly became the family's go-to "IT person," despite having no formal training. Using different software and learning new things just came naturally to me.

When the time came to choose a University course, I was drawn to any subject that steered clear of Math - which made me not even consider a Computer Science degree. I looked at all the Math behind it and ran as far away from it as I could, earning degrees in English and German.

After graduating University, I worked as a translator for several companies. I enjoyed the daily challenge, figuring out the solution to different problems, and never having a dull day. But after moving to Canada, I had to work any job that would allow me to earn more "Canadian experience." I started working different office jobs, in various fields, to pay the bills and insert myself in the Canadian workforce. One thing that stood out for me in all of those jobs, was how easily and quickly I would learn any new software, and how comfortable I was working with computers. In every job I had, I became (once again) the unofficial "IT person." As I began seeing a pattern, I decided it might be a good idea to pursue a career in IT.

Not having a lot of money to invest in more education, I enrolled in a free government program that would allow me to earn certifications in computer hardware and networking. It wasn't exactly what I wanted to do, but at least it was in IT! Once I was in, I figured, I could pivot into something I was more interested in: programming. Two months into the free course, I realized that it was not what I needed, and that it might not make a lot of sense for the path I actually wanted to pursue. I decided to get another office job, but this time for the sole objective of saving money to pursue the education that I needed.

While working and saving money, I researched the different areas within Computer Programming, and found Web Development very interesting. I enrolled in free online courses to learn the basics of HTML and CSS, and fell in love! I had found the career that I wanted to pursue. My only other obstacle was figuring out where to learn more advanced concepts and prepare for a career change. The more I read about bootcamps, the more interested I became. After visiting Juno and learning about how so many other people like me had changed careers into web development, I knew I had an easy choice to make. Two part-time courses later, here I am in their Web Development Immersive program, getting ready to be a web developer in a few months! I look forward to using all of my problem-solving skills to once again be in a career that will challenge me daily.
Cool tip for your next 1 on 1 meeting
Tags: management
Published: 2020-01-27 14:06:23

1 on 1 meetings are important, you already know it.

You might have those once every 6 months or maybe you do them on a weekly basis. it’s always hard to get your team members to open up instantly and tell you what is on their minds.

Very rarely those meeting goes as planned. Even if you got some kind of a check list of things you’d like accomplished in this meeting, it’s very hard to be effective.

You’d like to use those meetings to give some kind of a feedback to your guys from time to time. Either regarding their performance on a certain task or project or even their overall behavior working with peers or other stake holders within your company.

Those issues are not easy to discuss but ARE very important. how would you bring it up without upsetting your team member?

![1on1](https://miro.medium.com/max/600/1*7Nn1LPK6KTWryWZCzmrtHg.jpeg)

Here’s a small but VERY effective tip, I’ve used in the past.

Let’s say for example you’d like to address your team members’ performance on his / her last project. they didn’t do well.

He or she might have missed the time estimates and / or deadlines and the overall quality of the delivery was below average at best.

Present the following question to your team member: “How would you rate your work on the last project from 1 to 10”?

After taking few seconds to think about an answer that would be truthful but still won’t cause him or her to look bad, most people would give themselves a 7 or an 8.

There’s a catch here. As a manager you don’t really care about the grade given, it’s all about creating a discussion. If a grade other then 10 was given you should follow with this question: “Why a 7 (or any other grade for that matter)? What would have caused this task to be rated as a 10?”.
This will create an open discussion and will enable you give that feedback.

Try it and let me know what was the result in the comments.
Good Luck!