teleren/devto huggingface dataset:
Don't see only what you want to see
Published: 2020-07-15 02:37:35

---
title: Don't see only what you want to see
published: true
date: 2020-07-14 00:00:00 UTC
tags: 
canonical_url: 
---

People have strong opinions. Some people are more passionate than others in their values and beliefs, but everyone has them. Making rational decisions where the emotion is strong is hard, overlooking the facts that don’t agree with our values is very often the default mode.

The scientific term for this behavior is [Confirmation Bias](https://en.wikipedia.org/wiki/Confirmation_bias#:~:text=Confirmation%20bias%20is%20the%20tendency,evidence%2Dbased%20decision%2Dmaking.). A tendency to favor or look for information that supports one’s personal belief, a very common [cognitive bias](https://www.verywellmind.com/what-is-a-cognitive-bias-2794963#:~:text=A%20cognitive%20bias%20is%20a,and%20judgments%20that%20they%20make.).

![Confirmation Bias](https://rishpandey.com/images/posts/confirmation-bias.png)

Take the example of Ed. He is a person with low self-esteem.

Any person who sends a text and doesn’t get a reply thinks the other party must be busy. In this situation, Ed thinks that the other person doesn’t like him and chose to not reply.

He is biased towards thinking bad about himself and will believe the occurrence or a piece of information that supports his existing belief. For Ed, neglect is the obvious conclusion where ignorance seems apparent.

The same behavior goes to show why eyewitnesses are considered unreliable. The Innocence Project researchers have reported that **73% of the 239 convictions overturned through DNA testing were based on eyewitness testimony**, [source](https://www.scientificamerican.com/article/do-the-eyes-have-it/).

A neighbor who doesn’t care for dogs and thinks dogs are dangerous sees a vicious dog attack an innocent child. A bystander who loves dogs sees the dog defending itself against a menacing child. Neither eyewitness account is reliable due to confirmation bias.

**So, what to do?**

- The first thing is to address that you may have confirmation bias where you have strong opinions.

- Be careful and educate yourself when making your mind about things in those areas.

- Go out into the world, discuss your thoughts with others. Surround yourself with a diverse group of people, and don’t be afraid to listen to dissenting views.Challenge yourself with disagreements and fruitful dialogs.

The true sake of an argument is to educate everyone involved in it.
Differences between alert, prompt and confirm methods in JavaScript
Tags: javascript
Published: 2020-07-14 00:00:00

---
  title: Differences between alert, prompt and confirm methods in JavaScript
  published: true
  tags: JavaScript
  date: Tue Jul 14 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/differences-alert-prompt-confirm
  cover_image: https://melvingeorge.me/_next/static/images/main-f1bc1bfdae17dfbb467e5d3f4c9ecfb9.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/differences-alert-prompt-confirm)
  
![a piece of paper hanging on a string](https://melvingeorge.me/_next/static/images/main-f1bc1bfdae17dfbb467e5d3f4c9ecfb9.jpg)

<p class="text-center">
  Photo by
  <a href="https://unsplash.com/photos/mdADGzyXCVE" target="blank">
    Kelly Sikkema
  </a>
</p>

## `alert()` method

The `alert()` method is used to show some quick alerts like warnings, errors, or information.

```javascript
alert("This is a warning! 🚫"); // alert shown
```

The method accepts a string as the argument to be shown to the user.

The alert will open as a modal like this.

![alert dialog shown in screen](https://melvingeorge.me/_next/static/images/alert_screenshot-31c5a1fa4300e513f132218306a93d16.png)

## `prompt()` method

The `prompt()` method is used to take input from the user.

```javascript
// get age using prompt method
const age = prompt("What is your age", 18);

console.log(age);
```

The method accepts a string as the first argument which is shown to the user and a placeholder value as the second argument.

![prompt dialog shown in screen](https://melvingeorge.me/_next/static/images/prompt_screenshot-bf0e35b49a6eca1edccf5e3e872be12d.png)

The method returns the value user entered if OK is pressed and `null` if cancel, is pressed.

## `confirm()` method

The `confirm()` method is used to ask the user about a condition. eg: `Do you want to continue?`.

```javascript
// ask user a condition
const continue = confirm("Do you want to continue?");

console.log(continue);
```

![confirm dialog shown in screen](https://melvingeorge.me/_next/static/images/confirm_screenshot-72dc17533848484ea2ad6ba09a80032c.png)

The method accepts a string as a parameter to be shown to the user.

If the user pressed `OK` the method will return boolean `true` and `false` if not.

### Feel free to share if you found this useful 😃.

---
Free HOSTING sites with Instructions
Tags: featured
Published: 2020-08-10 08:40:31

---
title: Free HOSTING sites with Instructions
published: true
date: 2020-07-14 00:00:00 UTC
tags: featured
canonical_url: 
---

Getting your website deployed is probably the first thing you want to do and with these 5 sites, you can do it in just minutes.

- [Firebase hosting](https://firebase.google.com/docs/hosting)
- [Netlify](https://www.netlify.com/)
- [Render](https://render.com/)
- [Surge](https://surge.sh/)
- [Vercel](https://vercel.com/)

# Firebase

With [Firebase hosting](https://firebase.google.com/docs/hosting), you can deploy web apps - both static and dynamic content by a single command.

Step 1. Install the Firebase CLI

```
npm install -g firebase-tools
```

Step 2. Sign into Firebase

```
firebase login
```

Step 3. Navigate into your project

```
firebase init
```

Step 4. Prepare your site

```
npm run build
```

Step 5. Deploy

```
firebase deploy
```

# Netlify

[Netlify](https://www.netlify.com/) supports GitHub, GitLab and Bitbucket, it will redeploy the site just by pushing the code without manually rebuild.

Step 1. Login to Netlify and select New site from git

Step 2. Choose your repository and configure settings with options:

- Branch to deploy, default `master`
- Build Command, default `npm run build`
- Publish directory, default `public`, but it is usually `public`, `dist`, `build`,…

Step 3. Select `Deploy site`

# Render

With [Render](https://render.com/), you can host static sites, backend APIs, databases, cron jobs, and all your other apps in one place.

Step 1. Login to Render and create a new Web Service and give access to your repository

Step 2. Enter your settings

- Environment: Static Site
- Build Command: e.g npm run build
- Publish Directory: e.g public, dist, build,…

Step 3. Select Create Web Service

# Surge

[Surge](https://surge.sh/) is a cloud platform to publish static webfor Front-End Developers.

Step 1. Install the surge CLI

```
npm install -g surge
```

Step 2. Build your site

```
npm run build
```

Step 3. Deploy your site providing your Publish Directory

```
surge public/
```

# Vercel

[Vercel](https://vercel.com/) is a cloud platform for websites and serverless APIs, free and easy to use

Step 1. Install the Vercel CLI

```
npm i -g vercel
```

Step 2. Deploy

```
vercel
```

## Conclusion

Deploy and hosting is fast and easy.
URL SHORTENER APPLICATION
Tags: android, node, java, javascript
Published: 2020-07-13 23:44:45

It's been almost 2 years since I made a URL Shortener application. In that, I used <b>Mongodb</b> and <b>Express</b> to build an <b>API</b> for <b>shortening</b> URLs and <b>redirecting</b> to the original URL using the shortened URL. I deployed the NoSQL database on <b>mLab</b> and the Backend on <b>Heroku</b> and later consumed this API in my Android Application using the <b>OkHttp</b> Networking library.

I feel such projects are although pretty common but how much depth and understanding we have about the working of each and every part of our application is what really matters in the end. 

Link to the project :

1) <a href="https://github.com/tanishq9/URL-Shortener-Android">Android Application</a> 
2) <a href="https://github.com/tanishq9/URL-Shortener">Backend</a>

Do drop a star on the repository incase you like it !

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/emta24kv9tq5dx4ul9jr.png)
Async/Await with JavaScript's Map Method: Using Promise.all
Published: 2020-07-13 23:20:21

### Introduction

This post will discuss using JavaScript's map method when dealing with async/await and promises. I'll be using a real-world example from my most recent project, viewable <a href="https://usa-covid-testing.netlify.app/">here</a>. 

### Async/Await  

To start, I first had to fetch data from The Covid Tracking Project's API, so I did it using `async/await`, like so: 

```javascript
  async function fetchTestingData() {

    const response = await axios.get(
      "https://covidtracking.com/api/v1/states/current.json"
    );

    return const data = response;

} 
```

The `await` keyword in the snippet above does what it describes: it forces the rest of the code to literally *await* the promise until it resolves. `Async` makes it so that the function *always* returns a promise.  

Without an async/await, the data variable *may* come back undefined, since it may not fetch the response from the API before the return executes. 

### Combining the Map Method with Async/Await  

The next step is to iterate over each state and attach coordinates, like so: 

```javascript
const addCoordinates = data.map(async state => {

    const coordinates = await axios.get(`https://exampleAPI.com/geocode/json?address=${state.stateName}`);

    state.coordinates = coordinates;

    return state 

  });

```

JavaScript's map method uses a callback to apply the function over each element of the array, which is fine. But recall that async functions always return a promise. As a result, you are returning an array of *promises*. 

To summarize: the map method is a synchronous operation, but we are trying to do something asynchronous here, which combined with `async/await` leads to an array of promises instead of values. 

### Using Promise.all with an Asynchronous Map Method

The solution here is to use Promise.all, like so: 

```javascript
const addCoordinates = data.map(async state => {

    const coordinates = await axios.get(`https://exampleAPI.com/geocode/json?address=${state.stateName}`);

    state.coordinates = coordinates;

    return state 

  });

  const allStatesWithCoordinates = Promise.all(addCoordinates);

```

Promise.all is designed to take an array of promises as input and returns only *one* promise after all input promises have resolved, meaning the output will be one of values.
Building a Neural Network on Amazon SageMaker with PyTorch Lightning
Tags: aws, sagemaker, machinelearning, pytorch
Published: 2020-08-30 21:57:34

---
title: Building a Neural Network on Amazon SageMaker with PyTorch Lightning
published: true
date: 2020-07-13 23:17:40 UTC
tags: aws, sagemaker, machinelearning, pytorch
canonical_url: https://towardsdatascience.com/building-a-neural-network-on-amazon-sagemaker-with-pytorch-lightning-63730ec740ea
---

[![](https://cdn-images-1.medium.com/max/1920/1*3tQ4tDDAZHNqpjVQi36HkA.jpeg)](https://towardsdatascience.com/building-a-neural-network-on-amazon-sagemaker-with-pytorch-lightning-63730ec740ea?source=rss-6550450171ac------2)

Leverage the power of Amazon SageMaker and PyTorch Lightning to build ML models avoiding to manage boilerplate code and infrastructure.

[Continue reading on Towards Data Science »](https://towardsdatascience.com/building-a-neural-network-on-amazon-sagemaker-with-pytorch-lightning-63730ec740ea?source=rss-6550450171ac------2)
best latte Breville Barista Express Espresso Machine
Tags: beginners, sugesstionforbestlattemachine
Published: 2020-07-13 23:02:22

Breville Barista Express Espresso Machine is one of the best machine for making latte. Its top of the machine in the list of latte machines   
Features:
Durability                                                             
Very Convenient
Easy to clean 
Energy Efficient 
Digital Temperature 
The Barista Express automatically adjusts the water temperature for delicious Espresso. Its stainless feature gives its design a very impressive look. The coil heating system available in the machine. 
Power & Energy Efficient:
The 1600 watt and 120V heating systems available in machines that can work efficiently at any power system. 

The Breville Barista Latte machines are energy efficient as well because it automatically turns on standby mode and automatically off after 3 hours. 
 Buy from here : https://lattemachinehub.com/
Something out of Nothing: Null Object Pattern
Tags: ruby, beginners, oop, webdev
Published: 2020-07-13 22:58:50

_Originally published on [Beezwax.net](https://blog.beezwax.net/2020/07/13/something-out-of-nothing-null-object-pattern/)._

------

What is nothing? `nil`? `null`? `undefined`? A vast void of emptiness that fills your soul with dread? Oh sorry, that's just my stomach. 

We often think of nothing as... well, nothing. It's when something doesn't exist and therefore cannot be interacted with. So in our code, we try account for having nothing. No `User`? No problem. 

```ruby
def display_name
  if @user.present?
    @user.name.titlecase
  else
    "Guest User"
  end
end
```

Fixed it with a conditional. Right...?

But what happens when you want something else from the `User` elsewhere? Use another conditional? 

```ruby
def avatar
  if @user.present?
    @user.avatar
  else
    default_avatar
  end
end
```

Technically it would solve your problem for now, but soon there will a bunch of `if` statements cluttering your code when all you really want to do is simply call a method.

####Here's where the Null Object Pattern can come in handy.

What if instead of nothing, you had a something. Something that responded to the API of your object. That something would be the "null object"-- It is an object that represents when you have no object, kind of like a placeholder.

Instead of having to check whether or not you have a `User` object, you can ensure you always have something that will respond to your method calls by providing a null object that responds to the API of your object.

```ruby
class GuestUser
  def name
    "Guest User"
  end

  def avatar
    default_avatar
  end
end
```

Now you can use this `GuestUser` whenever you don't have a `User`.

```ruby
def initialize(user = GuestUser.new)
  @user = user
end

def display_name
  @user.name.titlecase
end

def avatar
  @user.avatar
end
```
As you can see in the above example, I've injected the `GuestUser` in as a default parameter in the constructor. Now if a `User` isn't passed in, the code will use the `GuestUser`, and no more need for additional conditionals!

To the keen eye, you'll notice that this Null Object Pattern is actually an example of Composition over Inheritance! Check out [this post on Composition over Inheritance](https://blog.beezwax.net/2020/06/29/composition-over-inheritance-with-javascript-examples/) if you'd like to learn more.

_The code examples are in Ruby, but the concept can be applied to any Object Oriented programming._

-----
_Cover photo by [Casey Horner](https://unsplash.com/@mischievous_penguins)._
Day 173: Same Sh!t, Different Toilet
Tags: hiphop, code, coding, lifelongdev
Published: 2020-07-13 22:33:46

_liner notes_:
- Saturday : Spent most of the day before the radio show cleaning out my van. I ordered a rug/carpet for the floor to help protect it from scratches. Especially when the frame I'll be building will be able to be slid in and out. Took everything I had in it out and mopped the floor. There were already a few scratches, so I ordered some cans of spray paint for metal to paint the whole floor. Time for the radio show. It was a solo show, but I think it went well. Had a great time as usual. The recording of this week's show is at https://kNOwBETTERHIPHOP.com

![Radio show episode image of a map of Oklahoma showing the Native American territories with the words July 11th 2020, Big Brain Ron](https://dev-to-uploads.s3.amazonaws.com/i/ykn5e8lyyrpfpy9pnnlc.jpg)

- Sunday : Got up early to finish up the post show promo posts. Picked up the spray paint I bought the day before. Spent some time cleaning up the floor of my van more and spray painted the floor. Good thing I bought 3 cans because I went through 2. After that, I mowed my lawn. Then I spent the rest of day working on a blog post for work and did some coding for my side project. I hooked up an admin section of the dashboard and got it connected to the database to show a list of groups and when you click one, the details of the group show up. I'm going to have it so that an admin can update/change the information. I also have a section for an admin to add a new group. Going to do a similar thing for users.

- Professional : Had a couple of meeting and a talk prep session earlier in the day. Wrote a whole bunch of my blog post. Just need to finish up a couple of sections, show and explain parts of the code and do some screen recordings. Oh and my Web Component has been merged into the main branch! Looks pretty good! Super happy it's in! Already have some new things I want to add for the next version. Also reached out to some friends about taking a tutorial I've been working on so I can get feedback from people outside the company.

- Personal : I'm pretty sore from yesterday. haha. Looked over the newly spray painted floor and touched up some spots, but it looked pretty good. Since I covered up some spots, I'll have to wait till tomorrow to put down the carpet.

![A star filled night sky taking up much of the photo over Port Angeles, Washington and distant mountains in the backgound at the bottom](https://dev-to-uploads.s3.amazonaws.com/i/maq4jo4ej9jn59h34cgo.png)

Going to work on the admin section of the dashboard and maybe start working on the YouTube integration. Maybe finish up the video sharing aspect of the side project. Want to get it out to users pretty soon. So over the weekend, Florida has once again set a record for the number of new cases of Corona virus in a single day, AGAIN! This time it's more than any other state EVER! Florida... I would say, same sh!t, different toilet, but it's more like worse sh!t, same toilet! Sigh...

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube RXaHaRoWogI %}
GatsbyJS Portfolio 
Tags: gatsby, react, javascript
Published: 2020-07-13 22:15:19

Hello everyone! I built my portfolio in GatsbyJS. 🙌
It's a very interesting technology.

[My Portfolio](https://viniciusdias.works)

This is my first post and I would appreciate to get some feedback in comments or some tips in [GitHub] (https://github.com/ViniciusmDias/portfolio). Thank you!!
Making a Form in Material UI with TextField and Button
Tags: dev, javascript
Published: 2020-07-13 22:01:16

---
layout: post
title:  Making a Form in Material UI with TextField and Button
tags: [ dev, javascript ]
description: How to make a form that accepts text input using Material UI
published: true
canonical_url: "https://thomasstep.com/blog/making-a-form-in-material-ui-with-textfield-and-button"
---
**Originally published at https://thomasstep.dev/blog/making-a-form-in-material-ui-with-textfield-and-button**

While working on my side project, I came across the need to have a form where some sort of text was given as input and when a button was clicked that input was captured and used in a subsequent API call. It turns out that the solution I went with was fairly easy to understand, but I wanted to make note of it either way.

Keep in mind that I am using Next.js/React and Material UI for this. The solution's code is below, but I will explain it first. I used a combination of React state and event listeners to accomplish this. First comes the form components themselves, a `TextField` and `Button` from Material UI. Next comes the state needed to hold onto the input given, which I just called `textFieldInput`. The `TextField` has an `onChange` event listener which captures anything that is given as input. I wrote a handler for this to simply update the `textFieldInput` state value with whatever is in the `TextField`. Next comes the `onClick` listener for the `Button`. Whenever that is clicked, I simply pull the value of `textFieldInput` out of the state and then I can use the current value that the user typed into the `TextField`. Voila.

```javascript
class FormClass extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      textFieldInput: '',
    };

    this.doSomethingWithInput = this.doSomethingWithInput.bind(this);
    this.handleTextFieldChange = this.handleTextFieldChange.bind(this);
  }

  handleTextFieldChange(event) {
    event.preventDefault();
    this.setState({
      textFieldInput: event.target.value,
    });
  }

  doSomethingWithInput(event) {
    event.preventDefault();
    const {
        textFieldInput,
      } = this.state;
    // Use textFieldInput
  }

  render() {
    return(
      <>
        <TextField id="filled-basic" label="Email" variant="filled" onChange={(e) => this.handleTextFieldChange(e)} />
        <Button
          variant="contained"
          startIcon={<AddIcon />}
          onClick={(e) => this.doSomethingWithInput(e)}
        />
      </>
    );
  }
}
```
I am getting an error while compiling the c++ code, please help me out to fix this.
Tags: cpp, programming, coding
Published: 2020-07-13 21:57:23

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


You can go through https://onlinegdb.com/Hy_FYU9JP to resolve the bug
rubico v1.2 release notes
Published: 2020-07-13 21:54:03

[rubico](https://github.com/a-synchronous/rubico) v1.2 is out! Here's a summary of the changes.

## v1.2.0
 * flatMap; map + flatten
 * transform(f, init), reduce(f, init); init can be a function
 * rubico/x/defaultsDeep - deeply assign defaults
 * rubico/x/isDeepEqual - left deeply equals right? eager version of eq.deep
 * rubico/x/find - get the first item in a collection that passes the test
 * rubico/x/forEach - execute a function for each item of a collection, returning input
 * rubico/x/is - directly checks the constructor
 * rubico/x/isEqual - left strictly equals right? eager version of eq
 * rubico/x/isObject - is object?
 * rubico/x/isString - is string?
 * rubico/x/pluck - create a new collection by getting a path from every item of an old collection
 * rubico/x/unionWith - create a flattened unique array with uniques given by a binary predicate

Also renamed rubico.js -> esm.js. This is for esm imports like
```javascript
import rubico from 'https://unpkg.com/rubico/esm.js'
```
How do you manage your reading lists?
Tags: discuss, productivity, learning
Published: 2020-07-13 21:49:21

Lately I've found myself with an ever-growing list of articles and papers in my To-Read list between newsletters, this very site, and interesting research papers that I find online.
It is becoming way more than I can read and process. 

How do you filter/prioritize/manage yours?

<span>Cover photo by <a href="https://unsplash.com/@brunobucar?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Bruno Bučar</a> on <a href="https://unsplash.com/s/photos/pile-of-newspaper?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>