teleren/devto huggingface dataset:
WHAT IS SOLID AND WHY YOU MUST KNOW ABOUT IT.
Published: 2022-06-03 16:08:00

#INTRODUCTION#
   
Basically, assimilating the concept _"SOLID"_ and the whole detail it entails,  may be quite overwhelming, 

But don't worry because this article will take you through this concept, and its role in modifying the data management system in the near future if implemented. 

#THE CONCEPT OF SOLID #
The  concept "SOLID" is derived from "social linked data",and it is a project aimed at giving  users total control over their personal data.
 
The said to be father of the web, _"Tim Berners-Lee"_ , aka TBL, founded the **INRUPT** company for this purpose, he being the pioneer with a drive that the internet was in need of repair due to abuses going on, decided to introduce a system whereby users are in total control of their personal data, which is to be stored in "pods"(personal online data stores), to give access to applications and people to use it, and can invariably withdraw the access to this informations at will. 

#PROS AND CONS OF INCORPORATING SOLID IN DATA MANAGEMENT#

With this project on ground we might experience a notable impact as regards personal data management if TBL keeps his dream alive, but you must also consider the Pros and Cons of this wonderful idea. 

**PROS**

1. Solid allows users to be in control of their information i.e  to grant and withdraw permission to access personal data stored in pods, and this can reduce the rate of exploitation in the internet circle which is as a result of certain vulnerabilities. 

2. The **INRUPT** company led by TBL is designing a system to manage user information,  so,  no stress in accessing it nor fear of lossing these informations.which establishes the security of user information. This is really a good turn up. 

**CONS**

1. Cost of managing user information , the solid idea may sound good to you but you really need to know that you have to pay for the storage capacity your informations occupy, which may be a problem to most users

2. Lack of total control, this may seem contradictory to SOLID's original aim, but the truth is since the company is building the software in which your informations occupy you lack the ability to customize your personal data storage set up, which means you are not totally in control. 

3. Need for internet connection,for your awareness,your informations are stored remotely,so in other to access them you need to be connected to the internet.

4. Privacy setbacks, though you are in control of your informations but don't forget the fact that a third party system is managing your informations, and could leak these informations, and this defeats the privacy advantage. 

#CONCLUSION#
  This is just an introduction to this 'SOLID' revolution that might change the data management system of the internet, so this is the end of this article. You can still go further in your research to understand it's full structure if you're still inquisitive about this subject. Thank you. 


i am Abraham covenant a software developer in HTML, CSS,  JAVASCRIPT & PHP, advancing rapidly since 2021 till date and gasping in more informations necessary for solution provision.
Nullish Coalescing Operator(??)
Tags: javascript, webdev, beginners
Published: 2022-06-03 16:07:36

Hello everyone so today I'll write about ***Nullish Coalescing Operator*** .

**Nullish Coalescing Operator** is a logical operator that returns the left-hand operand as the result or returns the right-hand side operand when the left-hand side operand is null or undefined.

Syntax:
```
leftExpression ?? rightExpression
```
For eg:

```
const a = null ?? 'hello neogrammer';
console.log(a); // output: hello neogrammer

const b = 'hi' ?? 'hello'
console.log(b); //output: hi
```
So if you run the above examples you can see that the value of ***"a"*** will be ***"hello neogrammer"*** as the left-hand operand is null.
While in the second example value of ***"b"*** will be ***"hi"*** 
as the right hand value is now not null or undefined.

***Why Nullish Coalescing Operator???***

As we know we were having ***OR*** operator for this kind of operations but there was as an issue with this operator as being a Boolean logical operator, the left hand operand is forced to a boolean for the evaluation and any falsy values like 0, NaN, "", null, undefined was not returned, and this may cause issues for you if you consider these falsy values as valid values.

For example:

```
const c = 0;

const result = c || 50 ;
console.log(result); //output: 50
```
Here, the output will be ***50*** not ***0*** 

To overcome this issue Nullish Coalescing Operator comes into the picture, this operator works well with falsy values unlike  ***OR*** operand.

For example:

```
const d = 0;

const res = d || 'hii programmers' //output: hii programmers
const res2 = d ?? 'hii everyone' //output: 0
```

So, if you run the above example you'll see that we have taken 0 (a falsy value) and the ***OR*** operand is not accepting the falsy value and returning the second operand while the ***Nullish Coalescing Operator*** works fine with the falsy value and returns 0.

So, in short if you want to work with these kinds of falsy values you can use this amazing operator.


Thank you.
Happy Learning!!!
Count Number of Nice Subarrays
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 16:00:41

Given an array of integers `nums` and an integer `k`. A continuous subarray is called **nice** if there are `k` odd numbers on it.

Return _the number of **nice** sub-arrays_.

**Example 1:**

**Input:** nums = \[1,1,2,1,1\], k = 3
**Output:** 2
**Explanation:** The only sub-arrays with 3 odd numbers are \[1,1,2,1\] and \[1,2,1,1\].

**Example 2:**

**Input:** nums = \[2,4,6\], k = 1
**Output:** 0
**Explanation:** There is no odd numbers in the array.

**Example 3:**

**Input:** nums = \[2,2,2,1,2,2,1,2,2,2\], k = 2
**Output:** 16

**Constraints:**

*   `1 <= nums.length <= 50000`
*   `1 <= nums[i] <= 10^5`
*   `1 <= k <= nums.length`

**SOLUTION:**

    class Solution:
        def numberOfSubarrays(self, nums: List[int], k: int) -> int:
            n = len(nums)
            ctr = 0
            odd = 0
            prefix = [0] * (n + 1)
            for i in range(n):
                prefix[odd] += 1
                if nums[i] & 1:
                    odd += 1
                if odd >= k:
                    ctr += prefix[odd - k]
            return ctr
Automate customer support with Dialogflow
Tags: productivity, ai, nlp, tutorial
Published: 2022-06-03 15:46:25

In this week's Speed Run, we learn how to connect Dialogflow with Pipedream and generate dynamic responses to customer support requests without code.

{% embed https://www.youtube.com/watch?v=FmblKiM5G4g %}

With Dialogflow, we can build chat bots that use Natural Language Processing or NLP for short. 

Just give Dialogflow examples of training phrases and how to respond to them, and it will automatically train and build a dedicated bot for you.

Then we use Pipedream to customize responses and reply with real dynamic data.

In this example, we automatically reply with the current stock in our inventory.
React - Add props to component if matches the condition
Tags: react, reactcomponent, reactprops, javascript
Published: 2022-06-03 15:44:29

When working with props and components, sometimes we need to send one specific property, when matches specific condition.

```
const MyComponent = () => {
    return (
        <Select label="Countries" options={} required/>
    );
}
```
if we want to send required just when matches specific conditions, we can spread the properties

```
const MyComponent = () => {
    return (
        <Select label="Countries" options={} {(condition && { required })} />
    );
}
```

You can't use regular if/else conditions inside a component definition. Use [Conditional (ternary) operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator) instead.

```
// if
{condition && (<span>Rendered when `truthy`</span>) }
```

```
// unless
{condition || (<span>Rendered when `falsey`</span>) }
```

```
// if-else
{condition ? (<span>Rendered when `truthy`</span>) : (<span>Rendered when `falsey`</span>)}
```
Making npm Packages with SvelteKit
Tags: svelte, sveltekit, npm
Published: 2022-06-03 15:44:04

---
title: Making npm Packages with SvelteKit
published: true
description: 
tags: svelte, sveltekit, npm
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjnxumrv62fazu49bysb.jpg
canonical_url: https://scottspence.com/posts/making-npm-packages-with-sveltekit
---

I have several components that I use across a couple of my SvelteKit projects. I decided to make them into an npm package so that I'm not maintaining them in several places.

Here I'm going to go through the process I followed to develop the package locally then publish it to npm. So first I should tell you about the project. I recently published [SvelteKit Embed] on npm and it's a package of components to embed 3rd party media like YouTube videos, Tweets and some other embeds into a Svelte project.

## Setting up the project

It's a normal `npm init svelte` project. I initialised it with TypeScript as that's the expected default for packages these days.

The project is a standalone project with all the components I want to use from it in the `src/lib/components` folder.

There needs to be a `index.ts` file exporting the components.

```bash
sveltekit-embed/
├─ src/
│  └─ components/
│  └─ index.ts
└─ package.json
```

This will be how the components can be accessed in the project, here's how they're being exported.

```ts
export { default as AnchorFm } from './components/anchor-fm.svelte'
```

## Package the project

I developed the package locally using the `sveltekit package` command, then installed it from the resulting `package` folder generated.

```bash
# package with sveltkit
pnpm run package
# install local package
pnpm i -D ./package
```

Now I can validate the components are working locally before publishing to npm.

## Publish the project to npm

OnceI'm happy with the state of the package, I can publish it to npm. I'll need to authenticate with npm first with the `npm login` command.

I'll use the `npm version` command to bump the version number, then run the `sveltekit package` command.

```bash
# authenticate with npm
npm login
# bump version with npm
npm version 0.0.2
# package with sveltkit
pnpm run package
# publish from package directory
```

Then once the package has been created I'll be able to change to the `package` directory and publish it to npm.

```bash
cd package
npm publish
```

npm will prompt me for my authentication credentials, which is a one time password (OTP) for 2FA.

Once it's published to npm I can then push the Git tags created to GitHub and make a release with it.

```bash
# push tags to github
git push --tags
```

## Conclusion

I was able to take all the components I used in several projects and create an npm package with them for reuse in many projects.

<!-- Links -->

[sveltekit embed]: https://github.com/spences10/sveltekit-embed
Choose your own adventure: Upstream is Tuesday! ⛰️
Tags: opensource, maintainers, event
Published: 2022-06-03 15:41:03

---
title: Choose your own adventure: Upstream is Tuesday! ⛰️
published: true
description: Wow: Upstream is less than a week away! Are you joining us Tuesday, June 7? We’ll kick off the day at 9:45 a.m. ET to greet you (we call this the hallway track), then sessions officially begin at 10 a.m. and run till 6:30 p.m. ET. 
tags: opensource, maintainers, event
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/quyieufjg7gtvp1xfvjq.png
canonical_url: https://blog.tidelift.com/choose-your-own-adventure-upstream-is-tuesday
---

<p>Wow: Upstream is less than a week away! Are you joining us Tuesday, June 7? We’ll kick off the day at 9:45 a.m. ET to greet you (we call this the hallway track), then sessions officially begin at 10 a.m. and run till 6:30 p.m. ET.&nbsp;</p>
<p>We've been working hard to carve out<a href="https://upstream.live/schedule" rel="noopener" target="_blank"> <span style="color: #1155cc; text-decoration: underline;">the perfect agenda</span></a>, and it’s almost complete. The day will be action-packed, so we wanted to give you a sneak peek at the first two hours.</p>
<p><a href="https://upstream.live/register">REGISTER HERE</a></p>
<p>Josh Simmons, senior ecosystem strategy lead at Tidelift, and Donald Fischer, Tidelift CEO and co-founder, will kick off the day, followed by Deborah Bryant of Red Hat, who will discuss zen and the art of contributor maintenance: what have you done for them lately?</p>
<p>Then it's time to choose your own adventure:</p>
<ul>
<li aria-level="1">Trail 1: Join Josh Simmons as he hosts a panel discussion on what it means to be a good open source citizen, featuring Al Gillen of IDC, Alyssa Wright of Bloomberg, Duane O’Brien of Indeed, and Rob Underwood of Goldman Sachs.</li>
<li aria-level="1">Trail 2: Join Tidelift co-founder Luis Villa as he discusses the 'we' behind open source projects with Python maintainer Seth Michael Larson.</li>
<li aria-level="1">Trail 3: Nancy Gariché, a senior developer advocate for the GitHub Security Lab, will discuss a maintainer-first approach to open source security.</li>
</ul>
<p>And that's just the first two hours! Having a hard time figuring out which trail you'd rather explore? Good news: everything will be recorded, so you can explore other talks whenever you'd like.</p>
<p>And our team will be live all day in the hallway, offering trivia, giveaways, and fun conversations, and we can help guide you to choose the right path for you. It’s going to be awesome.</p>
<p>Will we see you there? <a href="https://upstream.live/register">Register here</a>.</p>
Appwrite Community Report #8
Published: 2022-06-03 15:33:52

Ciao! 👋

Did you miss us the past week? We are back in full-force to share what we have been cooking for the past two weeks. 👀

P.S - If you are wondering what happened in the last week of May, here’s a highlight 👇
{% embed https://twitter.com/eldadfux/status/1530911583370727425?s=20&t=Kc_6geppwyP-WHL90L3rIA %}


**TLDR;** It is raining new swags in Appwrite, we also have some cool new features, bugs solved and resources for you to learn!

---

## 📢  What’s new 

- We have pride month exclusive swags! Every purchase made, goes as donation to organizations that are supporting and nurturing the LGBTQIA+ community
{% embed https://dev.to/appwrite/not-just-binary-3f2i %}
- We have received amazing response for the OSS Fund, the [review committee](https://twitter.com/appwrite/status/1532025391552110592?s=20&t=Kc_6geppwyP-WHL90L3rIA) is set-up and all ready to review the awesome applications🤩

P.S. - This is a year-long fund, if you haven’t applied yet, don’t worry, as we are still accepting applications: {% embed https://appwrite.io/oss-fund %}

---

## ✅ Issues solved

With our continued effort to make Appwrite the ultimate open-source solution for all your backend needs, here are some of the fixed we worked on:

- Fixing upgrade failure from version 0.13.x to 0.14.x
🔗[Link to PR](https://github.com/appwrite/appwrite/pull/3307)

- Making codebase more compliant to PSR12 coding standard - includes refactoring controllers, introducing php code sniffer and more
🔗[Link to PR](https://github.com/appwrite/appwrite/pull/3326)
- A PR by [@steven](https://github.com/stnguyen90) that bypasses SMTP host check for admins
🔗[Link to PR](https://github.com/appwrite/appwrite/pull/3297)
- Fixes Zoom OAuth scope that fails when requested `user_profile` cannot be found in the Zoom dashboard
🔗[Link to PR](https://github.com/appwrite/appwrite/pull/3255)

---

## ⚒️ What we’re currently working on

- API keys will soon have an expiration date
- Database Queries we know from the Database Service to filter results will make its way to Users, Storage, Functions and all other Services
- Disabled services can now still be used with an API Key and are only blocked for Client Side applications by [@steven](https://github.com/stnguyen90)

---

## 🗣 Discussions
Add preference at the time of account creation - feature requested by a community member. What do you think?
🔗 [Join the discussion here](https://github.com/appwrite/appwrite/discussions/3314)

---

## 📘 Resources

- Looking to get started with Appwrite? Check out 30 Days of Appwrite - [your one-stop resource for learning](https://30days.appwrite.io/)
- We love to see what you build with Appwrite! Be sure to drop them [here](https://github.com/appwrite/awesome-appwrite)
- Appwrite is on YouTube, did you know?
{% embed https://youtu.be/aO4mw8smXkI %}
Stone Game
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 15:30:38

Alice and Bob play a game with piles of stones. There are an **even** number of piles arranged in a row, and each pile has a **positive** integer number of stones `piles[i]`.

The objective of the game is to end with the most stones. The **total** number of stones across all the piles is **odd**, so there are no ties.

Alice and Bob take turns, with **Alice starting first**. Each turn, a player takes the entire pile of stones either from the **beginning** or from the **end** of the row. This continues until there are no more piles left, at which point the person with the **most stones wins**.

Assuming Alice and Bob play optimally, return `true` _if Alice wins the game, or_ `false` _if Bob wins_.

**Example 1:**

**Input:** piles = \[5,3,4,5\]
**Output:** true
**Explanation:** 
Alice starts first, and can only take the first 5 or the last 5.
Say she takes the first 5, so that the row becomes \[3, 4, 5\].
If Bob takes 3, then the board is \[4, 5\], and Alice takes 5 to win with 10 points.
If Bob takes the last 5, then the board is \[3, 4\], and Alice takes 4 to win with 9 points.
This demonstrated that taking the first 5 was a winning move for Alice, so we return true.

**Example 2:**

**Input:** piles = \[3,7,2,3\]
**Output:** true

**Constraints:**

*   `2 <= piles.length <= 500`
*   `piles.length` is **even**.
*   `1 <= piles[i] <= 500`
*   `sum(piles[i])` is **odd**.

**SOLUTION:**

    class Solution:
        def stoneGame(self, piles: List[int]) -> bool:
            return True
How to solve rounding error in Java, Python ?
Tags: java, python
Published: 2022-06-03 15:11:01

What is the summation of 

```
0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1 ?
```
1.0 , right?
Let's add them in java:

test.java

```
public class test{
    //main method
    public static void main(String[] args) {
        System.out.println(0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1);

    }
}
```
Output: 0.9999999999999999
 
In Python:

```
print(0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1)
```
Output: 0.9999999999999999


now, assume that you have 100 taka 45 paisa . Other than taking it as float or double as data type, we should take integer data type.

so don't take 

```
double balance=100.45
```

Take this

```
int balance = 10045
```
This is how you can solve this issue

<img src="https://c.tenor.com/Tvd3VKwtse0AAAAC/cat-cute.gif">
Delete Node in a BST
Tags: leetcode, dsa, theabbie
Published: 2022-06-03 15:00:42

Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.

Basically, the deletion can be divided into two stages:

1.  Search for a node to remove.
2.  If the node is found, delete the node.

**Example 1:**

![](https://assets.leetcode.com/uploads/2020/09/04/del_node_1.jpg)

**Input:** root = \[5,3,6,2,4,null,7\], key = 3
**Output:** \[5,4,6,2,null,null,7\]
**Explanation:** Given key to delete is 3. So we find the node with value 3 and delete it.
One valid answer is \[5,4,6,2,null,null,7\], shown in the above BST.
Please notice that another valid answer is \[5,2,6,null,4,null,7\] and it's also accepted.
![](https://assets.leetcode.com/uploads/2020/09/04/del_node_supp.jpg)

**Example 2:**

**Input:** root = \[5,3,6,2,4,null,7\], key = 0
**Output:** \[5,3,6,2,4,null,7\]
**Explanation:** The tree does not contain a node with value = 0.

**Example 3:**

**Input:** root = \[\], key = 0
**Output:** \[\]

**Constraints:**

*   The number of nodes in the tree is in the range `[0, 104]`.
*   `-105 <= Node.val <= 105`
*   Each node has a **unique** value.
*   `root` is a valid binary search tree.
*   `-105 <= key <= 105`

**Follow up:** Could you solve it with time complexity `O(height of tree)`?

**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 insert(self, root, node):
            if root:
                if node:
                    if node.val <= root.val:
                        root.left = self.insert(root.left, node)
                    else:
                        root.right = self.insert(root.right, node)
            else:
                root = node
            return root
        
        def deleteNode(self, root: Optional[TreeNode], key: int) -> Optional[TreeNode]:
            if root:
                if root.val == key:
                    root = self.insert(root.left, root.right)
                elif key < root.val:
                    root.left = self.deleteNode(root.left, key)
                else:
                    root.right = self.deleteNode(root.right, key)
                return root
            else:
                return None
Product launch: Startrack
Tags: react, github, nextjs, githubstars
Published: 2022-06-03 14:58:52

Recently, I launched Startrack in a [YouTube livestream](https://www.youtube.com/watch?v=_ymQsetuz_Q). It's an easier way to star repos on GitHub. Commonly, you'll head to a repo with the intent to star. Perhaps you saw the website first, or have been using the project for a while but not starred. When you click the link to a repo, you are overwhelmed by a lot of useful information like files, the README, and commit history. This can cause you to loose that intent to star.

Startrack aims to solve this problem, and is a bit like [twitter intents](https://developer.twitter.com/en/docs/twitter-for-websites/web-intents/overview). With Startrack, that intent is preserved. When you go to a Startrack starring page, you are presented with some context about the repo, like a name, description and author, along with a button to star in *one click*.

I am able to achieve this great user experience, because the first time you attempt to star a repo, you are prompted to authenticate with GitHub. Startrack then receives an oAuth token, which it uses to authenticate with the GitHub API. As this token is persisted in a database, you can easily star repos with minimal friction.

Another key feature of Startrack is its ease of setup. All it takes to use Startrack with your repo is a URL in this format:
```
https://startrack.vercel.app/star/[OWNER]/[REPO]
```
That's it! There is no complex setup required. And Startrack also offers an easy and fast way for returning back to the page you were starring from. It uses the history stack to go back, allowing for the page to be served from the browser cache for fast load times. This results in minimal disruption to the user.

That's it for this post! If you enjoyed it and are able to financially support me, please [buy me a coffee](https://buymeacoffee.com/jem). Otherwise, a Twitter follow ([@jqcat](https://twitter.com/intent/follow?screen_name=jhqcat)) or a YouTube subscribe ([Jacob Marshall](https://www.youtube.com/channel/UChXCa0OuD-HYr3QAESK434g)) would be nice. You can also [star this repo](https://startrack.vercel.app/star/jacobhq/startrack) or follow me on GitHub ([@jacobhq](https://github.com/jacobhq)). Have a great day.
Day 3 of the 2022 RT-Thread IoT OS Global Tech Conference is about to Begin.
Published: 2022-06-03 14:54:15

Howdy Developers!
2022 RT-Thread IoT OS Global Tech Conference is about to begin! 
Click the link below to join the conference from Teams or Click the LINK here. https://bit.ly/391C3pE

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

Looking forward to seeing you all!