teleren/devto huggingface dataset:
JavaScript Interview Question #23: Array.splice
Tags: beginners, javascript, codenewbie, webdev
Published: 2021-02-25 14:08:24

![js-test-23](https://learn.coderslang.com/js-test-23.png)

How many times can you `splice` the array in JavaScript? What's the output?

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Let’s start with the definition of `splice`.

The function `splice` is available in all JavaScript arrays and accepts the variable number of parameters. Here are 4 important things you should know about `splice`:

- The first parameter is called `start` and represents the index of the first element that will be removed from the array.

- The second argument is `deleteCount`. It determines the number of array elements that will be removed from the array

- The third, the fourth argument, and so on, are the new elements that will be added to the array.
- The function `splice` returns the array formed by deleted elements.

Now, we start the array `arr` with 5 elements `[1, 2, 3, 4, 5]`.

The first `splice` extracts 2 elements starting from `arr[1]`. We immediately save them into the `splicedArr`.

Before the final splice we have the following state:

```javascript
[ 1, 4, 5 ]  // arr
[ 2, 3 ]     // splicedArr
```

The second `splice` once again removes 2 elements from `arr` starting at `arr[1]`. This leaves us with a single element — `1`.

Then, we apply the destructuring with `...` to the `splicedArr` and add elements `2` and `3` to the initial array `arr`.

Here’s the code snippet with 2 additional calls to `console.log` to help you understand the explanation better:

```javascript
  const arr = [1, 2, 3, 4, 5];
  const splicedArr = arr.splice(1, 2);

  console.log(arr);         // [ 1, 4, 5 ]
  console.log(splicedArr);  // [ 2, 3 ]

  arr.splice(1, 2, ...splicedArr);
  console.log(arr);
```

---

**ANSWER**: the array will eventually hold values `[ 1, 2, 3 ]` which will be logged to the console.

[Learn Full Stack JavaScript](https://js.coderslang.com)
Don’t just say hello in chat
Tags: productivity, career, discuss
Published: 2021-02-25 15:08:55

---
title: Don’t just say hello in chat
published: true
date: 2021-02-25 14:00:00 UTC
tags: productivity,career,discuss
canonical_url: https://santoshhari.wordpress.com/2021/02/25/dont-just-say-hello-in-chat/
---

So the official [Microsoft Twitter](https://twitter.com/microsoft) account dropped a tweet that deeply resonated with me.

> Please don’t just say hello in chat.
> 
> — Microsoft (@Microsoft) [February 24, 2021](https://twitter.com/Microsoft/status/1364712460452773897?ref_src=twsrc%5Etfw)

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

So what’s wrong with just saying hello in chat? For context, this assumes business chat like Teams or Slack. Well, consider the below exchange that happened earlier this week – Monday and Tuesday (aka Yesterday in below screenshot) – between me and a collaborator on a project.

[![](https://santoshhari.files.wordpress.com/2021/02/image-1.png?w=951)](https://santoshhari.files.wordpress.com/2021/02/image-1.png)

A collaborator (West Coast) messaged me (East Coast) after hours (for me) with a "Hi" and no context. I generally don’t respond to chat messages after hours unless someone tags it "Urgent" or "Important" – as is our standing team policy. Well, as you can gather from above exchange, I did not respond until nearly 15 hours after the initial message was posted and it took another 3 hours to arrive at the context "something was not/working". As we work remote (and global), asynchronous communication is not only important but also necessary. But asynchronous communication only works if we give it context. We’re hardwired to be polite but saying "hi" in chat and then waiting 18 hours to provide context is a recipe for failure when it comes to asynchronous communication. Other forms of saying "hello" in chat:

- "Hello X, got a minute?" (Instead: "Hello X, if have a minute can you please take a look at X?")
- "Hey! I have a quick question" (Instead: "Hey! _followed by actual question_)

For more examples, read [nohello.com](https://www.nohello.com/). On a related note, I find people who use _nohello_ as a permanent status on their chat as a little rude. So what is the solution? A passive aggressive chat bot that responds to Hi with a gif? Chime in with thoughts below

<img width="100%" style="width:100%" src="https://media.giphy.com/media/xT9IgG50Fb7Mi0prBC/giphy.gif" />

On a lighter note, that tweet evoked a hearty agreement from me, which lead to this hilarious exchange culminating in a response from the official Microsoft Twitter account. Always a good day when that happens.

> You're welcome.
> 
> — Microsoft (@Microsoft) [February 25, 2021](https://twitter.com/Microsoft/status/1364732487008616451?ref_src=twsrc%5Etfw)

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
JavaScript meetup videos from January
Tags: javascript
Published: 2021-02-25 13:54:29

Hi folks,

The best JavaScript meetup videos from January are here! This roundup covers a wide range of fun topics, including using JS with Plone, building a Minecraft clone in JS, and increasing productivity with Deno.

You can check them out here: https://blog.meetupfeed.io/javascript-meetup-videos-jan-2021/

Enjoy!
Best Angular videos from January
Tags: angular
Published: 2021-02-25 13:52:47

Hello there,

MeetupFeed's back with January's best and most relevant Angular meetup videos.

This time we've got resources covering topics like error monitoring, developing components, HMR (hot module replacement) NgRx selectors, OAuth 2.0, and finally, two videos about ag Grid: one for beginners, and another for advanced users.

Here's the link: https://blog.meetupfeed.io/angular-meetup-videos-jan-2021/

Happy learning,
Bence
Call for PyCon India 2020
Tags: python, conference, pycon, india
Published: 2021-02-25 13:45:24

Hello All,

This is to brief you about [**PyCon**](https://pycon.org/).

**PyCon** is the largest premier [Python](https://www.python.org/) conference hosted all around the world, mostly organized by volunteers from local Python communities.

So thus, [PyCon India](https://in.pycon.org/2020/) is the largest gathering of Pythonistas in India for the Python programming language. Which is scheduled to be held on Oct 2nd to Oct 5th on an online platform.

This year, with the unique scenario at hand, the conference has become more accessible to make your participation right from the comfort of your homes.

### Schedule & Venue

When: Oct 2nd to Oct 5th, 2020
Where: Online
Website: [in.pycon.org/2020](in.pycon.org/2020)

### Participation

Whether you are an experienced programmer, a hobby hacker, or an absolute beginner, PyCon welcomes you to the Python community.

The conference happens in a very precise format each year. 2 days of talks on over different topics, then 2 days of hands-on which starts with a workshop followed by dev sprint.

Get your passes from [here](https://in.pycon.org/2020/register/).

### Volunteering

Have you ever wished you could contribute or give back to the Python community? Well, here’s an awesome opportunity for you to do it with the year’s premier conference for the Python programming language, PyCon India 2020.

You can join any of the following groups as per your interests and skill sets and contribute.

- Media team
- Design team
- Content team
- Technology team

You can find various open tasks on [PyCon India Github](https://github.com/pythonindia) account. A few topics which welcomes your contributions are:

- Main Website: [pythonindia/inpycon2020](https://github.com/pythonindia/inpycon2020/issues)
- Blog Page: [pythonindia/inpycon-blog](https://github.com/pythonindia/inpycon-blog/issues)
- Conference Management Tool: [pythonindia/junction](https://github.com/pythonindia/junction/issues)

### Proposals

The conference welcomes talks of every level. Whether you are a beginner filling the proposal for your first talk or have been giving talks for the past 10+ years. It encourages everyone to draft a proposal, no matter the difficulty level.

You can learn more about it, get the current proposal list, and also submit your proposals [here](https://in.pycon.org/cfp/2020/proposals/).

The best way to get the latest updates on the conference, connect with the PyCon India community, or to get answers to your queries faster, is joining the [PyCon India Zulip Channel](https://pyconindia.zulipchat.com./).

See you at the conference!
Laravel how to apply a validation on a json_decode content ?
Tags: laravel
Published: 2021-02-25 13:21:10

Hello , I receive the form data via as a blob type 

```
$companyDetail = request()->file('companyDetail');
$companyDetailJson = json_decode($companyDetail->getContent(),true);
```

How to apply a validation on `$companyDetailJson ` ?

For example how to make : `$companyDetailJson ["director"]["name"]`  required ?

Thanks
JavaScript setInterval, how to schedule repeated execution with the delay
Tags: beginners, javascript, codenewbie, webdev
Published: 2021-02-25 13:19:24

Similar to [setTimeout](https://learn.coderslang.com/0025-javascript-settimeout-delay-the-function-execution/), which executes the callback function once, you can start the repeated execution of the function in JavaScript using `setInterval`.

## Starting `setInterval` timer

In JS, `setInterval` has the same params as `setTimeout`.

- `callback` - the function that should be called after a delay
- `delay` - in milliseconds

The `callback` goes into `setInterval` as the first argument, followed by the `delay`. When executed, `setInterval` sets the timer, which will call `callback` function each `delay` milliseconds.

```javascript
console.log('START!');
setInterval(() => console.log('bingo'), 2000);
```

We'll see the message `START!` in the console followed by the strings `bingo`, printed every 2 seconds on a new line.

```
START!
bingo
bingo
bingo
...
```

The function inside of `setInterval` can use external variables.

```javascript
const delay = 2;
let i = 1;

console.log('START!');
setInterval(() => {
  console.log(`message ${i}, appeared after ${delay * i++} seconds`), delay * 1000);
```

The output starts like this:

```
START!
message 1,
appeared after 2 seconds
message 2,
appeared after 4 seconds
message 3,
appeared after 6 seconds
message 4,
appeared after 8 seconds
```

And continues forever.

## Stopping `setInterval` execution

To stop the execution of `setInterval` in JavaScript, you should use the function `clearInterval`. To understand how it works, let’s go into detail:

- `setInterval` returns the object that holds all the data about the scheduled `callback` execution:

  ```javascript
  Timeout {
    _idleTimeout: 2000,
    _idlePrev: [TimersList],
    _idleNext: [TimersList],
    _idleStart: 141,
    _onTimeout: [Function],
    _timerArgs: undefined,
    _repeat: 2000,
    _destroyed: false,
    [Symbol(refed)]: true,
    [Symbol(asyncId)]: 5,
    [Symbol(triggerId)]: 1
  }
  ```

- this object can be saved into the variable

- when we don’t need the repeated interval calls anymore, we pass the `Timeout` object into the function `clearInterval`. The timer stops and our `callback` isn’t called anymore.

Code example:

```js
const delay = 2;
const limit = 2;
let i = 1;

console.log('START!');
const limitedInterval = setInterval(() => {
  console.log(`message ${i}, appeared after ${delay * i++} seconds`);
  
  if (i > limit) {
    clearInterval(limitedInterval);
  }
}, delay * 1000);
```

Anonymous function inside `setInterval` will be called only once. 

Then, the condition `i > limit` turns true, and the interval will be stopped with `clearInterval(limitedInterval)`.

```text
START!
message 1, appeared after 2 seconds
message 2, appeared after 4 seconds
```

[Learn Full Stack JavaScript](https://js.coderslang.com)
Scraping Washington Post with Python and Beautiful Soup
Published: 2021-02-25 13:15:31

Today we are going to see how we can scrape Washington Post articles using Python and BeautifulSoup in a simple and elegant manner.

The aim of this article is to get you started on a real-world problem solving while keeping it super simple so you get familiar and get practical results as fast as possible.

So the first thing we need is to make sure we have Python 3 installed. If not, you can just get Python 3 and get it installed before you proceed.

Then you can install beautiful soup with...
We will also need the libraries requests, lxml and soupsieve to fetch data, break it down to XML, and to use CSS selectors. Install them using...
Once installed open an editor and type in...

Now let's go to the Washington Post home page and inspect the data we can get.

Back to our code now. Let's try and get this data by pretending we are a browser like this...



If you run it..



Now let's use CSS selectors to get to the data we want... To do that let's go back to Chrome and open the inspect tool. We now need to get to all the articles... We notice that the with the class '.pb-layout-item.pb-f-homepage-story-ans' holds all the individual articles together.
If you notice, that the article title is contained in an element inside the assetWrapper class. We can get to it like this.
We can get to it like this.

This selects all the pb-layout-item article blocks and runs through them looking for the element and printing its text.
So when you run it you get.

Bingo!! we got the article titles...

Now with the same process, we get the class names of all the other data like article link and article summary..
That was fun.
If you want to use this in production and want to scale to thousands of links then you will find that you will get IP blocked easily by the Washington Post. In this scenario using a rotating proxy service to rotate IPs is almost a must.
Otherwise, you tend to get IP blocked a lot by automatic location, usage, and bot detection algorithms.
Our rotating proxy server Proxies API provides a simple API that can solve all IP Blocking problems instantly.

With millions of high speed rotating proxies located all over the world,
With our automatic IP rotation
With our automatic User-Agent-String rotation (which simulates requests from different, valid web browsers and web browser versions)
With our automatic CAPTCHA solving technology,
Hundreds of our customers have successfully solved the headache of IP blocks with a simple API.

The whole thing can be accessed by a simple API like below in any programming language.
Everything Supported
Published: 2021-02-25 13:10:10

# Big Heading

## Medium Heading

### Small Heading

*Italic*

**Bold**

[Link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining)

> This is a Quote

```javascript

{
"wp:term_id":\["3"\],"wp:term_taxonomy":\["post_tag"\],"wp:term_slug":\["dusra-tag"\],"wp:term_parent":\[""\],"wp:term_name":\["Dusra Tag"\],"wp:term_description":\["Dusra Tagwa"\]
}
```


---

<https://wordpress-import-851b.netlify.app/all-the-draftbox-things/>

<Bookmark cardInfo={{data: {"type":"bookmark","url":"https://wordpress-import-851b.netlify.app/all-the-draftbox-things/","metadata":{"url":"http://wp.ipldreampredictions.com/2021/02/23/all-the-draftbox-things/","title":"All the Draftbox things","description":"This is the excerpt","author":"Rahul Mehra","publisher":"WordPress Import","thumbnail":"https://wordpress-import-851b.netlify.app/static/ef6ef4d1339efff5221da40750ae5e4d/0ff54/b4a027d9-f3eb-400f-b324-37e9c9b0ca04.jpg","icon":"https://wordpress-import-851b.netlify.app/icons/icon-512x512.png?v=85845375398d29854defb85d7728a70b","thumbnailHeight":675,"thumbnailWidth":1200}}}}/>


<Image caption={"Caption"} size="default" src="https://draftbox-dev.s3.amazonaws.com/content/5edbf81bbcdef3a440a363c0/content_1614256500200.jpg" naturalHeight="2282" naturalWidth="4096" alt={null} />

<ImageGallery caption={"Caption"} items={[{"src":"https://draftbox-dev.s3.amazonaws.com/content/5edbf81bbcdef3a440a363c0/content_1614256529429.jpg","height":136.4353312302839,"width":242.9,"naturalHeight":1080,"naturalWidth":1920},{"src":"https://draftbox-dev.s3.amazonaws.com/content/5edbf81bbcdef3a440a363c0/content_1614256540926.png","height":136.4353312302839,"width":379.3,"naturalHeight":432,"naturalWidth":1200},{"src":"https://draftbox-dev.s3.amazonaws.com/content/5edbf81bbcdef3a440a363c0/content_1614256568912.jpg","height":136.4353312302839,"width":242.9,"naturalHeight":2160,"naturalWidth":3840}]} />


| a | aasa | asa |
|----|----|----|
|    | asas | asa |
| asas |    |    |


<HtmlSnippet data={{snippet:"<h2>HTML Buttons</h2>\n<p>HTML buttons are defined with the button tag:</p>\n\n<button>Click me</button>\n"}}/>

* asasasas
* asasa

1. asas
2. asasa


- [ ] Do this
- [ ] Do that


<Notice type="info">

Info

</Notice>

<Notice type="warning">

Warning

</Notice>

<Notice type="tip">

Tip

</Notice>

<Tweet caption={null} tweetLink="https://twitter.com/KevinJPowell/status/1364722134187188225"/>

<YouTube caption={null} youTubeId="ewfdRy5jfF8"/>

<Instagram caption={null} instagramId="CLs6AGnFX7L"/>

<Vimeo caption={null} vimeoId="510313986"/>

<CodePen caption={null} codePenId="jFxdn"/>

<Gist caption={null} id="d13e273314c3b3ade33f"/>

<Pin size="medium" caption={null} pinId="263038434469153003"/>

<CustomIframe caption={"Caption"} data={{html: "<iframe class=\"iframe-embed\" width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/DtX_lWfOJjM\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"}}  />
How to solve the "not in sync" error on Arduino IDE
Tags: arduino, c, tutorial, programming
Published: 2021-02-25 13:06:16

If you've ever coded for an Arduino, you're probably familiar with the Arduino IDE. Is your IDE just not uploading your sketch? Are you getting an error such as this?


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1614013525427/6NaWEQkj2.png)

If so, the fix is quite simple. First, locate the `Tools` section on the top bar of the Arduino IDE.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1614013862476/muxNYwQ3d.png)


Then, hover over the `Port` option.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1614013908338/YQM2ySkcW.png)

As you can see here, my Arduino UNO is located on serial port `/dev/ttyACM3`. Let's try uploading the sketch again.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1614014106789/eA2dMPle3.png)

The sketch is now uploaded! If you enjoyed this tutorial helpful, like it and share it with a friend!
Bootstrap v5 Navbar Component with Multi-Level and Mega Menu
Tags: bootstrap, navigation, responsive, frontend
Published: 2021-02-25 13:06:00

Do you need more than only 2 Levels for your Bootstrap Navbar? Or you find the original hamburger menu of Bootstrap kind of boring? Well, here's the code for free.

### Super simple example

I had to create this code for a client who sells themes with Bootstrap. So here's a little screenshot of the 2-level menu:

<img src="https://i.imgur.com/bON4eXO.jpg">

### More advanced Codepen Example

This example code shows a Navbar component of the Bootstrap Framework version 5 with the following new features added:

- Multi Level Menu
- Material Icons as Dropdown Icons
- Animated Hamburger Menu for Mobile Devices

{%codepen https://codepen.io/typo3-freelancer/pen/poEvyGj %}

### Use, share and make it better

Feel free to use all my codes in your projects. I would be happy to see projects online where you used my codes. Please tell me what you think by writing a comment, and don't forget to follow me ;-)

###If you have any questions, feel free to contact me:

https://simonkoehler.com/contact
When I expand shell variable which have tab chars or space chars, how it works.
Published: 2021-02-25 13:05:38

## Environment

- bash

## Problems

When I defined shell values such below, how is space chars or tab chars in variable processed?

```
packages='
    httpd
    postgresql
    redis
'

yum install ${packages}
```

## How to solve

It is expanded to `yum httpd postgresql redis`, and it works as expected.

## Description

Let's see how it is expanded with using `echo` command.

```
#!/bin/bash
# your code goes here

packages='
    httpd
    postgresql
    redis
'

echo ${packages}
echo '${packages}'
echo "${packages}"
```

**output**

```
httpd postgresql redis
${packages}

    httpd
    postgresql
    redis
```

https://ideone.com/XfbkBI

When I quote variable with double quote, it expand, but tab characters or space characters does not replaced with single space.
Daily Developer Jokes - Thursday, Feb 25, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-02-25 13:00:18

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

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

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

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

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

<!-- 
Joke text:
___Q:___ How many Prolog programmers does it take to change a lightbulb?

___A:___ Yes.
 -->
React File Upload with drag-n-drop and progress bar
Tags: react, typescript, javascript, nextjs
Published: 2021-02-25 12:46:20

I published a video explaining how to create a multiple file upload using react. 

In the video I explained some of the common problems people face when deploying to vercel, netlify, aws lambda and heroku.
 
To solve those problems I recommend some solutions in the video like Amazon S3, Azure blob storage, cloudinary, imgx, etc. 

We will use cloudinary because they offer a free demo account, which is great! :)

{% youtube MAw0lQKqjRA %}