teleren/devto huggingface dataset:
Building a REST API in Go
Tags: go, webdev, beginners, programming
Published: 2024-03-24 00:32:40

## Introduction

Building a REST API (Representational State Transfer Application Programming Interface) in Go is becoming an increasingly popular choice for developers. Go, also known as Golang, is a modern, open-source programming language developed by Google. It was designed with the goal of building simple, reliable, and efficient software. In this article, we will discuss the advantages, disadvantages, and features of building a REST API in Go.

## Advantages

One of the main advantages of using Go for building REST APIs is its ability to handle high traffic and large volumes of requests. This makes it a suitable choice for building scalable and performant APIs. Go is also known for its simple and clean syntax, making it easy to learn and maintain, especially for teams with diverse experience levels. It also has a robust standard library and powerful concurrency model, making it ideal for building efficient and concurrent APIs.

## Disadvantages

One of the disadvantages of using Go for building a REST API is its relative newness compared to other popular languages like Java or Python. This may result in a limited pool of available resources and documentation. Additionally, some developers may find Go's strict error handling and lack of generics to be challenging.

## Features

Go offers many useful features for building REST APIs, such as its built-in HTTP server and router, which makes creating endpoints and handling requests straightforward. It also has a strong focus on building secure applications by default, including features like automatic memory management and built-in support for TLS encryption.

### Example of Creating a Simple HTTP Server in Go

```go
package main

import (
    "fmt"
    "net/http"
)

func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "Hello, World from Go!")
}

func main() {
    http.HandleFunc("/", handler)
    http.ListenAndServe(":8080", nil)
}
```

This example demonstrates how to create a basic HTTP server in Go that responds with "Hello, World from Go!" when accessed. It showcases the simplicity and power of Go's standard library for web applications.

## Conclusion

With its efficient performance, concurrency model, and focus on secure programming, Go is a strong choice for building REST APIs. While it may have some limitations, its advantages far outweigh any potential challenges. As more developers adopt Go in their projects, its community and resources will continue to grow, making it an even more attractive option for building modern and scalable APIs.
uploading file into pinata
Tags: pinata, ipfs, webdev, javascript
Published: 2024-03-23 21:34:33

hello family. in this function i want to send multiple png,s to pinata using their file upload system and then i want to fetch the images and map it inside my react app here is my code please some one let me know if they already face this issue .

`const handleImageChange = async () => {
    setLoaderThree(true);
    try {
      const formData = new FormData();
      const files = Array.from(selectedFile);

      files.forEach((file) => {
        console.log(file.name);
        formData.append("file", file);
        formData.append(
          "pinataMetadata",
          JSON.stringify({
            name: file.name,
          })
        );
      });

      formData.append(
        "pinataOptions",
        JSON.stringify({
          cidVersion: 0,
        })
      );

      const res = await fetch(
        "https://api.pinata.cloud/pinning/pinFileToIPFS",
        {
          method: "POST",
          headers: {
            pinata_api_key: `${apikey}`,
            pinata_secret_api_key: `${secretapikey}`,
          },
          body: formData,
        }
      );

      if (res.ok) {
        const resData = await res.json();
        console.log("Parent Hash:", resData.IpfsHash);
        const filesResponse = await fetch(
          `https://gateway.pinata.cloud/ipfs/${resData.IpfsHash}`
        );
        if (filesResponse.ok) {
          const filesText = await filesResponse.text();
          console.log("Response Body:", filesText);
          // Push each image with its corresponding metadata
          files.forEach((file, index) => {
            setImagesWithMetadata((prev) => [
              ...prev,
              { imageUrl: filesText, metadata: { name: file.name } },
            ]);
          });
        } else {
          console.error(
            "Failed to retrieve files within the parent hash:",
            filesResponse.statusText
          );
        }
      } else {
        console.error("Failed to pin the file to IPFS");
      }

      setLoaderThree(false);
    } catch (error) {
      console.error("Error while processing response:", error);
      setLoaderThree(false);
    }
  };`
Accuracy, Recall, Precision, Specificity
Published: 2024-03-23 21:31:50




 **TP** : True Positive = yani doğru tahmin edilen 1 değeri. 1 değerinden kasıt mesela Evli = 1 = positive, bekar = 0 = negative gibi. gerçekte evli, evli tahmin edilmiş.
 **FP** = yanlış tahmin edilen 1 değeri. Gerçekte bekar evli tahmin edilmiş. 
 **FN**: False Negative= yanlış tahmin edilen 0 değeri. Gerçekte Evli bekar tahmin edilmiş.
 **TN** = doğru tahmin edilen 0 değeri. Gerçekte bekar, bekar tahmin edilmiş.


Aslında şu şekil düşün false negative üzerinden örnek verelim. negatifin tersi nedir positive dimi FN de de Negative tahmin edilen değer, false de onu ters çevir demek yani negative in tersi nedir positive dimi FN = positive oluyor aslında. Kısaca 2 li adlandırma ya 2. harf tahmin edilen(P=1, N=0), 1. harf de tahminin doğru mu yanlış mı olduğu. FN o sebepten positive oluyor.(negative'in tersi) False demek tersi demek de diyebilirsin. 🪼

--------------

**Accuracy** = (TP + TN) / (TP + FP + TN + FN)

**Recall** = TP / (TP + FN) =  Yani, "gerçekten pozitif (FN neydi ?)" olan vakaların kaçının doğru olarak tespit edildiğini gösterir. (Evli olanların kaçı doğru tahmin edilmiş.)

**Precision** = TP / (TP + FP) = Yani,  positif tahmin edilenlerin  gerçekten kaçı doğru tahmin edilmiş. (Evli tahmin edilenlerin gerçekten kaçı evli) (FP = negatif ama positifim demiş. Yanlış yapmış yani) 

**Specificity** = TN / (TN + FP) = Yani, gerçekten negatif olan vakaların kaçının doğru olarak tespit edildiğini gösterir.

Recall ve Precision biraz birbirine benziyor biraz ATP harcayarak anlarsınız. Saygılar
Anyone up for a pizza party!!! 🍕
Tags: frontendchallenge, devchallenge, css
Published: 2024-03-23 21:28:30

This is a submission for DEV Challenge v24.03.20, CSS Art: Favorite Snack.

## Inspiration 
What's better than a Pizza on a weekend? 🍕🍕

## Demo
{% codepen https://codepen.io/psevak/pen/ZEZKamW %}

## Journey
So I initially began by writing a code for a simple pizza... 

 {% codepen https://codepen.io/psevak/pen/ExJmbVV %}


But then I thought about `Dave Portnoy - Barstool Pizza Review Show` 

{% instagram C4tjomvA1kq %}


and knew that he would throw this flat pizza of mine right into the trash without even taking a bite.


So I pivoted, I cut my round pizza into (im)perfect slices just as my local pizza store does it using different 
```HTML
<div class="slice slice-1">....</div>
``` 



![Single Pizza Slice](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgycvi5iaqqkyvz45upx.png)


Each `<div>`s will have individual toppings attached to them like 
```HTML
       <div class="sauce"></div>
       <div class="cheese"></div>
       <div class="green-pepper pepper-1"></div>
       <div class="green-pepper pepper-2"></div>
       <div class="green-pepper pepper-3"></div>
       <div class="tomatoes tomatoes-4"></div>
       <div class="tomatoes tomatoes-5"></div>
       <div class="olive olive-1"></div>
       <div class="olive olive-2"></div>
       <div class="olive olive-3"></div>
```

## Challenges & Learning
My greatest challenge and learning from this exercise were: 

## 1. CSS clip-path
```CSS
clip-path: polygon(10% 50%, 20% 45%, 30% 40%, 40% 40%, 50% 40%, 60% 40%, 70% 40%, 80% 40%, 90% 45%, 100% 70%, 90% 65%, 80% 60%, 70% 55%, 60% 55%, 50% 55%, 40% 55%, 30% 55%, 20% 55%, 10% 55%);
```

I Spent hours understanding how the clip-path works and giving the perfect bend to my green peppers for better taste.

## 2. Blur and Cheese pull effect
```HTML
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
    <defs>
        
        <filter id="goo">
            <feGaussianBlur in="SourceGraphic" result="blur" stdDeviation="10" />
            <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 18 -7" result="goo" />
            <feComposite in2="goo" in="SourceGraphic" result="mix" />
        </filter>
    </defs>
</svg>
```
I took the inspiration from [Online Code Pen that I found](https://codepen.io/samritha/pen/ExWqdQx) and took it to Google Gemini to understand what each attribute does.

1. **`feGaussianBlur`**: This filter adds a Gaussian blur effect to the element and we can control the blur radius.

2. **`feColorMatrix `**: This filter manipulates the element's colors. We can adjust the saturation, contrast, and hue to create the _"gooey"_ effect.

3. **`feComposite `**: Allows to composite the two/multiple filters and the attribute defines the first input of the composition. 

**_Thank you for the wonderful exercise._**

## References

A code pen by [Samritha S](https://codepen.io/samritha) [codepen] (https://codepen.io/samritha/pen/ExWqdQx)
Accept-Language header in software localization
Tags: react, javascript, restapi, acceptlanguage
Published: 2024-03-23 21:25:47

Ever wondered how websites know your language preferences without asking. The answer is Accept-Language header.
The Accept-Language header plays a crucial role in software localization by indicating the preferred language(s) of the user's browser or client application. This clever feature was designed to enhance your web browsing experience by making it smoother and more personalized, ensuring content is presented in the language you're most comfortable with whenever possible. 
When a user interacts with a web application or service, their browser automatically includes this header in the HTTP request sent to the server.
Software developers leverage the Accept-Language header to determine the user's preferred language and tailor the content or user interface accordingly. This enables the server to provide responses, such as web pages or API messages, in the language that best suits the user's preferences. For example, if a user's browser sends an Accept-Language header indicating French as the preferred language, the server can serve content in French if available.
Localization frameworks and libraries often utilize the Accept-Language header to seamlessly switch between different language versions of the software based on user preferences. This enhances the user experience by presenting content in a language familiar to the user, increasing accessibility and usability. Accept-Language header is utilized for content localization, language-specific features and for analytics and statistics of users' linguistic preferences.
In summary, the Accept-Language header facilitates software localization by enabling applications to dynamically adjust content and language settings based on user preferences, ultimately enhancing user satisfaction and engagement.
American Wheel & Tire - AWT
Tags: golfcart, awtgolfcarts
Published: 2024-03-23 20:54:20

**American Wheel & Tire - AWT
Address: 11350 Northwest Fwy Suite B-100, Houston, TX 77092
Phone: (713) 255-4802
Email: info@awtgolfcarts.com
Website: https://awtpowersports.com
GMB Profile: https://www.google.com/maps?cid=10362697887766142183**

American Wheel & Tire (AWT) is a leading destination for automotive enthusiasts in Houston, TX. Conveniently situated at 11350 Northwest Fwy Suite B-100, their phone number is (713) 682-1085. AWT specializes in providing top-notch wheels and tires for a variety of vehicles. 

Whether you're looking to upgrade your car, truck, SUV, or off-road vehicle, AWT offers an extensive selection of high-quality products to suit your needs. Their team of experts is dedicated to providing exceptional service, including professional installation and assistance in selecting the perfect wheels and tires for your vehicle. 

With a focus on quality, reliability, and customer satisfaction, AWT strives to exceed expectations and enhance your driving experience. Visit them today to discover why they're a trusted name in the automotive industry.

Working Hours 

MONDAY-FRIDAY 8:30AM – 6PM 
SATURDAY 9AM – 3PM 
SUNDAY CLOSED

Keywords:  Golf Cart Houston TX, AWT Golf Carts
Salvia Online Wholesale
Tags: webdev, javascript, beginners, programming
Published: 2024-03-23 21:17:34

**[Salvia wholesale](https://purplesticky.com/pages/salvia-wholesale)**: Title: Exploring the Benefits of Purple Sticky™ Kratom: A Comprehensive Guide
In the realm of natural remedies, Kratom has garnered significant attention for its myriad of potential benefits. Among the leading brands in the market, Purple Sticky™ stands out as a reliable source for high-quality Kratom products. Whether you're seeking capsules, powders, extracts, liquids, or tinctures, Purple Sticky™ offers a diverse range to suit your preferences and needs.Kratom, derived from the Mitragyna speciosa tree native to Southeast Asia, has been traditionally used for its medicinal properties for centuries. Its active compounds, known as alkaloids, interact with the body's receptors, producing various effects that have captivated users worldwide.
One of the primary reasons individuals turn to Kratom is for its potential in promoting relaxation and mood elevation. Whether you're dealing with stress, anxiety, or simply seeking a sense of calm, Kratom may offer a natural solution. Many users report feeling a sense of euphoria and heightened well-being after consuming Kratom products from Purple Sticky™.
Moreover, Kratom is renowned for its analgesic properties, making it a popular choice for individuals seeking relief from chronic pain conditions. From migraines to joint discomfort, Kratom's pain-relieving effects can provide much-needed comfort without the dependency associated with conventional pain medications.
Beyond its physical benefits, Kratom has also been praised for its potential in facilitating introspection and enhancing the exploration of one's inner state. Users often describe experiencing heightened focus, creativity, and a deeper connection to their emotions and surroundings.
However, it's crucial to note that while Kratom offers promising benefits, it's essential to use it responsibly and be aware of local regulations. Purple Sticky™ emphasizes the importance of customers familiarizing themselves with their area's laws regarding Kratom before making a purchase. Additionally, the brand prioritizes discreet shipping to ensure customers receive their orders promptly and securely.
In conclusion, Purple Sticky™ Kratom offers a diverse range of products that cater to various needs, whether you're seeking relaxation, pain relief, or inner exploration. With its commitment to quality and customer satisfaction, Purple Sticky™ stands as a trusted source for premium Kratom products. Experience the natural wonders of Kratom and unlock its potential with Purple Sticky™ today.
Buy Wholesale Thank you for your interest in ordering wholesale: To order wholesale online: www.PurpleStickySalvia.com If you would like a current wholesale pricelist by 
email: info@purplestickysalvia.com
You can place your order by email or online anytime, but the sales office is open Mon-Fri 9am-3pm PST, call (866) 3077979, text (702) 8862291 Purple Sticky Salvia™ Strongest since 2001. The first, the best, the original. 

**The article built by: Salvia wholesale**
Bootstrap 5: What You Need to Know
Published: 2024-03-20 06:58:00

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

**[Bootstrap 5](https://www.zenesys.com/everything-you-should-know-about-bootstrap-5)**, the latest iteration of the popular open-source web development tool, brings significant changes and improvements. Here's a quick rundown:

**Removal of jQuery:** Bootstrap 5 bids farewell to jQuery, opting for vanilla JavaScript instead. This streamlines the framework, reducing bloat and improving performance.

**Switching to Vanilla JavaScript:** With jQuery out of the picture, developers can now rely on native JavaScript, simplifying code and enhancing compatibility.

**Responsive Font Size:** Bootstrap 5 introduces a responsive font size engine, ensuring typography adapts seamlessly across devices.

**End of Internet Explorer 10 and 11 Support:** IE 10 and 11 are no longer supported in Bootstrap 5, allowing developers to leverage modern JavaScript standards without compatibility concerns.

**Changes in Gutter Width Unit of Measurement:** The gutter width unit shifts from pixels to rems, offering more flexibility in layout design.

**Elimination of Card Decks:** Card decks are replaced with a more flexible grid system in Bootstrap 5, streamlining responsive design.

**Navbar Optimization:** The navbar component is optimized for better performance and simplified markup, with added dark dropdown functionality.

**Customized SVG Icon Library:** Bootstrap 5 introduces a new SVG icon library, providing developers with a wide range of reusable icons.

**Switch From Jekyll to Hugo:** Bootstrap 5 integrates with Hugo, a fast and flexible static site generator, for improved performance and ease of use.

**Class Updates:** Some CSS classes are removed or added in Bootstrap 5, enhancing the framework's simplicity and functionality.

In conclusion, Bootstrap 5 continues to evolve, focusing on lightness, simplicity, and speed to empower developers in creating modern, responsive websites.


**For More Information Read Blog :** E_[VERYTHING YOU SHOULD KNOW ABOUT BOOTSTRAP 5](https://www.zenesys.com/everything-you-should-know-about-bootstrap-5)_
Unpacking useEffect in React: Messing with Component Purity - No Bloat
Tags: javascript, typescript, react, frontend
Published: 2024-03-23 20:48:13

## What's up with useEffect?

Okay, so you know React hooks, right? useEffect is one of them. It's handy for doing stuff in function components that you used to do in class components with lifecycle methods.

## So, what's the deal?

Here's the lowdown: useEffect lets you do things like fetching data or setting up event listeners. Cool, right? But it messes with the idea of component purity. In React, purity means a component should always spit out the same stuff given the same input. But useEffect throws a wrench into that by letting your component mess around with the outside world.

## Why does it matter?

Well, think about it. Your component should be predictable. You should be able to know what it's gonna do just by looking at it. But when you start bringing in useEffect, suddenly your component's behavior isn't just about its props and state anymore. Now it's doing stuff based on what's happening outside, like data coming from an API or user interactions.

## But isn't that useful sometimes?

Yeah, sure. Like, if you need to fetch some data when your component loads, useEffect is your buddy. Same goes for setting up event listeners or integrating with other libraries.

## Wrap it up

So, useEffect is great for getting stuff done in React components. But it messes with the purity of your components, which can make things less predictable. Just be mindful of when you use it, and try to keep your components as clean and predictable as possible. Balance is key, my friend.

[Reference for Functional Purity](https://www.geeksforgeeks.org/functional-programming-pure-and-impure-functions/)

[Reference for Pure Components](https://blog.logrocket.com/what-are-react-pure-functional-components/)
Journey of Token gated group chat in Push?
Published: 2024-03-23 20:41:13

## Token gated group chats were scheduled to launch in November, continuing propagation.

- Native web3 token gated groups chats allow  DAOs, NFT communities to enable group chat access or sending message based on if the wallet has their tokens or NFTs or even custom functions as per the user's preferences.
- This allows communities to be created that for the first time can integrate chat directly on their frontend with just 3-4 lines of code and enables direct, verified interaction with their DAO members
- It also enables communities to come with their own game theories to enable interaction between community and the team / creating rewards program / creating direct interface to allow feedback (ie: 10 tokens to join but 1000 token to send a message will mean only holders that have skin in the game are able to converse) and does other really cool things, all without going out of the frontend.


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

Currently, 3 formats are supported:
1. Creating token gating from frontend
2. Creating token gating from backend
3. UI Component for react

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

## What's new?

Web3 username protocol Unstoppable Domains had launched a new group chat feature,allowing username owners to form group chats that are badge-gated, meaning that only wallet accounts with particular characteristics are allowed to participate in the chat. 

The feature was created using Push Protocol- Opening gated group chats for 3.8m+ users of unstoppable!

Token-gated Groups on UD will enable any UD user to join an existing Group or create their own. There's 400+ Groups already live, including Polygon Labs and blockchain.

 For teams, DAOs, and protocols – leverage token-gated Group Chats to segment and engage with your communities in all-new ways.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/es1jx6bnq7vmpcxcczbs.png)
Re: Why use multiple cloud providers?
Published: 2024-03-23 20:39:14

Different clouds present different trade-offs. For example, very commonly a client will use AWS for most things, but GCP for a simple marketing website, or a machine learning data pipeline.

An early stage company can exist for quite a while with no cloud expenses. By coding the app to a common subset of cloud features, a startup can consume free credits on all the different cloud providers, rotating between them.

Consider not relying on ChatGPT for cloud questions. I found the answers to be not very good. Take with a large grain of salt.

Source: I'm a cloud consultant

[Via Reddit](https://www.reddit.com/r/Terraform/comments/1bll8hu/comment/kw8v8er/?utm_source=reddit&utm_medium=web2x&context=3)
what is selenium ? why do use selenium for automation?
Published: 2024-03-23 19:59:10

Selenium is an open-source automation framework used for automating web applications across different browsers and platforms. It allows you to write test scripts in various programming languages like Java, C#, Python, etc., and execute these tests on multiple browsers12.

The reasons for using Selenium for automation include:

Language and Framework Support: Selenium supports multiple programming languages, allowing you to write scripts in a language you are comfortable with3.
Open Source Availability: As an open-source tool, Selenium is free and its community provides strong support3.
Multi-Browser Support: Selenium scripts can run on all major browsers without the need to rewrite the scripts for each one3.
Ease of Integration: Selenium can be integrated with other tools like Maven, Jenkins, and Docker for continuous testing and with frameworks like TestNG and JUnit for test management and reporting4.
Parallel Testing: Selenium Grid allows for simultaneous execution of tests across different environments, which speeds up the testing process5.
These features make Selenium a versatile and cost-effective choice for automation testing of web applications.