teleren/devto huggingface dataset:
Convert images in Webp
Tags: laravel, php, images, webp
Published: 2023-11-07 11:03:16

---
title: Convert images in Webp
published: true
description: convert webp images with laravel
tags: laravel, php, images, webp
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-11-07 10:56 +0000
---

Allow users to upload an image in JPEG, PNG, JPG, or GIF format, convert it to the WebP format, and save it on your server.

This code performs a series of operations:

* It checks whether the user has uploaded a valid image.
* It generates a unique name for the WebP image based on the current time.
* It converts the uploaded image into an image object.
* If the conversion is successful, the image is converted to the WebP format and saved on the server.
* The name of the WebP file is saved in the database.
* In case of an error, the user receives an error message.

```
try {
    // Validation for the uploaded image
    $request->validate([
        'img_path' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048'
    ]);

    if ($request->hasFile('img_path')) {
        // Get the uploaded image
        $image = $request->file('img_path');

        // Generate a unique name for the WebP file based on the current time
        $imageName = time() . '.webp';

        // Path where the WebP file will be saved
        $webpPath = public_path('storage/images/' . $imageName);

        // Create an image object from binary data
        $imageResource = imagecreatefromstring(file_get_contents($image->path()));

        // Check if the conversion was successful
        if ($imageResource === false) {
            throw new \Exception("Error during image conversion.");
        }

        // Convert and save the image in WebP format
        if (!imagewebp($imageResource, $webpPath, 90)) {
            throw an \Exception("Error during WebP image saving.");
        }

        // Save the WebP file name in the database
        $imgModel = new Image();
        $imgModel->img_path = $imageName;
        $imgModel->save();

        return redirect()->back();
    }
} catch (\Exception $e) {
    // In case of an error, display an error message to the user
    return redirect()->back()->with('error', $e->getMessage());
}

```
Lilac Infotech- Taxi App Development Company
Tags: taxiappdevelopment, taxiappdevelopers, appdevelopmentcompany
Published: 2023-11-07 10:54:52

At **Lilac Infotech**, we're not your typical [Taxi App Development Company](https://lilacinfotech.com/what-we-do/taxi-on-demand-app-development-india). We're your dedicated technology collaborator, fully devoted to propelling your transportation business to new pinnacles of success. Fueled by a relentless passion for innovation and an unwavering commitment to excellence, we stand as the ultimate choice for all your taxi app development requirements. When you select us as your taxi app development partner, you're not just a client; you're an integral part of our journey to transform your visionary concepts into a digital reality. Reach out to us today, and together, we'll embark on an exhilarating voyage to reshape your taxi app ideas into a remarkable and flourishing digital reality!

Visit the Website:https://lilacinfotech.com/what-we-do/taxi-on-demand-app-development-india
🐳👑Bắn Cá SM66 – Game Bắn Cá Đổi Thưởng Hấp Dẫn👑
Tags: sm66, sm66nhacai, sm66vip, sm66banca
Published: 2023-11-07 10:41:39

🐳[👑Bắn Cá SM66 – Game Bắn Cá Đổi Thưởng Hấp Dẫn👑](https://sm66vip.space/)

🔥Bắn cá săn thưởng🔥: Săn cá, Nhận quả không tưởng tại Sm66!
🐳 Hòa mình vào thế giới đầy màu sắc và kỳ thú của game Bắn Cá Săn Thưởng tại #Sm66 và trải nghiệm cuộc phiêu lưu đầy hứng khởi.🐠
🐳Với những vũ khí mạnh mẽ, bạn sẽ đưa vào tầm ngắm những chú cá đầy giá trị để săn bắt và nhận được những phần quà không tưởng.💥🎁🎁🎁
🐳 Với đồ họa tuyệt đẹp, âm thanh sống động và các loại súng đủ loại hấp dẫn, Bắn Cá Săn Thưởng tại #Sm66 sẽ mang đến cho bạn những giờ phút giải trí thú vị và không thể nào quên.💥
🐳Tham gia ngay bắn cá bắn ra tiền ngay để tận hưởng nhiều ưu đãi nào🐠
🌐wed:: [https://sm66vip.space/](https://sm66vip.space/)
🌐Fanpage: [https://www.facebook.com/sm66vip1/](https://www.facebook.com/sm66vip1/)
🌟Link đăng ký: [https://tinyurl.com/sm66khuyenmaism66100k](https://tinyurl.com/sm66khuyenmaism66100k)
📧Email: sm66vips@gmail.com
📲 sdt: (+63)562 169 734
📌Địa chỉ: 1 Ng. 670 Đ. Nguyễn Khoái, Thanh Trì, Hoàng Mai, Hà Nội, Việt Nam
#sm66 #sm66nhacai #sm66vip #sm66banca
Brewer Jobs: Crafting the Perfect Pint
Tags: job, newse
Published: 2023-11-07 10:34:29

Are you passionate about crafting the perfect pint? Do you have a deep appreciation for the art of brewing? If so, then a career as a brewer might be the perfect fit for you. [Brewer jobs](https://beerwork.com/blog/brewer-jobs-crafting-the-perfect-pint) offer the opportunity to work in a dynamic and ever-growing industry, where you can turn your passion for beer into a rewarding profession.
CFA Level 3 Exam Success Starts with Practice Questions
Tags: exams, books
Published: 2023-11-07 10:26:23

**Application of Knowledge:**

CFA Level 3 is all about applying your knowledge in practical situations. Practice questions help you bridge the gap between theoretical understanding and  <a href="https://shorturl.at/bgrAB">CFA Level 3 Practice Questions</a> real-world application. They force you to think critically and make informed decisions in complex financial scenarios.

**Exam Simulation:** 

By working on practice questions, you simulate the actual exam experience. This helps you get accustomed to the exam format, timing, and pressure. Familiarity with the exam structure can significantly boost your confidence on the big day.

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

**Identification of Weak Areas:**

Practice questions reveal your strengths and weaknesses. They pinpoint the areas where you <a href="https://shorturl.at/bgrAB">CFA Practice Question</a> need more study and provide an opportunity to refine your study strategy accordingly.

**Retention of Knowledge:**

 Repetition is one of the most effective learning techniques. The more you practice, the better you remember the material. This is vital for retaining key concepts in your long-term memory.

Click Here More Info>> https://examtopicsfree.com/other-exams/cfa-level-3-practice-questions/
Orillia Handyman Services: Quick Home Fixes for Everyday Needs
Tags: handyman, plumber, snowremoval
Published: 2023-11-07 10:18:24


Every homeowner knows that maintenance and quick fixes are an integral part of keeping a home in top shape. Whether it's a leaky faucet, a squeaky door, or a small repair job, having a reliable **[Handyman Services in Orillia](https://urbantasker.com/handyman/orillia)** can make all the difference. Our handyman services in Orillia are your go-to solution for swift and efficient home fixes, ensuring your home remains comfortable, functional, and visually appealing.

Why Choose Our Handyman Services in Orillia?

Prompt and Reliable Service:
We understand the importance of timely repairs. Our handyman services in Orillia are known for their punctuality and reliability. When you need a quick fix, you can count on us to be there promptly, ready to address your concerns.

Wide Range of Services:
From plumbing and electrical repairs to carpentry and painting, our handymen are skilled in various trades. No task is too small or too complex for our experienced team. We offer a comprehensive range of services to meet all your home repair needs.

Quality Workmanship:
Quality is our hallmark. Our skilled handymen take pride in their workmanship, ensuring that every repair is completed to the highest standards. We use quality materials and proven techniques to deliver lasting results.

Customized Solutions:
We understand that every home is unique. Our handyman services are tailored to your specific requirements. Whether it's a minor repair or a more extensive project, we provide customized solutions that align with your needs and budget.

Examples of Quick Home Fixes We Handle:

Plumbing Repairs:
From fixing leaks and clogs to repairing faucets and pipes, our plumbers are experts in handling a wide range of plumbing issues, ensuring your water systems function seamlessly.

Electrical Repairs:
Our electricians can quickly diagnose and repair electrical problems, ensuring your home is safe and all electrical systems are functioning correctly.

Carpentry and Furniture Repairs:
Whether it's a broken cabinet, a loose handle, or a damaged piece of furniture, our carpenters can restore items to their original condition, saving you the cost of replacements.

Painting and Touch-ups:
Enhance the aesthetic appeal of your home with fresh paint or touch-ups. Our painters can efficiently cover scuffs, marks, and imperfections, giving your home a polished look.

Conclusion:

When it comes to quick home fixes in Orillia, our handyman services are your reliable partners. We take the hassle out of home repairs, providing fast and efficient solutions that enhance the functionality and beauty of your home. Don't let small issues turn into significant problems. Contact us today for prompt and professional handyman services tailored to your needs. Experience the convenience of having a trustworthy handyman at your service for all your home repair needs. Your home deserves the best care, and we are here to provide it!
Navigating the New Era of Learning: Top Generative AI Books for Programmers
Tags: ai, books, resources
Published: 2023-11-07 10:14:20


_by Manning Publications_

With massive changes happening due to generative AI tools like ChatGPT and GitHub Copilot, you won't be surprised that there's a swarm of new books that use generative AI to teach programming to beginners or to enhance what programmers can do.

In this article, we wanted to cover our top four generative AI books that are being published by Manning Publications.
We know, we know: you just want to use generative AI to supercharge your programming productivity. We want that, too! But we're at the dawn of a programming revolution here, and we strongly encourage you to take the time to understand the ethical and legal concerns wrought by generative AI.

What happens when generative AI models ingest objectionable speech or personal data? Why are these models apt to produce hallucinations, and why should we care? Why is it so difficult to address bias in machine learning? What is the critical role that human feedback plays in LLM training, and what are the associated costs to humans? Does generative AI's use of copyrighted work fall under fair use?

As informed end-users of generative AI, it's up to us to answer these questions–to understand what data we might be using, how that data was produced, and the societal and ethical impacts of these tools. This book helps us toward those answers.

We apprec[](url)iate that many claims in the book are supported with references that the reader can check for additional details. We also benefited from numerous powerful examples throughout the book, such as racial bias in movie sentiment scores, a ChatGPT data breach, and a famous virtual influencer.
We'd also like to emphasize that while the focus of the book is on the responsible use of generative AI, there is also a non-mathematical overview coverage of how generative AI tools work, which we suspect will be of interest to many readers. 

For example, you'll learn more about many concepts you've probably heard about in passing, such as foundation models, fine-tuning, emergent properties of LLMs, zero-shot and few-shot learning, and chain-of-thought prompting.
Finally, we applaud the balanced discussion of the pros and cons of synthetic media, the ways that LLMs are and will be misused, the ways that professionals are using LLMs and–of course!–the coverage of the impacts on education.

[Read the complete guide and get a 35% universal discount from Manning Publications.](https://www.developernation.net/blog/navigating-the-new-era-of-learning-top-generative-ai-books-for-programmers)
OpenAi’s new Consistency VAE is not good so far — tested by AUTOMATIC1111 himself
Tags: vae, openai, ai, stablediffusion
Published: 2023-11-07 10:14:13

Check right top of the picture to see ORG vs NEW. NEW is by OpenAI

1st org VAE
2nd OpenAI VAE
3rd org VAE
4th OpenAI VAE

OpenAI VAE VRAM requirement and durations are 3 times more


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


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


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



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

source : https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/13885
How to get a tax refund in Pakistan
Published: 2023-11-07 10:09:39

**

## Tax calculator

**
A tax calculator can help you to calculate your taxable income and estimate the amount of tax refund you are eligible for. There are a number of tax calculators available online, including the FBR's own tax calculator.

**To use a [tax calculator](taxcal.pk), you will need to enter the following information:**

Your income from all sources.
Any deductions or exemptions you are eligible for.
Your tax rates.
The [tax calculator](taxcal.pk) will then calculate your taxable income and estimate the amount of tax refund you are eligible for.

It is important to note that a tax calculator is only an estimate. The actual amount of your tax refund may vary depending on your individual circumstances.
Let's Explore GoFr
Tags: go, opensource, backenddevelopment
Published: 2023-11-07 10:01:32

Hey Guys!
Hope you all are doing great.I am happy to share will you all our newly opensourced Golang framework GoFr (https://gofr.dev/)

🚀 Introducing **GoFr** - An Opinionated Go Framework For accelerated microservice development! 🔥

🔗 Get started with **GoFr** now: https://github.com/gofr-dev/gofrJoin our Go community and supercharge your Go projects with GoFr! 🚀

I would request you all to please use/explore our new framework and support the new forming GoFr community.🙏🏻

Consider giving it a 🌟 if you like the framework.🙂
Director Extraordinaire Pharis Aboobacker's Business Empire
Tags: news
Published: 2023-11-07 09:50:45

**Introduction:**

In the bustling landscape of Kerala, where tradition meets innovation, one name has been echoing through the corridors of success – Pharis Aboobacker. He stands as a living testament to the power of determination and persistence, proving that actions indeed speak louder than words. Behind the title of a millionaire businessman lies a story of resilience, hard work, and unyielding dedication, transforming an average childhood into an extraordinary future.

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

**The Phoenix Emerges:**

Pharis Aboobacker's journey begins in the tiny settlement of Nandi, nestled in the Kozhikode district near Koyilandy. From a local Poykayil school to the prestigious Farooq College in Kozhikode, Pharis exhibited an unmatched zeal and instinctual drive that hinted at his future fame. His passion became the fuel that propelled him forward, turning challenges into opportunities and dreams into achievements.

**Directorship in Companies:**

Pharis Aboobacker's influence extends far beyond his personal success. He serves as a director for 32 esteemed organizations, each appointment marking a milestone in his illustrious career. From his tenure with Parrot Grove Private Limited Company to his recent role at Chikmangaloor Real Estates Private Limited, Pharis has woven a web of influence in businesses like Petropas Automotive Private Limited, Rusoh Elegant Real Estate Private Limited, and Kadavanthara Properties Private Limited, among others.

**Conclusion: A Legacy in the Making**

Pharis Aboobacker's story is more than a tale of triumph; it's a testament to the potential within us all. His journey, marked by unwavering dedication and an unyielding spirit, serves as a beacon of inspiration for aspiring entrepreneurs and dreamers. As he continues to leave his mark on Kerala's business landscape, Pharis Aboobacker stands as a reminder that with passion, persistence, and hard work, any ordinary individual can carve an extraordinary path to success. Join us in celebrating a life dedicated to turning dreams into reality and ordinary moments into extraordinary achievements.
DevOps learning
Published: 2023-11-07 09:47:49

## Azure Cloud
- [Udemy - AZ-104 Microsoft Azure Administrator Exam Prep - OCT 2023](https://www.udemy.com/course/70533-azure/)
- [Udemy - Microsoft Azure: From Zero to Hero - The Complete Guide](https://www.udemy.com/course/microsoft-azure-from-zero-to-hero-the-complete-guide/)

---
## Shell scripting
- [Udemy - Linux Shell Scripting: A Project-Based Approach to Learning](https://www.udemy.com/course/linux-shell-scripting-projects/)
- [Udemy - Bash Mastery: The Complete Guide to Bash Shell Scripting](https://www.udemy.com/course/bash-mastery/)
- [A Cloud Guru - The System Administrator’s Guide to Bash Scripting - NEW 2020](https://learn.acloud.guru/course/admin-guide-to-bash-scripting/overview)

---
## Azure DevOps
- [A Cloud Guru - Introduction to Azure DevOps](https://learn.acloud.guru/course/introduction-to-azure-devops/dashboard)
- [Udemy - CI/CD Pipelines using Azure DevOps](https://www.udemy.com/course/cicd-pipelines-using-azure-devops/)
- [Udemy - Azure Devops Crash Course -Build CI/CD release pipelines](https://www.udemy.com/course/azure-devops-fundamental/)

---
## Docker
- [Udemy - Docker for the Absolute Beginner - Hands On - DevOps](https://www.udemy.com/course/learn-docker/)
- [Udemy - Docker & Kubernetes: The Practical Guide [2023 Edition]](Docker & Kubernetes: The Practical Guide [2023 Edition]) - read until Kubernetes section

---
## Kubernetes
- [Udemy - Kubernetes Certified Application Developer (CKAD) with Tests](https://www.udemy.com/course/certified-kubernetes-application-developer/)

---
## Terraform
- [Udemy - Terraform on Azure](https://www.udemy.com/course/terraform-on-azure-services/)
- [Udemy - HashiCorp Certified: Terraform Associate 2023](https://www.udemy.com/course/terraform-beginner-to-advanced/)

---
## Python
- [Udemy - 100 Days of Code: The Complete Python Pro Bootcamp for 2023](https://www.udemy.com/course/100-days-of-code/)
Updating Map in Python
Published: 2023-11-07 09:38:09

when the element of the dictionary is updated, the result is instantly updated in the result of the  ChainMap, Enter the below code and try to execute it to see how updating Maps is done.

```
import collections

dict1 = {"player1":'cole palmer',"player2":'Raheem Sterling',"player3":'Reece james'}
dict2  = {"player4":'Levi Colwil',"player5":'Moises Caicedo',"player6":'Conor Callagher'}

res  = collections.ChainMap(dict1,dict2)
print(res.maps, '\n')


dict2['player4'] = 'Noni Madueke'
print(res.maps, '\n')
```

output 
When the above code is executed, it produces the following result .

```
[{'player1': 'cole palmer', 'player2': 'Raheem Sterling', 'player3': 'Reece james'}, {'player4': 'Levi Colwil', 'player5': 'Moises Caicedo', 'player6': 'Conor Callagher'}] 

[{'player1': 'cole palmer', 'player2': 'Raheem Sterling', 'player3': 'Reece james'}, {'player4': 'Noni Madueke', 'player5': 'Moises Caicedo', 'player6': 'Conor Callagher'}]
```
Hi, New to writing
Published: 2023-11-07 09:36:36

```
def test_response(args)
    print args[:happy_reacts] 
end
```

I hope to write at least once a week on dev.to . It's a request to the dev.to community to support me and others like me to write more.

Now going ahead I just want to add a small code snippet to rotate the array in rust.

it was pratice problem in [hackerearth](https://www.youtube.com/watch?v=mX38pWM--0M&list=PL1YS4hYJip07A-YteNUR8qTeA_wHQarDX&index=42)

I'll just explain here what i wrote in Rust(new to rust so your feedback is valuable in comments).

The video has better explanation. 

The first step was to get the number of test cases.

```
let mut input = String::new();
    io::stdin().read_line(&mut input).expect("Failed to read input");
    let t: usize = input.trim().parse().expect("Invalid input");
```

then loop form 0 to t
```
for _ in 0..t {
}
```

inside the loop add another input to get the length of array and the times that rotation has to performed.

```
 let mut input_n_k = String::new();
        io::stdin().read_line(&mut input_n_k).expect("Failed to read input");
        let mut nk = input_n_k.trim().split_whitespace();
        let n: usize = nk.next().unwrap().parse().expect("Invalid input");
        let k: usize = nk.next().unwrap().parse().expect("Invalid input");
```

following that another input stream to get the array and store in a Vector of i32 type. (i32 was within limits of the test cases)

```
let mut input_arr = String::new();
        io::stdin().read_line(&mut input_arr).expect("Failed to read input");
        let mut elements: Vec<i32> = input_arr.trim().split_whitespace()
            .map(|x| x.parse().expect("Invalid input"))
            .collect();
```

now before performing the array rotation it is good practice sanitise the rotation times and the length of the array

```
 let k = k % n; // Handle cases where k is larger than n
```

now create a new array to store the results

```
let mut result: Vec<i32> = Vec::with_capacity(n);
```

the actual rotation operation
```
for i in 0..n {
            let new_index = (n + i - k) % n;
            result.push(elements[new_index]);
        }
```
the magic of rotation happens when the new_index is created.
e.g., if n =5 and k =2 
in this rotation loop 
new_index = (5+0-2)%5 = 3
new_index = (5+1-2)%5 = 4
new_index = (5+2-2)%5 = 0
new_index = (5+3-2)%5 = 1
new_index = (5+5-2)%5 = 3

the new_index variable denotes the current index and when to push in the result array.

finally print the result and a new line to continue
```
      for i in 0..n {
            print!("{} ", result[i]);
        }
        println!();
```

This was simple array manipulation question solved using Rust.

The concepts of Rust used here are mutables,loops and Vectors.
Unlock Success with Lilac Infotech's Leading Grocery App Development Services
Tags: groceryappdevelopmentcompany, groceryappdevelopers
Published: 2023-11-07 09:33:43


**Lilac Infotech **excels in crafting exceptional global grocery apps. Our standout feature is our well-established reputation as the preferred choice for [grocery delivery app development](https://lilacinfotech.com/what-we-do/grocery-delivery-on-demand-app-development-india), underpinned by our profound industry knowledge and unwavering commitment to our clients' success.

Ready to launch your successful grocery delivery app? Look no further. Explore our website for a full understanding of our services.
Visit the Website:[https://lilacinfotech.com/what-we-do/grocery-delivery-on-demand-app-development-india](https://lilacinfotech.com/what-we-do/grocery-delivery-on-demand-app-development-india)
Map Reordering in Python
Published: 2023-11-07 09:24:42

if we change the order  of dictionaries  while clubbing them in below  example we see  the positionof elements  get interchanged as if they  are in continuos chain.
Enter the following code and try to excute it you see the outcome.

```
import collections

dict1 = {"player1":'cole palmer',"player2":'Raheem Sterling',"player3":'Reece james'}
dict2  = {"player4":'Levi Colwil',"player5":'Moises Caicedo',"player6":'Conor Callagher'}



res1  =  collections.ChainMap(dict1, dict2)
print(res1.maps,'\n')


res2  = collections.ChainMap(dict2, dict1)
print(res2.maps, '\n')

```
When the above code is executed, it produces the following result.

```

[{'player1': 'cole palmer', 'player2': 'Raheem Sterling', 'player3': 'Reece james'}, {'player4': 'Levi Colwil', 'player5': 'Moises Caicedo', 'player6': 'Conor Callagher'}] 

[{'player4': 'Levi Colwil', 'player5': 'Moises Caicedo', 'player6': 'Conor Callagher'}, {'player1': 'cole palmer', 'player2': 'Raheem Sterling', 'player3': 'Reece james'}]

```