teleren/devto huggingface dataset:
Mutual recursion in JavaScript
Tags: javascript, algorithms, beginners
Published: 2022-11-13 09:07:40

Mutual recursion is a subset of recursion where a pair of functions are defined in terms of each other.

```js
function isEven(n) {
  if (n === 0) {
    return true;
  }
  return isOdd(n - 1);
}

function isOdd(n) {
  if (n === 0) {
    return true;
  }
  return isEven(n - 1);
}
```

I didn't realize this was possible until I walked through each function call. Let's walk through the examples step by step:

## isEven(0)

```js
// 1
isEven(0) // => true
```

## isEven(1)

```js
// 1
isEven(1)

// 2
isOdd(0) // => false
```

## isEven(2)

```js
// 1
isEven(2)

// 2
isOdd(1)

// 3
isEven(0) // => true
```

## isEven(3)

```js
// 1
isEven(3)

// 2
isOdd(2)

// 3
isEven(1)

// 4
isOdd(0) // => false
```

## isEven(4)

```js
// 1
isEven(4)

// 2
isOdd(3)

// 3
isEven(2)

// 4
isOdd(1)

// 5
isEven(0) // => true
```

# Challenge

Now it's your turn! Try to walk through the following calls:

```js
isOdd(0) // => false
isOdd(1) // => true
isOdd(2) // => false
isOdd(3) // => true
isOdd(4) // => false
```
STOP DOING [INSERT VERY POPULAR THING]
Published: 2022-11-13 08:47:50

---
title: STOP DOING [INSERT VERY POPULAR THING]
published: true
description: 
tags: #discuss
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-13 08:30 +0000
---

It seems that there is a trend to make this kind of posts between new tech-authors. Well I am okay with it as long as it's the correct approach. But that doesn’t seem to be the case most of the time. And since most tech readers in these forums are beginners or juniors that is something unacceptable.

STOP USING ELSE 
STOP USING JWT
STOP USING [INSERT PROGRAMMING LANGUAGE]
STOP USING LOCALSTORAGE

List goes on but seeing this controversial = more reads mentality having a place in a very supportive community like programming just saddens me even though it is minority of the posts.
Perfection Undefined
Tags: beginners, career, productivity, codenewbie
Published: 2022-11-13 08:29:40

Hey my friend from the internet :wave: the journey you're in, there's no location called perfection. In your job there's no position, perfection. Your profession has no certification called perfection. Perfection is undefined.

Freely, I'll tell you - no one is perfect either and that shouldn't be the goal at all. I died the idea/notion of being perfect when I realized perfection is undefined, instead I've embraced Understanding. Understanding that new concept, understanding the base principles of a theory, understanding my field and its market, understanding why I'm in the Journey I'm in.

The beauty of Understanding is that it comes with a **realization** which in itself is a product of having dealt multiple times with that which you're trying to understand and questioning your process every single time. Trying to be perfect, places pressure on you and makes for vulnerability to imposter syndrome but trying to understand doesn't. Every failed attempt builds on your understanding as you get to see what doesn't work and for every successful attempt, you not only understand the right way to get it done but you also begin to see patterns to simplify the process and still achieve same or an even better result.

Understanding varies for different people, but when what you understand is right, every angle you take it from is right too. This is why two person could both understand a concept and when told to explain, they would use their own words/examples to convey it. The choice of words and example most likely is from the realization gotten when understanding the concept.

When you understand a process, you will follow it a million times easily, you might make some mistakes (imperfect nature of man) but you'll easily identify where that's from and easily fix it. At this point is where mastery comes in. This simply says you've mastered the process and know the behavior gotten/expected from each steps. Understanding a concept to point of mastery takes time, it requires you to get hands on and work it out. With understanding you know when to move on to the next thing, perfection keeps you stuck.

Every industry is changing rapidly and as a software developer, I wake up to meet new update in libraries, frameworks, methodologies and architectures, trying to perfect any of these will take more than eternity.

Pursue understanding instead by getting hands on, give yourself time and not allow failure get the best of you. Perfection is Undefined, breakout !!!

**Thank you for being AWESOME**

⏩Share with a colleague, friend and your social circle. Help someone breakout from Perfection Jail

❤️Hit the LIKE button and FOLLOW me so you're notified on future posts.

:coffee: Thanks to my [cup of coffee](https://www.buymeacoffee.com/spaceofmiah)

---

_Image Credit [Gerd Altmann](https://pixabay.com/users/geralt-9301/)_
New to Dev.to
Tags: beginners
Published: 2022-11-13 07:20:43

Starting 2014, my first personal free website from Blogger.com provided by Google. In 2016 I purchase my first domain name (haqem.com) with hosting at GoDaddy before I go to school, and at the current situation as a student I don't have enough money to pay next upcoming year and I decided to refund all the purchase from GoDaddy.

After 1 Years I decide again to have my self-hosted website and try to purchase my old domain, em unfortunately that domain is not available, and I try asked the Uniregistry to purchase the domain and you know what? They sell my name "Haqem.com" at USD$4,999. Whoa too expensive meh. I frustrated at that time! 

Then I'm waiting until 2018, finally the domain name is available to purchase. So happy to hear that sia, I faster make a purchase on Nov, 2018 for my name Haqem.com until now the domain still active.

Ok I think that's all for my personal now get back to main topic **New to Dev.to**. This my is my first post on November 2022 you can check it out my [GitHub](https://github.com/haqem).

Starting 2019 I'm working on CGPA Calculator ([Web App](https://haqem.com/cgpa) & [Android Apps](https://play.google.com/store/apps/details?id=com.haqem.cgpacalculator)), on 2021 I'm working on IPTV-Malaysia ([Haqem.com VOD](https://haqem.com/vod)) that can watch on my website.

The latest project that I make is creating a Quiz Game from Unity that can be found on my GitHub and I will update on Dev.to.

Also, I try to make my GitHub useful by using their features to make my website much better. 

_Psst! I got new project coming soon :)_

Follow me on GitHub for more update.

Thanks.
【Github】How to restore the status of the file in your working directory
Tags: github
Published: 2022-11-13 07:11:28

You are coding and you hit the command "git add ." and "commit -m XXX (comment) ." Then, you noticed some files that you believe that you have not changed on the ""modified files" list. Do not panic.

1.Hit "git reset --soft HEAD^" to cancel the commit.
2.Hit "git restore --staged <file path>" to unstage the file.
3.Hit "git diff -- <file path> " to check what has been changed in these files are really changed.
4.If you think that those changes would not be a problem, hit "git checkout <file path>" to restore the status of the file (restore the status before the commit was executed.)
<Notice> This is like a "transaction." If you hit "git checkout <file path>," those changes that were added to the file will not be
restored ,ever again. Make sure there would be no problem after you execute "git checkout."
【JavaScript】How to embed script in eventhandler
Tags: javascript
Published: 2022-11-13 07:10:44

When you want to use a JavaScript for event handler, you can embed the script directly as below.
```
<div id="element">Hello</div>
<button type="button" onclick="document.querySelector('#element').textContent='Clicked!'">Press Here</button>
```
As you know, this also works.
```
<div id="element">Hello</div>
<button type="button" onclick="changeText()'">Press Here</button>
...
<script>
function changeText(){
document.querySelector('#element').textContent='Clicked!'
}
</script>
```
How to use PySpark and Spark SQL , MatPlotLib and Seaborn in Azure Synapse Analytics and Spark Pool
Tags: azure, azuresynapse, bigdata, dataengineering
Published: 2022-11-13 07:05:29

How to use PySpark and Spark SQL , MatPlotLib and Seaborn in Azure Synapse Analytics

PySpark is an interface for Apache Spark in Python. It not only allows you to write Spark applications using Python APIs, but also provides the PySpark shell for interactively analyzing your data in a distributed environment. PySpark supports most of Spark’s features such as Spark SQL, DataFrame, Streaming, MLlib (Machine Learning) and Spark Core.

Spark SQL lets you query structured data inside Spark programs, using either SQL or a familiar DataFrame API. Usable in Java, Scala, Python and R.

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Matplotlib makes easy things easy and hard things possible.

Create publication quality plots.
Make interactive figures that can zoom, pan, update.
Customize visual style and layout.
Export to many file formats.
Embed in JupyterLab and Graphical User Interfaces.
Use a rich array of third-party packages built on Matplotlib.

Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics.


Azure Synapse Analytics is a limitless analytics service that brings together data integration, enterprise data warehousing, and big data analytics. It gives you the freedom to query data on your terms, using either serverless or dedicated options—at scale. Azure Synapse brings these worlds together with a unified experience to ingest, explore, prepare, transform, manage, and serve data for immediate BI and machine learning needs.

{% embed https://youtu.be/tft8JP4lz3w %}
What Is Web Scraping And how to do with azure Synapse and Python and Spark Pool
Tags: azure, azuresynapse, bigdata, dataengineering
Published: 2022-11-13 07:02:23

What is Web Scraping And how to do with azure Synapse and Python?

Web scraping is the process of gathering information from the Internet. Even copying and pasting the lyrics of your favorite song is a form of web scraping! However, the words “web scraping” usually refer to a process that involves automation.Automated web scraping can be a solution to speed up the data collection process. You write your code once, and it will get the information you want many times and from many pages.

{% embed https://youtu.be/J5VI-cZKZMM %}
【JavaScript(TypeScript)】The repeat() method
Tags: javascript, typescript
Published: 2022-11-13 07:02:18

The repeat() method returns a new string that consists of the specified number of copies of the string.

For example:
```
const catSound="meow";
console.log(Cat makes sounds "${catSound.repeat(5)}");
```
The console shows as below:
```
'Cat makes sounds "meowmeowmeowmeowmeow"' //"meow" is repeated 5 times as specified in the brackets.
```
If you specify the number "0"
```
'Cat makes sounds ""'
```
If you specify a negative number (e.g. -1) or an infinity number (e.g. 1/0)
It returns "Range Error."
Azure Data Factory - Incrementally load data from Azure SQL to Azure Data Lake using Watermark
Tags: azure, bigdata, azuredatafactory, dataengineering
Published: 2022-11-13 06:55:50

Azure Data Factory - Incrementally load data from Azure SQL to Azure Data Lake using Watermark
In a data integration solution, incrementally (or delta) loading data after an initial full data load is a widely used scenario. The tutorials in this section show you different ways of loading data incrementally by using Azure Data Factory.

In this case, you define a watermark in your source database. A watermark is a column that has the last updated time stamp or an incrementing key. The delta loading solution loads the changed data between an old watermark and a new watermark.

In this Demo we will do following

Introduction -Agenda of Demo
Create Azure SQL Database
Create Azure Data Lake
Create an Azure Data Factory
Create required tables/SP in Azure SQL
Create Linked Services
Create ADF Pipeline
Run ADF Pipeline
Verify Azure Data Lake for File
Update Azure SQL Records
Run ADF Pipeline
Verify Azure Data Lake for Delta File

{% embed https://www.youtube.com/watch?v=_Ce-b6Dz1Wg %}
VueJS Introduction
Published: 2022-11-13 05:13:49


**What is VueJs ?**

VueJS is an open-source and progressive JavaScript framework for Front-End Development. It is used for building  user-interfaces.

VueJS Combines top level features of ReactJS and Angular.It provides a declarative and component-based programming model that helps you efficiently develop user interfaces, be they simple or complex.

**Major Features of VueJS**
**Virtual DOM :**
It uses Virtual DOM similar to other existing frameworks like React.Virtual DOM is a light-weight in-memory tree representation of the original HTML DOM and updated without affecting the original DOM.

**Reusable Components :**
One can create various components that can be reused which helps us to write less number of less and one can get rid from repetitive codes.

**Vue Router :**
One can easily navigate between screens using vue-router.

**State-management :**
As I worked with various technologies and I found VueJS State management tool [ Pinia ] the most easiest one. The tools like Redux , MobX ,Context are very complex to understand and setup at the same time Pinia is very easy to Integrate and understand.

**Light Weighted :**
VueJS is light-weighted as compared to other libraries and framework.

**Top Organisations that are using VueJS :**
1)Meta
2)Upwork
3)Adobe
4)Netflix
5)GitLab
6)Alibaba
Binary Tree Right / left Side View
Tags: javascript, leetcode
Published: 2022-11-13 06:55:03

Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.

 

Example 1:
Input: root = [1,2,3,null,5,null,4]
Output: [1,3,4]

Example 2:
Input: root = [1,null,3]
Output: [1,3]

Example 3:
Input: root = []
Output: []


```js
var rightSideView = function (root) {
  if (!root) return [];
  const q = [root];
  const result = [];
  while (q.length) {
    const size = q.length;
    result.push(q[size - 1].val);
    for (let i = 0; i < size; i++) {
      const node = q.shift();
      node.left && q.push(node.left);
      node.right && q.push(node.right);
    }
  }
  return result;
};

var leftSideView = function (root) {
  if (!root) return [];
  const q = [root];
  const result = [];
  while (q.length) {
    const size = q.length;
    result.push(q[0].val);
    for (let i = 0; i < size; i++) {
      const node = q.shift();
      node.left && q.push(node.left);
      node.right && q.push(node.right);
    }
  }
  return result;
};


```
How to update the attribute value of an object using the map function in JavaScript?
Tags: javascript
Published: 2022-11-13 06:53:31

To update the attribute value of an object using the map function in JavaScript, we return the updated object.

For instance, we write

```js
const editSchoolName = (schools, oldName, name) =>
  schools.map((item) => {
    if (item.name === oldName) {
      return { ...item, name };
    } else {
      return item;
    }
  });
```

to define the `editSchooName` function that returns a new version of the `schools` array that has entries mapped from `schools` with the objects updated if they have `name` property equal to `oldName`.
How to find out how many times an array element appears with JavaScript?
Tags: javascript
Published: 2022-11-13 06:52:47

To find out how many times an array element appears with JavaScript, we use the `filter` method.

For instance, we write

```js
const countInArray = (array, what) => {
  return array.filter((item) => item == what).length;
};
```

to define the `countInArray` function.

In it, we get the count the number of items equal to `what` by calling `array.filter` with a callback that returns if `item` equals to `what` to return an array with entries with `what` inside.

Then we get the `length` property to get the count of `what` in the array returned by `filter`.
How to send a PDF file directly to the printer using JavaScript?
Tags: javascript
Published: 2022-11-13 06:51:59

To send a PDF file directly to the printer using JavaScript, we create an object URL.

For instance, we write

```js
const dataUrl = window.URL.createObjectURL(file);
const pdfWindow = window.open(dataUrl);
pdfWindow.print();
```

to call `createObjectURL` with the PDF `file` to create the PDF file object URL string.

Then we open the `dataUrl` in a window wiith `window.open`.

Finally, we call `print` to open the print dialog to print the PDF.
How to change the interval time on Bootstrap carousel with HTML?
Tags: html
Published: 2022-11-13 06:50:39

To change the interval time on Bootstrap carousel with HTML, we set the `data-interval` attribute.

For instance, we write

```
<div
  data-ride="carousel"
  class="carousel slide"
  data-interval="10000"
  id="myCarousel"
>
  ...
</div>
```

to set the `data-interval` attribute to 10000ms to make the carousel update every 10000ms.
How to get the day of the week from the day number in JavaScript?
Tags: javascript
Published: 2022-11-13 06:49:20

To get the day of the week from the day number in JavaScript, we call the `toLocaleString` method.

For instance, we write

```js
const weekday = new Date().toLocaleString("en-us", { weekday: "long" });
```

to call `toLocaleString` on a date object with the locale and an object specifying the date string returned.

We set `weekday` to `'long'` to return the day of the week.
Cyrpto - October release
Tags: community, news, crypto, showdev
Published: 2022-11-12 22:14:41

Hi All 👋🏻

We've just released our October's edition of developer's T-shirts.

Hope that you'll enjoy them 😊

## Developer t-shirt release summary

Question was:
```
Do you support crypto?
```

Inspirational quote
```
If you don’t believe it or don’t get it, 
I don’t have the time to try to convince you, sorry.
```

Read the full story of this [developer t-shirt](https://www.devshirt.club/browse-shirts/crypto)

---

## Answer yes

![Developer's T-shirt, Yes I support Crypto, Do crypto with passion or don't do it at all](https://images.devshirt.club/do-crypto-with-passion-or-dont-do-it-at-all/do-crypto-with-passion-or-dont-do-it-at-all.jpeg)

### Developer T-shirt design
With answer yes we tried to illustrate how early adopters of crypto looked like. They were often geeky, un-shaved introverts with a spare machine. Even though they were closed introverts, once they let their guard down, their friendliness and kindness comes to the surface. They were simply developers passionate about crypto and we think that is the reason it become so popular. This days it feels like it would be beneficial to remind ourselves of crypto roots, and maybe strive to bring the same values.
Humility, friendliness, hard work and kindness.
We all love those kind of developers. ❤️❤️❤️ 

---

## Answer no
![Developer's T-shirt, No I don't support Crypto, The system isn't broken, can we trust the crypto token](https://images.devshirt.club/crypto-sceptics/crypto-sceptics.jpeg)

### Developer T-shirt design
We've illustrated the scepticism attitude some developers have toward everything crypto related. There are a lot of things happening in crypto that aren't exactly legal. There is a lot of scams us developers as technical people see trough, and feel empathic to victims. When looking from outside perspective some us have a feeling the whole crypto thing is just an unregulated wild west. Hence the question we ask ourself. Can we truly trust the crypto token. 

---

## What is devshirt.club
devshirt.club is a paid tee a month club built specifically for developers, engineers and programmers in mind. Each month you answer a question and get a tee delivered at your doorstep.
Every one of our shirts is illustrated and we aim to provide high quality tee's.
151. Leetcode Solution in Python3
Tags: python, chiki1601
Published: 2022-11-13 06:00:25

```python
class Solution:
  def reverseWords(self, s: str) -> str:
    return ' '.join(reversed(s.split()))

```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/reverse-words-in-a-string/
Introduction of compiler and interpreter
Tags: javascript, programming, compiler, interpeter
Published: 2022-11-13 05:57:23

Compiler and interpreter both are one kind of translator program. They do translate our code from high-level language to low-level or convert it to binary code. Compiler and interpreter work in two different ways. Let's give a deep dive into the compiler and interpreter. Let's know which languages are high-level languages now in this era. Most widely uses high-level languages are: Python, Java, C++, C#, Visual Basic, JavaScript, PHP and so on. 

### Compiler: 
Compilers translate our code from a higher-level language to something that the computer can understand.

As to how a compiler works, that is indeed complicated. I will attempt to briefly outline the main stages of the process, but this will be a very cursory overview.

- Lexing - break up the text of the program into "tokens". The tokens are the "words" of the programming language, such as identifiers (keywords, variable names, function names, etc.) or operators (=, *, &, etc.).
- Parsing - convert the sequence of tokens into a parse tree, which is a data structure representing various language constructs: type declarations, variable declarations, function definitions, loops, conditionals, expressions, etc.
- Optimization - evaluate constant expressions, optimize away unused variables or unreachable code, unroll loops if possible, etc.
Translate the parse tree into machine instructions (or JVM byte code).

Modern compilers are very smart, and, consequently, very complicated.


![How compiler works](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm1lgpwyb1b46bv0mp0m.png)




### Interpreter:
An interpreter is a computer program that is used to directly execute program instructions written using one of the many high-level programming languages.

The interpreter transforms the high-level program into an intermediate language that it then executes, or it could parse the high-level source code and then performs the commands directly, which is done line by line or statement by statement.

To make a long story short; an interpreter translates the high-level language line by line, which is done only when the target program is run. 




![How interpreter works](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4fqb41aj84i1adsauk6g.png)

### Core pros and cons of compiler and interpreter

- Interpreter is memory efficient. On the other hand compiler is not memory efficient. 
- Compiler: compiled code run faster. Interpreter: interpreted code run slower.