teleren/devto huggingface dataset:
Welcome to My Dev Blog: A Journey of Learning and Growth
Published: 2024-06-22 16:05:32

Hey fellow devs! I'm thrilled to introduce my dev blog, a space where I'll share my experiences, knowledge, and passions with the developer community. As a full-stack developer with a zeal for learning and growth, I'm excited to embark on this journey with all of you.

Why I'm Starting This Blog

As a developer, I've often found myself stuck on a problem or wondering how others approach certain challenges. I believe that sharing our experiences and knowledge is essential to growing as a community. This blog is my attempt to contribute to that growth, and I hope it will become a valuable resource for fellow devs.

What to Expect

In this blog, I'll be sharing a mix of technical tutorials, personal anecdotes, and industry insights. I'll cover topics ranging from coding best practices to my favorite tools and resources. I'll also share my experiences with different programming languages, frameworks, and technologies.

My Goals

My primary goal is to create a community-driven blog where devs can come together to learn from each other, share their experiences, and get feedback on their projects. I want this blog to be a go-to resource for developers looking for inspiration, guidance, or just a fresh perspective.

How You Can Get Involved

I encourage you to participate in the conversation by commenting on my posts, sharing your own experiences, and suggesting topics you'd like me to cover. Let's build a community that supports and learns from each other.

Stay Tuned

In my upcoming posts, I'll be covering topics such as effective coding practices, my favorite development tools, and how to stay motivated as a developer. I'll also be sharing some of my personal projects and experiences, so be sure to subscribe to stay updated.

Thanks for joining me on this journey, and I look forward to hearing from you in the comments!
Solution for Render.com Web services spin down due to inactivity.
Tags: render, deployment, node, tutorial
Published: 2024-06-22 15:51:11

When deploying backend applications for hobby projects, Render is a popular choice due to its simplicity and feature set. However, one common issue with Render is that instances can spin down due to inactivity. This results in delayed responses of up to a minute when the instance has to be redeployed. This behavior is clearly mentioned by Render:

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

**The Problem**
Render instances spin down when inactive, leading to delays when the server is accessed after a period of inactivity. This can be particularly annoying as it affects the user experience with slow response times.
**The Solution**
To keep your instance active even when no one is using the site, you can add a self-referencing reloader in your app.js or index.js file. This will periodically ping your server, preventing it from spinning down.

Here’s a simple snippet of code to achieve this:

```
const url = `https://yourappname.onrender.com/`; // Replace with your Render URL
const interval = 30000; // Interval in milliseconds (30 seconds)

//Reloader Function
function reloadWebsite() {
  axios.get(url)
    .then(response => {
      console.log(`Reloaded at ${new Date().toISOString()}: Status Code ${response.status}`);
    })
    .catch(error => {
      console.error(`Error reloading at ${new Date().toISOString()}:`, error.message);
    });
}

setInterval(reloadWebsite, interval);

```

**How It Works**
- Self-Referencing Reload: This code snippet sets an interval to ping your server every 30 seconds.
- Keep Alive: By continuously pinging the server, it remains active, preventing it from spinning down.
- Logs: You can monitor the logs to see the periodic checks and ensure the server is active.


**Implementation**

1. Add the Code: Insert the above code into your app.js or index.js file.
2. Start Your Server: Deploy your application to Render as usual.
3. Monitor: Check the logs in your Render dashboard to verify that the server is being pinged regularly.

**Benefits**
1. No Downtime: Your server remains active, providing quick responses.
2. Simple Solution: Easy to implement without complex configurations.
3. Scalability: Works well for small to medium-level hobby projects.

**Managing Multiple Backends**
For projects with multiple backends, you can consolidate the reloaders into a single backend. This approach ensures all instances remain active without each backend needing its own reloader.


**Conclusion**
By adding a simple reloader script to your backend, you can prevent Render instances from spinning down due to inactivity. This ensures that your server remains responsive, providing a better user experience for your hobby projects. This solution is effective for small to medium-level projects and helps maintain constant activity on your server.

[Github](https://github.com/Harsh-git98/render.com-spindown-solution)

Hope this helps! Happy Deployment.
Digital Marketing Company In Nagpur
Tags: digitalmarketing
Published: 2024-06-22 15:40:12

[Digital Marketing Company In Nagpur](https://primathink.com/digital-marketing-company-in-nagpur/) | Digital Marketing Services

PrimaThink the Digital Marketing Company In Nagpur is at your service. We have the perfect tools and strategies to take your business to a whole new level through our Digital Marketing Services.
"Digital Marketing Courses In Nagpur "
Tags: digitalmarketing
Published: 2024-06-22 15:37:24

PrimaThink - [Digital Marketing Courses In Nagpur](https://primathink.com/digital-marketing-courses-in-nagpur/)

PrimaThink provides Digital Marketing Courses in Nagpur that cover everything from Search Engine Optimization and Social Media Marketing to its Analysis tool’s effective use to get a targeted audience with the right strategies.
Allow remote access to postgresql database
Tags: postgres
Published: 2024-06-22 15:35:33

Allowing remote access to your PostgreSQL database can be necessary for various reasons, such as connecting from different servers or enabling remote management. 

### Step 1: Modify the PostgreSQL Configuration File

First, you need to modify the PostgreSQL configuration file to allow connections from remote hosts. This file is typically located in `/etc/postgresql/<version>/main/postgresql.conf`. Replace `<version>` with your PostgreSQL version number.

For example, if you are using PostgreSQL version 13, you would run:

```bash
sudo nano /etc/postgresql/13/main/postgresql.conf
```

Locate the following line:

```plaintext
#listen_addresses = 'localhost'
```

Uncomment this line and change `'localhost'` to `'*'` to allow connections from any IP address:

```plaintext
listen_addresses = '*'
```

### Step 2: Configure Client Authentication

Next, you need to configure PostgreSQL to accept remote connections by editing the `pg_hba.conf` file, which controls client authentication.

Open the `pg_hba.conf` file:

```bash
sudo nano /etc/postgresql/13/main/pg_hba.conf
```

Add the following line at the end of the file to allow connections from any IP address using MD5 password authentication:

```plaintext
host    all             all             0.0.0.0/0               md5
```

### Step 3: Restart PostgreSQL Service

For the changes to take effect, you need to restart the PostgreSQL service. Use the following command:

```bash
sudo systemctl restart postgresql
```

### Step 4: Configure Your Firewall

Ensure your firewall allows incoming connections on PostgreSQL's default port (5432). If you are using UFW (Uncomplicated Firewall), you can allow connections to this port by running:

```bash
sudo ufw allow 5432/tcp
```

### Step 5: Verify Remote Access

To verify that your PostgreSQL database is accessible remotely, you can use a PostgreSQL client tool like `psql` from a remote machine. For example:

```bash
psql -h <your_server_ip> -U <your_username> -d <your_database>
```

Replace `<your_server_ip>`, `<your_username>`, and `<your_database>` with your server’s IP address, PostgreSQL username, and database name, respectively.

### Security Considerations

Allowing remote access to your PostgreSQL database opens up potential security risks. Here are a few best practices to mitigate these risks:

1. **Use Strong Passwords:** Ensure that all your PostgreSQL user accounts have strong passwords.
2. **Restrict IP Addresses:** Instead of allowing connections from any IP address, restrict access to specific IP addresses or ranges by modifying the `pg_hba.conf` file.
3. **Enable SSL:** Configure PostgreSQL to use SSL for encrypted connections.
4. **Regular Updates:** Keep your PostgreSQL installation and all related packages up to date to ensure you have the latest security patches.

### Conclusion

By following these steps, you can configure your PostgreSQL database to allow remote connections. Always remember to balance accessibility with security to protect your data. With the proper configuration and security measures, remote access can be both convenient and safe.
CURSORS
Tags: codepen
Published: 2024-06-22 15:34:51

<p>This HTML and CSS code creates a web page with several interactive elements and style effects. Here's a summary of the elements and their functionalities:</p>

<p>A link to an Instagram profile with the text "hover and click".
Line break tags to add vertical space.
A button with a "glow-on-hover" class and the text "TEST ! CLICK ON ME !!!".
A level 1 heading with the text "Hover over me and highlight me!".
CSS code that defines a custom cursor for the entire page, for certain interactive elements like links and buttons, as well as for specific text-related elements like headings and paragraphs.
CSS style for links, including a transition effect for color and background when hovered.
CSS style for the button with a glow effect on hover.
CSS style for the heading with an animated underline effect on hover.
CSS style for text selection in the heading.
In summary, this page presents multiple interactive elements with visual style effects and animations to enhance the user experience.</p>

{% codepen https://codepen.io/myvoice/pen/wvZLaEr %}
How Machine Learning Models Work - One Byte Explainer
Tags: devchallenge, cschallenge, computerscience, beginners
Published: 2024-06-22 15:32:53

*This is a submission for [DEV Computer Science Challenge v24.06.12: One Byte Explainer](https://dev.to/challenges/cs).*

## Explainer

Machine learning is a system that learns from data and improves over time without writing extra programming. Machine learning models first train on the given data and then test the data by making decisions or predictions based on the given data. 


## Additional Context

Whenever studying machine learning, we often get confused about how it works, why we need testing and training data, and the functioning of models. I simply explain: the roles of data, and how models work.
Day 26 of my progress as a vue dev
Tags: webdev, vue, typescript, tailwindcss
Published: 2024-06-22 15:26:24

**About today**
Today was one of the most productive days I've had in a while and it felt great to get a lot of work done. I'm surprised how much you can do if you don't have any distractions and you set your mind to something. I got my landing page completed and spent a lot of time studying many concepts on generative AI which was fun.

**What's next?**
I will try absolute best to continue this pace and will try to up number of productive of hours on daily basis. I have one more landing page I want to work on and will do that before getting started on my portfolio landing page.

**Improvements required**
I think I have to re-figure my daily schedule in order to fit my work hours and get as many productive sessions in day as I can.

Wish me luck!
Thread In Java
Tags: java
Published: 2024-06-22 15:22:08

- A thread is a small part of a process capable of execute independently.
- Java supports multithreading, allowing a process to be divided into multiple threads. These threads can be scheduled by the CPU to execute in parallel, improving the performance of the application.

## Creation of a Thread
- We can create a thread by extending the 'Thread' class or implementing the 'Runnable' interface. Override the run method inside the thread.

## CODE

```
class A extends Thread{ //A is a thread that extends "Thread" class
    public void run(){ //Override the run method
        for (int i=0; i<10; i++){
        System.out.println("AAAA");
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

class B implements Runnable{ //B is a thread that impliments "Runnable" interface
    public void run(){ //Override the run method
        for (int i=0; i<10; i++){
            System.out.println("BB");
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

public class Server {
   public static void main(String[] args){
        A a = new A();
        B b = new B();
        Thread Tb = new Thread(b); // we need to pass that runnable into the costructor of thread class to create a thread
        a.start();
       try {
           Thread.sleep(10);
       } catch (InterruptedException e) {
           throw new RuntimeException(e);
       }
       Tb.start();

    }
}

Output:
AAAA
AAAA
BB
BB
AAAA
AAAA
BB
AAAA
BB
BB
AAAA
BB
AAAA
AAAA
BB
BB
AAAA
BB
AAAA
BB

```
Here we have two classes, A and B, both representing threads. When we start the threads using the start method, both threads begin executing in parallel.

## Methods in the Thread Class

- **start():** Starts the thread's execution; the JVM calls the thread's run method.
- **run():** Contains the code to be executed by the thread.
- **join():** Waits for the thread to die. If called on a thread, the calling thread will wait until the thread on which join was called finishes.
- **sleep(long millis):** Causes the current thread to sleep for the specified number of milliseconds.
- **interrupt():** Interrupts the thread, causing it to stop its current task and handle the interruption (if it checks for interruptions).

## CONCLUSION

> Threads are helpful in large applications that require more time and resources to execute. By dividing such applications into multiple threads and executing them in parallel, the performance of the application can be significantly increased.

_**Please comment below if I have made any mistakes or if you know any additional concepts related to this topic.**_
1248. Count Number of Nice Subarrays
Tags: php, leetcode, algorithms, programming
Published: 2024-06-22 15:11:14

1248\. Count Number of Nice Subarrays

Medium

Given an array of integers `nums` and an integer `k`. A continuous subarray is called nice if there are `k` odd numbers on it.

Return _the number of **nice** sub-arrays_.

**Example 1:**

- **Input:** nums = [1,1,2,1,1], k = 3
- **Output:** 2
- **Explanation:** The only sub-arrays with 3 odd numbers are [1,1,2,1] and [1,2,1,1].

**Example 2:**

- **Input:** nums = [2,4,6], k = 1
- **Output:** 0
- **Explanation:** There are no odd numbers in the array.

**Example 3:**

- **Input:** nums = [2,2,2,1,2,2,1,2,2,2], k = 2
- **Output:** 16 

**Solution:**

- <code>1 <= nums.length <= 50000</code>
- <code>1 <= nums[i] <= 10^5</code>
- <code>1 <= k <= nums.length</code>


**Constraints:**

```
class Solution {

    /**
     * @param Integer[] $nums
     * @param Integer $k
     * @return Integer
     */
    function numberOfSubarrays($nums, $k) {
        $r  = array(0, 0);
        $res = 0;
        $pre = 0;
        $cur = 0;
        for($i = 0; $i < count($nums); $i++){
            $r[$nums[$i] & 1]++;
            if($r[1] == $k){
                $pre = $cur;
            }
            while($r[1] == $k){
                $r[$nums[$cur] & 1]--;
                $cur++;
            }    
            $res += $cur - $pre;
        }
        return $res;
    }
}
```



**Contact Links**

- **[LinkedIn](https://www.linkedin.com/in/arifulhaque/)**
- **[GitHub](https://github.com/mah-shamim)**
AWS Global Accelerator
Tags: aws
Published: 2024-06-22 14:46:44

🚀 Exciting News! 🚀

I'm thrilled to announce that I've achieved AWS certification! 🎉

After months of dedicated learning and hard work, I am now officially certified with this certificate. This journey has been incredibly rewarding, and I'm looking forward to leveraging this knowledge to drive innovation and efficiency in cloud computing.

A huge thank you to everyone who supported me along the way. Your encouragement and guidance meant the world to me.

Let's continue to push boundaries and explore new possibilities with AWS! 💡
Introduction to Amazon Polly
Tags: aws
Published: 2024-06-22 14:46:03

🚀 Exciting News! 🚀

I am thrilled to announce that I have achieved my AWS certification! 🎉 After months of hard work and dedication, I am now certified with this certificate. This accomplishment signifies my commitment to mastering AWS services and best practices, enhancing my skills in cloud computing and infrastructure management.

I am grateful for the support of my colleagues, mentors, and the invaluable resources provided by AWS. This journey has been incredibly rewarding, and I look forward to applying my knowledge to deliver innovative solutions and contribute effectively to our projects.

Thank you all for your encouragement and belief in my abilities. Let's continue to strive for excellence together!
GalaxyBot: A Cosmic WhatsApp Chatbot with Laravel, Twilio, and Cloudflare AI
Tags: devchallenge, twiliochallenge, ai, twilio
Published: 2024-06-22 14:38:44

*This is a submission for [Twilio Challenge v24.06.12](https://dev.to/challenges/twilio)*

## What I Built
I have created a GalaxyBot, an informative WhatsApp chatbot that delivers detailed information about stars and galaxies. The bot uses Laravel for the backend, Twilio for WhatsApp messaging, and Cloudflare's AI for generating responses.

- **User Interaction and processing:** Users send the bot queries about stars and galaxies.
- **AI Integration:** The bot passes the query to Cloudflare's AI model, which returns detailed information about the star or galaxy.
- **Response Delivery:** GalaxyBot sends the information back to the user's WhatsApp via Twilio.

## Twilio and AI
I have used **Twilio Messaging API** to set the communication channel for WhatsApp and the AI model `@cf/meta/llama-2-7b-chat-fp16` from **Cloudflare Workers AI** using REST API. 

**1. Seamless Messaging:** Twilio's WhatsApp API allows to receive user messages and send responses seamlessly, providing a robust messaging platform.
**2. Dynamic Responses:** Using Cloudflare's AI, the bot generates dynamic and accurate information based on user queries. I am using Cloudflare Workers AI.
**3. Efficient Communication:** The integration of Twilio with AI ensures that users receive detailed and relevant information promptly, making the bot an effective educational tool.

**Demo**
This application is currently running in a sandbox environment. To test the application you can send a message `alphabet-theory` to the number `+14155238886` or scan the QR code from your mobile.

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

**Github Repo**
{% embed https://github.com/snehalkadwe/galaxy-info-chatbot %}



Kudos to the Dev team for organizing an amazing challenge.
Become A Full Stack Developer in Lahore
Published: 2024-06-22 14:37:37

Join [Web Development trainings](https://shantrainings.com/web-development) in Lahore and unlock the potential in the world of coding. Learn from shan trainings and build your career today. If you are looking HTML and CSS in Web Development trainings in Lahore. Shan Trainings offering best courses programm.
How Amazon SageMaker Can Help
Tags: aws
Published: 2024-06-22 14:36:56

🚀 Exciting News! 🚀

I'm thrilled to announce that I've achieved AWS certification! 🎉

After months of dedicated learning and hard work, I am now officially certified with this certificate. This journey has been incredibly rewarding, and I'm looking forward to leveraging this knowledge to drive innovation and efficiency in cloud computing.

A huge thank you to everyone who supported me along the way. Your encouragement and guidance meant the world to me.

Let's continue to push boundaries and explore new possibilities with AWS! 💡
Amazon Direct Connect
Tags: aws
Published: 2024-06-22 14:36:14

🚀 Exciting News! 🚀

I am thrilled to announce that I have achieved my AWS certification! 🎉 After months of hard work and dedication, I am now certified with this certificate. This accomplishment signifies my commitment to mastering AWS services and best practices, enhancing my skills in cloud computing and infrastructure management.

I am grateful for the support of my colleagues, mentors, and the invaluable resources provided by AWS. This journey has been incredibly rewarding, and I look forward to applying my knowledge to deliver innovative solutions and contribute effectively to our projects.

Thank you all for your encouragement and belief in my abilities. Let's continue to strive for excellence together!
JIN: A Light-Weight Hacking Tool Project
Tags: cybersecurity, cli, python, programming
Published: 2024-06-22 14:32:25

Today, I want to share my own simple cli application used for mapping URL, mapping open port of targeted website, and launching a DDoS attack. Disclaimer on, this project is made just for educational purpose, so I do not recommend you to use this project for unethical purpose.

## What is CLI ?
**CLI** stands for Command Line Interface is a way we interact with computer programs through text commands in a console or terminal. Instead of using graphical elements like windows or buttons, users type commands to perform tasks. CLIs is prevalent in programming, system administration, and various tech field because they offer powerful and efficient way to manage tasks and automate workflows.

## What is JIN ?
As I mention before, JIN is a simple CLI application designed for doing URL mapping, open port mapping, and launching a DDoS attack. This tool is made for education purpose and just to satisfy my curiosity. For further information, you can follow the link bellow.
[JIN Repository](https://github.com/aliftech/jin).


## Installation and Setup
clone the JIN project using the following command:

```bash
git clone https://github.com/aliftech/jin.git
```

After that, move to root project and create a virtual environment using the following command:

```bash
py -m venv env
```

```bash
.\env\Scripts\activate
```

After creating a virtual environment, the next step is installing all required dependencies using the following command:

```bash
pip install -r requirements.txt
```

Well, the JIN application is now ready to use.

## Install and Setup JIN Using Docker
Beside installing and setup JIN application using the previous way, there is one more simple installation method, that is running this application using docker. In order to do that, you only need to run the following command:

```bash
docker compose run jin
```

Then you can use your project now.
Getting Started with NLB
Tags: aws
Published: 2024-06-22 14:27:44

🚀 Exciting News! 🚀

I'm thrilled to announce that I've achieved AWS certification! 🎉

After months of dedicated learning and hard work, I am now officially certified with this certificate. This journey has been incredibly rewarding, and I'm looking forward to leveraging this knowledge to drive innovation and efficiency in cloud computing.

A huge thank you to everyone who supported me along the way. Your encouragement and guidance meant the world to me.

Let's continue to push boundaries and explore new possibilities with AWS! 💡