teleren/devto huggingface dataset:
Invert Binary Tree
Tags: python, leetcode
Published: 2023-04-13 00:38:37

_Given the root of a binary tree, invert the tree, and return its root._

![Diagram showing a binary tree next to a binary tree that has been inverted](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0iz86czuyw5n066yriyi.png)

- First we will have to look at the root node, take its children, swap the positions of the children, then recursively run invert on both right and left subtrees. DFS will allow us to solve this problem 

Depth For Search (DFS) - is an algorithm for traversing or searching tree. The algorithm starts at the root node and explores as far as possible along each branch before backtracking.

```python
class Solution:
   def invertTree(self, root: TreeNode) -> TreeNode:
      if not root:
         return None
      # swap the positions of the children
      #saving the left value in a temporary variable
      tmp = root.left 
      #replacing the left value(root.left) to with right value(root.right)
      root.left =root.right 
      #replacing the right value(root.right) with the left which we saved as "tmp"
      root.right = tmp 
      
      #invert left subtree
      self.invertTree(root.left) 
      #invert right subtree
      self.invertTree(root.right) 
      return root
```
10 reasons why you should use Flutter
Tags: flutter, appdev, opensource, learning
Published: 2023-04-12 20:22:59

Here are 10 reasons why you should use Flutter, with a dash of humour and some emojis 🤖🎉:

1️⃣ Flutter is cross-platform, so you can create apps for both iOS and Android without having to sell your soul to Apple or Google 👻💰.

2️⃣ With Flutter's hot reload feature, you'll never have to wait for your code changes to take effect. It's like magic! 🎩✨

3️⃣ The Flutter widget library is extensive, making it easy to create beautiful and functional UIs. You'll feel like a UI wizard in no time 🧙‍♀️🌈.

4️⃣ The Dart programming language is easy to learn and use, even for beginners. It's so simple, your grandma could probably code in Dart 🧓💻.

5️⃣ Flutter makes it easy to create custom animations and transitions, so you can make your app dance, sing, and do the cha-cha-cha 💃🕺.

6️⃣ Flutter has a built-in material design library, which means your app will look modern and sleek without having to spend hours designing it yourself 🎨👌.

7️⃣ The Flutter community is friendly and supportive, so you'll always have a helping hand when you need it. Plus, they have some great memes 🤣👌.

8️⃣ Flutter's code is compiled directly into native code, which means your app will run faster than you after drinking a cup of coffee ☕️💨.

9️⃣ With Flutter's clean architecture, it's easy to maintain and update your codebase. It's like having a personal assistant, but for coding 🤖💼.

🔟 And finally, using Flutter is just plain fun! You'll feel like a superhero every time you create a new app. It's like having a superpower, but without the spandex suit 🦸‍♀️👕.
Cusdis: a privacy-friendly comment system
Tags: svelte, privacy, webdev
Published: 2023-04-12 23:25:12

[Cusdis](https://cusdis.com/) is a new lightweight, privacy-first, open-sourced comment system. It's a perfect alternative for [Disqus](https://disqus.com/) users who want to retain their privacy.

Installing Cusdis is very easy, and its user interface is simple. Users do not need to sign up before they can comment on your website. This is very great for me because I do not want users to spend time creating an account to just write a single comment.

## Pros

- Cusdis is open-sourced.
  This means that if you are a developer, you can read the source code and make sure they are not tracking your data.

- It is self-hostable.
  In case you want to host your data on your server, Cusdis allows you to do just that.

- It doesn't require the commenter to sign in.

- It also doesn't use cookies.

## Cons

- You have to manually moderate comments.
  Unlike other comment systems, you have to manually moderate your comments in Cusdis. This means that comments are not displayed by default until you approve them.

- The comment widget is not customizable.
  This means you can't use your custom colours and fonts within the widget.

## Installing it on my website

As I said earlier, installing Cusdis is very easy. Just head over to their website and create an account. After that, you will be redirected to your dashboard which will allow you to add a new website. After adding the website, you will be given an embed code which you will place wherever on your page where you want your comment widget to appear.

On this site, my blog posts page is on `src/routes/blog/[slug]/+page.svelte`, and this is how I inserted Cusdis into my website.

```svelte
<article>
<div>
<!-- article content -->
</div>
<!-- [tl! focus:start] -->
<div id="cusdis_thread"
  data-host="https://cusdis.com"
  data-app-id="{appid}"
  data-page-id="{metadata.slug}"
  data-page-url="{$page.url.pathname}"
  data-page-title="{metadata.title}"
  data-theme="{$theme}">
</div>
<svelte:head>
    <script async defer src="https://cusdis.com/js/cusdis.es.js"></script>
</svelte:head>
<!-- [tl! focus:end] -->
</article>
```

This is how I display Cusdis on my website. I provide variables for all the data Cusdis will need to render the comment system.

| Variable Name     | Description                                                            |
| ----------------- | ---------------------------------------------------------------------- |
| `data-host`       | Refers to the domain on which the data is loaded                       |
| `data-app-id`     | Unique ID that is generated by Cusdis                                  |
| `data-page-id`    | Unique keyword used to identify the page (You can use the blog's slug) |
| `data-page-url`   | Current page's URL                                                     |
| `data-page-title` | Title of the current page                                              |
| `data-theme`      | Theme of the widget (Could be light, dark or auto)                     |
React Series: React Component
Tags: react, webdev, javascript, beginners
Published: 2023-04-12 22:58:16

##Introduction

When you are developing a single page application using the DOM structure, you will face a challenge when you want to change a specific part of the application. The creation of React.js solved this problem. React.js is a component-based framework, and if you want to build an application with it, you should understand what components are. This article will teach you what components are and how to use them.

##Prerequisites 
- Have a good knowledge of HTML
- Have a good knowledge of CSS
- Have a good knowledge of Javascript
- Have a good knowledge of React

##What Is A Component
Every piece of user interface (UI) in React.js is a component. 
A component can include everything from the smallest UI in your application, such as a table, button, navbar, or card, to the entire page. 

```react
function RedButton() {
  return (
    <button>Click here</button>
  );
}
```

Components are said to be a fundamental concept in React.js and each component have their own logic and appearance, but they all exist in the same space and are bounded by the parent component. Depending on what you're building, you can create a reusable component that can be used repeatedly on your application.

##Benefit Of Component

The advantage of using components is that because UIs are broken down into small pieces, they are **easier to understand**, **reuse where necessary**, and **modify**. A component should only do one thing; if it needs to do more, it should be broken down into subcomponents.

##How To Identify A Component
As shown below, each React component begins with a **capital letter**.


```react
function BlueButton() {
  return (
    <button>Read more</button>
  );
}
```
 The "export default" keyword is used to identify the main component. Knowing the main component in a file allows you to easily import it from other files.
```react
export default function MyApp() {
  return (
    <div>
      <h2>React Component</h2>
      <BlueButton />
    </div>
  );
}
```
##Conclusion
You can build your application with just one component, but this is risky because you will be unable to easily modify it. Breaking down your React application into components is important because the simplicity of your application's components determines its performance.
Day 734 : Perspective
Tags: hiphop, code, coding, lifelongdev
Published: 2023-04-12 22:26:45

_liner notes_:
- Professional : So.... realized today that a library that I was using for my proof of concept isn't available for public use. Spent the day refactoring code to use things that are available. Took a little longer than I expected.

- Personal : Last night, I went through some tracks for the radio show, did some research on storage and the shower for my van and worked on my side project. I made some pretty good progress with a transition. It was going well, but the way I originally wrote my code didn't really work with the View Transitions API. I'm going to have to do some refactoring.

![View from the shore of a shallow lake in Grüner See, Austria with a forest filled with white and green pine trees with gray snow topped mountains in the distance. ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qcrnck24dsqut5d1zxas.jpg)

Going to do some more refactoring of the code for my side project. The transitions are getting kind of wonky. It's giving me a new perspective on how I can rewrite my code. Also want to check out some tracks for the radio show. We'll see what happens after that.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube WRL-l8BX1Do %}
SaasRock v0.8.4 🎉 - Feature Flags 🚩 + Admin Panel Improvements
Tags: saas, webdev, typescript, react
Published: 2023-04-12 22:25:55

---
title: SaasRock v0.8.4 🎉 - Feature Flags 🚩 + Admin Panel Improvements
published: true
description: Implemented Feature Flags management in the admin portal + manually adding users + deactivating accounts + tenant IP logging + filtering users by last login
tags: saas,webdev,typescript,react
cover_image: https://cdn-images-1.medium.com/max/1600/1*TnXdOoohDa5RQ5UKyT06GA.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-04-12 22:02 +0000
---

Finally, consistent updates. [SaasRock](https://saasrock.com/?ref=dev.to&utm_content=v0-8-4) v0.8.4!

In this update, I focused on enhancing our admin portal with minor improvements and implementing Feature Flags _(Enterprise-only 🚀)_.

### Feature Flags 🚩

You can now manage and control the release of new features using our Feature Flags system. Check out the [video demo](https://www.loom.com/share/c12d15ad42034f438f92653d7d60d461) to learn more:

[![Feature Flags Video](https://user-images.githubusercontent.com/8606530/231593355-28218c3f-604c-4391-96e5-27228544dc2c.png)](https://www.loom.com/share/c12d15ad42034f438f92653d7d60d461 "Feature Flags 🚩")

### Closed Issues

There were a total of 5 closed issues this week:

1. ⭐ Feature: Feature Flags - [#19](https://github.com/AlexandroMtzG/saasrock/issues/19)
2. 🔨 GitHub Issue: Add Admin users from Dashboard - [#28](https://github.com/AlexandroMtzG/saasrock/issues/28)
3. 🔨 GitHub Issue: Deactivate Account - [#147](https://github.com/AlexandroMtzG/saasrock/issues/147)
4. 🔨 GitHub Issue: Tenant IP Logging - [#68](https://github.com/AlexandroMtzG/saasrock/issues/68)
5. 🔨 GitHub Issue: Filter Users by Last Login - [#148](https://github.com/AlexandroMtzG/saasrock/issues/148)

### Screenshots

Add Admin users from Dashboard:

![Add Admin users from Dashboard](https://user-images.githubusercontent.com/8606530/231592584-45d86109-69b5-426c-95dc-d25653bd4bcf.png)

Deactivate/Activate Account with a Reason:

![Deactivate Account](https://user-images.githubusercontent.com/8606530/231592494-1bbba71e-190f-4e5d-8186-f3166c19af8b.png)

Tenant IP Logging:

![Tenant IP Logging](https://user-images.githubusercontent.com/8606530/231592449-ac4e6856-de37-4f25-ab5f-edfb24866ad2.png)

Filter Users by Last Login:

![Filter Users by Last Login](https://user-images.githubusercontent.com/8606530/231592225-eaaf2c61-f22e-4f7e-92c6-c9ed22741063.png)

I hope you enjoy these new features and improvements. As always, I appreciate your feedback and support in the [discord server](https://discord.gg/KMkjU2BFn9).

---

## What's Next?

For v0.9, I'll start working on these two Enterprise features:

- Customer Support / Help Desk MVP
- Knowledge Base

And grab a few more issues from the [roadmap](https://saasrock.com/docs/roadmap?ref=dev.to&utm_content=v0-8-4).
Why Do Microservices Need an API Gateway
Tags: api7cloud, apigateway, microservices
Published: 2023-04-12 22:24:09

## Summary
As the internet world continues to develop, enterprises rapidly evolve, leading to constant changes in system architecture. The microservices architecture has been widely adopted by many companies.

As the data and API quantity of microservices increases, it is crucial to choose an excellent API gateway for high-traffic governance.

[This article](https://api7.ai/blog/why-do-microservices-need-an-api-gateway) compares common API gateways, highlighting their respective advantages and disadvantages. Suppose you are in the process of selecting an API gateway technology, encountering performance issues in your microservice system, or looking to build an efficient and stable microservice system. In that case, this article aims to provide you with some helpful insights.

[Read Now](https://api7.ai/blog/why-do-microservices-need-an-api-gateway)
Join MLH fellowship
Tags: webdev, javascript, programming, beginners
Published: 2023-04-12 21:13:08

**Are you a software developer**

Please, apply to the MLH fellowship. If selected, at the end of the program you will recieve **$ 2,500 USD**

The deadline is on the 30th of May, 2023

https://fellowship.mlh.io/apply

<a href="https://www.buymeacoffee.com/ifeanyichima" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>


**Thank you, Please follow me**

[![HTML](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://linkedin.com/ifeanyi-thankgod-chima)&nbsp;[![GitHub](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/masterifeanyi)
Creating Your First Machine in the Cloud in 3 Simple Steps: A Beginner’s Guide
Tags: cloud, beginners, career, googlecloud
Published: 2023-04-12 20:59:19

Do you want to get your feet wet with the cloud and create your first machine? Creating a machine can seem like a daunting task. However, it's a breeze with Google Cloud Platform (GCP)!

## Step 1: Choosing a Cloud Service Provider

Before we get started, there are three main cloud providers: Amazon Web Service, Microsoft Azure, and Google Cloud Platform. These are the providers, whose hardware you will be using in the cloud. While they are all great choices, we will use GCP in this guide. GCP is easy to use and has an excellent free tier to test without any costs. However, feel free to use any provider you prefer.

## Step 2: Creating an Account

To create your first machine on GCP, you will need a basic Google Account. When you first sign up, you'll need to provide your mailing address and add a credit card. This is in case you want to use services outside the free tier.

## Step 3: Creating Your First Machine

To create your first machine, go to the "Compute Engine" product, which can be found on the main screen or in the side menu. Activate the "Compute Engine API" for your project. Then click "create instance".

Now you need to provide general details about the machine you want to create:

* **Name:** Enter a unique name for your instance.

* **Region/Zone:** Select the physical location of your machine. For this guide, we recommend using `us-west1, us-central1, or us-east1` as it they are included in the free tier.

* **Series and Machine Type:** Choose the size of your machine. For beginners, we suggest using an E2 Series and `e2-micro` type, which is included in the free tier.

* **Boot Disk:** Choose the disk and operating system you want to run. We recommend keeping it at the default `Debian GNU/Linux 11`.

* **Firewall:** This is used if you want to create a public server. Just keep the default values now.

Once you have filled in all the details, hit the "CREATE" button, and Google will start creating your machine. Within a few minutes, your machine will be ready to use. To access it, click "Connect > SSH," and you can start using your machine immediately.

To delete the machine, select the instance and click "delete" in the top menu. That's it.

---

Congratulations! You've now created your first machine on GCP, which only took a few minutes. Cloud computing makes it easy to create and remove infrastructure. As you continue to explore GCP, you'll find that it offers a range of powerful tools and services that can help you build and deploy applications quickly and efficiently.
Understanding Measures of Central Tendency in Marketing Statistics
Tags: statistics, mean, marketing, measuresofcentraltendency
Published: 2023-04-12 20:48:26

Marketing is an essential aspect of any business, and making data-driven decisions is crucial for success. Statistical analysis plays a significant role in marketing, and understanding measures of central tendency is essential for effective marketing analysis. Measures of central tendency are statistical tools used to determine the central or typical value of a set of data. In this article, we will discuss the three main measures of central tendency - mean, median, and mode - and their applications in marketing analysis.

Mean
The mean, also known as the arithmetic average, is calculated by adding up all the values in a dataset and dividing the sum by the total number of values. For example, suppose you are analyzing the sales of a particular product over a month, and the sales figures for the product for each day of the month are as follows: 100, 200, 150, 300, and 250. The mean sales figure for the month would be (100+200+150+300+250)/5 = 200. The mean is an essential measure of central tendency in marketing because it provides a useful average value that can be used for benchmarking, forecasting, and decision-making.

Median
The median is the middle value in a dataset when the values are arranged in numerical order. For instance, if we take the sales figures in the above example, the median would be 200, as it is the middle value when the numbers are arranged in ascending order. Median is useful when the data has outliers or extreme values that can distort the mean. For example, if we add another sales figure of 1000 to the above dataset, the mean would increase significantly to 380, while the median would remain unchanged at 200.

Mode
The mode is the most frequently occurring value in a dataset. For example, if we take the sales figures in the above example and add another value of 250, the mode would be 250 as it is the value that occurs most frequently. The mode is useful when analyzing categorical data, such as customer preferences, as it gives an insight into the most popular choice among a set of options.

Conclusion
Measures of central tendency are essential tools in marketing analysis, providing valuable insights into the central or typical value of a dataset. The mean, median, and mode are the three main measures of central tendency, each with its own strengths and applications. By understanding and utilizing these measures, marketers can make more informed decisions and improve the effectiveness of their marketing campaigns.
Web Scraping from IE Selenium when download file and show promp
Tags: selenium
Published: 2023-04-12 20:37:20

 I want to web scraping and download files using python, selenium and Internet explorer. But this show me a promp with confirmation, How to confirm to save automatically or programtically?.

This downloading only works with IE, then I cannot change of explorer.

`boton_download = driver.find_element_by_xpath("//tbody/tr[3]/td[2]/a[1]/img[1]")
boton_donwload.click()`

Do you want to open or save Reporrrr.MND from www.asdasd.com? Open Save Cancel



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/al78x2caa8ungmi4gmwd.PNG)e description here
"Empowering the Next Generation of Black Tech Talent": CodeNewbie Podcast S23E8
Tags: codenewbie, beginners, career
Published: 2023-04-12 20:37:04

In our final episode of Season 23 of the CodeNewbie Podcast, @saronyitbarek talks with [Pariss Chandler](https://twitter.com/ParissAthena?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor), Founder and CEO of [Black Tech Pipeline](https://blacktechpipeline.com/about/) about the importance of advocating for Black programmers in tech and creating actionable change towards a more diverse tech world.

{% embed https://www.codenewbie.org/podcast/empowering-the-next-generation-of-black-tech-talent %}

Pariss Chandler is a Software Engineer turned Founder & CEO of Black Tech Pipeline and mobilizer of the hashtag, movement and community #BlackTechTwitter.

- [Listen on Apple Podcasts](https://podcasts.apple.com/us/podcast/codenewbie/id919219256?i=1000608583470)

- [Listen on Spotify](https://open.spotify.com/episode/2OcQAdJ3M8trZgK9HWl8PY?si=4740345d7ecc4a1f)

Or, listen wherever you normally get your podcasts!

***

**Make sure to subscribe to the CodeNewbie podcast if you haven't yet!**

Happy coding! We hope you enjoy this season of the CodeNewbie Podcast 💜