<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Azeem Akhtar</title>
    <description>The latest articles on DEV Community by Azeem Akhtar (@bigprogrammer).</description>
    <link>https://dev.to/bigprogrammer</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1053230%2F31fd4fd2-76eb-4888-a526-4cb0c2a306c4.png</url>
      <title>DEV Community: Azeem Akhtar</title>
      <link>https://dev.to/bigprogrammer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bigprogrammer"/>
    <language>en</language>
    <item>
      <title>How to Send Emails with Django: A Step-by-Step Guide</title>
      <dc:creator>Azeem Akhtar</dc:creator>
      <pubDate>Wed, 02 Aug 2023 17:24:34 +0000</pubDate>
      <link>https://dev.to/bigprogrammer/how-to-send-emails-with-django-a-step-by-step-guide-5c71</link>
      <guid>https://dev.to/bigprogrammer/how-to-send-emails-with-django-a-step-by-step-guide-5c71</guid>
      <description>&lt;p&gt;Django, a powerful web framework for Python, makes it easy to build web applications, including ones that involve sending emails. Sending emails is a common requirement in many web applications, whether it's for user registration, password reset, notifications, or any other communication with users. In this step-by-step guide, we will walk you through the process of setting up and &lt;strong&gt;sending emails using Django&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Set up Django Project
&lt;/h2&gt;

&lt;p&gt;Assuming you have Python installed on your system, start by creating a new Django project if you haven't already:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;django-admin startproject projectname
cd projectname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Create Django App
&lt;/h2&gt;

&lt;p&gt;Next, create a new Django app within your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python manage.py startapp appname

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Configure Email Settings
&lt;/h2&gt;

&lt;p&gt;In your Django project's settings.py file, configure the email settings. Open the settings.py file and find the &lt;code&gt;EMAIL_BACKEND&lt;/code&gt; and &lt;code&gt;EMAIL_HOST&lt;/code&gt; settings. You can use Django's built-in SMTP backend for development and testing purposes, but for production, you'll need to use a proper email service provider.&lt;/p&gt;

&lt;p&gt;For production, you should use a proper email service provider like Gmail, Mailgun, SendGrid, etc.:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# settings.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'your_email_host'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your_email_username'
EMAIL_HOST_PASSWORD = 'your_email_password'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember to replace 'your_email_host', 'your_email_username', and 'your_email_password' with your actual email service provider details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Create Email Template (Optional)
&lt;/h2&gt;

&lt;p&gt;You can create an HTML email template to make your emails look more professional and engaging. Create a folder named templates within your app directory and then create a sub-folder named emails. Inside this folder, create an HTML file for your email content. For example, registration_email.html:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- registration_email.html --&amp;gt;

&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Welcome to our website!&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h2&amp;gt;Hello {{ username }},&amp;lt;/h2&amp;gt;
    &amp;lt;p&amp;gt;Thank you for registering on our website. We're excited to have you onboard!&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;Best regards,&amp;lt;/p&amp;gt;
    &amp;lt;p&amp;gt;The Website Team&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Sending Emails from Django Views
&lt;/h2&gt;

&lt;p&gt;Now that your email settings are configured, and the email template (if you have one) is ready, it's time to send emails from your Django views. Open your app's views.py file and import the necessary modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# views.py

from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.utils.html import strip_tags

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, define a function to send the email:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# views.py

def send_registration_email(request):
    # Get the user's email and username
    email = 'user@example.com'  # Replace with the user's email address
    username = 'John Doe'       # Replace with the user's username

    # Prepare the email content
    subject = 'Welcome to Our Website!'
    html_message = render_to_string('emails/registration_email.html', {'username': username})
    plain_message = strip_tags(html_message)

    # Send the email
    send_mail(subject, plain_message, 'your_email_sender@example.com', [email], html_message=html_message)

    return HttpResponse('Email sent successfully!')

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we're sending a welcome email to a user who has just registered on our website. The send_mail() function is used to send the email, and it takes the subject, plain text message, sender email address, recipient list, and the HTML message as parameters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Configure URL and Test
&lt;/h2&gt;

&lt;p&gt;Finally, you need to configure a URL in your app's urls.py file to trigger the email sending process. Add a URL pattern that maps to the view function you created earlier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# urls.py

from django.urls import path
from . import views

urlpatterns = [
    path('send_email/', views.send_registration_email, name='send_email'),
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you can run your Django development server and visit the URL &lt;a href="http://127.0.0.1:8000/send_email/" rel="noopener noreferrer"&gt;http://127.0.0.1:8000/send_email/&lt;/a&gt;. This will trigger the send_registration_email view, and the welcome email will be sent to the specified email address.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Congratulations!&lt;/strong&gt; You have successfully set up and sent emails using Django. You can extend this functionality to other parts of your web application, such as sending password reset emails, notifications, and more.&lt;/p&gt;

&lt;p&gt;Keep in mind that when deploying your application to production, you should use a proper email service provider for reliability and security. Always handle sensitive information like email passwords securely and follow best practices for email communication in your web application.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Learn to Code: Create a Random Number Guessing Game in Python</title>
      <dc:creator>Azeem Akhtar</dc:creator>
      <pubDate>Sat, 03 Jun 2023 17:12:17 +0000</pubDate>
      <link>https://dev.to/bigprogrammer/learn-to-code-create-a-random-number-guessing-game-in-python-3mpi</link>
      <guid>https://dev.to/bigprogrammer/learn-to-code-create-a-random-number-guessing-game-in-python-3mpi</guid>
      <description>&lt;p&gt;In this article, we will walk through the process of creating a simple program that generates a random number and asks the user to guess it. This can be a fun and interactive way to learn about programming and practice your coding skills. We will be using a programming language of your choice, but for the sake of simplicity, we will provide examples in Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generating a Random Number
&lt;/h2&gt;

&lt;p&gt;The first step is to generate a random number that the user will have to guess. In Python, we can make use of the &lt;code&gt;random&lt;/code&gt; module to accomplish this. Here's an example code snippet:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random

def generate_random_number():
    return random.randint(1, 100)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;random.randint(a, b)&lt;/code&gt; function generates a random integer between &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;, inclusive. In this case, we are generating a random number between 1 and 100. Feel free to adjust the range according to your preferences.&lt;/p&gt;

&lt;h3&gt;
  
  
  Asking the User for Guesses
&lt;/h3&gt;

&lt;p&gt;Now that we have a random number, we can start asking the user to guess it. We will prompt the user for input and compare their guess with the randomly generated number. Here's an example code snippet to get you started:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def ask_user_for_guess():
    guess = int(input("Take a guess: "))
    return guess

def check_guess(random_number, user_guess):
    if user_guess &amp;lt; random_number:
        print("Too low!")
    elif user_guess &amp;gt; random_number:
        print("Too high!")
    else:
        print("Congratulations! You guessed it!")

# Main program
random_number = generate_random_number()

while True:
    user_guess = ask_user_for_guess()
    check_guess(random_number, user_guess)
    if user_guess == random_number:
        break
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In this code, we define two functions: &lt;code&gt;ask_user_for_guess()&lt;/code&gt; and &lt;code&gt;check_guess(random_number, user_guess)&lt;/code&gt;. The &lt;code&gt;ask_user_for_guess()&lt;/code&gt; function prompts the user to enter their guess and returns it as an integer. The &lt;code&gt;check_guess()&lt;/code&gt; function compares the user's guess with the randomly generated number and provides feedback accordingly.&lt;/p&gt;

&lt;p&gt;We then use a &lt;code&gt;while&lt;/code&gt; loop to continuously ask the user for guesses until they guess the correct number. Once the user guesses the correct number, the loop breaks, and the program ends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Congratulations! You have successfully written a program that generates a random number and asks the user to guess it. This exercise is a great way to practice your coding skills and understand the basics of user input and random number generation in programming.&lt;/p&gt;

&lt;p&gt;Feel free to modify the code and add additional features to make the game more interesting. You could keep track of the number of guesses the user takes, provide hints, or even create a high-score system.&lt;/p&gt;

&lt;p&gt;Remember to have fun and keep exploring my profile!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>React Native Notes Download Complete Learn React Native</title>
      <dc:creator>Azeem Akhtar</dc:creator>
      <pubDate>Thu, 01 Jun 2023 20:10:26 +0000</pubDate>
      <link>https://dev.to/bigprogrammer/react-native-notes-download-complete-learn-react-native-43b8</link>
      <guid>https://dev.to/bigprogrammer/react-native-notes-download-complete-learn-react-native-43b8</guid>
      <description>&lt;p&gt;In the dynamic world of mobile app development, React Native has emerged as a game-changer, empowering developers to build captivating applications for both iOS and Android platforms using a single codebase. In this blog post, I’ll share my journey and insights into harnessing the power of React Native, from learning the fundamentals to successfully deploying my first app. Join me as we delve into cross-platform mobile development and discover its limitless possibilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Native Notes
&lt;/h2&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://bigprogrammer.medium.com/react-native-notes-download-learn-mobile-app-development-2023-4b3c45f27224" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afill%3A88%3A88%2F1%2ACqWfMBqwPg8juaGbFtaTlQ.png" alt="Azeem Akhtar"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://bigprogrammer.medium.com/react-native-notes-download-learn-mobile-app-development-2023-4b3c45f27224" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;React Native Notes Download Learn mobile app development 2023 | by Azeem Akhtar | Medium&lt;/h2&gt;
      &lt;h3&gt;Azeem Akhtar ・ &lt;time&gt;Jun 1, 2023&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fmedium-f709f79cf29704f9f4c2a83f950b2964e95007a3e311b77f686915c71574fef2.svg" alt="Medium Logo"&gt;
        bigprogrammer.Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Master Flexbox: A Comprehensive Guide to Understanding and Using CSS Flexbox</title>
      <dc:creator>Azeem Akhtar</dc:creator>
      <pubDate>Thu, 06 Apr 2023 08:14:57 +0000</pubDate>
      <link>https://dev.to/bigprogrammer/master-flexbox-a-comprehensive-guide-to-understanding-and-using-css-flexbox-2b59</link>
      <guid>https://dev.to/bigprogrammer/master-flexbox-a-comprehensive-guide-to-understanding-and-using-css-flexbox-2b59</guid>
      <description>&lt;p&gt;CSS Flexbox is a powerful layout system that has revolutionized the way we design and structure web pages. With Flexbox, you can easily create complex and responsive layouts that adapt to different screen sizes and devices. In this article, we will take an in-depth look at CSS Flexbox and show you how to master it for your web development projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is CSS Flexbox?
&lt;/h2&gt;

&lt;p&gt;CSS Flexbox, also known as Flexible Box Layout, is a CSS module that enables you to create flexible and responsive layouts for web pages. With Flexbox, you can align and distribute content within a container in any direction, including horizontally and vertically. This is particularly useful for creating complex layouts with multiple columns, rows, and nested elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flexbox Terminology
&lt;/h2&gt;

&lt;p&gt;Before diving into the details of Flexbox, it's essential to understand the terminology used to describe the layout system. Here are some key terms to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flex container: The parent element that contains the flex items.&lt;/li&gt;
&lt;li&gt;Flex item: The child element that is placed inside the flex container.&lt;/li&gt;
&lt;li&gt;Main axis: The primary axis along which the flex items are arranged. This can be either horizontal or vertical, depending on the flex direction.&lt;/li&gt;
&lt;li&gt;Cross axis: The secondary axis perpendicular to the main axis. This is the opposite of the main axis.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Flexbox Properties
&lt;/h2&gt;

&lt;p&gt;There are several Flexbox properties that you can use to customize the layout of your web page. Here are some of the most commonly used properties:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;display: This property sets the display mode of the element to "flex" and enables the Flexbox layout.&lt;/li&gt;
&lt;li&gt;flex-direction: This property specifies the direction of the main axis. You can set it to "row" for a horizontal layout or "column" for a vertical layout.&lt;/li&gt;
&lt;li&gt;justify-content: This property aligns the flex items along the main axis. You can use values like "flex-start," "flex-end," "center," and "space-between" to adjust the spacing and alignment of the items.&lt;/li&gt;
&lt;li&gt;align-items: This property aligns the flex items along the cross axis. You can use values like "flex-start," "flex-end," "center," and "stretch" to adjust the positioning of the items.&lt;/li&gt;
&lt;li&gt;flex-wrap: This property specifies whether the flex items should wrap to a new line when the container is full. You can use values like "nowrap," "wrap," and "wrap-reverse" to control the wrapping behavior.&lt;/li&gt;
&lt;li&gt;align-content: This property aligns the lines of flex items when there are multiple lines within the flex container. You can use values like "flex-start," "flex-end," "center," and "space-between" to adjust the spacing and alignment of the lines.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Flexbox Examples
&lt;/h2&gt;

&lt;p&gt;Let's take a look at some examples of Flexbox in action:&lt;/p&gt;

&lt;p&gt;Creating a Simple Flexbox Layout&lt;br&gt;
To create a simple Flexbox layout with two columns, you can use the following CSS code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.item {
  width: 50%;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we set the display mode of the container to "flex" and specify a horizontal layout with two columns. We also use the "space-between" value for the justify-content property to evenly distribute the columns within the container.&lt;/p&gt;

&lt;h2&gt;
  
  
  Centering Items with Flexbox
&lt;/h2&gt;

&lt;p&gt;To center an element both horizontally and vertically within a Flexbox container, you can use the following CSS code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex;
  justify-content: center;
  align-items: center;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we set the display mode of the container to "flex" and use the "center" value for both the justify-content and align-items properties to center the child element within the container.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Responsive Flexbox Layout
&lt;/h2&gt;

&lt;p&gt;To create a responsive Flexbox layout that adapts to different screen sizes, you can use media queries to adjust the layout based on the screen width. Here's an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

.item {
  width: 100%;
}

@media only screen and (min-width: 768px) {
  .container {
    flex-direction: row;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we use a media query to change the flex direction of the container from column to row when the screen width is 768 pixels or larger. This allows the layout to adapt to smaller screen sizes by stacking the items vertically, and then switching to a horizontal layout for larger screens.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;CSS Flexbox is a powerful layout system that offers a lot of flexibility and control over the positioning and alignment of elements on a web page. With its intuitive syntax and powerful properties, Flexbox has become a staple of modern web design and development. By mastering Flexbox, you can create beautiful and responsive layouts that work seamlessly across different devices and screen sizes.&lt;br&gt;
&lt;a href="https://www.sitesbrain.com/2023/06/how-to-learn-django.html" rel="noopener noreferrer"&gt;How to Learn Django in 2023 as beginners to win Job&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
