teleren/devto huggingface dataset:
Kubernetes 101 - Control Plane
Tags: kubernetes, beginners
Published: 2022-10-30 06:11:39

As mentioned in the previous article, on one side of Kubernetes, we get something called the control plane.

This is the control system that can make decisions about the cluster. For example, ensuring enough pods are online at all times and routing traffic correctly.

## What is the control plane

The control plane is really like the brains of the operation. It includes several components that control your cluster, manage data, state data, and configuration.

It's also solely responsible for ensuring the cluster works the way you want it to, which you defined declaratively (more on that later).

Let's take a closer look at the components inside the control plane.

### kube-apiserver

The API server is one of the components inside the control plane, and it exposes the Kubernetes API.
This API server is the front end of the Kubernetes control plane.

It's responsible for all external and internal requests.
The API server is also designed to scale horizontally, meaning you can spool up multiple instances and communicate between them.

### kube-scheduler

This particular component is used for scheduling pods onto specific nodes according to your needs and resources.
It can determine the best place to put a pod based on multiple requirements.

### kube-controller-manager

The controller is a component that handles all the controller processes, of which we have multiple combined in this one.

Some of these types are:

- Node controller: Ensuring the nodes are up and acting on failing nodes.
- Job controller: Watches for once-off jobs, creates a pod to run the job, and fails them once they're done.
- Namespace controller: Handle all the namespace-specific actions to act on.

And so on, there is a bigger list. Let's go into detail in another article.

The controller manager, it's the overseer of all the individual controllers.

### etcd

This consists of a key-value database used by Kubernetes to store information about your cluster state and config.

### cloud-controller-manager

This particular element contains cloud-specific logic. It lets you link the uniform Kubernetes and each cloud provider's specific needs.

It's important to note this component only exists when running your service on a cloud provider. Locally there is no need for one.

As with the kube-controller-manager, the cloud controller is split into multiple individual controllers depending on the cloud provider's offer.

## Conclusion

The Control Plane is the brains of the operation and can interact between all the resources and systems our cluster needs.

It provides multiple individual components that all serve their purposes.

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Build Instagram Login Page super easy
Tags: webdev, tutorial, beginners, css
Published: 2022-10-30 05:44:07

🌍🤝**Catch me on:** [GitHub](https://github.com/deepakydv9315) || [Codepen](https://codepen.io/deepakydv9315) || [Instagram](https://www.instagram.com/syco_coders/)

**Youtube Tutorial** [Link](https://youtu.be/ih2fEEHrgps)

{% youtube https://youtu.be/ih2fEEHrgps %}
The History of Innovation, the Dodo, and the Low-Code
Tags: lowcode, productivity
Published: 2022-10-30 05:04:48

A frog leap is when something or somebody skips over a step in their expected evolutionary path. It is the equivalent of skipping a class in elementary school, going straight from 4th grade to 6th grade, due to learning so fast, that 5th grade is not relevant anymore.

When a frog leap occurs in innovation, it changes how we must use historical data to predict the trajectory of the future. When frog leaps are due, existing survival mechanisms are typically counter productive, and often causes more harm than good. The best analogy and example of this is paradoxically the Dodo.

![The Dodo and Low-Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a70y4ca8vvxfvc7f6q0v.jpg)

The Dodo was a bird in Mauritius that had grown huge in size as a part of its survival mechanism. As a consequence of its growth, it lost the ability to fly. For millions of years this was the best strategy for the Dodo, and it grew larger and larger due to evolutionary advantages that resulted in larger size improving its ability to survive and spread its genes. Since it had no natural enemies, it did not need to fly, and also lost its fear of other animals.

For millions of years, the Dodo lived in happiness on Mauritius, and prospered as a specie, until one day humans settled the island. A couple of decades later, humans had feasted on every single Dodo in existence, and the Dodo went extinct.

When outer evolutionary storms and intrusive species such as Homo Sapiens enters an eco system, everything changes. Biological evolution is no different here than meme evolution. Memes (_"ideas"_) lives within the same rulesets that biological evolution does. One example of this is how the camera changed art. 300 years ago we had painters like Rembrandt and Leonardo DaVinci. After the camera was invented, everybody could create their own _"Rembrandt"_ in seconds - And as a consequence we got Picasso and Salvador Dali, whom instead of trying their best to portrait reality, had to create absurd art, not possible to reproduce using the camera. An entire generation of naturalistic artists _"went extinct"_ because of photography, and today naturalistic artists barely exists.

![Picasso](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6wxw68o00eudzgzhhdc2.jpg)

So what does this have to do with low-code and software development? It's quite simple in fact, low-code is a frog leap of innovation, similar to the camera - And the effects on our eco system will be similar to the effects the camera had on art 120 years ago, and the effect homo sapiens had on the Dodo in Mauritius.

> If you want to "survive" as a software developer in the future, you have to do something completely different than what you're used to doing - Or you'll "go extinct" - You have to "find your Picasso"

In the video below I am walking you through the arguments, by using analogies I think are fitting, in addition to historical examples of frog leaps. Let me know what you think in the comments.

{% embed https://www.youtube.com/watch?v=LHe6Bj_ib-w %}
How behave 'Scanner', 'nextInt()', and 'nextLine()'?
Tags: java, beginners, programming
Published: 2022-10-30 05:03:10

## Oneday, I programed system worked weird.
When I tried to have the user enter a string after entering a numerical value, the system terminated after entering the numerical value.
In other words, the string input step was skipped.
I don't expected behave this.

```java
public class App {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        System.out.println("What is number1?");
        int number1 = scan.nextInt();

        System.out.println("What is string1?");
        String string1 = scan.nextLine();

        System.out.println("number1 is " + number1);

        System.out.println("string1 is " + string1);
    }
}
```

As a result of the above syntax.
```
number1 is 1
string1 is 
```
Why does it happen?

##nextLine()
>public int nextInt(int radix)
Scans the next token of the input as an int. This method will throw InputMismatchException if the next token cannot be translated into a valid int value as described below. If the translation is successful, the scanner advances past the input that matched.

## so what?

### Let's run some verification programs.

```java
Scanner scan = new Scanner(System.in);

int num1 = scan.nextInt();

System.out.println("What is number?");
System.out.println(num1);

System.out.println("What is string?");
String str = scan.nextLine();

System.out.println(str);
System.out.println("end");
```

```
1

end
```

In other words, if you enter a number in the first code and press Enter, "number + \n" will be entered into the "scan".
When this is read by "nextline()", only the number is read.
Then "\n" will remain in "scan".
I thought I would enter the value in the next step, but "scan" already contains "\n".
This is the same behavior as the enter key being pressed.


## How to resolve.

You can use "next()".

```java
public class App {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        System.out.println("What is number1?");
        int number1 = scan.nextInt();

        System.out.println("What is string1?");
        String string1 = scan.next(); //fixed

        System.out.println("number1 is " + number1);

        System.out.println("string1 is " + string1);
    }
}
```

```
What is number1?
1
What is string1?
str
number1 is 1
string1 is str
```

and also, using "parseInt" You can fixed.
```java
public class App {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        System.out.println("What is number1?");
        int number1 = Integer.parseInt(scan.nextLine()); //fixed

        System.out.println("What is string1?");
        String string1 = scan.nextLine();

        System.out.println("number1 is " + number1);

        System.out.println("string1 is " + string1);
    }
}
```
```
What is number1?
1
What is string1?
str
number1 is 1
string1 is str
```

thank you.
1293. Leetcode solution in Java
Tags: java
Published: 2022-10-30 04:41:10

```java
class T {
  public int i;
  public int j;
  public int eliminate;
  public T(int i, int j, int eliminate) {
    this.i = i;
    this.j = j;
    this.eliminate = eliminate;
  }
}

class Solution {
  public int shortestPath(int[][] grid, int k) {
    final int m = grid.length;
    final int n = grid[0].length;
    if (m == 1 && n == 1)
      return 0;

    final int[] dirs = {0, 1, 0, -1, 0};
    int steps = 0;
    Queue<T> q = new ArrayDeque<>();
    q.offer(new T(0, 0, k));
    boolean[][][] seen = new boolean[m][n][k + 1];
    seen[0][0][k] = true;

    while (!q.isEmpty()) {
      ++steps;
      for (int sz = q.size(); sz > 0; --sz) {
        final int i = q.peek().i;
        final int j = q.peek().j;
        final int eliminate = q.poll().eliminate;
        for (int l = 0; l < 4; ++l) {
          final int x = i + dirs[l];
          final int y = j + dirs[l + 1];
          if (x < 0 || x == m || y < 0 || y == n)
            continue;
          if (x == m - 1 && y == n - 1)
            return steps;
          if (grid[x][y] == 1 && eliminate == 0)
            continue;
          final int newEliminate = eliminate - grid[x][y];
          if (seen[x][y][newEliminate])
            continue;
          q.offer(new T(x, y, newEliminate));
          seen[x][y][newEliminate] = true;
        }
      }
    }

    return -1;
  }
}

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/shortest-path-in-a-grid-with-obstacles-elimination/
Primitive Data Types
Tags: blockchain, solidity, web3
Published: 2022-10-30 04:21:18

## Primitive Data Types
Here we introduce you to some primitive data types available in Solidity.

- `boolean`
- `uint`
- `int`
- `address`

## Boolean 
`Bool`: The possible values are constants`True` and `False`.

Operators:

- `!` (logical negation)

- `&&` (logical conjunction, “and”)

- `||` (logical disjunction, “or”)

- `==` (equality)

- `!=` (inequality)


## uint

uint stands for `unsigned integer`, meaning non negative integers<br>
    different sizes are available<br>
        `uint8`   ranges from 0 to 2 ** 8 - 1<br>
        `uint16`  ranges from 0 to 2 ** 16 - 1<br>
        ...<br>
        `uint256` ranges from 0 to 2 ** 256 - 1<br>

Operators:

- Comparisons: `<=`, `<`, `==`, `!=`, `>=`, `>` (evaluate to bool)

- Bit operators: `&`, `|`, `^` (bitwise exclusive or), `~` (bitwise negation)

- Shift operators: `<<` (left shift), `>>` (right shift)

- Arithmetic operators: `+`, `-`, unary `-` (only for signed integers), `*`, `/`, `%` (modulo), `**` (exponentiation)

## int

`Negative numbers` are allowed for int types.<br>
    Like `uint`, different ranges are available from `int8` to `int256`<br>
    ....<br>
    `int256` ranges from -2 ** 255 to 2 ** 255 - 1<br>
    `int128` ranges from -2 ** 127 to 2 ** 127 - 1


## address


The address type comes in two flavours, which are largely identical:

- `address`: Holds a 20 byte value (size of an Ethereum address).
- `address payable`: Same as `address`, but with the additional members `transfer` and `send`.

The idea behind this distinction is that `address payable` is an address you can send Ether to, while you are not supposed to send Ether to a plain `address`, for example because it might be a smart contract that was not built to accept Ether.
DPS909 Blog :LAB 6 Intro to Docusaurus.
Tags: opensource, beginners
Published: 2022-10-30 03:58:06

## Overview
For this lab we are going to extend our SSG projects by exploring the features of a popular SSG, Docusaurus.

## Docusaurus

[Docusaurus](https://docusaurus.io/) is a React-based static site generator [built and maintained by Facebook](https://github.com/facebook/docusaurus).  It helps projects document their technology for users and developers, without having to put a lot of effort into creating a full website.

## Learned from this lab

- Setting up and learning the Docusaurus project for a documentation site
- Evaluating existing open source projects for inspiration and ideas when building your own solutions
prototyping a new feature in your SSG


## Docusaurus Repo and link

After studying through the material and online resource i have created this.
Github Repo:
[docusaurus-sample-repo](https://github.com/anshul137/docusaurus-sample-repo)

Deployed link:
[docusaurus-sample](https://anshul137.github.io/docusaurus-sample-repo/)

## Issues created and fixed during this lab
[issues-13](https://github.com/anshul137/ag-ssg/issues/13)
[issues-14](https://github.com/anshul137/ag-ssg/issues/14)

## Feature from Docusaurus
I really like the theme feature where user can switch from dark mode or light mode according to their choice.
I have use the `Darkmode.Js` to achieve this functionality in my code. 
After finishing my code i have created this 
[PR](https://github.com/anshul137/ag-ssg/commit/3087bb1b1fb41790415b0c56c24b8d68d9e091a2)

## Outcome after implementing my feature

### Dark Mode
![Dark Mode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/15zotxpglb9mfavy6m9p.png)

#### Light Mode
![Light Mode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6mxui0cp0ctt4xh894f1.png)

Now all the linked pages and newly created features will have this feature.

`Thanks`
Hacktoberfest::end();
Tags: hacktoberfest, opensource
Published: 2022-10-29 22:04:07

Hey there! Thanks for checking in.

After a month of searching and contributing to 4 different repos, I am glad to say that I am finally done with this year Hacktoberfest! 

It has been a great experience, and now I feel much more confident as a developer and a contributor.

## My pull request blog posts

1. [PR#1](https://dev.to/devils2ndself/language-is-key-for-supporting-the-nation-3j7h)
1. [PR#2](https://dev.to/devils2ndself/hacktoberfest-pr2-windows-isnt-the-greatest-os-for-development-4f41)
1. [PR#3](https://dev.to/devils2ndself/hacktoberfest-pr3-monorepos-are-cool-but-come-at-a-cost-n9j)
1. [PR#4](https://dev.to/devils2ndself/hacktoberfest-pr4-back-to-the-roots-34nh)

## Skills and techniques I learned 

First and foremost, what I accomplished in October was that I expanded my Git and GitHub skills. If I compare what I knew and could do a month ago and now regarding git, it would seem like 2 different people.

Another valuable thing I learnt is how projects are usually structured and set up for installation. Docker, docker-compose, pnpm, Python requirements & vendors, and much more. By learning how big repos structure and design their solutions, I can improve my future projects and workspace. 

## Not without struggles, of course

If someone would ask of I'd like to try Hacktoberfest next year too, I would hesitate. Working on things and contributing to world-changing projects is really fun; however searching for possible issues isn't as much fun.

In total, I believe I spent over 12 hours simply searching for fitting issues and repositories. Maybe if I make a list of repositories I like or come up with a better searching technique, I would try Hacktoberfest again. 'Issue-searcher' also seems like a good idea for a project to create!

## Summary

Hacktoberfest really gives you a chance and motivation to try new tools or strengthen one's skills. This was a great challenge and it is very relieving to be done with it!
Hacktoberfest Recap
Published: 2022-10-30 01:23:25

Hi everyone,

I have finally completed my Hacktoberfest journey. It was definitely a lot more stressful than I thought, but I'm glad I was able to complete it on time. The main problem that I had was finding the right issue to work on. It took me way too long to find the right issues that I wanted to work on. 

Here are my blogs that document my journey:

1. https://dev.to/neilan99/my-first-pr-for-hacktoberfest-b9d
2. https://dev.to/neilan99/my-second-pr-for-hacktoberfest-4geh
3. https://dev.to/neilan99/my-third-hacktoberfest-pr-823
4. https://dev.to/neilan99/my-fourth-hacktoberfest-pr-4oni

I learned a few things on my journey. First, finding the right issue is important. I had to make sure the repo I was working on was documented well and had been updated recently. I also learned to start early, because I ran into a lot of problems that made me unable to continue to work and I had to scrap some issues I worked on. Most repo owners were very helpful and friendly, but I did run into some who did not answer my questions or were not responding at all. I became very familiar with contributing to a repo and I learned how to read documentation better. Finally, I learned to believe in my own skills as a programmer.
Who will win the 2022 Brazilian Presidential Election?, according to statistics.
Tags: datascience
Published: 2022-10-30 00:20:40

Tomorrow, A new President will be elected to lead the Federative *Republic of Brazil*, since this has become a popular topic in the media, many news outlets have run opinion polls on presidential candidates; what does this data tell us about a possible winner?.

### Is it possible to predict a winner for the election using opinion polling data?

The short answer is yes, if you want to know more about the use of inference to make this prediction feel free to read our previous post regarding the power of opinion polling data: <https://artofcode.tech/who-will-win-the-2022-colombian-election-according-to-statistics/>, or go directly to our current forecast:

### Check out our current forecast here: <https://artofcode.tech/2022-brazilian-election-forecast/>

### How to interpret this model?

![](https://res-2.cloudinary.com/hbig9cpoo/image/upload/q_auto/v1/ghost-blog-images/Rplot.png)

Lula's chances of winning according to our model are over 95%, which in statitistics can be interpreted as certainty, this basically means that we are sure that he will be the winner of the election, if you want to know more about how we made this prediction feel free to check our inference model on Github.

### References:

Forecast: <https://artofcode.tech/2022-brazilian-election-forecast/>
Github: <https://github.com/christianpaez/brazilian-election-analysis-2022>
Image credit: <https://unsplash.com/@phillustrations>
Keep the same Node.js version between local environment and Github Actions
Tags: javascript, node, github, githubactions
Published: 2022-11-13 18:05:40

---
title: Keep the same Node.js version between local environment and Github Actions
published: true
date: 2022-10-30 00:00:00 UTC
tags:
  - javascript
  - nodejs
  - github
  - githubactions
canonical_url: https://www.emmanuelgautier.com/blog/keep-node-version-github-actions-local-development
---

It can be complicated to have the same Node version between the local environment and the CI/CD. The latest Node.js version or the latest lts is released recently and if you want to upgrade to the Node version, usually you can forget to configure one environment. For that reason, it can be important to have only one source of truth to define the Node version, so you change in one place it impacts every environment.

Here we will use nvm and have the CI/CD example with Github Actions. Some other CI/CD solutions can exist elsewhere using a similar configuration and reproduce the common configuration.

First of all, you should configure a `.nvmrc` file defining the version you want to use. This version will be used in your local environment. To use it, you can either make an `nvm use` each time you go to the project's local directory or configure your bash to use it automatically.

Here is an example of a `.nvmrc` file content:

```text
lts/hydrogen

```

Then, you can configure the Github Action so to use the same .nvmrc file.

```text
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup node env
        uses: actions/setup-node@v3
        with:
          node-version-file: '.nvmrc'
          cache: 'yarn'
```

Now, when you change the .nvmrc file, it changes the version used for your local environment, the Node environment for all your team, and the CI/CD running on Github.
Extends Express session SessionData type
Tags: javascript, node, github, githubactions
Published: 2022-11-13 18:25:06

---
title: Extends Express session SessionData type
published: true
date: 2022-10-30 00:00:00 UTC
tags:
  - javascript
  - nodejs
  - github
  - githubactions
canonical_url: https://www.emmanuelgautier.com/blog/extends-expressjs-session-typescript-sessiondata
---

It can be complicated to have the same Node version between the local environment and the CI/CD. The latest Node.js version or the latest lts is released recently and if you want to upgrade to the Node version, usually you can forget to configure one environment. For that reason, it can be important to have only one source of truth to define the Node version, so you change in one place it impacts every environment.

Here we will use nvm and have the CI/CD example with Github Actions. Some other CI/CD solutions can exist elsewhere using a similar configuration and reproduce the common configuration.

First of all, you should configure a `.nvmrc` file defining the version you want to use. This version will be used in your local environment. To use it, you can either make an `nvm use` each time you go to the project's local directory or configure your bash to use it automatically.

Here is an example of a `.nvmrc` file content:

```text
lts/hydrogen

```

Then, you can configure the Github Action so to use the same .nvmrc file.

```text
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup node env
        uses: actions/setup-node@v3
        with:
          node-version-file: '.nvmrc'
          cache: 'yarn'
```

Now, when you change the .nvmrc file, it changes the version used for your local environment, the Node environment for all your team, and the CI/CD running on Github.