teleren/devto huggingface dataset:
What is Interpolation in Data Science ?
Tags: datascience
Published: 2023-06-15 05:31:59

In data science, interpolation refers to the technique of estimating or predicting values within a given set of data points based on the existing data. It involves filling in the gaps or missing values between the known data points by creating a smooth curve or surface that passes through the available data.

Interpolation is commonly used when there are incomplete or sparse data points, and there is a need to estimate values at intermediate positions. This can occur in various scenarios, such as time series analysis, spatial data analysis, or when dealing with irregularly sampled data.

There are different methods of interpolation, and the choice of method depends on the nature of the data and the specific requirements of the analysis.

** Some commonly used interpolation techniques include:**

**1. Linear Interpolation:** This method assumes a straight line between two neighboring data points and estimates the values at intermediate positions based on the linear equation. It provides a simple and quick approximation but may not capture complex patterns in the data.

**2. Polynomial Interpolation:** Polynomial interpolation involves fitting a polynomial function through the given data points to estimate values at intermediate positions. The degree of the polynomial determines the complexity of the curve or surface created. Higher-degree polynomials can capture more intricate patterns but may be prone to overfitting.

**3. Spline Interpolation:** Spline interpolation uses piecewise-defined functions to approximate the data. It involves dividing the dataset into smaller segments and fitting separate curves or polynomials to each segment. This method can provide a smoother and more accurate estimate compared to linear or polynomial interpolation.

**4. Kriging:** Kriging is a geostatistical interpolation technique commonly used for spatial data analysis. It takes into account the spatial correlation between data points and uses a weighted average of neighboring values to estimate the values at unobserved locations. By obtaining [Data Science with Python Course](https://www.edureka.co/data-science-python-certification-course), you can advance your career in Data Science. With this course, you can demonstrate your expertise in data operations, file operations, various Python libraries, many more fundamental concepts, and many more critical concepts among others.

The choice of interpolation method depends on factors such as the nature of the data, the presence of outliers or noise, and the desired accuracy of the estimates. It is important to consider the limitations and assumptions of each method and validate the results to ensure the appropriateness of the interpolation technique for the specific data analysis task. 

Interpolation is a valuable tool in data science as it allows for the estimation of missing values, the creation of smooth representations of data, and the generation of continuous datasets for further analysis or modeling.
When to start learning DSA ? 🚀
Tags: dsa, programming, coding, cloud
Published: 2023-06-15 05:31:32

The most common question I get from students is,

- *How much should I learn a programming language before starting DSA ?*
- *I can’t start DSA because I am still learning a programming language.*

Starting the preparation of DSA (Data Structures and Algorithms) seems like a daunting task. But what if I tell you, the only thing or let’s say it “the prerequisite” which you need to learn is:

**The basics of any programming language.**

If you know the basics of any programming language, you are all set to learn DSA.

---

## Does DSA not require advanced programming skills?

This is the natural question that comes into mind naturally, and to answer your question, YES, it requires advanced programming skills.

However, the best way to learn both of these things, to learn them together.
You’ll learn the programming language better if you are programming and writing code with your own two hands. And solving the DSA problem is the way to do that.

---


##How can I solve a DSA problem, if I don't have the necessary language skills?

If you encounter a problem and don’t know how to solve using your existing language skills, don’t worry, just search for the way on the internet, watch a tutorial or ask ChatGPT. That way you will build your language skills along with your problem-solving skills which is required in DSA.

Now, the question that comes to mind is,

What is the basic level of any programming language that I mentioned ? What topics does it include ?

These are the basics topics to learn for any programming language:

- *Variables*
- *Loops*
- *Conditionals*
- *Functions*
- *Data types*
- *Arrays*

You can easily learn these topics in 2–4 weeks, even if you are starting from scratch. And if you have already learned these topics, then what are we waiting for ?

*Happy Coding !*🍀

Upcoming: How to actually start preparing for DSA ?
If you have any queries, don't hesitate to ask me. Click [here ](https://www.linkedin.com/in/shivam-dhaka12/)to connect with me on LinkedIn.
[Android] UserListApp - UnitTest -Part6
Tags: android, kotlin, retrofit, api
Published: 2023-06-15 05:30:17

##Add Test Dependency
**okhttp3.4.9 is match mockwebserver4.9.3**
```
    //Mock Server
    testImplementation 'com.squareup.okhttp3:mockwebserver:4.9.3'
    //okhttp
    implementation 'com.squareup.okhttp3:okhttp:3.4.9'
    //Truth
    testImplementation "com.google.truth:truth:1.1"
    testImplementation 'junit:junit:4.13.2'
```
##Create TestFile 

![CreateTestFile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkphr7r2dtaijuuy5nbf.png)


![CreateTestFile2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f5cz8stvsvtzaxitv8cs.png)

## UserRepositoryTest
This test is test for api send , success and fail

```
class UserRepositoryImplTest {

    private lateinit var userRepository: UserRepository
    private lateinit var mockWebServer : MockWebServer

    @Before
    fun setUp() {
        mockWebServer = MockWebServer()
        val retrofit = Retrofit.Builder()
            .baseUrl(mockWebServer.url(""))
            .addConverterFactory(GsonConverterFactory.create())
            .build()
        val userApi = retrofit.create(UserApi::class.java)
        userRepository = UserRepositoryImpl(userApi)
    }

    @After
    fun tearDown() {
        mockWebServer.shutdown()
    }

    @Test
    fun `getRandomUserWhenSuccess`() = runBlocking{
        mockWebServer.enqueue(
            MockResponse()
                .setResponseCode(200)
                .setBody(UserDumpData.result)
        )

        var user : User?=null
        var errorMessage = ""
        userRepository.getRandomUser().collectLatest {
            user = it.data
            errorMessage = it.message?:""
        }
        assertTrue(user !=  null)
        assertTrue(errorMessage.isEmpty())
    }
    @Test
    fun `getRandomUserWhenFailed`() = runBlocking{
        mockWebServer.enqueue(
            MockResponse()
                .setResponseCode(404)
                .setBody("{}")
        )

        var user : User?=null
        var errorMessage = ""
        userRepository.getRandomUser().collectLatest {
            user = it.data
            errorMessage = it.message?:""
        }
        assertTrue(user ==  null)
        assertTrue(errorMessage.isNotEmpty())
    }
}
```
What is Web Application Security?
Tags: security, webdev, javascript, programming
Published: 2023-06-15 05:18:48


### Web Application Security ?

Practice of protecting web applications from various security threats and vulnerabilities. It involves implementing security measures and controls to ensure the confidentiality, integrity, and availability of web applications and the data they handle.

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

### Web applications are vulnerable to a wide range of attacks, including:
<br></br>

- **Cross-Site Scripting (XSS)**: Attackers inject malicious scripts into web pages viewed by users, allowing them to steal sensitive information or perform unauthorized actions.

<br></br>

- **Cross-Site Request Forgery (CSRF)**: This attack tricks users into unknowingly performing actions on a web application without their consent, potentially leading to unauthorized actions being executed.
<br></br>

- **SQL Injection**: Attackers manipulate input fields in web applications to execute unauthorized SQL queries, potentially gaining access to or modifying the application's database.
<br></br>

- **Security Misconfigurations**: Poorly configured web servers, frameworks, or platforms can leave vulnerabilities exposed, allowing attackers to exploit them.
<br></br>
- **Session Hijacking**: Attackers steal or manipulate session tokens to gain unauthorized access to a user's session and impersonate them on the web application.
<br></br>
- **Denial of Service (DoS) Attacks**: These attacks aim to disrupt the availability of a web application by overwhelming it with excessive traffic or resource consumption.

---

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


[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kristiyan-velkov-763130b3/)

<a href="https://revolut.me/kristiyanvelkov" target="_blank">
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rxmsw2d2ooukhdg8x5ar.png)
</a>

If you like my work and want to support me to work hard, please donate via:

<a href="https://revolut.me/kristiyanvelkov" title="Link to Revolut">Revolut website payment</a> or use the QR code above.                                                                                                                           


**Thanks a bunch for supporting me! It means a LOT 😍**
Digital Marketing Courses with certification
Published: 2023-06-15 05:18:05

We, at Edred, aim to redefine education, one student at a time. Among a plethora of digital learning services, Edred is India’s first futuristic learning academy with Glass Board Technology! We are equipped to help professionals upskill and boost their careers with state-of-the-art facilities as experts to holistically transform the industry. Edred is India's no.1 ed-tech Company providing [Digital Marketing courses](https://edred.in/digital-marketing-courses/) with certification. We provide 30+ modules and 15+ certifications with our professional and expert courses. We have both offline & online classes.
Open-source collaboration
Tags: python, webdev, ai, opensource
Published: 2023-06-15 04:58:44

My name is Adrian and I'm an open-source maker, just created [Apollo](https://github.com/apolloapi/apolloapi) an open-source LLM aggregation library for python.

I'm posting because what better way to share the news! We're currently planning a hackathon, if you're interested feel free to sign up for the [waitlist](https://apolloapi.io/)

I'm looking to add support for a full API to manage in-app integrations, user subscription management, preferences and etc... And looking for feedback from people who had experience with some of those topics previously.

BTW, we are looking for new contributors if you'll find it interesting :)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7fwdxw4qru2q6wzuhrfv.png)
Scaling Your Codebase with Tailwind CSS's @apply Directive
Tags: tailwindcss, css, webdev, javascript
Published: 2023-06-15 04:58:23

When it comes to rapidly building features, Tailwind CSS's utility-first approach enables engineers to move fast. However, as a code base grows in size and complexity, that utility-first approach can encounter challenges with scaling. One approach to circumvent these issues is to use Tailwind's `@apply` directive to create custom classes.

## Utility-first Approach

A site can have page headers, sub-headers, and standard body copy. These may require some combination of `color`, `font-face`, `font-size`, `font-weight` and `line-height` styles. Using Tailwind, we could implement a "large sub-header" like this:

```html
<h2 class="font-sans font-semibold text-lg text-stone-600">
```

Scaling this is problematic. Copying the 4 classes above and pasting them anywhere you need a large sub-header is not optimal. 

## Using the `@apply` directive

Tailwind's documentation describes the `@apply` directive as providing the ability to ["to inline any existing utility classes into your own custom CSS."](https://tailwindcss.com/docs/functions-and-directives#apply) Using the `@apply` directive, we can create a custom large sub-header class:

```sass
.large-sub-header {
  @apply font-sans font-semibold text-lg text-stone-600;
}
```

With the same tokens used for the classes, we can add those styles to our custom class name. We can now use `.large-sub-header` class anywhere we need a large sub-header. 

```html
<h2 class="large-sub-header">
```
When the inevitable change comes to update the styles for large sub-headers, we only have to make the change in one place.

## State Variants

`@apply` allows you to use state variants. Here is a "link" class that uses the `hover:` variant: 

```sass
.link {
  @apply text-orange-600 hover:text-orange-900
}
```

All state variants are available to the `@apply` directive. For `.large-subheader`, we want to apply `text-md` on small screens.

```sass
.large-sub-header {
  @apply font-sans font-semibold text-lg text-stone-600 xs:text-md;
}
```

By adding `xs:text-md` to our custom class, we made it responsive without losing the benefits that come with using Tailwind.

## `!important`

One limitation of the `@apply` directive is that the styles are added without `!important`. This is done to avoid specificity issues. To apply `!important` to an `@apply` directive is done the same way you would apply `!important` to CSS property.

```sass
.large-sub-header {
  @apply font-sans font-semibold text-lg text-stone-600 !important;
}
```

---

While Tailwind CSS is great at providing all of the utility classes one needs, over reliance upon them can result in issues down the road. A well implemented site is one that is easy to update. Using Tailwind's `@apply` to combine your patterns into custom classes can help with those scaling efforts.
100 Days Coding Challenge - Day 26: FreeCodeCamp JavaScript Algorithms and Data Structures
Tags: webdev, javascript, programming, 100daysofcode
Published: 2023-06-15 04:38:06

## Day 26

I just need one more project and finish the JavaScript course :D that regex I took it off the internet, it was too tangled.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtn0wlcfb3iq1h0351kx.png)
Which Came Foist?
Tags: poetry, aphorism
Published: 2023-06-15 04:00:00

```
switch came first?
the chick then or them in?
answer plain to see here
it's a chick kin
then a chick kin hen
then we egg with it again
and the rooster who rushes in
came before itself 
a clock ere doodle duet win
```
How to Configure Layered Navigation in Magento 2 Store
Tags: magent, magento2, magento2tutorial
Published: 2023-06-15 03:39:02

This guide will teach you **_How to Configure Layered Navigation in Magento 2 Store_**, enabling your customers to easily locate the products they desire. By utilizing Layered Navigation, customers can refine search results by filtering attributes such as price, category, and color, resulting in a more seamless shopping experience.

We will cover everything from displaying the Layered Navigation menu on your category page to adding filterable attributes. Don't take the risk of losing customers due to ineffective navigation—take advantage of Magento 2's robust Layered Navigation feature to provide an optimal on-site experience for your customers.

Follow these steps to configure Layered Navigation in your Magento 2 store and unlock its full potential.

For more information , please visit this :- [https://webguru.dev/how-to-configure-layered-navigation-in-magento-2-store/](https://webguru.dev/how-to-configure-layered-navigation-in-magento-2-store/)
Why do I keep falling back into Arch evry single time?
Tags: linux
Published: 2023-06-15 03:24:15

"I use arch btw..."

Now that's something we all have seen or heard on the internet. I agree that the Arch community can be a little bit toxic, in toxic means they expect everyone to do the same amount of research like they did and finding out a solution on their own rather than spoon feeding them the information.
Arch Linux is a rolling-release distro , yada-yada-yada  we all know that. Here is why I kept falling back into Arch even after being having a messed up system , multiple times.


In my early days of Linux usage , i was limited to a very very under-powered computer. A Pentium e5500 and 4gigs of ram just did not simply make the cut. And hence i had to resort to very less resource intensive things like a custom and striped down version of windows!

That is when i met Linux. I started off with Ubuntu , and later found out that Linux can go even lighter. I went and distro hopped for a whole year trying everything from Peppermint OS , Elementary to even Gentoo! I tried sticking to Debian based distros in the beginning because i was in 8th grade and boy I had no clue what "rm -rf /*" did back then let alone a whole different package manager like pacman.

I stuck with Linux Mint for a long while until i got my solid roots in Linux. Basic bash command, what services where, X11 , window managers etc. I read a lot of things about Arch. It was not for the faint of heart, It will take time to install , very unstabel takes too much effort , VERY LIGHTWEIGHT!


Aha I found arch to be a walking flag with one green flag and I fell for it (Not the first time ugh~). Anyways , downloading arch and finding a blank tty was well disappointing.  Off to a VM i went , installed arch onto it and boy oh boy was i surprised by the 450Mb ram usage of the Arch+Xfce i did back then. 

After a few weeks in VM i installed arch and used it for 2 straight years. Without any crashes? Well mostly yea!! Untill and unless i decided to well change the display manager a bit , or get another DE installed , it was just basic config errors which kinda made me unable to get back in and things. (I did not know about arch-chroot could fix all this back then , shame on me haha).

In the end Arch did exactly what it had to do for me. A very lightweight distro where I am in control , which is not much complicated. You can easily daily drive arch if you set it up correctly! A proper timeshift is probably all it takes for you to get it running for years!
Send email with GO + AWS SES for multiple recipents and many attached files
Tags: go, aws
Published: 2023-06-15 02:02:12

This is a simple example how send email for many recipients and add many attachments using [SES](https://aws.amazon.com/pt/ses/)

```go
package main

import (
	"fmt"
	"log"
	"strings"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/ses"
)

type EmailData struct {
	From      string
	Recipient Recipient
	Subject   string
	Body      string
	Attachs   map[string][]byte
}

type Recipient struct {
	To  []string
	Cc  []string
	Bcc []string
}

func main() {
	sesClient, err := getSesClient()
	if err != nil {
		fmt.Println(err)
	}

	emailData := EmailData{
		From: "teste@example.com.br",
		Recipient: Recipient{
			To:  []string{"teste2@example.com.br"},
			Cc:  []string{"teste2@example.com.br", "teste3@example.com.br"},
			Bcc: []string{"teste4@example.com.br"},
		},
		Subject: "Subject Example",
		Body:    "Body Example",
		Attachs: map[string][]byte{
			"file1": []byte("attach1"),
			"file2": []byte("attach2"),
			"file3": []byte("attach3"),
			"file4": []byte("attach4"),
		},
	}
	_, err = sesClient.SendRawEmail(emailData.MountEmail())
	if err != nil {
		log.Fatal("error for send email:", err)
	}

}

func (e *EmailData) MountEmail() *ses.SendRawEmailInput {
	header := fmt.Sprintf("From: %s\r\n", e.From)
	header += fmt.Sprintf("To: %s\r\n", strings.Join(e.Recipient.To, ", "))
	header += fmt.Sprintf("Cc: %s\r\n", strings.Join(e.Recipient.Cc, ", "))
	header += fmt.Sprintf("Subject: %s\r\n", strings.Join(e.Recipient.Bcc, ", "))
	header += "MIME-Version: 1.0\r\n"
	header += "Content-Type: multipart/mixed; boundary=\"Boundary\"\r\n\r\n"

	//BodyPart
	bodyPart := fmt.Sprintf("--Boundary\r\n")
	bodyPart += fmt.Sprintf("Content-Type: text/plain; charset=\"UTF-8\"\r\n")
	bodyPart += fmt.Sprintf("Content-Disposition: inline\r\n\r\n")
	bodyPart += fmt.Sprintf("%s\r\n\r\n", e.Body)

	attachmentParts := ""
	for filename, attachment := range e.Attachs {
		attachmentPart := fmt.Sprintf("--Boundary\r\n")
		attachmentPart += fmt.Sprintf("Content-Type: application/octet-stream\r\n")
		attachmentPart += fmt.Sprintf("Content-Disposition: attachment; filename=\"%s\"\r\n\r\n", filename)
		attachmentPart += string(attachment) + "\r\n"
		attachmentParts += attachmentPart
	}

	endPart := fmt.Sprintf("\r\n--Boundary--")
	rawMessage := header + bodyPart + attachmentParts + endPart
	email := &ses.SendRawEmailInput{
		RawMessage: &ses.RawMessage{
			Data: []byte(rawMessage),
		},
	}

	return email
}

func getSesClient() (*ses.SES, error) {
	awsSession, err := session.NewSession(&aws.Config{
		Region: aws.String("us-east-1"),
	})
	if err != nil {
		fmt.Println(err)
		return nil, err
	}
	sesClient := ses.New(awsSession)

	return sesClient, err
}
```
Removing trailing space underlines from groups of anchor tags
Tags: css, jsx
Published: 2023-06-15 01:35:11

---
title: Removing trailing space underlines from groups of anchor tags
published: true
description: Sometimes when you have a bunch of anchor tags, the trailing spaces around them are underlined. Here's how to fix that.
tags: css, jsx
cover_image: https://images.unsplash.com/photo-1531160492875-2a09eb0cd73b?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1742&q=80
canonical_url: https://blog.cassidoo.co/post/trailing-underlines/
---

Recently as I was working on some styles for my blog, I ran into an issue where I had a block of anchor tags rendered in JSX, and they didn't look right.

![A list of tags with trailing spaces that were underlined](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dryhsp3kk1509yu1xe4j.png)

All of the links had trailing spaces, and those spaces were being underlined!

## How did we get here?

I had an array of tags, and they were being displayed in a `<div>`, like so:

```jsx
<div>
    {
        tags.map((tag) => (
            <a class="tag" href={`#`}>
                #{tag}
            </a>
        ))
    }
</div>
```

I didn't fully understand why the underlined, trailing space was being rendered, and weeped as the gods of JavaScript mocked me.

After getting over it, I tried changing the `word-wrap` and other various CSS styles to fix the links, with no success. I admit it took me way longer than I expected to find a solution, and I wrote this blog to save me from my future self who will inevitably run into this problem again.

## How did we overcome?

Turns out, if you add `display: inline-block`, it removes the underlines in the spaces!

Here's a CodePen to show this lil CSS trick in action!

{% codepen https://codepen.io/cassidoo/pen/BaGjpBe %}

The end, stay safe, nerds.