teleren/devto huggingface dataset:
Vanilla JavaScript Replace All Whitespaces
Tags: javascript
Published: 2020-08-12 05:58:18

Today we'll be looking into a widespread use case; we want to replace all whitespace occurrences from a string. Think about an input we want to save as a URL, and we need to replace the whitespaces with dashes. Or an image where we need to remove them.

## JavaScript Replace All Whitespace

To remove all whitespaces, we have multiple options, but the best one is to use a regular expression.

Let's say we have the following string:

```js
var string = "You've got a friend in me.";
```

And let's first start by just removing the whitespaces:

```js
console.log(string.replace(/\s/g, ''));
// You'vegotafriendinme.
```

Now let's try and replace them all for dashes:

```js
console.log(string.replace(/\s/g, '-'));
// You've-got-a-friend-in-me.
```

Awesome!

So how does this regular expression work?

`\s` means any whitespace character and `g` means it's a global modifier and must match any search occurrences!

You can have a play with this on Codepen.

{% codepen https://codepen.io/rebelchris/pen/gOraRyP default-tab=js,result %}

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
How low code business app builder benefits people?
Tags: appbuilder
Published: 2020-08-12 05:37:20

The low code platform provides business people with the ability to create online applications
For enterprises, the employees may not be possible to develop software due to a lack of professional knowledge, resulting in inefficiency and other losses. However, the no code app builder platformenables them to build online applications by themselves. This will become the motivation to attract business people to continue to use the low code platform, which also explains why the low code business app builder is gradually accepted by customers.
https://www.yeeflow.com/enterprise
Secure code review: Part 3 - Test for vulnerabilities introduced by dependencies
Tags: security, codequality, codenewbie
Published: 2020-08-12 05:14:26

Code reviews are hard to do well. Particularly when you’re not entirely sure about the errors you should be looking for! The DevSecOps approach pushes security testing left so that vulnerabilities can be found and fixed earlier, in the design, development, or CI/CD stages of the workflow. It’s always a good idea to check for security issues in code that you review. In case you don’t know what to look for, check out this series to give you pointers for your next code reviews!

## Test for new security vulnerabilities introduced by third-party open source dependencies

Modern application development is heavily dependent on third-party libraries. By using package managers like npm, Maven, Gradle PyPI, or any equivalent, we have easy access to publicly available libraries and frameworks. As developers, we want to focus on specific business logic and not so much on creating boilerplate functionality, using frameworks and libraries to do the heavy lifting is an obvious choice..

There’s a good chance you don’t know how many direct dependencies your application uses. When looking at an average project, the amount of your code can be as little as 1% — the rest is imported libraries and frameworks. A lot of code that is put into production is simply not ours, but we do depend on it heavily. It’s also extremely likely you don’t know how many transitive dependencies your application uses. Larger frameworks nowadays are depending on other libraries that also depend on other libraries. By pulling in a single library or framework, chances are that you are pulling in at least a dozen more libraries and/or frameworks, that you are not always aware of. This way dependencies are making up for the majority of your overall application. Attackers target open source dependencies more and more, as their reuse provides a malicious attacker with many victims. For this reason, it’s important to ensure there are no known vulnerabilities in the entire dependency tree of your application.

Let’s use [Snyk](https://app.snyk.io) as an example. Snyk statically analyzes your project to find vulnerable dependencies you may be using and helps you fix them. You can test your repos through Snyk’s UI to find issues, but also to keep users from adding new vulnerable libraries by testing pull requests and failing the test, if a new vulnerability was introduced. Automated fix PR’s are also an option.


Depending on how you like to work, you can choose to connect your repository to the Snyk UI or scan the project on your local machine using the CLI (check the [CLI cheat sheet](https://snyk.io/blog/snyk-cli-cheat-sheet/)), an integration in your build system, or a plugin in your IDE. From left (the developers’ local machine), to completely right (your system in production), and every step in between, you should analyze your dependencies automatically to ensure quick feedback.

## Want to know more
Check the complete [Secure code review cheat sheet](https://snyk.io/blog/secure-code-review/)
How to Use BITOR Function in MS Excel 365? – { with Examples }
Tags: bitorfunctioninexcel, excelfunctions
Published: 2020-08-13 04:11:26

---
title: How to Use BITOR Function in MS Excel 365? – { with Examples }
published: true
date: 2020-08-12 05:10:13 UTC
tags: BITORFunctioninExcel,ExcelFunctions
canonical_url: https://geekexcel.com/how-to-use-bitor-function-in-ms-excel-365-with-examples/
---

## BITOR Function in Excel:

In this article, we are going to explore the usage of **BITOR Function in Excel** 365 with basic syntax, and examples. This function is used to perform **bitwise OR** operation for each bit in the binary value. Let’s step into this article!!



## BITOR – Function Description:

- This function is used to find **Bitwise OR of two numbers** and returns the output as a decimal number.
- It will perform logical OR operation to each bit in the binary value. So it is not like a normal OR operator.

## Basic Syntax:

**=BITOR(number 1, number 2)**

### Parameter Description:

**Number 1 and Number 2** – These both parameters should be given in the decimal form that is greater than or equal to 0.

### **Note:**

- If any argument you have given is less than 0, it will return **#NUM!** Error value.
- If you give any of the arguments as non-numeric value ( **Letters and Special characters** ), it will return **#VALUE!** Error.

## Examples:

Let’s see some examples of the BITOR function and know how it works.

### Example 1: Bitwise OR of two numbers

- Kindly, refer to the below screenshot.
- Here the inputs are given in the cells ( **B2 and B3** ) as a decimal value, then get the output using **BITOR** function in the active cell **B4**.

![Example 1](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/08/1-16.png)<figcaption id="caption-attachment-11545">Example 1</figcaption>

- If any argument you have given is less than 0, it will return **#NUM!** Error value.

![Example 2](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/08/2-14.png)<figcaption id="caption-attachment-11546">Example 2</figcaption>

- If you give any of the arguments as non-numeric value, it will return **#VALUE!** Error.

![Example 3](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/08/3-13.png)<figcaption id="caption-attachment-11547">Example 3</figcaption>

## Sum-Up:

In the above article, you can clearly understand how to use **BITOR Function in Excel** 365 with syntax, description, and clear cut examples. Drop your **queries/suggestions** in the comments section. Thanks for visiting **[Geek Excel.](https://geekexcel.com/)** Keep Learning!!

### Read Also:

- [How to use DOLLAR Function in Microsoft Excel 365?](https://geekexcel.com/how-to-use-dollar-function-in-microsoft-excel-365/)
- [Use ISTEXT Function in Microsoft Excel 365 In Easy Ways!!](https://geekexcel.com/use-istext-function-in-microsoft-excel-365-in-easy-ways/)
- [How to Use T Function in Microsoft Excel 365? [With Examples]](https://geekexcel.com/how-to-use-t-function-in-microsoft-excel-365-with-examples/)
Getting Logs From Static Web Apps APIs
Tags: serverless, azure, webdev, staticwebapps
Published: 2020-08-13 01:40:40

---
title: Getting Logs From Static Web Apps APIs
published: true
date: 2020-08-12 04:35:09 UTC
tags: serverless,azure,webdev
canonical_url: https://www.aaron-powell.com/posts/2020-08-12-getting-logs-from-static-web-apps-apis/
---

I’ve been doing a lot recently with [Azure Static Web Apps](http://docs.microsoft.com/azure/static-web-apps?WT.mc_id=devto-blog-aapowell), mainly because I find it to be a service that really fits me needs. Sometimes though, I write code that has a bug in it, especially in the Functions backend, and that can be difficult to diagnose.

The other day I found myself in such a situation, the API worked locally, but when deployed to Azure it didn’t. _sigh_ And as the service is in preview the debugging story is still not great. _sigh again_

Now, we know that the API for the Static Web Apps is [Azure Functions](https://docs.microsoft.com/azure/azure-functions?WT.mc_id=devto-blog-aapowell) and Functions integrates with [App Insights](https://docs.microsoft.com/azure/azure-functions/functions-monitoring?WT.mc_id=aaronpowell-blog-aapowell), so I figured there has to be some way to tap into that.

First up, we need to create an [Application Insights](https://portal.azure.com/?WT.mc_id=devto-blog-aapowell#create/Microsoft.AppInsights) resource in Azure:

![Create a new resource](https://www.aaron-powell.com/images/getting-logs-from-swa/001.png)

Once the resource is created, copy the **Instrumentation Key** for it:

![Instrumentation Key location](https://www.aaron-powell.com/images/getting-logs-from-swa/002.png)

Now we can head over to our Static Web App, then navigate to it’s **Configuration** and click **Add** :

![Add Configuration](https://www.aaron-powell.com/images/getting-logs-from-swa/003.png)

We need to add a new configuration value named `APPINSIGHTS_INSTRUMENTATIONKEY` which has the value of your **Instrumentation Key**. Once this is saved the Functions are restarted and connected to App Insights. All that’s left is to start generating some errors and check out the `exceptions` query.

A bonus tip is that if you want to look at anything you write out to the logs of Azure Functions (`context.log` in JavaScript), they are available in the `traces` table.

## Conclusion

It’s not immediately obvious how to connect up a Static Web Apps backend API to App Insights, but as it’s Functions under the hood it really only takes a `APPINSIGHTS_INSTRUMENTATIONKEY` being set. And since configuration values are per-environment, you can use a different App Insights for your non-production instance easily.

And a shout-out to [Anthony Chu](https://anthonychu.ca/) who pointed me in this direction.
TIL: vararg in Kotlin is never nullable
Tags: kotlin
Published: 2020-08-11 18:40:47

---
title: TIL: vararg in Kotlin is never nullable
published: true
date: 2020-08-11 18:36:55 UTC
tags: kotlin
canonical_url: https://le0nidas.gr/2020/08/11/til-vararg-in-kotlin-is-never-nullable/
---

Today I came across a piece of code that looked like this:

```kotlin
fun printAll(vararg names: String?) { 
  names.forEach { name -> 
    println(name) 
  }
}
```

and noticed that the IDE did not complain about using `names` without checking if it is null `names?.forEach { ... }`!

After decompiling Kotlin’s bytecode I saw that no matter what type I use (`String?` or `String`) the java code was the same:

```java
public static final void printAll(@NotNull String... languages) { 
  //...
}
```

Does the Kotlin compiler ignore the nullable type completely? Turns out that yes!

And the reason is quite clear and straightforward but it hadn’t registered in my mind until now:

> Note that `vararg` parameters are, as a rule, never nullable, because in Java there is no good way to distinguish between passing `null` as the entire vararg array versus passing `null` as a single element of a non-null vararg array.
> 
> <cite><a href="https://discuss.kotlinlang.org/t/whether-it-is-the-only-way-to-convert-nullable-case-vararg-parameter-from-java-to-kotlin-replace-with-array-some/2120/2">kotlin’s forums</a></cite>

#### **What if we pass a null value**?

As a matter of fact if you pass a null value:

```kotlin
printAll(null)
```

the compiler makes sure that the java code will be called with a null value casted to the appropriate type:

```java
printAll((String)null);
```

which ends up in an array of strings that has one element!
Create a TypeScript React notification Component from zero
Tags: react, typescript
Published: 2020-08-12 04:06:11

Why not use the existing packages? They don't fulfill my requirements. I define the component to do:
1. Existing popular features should be there.
2. Totally written in TypeScript.
3. A framework to work with different UI frameworks like Material-UI. This means I could totally define the appearance being consistent.
4. Keep the codes neat and easy to understand, and easy to follow for extending.

So the task will be split into 3 parts or levels:
1. A pure TypeScript/JavaScript package with all features described and partially implemented.
2. A React component based on the previous package has a full implementation.
3. A Material-UI version to customize the appearance and behaviors.

Here is help link about how to create a repository: https://dev.to/garryxiao/build-a-react-components-npm-package-and-ci-cd-with-github-action-1jm6

Task 1:
Step 1: Create a repository at https://github.com/ETSOO/NotificationBase
Step 2: Architect, An abstract class Notification presents the message to display. A NotificationContainer class presents a global container for the components, includes add, remove, and registered methods.

Task 2:
Step 1: Create a repository: https://github.com/ETSOO/NotificationUI
Step 2: NotificationReact extends Notification<React.ReactNode> to support under React environment. NotificationDisplay is a React component to display notifications. It will register the update method to the NotificationContainer and achieve notifications add and remove actions.

Task 3:
Step 1: Create a repository: https://github.com/ETSOO/NotificationMU
Step 2: NotificationMU extends Notification<React.ReactNode> to support Material-UI framework. NotificationDisplayMU is a Material-UI implmentation for NotificationDisplay.

Task 4:
A shared package applied: https://github.com/ETSOO/Shared

Please follow the source codes to get a very basic understanding of architectural design. Use the template support of Github repository, split the requirements into 3 parts as micro packages. It may delay the development progress but would benefit the long-term maintenance and improvements.
Domain suggestion for URL Shortener
Tags: domain, help, watercooler, suggestion
Published: 2020-08-12 03:47:28

**UPDATE: I purchased the domain [https://qain.si](https://qain.si)**

👋 I am looking to buy a domain for my URL shortener service. 

My blog url is `qainsights.com`

I need the domain ideas which looks similar to `qainsights.com`, e.g. `qain.si`

Please throw your suggestions. 🙏
Why you should learn JavaScript-First
Tags: javascript, tutorial
Published: 2020-08-12 03:43:24

# Why learn JavaScript instead of another language?

Put simply, it comes down to educational / career opportunities. Most developers who’ve been coding for more than 5 years will probably agree that beginners should start off by learning one language and master it before learning another. The reasoning is that once you have a core understanding of the fundamentals such as variables, control structure, data structures (objects and arrays), functions/classes, and iteration (loops & recursion) it will be easier to pick up another language.

Being a browser-based language means anyone can learn the language, anywhere, and on practically any device. Moreover, the node.js runtime environment allows the language to go beyond that and run a server, mobile apps, hardware, AI, etc.

>JavaScript is easy to learn and you can use it to build just about anything from websites, mobile apps, servers and even hardware projects.

So if there is a single programming language beginners should learn in 2020 and master, it’s **gotta be JavaScript**.

Everyone has there own opinion on what their favorite language is and I'm not here to tell you about that. JavaScript isn't a perfect language, but it's also not a "weird" one. It's just a dynamic one.

A lot of people will say you should learn HTML, CSS and then JavaScript. It's certainly not a bad approach but keep in mind the two are not programming languages. One is for markup and the other is to style that markup.

# Here's my radical pitch. 

I'm writing an open-source book and I just released the early access to the first ~3 chapters. I want you to give it a try and provide some feedback. 

Unlike a lot of other books, this one isn't intended for you to read and nod along or buy to add to a bookshelf. It's meant to be interactive and collaborative and by the end (which isn't completed) you should know how to build a website, server in JavaScript, HTML and CSS (maybe a mobile app too).

Here is the link:
https://github.com/HansUXdev/JavaScript-First

It uses GitPod now, which means you don't need any programming experience or even an IDE (Integrated Developer Environment). You just a GitHub account and spin up a GitPod and follow along. If you get lost, don't worry. That's why I'm going to stream it on twitch. 

GitPod is new to me too and it's going to make me rewrite a lot of the book. But on the plus side it means, you won't need a specific OS or a fancy computer to learn, professional development, just a browser and some spare time during quarantine.
What is __name__  in Python Explained with Example
Tags: python, tutorial, codenewbie
Published: 2020-08-12 03:23:51

{% youtube MN9knCUTgwE %}
In this video, We will understand what is __name__ in python and how it is working with an example.


------------------------------SOCIAL------------------------------
Github: https://github.com/codingx01
Twitter: https://twitter.com/TechParida
Linkedin: https://www.linkedin.com/company/codingx/
Facebook: https://www.facebook.com/codingx
Instagram: https://www.instagram.com/coding.x/

Leave any questions in the comments section and don't forget to subscribe to be notified of new content! :)
How to break into Development
Published: 2020-08-12 02:47:03

I feel like this is probably a question that is asked frequently, but I know it's something that is very dependent on the individual. Why can't I ever land a Software Development job?

I finished my Bachelors in Software Development almost a year ago, in October of 2019. I have applied to so many software engineering, web development, etc. jobs that I can't even keep track any more. I have only received a few contacts back from hiring managers, and from those I have had even fewer interviews.

When I do finally get into an interview, it seems like everything goes great, but then I receive that dreaded email that they went with someone who "better fits what they are looking for", without even getting a chance to have a technical interview. 

I am curious what I can do to improve my chances here, or if there is anything obvious I might be missing?
The CSS Podcast: Episode Three - Specificity
Tags: css, specificity, coding, development
Published: 2020-08-12 02:44:36

---
title: The CSS Podcast: Episode Three - Specificity
published: true
description: Hello, I'm Brittney and I'm on a journey to write a podcast about every episode for The CSS Podcast. This is Episode Three, Specificity.
tags: #css, #specificity, #coding, #development
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/ii2s804y6dz0x7wiy6ar.png
canonical_url: https://console-logs.netlify.app/logs/css-podcast/#episode-three-specificity
---

![The CSS Podcast Banner](https://dev-to-uploads.s3.amazonaws.com/i/ii2s804y6dz0x7wiy6ar.png)

Hi, I'm Brittney and I'm on a journey to write a podcast about each episode for [The CSS Podcast](https://thecsspodcast.libsyn.com/003-specificity). I'm also an instructor over at [ZTM Academy](https://academy.zerotomastery.io/?affcode=441520_gjue7n-1) and the owner, designer, and developer at [bDesigned](www.bdesigned.dev). You can find more dev notes by me at [Console Logs](https://console-logs.netlify.com/).

## Episode Three: Specificity

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

#### Episode Links
[Diagram by Estelle Weyl](http://specifishity.com)<br/>
[Specificity Calculator](https://specificity.keegan.st)<br/><br/>

What happens when a subject is being targeted by multiple rules? The rule with the highest amount of points, or specificity, wins out. Specificity is how the browser decides which styles should be applied to an item. A weight or in this example points are given to each selector based on their ranking of least to most specific. Here's the game, we start at 0 and add up the number of points for each selector. If there is a tie, the last rule in the stylesheet wins. And no cheating by duplicating extra classes to your css 😜!

| Points   |   Selectors   |
|----------|---------------|
| 0        |  Universal/Not **`*`**/**`:not`**  |
| 1        | Element/Pseudo-element **`h1`**/**`::before`** |
| 10       |   Class/Pseudo-class **``.**/**`:focus`**   |
| 100      | ID **`#`** |
| 1000     |   Inline **`style`**   |

### Game Time

- *
- p
- main .header
- #nav ul li
- a:active
- a:not(:active)
- article a.outbound:not(:visited)
- a.lol.lol.lol.lol

Check your scores in the [specificity calculator](https://specificity.keegan.st). How did you do? Hopefully, this article helped you learn a little more about how to calculate specificity and apply it in your CSS! Cya next time :wave:!