teleren/devto huggingface dataset:
Data Modeling and its Importance in Data Science.
Tags: beginners, datascience
Published: 2023-10-22 18:10:11

What is data modeling? **Data modeling is the process used in database management to create a representation of data and its relationships within an organization.** It helps us to ensure that data is accurate and usable for various purposes such as analysis.

In data modeling, we use a data model, which is a representation of how data is stored and accessed in a database system. It is also used to design databases.
There are various types of data models for example:
> - Hierarchical models where data is structured in a tree-like structure. This model is used in file systems and old databases
> - Network models that show a more complex relationship between variables in data e.g. CODASYL databases.
> - Relational models that represent data in columns and rows like MySQL, PostgreSQL, and Oracle.

Data modeling plays a very important role in data science and it is a very crucial process in data science.
Some of the roles are as stated below:
**1. Data Exploration:**
Data modeling helps data scientists understand the structure and the relationship between the independent variables and dependent variable in the data.

**2. Feature Engineering:**
Feature engineering is the selecting and transforming of relevant data attributes to improve the model performance. By understanding the relationships between different data elements, data scientists can design new features or select existing ones that are most predictive and more accurate for the problem at hand.

**3. Model Building:**
The selection of models depends on the structure of the data and the relationship between variables. Some models are preferably used with structured data while others with unstructured data.

**4. Data Integration:**
Data modeling aids in the integrating of data from different sources e.g. databases or files by creating a unified model.

**5. Data Transformation:**
Data modeling can involve transforming data to meet the assumptions of certain modeling techniques

**In conclusion,** data modeling is a very crucial process in effective data management and decision-making in Data Science. By embracing data modeling techniques, organizations can get the full potential of their data resources which in turn, enables informed decision-making.
Now you can do full Stable Diffusion XL (SDXL) DreamBooth training on Kaggle for free under 2 hours.
Tags: ai, kaggle, kohya, stablediffusion
Published: 2023-10-22 18:03:58

Now you can do full Stable Diffusion XL (SDXL) DreamBooth training on Kaggle for free under 2 hours.

Notebook and instructions : https://www.patreon.com/posts/88397937

Kaggle provides 2x T4 GPU.

With Kohya script we are literally doubling effective number of steps.

So when we do 80 repeating we do 160 epochs.


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

At the above image you see I did 160 repeating training.

So it was actually 320 epochs therefore overtrained.

Updated my Kaggle notebook post with accurate instructions.
The first time I contributed to Hacktoberfest 2023 Open Source
Tags: hack23contributor
Published: 2023-10-22 18:03:47

🌱 Exciting News: I've Successfully Completed Hacktoberfest 2023! 🌟



I'm thrilled to share that I've successfully completed this year's Hacktoberfest! It's been an incredible journey, and I'm over the moon to announce that Hacktoberfest has gifted me a tree as a token of their appreciation.



🌳 Tree Species: Markhamia lutea

📍 Location: The tree(s) will grow within the project "Usambara Biodiversity Conservation," Tanzania.



It's heartwarming to know that my contributions to open-source projects are not only helping the global tech community but also making a positive impact on the environment. This Markhamia lutea tree will stand tall in the beautiful lands of Tanzania, contributing to the conservation of Usambara's rich biodiversity.



I want to thank the entire Hacktoberfest community for this wonderful initiative. I encourage everyone to participate in such events that not only enrich our skills but also allow us to give back to our planet. 🌍 Let's continue to code and contribute, making the world a better place one pull request at a time! 💻🌿



#LinkedIn #GitHub #Hacktoberfest2023 #OpenSource #EnvironmentalConservation #CodingForACause #TechForGood #Tanzania #connections #UsambaraBiodiversityConservation
Install and use Bootstrap5 in Django
Tags: webdev, bootstrap, django, tutorial
Published: 2023-10-22 17:58:43

You can use the latest version of bootstrap (bootstrap5) in django by install the module in your virtual environment.

There's other ways you can achieve that too -> include CDN, download the required files in include them in your project. But my favorite one is install the module.

Letsgooo.

inside your project active the virtual environment `source myEnv/bin/activate` if you're using venv as your virtual environment.
:: replace myEnv* by your virtual environment name

Once you are inside the virtual environment, install Bootstrap 5 with this command:
`pip install django-bootstrap-v5`

you should get something like this
![result from 'pip install django-bootstrap-v5' command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jptourtlvkfmd8fy7x5k.png)

inside your terminal type
`pip freeze > requirements.txt`

![result from freeze](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j56i2feqzxtfo1xl5mee.png)

update your settings.py and add bootstrap to your apps

![add it to you apps list](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lcpqjwcropl1pxxspwwe.png)


now add bootstrap style to your master template
[What is a master template ?](https://dev.to/schleidens/django-root-base-template-setup-4ijc)

add these 3 lines in your html head
```
{% load bootstrap5 %}
{% bootstrap_css %}
{% bootstrap_javascript %}
```
![how it looks in your HTMl](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/olvn7orycvr9iv32zqx8.png)


Bravo, you've been added Bootstrap5 in your project.


[let's connect on X/Twitter for more engagement](https://twitter.com/schleidens_dev)
Research about financial compensation on Github
Tags: opensource, github, freelance, career
Published: 2023-10-22 17:58:22

I am trying to find out whether people are interested in bringing financial compensation into the world of open-source software development. In other words, are coders interested in getting paid for their contributions to open-source projects? And are the maintainers of open-source projects willing to offer payment in exchange for work being done on their projects?

To answer these questions I have created a short survey (1-3 min). Here is the link: [survey](https://forms.gle/ncMU6HMRzWATmB796)

Thank you in advance!😊
How to install mycli for root
Published: 2023-10-22 17:02:44

## Intro

You might be using following command as a workaround in your local environment for avoiding setting a mysql password

`sudo mysql`

But, what if you want to use `mycli`.

Note: if you just use `sudo pip install <some_package_name>` This might break the system, as python dependencies of the system may get affected.

## How to enable mycli

Switch to root account
`sudo su`

Create a virtualenv in root user's home folder (or where ever you like :-) )
`python -m venv /root/venv`

Add this venv to load by default in root account.

`vim ~/.bashrc`

`# Add this conent
. /root/venv/bin/activate`

## Now you can use 

`sudo mycli`

## Note

Just use pip install command to install similar tools like pgcli too samve venv (ie. /root/venv). But, pgcli doesn't support this root login, as far I know.

`pip install pgcli`

## Links

https://github.com/dbcli
https://www.dbcli.com/
Set Up Azure AI Chatbot in 7 Easy Steps! 🤖
Tags: azure, ai, tutorial, programming
Published: 2023-10-22 17:19:41

---
title: Set Up Azure AI Chatbot in 7 Easy Steps! 🤖
published: true
tags: #azure #ai #tutorial #programming
canonical_url: https://devtoys.io/2023/10/21/set-up-an-azure-ai-chatbot-for-your-business-in-7-easy-steps/
---

In today’s fast-paced digital era, staying connected with your customers around the clock is no longer a luxury—it’s a necessity. Imagine harnessing the power of cutting-edge AI technology to revolutionize your customer interactions, all in the time it takes to enjoy a lunch break! Welcome to our step-by-step guide where we’ll walk you through the exhilarating journey of setting up an AI ChatBot for your business in just 7 easy steps. Whether you’re a tech novice or a seasoned pro, by the end of this tutorial, you’ll have a fully-functioning digital assistant ready to elevate your business to new heights. Let’s dive in!

👀 **Read the Full Tutorial Here** ===> [DevToys - Set Up an Azure AI Chatbot for Your Business in 7 Easy Steps](https://devtoys.io/2023/10/21/set-up-an-azure-ai-chatbot-for-your-business-in-7-easy-steps/)
Virtual Memory in Operating Systems
Tags: computerscience, softwaredevelopment, tutorial, virtualmachine
Published: 2023-10-22 16:50:22

## What is virtual memory?

Virtual memory is an important part of modern operating systems designed to provide the illusion of a large and continuous memory space to the program by using efficient physical RAM (Random Access Memory). The computer allows you to run programs that require more memory than is available physically, to do many tasks and the execution of large programs.

## How virtual memory works

Imagine you have several programs open on your computer - a web browser, a word processor, and a music player. Each of these programs requires a portion of your computer's memory to run. In a system without virtual memory, this application must compete for limited physical RAM, which can cause frequent crashes or slowdowns. However, virtual memory takes steps to avoid such problems.

Virtual memory works by creating a layer of abstraction between physical RAM and the software running on your computer. Instead of a direct connection between programs and RAM, your operating system allocates a portion of your hard drive called "page file" or "swap space" as an extension of RAM. This virtual memory is divided into blocks of the size called "pages".

When a program needs memory, it will interact with the virtual memory address without knowing its actual location in RAM or hard disk. The operating system's memory manager handles the translation of these virtual memory addresses into physical RAM or storage space, exchanging data between RAM and the hard disk to keep active processes running smoothly.

### Simple example

Let's look at a simple example to illustrate how virtual memory works. Imagine you have a computer with 4 GB of physical RAM and you run two programs:

1. Photo editing program that uses 2 GB of memory.
2. A web browser that uses 1 GB of memory.

Without virtual memory, you'll run into problems because your programs will require more memory than your physical RAM can accommodate. However, with virtual memory, the operating system can temporarily cache data from photo editing software and web browsers to free up RAM space for active programs.

When you switch between these programs, the operating system efficiently manages data in and out of RAM and provides a smooth user experience.

### The results

Virtual memory is an important concept in modern operating systems, allowing multiple programs to run simultaneously even when physical RAM is limited. Creating an abstraction layer works by translating virtual memory addresses to physical memory locations. Thus, it provides the illusion of large memory space for applications by efficiently managing available hardware resources.
How to create suspense in the next JS?
Tags: webdev, programming, javascript, react
Published: 2023-10-22 16:49:08

**_What is React Suspense?_**
React’s Suspense component was first added to React in v16.6, which was released in 2018. Suspense handles asynchronous operations like code splitting and data fetching. In simple terms, it lets you display a fallback component until the child component is fully loaded. The code below shows React Suspense’s syntax:

```
<Suspense fallback={<Loading />}>
  <SomeComponent />
</Suspense>
```
**Suspense in NextJS**

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

**Next.js** supports server-side rendering, so the UI will take some time to load. In such cases, you can use Suspense to load the UI. The component in loading.js is defined as a functional component that can be exported as the default. The syntax is below:

```
export default function Loading() {
  // You can add any UI inside Loading, including a Skeleton.
  return <LoadingSkeleton />
}
```

**Setting up our Next.js project**

```
npx create-next-app@latest
```
After successfully creating of next project follow the below steps.

1. Removing unnecessary files and folders.
2. Creating `Loading.js` into the root. 
3. Fetching posts from `[Jsonplaceholder](https://jsonplaceholder.typicode.com/)`.
4. Creating a `Posts route` into the app folder.

```
async function getPosts() {
  await new Promise((resolve) => setTimeout(resolve, 2000));
  let res = await fetch(
    `https://jsonplaceholder.typicode.com/posts`
  );
  
  return res.json();
}

async function SocialPosts() {
  let posts = await getPosts();
  return (
    <div>
      <h3>Posts</h3>
      {posts &&
        posts.map((index) => {
          return <li>{index.title}</li>;
        })}
    </div>
  );
}
export default SocialPosts;
```
Here is the output: 

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

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


**Conclusion**
Building a loading component with Next.js and React Suspense can significantly improve the user experience of your web application. With Suspense, you can easily create loading states for data-fetching and dynamic imports, making your application more responsive and efficient.
How to Handle Side Effects like API Calls in React Components
Tags: webdev, javascript, programming, react
Published: 2023-10-22 16:37:25

When developing React applications, handling side effects such as API calls is crucial. The primary tool for this in the React ecosystem is the `useEffect` hook. Here's a simple guide to help you manage those side effects:

**Understanding useEffect:**
The `useEffect` hook allows you to perform side effects in function components. It takes two arguments: a function where you place your side effect and a dependency array. The side effect will re-run whenever any value in the dependency array changes.

**Making an API Call:**

```
const [data, setData] = useState(null);

useEffect(() => {
  fetch('/api/data')
    .then(response => response.json())
    .then(data => setData(data))
    .catch(error => console.error("There was an error fetching data:", error));
}, []);

```
In the example above, we're making an API call using the `fetch `function. The empty dependency array `[]` ensures the effect only runs once, similar to `componentDidMount `in class components.

**Handling Loading & Errors:**
To provide better UX, it's a good idea to handle loading states and errors.

```
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);

useEffect(() => {
  fetch('/api/data')
    .then(response => response.json())
    .then(data => {
      setData(data);
      setLoading(false);
    })
    .catch(error => {
      console.error("There was an error fetching data:", error);
      setError(error);
      setLoading(false);
    });
}, []);

```
**Cleaning Up Side Effects:**
Sometimes, you might set up subscriptions or listeners that need cleanup. To do this, return a cleanup function from your effect:

```
useEffect(() => {
  const subscription = someAPI.subscribe(data => {
    setData(data);
  });

  return () => {
    subscription.unsubscribe();
  };
}, []);

```
**Using Libraries:**
For more complex scenarios or to streamline your API calls, consider libraries like `axios `for HTTP requests or `react-query` and `SWR `for data fetching, caching, and synchronization.

**Conclusion:**
Handling side effects, especially API calls, in React is straightforward with the `useEffect `hook. Ensure you manage loading states, errors, and potential cleanups to provide an optimal experience for your users.
Tuple Types in Typescript
Tags: typescript, beginners, learning, codenewbie
Published: 2023-10-22 16:04:09

Sometimes, you need to define arrays where the order and types of their elements should matter. In a case like that, Tuple types come in very handy.

For example, if you have a `turtle = ["Zanjabeel", 14];` where Zanjabeel is its name, and 14 is its age. Declaring `turtle` that way (without Tuple) will implicitly give it the type of `(number|string)[]` (array of `string` or `number`), which will not help prevent someone from giving `turtle` a non-string name or a not-a-number age.


### Defining `turtle` with Tuples

To guarantee that `turtle` will have the first element as `string` and the second one as `number`, you’ll need to define it as a Tuple of length two.

```javascript
let turtle: [string, number] = ["Zanjabeel", 14];
turtle[1] = "15"  // Error Type: ‘string’ is not assignable to type ‘number’. 

turtle[0] = "Ginger" // works fine
turtle[1] = 15 // works fine
```


### Naming & Destructuring Tuples

To enhance code readability, you could name the Tuple type elements.

```javascript
let turtle: [name: string, age: number] = ["Zanjabeel", 14];
```

Or you could also destructure it.

```javascript
const turtle: [string, number] = ["Zanjabeel", 14];
const [name, age] = turtle;
```


### Readonly Tuples

To make your Tuple array read-only, you can use `readonly`.

```javascript
const KEYS: readonly [KEY_1: string, KEY_2: number] = ["secret_key", 40];

// The following lines will throw compile-time errors.
KEYS[0] = "new_secret_key"; // Error: Cannot assign to '0' because it is a read-only property.
KEYS.push("new_secret_key"); // Property 'push' does not exist on type 'readonly [KEY_1: string, KEY_2: number]'.
``` 

This feature is particularly valuable when you want to ensure the immutability of certain data structures.

_Thanks for reading._
2023 Hacktoberfest #2
Published: 2023-10-11 20:27:46

[Issue](https://github.com/samratghosh291/Musicia/issues/43)
[PR](https://github.com/samratghosh291/Musicia/pull/45)

After I worked on the first PR of `2023 Hacktoberfest` I got confident in finding and contributing to open-source projects. And I could easily find a new project called `Musicia` a web based music player application. It looked like a small project and they only used plain `Javascript`,`HTML` and `CSS`, so I was sure that I'd fix the bug in the project. 

A bunch of bugs were already in the `Issues` and I easily found a `bug`, it was not able to redirect to `sign-in` and `log-in` pages even though buttons were created. 

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

The previous code didn't have `<a></a>` tag to redirect to each page, and the `sign-in` and `log-in` two buttons were too close because of `class='user' CSS`. So, I simply added `<a></a>` tag to each icon to redirect to `pages/login.html` and `pages/signup.html`. Also, I used `class='nav-links` for consistency of navbar instead of `class='user'. 
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x1ibdgg1opeap5iy9zic.png)

Even though it was a simple issue and PR, it took longer than I expected because the author didn't approve not in order and I had to update `index.html` to avoid conflicts when the new merge came up.

Now, I really got interested in open-source projects and want to keep contributing to the open-source world even though `Hacktoberfest` and my course is over later on. Also, I updated my [README.md](https://github.com/seog-jun) profile page to show my `GitHub's Stat` and actively work on open-source projects. Feel free to follow my account, and learn new technologies, share ideas, and work on open-source projects together!
Docker - Utilize Docker Compose for Local Development Environments
Tags: docker, devops, tutorial, programming
Published: 2023-10-22 15:30:00

Docker Compose is an excellent tool for defining and managing multi-container applications, and it's particularly valuable for setting up local development environments that closely mirror production configurations. By using Docker Compose, you can simplify, providing all the services and dependencies required for your development environment.

Here are some benefits of using Docker Compose for local development:

1. **Consistency:** Docker Compose ensures that all team members use the same development environment, reducing "it works on my machine" issues.

2. **Isolation:** Each service runs in its own container, isolating dependencies and avoiding conflicts between different components.

3. **Easy Configuration:** You can define your entire development environment, including services, volumes, and networks, in a single `docker-compose.yml` file.

4. **Version Control:** Your `docker-compose.yml` file can be versioned and stored alongside your code, making it easy for team members to set up the development environment.

5. **Scalability:** Docker Compose allows you to scale services up or down, mimicking production scenarios if needed.

Here's a basic example of a `docker-compose.yml` file for a local development environment with a web application and a database:

```yaml
version: '3'
services:
  webapp:
    image: my-webapp-image:latest
    ports:
      - "80:80"
    volumes:
      - ./app:/app
    depends_on:
      - database
  database:
    image: postgres:latest
    environment:
      POSTGRES_DB: mydb
      POSTGRES_USER: myuser
      POSTGRES_PASSWORD: mypassword
    volumes:
      - postgres-data:/var/lib/postgresql/data

volumes:
  postgres-data:
```

With this configuration, developers can start the entire development environment with a single command:

```bash
docker-compose up
```

Docker Compose also provides options for starting services in the background (`docker-compose up -d`), rebuilding images (`docker-compose build`), and more. It's a powerful tool for simplifying the setup of local development environments, making it easier to collaborate on projects and ensuring consistency across development and production environments.
CopyQ Shortcut not working under Wayland - quick fix
Published: 2023-10-22 15:28:58

If CopyQ used under X11 in Linux, it's keyboard shortcut can be set from it's UI. But, that was not working under KDE Wayland Session (Probably, under Gnome or others too).

# Workaround
I did a workaround by adding a shortcut from KDE.

1. Search for Shortcuts in start menu search.
2. Open it, and Use Add Command button to add a command of 

`copyq toggle`

3. Set a shortcut to this newly created command.

### Credits
https://github.com/hluk/CopyQ/issues/27
Find best bus seat to avoid the sun while traveling
Tags: map, bus, sun
Published: 2023-10-22 15:28:57

## www.SitInShade.com
This is so specific this is hilarious. Some clever guy made this and shared in a [reddit post](https://www.reddit.com/r/webdev/comments/17drp7o/i_made_a_website_to_find_best_bus_seat_to_avoid/)
{% embed https://sitinshade.com %}