teleren/devto huggingface dataset:
Auth via E-mail: Overriding Django's default auth system
Tags: webdev, django, api, backenddevelopment
Published: 2024-03-30 08:53:20

Django framework provides a great mechanism to authenticate users via their username and password, but what if you need to implement a custom auth where you have to authenticate via the email instead? 
This Guide covers the steps to create a custom user auth for you project

1. **Creating your auth.py**:
first of all inside you app directory create a file named auth.py, that's where we're gonna override the default authentication behavior.
2. *** Overriding the default authenticate method***:
 inside you auth.py file paste the following code:

```
from django.contrib.auth.backends import BaseBackend
from django.contrib.auth import get_user_model

class CustomUserAuth(BaseBackend):
    def __init__(self) :
        # get the custom user model we've already created
        self.UserModel = get_user_model()
        # overriding the authenticate  method to include our own logic for authentication
    def authenticate(self, request, username=None,password=None,**kwargs):
        # retrieve the username
        username = kwargs.get('username')
        if username:
            try :
                # treat the username as email if it contain @
                if '@' in username:
                    user = self.UserModel.objects.get(email=username)
                # if it doesnt treat it as a username
                else:
                    user = self.UserModel.objects.get(username=username)
                # check the password that's included on the request 
                # and return user object if its true
                if user.check_password(password):
                    return user
                else :
                    return None
            except Exception as e:
                return None
    # a function to get the user object
    def get_user(self, user_id):
        try:
            return self.UserModel.objects.get(pk=user_id)
        except self.UserModel.DoesNotExist:
            return None
```
3. ***Tell django about the new settings***:
return to your settings.py and add this line:

```

AUTHENTICATION_BACKENDS = [
    'relative/path/tp/your/auth.py'
]

```
this line will tell django that we've created our own authentication login and that we're going to use it 

And that it, your custom authentication should now work either by email or useraname
Building a Lua docker environment
Published: 2024-03-30 08:48:14

## Intro

I have a keen interest in containerization, a practice that has significantly streamlined my development workflow. Reflecting on my early days in programming around 2011-2012, I recall encountering a common issue when setting up local development environments. Specifically, during the installation of WAMP, I faced an error indicating that port 3306 (MySQL) was already in use. Upon investigation, I discovered that a previous installation of MySQL for a school project was the culprit, highlighting the challenges of managing dependencies and conflicting software configurations.

## Motivation

Currently, I am embarking on a journey to learn Lua scripting to complement my son's endeavors in 3D modeling within the Roblox platform. This motivation stems from a desire to actively engage and support his interests, although finding the time amidst other responsibilities remains a challenge. Nevertheless, I am enthusiastic about delving into Lua scripting to enhance our collaborative projects.

## Installation

To facilitate my exploration of Lua, I adopt a pragmatic approach by leveraging containerization with Docker to create a dedicated development environment. This method ensures isolation from existing system dependencies and simplifies setup and management.

First, let's build the project structure:
```
mkdir ~/learn-lua
cd ~/learn-lua
```

Then, create a `Dockerfile` and our `main.lua` script:
```
touch Dockerfile
touch main.lua
```

*Dockerfile:*
```
# Use a base image with Lua installed
FROM alpine:latest

# Install Lua and LuaRocks
RUN apk --update add lua5.3 lua5.3-dev luarocks5.3

# Optionally, you can install additional Lua packages using LuaRocks
# For example, to install LuaSocket:
# RUN luarocks-5.3 install luasocket

# Set the working directory
WORKDIR /app

# Copy your Lua scripts into the container
COPY . .

# Set the command to run your Lua script when the container starts
CMD ["lua5.3", "main.lua"]
```

*main.lua:*
```
print("Hello, Lua!")
```

Now to run the `lua` script:
```
docker build -t game-lua .
docker run -it --rm game-lua
```

Time to learn more `lua`! I will update again soon :D
Electronic Voucher Management System | Electronic Voucher Distribution System
Tags: digitalvoucherdistribution, vouchermanagementsystem
Published: 2024-03-30 08:08:01

Mobogaze provides an [Electronic Voucher Management System](https://evdsystem.com/) that allows you to pay your bills, recharge mobile phones, book tickets, purchase in retail stores, and buy lotteries with e-money. 

The Electronic Voucher Management System is a software solution developed by the leading provider of Electronic Voucher distribution and management systems. When it comes to electronic voucher management software in the telecom industry, MobEVD is the top choice. Offering both physical and electronic voucher systems, MoboGage provides software that effectively handles the distribution of electronic vouchers. 

This software, also referred to as EVD software or electronic voucher distribution software, plays a vital role in generating and distributing vouchers for telecom companies vouchers, online gaming companies vouchers, and other businesses that utilize loyalty reward coupons. Additionally, E-Voucher is synonymous with a voucher management system or digital card distribution system.

The Electronic Voucher Management System Comes With Excellent Features Like User Management, Inventory Management, Voucher Generation, And Voucher Lifecycle Management Using Build AI Tech. Offline And Online Voucher Sales Management Using POS Terminals Like Sunmi V2, Sunmi V2 Pro, Telpo, Z91, and Pinelabs POS Terminals.
Glam Up My Markup: Submission (An interactive form)
Tags: frontendchallenge, devchallenge, css, javascript
Published: 2024-03-30 07:44:18

_This is a submission for DEV Challenge v24.03.20, Glam Up My Markup: Camp Activities_

## What I Built

For this challenge 🌈, I created a dynamic form for camp activity inquiries. Users can select their preferred activity 🏓 from a dropdown menu, enter any food allergies 🥴 they have (if applicable), and provide additional information 🧐 to the counsellor. The form dynamically updates with tips related to the selected activity and displays an emoji representing the chosen activity at the top of the form which makes it interactive.

## Demo

Use it on 0.5x for a better experience 🤫.

{% codepen https://codepen.io/sidpan2011/pen/zYXoZKe %}

## Journey

Throughout this challenge, I learned how to dynamically update form elements based on user input using JavaScript. I also gained experience in manipulating the DOM to display relevant information and improve user experience. One aspect I'm particularly proud of is the seamless integration of emoji representations for each activity, enhancing the visual appeal of the form.

I have tackled the default behaviour of the form when submitted and tried to give an actual feeling while filling the form up by adding checks (when the fields are empty) and when the form is submitted by filling up the details, I have provided an alert, so that the user gets to know that the form is submitted.

In the future, I aim to further enhance the form by implementing features such as input validation and improved styling to make it even more user-friendly 🤗.

## Contributors

@sidhanth 

I hope you like it 👻.

Thank you for this challenging opportunity! 💪
Happy Coding 🖥️!
It’s burger o’clock - Pure CSS Art (Version 1.2)🍔
Tags: frontendchallenge, devchallenge, css
Published: 2024-03-30 07:43:14

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

## Inspiration
The challenge said "Favourite Snack" and I couldn't think of anything but Burger.

## Demo 

{% codepen https://codepen.io/ge__ge/pen/vYMeRyN %}

## Journey 
It had been a while since I played with CSS. Here is the recipe
for the burger😊:

BUN:
i)Box-shadow: To give the bun the burnt bun color.
ii)Border-radius: To shape the bun.

CHEESE
i)Border-bottom, border-right, border-left: To shape the cheese
And added highlight using pseudo-element(::before)

SPINACH:
i)Border-bottom, border-right: To create the base leaf structure(A "L" shape)
ii)Border-radius: To give the spinach a round leaf structure

Animation:
i)Keyframes: To specify the position during transition

I had no idea we could do so much with pseudo-element, box-shadow and border alone. I enjoyed doing this.

Thank you😊!!


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


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4r33ko9ggud2p79rt6m1.png)
CSS Art: Paneer Tikka
Tags: frontendchallenge, devchallenge, css
Published: 2024-03-30 07:40:20

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

## Inspiration 
<!-- What snack are you highlighting today? -->
India is famous for its delicacies, for every 10 kilometers you travel, you will find a new food item that is famous in that area. 

Being a South Indian, I like North Indian food, despite having a variety of dishes, one of my favorite starters is Paneer Tikka. This starter is made by adding paneer, onion, capsicum, and tomato to a stick and grilling it in a [Tandoor](https://en.wikipedia.org/wiki/Tandoor) 

## Demo
{% codepen https://codepen.io/deveesh_shetty_12/pen/GRLMBzE %}

## Journey
It has been a very long time since I used vanilla CSS, Tailwind CSS totally didn't spoil me XD.

Well jokes apart, I woke up with an email from Devto about this challenge, and in no time I started to think about my favorite dish that I could create.

It was a fun journey that took almost 3-4 hours to put this up, and the neat part it is 100% responsive. The first time I used the General Sibling Selector (~) in CSS, and also added a fun hover animation to eat the paneer tikka.

My step-by-step take on building this ✨

- First, I created a plate that was quite simple, I used CSS pseudo-elements to give inner borders, and border-radius to have the croissant-type shape.

- Then I proceeded to create a stick and centered it on the plate using a Flexbox.

- Next comes the food item, I placed each item ie Paneer, Capsicum, etc. in a div with particular class names, and styled them accordingly using CSS colors, borders, and box-shadows.

- All the items are child of the stick so it was easy to align them with a simple flex.

- Next comes the sauce (literally), firstly I drew 2 circles and masked them with their pseudo-element to have a semi-circular pattern.

- Created 2 extra divs and positioned them at the top right as sauce bowls.

- Added some final box-shadow which gave some depth effect to the plate and bowls.

- Still, something is missing, yes animation! So I added a small hover effect which on hover eats everything in the plate and leaves one capsicum XD


If you found it delicious you can find the recipe here - [Paneer Tikka Recipe](https://www.indianhealthyrecipes.com/paneer-tikka-on-stove-top/)

<!-- Tell us about your process, what you learned, anything you are particularly proud of, what you hope to do next, etc. -->

<!-- Team Submissions: Please pick one member to publish the submission and credit teammates by listing their DEV usernames directly in the body of the post. -->

<!-- We encourage you to consider adding a license for your code. -->

<!-- Don't forget to add a cover image to your post (if you want). -->

Thank you for reading!

**Deveesh Shetty**
[Github](https://github.com/dev-shetty) | [Twitter](https://twitter.com/shettydeveesh)


<!-- Thanks for participating! -->
Latest Newsletter: Eating Glass (Issue #157)
Tags: javascript, tech, webdev, discuss
Published: 2024-03-30 07:28:33

---
title: Latest Newsletter: Eating Glass (Issue #157)
published: true
description: Bitcoin scaling, social media federation, Bitcoin on feature phones, Microstrategy strategy, the slaughtering of good media outlets, fascinating Bitcoin mining dynamics
tags: javascript, tech, webdev, discuss
---
Latest Newsletter: Eating Glass (Issue #157)

Bitcoin scaling, social media federation, Bitcoin on feature phones, Microstrategy strategy, the slaughtering of good media outlets, fascinating Bitcoin mining dynamics

https://markjgsmith.substack.com/p/saturday-30th-march-2024-eating-glass

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
Docker Commands
Published: 2024-03-30 07:26:33

## Installing docker Ubuntu
```
sudo apt-get update
sudo apt install docker.io

sudo systemctl disable docker
sudo systemctl stop docker

sudo service docker start
```

## Sample Dockerfile

```
FROM node:*-alpine

# update packages
RUN apk update

# create root application folder
WORKDIR /app

# copy configs to /app folder
COPY package*.json ./
COPY tsconfig.json ./
# copy source code to /app/src folder
COPY src /app/src

# check files list
RUN ls -a

RUN npm install
RUN npm run build

EXPOSE 7777

CMD [ "node", "./dist/main.js" ]
```

## Docker commands

### Images

Build docker image
```
docker build -t test-image-name .
```

Run image in interactive mode
```
docker run -it -p 7777:7777 test-image-name
```

Or run image in silent(daemon) mode
```
docker run -d -p 7777:7777 test-image-name
```
List all images
```
docker image ls
```

Remove all images at once
```
docker rmi $(docker images -q)
```

### Containers

List all active containers
```
docker ps
```

List all active and dead containers
```
docker ps -a
```

Stop all running containers
```
docker stop $(docker ps -a -q)
```

Delete all stopped containers: 
```
docker rm $(docker ps -a -q)
```

### Other

Install help utils
```
apt-get install iputils-ping nmap
```

Jump into container shell
```
docker exec -it CONTAINER_ID /bin/sh
```
Help you better to understand The XSS In Security
Published: 2024-03-30 07:24:51

The XSS,known as Cross-Site Scripting,is a common security flaw.to understand XSS better,we need to learn some knowledge about front-end development.

One of the most popular using tool is Browser in surfing internet today.with Browser,we can do magic things like reading news,buying items,and searching for flights.although it brings convince to our life,bad guys skilled on internet pose risks to you.  

Browser use javascript,which is a high-level programming language and executed by Browser to control web page.for example adding items to trolley,jumping to the payment page and so on,process for all of these is done by javascript.javascript will receive input from user to complete these processes.just imaging,if user input became part of javascript codes or web pages with an evil injection.Terrible,right?this is what xss.

The following segment of javascript code that rececives user input as part of web page is extremely dangerous.in this case,user can inject harmful content affecting the website.assuming that `<img src=1  onClick='alert(hack success)'> ` is the injected content,javascirpt will add an img element bound with onclick event ,which is displayed as an image on page.if another user clicks the image,javscript code in the onClick event will be executed.


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



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

The essence of XSS is that user input flows to risky method like 'innerHtml' and is considered a part of javascript code or a web page,so that malicious operations can occur on the website.XSS is classified into various type based on the injection approach.an article full of many things can be confused,So,next time,we will understand Stored XSS and Reflected XSS in an accessible way.
Transforming Digital Experiences: An Introduction to Progressive Web Applications (PWAs)
Tags: webdev, javascript, pwa, ux
Published: 2024-03-30 07:00:09

_Progressive Web Applications(PWAs)_ are web applications that combine the best features of both websites and native mobile applications. They are designed to offer fast, reliable, and engaging experiences even on unreliable network connections.


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

**Advantages of PWAs:**    

- Fast Load Times: PWAs can load quickly, even on slow networks, thanks to optimizations like caching and preloading.    

- Offline Mode: PWAs can cache resources locally, enabling offline mode and faster load times.   

- Engaging UX: PWAs can provide immersive full-screen experiences, complete with animations and interactions similar to native mobile apps.
    
- Easy Installation: Users can easily install PWAs on their home screen, without needing to go through the app store.
    
- Cross-platform compatibility: PWAs can run on any platform that supports modern web technologies, including desktop browsers, Android, iOS, and Chrome OS.

**Purpose of PWAs:**

The primary goal of PWAs is to provide a seamless and engaging user experience that combines the benefits of web and native mobile applications. By offering fast load times, offline mode, and full-screen experiences, PWAs aim to bridge the gap between traditional web pages and native mobile apps.

**Features of PWAs:** 

- Responsive Design: PWAs are responsive and adapt to various screen sizes and orientations.    

- Service Workers: PWAs use service workers to enable background sync, push notifications, and offline capabilities.
    
- HTTPS Requirement: PWAs require secure communication over HTTPS protocol to protect user data.    

- Manifest File: PWAs use manifest files to declare metadata about the app, such as iconography, colors, and splash screens.
    
- Linkability: PWAs can be shared via URLs, unlike native mobile apps that require download and installation.

**Usage of PWAs:**

PWAs can be used in a variety of scenarios, including e-commerce, news sites, social media platforms, productivity tools, and gaming. They are particularly well suited for businesses looking to engage customers on mobile devices, without requiring them to download and install a native app.

Some examples of successful PWA implementations include Twitter Lite, Starbucks, Flipkart, Alibaba, and Trivago. These companies have reported significant improvements in engagement metrics, conversion rates, and overall customer satisfaction after implementing PWAs.

Overall, PWAs represent a powerful tool for businesses looking to deliver high-quality, performant, and engaging web experiences. By combining the strengths of web and native mobile applications, PWAs offer a promising path forward for the future of digital experiences.
How to Set up a Domain on your Vercel Project
Tags: github, developer, tutorial, softwaredevelopment
Published: 2024-03-30 06:37:15

Hey, fellow devs! So, you've purchased a sweet domain from Hostinger and you're itching to connect its power to Vercel?💥

I'll hold your hand as we connect your domain to Vercel and craft some nifty subdomains along the way.

Read the full article here: https://codecraftsangita.blogspot.com/2024/03/set-up-domain-and-subdomain-on-vercel.html
Writing multi-line code on Chrome DevTools
Tags: chrome, devtools, frontend, snippets
Published: 2024-03-30 06:31:38


![Chrome DevTools Snippets](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0or6kletsocpfel2bhik.png)

One of the most frequently used panels of tools like Chrome DevTools is writing and running code through the console. This panel, which we often use to test a piece of code as well as when we debug, does not seem very practical when it comes to writing multi-line codes, even though it allows it. 

To enter multiple lines on the console, simply press shift+enter instead of just enter at the end of the line. You can navigate through your code using the up and down arrow keys. However, sometimes you might lose your progress while navigating this history, especially if you mix up your shortcuts.

There may also be times when you want to paste a code, make changes to it, and run it numerous times. The console is very accessible for this, but there's another panel in DevTools called 'Snippets' that you might have overlooked. Snippets exist in almost every editor and can also be saved in DevTools. They support every feature related to debugging, making them more ideal for storing lengthy lines of code.

Moreover, you can find many useful snippets with a bit of research. You can experiment with these snippets and save the ones you like in DevTools.

To write multi-line code here are the steps:

1. Open Chrome DevTools (right-click anywhere on a webpage and select 'Inspect' or use the shortcut `Ctrl+Shift+J` for Windows/Linux or `Cmd+Option+J` for Mac).
2. Go to the 'Sources' tab.
3. On the left pane, click on the '>>' button and select 'Snippets'.
4. Click on 'New snippet'.
5. Give it a name and start writing your code in the editor.
6. Once you're done writing your code, you can run it by clicking the 'Run' button or using the shortcut `Ctrl+Enter`.

This way, you can write and run multi-line codes easily in the Chrome DevTools console.
MindMap for revision of DSA in 30 days !! 🎯
Tags: cpp, datastructures, algorithms, webdev
Published: 2024-03-30 06:28:08

I have taken this 30 days of challenge to revise all DSA topics and practice it 
Watch my journey in instagram 📸 : https://www.instagram.com/codeandcrunch/ 
Here is mind map which i have created!! (i am keep updating questions and tutorial link as i studied) 📚💻
{% embed https://miro.com/app/board/uXjVNgUXAWU=/?share_link_id=208142030076 %}

Share your thoughts bellow 
Happy coding ! 🫶🏻
What are the different types of Stablecoins?
Tags: cryptocurrency, asic, bitcoin
Published: 2024-03-30 06:15:33

The kinds of **[stablecoins ](https://asicmarketplace.com/blog/what-are-stablecoins/)**are different in their backing from different assets. The most commonly used types include fiat-backed stablecoins and commodities-backed and algorithms-backed stablecoins. Let's now look at these three types in greater detail to better understand:

**1. Fiat currencies Backed Stablecoins**
The most popular and widely utilized method is to make use of fiat currency or cash equivalents to help support every stablecoin on the same amount. The most simple method of connecting the value of a coin with the U.S. dollar is to provide it with an equivalent quantity of reserves that are held in the bank account. It means that the account of the issuer's U.S. bank accounts are stored in reserve equivalent to one USD per stablecoin that is in circulation. The issuer offers its customers an opportunity to deposit dollars to the same amount of tokens.

**2. Algorithmic Backed Stablecoins**
The aim to use algorithmic stablecoins providing an uncentralized system that utilizes different outside-of-the-chain as well as within-the-chain processes to mimic the dollar. They may employ an approach to fractional reserve, or some other assets may not be backed by these coins. It's very risky to invest in cryptographic coins. Many popular ones have been unsuccessful (most recently, Terra). They haven't proven themselves to be solid and stable that they are widely accepted by investors so far.

**3. Commodity stablecoins backed by a stable currency**
Instead of algorithmsic stablecoins are backed by variable assets like precious metals. The gold bar is by far the most frequently used asset to back these stablecoins. Some stablecoin issuers like Daxos Gold and Kitco Gold are planning to take their currency out using gold bars.

**4. Crypto-backed Stablecoins**
Crypto-collateralization, a method by which assets of other cryptocurrencies back stablecoins, is another comparable technique for preserving a stablecoin's price peg. The stablecoins that are crypto-backed tend to be over-collateralized since cryptocurrencies are less volatile than traditional currency.