teleren/devto huggingface dataset:
What was your win this week?
Tags: discuss, weeklyretro
Published: 2024-04-05 11:35:00

Howdy! 🤠

With the first week of April under our belts, y'all got any wins to share?! 😎

Looking back on this past week, what was something you were proud of accomplishing?

All wins count — big or small 🎉 

Examples of 'wins' include: 
- Starting a new project
- Fixing a tricky bug
- Enjoying the nice weather 🌤

---

![A sunshine with a creepy face of Nicolas Cage rises up over a valley of peas.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jxb6cslgu16yri2tm2s.gif)

---

**_Did you know we feature wins in our "Wins of the Week" email every Friday? [Subscribe to our weekly newsletter emails](https://dev.to/settings/notifications) to get wins delivered right to your inbox!_** 💌
Laravel Sanctum Authentication for Mixed Access Routes - Optional Authentication
Tags: laravel
Published: 2024-04-05 11:11:59

Let's unravel a common misconception about Laravel Sanctum and how it handles authentication, particularly around the idea that routes must be explicitly wrapped in `auth:sanctum` to utilize Sanctum's authentication capabilities.

One of Sanctum's features is the ability to handle routes that are optionally authenticated. This means that the same route can serve both authenticated and unauthenticated requests, adapting its behavior based on the presence of a valid authentication token. Surprisingly, this doesn't require the explicit use of `auth:sanctum` middleware on each route.

### Understanding the Magic Behind Sanctum
The magic lies in the `EnsureFrontendRequestsAreStateful` middleware. When included in the `api` middleware group (as is typical in a standard Laravel application), it checks incoming API requests for authentication tokens. If a token is present, Sanctum attempts to authenticate the user, making the user instance available through $request->user(). If the token is missing or invalid, the request proceeds without authentication.

### Key Takeaways
Routes don't need auth:sanctum to be authenticated: Simply being processed through the api middleware group allows Sanctum to attempt authentication.
Flexibility for route access: This setup enables routes to be designed for mixed access, serving both users who are authenticated and those who are not, without needing separate routes or explicit middleware assignments.
How to Implement Mixed Access Routes
To leverage this feature in your Laravel application, follow these guidelines:

- Ensure the Sanctum Middleware is Set Up: Check your app/Http/Kernel.php file to make sure the EnsureFrontendRequestsAreStateful middleware is included in your api middleware group.

- Design Your Routes for Optional Authentication: When defining your API routes in routes/api.php, simply create them outside any auth:sanctum middleware group. Laravel's automatic application of the `api` middleware group takes care of the rest.

Handle Authenticated and Unauthenticated Requests: In your controller methods, use `$request->user()` to check for an authenticated user. Your method can then adjust its behavior based on whether a user is authenticated.

An Example to Illustrate
```php
Route::get('/profile', function (Request $request) {
    if ($user = $request->user()) {
        return response()->json(['message' => 'Authenticated access', 'user' => $user]);
    }
    return response()->json(['message' => 'Unauthenticated access']);
});
```
This route serves both authenticated and unauthenticated requests, adjusting the response based on the authentication status of the request, all without explicitly requiring Sanctum's auth:sanctum middleware.
The Future of Anti-Anxiety Medicine: Trends and Forecasts
Published: 2024-04-05 11:04:17

In today's fast-paced world, the demand for effective anti-anxiety medicine is on the rise. As anxiety-related disorders continue to affect millions worldwide, the pharmaceutical industry is witnessing a surge in research and development aimed at addressing this pressing need. From innovative formulations to personalized treatment approaches, the future of anti-anxiety medicine is poised for transformative growth.
**1.Advanced Formulations:** **[Anti-anxiety medicine manufacturers](https://taksapharma.co.in/blogs/anti-anxiety-medicine-manufacturer/)** are investing in advanced formulations that offer improved efficacy and reduced side effects.
**2.Personalized Treatment:** The future of anti-anxiety medicine lies in personalized treatment approaches tailored to individual patient needs and genetic profiles.
**3.Digital Therapeutics:** The integration of digital therapeutics, such as mobile apps and virtual reality, holds promise for enhancing the effectiveness of anti-anxiety treatments.
**4.Natural Remedies:** There is a growing trend towards the use of natural remedies and herbal supplements as adjuncts to traditional anti-anxiety medication.
**5.Targeted Drug Delivery:** Innovations in targeted drug delivery systems aim to enhance the precision and efficiency of anti-anxiety medication delivery, minimizing systemic side effects.
**6.Combination Therapies:** Combination therapies that target multiple pathways implicated in anxiety disorders are emerging as a promising approach to improving treatment outcomes.
**7.Telemedicine:** The expansion of telemedicine services enables patients to access mental health care and receive prescriptions for anti-anxiety medication remotely, increasing accessibility and convenience.
**8.Genetic Testing:** Genetic testing for identifying biomarkers associated with anxiety disorders is paving the way for personalized anti-anxiety treatment strategies.
**9.Psychedelic Therapy:** Psychedelic-assisted therapy, utilizing substances like MDMA and psilocybin, is being explored as a novel approach to treating severe anxiety disorders.
**10.Neurofeedback and Brain Stimulation:** Techniques such as neurofeedback and transcranial magnetic stimulation show promise in modulating brain activity and alleviating anxiety symptoms.
As the pharmaceutical industry continues to innovate and adapt to evolving patient needs, the future of anti-anxiety medicine holds tremendous potential for improving the lives of millions grappling with anxiety-related disorders. Through a combination of cutting-edge research, technological advancements, and a holistic approach to mental health care, the journey towards a brighter future for anxiety treatment is well underway.
My life into coding #1 the first course - 42 School
Tags: beginners, 42, learning
Published: 2024-04-05 10:51:59

I'm starting a series of articles in which I want to write about my coding journey and the different approaches and experiences I'm having during this life journey of studying coding.

It's a way of keeping a diary of my studies and sharing my progress.

My first experience started with 42 School's Piscine project - a free international coding school. They have schools in various places and I signed up for their program because it was the cheapest (free) option I had at the time. I definitely didn't have the money to spend on a bootcamp. 

The admission program - also called Piscine - is an intensive one-month course, every day, to see if you are able to adapt to their learning method. There are no teachers, no classes, just other students to help you and the famous internet.

I didn't pass the 2-year intensive program, but I had already thought, before finishing Piscine, about not continuing with it for a few reasons.
  - the entire course is only in the C language;
  - I'm a queer person and there were a lot of straight people with a macho mentality around. I was in Berlin at the time, so I expected things to be a bit different;
  - I asked if anyone already had a job as a programmer and even the people with almost a year of course still weren't working in the field;
  - Most of the people studying there were struggling to follow the program. The only ones who were a bit more chill were people who had the privilege of not having to worry about money or were receiving some kind of government benefit. Those who had to work full-time or part-time were struggling.
  - I like having classes and at least having a base material to follow. Otherwise, why would I be at school and not at home studying whatever I wanted?
  - WTF I can do only with C language?
In any case, I would recommend Piscine to anyone interested in having a first experience with programming. There will be intense days with lots of programming and without spending any money for it. It really helps to break the ice and start programming. At least that's how it was for me. C is terrible, but taking a look at it before anything else is a good start - but not for 2 years.
Vedu APK
Published: 2024-04-05 10:46:00

[Vedu APK](https://veduapps.in/) is a cool app that helps people learn stuff easily. It covers lots of subjects like maths and reading. The app has fun stuff like quizzes and videos to make learning more interesting. You can use it whenever you want, and it's super handy for studying on the go. Vedu APK is like having a smart teacher in your pocket, making learning fun and accessible for everyone.
How big is my upgrade?
Tags: apt, dpkg, bc
Published: 2024-04-05 10:37:55

Say I want to upgrade my Ubuntu box but I want to find out how big the upgrade operation will be.

First, we have to find out all the packages to be installed. The `-s` option means it's simulation (ie. nothing will be installed).

```
$ apt-get -s upgrade | grep -i ^inst | awk '{print $2}' | tr '\n' ' '
base-files libnss-systemd ... xwayland mutter
```

The package names are separated by a space.

Now I want to query the installed-size using dpkg-query:

```
$ dpkg-query -s $(apt-get -s upgrade | grep -i ^inst | awk '{print $2}' | tr '\n' ' ') | grep -i "installed-size"
Installed-Size: 392
...

```
Then, just get the numbers (eg. 392) and add them all up.

```
$ dpkg-query -s $(apt-get -s upgrade | grep -i ^inst | awk '{print $2}' | tr '\n' ' ') | grep -i "installed-size" | awk '{print $2}' | awk '{total+=$1} END {print total}'
2649388
```
What we've got is total space that will be occupied by apt-get's upgrade operation is 2649388 KB.

Now we've done the hard part. Phew! What's left is to convert 2649388 KB to GB for our convenience.

```
$ total=$(dpkg-query -s $(apt-get -s upgrade | grep -i ^inst | awk '{print $2}' | tr '\n' ' ') | grep -i "installed-size" | awk '{print $2}' | awk '{total+=$1} END {print total}'); bc <<< "scale=5; $total / 1024 / 1024"
2.52665
```
To finish, just append GB at the end.

```
$ total=$(dpkg-query -s $(apt-get -s upgrade | grep -i ^inst | awk '{print $2}' | tr '\n' ' ') | grep -i "installed-size" | awk '{print $2}' | awk '{total+=$1} END {print total}'); bc <<< "scale=5; $total / 1024 / 1024" | sed 's/$/GB/'
2.52665GB
```
So, I know that if I decide to upgrade my Ubuntu box, it will take up at least 2.5 GB of space!
Mastering AngularJS: A Comprehensive Guide to Web Development
Published: 2024-04-05 10:36:42


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

Introduction
In the ever-evolving landscape of web development, AngularJS has emerged as a powerful framework that streamlines the process of building dynamic web applications. Whether you are a seasoned developer or a newcomer to the world of programming, mastering AngularJS can open up a world of possibilities for creating robust and interactive web solutions.

Chapter 1: Understanding the Basics of AngularJS
AngularJS is a JavaScript framework developed by Google for building single-page web applications. It utilizes the Model-View-Controller (MVC) architecture to separate the concerns of an application, making it easier to manage and maintain code. In this chapter, we will delve into the core concepts of AngularJS, including data binding, directives, and modules.

Chapter 2: Building Your First AngularJS Application
Now that you have a solid understanding of the basics, it's time to roll up your sleeves and start building your first [AngularJS application](https://www.bitcot.com/angularjs-development-company/). We will walk through the process of setting up your development environment, creating components, and connecting them to build a functional web application from scratch.

Chapter 3: Enhancing User Experience with AngularJS Directives
AngularJS directives are a powerful feature that allows you to extend HTML with custom attributes and create reusable components for your application. In this chapter, we will explore the different types of directives available in AngularJS and learn how to leverage them to enhance the user experience and functionality of your web application.

Chapter 4: Working with Services and Dependency Injection
Services are essential building blocks in AngularJS that facilitate code reusability and maintainability. By understanding how services and dependency injection work in AngularJS, you can create modular and scalable applications. In this chapter, we will dive into the world of services and learn how to use them effectively in your projects.

Chapter 5: Routing and Navigation in AngularJS
Navigation is a crucial aspect of any web application, and AngularJS provides powerful routing capabilities to manage different views and states within your application. We will explore how to set up routing in AngularJS, create multiple views, and enable seamless navigation between different sections of your web application.

Conclusion:
Mastering AngularJS opens doors to creating dynamic web applications with ease. From understanding core concepts to building functional applications, harnessing AngularJS empowers developers to enhance user experience and streamline development processes. Dive into AngularJS and unlock endless possibilities for web development innovation.
Nainileaf: Explore and Buy Nursery Live Plants for Lush Living Spaces!
Published: 2024-04-05 10:30:41

Elevate your surroundings with Nainileaf's exquisite collection - [Buy nursery live plants](https://nainileaf.com/) to bring nature's vibrance into your home. Our carefully curated selection offers premium, thriving greenery to transform any space. Experience the joy of nurturing life with ease. Nainileaf's commitment to quality ensures your living spaces flourish. Dive into our collection, redefine your decor, and indulge in the beauty of live plants. Enhance your surroundings, shop with Nainileaf today!
"Day 57 of My Learning Journey: Setting Sail into Data Excellence! Today's Focus: Maths for Data Analysis (Probability - 3)
Published: 2024-04-05 10:25:24

🌟 Important Announcement 🌟

Hey everyone,

I hope you're all doing well. I wanted to quickly update you about my absence from sharing learning content recently. Unfortunately, I've been under the weather with a fever, which has made it challenging for me to keep up with posting.

I want to assure you that I'm on the road to recovery, and I'm eager to get back to sharing insightful content with you all. Starting from upcoming Monday, April 8, 2024, I'll be back on track and ready to dive back into our learning journey together.

Thanks for your understanding and patience during this time. Looking forward to reconnecting with you all soon!

Best regards,
Nitin Bhatt.


PROBABILITY - 3






RANDOM VARIABLES ( X ):- 

A variable which denotes all the outcomes of a random experiment is known as a random variable.

A DICE is rolled once.

Outcome :- 1,2,3,4,5,6
Or 
Outcome :- its outcome is one variable which can have different 6 values.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yrpf8hif0hhdn25gozuo.png)
SUMMATION OF P(X) = 1
Expectation :- 

Domain knowledge is also needed with the probability to predict.

Because we can only predict if it will happen or not,it is not confirmed. To increase the probability we need expectation.
Average of all the outcomes is expectation. 



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



MEAN OR E ( X ) = SUMMATION OF  X *P(X)

It means mostly we will get 3 or 4 as an output.

Variance of Random Variable :- 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7rqpqkax4sw8w3eo0itv.png)
It tells how the data points differ from the mean values..


 🙏 Thank you all for your time and support! 🙏
Week Recap: A Hacker Attack on OpenLeverage, WhiteBIT on Paris Blockchain Week Summit, And More 🌐🔒
Tags: crypto, cryptocurrency
Published: 2024-04-05 10:24:19


🕵️‍♂️ OpenLeverage Hacked: OpenLeverage, a decentralized margin trading platform, fell victim to hackers who stole $230,000 worth of assets. Cyvers Alerts detected the attack on April 1, revealing losses of approximately $230,000 in cryptocurrency. The attacker used Tornado Cash for laundering. PeckShield estimated the total loss at $236,000. OpenLeverage suspended operations and promised to cover the losses using insurance and buyback funds. They're urging the hacker to return the funds.

🤖 Elon Musk's April Fools’ Prank: Elon Musk, known for his controversial tweets, stirred the crypto community on April 1 with a joke about joining Disney as Chief DEI Officer. He teased changes to Disney content and mocked sequels. This sparked memes and responses from the community, with many trolling Disney and Netflix over social policy.

🌐 WhiteBIT Partnerships: WhiteBIT announced its participation in major blockchain events: Paris Blockchain Week Summit (April 9-11) and TOKEN2049 Dubai (April 18-19). The exchange will showcase products and network with thousands of participants to explore collaborations and innovations in the crypto industry.

📡 New Blockchain Protocol: Anatoly Yakovenko, Solana Labs co-founder, introduced BunkerCoin—a protocol for efficient data transmission in low-bandwidth areas using shortwave radio. The protocol optimizes blockchain for remote and inaccessible regions, ensuring secure data transmission and network resilience.

🤖 Solareum Shutdown: Solareum, a Telegram trading bot on the Solana blockchain, shut down permanently due to security breaches and financial constraints. The closure followed a recent hack that compromised user funds. The team cited insufficient funds and evolving market trends for their decision.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ia7a3rv4opk8bsor3xzg.png)
Python Automatically Numbers Rows in Excel
Tags: webdev, programming, python, devops
Published: 2024-04-05 10:21:07

When we are working with Excel, numbering the rows is an issue as manually adding row numbers to a large dataset is time-consuming and prone to errors. Row numbers are necessary as helps in easy identification and referencing different rows of data. What if i say i can make this take super easy for you?

Python offers a convenient way to automate this task, making it easier to manage your Excel data.

Using Python, you can read an Excel file, add a new column for row numbers, and then save the updated data back to the Excel file. This automation can save you time and effort, especially when dealing with large datasets.

To add row number automatically to an existing excel sheet. First create a file in your editor and save it with .py extension with the below code in it

Original Excel Sheet:


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

[Read More
](https://codemagnet.in/2024/04/05/python-automatically-numbers-rows-in-excel/)
What advice would you give to your mentee? 🧙🏻‍♂️
Tags: discuss, career, learning, beginners
Published: 2024-04-05 10:20:22

Just like in the title. <u>Imagine you are a mentor and can share only one advice with your mentee. Would would it be?</u> ^^

PS: This post isn't directed only to super experienced developers like seniors, principals, or maybe team leads etc, but also juniors and people who have just started. 

I hope this will create some nice **healthy conversations** and open closed doors, that everyone of us have, no matter of how many years behind we have. 

---

Being a developer is a lot about having the right mindset, so I'm really curious what advices you will give :D

PS: btw I'm building a job board for remote developers and companies with remote-first culture. If you are interested here is a link: [devsonremote.com](https://devsonremote.com/)
AI Chatbot with Cloudflare Worker AI Model and Vercel AI SDK
Tags: cloudflarechallenge, devchallenge, ai, nextjs
Published: 2024-04-05 10:14:58

*This is a submission for the [Cloudflare AI Challenge](https://dev.to/devteam/join-us-for-the-cloudflare-ai-challenge-3000-in-prizes-5f99).*

## What I Built

A simple chatbot app using llama-2-7b-chat-fp16 model from Cloudflare Worker and Vercel AI SDK 

## Demo

[AI Chatbot](https://cloudflare-chatbot.pages.dev)

## My Code

[Github project](https://github.com/letrieu/cloudflare-chatbot)

## Journey
Just a simple chatbot using [Next.js](https://nextjs.org), the prebuilt utility [useChat](https://sdk.vercel.ai/docs/api-reference/use-chat) from the Vercel AI SDK to handle streaming responses of Cloudflare Worker, and utilizing the prebuilt [chat bubble](https://daisyui.com/components/chat/) component from DaisyUI for the UI.

## Tech Stack

- [Cloudflare Pages](https://pages.cloudflare.com) – deployments
- [Cloudflare Worker AI Model](https://developers.cloudflare.com/workers-ai/models/) - text generation
- [Next.js](https://nextjs.org/) – framework
- [Vercel AI SDK](https://sdk.vercel.ai/docs) – AI library
- [TailwindCSS](https://tailwindcss.com/), [DaisyUI](http://daisyui.com) - styles

![Demo photo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r8tr9xikql5di361zub6.png)
Enhancing LLMs with Vector Database with real-world examples
Tags: llm, datascience, python, machinelearning
Published: 2024-04-05 10:14:49

We can say Vector Databases keep LLMs up to date. Through the RAG technique mostly we do. In this article, Grig Duta explained about vector databases, how people used them before the LLM era, how to improve their performance, how to create embeddings, etc. A long one but a good one

{% embed https://mlengineering.medium.com/integrating-vector-databases-with-llms-a-hands-on-guide-82d2463114fb %}
Curly Quotes, Phrase Strings, & ARB
Published: 2024-04-05 10:13:27

This is a friendly reminder that all single quotes will be converted to a curly quote (smart quote) when Phrase Strings exports as an ARB file.

I hope this post can prevent another person from spending time debugging their system 🍀.

[.ARB - Application Resource Bundle (Strings) – Phrase](https://support.phrase.com/hc/en-us/articles/6111361660188--ARB-Application-Resource-Bundle-Strings)
I built a tool to collect loom videos from your users
Tags: javascript, loom, react, vercel
Published: 2024-04-05 10:10:36

Hey Everyone

As you guys all now loom is a very popular internal feedback tool. I always wanted to use loom collect feedback from my users but there was no way to automate that process. 

So I created a simple widget you can install in your website in 5 minutes, that allows your visitors to submit loom video feedback and annotated screenshots without requiring an account.

You can check it out here www.loomflows.com