teleren/devto huggingface dataset:
Build and Deploy Buymeacoffee with MongoDB, NodeJS, ExpressJS
Tags: mongodb, node, express, tutorial
Published: 2024-02-04 11:23:28

{% youtube jN-b5f2huFM %}

Welcome to our latest tutorial! 
In this video, we'll guide you through the process of creating and deploying a BuyMeACoffee platform  from scratch using powerful technologies like MongoDB, NodeJS, and ExpressJS. Additionally, 
we'll integrate the secure Cryptomus Payment Gateway for seamless transactions.

🌐 Project Overview:
Learn to set up a robust backend with NodeJS and ExpressJS.
Utilize MongoDB to store and manage data efficiently.
Integrate Cryptomus Payment Gateway for secure and reliable transactions.
Enhance your development skills with real-world application building.

⚙️ Key Topics Covered:
Setting up a NodeJS and ExpressJS environment.
Implementing MongoDB database for BuyMeACoffee.
Integrating Cryptomus Payment Gateway for cryptocurrency transactions.
Deploying the application to a cloud platform for global accessibility.

🎓 Who Should Watch:
Developers looking to build a real-world application.
Enthusiasts interested in integrating payment gateways and databases.


[🔗Cryptomus](https://cryptomus.com/?utm_source=youtube&utm_medium=video&utm_campaign=codewithsadee)
[🔗Cryptomus Telegram](https://t.me/CPT_English?utm_source=youtube&utm_medium=video&utm_campaign=codewithsadee)
[🔗Source Code](https://www.patreon.com/posts/fansfund-clone-97482690?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_link)


⏱️ Timestamps
0:00 - Demo
4:57 - Project initial
20:54 - Topbar
26:19 - Hero section
33:20 - Contribuite section
1:02:44 - About section
1:08:08 - History section
1:15:30 - Footer
1:16:46 - Media queries
1:33:27 - Handle checkout
1:45:11 - Payment intigration
2:16:14 - MongoDB
2:50:57 - Testing payment
main function, watch, breakpoints, scope, and the call stack:
Tags: javascript, webdev, beginners, programming
Published: 2024-02-04 11:20:40

Certainly, here's a simple JavaScript program that incorporates the concepts of threads, the main function, watch, breakpoints, scope, and the call stack:

```javascript
// Main function
function main() {
    // Initialize a variable in the global scope
    let globalVariable = 10;

    // Create a new thread to perform asynchronous tasks
    const asyncThread = new Worker('asyncWorker.js');

    // Set a watch on a variable for debugging purposes
    console.log('Watching globalVariable:', globalVariable);

    // Set a breakpoint for debugging
    debugger;

    // Modify the global variable
    globalVariable = 20;

    // Call a function that involves a local scope
    function localScopeFunction() {
        let localVariable = 5;

        // Use the local variable
        console.log('Local variable:', localVariable);
    }

    localScopeFunction();

    // Display the modified global variable
    console.log('Modified globalVariable:', globalVariable);

    // Access the call stack
    displayCallStack();
}

// Function to display the call stack
function displayCallStack() {
    const callStack = new Error().stack;
    console.log('Call Stack:', callStack);
}

// Execute the main function
main();
```

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

In this program:

1. The `main` function serves as the entry point and contains the main logic.
2. The program simulates a new thread using a Web Worker (`asyncWorker.js` would be a separate file).
3. A watch is set on the `globalVariable` to monitor its changes during debugging.
4. A breakpoint is set using the `debugger` statement.
5. The local scope is demonstrated through the `localScopeFunction`.
6. The call stack is accessed and displayed through the `displayCallStack` function.

Note: Ensure that you have a proper environment to execute this program, and you may need to handle the asynchronous nature of the Web Worker appropriately.
My First Package on PyPI!
Tags: python, beginners, opensource, pypi
Published: 2024-02-04 10:47:44

## 🎉 Introducing WhatsApp Chat Parser 🎉

Hello Dev community!

Today, I'm thrilled to share a milestone that I've reached in my coding journey. I've just published my very first package to PyPI, that is  [WhatsApp Chat Parser](https://pypi.org/project/whatsapp-parse/)!

## 🚀 About WhatsApp Chat Parser

WhatsApp Chat Parser is a tool that makes it easier for everyone to extract and analyze their WhatsApp chat histories. Whether you're a researcher, marketer, or just someone curious about your chat patterns, this tool is designed to help you parse through the data with ease.

Here's a quick rundown of what you can do with it:

- Extract conversation data including datetime, sender, and message content.
- Parse chat logs into a user-friendly Pandas DataFrame.
- Directly output a CSV file from the command line for further analysis.

## 🛠️ How to Install

You can install the package with a simple pip command:

```bash
pip install whatsapp-parse
```

## 📈 Future Updates
I'm already planning some exciting updates, including:

- Support for additional date and time formats.
- More output formats for different use cases.
- Handling media attachments to get a comprehensive view of your chat data.

## 🤝 Contributing

I wholeheartedly welcome contributions to the WhatsApp Chat Parser project. If you have any suggestions, ideas, or improvements, feel free to give me any feedback, since I believe that I grow on critics.

Cheers, Hassan Hamada

Disclaimer: This post was written by [Cody](https://sourcegraph.com/cody) and edited by me for clarity and personal touch.
how to (correctly) check if properties are optional
Tags: typescript, programming
Published: 2024-02-04 10:47:20

## TL;DR

```typescript
type IsKeyOptional<T extends Record<string | number | symbol, unknown>, Keys extends keyof T> = 
    {[Key in Keys]?: T[Key]} extends Pick<T, Keys> ? true : false;

type Foo = {
    foo?: string
    bar: string | undefined // this is not the same as foo!
}

type IsFooOptional = IsKeyOptional<Foo, "foo"> // true
type IsBarOptional = IsKeyOptional<Foo, "bar"> // false
```

## The problem

Recently I've run into a problem [with using zod](https://github.com/colinhacks/zod/issues/3186) where zod deliberatly adds `| undefined` to the value of a key to then add the optional flag `?` depending on whether or not the value includes `undefined`.

This check isn't accurate though as there is a fundamental difference between optional keys and nullable values, which is the exact reason why [`exactOptionalPropertyTypes`](https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes) exists. "IF you give me a banana, I expect it to be a banana, not a `banana | undefined`"

## Correct checking
Think of objects as rows of `[key, value]` tuples for a second and the solution becomes clearer. In order to determine whether a **key** is optional we have to check whether the respective **row** is present, not whether the value includes `undefined`. And with that in mind we can just say 

> for a set of keys construct rows that are optional and check whether those rows are equal to the rows for the same keys from the type we want to check against

Or, more picturesque:

| isOptional | check | control |
| --- | --- | --- |
| false | maybe the row exists | the row DOES exist (even if its value can be undefined) |
| true | maybe the row exists | maybe the row exists|
Storing and Testing State in localStorage with React
Tags: react, webdev, javascript, localstorage
Published: 2024-02-04 10:37:29

Managing state in a React application is a common challenge, and when it comes to persisting that state across sessions, localStorage is a handy solution. In this post, we'll explore a custom React hook, `useSemiPersistentState`, that simplifies the process of storing and testing state in localStorage.

## The `useSemiPersistentState` Hook

```jsx
import { useEffect, useState, Dispatch, SetStateAction } from "react";

const useSemiPersistentState = <T>(
  key: string,
  initialValue: T
): [T, Dispatch<SetStateAction<T>>] => {
  const [state, setState] = useState<T>(() => {
    try {
      const storedState = localStorage.getItem(key);
      return storedState ? JSON.parse(storedState) : initialValue;
    } catch (error) {
      // Handle parsing error, fallback to initial value
      console.error("Error parsing localStorage data:", error);
      return initialValue;
    }
  });

  useEffect(() => {
    // Save the value to localStorage whenever it changes
    localStorage.setItem(key, JSON.stringify(state));
  }, [key, state]);

  return [state, setState];
};

export { useSemiPersistentState };
```

The `useSemiPersistentState` hook makes it easy to manage state in your React components while ensuring its persistence between page reloads.

## Usage and Example

Let's consider a scenario where we want to persist the user's theme preference. Here's how you can use the hook:

```jsx
import { useSemiPersistentState } from '<relative-path-to-your-hook-file>';

const ThemeSelector = () => {
  const [theme, setTheme] = useSemiPersistentState('theme', 'light');

  const toggleTheme = () => {
    const newTheme = theme === 'light' ? 'dark' : 'light';
    setTheme(newTheme);
  };

  return (
    <div>
      <p>Current Theme: {theme}</p>
      <button onClick={toggleTheme}>Toggle Theme</button>
    </div>
  );
};

export default ThemeSelector;
```

In this example, the `ThemeSelector` component effortlessly maintains the theme preference in `localStorage`, allowing the theme to persist across page reloads.

## Testing Made Simple

Testing stateful components becomes easier with this hook. You can mock the `localStorage` object in your tests to simulate different scenarios and ensure that your components behave as expected.

## Conclusion

The `useSemiPersistentState` hook provides an elegant solution for handling semi-persistent state in React applications. Whether you're building a theme switcher or saving user preferences, this hook simplifies the process and enhances the user experience.
Rise of Automation in Software Testing
Tags: webdev, automation, selenium, sushil
Published: 2024-02-04 10:08:07

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wv9hbg8ly6ii591fk4qb.png)
Imagine working on a long-term project where you find yourself repeatedly conducting regression testing in every sprint and performing smoke testing for the same test cases with each change. Consider the amount of time and effort invested in these repetitive tasks, leading to monotony and inefficiency.

Repetitive manual testing can be tedious and may result in testers overlooking certain scenarios in regression and smoke testing. To address these issues, automation can serve as an effective alternative solution.

Automation encompasses more than just writing code; it can involve tasks such as sending bulk data simultaneously and collecting multiple responses. For instance, automating the process of sending a hundred JSON data entries via a .CSV file through tools like Postman qualifies as automation as well.

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

To execute frequent test cases efficiently, you can maintain automation code using tools like Selenium or Cypress, along with your preferred programming language. The objective is to automate the testing process, where you simply trigger the action and let the machine handle testing across all scenarios, providing comprehensive reports afterward. For instance, running 1000 test cases manually might require 10 employees an entire day, whereas automation could complete the task in just 20 to 30 minutes.This is why many companies nowadays prioritize automation. However, there are limitations to automation, particularly when it comes to testing aspects dependent on system architecture. Nevertheless, automation significantly saves time and provides accurate reports, making it a valuable asset in software testing.
How to Enhance Your Web Applications with Request URL Parameters
Tags: url, web, webdev
Published: 2024-02-04 10:00:05

Interacting with web applications involves the dynamic exchange of data between the user's browser (client) and the server. This process is heavily reliant on what we refer to as **[API](https://apidog.com/blog/free-api-client/)** request parameters. These elements are essential in detailing the type of information that needs to be sent or received. 

### The Essence of API Request Parameters

At the core of API communications, request parameters serve as the bridge facilitating the transfer of data between the client and the server. Though diverse in their types, the following are the main categories:

-   **Query Parameters**: These parameters find their place within the URL during a GET request.
-   **Body Parameters**: For POST requests and similar methods, these parameters are located within the request's body.
-   **Header Parameters**: Found in the headers of requests and responses, these parameters usually handle authentication and define content types.
-   **Path Parameters**: Components of the URL's path, these parameters act as identifiers for specific resources.

Combining various request parameters allows APIs to be flexible and cater to numerous scenarios efficiently.

- **[Request Parameters in Apidog](https://apidog.com/blog/request-parameters/)**

### Diving into URL Parameters

When discussing URL parameters, we're primarily looking at query parameters and path parameters. Both play distinct roles within the URL, serving different purposes in API communication.

#### A Closer Look at Query Parameters

Imagine navigating to the following web address:

```
http://example.com/search?keyword=cat&orderby=date
```

In this URL, everything following the question mark (`?`) constitutes the query parameters — in this scenario, `keyword=cat` and `orderby=date`. They are displayed as key-value pairs, separated by an ampersand (`&`). Query parameters are instrumental in GET requests, allowing the server to parse and act upon the provided information.

#### Understanding Path Parameters

Consider this web address:

```
https://example.com/users/12345
```

Here, the segment following `users/` is a path parameter. By replacing it with `{id}`, like so:

```
https://example.com/users/{id}
```

the path parameter, encapsulated in curly braces, acts as a variable (`id`). This versatility facilitates access to various resources under the same URL pattern, enabling resource-specific navigation such as accessing user profiles or REST API endpoints by ID.

### Conclusion

Request parameters, in their varied forms, play pivotal roles in the interaction between clients and servers within the realm of web development. Understanding their types and uses is essential for anyone looking to delve into web development or API exploration. For hands-on practice, **[Apidog](https://apidog.com/)** offers a comprehensive platform that supports the intricate use of these parameters, making it a valuable tool for both beginners and experienced developers alike.
Help me validating my Micro Startup Idea
Published: 2024-02-04 09:52:38

**Hey fellow learners!**

I'm excited to share with you a new project I've been working on that I believe has the potential to revolutionize how we approach online learning, especially on platforms like Udemy. As a passionate learner myself, I've often found it challenging to stay consistent with my Udemy courses and effectively organize my notes as I go along.

### What is it?

This platform aims to streamline your Udemy learning experience by offering a range of features to keep you on track and engaged throughout your courses. From progress tracking to note-taking and community interaction, this platform is your all-in-one companion for mastering new skills and concepts.


### Key Features:

1. Course Progress Tracking: Keep tabs on your progress within each Udemy course, marking lectures, quizzes, and assignments as completed to stay on top of your learning goals.

2. Reminder System: Receive customizable reminders to help you stay consistent with your learning schedule, ensuring you never miss a beat.

3. Note-taking Tool: Take detailed notes directly within the platform, complete with rich text formatting and support for code snippets, making it easy to review and reference key concepts later on.

4. Integration with Udemy: Seamlessly import your Udemy courses into the platform with just one click, and enjoy real-time syncing of your progress between platforms.

5. Progress Analytics: Gain valuable insights into your learning habits and progress over time, empowering you to make informed decisions about your study approach.

6. Community Interaction: Connect with fellow learners, participate in discussion forums, and join study groups to enhance your learning experience through collaboration and peer support.


### Seeking Your Feedback:

Before finalizing the development of this platform, I'm eager to hear from you, the potential users! What do you think of this idea? Are there any features you'd like to see added or any improvements you'd suggest?
Docker Hands-On Part 01
Tags: tutorial, docker, containers
Published: 2024-02-04 09:42:29

## 01. Initializing the Docker Environment 

**Installing Docker CE**

**Installing Required Packages:** If you are using Essential packages for Docker CE in CentOS, such as `utils`, `device-mapper-persistent-data`, and `lvm2`, are installed using the `yum` package manager.

I'm using the Linux EC2 2023 server. 

**To install Docker on Amazon Linux 2 or Amazon Linux 2023**

1.Update the installed packages and package cache on your instance.

```
$ sudo yum update -y
```

2.Install the most recent Docker Community Edition package.

For Amazon Linux 2, run the following:

```
$ sudo amazon-linux-extras install docker
```

For Amazon Linux 2023, run the following:

```
$ sudo yum install -y docker
```

3.Start and enable the Docker service


```
$ systemctl enable --now docker.service
$ systemctl ststus docker.service
```

Add the _ec2-user_ to the docker group so that you can run Docker commands without using sudo.


```
$ sudo usermod -a -G docker ec2-user
```

Pick up the new docker group permissions by logging out and logging back in again. To do this, close your current SSH terminal window and reconnect to your instance in a new one. Your new SSH session should have the appropriate docker group permissions.

Verify that the ec2-user can run Docker commands without using sudo.

```
$ docker ps -a
```
iPhone 15 Pro Max Giveaway
Published: 2024-02-04 09:41:19

Eligibility:

Open to [[geographical restrictions if any](https://sites.google.com/view/iphonemobille/home)].

Participants must be [age restriction] or older.

[[Any other eligibility criteria](https://sites.google.com/view/iphonemobille/home)].

How to Enter:

Follow [@YourBrand] on [social media platform(s)].

Like this post.

Tag [number] friends in the comments (each tag is an additional entry).

Bonus Entries:

Share this post on your story/feed and tag [@YourBrand].

[Any other actions for bonus entries].

Winner Selection:

The winner will be randomly selected from eligible entries.

Winner will be announced on [date] on our [[social media platforms].](https://sites.google.com/view/iphonemobille/home)

The winner will be contacted via [direct message/email], and they must respond within [number] hours to claim the prize.

Prize:

One lucky winner will receive an iPhone 15 Pro Max [specify storage capacity and color].

Disclaimer:

This giveaway is not sponsored, endorsed, or associated with Apple or [[social media platform(s)](https://sites.google.com/view/iphonemobille/home)].

Other Terms:

[Include any other terms and conditions, such as shipping details, etc.].

Important Dates:

Giveaway starts: [10.02.2024]

Giveaway ends: [12.02.2024]

Winner announcement: [15.02.2024]

[Good luck to everyone!](https://sites.google.com/view/iphonemobille/home
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q3t04oi0rhbjgl0ntbds.jpeg)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cfzg19ljj7c66i2663vg.jpeg)) 🎉

[Win iphone 15 pro max](https://sites.google.com/view/iphonemobille/home)
Protocol Village’s DLN and BloXroute’s High-Speed Intents Network
Tags: blockchain
Published: 2024-02-04 09:39:49

In the ever-evolving landscape of blockchain technology, interoperability remains a paramount challenge. The ability of disparate blockchains to communicate seamlessly and efficiently has been a hurdle for achieving the full potential of decentralized ecosystems. However, breakthroughs in this domain are arising, exemplified by Protocol Village’s DLN (Decentralized Ledger Network) and BloXroute’s collaborative efforts, promising a high-speed cross-chain intents network.

### Understanding the Challenge

Blockchain networks, each with their unique protocols and consensus mechanisms, exist in silos. While this autonomy ensures security and decentralization, it impedes the flow of information and value across different chains. Interoperability solutions aim to bridge these divides, allowing for the frictionless exchange of data and assets among disparate blockchains.

### The Collaborative Approach: DLN & BloXroute

Protocol Village’s DLN operates as an interoperability protocol, aiming to establish a seamless bridge between various blockchain networks. DLN’s architecture centers on facilitating efficient communication by enabling cross-chain transactions and data transfers without the need for intermediaries.

Partnering with DLN, BloXroute contributes its expertise in optimizing network infrastructure. BloXroute’s high-performance networking technology focuses on maximizing data propagation speed among nodes, significantly enhancing the efficiency of blockchain networks.

### The Promise of a High-Speed Cross-Chain Intents Network

The collaboration between DLN and BloXroute is poised to revolutionize cross-chain communication. By leveraging DLN’s interoperability solutions and BloXroute’s network optimization, the envisioned high-speed intents network aims to:

1. Enhance Speed and Scalability: Through BloXroute’s network optimizations, the cross-chain intents network intends to achieve unparalleled speeds in transferring data and executing transactions, significantly improving scalability.

2. Boost Security and Decentralization: Despite increased speed, the network prioritizes security and decentralization, maintaining the fundamental principles of blockchain technology.

3. Enable Seamless Interoperability: DLN’s interoperability solutions will foster seamless communication among different blockchains, allowing for the unhindered flow of information and assets.

### Conclusion

The collaboration between Protocol Village’s DLN and BloXroute is poised to reshape the landscape of cross-chain communication. By combining expertise in interoperability and network optimization, the creation of a high-speed intent network holds immense promise in addressing the challenges of blockchain interoperability, ultimately fostering a more connected and efficient decentralized ecosystem.

Stay tuned for further developments as these groundbreaking initiatives unfold, potentially paving the way for a new era of interconnected blockchain networks.