teleren/devto huggingface dataset:
What is preventDefault() in JS?
Tags: javascript
Published: 2020-02-12 17:01:39

The [preventDefault()](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) method is used on the Event interface. It tells the the user agent (whether that be in the browser, bot, download manager, or another app accessing the Web) that if the event does not get explicitly handled, its default action should not be taken as it normally would be. This means that the default action of an even will not occur when [preventDefault()](https://www.w3schools.com/jsref/event_preventdefault.asp) method is used.

The preventDefault() method is used in many different JavaScript frameworks including but not limited to jQuery, React.js, and Angular.js.

You can see and example of it being used with Vanilla JavaScript [here](https://codepen.io/Andrewz_OS/pen/yLNNvzL?editors=1010) .

You can see and example of it being used with jQuery [here](https://codepen.io/Andrewz_OS/pen/jOPPZgb) .

In React.js we can use the preventDefault() method to prevent a browser reload or refresh. You can see and example of it being used with React [here](https://www.robinwieruch.de/react-preventdefault) .

You can see and example of it being used with Angular [here](http://logic24by7.com/angularjs-event-stoppropagation-and-event-preventdefault/).

PS: This was a question asked on [Quora](https://www.quora.com/What-is-event-preventDefault-in-JS).
Switching from Web to App development
Tags: webdev, appdev
Published: 2020-02-12 16:54:22

I’ve recently moved jobs and this switch has brought a few changes. The biggest one being I’m now developing for mobile apps. I initially thought this would be a hard task and sure, some languages can make it difficult to learn. As a developer with some Vue.js experience however it’s far easier than I imagined to switch fields.

If you don’t believe me, you can see for yourself in the NativeScript playground, which provides a code editor and an excellent set of tutorials to get you started so you can see for yourself how similar coding for apps is.

[NativeScript Playground](https://play.nativescript.org)

You don’t need any framework experience, though if you’ve used Angular or Vue before you might be more comfortable with those tutorials.

Switching fields is often a scary concept. In most cases this requires learning new languages specific to that field, but this is no longer the case for App development. Long gone are the days where Swift & Java ruled the mobile (though they are still valid ways of making apps if you want). The space has grown and is open to a wider variety of developers. 

If you have the opportunity to switch fields from App to Web or Web to App then try it out. You might surprise yourself.

[Play and Try NativeScript on Your Device – {N} Playground](https://play.nativescript.org)
Bootstrap Accordion Menu
Tags: todayilearned, todayisearched, css, html
Published: 2020-02-12 16:31:56


The accordion menu is used on the website to show your important links. So here we designed a simple and awsome accordion menu using bootstrap 4. Also, we customized some bootstrap classes.

In this element, we used some basic and minimal colors and font awesome icons on the link side and header side. Here we used the bootstrap element to make our menu more attractive. So we used a list-group component and also we used a collapse component to make an element. This is a responsive accordion menu for all views.
 
Make it yours now by using it, downloading it and please share it. we will design more elements for you.

GET SOURCECODE:-

https://w3hubs.com/bootstrap-accordion-menu/
Angular 9: What’s New?
Tags: angular, webdev, frontend
Published: 2020-02-12 16:22:50

---
title: Angular 9: What’s New?
published: true
description: Learn about the top seven features and upgrades we get with Angular 9
tags: #angular #webdev #frontend
canonical_url: https://auth0.com/blog/angular-9-whats-new/
---
Angular v9 is here! Along with it, we now get Ivy, the default compiler that can reduce bundle size, improve debugging, and much more. It’s been almost three years since Angular released an update this large (ironic, since this update makes the code smaller!), and we can see it’s been worth the wait.

In this article, we are going to go over how to update from v8 to v9 and the most Magnificent Seven things that Angular v9 has given us. There are many things we can look forward to in this update, let’s talk about some of our favorites!

[Read on 📖](https://auth0.com/blog/angular-9-whats-new/?utm_source=twitter&utm_medium=sc&utm_campaign=angular_9)
[solved] How to resolve this issue? "ssh: Could not resolve hostname github.com: nodename nor servname provided, or not known"?
Tags: ssh, zsh, nodeman, hostname
Published: 2020-02-12 16:21:13

If you are getting this in your terminal.

```
ssh: Could not resolve hostname github.com: nodename nor servname provided, or not known
```

and you are thinking that the problem is related to ssh or GitHub, then you are totally wrong.

Believe me, I made the same mistake 😅

The easiest way to resolve this issue to run this command in your terminal.

```sh
git config --global --unset http.proxy 
git config --global --unset https.proxy
```
Working remotely! YES or NO?
Tags: remote, beginners, codenewbie, todayilearned
Published: 2020-02-12 15:56:22

So, today I decided to ponder about working remotely!
Its' pros and cons, whether I really like it or no and is it even productive.

First of all, I noticed that on the days when I visit the office I am so drained out by the end of the day that I don't want to do anything anymore. This is related to a 2h daily commute that I need to tackle in order to get to the office and to the fact that working in the office quite honestly just takes more out of you due to always chatting with someone, joggling this and that and quite simple more things to do then just tasks at hand.
When I work at home I can easily do some extra work at 8PM, 9PM sometimes even 10PM. No problem. I am not tired from driving for 2h and working at home is quite simple more calming.

Secondly, I have to say(even though this is very specific from person to person) that my personal productivity level is better at home. And here I mean not the hours spent on work, no-no, I mean the overall amount of work done within a day! Obviously if you lack focus and can't sit for a while at a computer thinking about how to solve an unsolvable problem, maybe, this is not the way for you!

To conclude, I would like to say, that I really like working remotely!
My productivity is better. I can work more. I am not tired by the end of the day.

Did you try working remotely? Maybe with a friend?
How did it go? And if you haven't, why?

Tell me about your experience...
Welcome Thread - v60
Tags: welcome
Published: 2020-02-12 15:47:46

---
title: Welcome Thread - v60
published: true
description: Welcome to DEV! A thread of hellos and intros.
tags: welcome
---

![ralph hello](https://media.giphy.com/media/ASd0Ukj0y3qMM/giphy.gif)

### Welcome to DEV!

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

**Great to have you in the community!**
How to cqrs with message bus
Tags: cqrs, csharp, discuss
Published: 2020-02-12 15:41:43

Hey, I try to create an application with the cqrs pattern in. Net. So I use mediatr as command and query invoker.

This works very well for now. But I think that is to right coupled Between the Modules. Because I have one base application that serve some webapi Controllers and using nuget (satelite) pakages that contains the desired command and query Object and also the handler. These package will be tested independently. 

So my idea was to use any Bus system(asb, rabbitmq..) for "sending" messages (command and queries) between the Module. 

Is there any kind of good toolkit / Pattern /Way  for this? 

Or are I am on a wrong path for this and do a wrong descision?
Callback, Promise and Async/Await in JavaScript
Tags: javascript, node, tutorials
Published: 2020-02-13 07:11:52

---
title: Callback, Promise and Async/Await in JavaScript
published: true
date: 2020-02-12 15:37:36 UTC
tags: Javascript,javascript,node.js,tutorials
canonical_url: https://codesquery.com/callback-promise-and-async-await-in-javascript/
---

We all know that Javascript is a single-threaded. This means it has one call stack and one memory heap. I have already written an article on this topic, you can learn more about the call stack, event loop before going through the rest of this article. In this article, we are going to learn some [...]

The post [Callback, Promise and Async/Await in JavaScript](https://codesquery.com/callback-promise-and-async-await-in-javascript/) appeared first on [CodesQuery](https://codesquery.com).
Daily Challenge #185 - House Numbers Sum
Tags: challenge
Published: 2020-02-12 15:36:26

---
title: Daily Challenge #185 - House Numbers Sum
published: true
series: Daily Challenge
description: Count the number of houses seen on each block. 
tags: challenge
---
###Setup
A boy is walking home from school. To make the walk more enjoyable, he decides to add up the numbers of the houses he passes during his walk. Unfortunately, the numbers won't appear to him in any specific order, since he's regularly taking turns.

At some point during the walk, the boy encounters a house marked number _0_. This surprises him so much that he stops adding the numbers after that house to the total. 

For the given array of house numbers, determine the sum that the boy will get. There will always be at least one number 0 house on the path.

###Examples
`inputArray = [5, 1, 2, 3, 0, 1, 5, 0, 2]` => 11

`inputArray = [1, 4, 34, 124, 2, 0, 14, 51]` => 165

###Tests

`inputArray = [5, 1, 2, 3, 0, 1, 5, 0, 2]`

`inputArray = [4, 2, 1, 6, 0]`

`inputArray = [4, 1, 2, 3, 0, 10, 2]`

Good luck!
***
_This [challenge](https://www.codewars.com/kata/58880c6e79a0a3e459000004) comes from myjinxin2015 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!_
You will love Tailwind CSS
Tags: css, react, webpack, webdev
Published: 2020-02-12 15:27:05

# Intro
There are few technologies that I fell in love with. 
React is one of those, Redux is another, even if I don’t use it as much today.
**I never fell in love with a CSS framework, until I discovered [Tailwind](https://tailwindcss.com/)**, so I want to share my joy with you, sure that you will love it, too.

Briefly, Tailwind is one of those frameworks that make you write **long class names** like `text-3xl sm:text-5xl text-center font-gray-600 leading-tight` and this is the thing that scares most of the developers approaching it. 

In this post I’m going to tell you the main reasons why Tailwind is very good for me and my team, sorting them by the impact they have on my everyday “job to be done”.

# A built-in design system
I find myself creating better interfaces just because I use Tailwind.

It has a good design system built-in. What does it mean? **Tailwind limits your choices, lowering the cognitive load and making your design better.** 

There’s a fixed (overridable) and well-thought set of font-sizes, colors, paddings, widths, shadows and so on. When you use this low-level design system you have **more coherent interfaces** from day one.

# No context switching
**I work just on the JSX code**, without going back and forth to a CSS file. I almost never write CSS anymore. Super-productive!

# No naming problem
I am very fussy when it comes to naming things.
**With Tailwind no one in my team will ever write a new class with a name that I don’t like** 😊. Everyone uses the same self-explanatory classes.

On the other hand, I know everyone immediately understands the meaning of my CSS classes (I know the others don't like my names, too 😉).

# Complete, flexible, lightweight
**Everything can be customized** using `tailwind.config.js`: colors, fonts, spacings… everything! 

To make this work on a [React](https://reactjs.org/) / [Next.js](https://nextjs.org/) / [Gatsby](https://www.gatsbyjs.org/) project, you need to configure `postcss`. 
And this is great, because **it gives you a method, and a very good one**. 

When you have this configuration in place, not only you can configure the framework, but you can easily add `purgecss` to the equation and **remove all the unused styles**, dramatically reducing the size of the CSS bundle.

# Easy to learn
People may convince themself that a new way of doing things is great only if they **start doing things the new way**. And if a technology has a steep learning curve, the trial phase becomes a nightmare, the first impression is bad and the old way is the one that wins.

With Tailwind, **the onboarding process is as easy as throwing some classes in the code and seeing the result**. As soon as developers start using responsive utility variants, they are often already with you, pleased to use it.

#Conclusion
With Tailwind CSS I am more productive, more satisfied of my work and, at the end of the day, **I am happier 😃**. Try it to believe!
I create open source betting calculators
Tags: discuss
Published: 2020-02-12 15:12:07

---
title: I create open source betting calculators
published: true
tags: discuss
---

Hi, my name is Sergey and I like three things - programming, betting, and esport.

Now if I have free time, I create open source betting calculators/arbitrage/live dota2 generator links on dotapicker, etc.

Check it and get feedback, thx for attention!

https://gaserd.github.io/oddslootcalculator/

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jiptwntewr4tp8t50eyr.jpg)
Salesforce Classic slow in Chrome? Use Firefox until Spring ‘20
Tags: salesforce, tips
Published: 2020-02-12 16:19:33

---
title: Salesforce Classic slow in Chrome? Use Firefox until Spring ‘20
published: true
date: 2020-02-12 15:00:00 UTC
tags: salesforce,tips
cover_image: https://katiekodes.com/images/header-chrome-slow-20200212.png
canonical_url: https://katiekodes.com/salesforce-chrome-classic-slow-winter20/
---

Are your Salesforce "Classic" record pages loading slowly in Chrome, only to eventually load with broken content?

If you:

1. Are using Salesforce in Classic mode _(as opposed to Lightning Experience)_
2. Have special functionality embedded into record page layouts that, should you ask an admin/developer, turns out to be something called a "Visualforce component"
3. Experience minutes-long page load times on record detail pages
4. Notice that the "special embedded functionality" looks wrong when the page finally loads
5. Are using Chrome to log into Salesforce

Use Firefox for this week.

Chrome's latest update _("[SameSite](https://www.chromium.org/updates/same-site)" rules)_ broke certain features in Salesforce Classic.

According to Adam Gregory over on the Salesforce Developer discussion forum, things [should sort themselves out as soon as the org you're using updates from "Winter '20" to "Spring '20"](https://developer.salesforce.com/forums/?id=9062I000000XqQeQAK) -- which for many companies is this weekend.

I'm only experiencing the problem in a production org still on Winter '20, but not in a sandbox already on Spring '20, so switch to Firefox and be patient for a few more days!
How to use NFC tags with React Native
Tags: reactnative, webdev, javascript, beginners
Published: 2020-02-12 14:41:15

In this video, we explore using React Native library called react-native-nfc-manager to get NFC tags working for mobile development (in Android & iOS). NFC tags have heaps of uses, such as being able to have short range tags for prompting website links, directions, URLs or even youtube channels!
{% youtube Kx22B6OH3Oc%}
Items we cover include:
* What are NFC
* How can we use NFC Tags
* Getting NFC tag manager installed for React Native
* Using React Native to read and write NFC tags
* Using Windows/Apple to read and write NFC tags with GoToTags.

NFC on iOS 13:
https://gototags.com/blog/apple-expands-nfc-on-iphone-in-ios-13/

React Native NFC Manager:
https://github.com/whitedogg13/react-native-nfc-manager

## Follow and support me: 
Special thanks if you subscribe to my channel :)
* [Youtube](https://www.youtube.com/channel/UCvM5YYWwfLwpcQgbRr68JLQ?sub_confirmation=1)
* [Patreon](https://www.patreon.com/adriantwarog)
* [Twitter](https://twitter.com/twarogadrian)

## Want to see more:
I will try to post new great content every day. Here are the latest items:
* [Full Tutorial on how to use SASS to improve your CSS](https://dev.to/adriantwarog/full-tutorial-on-how-to-use-sass-to-improve-your-css-57on)
* [4 Simple CSS Hover Transitions for your Elements Background](https://dev.to/adriantwarog/4-simple-css-hover-transitions-for-your-elements-background-4mlg)
* [How to implement Dark Mode with CSS new media call: prefers-color-scheme](https://dev.to/adriantwarog/how-to-implement-dark-mode-with-css-new-media-call-prefers-color-scheme-3h65)
* [Creating a Mobile Design and Developing it](https://dev.to/adriantwarog/creating-a-mobile-design-and-developing-it-5c4o)
golang compiler
Tags: go, beginners
Published: 2020-02-12 14:38:20

If you have the <a href="https://golang.org/">Go programming language</a> installed on your computer, you can run Go programs. You can verify this by opening a terminal and typing 

```
go version
```

If it outputs an error like "command not found", you should <a href="https://golangr.com/install/">install</a> it. 


Then you can save your program as filename.go (the .go extension) and run it with:

```
go run filename.go
```

That then runs the program and outputs it in the terminal. What if you want to have a program?

Then you have to <a href="https://en.wikipedia.org/wiki/Compiler">compile</a> it. Compiling converts your source code into an actual program.

## Compile in Go

You can do so in a few steps. Open up a terminal (On Linux: Ctrl+Alt+t).
First create new directory for your project:

```bash
➜  ~ mkdir hello
➜  ~ cd hello
```

Now create your <a href="https://golangr.com/hello-world/">hello world</a> program with your favorite editor.

```
➜  hello vim hello.go
```

Do note I'm using a <a href="https://ohmyz.sh/">Zsh</a> theme so it puts the directory name in front. 
The hello world program:

```go
package main

import "fmt"

func main() {
	fmt.Println("Hello, world.")
}
```

Save it and exit the editor.
Now you can run the build command:

```
➜  hello go build hello.go
```

And you have an application that you can run

```
➜  hello ./hello
Hello, world.
```

That's it! Simple
Learning Nim: var vs let vs const
Tags: nim, codenewbie, beginners
Published: 2020-02-12 14:33:56

I've been exploring [Nim-lang](https://nim-lang.org/) these days. Its one of the new languages in town and if you're hearing about it the first time then you should definitely checkout this [FAQ](https://nim-lang.org/faq.html). 

``var, let and const`` all of them are used to hold value in Nim, but there are slight differences that beginners need to be aware of.

## **var**
`var` can be used in 3 different forms to define a variable.
```nim

# 1. Declare first and assign later.
var <variable-name>: <variable-type>
<variable-name> = <value> 

# 2. Declare and assign at the same time.
var <variable-name>: <variable-type> = <value>

# 3. Directly assign the variable, Nim compiler is smart
#    enough to guess the type of the value
var <variable-name> = <value>

# Following any case, the variable can be reassigned a value
<variable-name> = <value>
```
#### Can we change the type of the variable while reassigning?
```nim
# No
var x = 9
x = "string" #throws type mismatch error
```
## **let**

`let` also works like `var`, except `let` requires initialization and once the value is assigned, it cannot be changed.

```nim
let <variable-name>: <type> = <value> #works
let <variable-name> = <value> #works

let <variable-name>: <type> #ERROR
<variable-name> = <value> #ERROR
```
#### How about the following case?
```nim
let x = 9
let x = 10 #throws ERROR. It will be considered as redefinition of x.
```
## **const**
`const` keyword is used if we want to assign a constant value to a variable and the value is known while writing the code. Once a value is assigned to it, it cannot be reassigned.

```nim
const <variable-name>: <type> = <value> #works
const <variable-name> = <value>

const <vaiable-name>: <type> #ERROR
<variable-name> = <value> #ERROR
```
#### But then what's the difference between `const` and `let`?
const and let are almost the same except that const expressions are evaluated at compile time and let expressions are evaluated at run time. For example:

```nim
var x = 9
let y = x+2 #works
const z = x+2 #throws ERROR
```
The compiler needs an absolute value for a constant expression that can be bound to the variable at compile time.



If you learnt something, hit ❤️ and share. Others deserve learning too 🙂
Return in Functions – JavaScript Series – Part 19
Tags: javascript, tutorial, codenewbie, beginners
Published: 2020-02-12 14:28:48

Until now we didn’t worked with the return in functions. But there is a return in function

If we don’t write anything in return then it just return undefined. But we can return anything. Like – integer, string etc.

Let’s make our hand dirty by coding

Suppose in function we are going to two parameter. One is name and another is dialouge. Now we are going to print it on the console using return within a function

Now get the values from params first and put it inside a new variable. Now we are going to return this variable.

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

Now we need to change our function call. Because this function is not doing anything. It is returning something, we are going to catch the value and print it.

This step is a pretty easy to. Just initial a variable by calling the function

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

See the result in browser –

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


You can see the graphical version here
{% instagram B8eAz4MAABq %}

Source Codes - { Check commits }
{% github nerdjfpb/javaScript-Series %}

Originally it published on [nerdjfpbblog](https://blog.nerdjfpb.com/javascript-part-19/). You can connect with me in [twitter](https://twitter.com/nerdjfpb) or [linkedin](https://www.linkedin.com/in/nerdjfpb/)!