teleren/devto huggingface dataset:
Number of Smooth Descent Periods of a Stock
Tags: leetcode, dsa, theabbie
Published: 2022-06-07 11:30:38

You are given an integer array `prices` representing the daily price history of a stock, where `prices[i]` is the stock price on the `ith` day.

A **smooth descent period** of a stock consists of **one or more contiguous** days such that the price on each day is **lower** than the price on the **preceding day** by **exactly** `1`. The first day of the period is exempted from this rule.

Return _the number of **smooth descent periods**_.

**Example 1:**

**Input:** prices = \[3,2,1,4\]
**Output:** 7
**Explanation:** There are 7 smooth descent periods:
\[3\], \[2\], \[1\], \[4\], \[3,2\], \[2,1\], and \[3,2,1\]
Note that a period with one day is a smooth descent period by the definition.

**Example 2:**

**Input:** prices = \[8,6,7,7\]
**Output:** 4
**Explanation:** There are 4 smooth descent periods: \[8\], \[6\], \[7\], and \[7\]
Note that \[8,6\] is not a smooth descent period as 8 - 6 ≠ 1.

**Example 3:**

**Input:** prices = \[1\]
**Output:** 1
**Explanation:** There is 1 smooth descent period: \[1\]

**Constraints:**

*   `1 <= prices.length <= 105`
*   `1 <= prices[i] <= 105`

**SOLUTION:**

    class Solution:
        def deslen(self, prices, i, n):
            if i in self.cache:
                return self.cache[i]
            if i == n - 1 or prices[i] - prices[i + 1] != 1:
                self.cache[i] = 1
                return 1
            val = 1 + self.deslen(prices, i + 1, n)
            self.cache[i] = val
            return val
        
        def getDescentPeriods(self, prices: List[int]) -> int:
            n = len(prices)
            self.cache = {}
            ctr = 0
            for i in range(n):
                ctr += self.deslen(prices, i, n)
            return ctr
15 Steps to using Open Source to Advance your Career as an Early Tenure Developer
Published: 2022-06-07 11:12:20

1. Pick the language you are the best at. If you're not at least an advanced beginner in a language work on tutorials until you get there.
2. Search for an Open Source project in that language - good places to look are https://github.com/stars/bdougie/lists/open-source-friday / or https://summerofcode.withgoogle.com/programs/2022/organizations 
3. Pick 2 or 3 projects.
4. Watch all 2-3 projects for 1-2 weeks. See how people contribute, how they talk to each other. and read all of the documentation.
5. Based on that investigation, pick the one that seems most welcoming to you. Only pick one.
6. Introduce yourself in the proper channels. Follow the introduction instructions!
7. Read all of the open issues. Pick the one that you are most likely to do well. Work on that issue.
8. Meanwhile, if you see someone else ask a question that you know the answer to based on reading ALL of the documentation, answer those questions. "I think the answer is this [and add link]. Community, please redirect me if I'm wrong.
*** helping in Open Source is more than coding, and this is a great way to ease the burden on the very busy Maintainers. ***
9. When you finish the issue, follow the protocol to get a code reviewer. Also, ask the appropriate channel for a Maintainer to double-check that you are following the correct process.
10. Repeat steps 7-9 at least 5 times, preferably 10.
11. Ask in a public channel, not privately, for an experienced Contributor or Maintainer to review your initial contributions to see what you are doing well and how you can improve.
12. Now that you've worked on 10 issues, work on 20, then 30, then 40.
13. Recommended: start reviewing others’ pull requests. Make sure you get advice from someone more experienced after your first one.
14. Recommended: along the way, keep a weekly list of what you did, and what you learned. here's a guide: https://www.semasoftware.com/blog/how-to-build-an-accomplishment-journal-brag-book 
15. After at least 25 hours of contribution, but preferably 50, update your resume (that's what #14 is for), and ask on a general or career channel if folks would give advice on your job search. "I've been working on Community AA for the last BB weeks and have done XX issues, YY pull requests, ZZ code reviews. Would someone be willing to share tips on my resume and or organizations you know who might be looking for an Engineer with these skills <list yours.>”
Developer-friendly Landing Pages
Tags: nuxt, vercel, tailwindcss, landingpage
Published: 2022-06-07 11:11:00

**I don't like page builders.**

As an "experienced" developer, I like having control over my websites. Being able to see, edit and publish any fine-tuned changes in HTML, CSS, JavaScript and all of the backend logic. 

That is not something many of the "Landing Page builders" can give or promise. They are often filled with unnecessary bloat, making for a worse experience for the visitor.

They also cost a ton. 😵‍💫

I went on to build the landing page myself from scratch, using some of the easiest and fastest frameworks available today.

**Ok, then what?**

Build the pages yourself with _Next.js/Nuxt.js_ + _some CSS framework_ + _Vercel/Netlify_.

Since I have experience with Vue.js + Tailwind, I chose the tools geared for that. You might choose different ones if you're into React, Angular or Svelte, but the point is - it's there, it's free, and really easy to use.

By building these landing pages yourself, instead of using page builders - you:
- retain full control of the website. Make any changes at any time, no matter how complex they are
- don't have to pay hefty fees for the page builders
- the website is much much faster
- you get to write more code (isn't that the fun part??)

Read more about my experience of building a fast and beautiful landing page in just a few hours here:

https://arunas.dev/developer-friendly-landing-pages/

Hope this inspires some more of you to ditch the builders and make it your own! 😄 I mean, I know I'm in the right space, cos we're developers after all!

Thanks everyone 🙌
Next Greater Node In Linked List
Tags: leetcode, dsa, theabbie
Published: 2022-06-07 09:00:49

You are given the `head` of a linked list with `n` nodes.

For each node in the list, find the value of the **next greater node**. That is, for each node, find the value of the first node that is next to it and has a **strictly larger** value than it.

Return an integer array `answer` where `answer[i]` is the value of the next greater node of the `ith` node (**1-indexed**). If the `ith` node does not have a next greater node, set `answer[i] = 0`.

**Example 1:**

![](https://assets.leetcode.com/uploads/2021/08/05/linkedlistnext1.jpg)

**Input:** head = \[2,1,5\]
**Output:** \[5,5,0\]

**Example 2:**

![](https://assets.leetcode.com/uploads/2021/08/05/linkedlistnext2.jpg)

**Input:** head = \[2,7,4,3,5\]
**Output:** \[7,0,5,5,0\]

**Constraints:**

*   The number of nodes in the list is `n`.
*   `1 <= n <= 104`
*   `1 <= Node.val <= 109`

**SOLUTION:**

    # Definition for singly-linked list.
    # class ListNode:
    #     def __init__(self, val=0, next=None):
    #         self.val = val
    #         self.next = next
    class Solution:
        def nextLargerNodes(self, head: Optional[ListNode]) -> List[int]:
            stack = []
            curr = head
            greater = {}
            vals = {}
            i = 0
            while curr:
                vals[i] = curr.val
                while len(stack) > 0 and curr.val > vals[stack[-1]]:
                    popped = stack.pop()
                    greater[popped] = curr.val
                stack.append(i)
                curr = curr.next
                i += 1
            return [greater.get(j, 0) for j in range(i)]
Permutation in String
Tags: leetcode, dsa, theabbie
Published: 2022-06-07 11:00:53

Given two strings `s1` and `s2`, return `true` _if_ `s2` _contains a permutation of_ `s1`_, or_ `false` _otherwise_.

In other words, return `true` if one of `s1`'s permutations is the substring of `s2`.

**Example 1:**

**Input:** s1 = "ab", s2 = "eidbaooo"
**Output:** true
**Explanation:** s2 contains one permutation of s1 ("ba").

**Example 2:**

**Input:** s1 = "ab", s2 = "eidboaoo"
**Output:** false

**Constraints:**

*   `1 <= s1.length, s2.length <= 104`
*   `s1` and `s2` consist of lowercase English letters.

**SOLUTION:**

    class Solution:
        def checkInclusion(self, p: str, s: str) -> bool:
            np = len(p)
            ns = len(s)
            if np > ns:
                return False
            pctr = [0] * 26
            for c in p:
                pctr[ord(c) - ord('a')] += 1
            sctr = [0] * 26
            for i in range(np):
                sctr[ord(s[i]) - ord('a')] += 1
            i = 0
            while i < ns - np:
                if pctr == sctr:
                    return True
                sctr[ord(s[i]) - ord('a')] -= 1
                sctr[ord(s[i + np]) - ord('a')] += 1
                i += 1
            if pctr == sctr:
                return True
            return False
How to activate Azure Command Line Interface (Azure CLI)
Tags: azure, azurecli, beginners, cloud
Published: 2022-06-07 10:50:20

The Azure Command-Line Interface is a cross-platform tool that can be used to run administrative tasks on Windows computers. It can be installed and used locally on a variety of devices. You can also use it to connect to Azure through a browser or run it from inside a Docker container.

The Azure CLI is automatically installed on Windows computers using a multi-system image (MSI). It can be accessed through the Windows Command Prompt or the Powershell. 

When installing the software for Linux, you can also use the packages that are available for Windows Subsystem for Linux. See the main page for more details.

The latest version of the Azure CLI is version 2.36.0. To find out if it's still working properly, run "az version". The Azure CLI is a cross-platform command line tool that can be used to connect to Azure resources. It can also be used to run tasks from inside a Docker container. You can also use it through a browser.

Update or install
On Windows, the MSI distributable is used to install or update the Azure CLI. Current versions do not need to be uninstalled before installing the MSI installer because the MSI will upgrade any existing version.

The Recent version:
Make sure to Install the most recent version of the Azure CLI. Click the "Yes" box when the installer asks if it can make changes to your device. To utilize the Azure CLI, close and reopen any open Windows Command Prompt or PowerShell windows after the installation is complete.


Version specific
Change the version section in the URL https://azcliprod.blob.core.windows.net/msi/azure-cli-version>.msi to download the MSI installer for a given version. The Azure CLI release notes list the available versions.

Activate the Azure CLI
The az command can now be used to launch the Azure CLI from either Windows Command Prompt or PowerShell.
Behavior Driven Development (BDD)
Tags: testing, webdev, programming, softwaredevelopment
Published: 2022-06-07 10:44:12

![Cucumber BDD circle](https://miro.medium.com/max/1400/1*V9Alo-YkRqAEqgfGAj4m9g.png)

When you write tests following the BDD approach, you take the perspective of the one that will consume your code.

{% medium https://medium.com/@mariusbongarts11/behavior-driven-development-bdd-f843484ab081 %}
ListView in ScrollView Nativescript Angular
Tags: scrollview, listview, nativescript, angular
Published: 2022-06-07 10:34:55

 When you develop a mobile application with NativeScript Angular, you can stuck with some bugs with android or ios. In this article, we will solve the nested scrolling problem in android, if you found this article I am sure that you have some kind of scrolling problem with android.

If you have a main dashboard with ScrollView and you want to add inside ScrollView another ListView you can find that you cant scroll nested ListView. You can scroll only through parent ScrollView. Even if you follow [documentation](https://docs.nativescript.org/ui-and-styling.html#listview) using ListView in ScrollView you will have a problem with android.

From documentation:
"
_Important

Using the ListView component inside a ScrollView or ScrollView inside the ListView's items can lead to poor performance and can reflect the user experience. To avoid this issue, we should specify the height explicitly for the ListView in the scenario when the ListView is nested in ScrollView and the ScrollView's height - when the component is used inside the ListView._

```
<ScrollView>
  <StackLayout>
    <ListView height="150" [items]="countries"> ... </ListView>
  </StackLayout>
</ScrollView>

```
 "

For this situation in native Java Android you need to add the property nestedScrollingEnabled to true, like the image below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a19e9oqj2ed69cvloog8.jpg)

If we can change property in Java, we can change it in Nativescript too. First, you need to import the ListView class from @nativescript/core like the code below:

```
import { ListView } from '@nativescript/core';
```
Then we will create a function to change properties like the code below:

```
onListView(e:EventData){
//First check if is Android
  if(isAndroid){
//get object from EventData and convert it as ListView class object

   const listView = e.object as ListView;
   // and you can change property like that
   listView.nativeView.setNestedScrollingEnabled(true);
  }
}
```
We need add "(loaded)" to html ListView like the code below:

```
<ListView
  (loaded)="onListView($event)"
  [items]="someArray"
>
```
Now you can check your nested scroll ListView.

If You find this article useful please write comment and push the like button.
Whatsapp Clone for Android & IOS using Flutter & Python - Part 5 (Complete Tutorial)
Published: 2022-06-07 10:32:01


Hey fellas I am Yash Makan back with another article. Today we are going to continue our journey where you and I are going to create a complete whatsapp applicaion from scratch. Yup, from very start till the end. This is the part 5 of the series so If you have missed the previous parts then I will highly suggest you to check the [playlist](https://www.youtube.com/playlist?list=PLm8trMDxkTIlIJJqIHK12PiT36C8RpQCs) to understand better. If you don’t know about whatsapp application then basically it’s a social media messaging application where user can send messages to their friends & family. It also has features like video calling, status sharing and much more. And if you are thinking, are we going to develop all these features?? then the answer is yes my friend... Also If you are tired of reading and want me to get out of your mind then I’ve got a video covering all this just watch the youtube video below.

{% youtube yvoNYW1Py-I %}


## Source code

Source Code is Available in the description box below in the video. So do check it out...

## Subscribe For More

[![YouTube](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lvjpg9zn6xfcdkfxhl0x.png)](https://www.youtube.com/channel/UCLO_mjF4nvD4wYnTYRlYXsA?sub_confirmation=1)

## Contact Me

Website: [yashmakan.co.in](http://yashmakan.co.in)

Twitter: [@Yash_Makan](https://twitter.com/Yash_Makan)

## Contribute

buymeacoffee: [@Here](https://www.buymeacoffee.com/yashmakan) 

## Other Interesting Articles

- [21 must-read books for kids, beginner, advanced & interview with PDF 🐍](https://dev.to/yash_makan/21-must-read-books-for-kids-begineer-advanced-interview-with-pdf-56c7)
- [Improve your workflow using Automation in Python](https://dev.to/yash_makan/everything-about-automation-in-python-pc-mobile-web-raspberry-pi-4cgh)
- [4 ways to create modern GUI in python in the easiest way possible](https://dev.to/yash_makan/4-ways-to-create-modern-gui-in-python-in-easiest-way-possible-5e0e)
- [4 Free hosting platforms for python web app with step-by-step process](https://dev.to/yash_makan/4-best-python-web-app-hosting-services-for-freewith-complete-process-57nb)
- [18 Python one-liners that will speed up your coding process.](https://dev.to/yash_makan/18-python-one-liners-that-will-speed-up-your-coding-process-21md)
- [AI bot that could answer your questions](https://dev.to/yash_makan/ai-bot-that-could-answer-any-questions-asked-gmn)
- [Generate your own favourite TV episode using python](https://dev.to/yash_makan/generate-your-own-favourite-tv-episode-using-python-1pb3)
How do you fetch and process your data
Tags: discuss, javascript, react
Published: 2022-06-07 10:32:00

Let's discuss - how do you fetch your tabular data?
Do you load it initially and then only do client side processing?
How do you sort - local or remote sorting? What about filtering?
Do you use grouping or pivoting - and if so, does it happen in the browser?
Keen to find out how other people do it 🤔
Minimum Distance Between BST Nodes
Tags: leetcode, dsa, theabbie
Published: 2022-06-07 10:30:39

Given the `root` of a Binary Search Tree (BST), return _the minimum difference between the values of any two different nodes in the tree_.

**Example 1:**

![](https://assets.leetcode.com/uploads/2021/02/05/bst1.jpg)

**Input:** root = \[4,2,6,1,3\]
**Output:** 1

**Example 2:**

![](https://assets.leetcode.com/uploads/2021/02/05/bst2.jpg)

**Input:** root = \[1,0,48,null,null,12,49\]
**Output:** 1

**Constraints:**

*   The number of nodes in the tree is in the range `[2, 100]`.
*   `0 <= Node.val <= 105`

**Note:** This question is the same as 530: [https://leetcode.com/problems/minimum-absolute-difference-in-bst/](https://leetcode.com/problems/minimum-absolute-difference-in-bst/)

**SOLUTION:**

    # Definition for a binary tree node.
    # class TreeNode:
    #     def __init__(self, val=0, left=None, right=None):
    #         self.val = val
    #         self.left = left
    #         self.right = right
    class Solution:
        def inorder(self, root):
            if root:
                self.inorder(root.left)
                if self.latest != None:
                    if self.minDiff == None or root.val - self.latest < self.minDiff:
                        self.minDiff = root.val - self.latest
                self.latest = root.val
                self.inorder(root.right)
        
        def minDiffInBST(self, root: Optional[TreeNode]) -> int:
            self.minDiff = None
            self.latest = None
            self.inorder(root)
            return self.minDiff
How to work with Streams and Buffer in Nodejs?
Published: 2022-06-07 10:29:20

---
title: How to work with Streams and Buffer in Nodejs?  
published: true
description: 
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---
I was working on my project.

Essentially I wanted to upload a Readable in memory to GCP Cloud Storage in Node.

It gave me an error saying the Cloud Storage accepts a Buffer type object instead.

I don’t know exactly how to convert a Readable to Buffer
How do you distinguish programming, coding, software engineering and architecting?
Published: 2022-06-07 10:29:03

---
title: How do you distinguish programming, coding, software engineering and architecting? 
published: true
description: I wonder how you distinguish these three distinct roles. 
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---
I do my first PiBox installation
Published: 2022-06-07 10:24:43

---
title: I do my first PiBox installation
published: true
description: I look into the PiBox installation and give my first impressions of the software and features of the PiBox solution.
tags:
cover_image: https://i.ytimg.com/vi/YwwjsmOT7WA/maxresdefault.jpg
---

{% youtube YwwjsmOT7WA %}

I look into the PiBox installation and give my first impressions of the software and features of the PiBox solution.
Scripting vs. Programming Languages
Tags: beginners, programming
Published: 2022-06-07 10:23:22

The difference between a scriting and a programming language lies in how the code written is converted to machine language. 

Once you have written your code, we need to find a way to convert from human readable language to machine readable format. To achieve this, the program can either be compiled in the case of programming languages or translated in the case of scripting languages.

Whereas a programming language requires a compiler to to be converted to a machine notation, a script language requires, well, an Interpreter. To compile or translate is to transform a program from a high level language(human readable source code) to object/machine code. 

Compiled programs are generally relatively faster than interpreted programs because they are first of all converted to machine language before execution. Additionally, compilers scan the entire program and report any errors if any before execution whereas interpreters execute code line by line and throw errors only when they incur them. 

However, With the advances in hardware and computation technologies, the difference between scripting and programming languages is gradually fading. When classifying languages as either scripting or programming, it is significant to consider the enviroment of execution of that specific language. This is important because one can design an interpreter using a programming language for example C++ and use it as a scripting language. Similarly, one can use a scripting language as a compiled language. For instance Google Chrome's V8 engine is a JavaScript engine that compiles JavaScript (traditionally, a scripting language) to a machine code.

### Examples of Scripting Languages
Some of the languages that are tranditionaly classified as scripting languages include JavaScript, Python, and PHP

### Examples of Programming Languages
Some of the languages that are tranditionaly classified as programming languages include C, C++

### What about Java?
You might be tempted to mention Java as being strictly a compiled language but that would be wrong since Java is both an interpreted and compiled language.

### Key Takeaways

- Scripting languages need a translator to be converted to machine code

- Programming languages, on the other hand, need a compiler to be converted to machine code

- Programming languages tend to execute faster than scripting languages

- A compiler scans the entire code and thus identifies erros before execution 

- An interpreter translates code line by line and only throws errors when it incurs them

- Examples of scripting languages include Python, PHP, JavaScript

- Examples of programming languages include C, C++
About Vywhy
Tags: why
Published: 2022-06-07 10:22:53

What is Vywhy about?
On this page, we collect the best and most relevant results for ""why is friday the 13th scary"" you are searching for.

How we help users?

As users search for anything, we returns a list of the best and most suitable results related to the word ""why,"" according to our ranking system and manual ranking by our editors. For example, this page returns 17 results for ""why is friday the 13th scary""

Why should you choose us?

VyWhy has far too many benefits. But the most crucial aspects are time management and reliable data. Unlike previous approaches, our tool does not need you to spend hours searching for the correct solution to your query: why is friday the 13th scary. You can easily locate the proper answer by typing the question you're looking for.
------------------------------
We are always ready to revise for perfection. Do not hesitate to give us feedback.
Website: https://vywhy.com/
Facebook:https://www.facebook.com/vywhycom/
Twitter: https://twitter.com/Vywhy2 
Linkedin: https://www.linkedin.com/in/why-vyy-b39151238/ 
Pinterest: https://www.pinterest.com/vywhycom/_saved/