teleren/devto huggingface dataset:
Staircase problem in JS
Tags: javascript, interview
Published: 2022-12-24 13:18:38

Interviews can be an intimidating process, and the pressure can be overwhelming. It’s not uncommon for employers to ask questions in which if you don’t think in the right direction, it could be a game over. With the right preparation and practice, you can be ready for any difficult question that comes your way. In this article, we'll explore one of the questions that got the better of me.

**Problem Statement -** 
There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. 
Given N, write a function that returns the number of unique ways you can climb the staircase.

```
const totalSteps=4; 
const stepsInSingleJump=[1,2]; 
function getAllCombinations(){ }
console.log(getAllCombinations(totalSteps, stepsInSingleJump)) 

// output: [[1,1,1,1], [1,1,2], [1,2,1], [2,1,1], [2,2]]
```

Why not try to write a pseudo code before you see the answer below? It's pretty easy if you can determine what programming concept you have to use here.

---

**Hint -** Recursion

```
function getAllCombinations(totalSteps, stepsInSingleJump) {
  let combinations = [];

  function recurse(currentSteps, currentCombo) {
    if (currentSteps === totalSteps) {
      combinations.push(currentCombo);
      return;
    }
    if (currentSteps > totalSteps) {
      return;
    }

    for (const step of stepsInSingleJump) {
      recurse(currentSteps + step, [...currentCombo, step]);
    }
  }

  recurse(0, []);
  return combinations;
}

console.log(getAllCombinations(4, [1, 2]));
```


**Explanation -**

The function uses recursion to explore all the possible combinations of steps. It maintains a combinations array to store the combinations and a currentCombo array to store the current combination being built.

The base case is when the currentSteps is equal to totalSteps. In this case, the currentCombo is added to the combinations array. The recursion ends when currentSteps becomes greater than totalSteps, since it is not possible to exceed the total number of steps.

For each step in stepsInSingleJump, the function calls itself with the updated currentSteps (which is the sum of the current step and the number of steps already taken) and the updated currentCombo (which includes the current step). This continues until the base case is reached, at which point the combinations are returned.
Linear Regression Concept using Python Programming
Tags: machinelearning, datascience, python
Published: 2022-12-24 12:52:09

```python
from sklearn.linear_model import LinearRegression
# Load the data
X = [[1], [2], [3], [4], [5],[6],[7],[8],[9],[10]]
y = [8, 16, 24, 32, 40, 48,56,64,72,80]

# Create the model
model = LinearRegression()
X = np.array(X)
y = np.array(y)
# Train the model on the data
model.fit(X, y)
test = [[30000]]
z = model.predict(test)
print(int(z))
```

This code uses the linear regression model from the scikit-learn library to predict a continuous value.

First, it imports the LinearRegression class from scikit-learn and creates an instance of the model called "model". Then, it loads the data that will be used to train the model. In this case, the data consists of two lists: X and y. X contains a list of integers from 1 to 10, and y contains the corresponding values of 8, 16, 24, 32, 40, 48, 56, 64, 72, and 80.

Next, the code trains the model on the data by calling the "fit" method and passing in the X and y arrays as arguments. This method fits the model to the data and allows it to learn the relationship between X and y.

Finally, the code makes a prediction using the model by calling the "predict" method and passing in a new test value, [[30000]], as an argument. The result of this prediction is stored in the variable "z" and printed to the console as an integer.
790. Leetcode Solution in cpp
Tags: cpp
Published: 2022-12-24 12:51:43

```cpp
class Solution {
 public:
  int numTilings(int N) {
    constexpr int kMod = 1e9 + 7;

    vector<long> dp(1001, 0);
    dp[1] = 1;
    dp[2] = 2;
    dp[3] = 5;

    for (int i = 4; i <= N; ++i)
      dp[i] = (2 * dp[i - 1] + dp[i - 3]) % kMod;

    return dp[N];
  }
};
```
#leetcode
#solution 
Here is the link for the problem:
https://leetcode.com/problems/domino-and-tromino-tiling/
Reset MySQL Root Password (Version 8 and above)
Tags: mysql, database, firstpost
Published: 2022-12-24 07:42:54

Today, I faced a problem while trying to reset the root password for a MySQL database. In order to help others who may be in a similar situation, I am sharing a tutorial that outlines the steps that worked for me. 

While there are many resources available on this topic, I hope that this post will be a helpful addition.

To follow these steps, you will need access to the server using SSH.

Stop the MySQL process using the following command:

```bash
sudo service mysql stop
```

Start the MySQL service with the **`--skip-grant-tables`** option, which allows you to connect to the MySQL server without a password:

```bash
sudo mysqld_safe --skip-grant-tables &
```

If you encounter an error saying "mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists," try creating the directory and setting the correct ownership and permissions with these commands:

```bash
sudo mkdir /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
sudo chmod 755 /var/run/mysqld
```

Connect to the MySQL server as the root user:

```bash
mysql -u root
```

Run the following MySQL commands to reset the root password:

```sql
UPDATE mysql.user SET authentication_string=null WHERE User='root';
FLUSH PRIVILEGES;
exit;
```

Connect to the MySQL server again as the root user:

```bash
mysql -u root
```

Set a new password for the root user using the **`ALTER USER`** command. Be sure to use a strong, unique password:

```sql
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '{mypassword}';
```

*Replace **`{mypassword}`** with your desired password.*

Stop the running mysqld process:

```bash
sudo killall -KILL mysql mysqld_safe mysqld
```

Start the MySQL process normally and log in with your new password:

```sql
service mysql start
mysql -u root -p
```
What is html attribute with examples ..
Published: 2022-12-24 12:34:18

HTML attributes provide additional information about HTML elements. They are specified in the opening tag and consist of a name and a value, separated by an equals sign (=).

For example, in the following HTML code:

```
<a href="https://www.example.com">This is a link</a>
```

The href attribute specifies the destination URL of the link. The value of the attribute, https://www.example.com, specifies where the link will take the user when they click on it.

Here are some other examples of HTML attributes:

 

 1. 'src' attribute in the img element, which specifies the source URL of an image.

 2. 'alt' attribute in the img element, which specifies an alternate text for an image.

 3. 'width' and 'height' attributes in the img element, which specify the width and height of an image in pixels.

 4. 'class' attribute in any HTML element, which can be used to specify a class name for an element.
 
 5. 'id' attribute in any HTML element, which can be used to specify a unique id for an element.


HTML attributes are always specified in the opening tag of an element and are used to provide additional information about the element. They can be used to control the appearance and behavior of an element, or to provide information about the element that can be used by a script.
what is HTML element with example..
Tags: html, eleme, webdev, website
Published: 2022-12-24 12:18:59

HTML elements are the building blocks of HTML documents. They are used to structure the content of a webpage and to add meaning and semantics to the content.

An HTML element is represented by a pair of tags, an opening tag and a closing tag, with the content of the element appearing between the two tags. For example:

```
<p>This is a paragraph.</p>

```

In this example, the p element represents a paragraph and the content of the paragraph, "This is a paragraph," appears between the opening <p> tag and the closing </p> tag.

There are many different types of HTML elements, including elements for headings, paragraphs, lists, links, images, and more.

Here is an example of an HTML document with a variety of different elements:

```
<!DOCTYPE html>
<html>
<head>
  <title>My Website</title>
</head>
<body>
  <h1>Welcome to My Website</h1>
  <p>This is my personal website where I share my interests and hobbies.</p>
  <h2>About Me</h2>
  <p>I am a programmer and avid reader. I enjoy hiking and spending time with my family.</p>
  <h2>My Hobbies</h2>
  <ul>
    <li>Reading</li>
    <li>Hiking</li>
    <li>Programming</li>
  </ul>
  <h2>Contact Me</h2>
  <p>You can reach me at <a href="mailto:me@example.com">me@example.com</a>.</p>
</body>
</html>

```

In this example, the html, head, title, body, h1, p, h2, ul, and li elements are all used to structure the content and add meaning to the webpage. The a element is used to create a hyperlink.
New free seo tool website
Published: 2022-12-24 12:07:36

There are many free SEO tools available on the web that can help you improve your website’s search engine optimization. Some popular free SEO tools include:

Google Search Console: This [tool](https://www.emexee.com/) from Google helps you monitor and maintain your site’s presence in Google search results. It provides data on your website’s traffic and performance, as well as alerts for any issues that need to be addressed.
Google Analytics: This tool also from Google provides detailed information on your website’s traffic, including the sources of your traffic and the keywords people are using to find your site.
SEMrush: This tool provides a range of SEO and marketing features, including keyword research, website audit, and competitor analysis. It also has a free version that includes limited features.
Ahrefs: This tool offers a range of SEO features, including keyword research, backlink analysis, and website audit. It also has a free version that includes limited features.
Moz: This tool offers a range of SEO features, including keyword research, link building, and site audit. It also has a free version that includes limited features.
There are many other free SEO tools available, and it’s worth experimenting with a few different ones to see which ones work best for your needs. It’s also a good idea to use a combination of free and paid tools to get the most comprehensive picture of your website’s SEO performance.
Introduction of HTML
Tags: webdev, html, css, javascript
Published: 2022-12-24 12:02:33

HTML (HyperText Markup Language) is a standard markup language for creating web pages and web applications. HTML is written in the form of HTML elements consisting of tags enclosed in angle brackets (like <html>). HTML tags typically come in pairs like although some tags, known as self-closing tags, are unpaired, for example br.

HTML is used to structure the content of a web page, and to define the meaning and behavior of that content. For example, you can use HTML to create headings, paragraphs, lists, links, images, and more.

**Here is a simple example of an HTML page:**

```
<!DOCTYPE html>
<html>
<head>
  <title>My Page</title>
</head>
<body>
  <h1>Welcome to my page</h1>
  <p>This is my first web page.</p>
  <ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
  </ul>
</body>
</html>

```

The <!DOCTYPE html> declaration at the top of the page tells the web browser that this is an HTML5 document. The <html> element is the root element of the HTML page, and all other elements are contained within it. The <head> element contains metadata about the page, such as the page title, and the <body> element contains the actual content of the page. In this example, the page has a heading h1 and a paragraph p, as well as an unordered list ul with three list items li.

HTML is a powerful and flexible language, and it is the foundation of the modern web. If you want to learn more about HTML, there are many resources available online, such as tutorials, guides, and reference materials.
[AWS]AWS DevOps Engineer - Professional
Tags: awscertificated, awsdevops
Published: 2023-12-30 12:48:47

---
title: [AWS]AWS DevOps Engineer - Professional
published: true
date: 2022-12-24 11:59:43 UTC
tags: 
- AWSCertificated
- AWSDevOps
canonical_url: https://www.kmp.tw/post/awsdevopsexperoence/
---

## 這次考的認證為 `AWS DevOps Professional`


### 主要是理由有二：
- 弱弱的 [Developer](https://www.kmp.tw/post/awsdeveloperexperience/) 跟 [Sysops](https://www.kmp.tw/post/awssysopsexperience/) 即將在近期過期, 考取這張可以順便 Renew 這
兩張即將過期的證照 (CP值超高)
- 這張是專業級的另一張證照, 考齊兩張專業級以及三張助理級的證照對弱弱來說算是可以開啟另外一個階段的敲門磚


### 這次弱弱只有看 [Jayendrapatil's Blog](https://jayendrapatil.com/aws-certified-devops-engineer-professional-exam-learning-path/) 的資料, 並且搭配 [AWS 官方](https://d1.awsstatic.com/training-and-certification/docs-devops-pro/AWS%20Certified%20DevOps%20Engineer%20Professional_Exam%20Guide_v1.5_FINAL%20(2).pdf)的一些說明

### 基本上會圍繞著六大部分去出題
- SDLC Automation
- Configuration Management and Infrastructure as Code
- Monitoring and Logging
- Policies and Standards Automation
- Incident and Event Response
- High Availability, Fault Tolerance, and Disaster Recovery


### 考試時間一樣為 180 分鐘, 並可申請 30 分鐘的延長, 及格分數為 750 分

### 最後一樣讓弱弱來炫耀一下囉 :D

![dopc01](http://img.kmp.tw/dopc01.jpg)
Blockchain: Starting of new Journey
Tags: blockchain, solidity, beginners, decentrilized
Published: 2022-12-24 11:52:45



Hi there !! , I just started learning **Blockchain** and it's my new year resolution to become **Blockchain Developer in 2023** .

So let's get started with Blockchain Introduction.

**BLOCKCHAIN :**
A Blockchain is a constantly growing **ledger** which make sure to keep permanent record of all the transactions that have taken place in **chronological** ,**immutable** and **secure** way.

In know a lot's of Buzzwords there. So let's understand this in a simple way.

Basically a Blockchain is a chain of Blocks that contains information and chain of blocks collectively known as ledger.

Each time when a block get's completed(i.e. when record is stored in the block). A New Block is generated.

Also we cann't change the information in the ledger which makes this secure.
![BLOCKCHAIN](https://user-images.githubusercontent.com/99062463/209332790-0c3d81d1-8f69-4615-b7c8-11d93f93f82a.png)

**Detailed Explanation :**
As we know that, Blockchain is a chain of Block and each block contains some digital information.
Also ,
Each Block of Blockchain has **32-Bit** unique whole number called **NOnce** which is connected to **256-Bit** of Hash Number.

A **Chain of Cryptographic Hash function** is used for connection between Blocks and they are linked in such a way that each block links to it's previous block.


So, that's for this Blog.  I will surely add Blogs for Blockchain from now so that whenever I need Revision I will use these blogs. Also it will help others to gain knowledge from these blog.
If anyone is Blockchain Expert or also learning Blockchain feel free to add more content in comments.
Roadmap of web development
Tags: webdev, javascript, programming, tutorial
Published: 2022-12-24 11:52:24

Web development refers to the process of building and maintaining websites and web applications. There are many different technologies and frameworks that are used in web development, and the specific tools and technologies that you will use will depend on the project you are working on and your personal preferences.


**Here is a general roadmap for learning web development:**

1. Learn HTML: HTML (HyperText Markup Language) is the standard markup language for creating web pages and web applications. It is used to structure and format content on the web.

2. Learn CSS: CSS (Cascading Style Sheets) is a stylesheet language used for describing the look and formatting of a document written in HTML. It is used to control the appearance of web pages and web applications.

3. Learn JavaScript: JavaScript is a programming language that is commonly used in web development to add interactivity to web pages and web applications. It is used to create dynamic effects such as animations, form validation, and to handle events such as clicks, hover, and more.

4. Learn a web framework: There are many different web frameworks available that can make it easier to build web applications. Some popular frameworks include React, Angular, and Vue.js.

5. Learn a back-end language: In addition to the front-end technologies (HTML, CSS, and JavaScript), you will also need to learn a back-end language if you want to build server-side applications. Some popular back-end languages include Python, Java, and PHP.

6. Learn a database: Most web applications store data in a database, so you will need to learn how to work with a database in order to build more advanced applications. Some popular databases include MySQL, PostgreSQL, and MongoDB.


I hope this roadmap helps give you an idea of the steps involved in learning web development. Let me know if you have any questions!
Dio Interceptors in Flutter
Tags: dio, flutter, dart
Published: 2022-12-24 11:46:29

[Medium Articles](https://medium.com/@crpoudyal/dio-interceptors-in-flutter-6ac22d9a1de)

Dio interceptors are a feature of the Dio library in Flutter that allow you to intercept and modify HTTP requests and responses. This can be useful for a variety of purposes, such as logging, debugging, authentication, and caching.

To use interceptors with Dio, you first need to create an instance of the Dio class and then add your interceptors to the interceptors list. For example, suppose you want to create an interceptor that logs all requests and responses:



```
var dio = Dio();

dio.interceptors.add(InterceptorsWrapper(
  onRequest: (RequestOptions options) {
    print('Request: ${options.method} ${options.path}');
    return options;
  },
  onResponse: (Response response) {
    print('Response: ${response.statusCode}');
    return response;
  },
  onError: (DioError e) {
    print('Error: ${e.message}');
    return e;
  },
));
```

Here, an instance of the Dio class is created and then an interceptor is added to the interceptors list. The interceptor has three callback functions: onRequest(), onResponse(), and onError(). These callback functions are called whenever a request is made, a response is received, or an error occurs, respectively. In this example, the callback functions simply log the request and response information.

Once you have added your interceptors, you can use the Dio instance to make HTTP requests as usual. The interceptors will automatically be applied to each request and response.

In general, Dio interceptors are a powerful and flexible tool for modifying HTTP requests and responses in Flutter. They can be used for a variety of purposes, such as logging, debugging, authentication, and caching.
Free time tracker for developers
Tags: tracker, timer, work, django
Published: 2022-12-24 11:39:29

Friends, I would like to share with you my wonderful and free project that will be of interest to you.

I have created a free time tracker https://workhours.space for programmers (and not only) where you can easy track your time, calculate salary, make reports and many more.

Forget about boring authorization.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0sizfzxl65xbs8ehf7go.PNG)

You can register in two click via telegram or chrome metamask extension.

After registration, a perfect profile account is available to you.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4pbj29fx3gkuzp7kjsb4.PNG)

You can track your working time via telegram.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8buenbwkd3ccz6b8nicp.PNG)

Or via web interface.

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

Your session list looks nice.

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

Also you can share session to your employer.


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

Enjoy https://workhours.space
It is free and simple.
Core Java-Static keyword
Tags: java
Published: 2022-12-24 11:29:53

**Public class HelloWorld {
public static void main(string[] args){
System.out.println("Hello World");
}
}**

For Static block, method and variable we don't need to create a object reference to access it we can directly access it by calling the class.method and varaible.
Static block is executed at compile time itself.

**Static**
Static - class level (No matter how many objects is created it will share the same block or method).
Non-Static - Object level.

Example :
      Banking Example -
          AccountBalance is non static object level.
          Interest rate, Bank name is a static class level.

**Static block is executed before the main method. If we have 2 static block it will be executed in order after that main method is executed.**

Static methods- 
      A static method is called with class name.
Static Variable-
      A static Variable is used to declare a variable for memory management.
Example:
      ClgName = "SRM";
its common for every student.



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


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


**Non Static**
Any functionality that belongs to object is called non-Static.
Non-Static Variable, Non-Static User defined Methods, Non-Static Block and Constructor.


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


**Default Constructor** - If we don't create a constructor java compiler itself create a constructor. So at the time of object creation it will not cause any error.

**Object Reference** Student s1 = new Student(); here s1 is object reference. it will hold the address of the object in memory.
It will allow to access the object members (varaibles or methods) from non static context.

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


Before assigning a object to reference variable initially it was null. after assigning it to new object memory is created.

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


**This Keyword** This keyword is used to refer the current object address. If we use this.variable it will print the value of the variable.

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


Creating object inside a static method.

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

Invoke a non static method in object.

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