teleren/devto huggingface dataset:
Linux file system
Tags: linux, scor32k
Published: 2023-08-10 05:52:10

### In one line 


**/bin** -> Program and commands that all users can run 

**/boot** -> All the files needed at boot time 

**/dev** -> special files that represent the device on your system 

**/etc** -> configuration files eg. MySQL, Oracle 

**/home** -> user home directories 

**/home/scor32k** -> home directory for the scor32k user

**/tmp** -> space for programs to create temporary files 

**/usr** -> programs and data usable by all users 

**/var** -> system log and spool files

### Brief


**/** - The root directory of the entire filesystem hierarchy, everything is nestled under this directory. 

**/bin** - Essential ready-to-run programs (binaries), include the most basic commands such as ls and cp. 

**/boot** - Contains kernel boot loader files. /dev - Device files. 

**/etc** - The core system configuration directory, should hold only configuration files and not any binaries. 

**/home** - Personal directories for users, hold your documents, files, settings, etc. 

**/lib** - Holds library files that binaries can use. 

**/media** - Used as an attachment point for removable media like USB drives. /mnt - Temporarily mounted filesystems. 

**/opt** - Optional application software packages. 

**/proc** - Information about currently running processes. 

**/root** - The root user's home directory. 

**/run** - Information about the running system since the last boot. 

**/sbin** - Contains essential system binaries, usually can only be run by root. 

**/srv** - Site-specific data which are served by the system. 

**/tmp** - Storage for temporary files 

**/usr** - This is unfortunately named, most often it does not contain user files in the sense of a home folder. This is meant for user installed software and utilities, however, that is not to say you can't add personal directories in there. Inside this directory are sub-directories for /usr/bin, /usr/local, etc. /var - Variable directory, it's used for system logging, user tracking, caches, etc. Basically anything that is subject to change all the time

If the article helps you, leave a like, follow, or anything 🙂.
You can follow me on [LinkedIn](https://www.linkedin.com/in/abhishekpathak32/) and [GitHub](https://github.com/scorcism).
Boot Process Overview
Tags: linux, beginners, scor32k
Published: 2023-08-10 05:35:53

The Linux boot process can be broken down into 4 simple stages:

1) BIOS


The BIOS (stands for "Basic Input/Output System") initializes the hardware and makes sure with a Power-on self-test (POST) that all the hardware is good to go. The main job of the BIOS is to load up the bootloader.

2) Bootloader


The bootloader loads the kernel into memory and then starts the kernel with a set of kernel parameters. One of the most common bootloaders is GRUB, which is a universal Linux standard.

3) Kernel


When the kernel is loaded, it immediately initializes devices and memory. The main job of the kernel is to load up the init process.

4) Init


Remember the init process is the first process that gets started, init starts and stops essential service process on the system. There are three major implementations of init in Linux distributions. We will go over them briefly and then dive into them in another course.

There it is, the (very) simple explanation of the Linux boot process.

---

🙂 If the article helps you, leave a like, follow, or anything.  
You can follow me on [LinkedIn](https://www.linkedin.com/in/abhishekpathak32/) and [GitHub](https://github.com/scorcism).
.NET 8 Web API - Filters
Tags: dotnet, csharp, webapi, programmers
Published: 2023-08-10 05:28:27

This is not an article. I am going to teach to how to create a .NET 8 WEB API from scratch. All the chapters would be collected here ...

Filters
{% embed https://youtu.be/UVPFuFqoUOQ %}

Filters - Example
{% embed https://youtu.be/2Dsxgs0s4ek %}
Dia 5 - #100DaysOfSwift
Tags: ios, swift
Published: 2023-08-10 04:59:58

## Funções
Servem pra criar blocos de código que serão usados mais de uma vez, assim reduzindo código repetido. É uma boa prática criar funções que tenham apenas uma responsabilidade.

Quando a função tem uma única expressão a palavra reservada _return_ pode ser omitida:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j5d2lpfqxneu70xmjl5v.png)

É possível retornar mais de um valor numa função usando tuplas ou alguma coleção(array ou dicionário):
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbu3a5g9wtobjtxrpvdk.png)

Swift permite que coloquemos dois nomes em cada parâmetro, sendo o primeiro de uso externo e o segundo de uso interno, permite também omitir o parâmetro na chamada da função(usando _), ambas as formas podem ser usadas pra deixar o código mais fácil de ler.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6v30notcuqh40ner1vco.png)

Quando temos um parâmetro que na maioria das vezes vai receber um valor específico, pra facilitar dá pra colocar um parâmetro padrão.

###Throwing functions
As vezes num código algo pode dar erro, mas ser um erro mais "tranquilo", por exemplo quando um app consome dados de uma API e por algum motivo não foi possível decodificar os dados que estão sendo recebidos, nesses casos é muito útil saber que um erro aconteceu sem crashar o app, assim é possível dar um feedback visual pro usuário e deixá-lo livre pra tentar fazer outras coisas no app.
 
O Swift nos permite lançar erros dentro de funções, pra isso é preciso colocar a palavra _throws_ antes do tipo de retorno da função, e dentro dela usar a palavra _throw_ quando algo der errado e aí chamar algum erro que você criou num enum que conforma com o protocolo _Error_.

Pra chamar uma throwing function é preciso usar três palavras: _do_, _try_, e _catch_, como a linguagem nos força a usar try ao chamar uma throwing function, fica bem fácil de saber visualmente quais funções podem ou não causar erros.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/05tbmizyd2ui0debvzuj.png)
Inconsistent "ResourceNotFoundException" Error When Updating User Attributes in AWS Cognito
Tags: discuss, aws
Published: 2023-08-10 05:25:55

I'm encountering an issue while updating user attributes in AWS Cognito. The problem is specific to the production environment and results in a "ResourceNotFoundException" error. I'm seeking insights from the community to help troubleshoot this inconsistency.

**Problem:**

When attempting to update user attributes in the production environment, I consistently receive the following error message:

```
"msg": {
  "message": "User pool us-east-2_******* does not exist.",
  "code": "ResourceNotFoundException",
  "time": "2023-08-09T11:32:50.538Z",
  "statusCode": 400
}
```
**Observations:**

- The code works flawlessly in both development and staging environments without any errors during attribute updates.

- Surprisingly, I connected my backend to the production database locally and tested the same code, resulting in successful attribute updates.

- However, using the same API request via Postman or in the production environment still triggers the "ResourceNotFoundException" error.

If you have encountered a similar issue or have insights into possible causes, your input would be greatly appreciated.
Top 6 Step Strategic Sourcing Process of Products for Your E-commerce Store
Tags: ecommerce, ecommercestrategic, 6stepstrategic, sourcingprocess
Published: 2023-08-10 05:22:50

## Introduction

- Importance of strategic sourcing in e-commerce
- Brief overview of the 6-step process

## Define Sourcing Goals and Criteria
A. Clarify Business Objectives
B. Establish Product Criteria
C. Determine Quality Standards

## Supplier Identification and Assessment
A. Research Potential Suppliers
B. Evaluate Supplier Reputation
C. Analyze Supplier Capabilities

## Negotiation and Agreement
A. Initiate Negotiations
B. Discuss Pricing and Terms
C. Formalize Agreements

##  Quality Control and Assurance
A. Set Quality Inspection Parameters
B. Implement Quality Assurance Protocols
C. Conduct Supplier Audits

## Inventory and Logistics Management
A. Determine Inventory Levels
B. Plan for Warehousing and Storage
C. Optimize Shipping and Delivery

**[Multi-channel Inventory Management
](https://salesoperator.net/2023/02/06/multi-channel-inventory-management/)**
## Continuous Monitoring and Improvement
A. Implement Performance Metrics
B. Monitor Supplier Performance
C. Seek Feedback and Make Adjustments

Now to read about all these in detail in very easy way, click on this link, [6 Step Strategic Sourcing Process of Products for Your Ecommerce Store](https://salesoperator.net/2023/07/24/6-step-strategic-sourcing-process/)

## Conclusion
- Benefits of a well-structured strategic sourcing process
- Call to action for implementing the 6-step process
Boosting Programmer Productivity: VS Code Terminal Commands for Mouse-Free Efficiency
Published: 2023-08-10 05:18:13

Are you tired of reaching for your mouse every time you want to perform a task in Visual Studio Code? 🐭💤 Let's supercharge your coding experience by mastering some powerful terminal commands that will elevate your productivity to new heights! 🚀

Here's a quick rundown of essential terminal commands to help you navigate and work efficiently without touching that mouse:

Navigation Magic: Move around your project directories swiftly with ease.


```
cd "your-folder-path"   # Navigate to a directory
ls                      # List files and folders
code .                  # Open the current 
```
directory in VS Code
Version Control: Manage your Git repositories seamlessly.



```
git clone "repo-url"    # Clone a Git repository
git pull                # Fetch the latest 
```
changes
git commit -m "message" # Commit changes
Package Management: Handle dependencies like a pro.

bash
Copy code
npm install "package"   # Install a Node.js package
npm update "package"    # Update a package
Running Code: Compile and run your code straight from the terminal.

bash
Copy code
python "script.py"      # Execute a Python script
node "script.js"        # Run a Node.js script
Text Manipulation: Perform text-related tasks without opening a file.

bash
Copy code
echo "Hello, World!" > "output.txt"   # Create a text file
cat "file.txt"          # Display file content
Efficient Searching: Find what you're looking for with speed.

bash
Copy code
grep -r "search-term"   # Search text in files recursively
Terminal Commands for Productivity

Command	Description
ctrl + ~	Open the integrated terminal in VS Code
up arrow / down arrow	Navigate through command history
tab	Auto-complete filenames and commands
ctrl + c	Terminate a running process (e.g., script)
ctrl + l	Clear the terminal screen
Remember, mastering these commands might take a bit of practice, but the time you save and the efficiency gained are well worth it! So, say goodbye to the mouse and hello to a more streamlined coding workflow. 💼🎉

Give these commands a try and watch your programming productivity soar! Have any favorite terminal tricks? Share them in the comments below! 👇🤖

#ProgrammingTips #ProductivityHacks #VSCodeMagic #TerminalCommands #MouseFreeCoding****
Linux Kernel
Tags: linux, scor32k, kernel, beginners
Published: 2023-08-10 05:13:57

The most basic level is hardware, which includes our CPU, memory, hard disks, networking ports, etc. The physical layer computes what our machine is doing.

The next level is the **kernel**, which handles process and memory management, device communication, system calls, sets up our filesystem, etc. 

The kernel's job is to talk to the hardware to make sure it does what we want our processes to do.

And the level that you are familiar with is the user space, the user space includes the shell, the programs that you run, the graphics, etc.

In **kernel mode**, the kernel has complete access to the hardware, it controls everything.

In user space mode, there is a very small amount of safe memory and CPU that you are allowed to access.

When we want to do anything that involves hardware, reading data from our disks, writing data to our disks, controlling our network, etc, it is all done in kernel mode.

**Why is this necessary?**

Imagine if your machine was infected with spyware, you wouldn't want it to be able to have direct access to your system's hardware. It can access all your data, your webcam, etc. and that's no good.

**The Protection Rings:**
![protection ring](https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Priv_rings.svg/300px-Priv_rings.svg.png)

The innermost ring corresponds to the highest privilege level.

There are two main levels or modes in an x86 computer architecture.

**Ring #3** is the privilege that user-mode applications run in,

**Ring #0** is the privilege that the kernel runs in. Ring #0 can execute any system instruction and is given full trust.

**how are we able to write anything to our hardware? Won't we always be in a different mode than the kernel?**

The answer is with system calls, system calls allow us to perform a privileged instruction in kernel mode and then switch back to user mode.
Linux Devices Management
Tags: linux, beginners
Published: 2023-08-10 05:00:23


# /dev directory

When you connect a device to your machine, it generally needs a device driver to function properly. 

You can interact with device drivers through device files or device nodes, these are special files that look like regular files. 

Since these device files are just like regular files, you can use programs such as ls, cat, etc to interact with them. These device files are generally stored in the /dev directory. 

Go ahead and ls the /dev directory on your system, you'll see a large amount of devices files that are on your system.

ls /dev

![ls /dev](https://i.imgur.com/WJvBDyB.png)

c - character -> These devices transfer data, but one a character at a time.

b - block -> These devices transfer data, but in large fixed-sized blocks.

p - pipe -> Named pipes allow two or more processes to communicate with each other, these are similar to character devices, but instead of having output sent to a device, it's sent to another process.

s - socket -> Socket devices facilitate communication between processes, similar to pipe devices but they can communicate with many processes at once.

## Device Names

If you have any sort of mass storage on your machine, chances are it is using the SCSI (pronounced "scuzzy") protocol. 

SCSI stands for Small Computer System Interface, it is a protocol used for allow communication between disks, printers, scanners and other peripherals to your system. 

You may have heard of SCSI devices which aren't actually in use in modern systems, however our Linux systems correspond SCSI disks with hard disk drives in /dev. 

They are represented by a prefix of sd (SCSI disk):

Common SCSI device files:

/dev/sda - First hard disk
/dev/sdb - Second hard disk
/dev/sda3 - Third partition on the first hard disk

**Listing USB Devices**
```bash
lsusb
```

**Listing PCI Devices**
```bash
lspci
```

**Listing SCSI Devices**
```bash
lsscsi
```

## dd

The dd tool is super useful for converting and copying data. 
It reads input from a file or data stream and writes it to a file or data stream.

Consider the following command:

$ dd if=/home/pete/backup.img of=/dev/sdb bs=1024 
This command is copying the contents of backup.img to /dev/sdb. 

It will copy the data in blocks of 1024 bytes until there is no more data to be copied.
eg ls -alshr
createContext in React? Important for Interview and Development
Tags: webdev, react, beginners, tutorial
Published: 2023-08-10 04:58:36

`createContext` is a method provided by React's Context API that facilitates a way to pass data through the component tree without having to pass props down manually at every level. It's especially useful for passing down state, functions, or other data to deeply nested child components without prop drilling.


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

Here's a simple guide on how to use `createContext`:

1. **Creating the Context**

Firstly, you'll need to create a context.

```jsx
import React, { createContext } from 'react';

const MyContext = createContext();
```

By default, `createContext` accepts a default value, which will be used when a component doesn't have a matching Provider above it in the tree.

2. **Provider Component**

Wrap the component tree with the Provider component, which accepts a value prop to be passed to consuming components.

```jsx
const MyProvider = (props) => {
    return (
        <MyContext.Provider value={{ data: "Hello from context!" }}>
            {props.children}
        </MyContext.Provider>
    );
};
```

3. **Consumer Component**

There are two main ways to consume the value from the context:

- Using `MyContext.Consumer`:

```jsx
function MyComponent() {
    return (
        <MyContext.Consumer>
            {(value) => {
                return <div>{value.data}</div>;
            }}
        </MyContext.Consumer>
    );
}
```

- Using the `useContext` hook (more common and concise for functional components):

```jsx
import React, { useContext } from 'react';

function MyComponent() {
    const value = useContext(MyContext);
    return <div>{value.data}</div>;
}
```

4. **Using the Provider**

Wrap the parts of your app where you want the context to be accessible in the `MyProvider`:

```jsx
function App() {
    return (
        <MyProvider>
            <MyComponent />
        </MyProvider>
    );
}
```

That's a simple overview of using `createContext` in React. Remember that while the Context API is powerful, it doesn't mean you should use it everywhere. It's more apt for global state or shared utilities/functions that are needed across various components in your application. For local state or prop passing between a parent and a direct child, regular state and props work just fine.

Thank you for reading. I encourage you to follow me on Twitter where I regularly share content about JavaScript and React, as well as contribute to open-source projects. I am currently seeking a remote job or internship.

Twitter: https://twitter.com/Diwakar_766

GitHub: https://github.com/DIWAKARKASHYAP

Portfolio: https://diwakar-portfolio.vercel.app/
PHPMyAdmin import database timeout | Import SQL using command line/Terminal
Tags: phpmyadmin, timeout
Published: 2023-08-10 04:51:43

This problem might happen if the database is really big or if the internet connection is slow.

Just so you know, PHPMyAdmin doesn't pay attention to the timeout or memory settings in cPanel. It gets its rules from the regular timeout on the server, which is set in WHM.

Sometime it can happen on your local pc. so you can follow this steps- 

> Attention: If a particular cPanel doesn't come with a Terminal, then this won't work on it.

1. If we have shell/terminal access, we log in to the cpanel user account and run or in your local pc:

```
mysql -u username -p
```

Note: If you are using localhost use `root` on `username` 

In the prompt we enter the password then run the command:

Note: If you are using localhost then just hit enter only. [by default localhost do not have password. if you set any password then use that.]

Then enter your database:

```
mysql> use database_name;
```
Then we import the database sql with the correct path:

```
source /our/path/to/backup.sql;
```
Analyze Apache Logs with Python: Introducing the Apache Log Analyzer Script
Published: 2023-08-10 04:49:13


As developers, understanding how our APIs are performing is crucial. To help with this, I've created the **Apache Log Analyzer Script**, a Python tool that simplifies the process of analyzing Apache access logs to extract valuable insights about API response times and usage patterns.

### What is the Apache Log Analyzer Script?

The Apache Log Analyzer Script is a command-line tool designed to process Apache access logs and provide meaningful information about API performance. It calculates response times, tracks hit counts for different routes, and allows you to set custom time ranges for analysis.

### Key Features:

- **Response Time Analysis:** The script calculates and analyzes the response times of various APIs recorded in the access logs.

- **Custom Time Ranges:** You can choose to analyze logs from specific time ranges, making it easy to identify trends and anomalies.

- **API Hit Counts:** The script also tracks the number of hits for each API route, helping you understand which routes are most frequently accessed.

### How to Use the Apache Log Analyzer Script:

1. **Clone the Repository:**
   Start by cloning the [Apache-Log-Analyzer](https://github.com/DhananjayThomble/Apache-Log-Analyzer) containing the script.

2. **Install Dependencies:**
   Run the following command to install the required dependencies:
   ```bash
   pip install -r requirements.txt
   ```

3. **Run the Script:**
   Execute the script by running the following command:
   ```bash
   python api_log_analysis.py
   ```

4. **Follow the Prompts:**
   The script will guide you through the process. You can choose between different time ranges or provide a custom time range.

5. **View the Results:**
   Once the analysis is complete, the script will generate an `api_names_with_response_times.txt` file with detailed results.

### Code Breakdown:

The script is divided into several parts:

- **Log File Selection:** Choose the Apache access log file to analyze.

- **Time Range Selection:** Select the time range for analysis, whether it's custom or predefined.

- **Log Processing:** The script reads and processes the log lines, calculating response times and hit counts.

- **Results Generation:** The results are organized and saved in the `api_names_with_response_times.txt` file.

### Get Involved!

The Apache Log Analyzer Script is open source, and I invite you to contribute to its development. Feel free to create issues, submit pull requests, or provide feedback through the GitHub repository.

### Conclusion:

The Apache Log Analyzer Script streamlines the process of analyzing Apache access logs, making it easier for developers to gain insights into their API performance. Try it out, and let me know your thoughts and suggestions! You can find the script and more details here: [Apache-Log-Analyzer](https://github.com/DhananjayThomble/Apache-Log-Analyzer).

Happy analyzing!