<?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: Sami Ullah Saleem</title>
    <description>The latest articles on DEV Community by Sami Ullah Saleem (@samiullahsaleem).</description>
    <link>https://dev.to/samiullahsaleem</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%2F634263%2Fe1bf0578-eb82-49f8-96f2-13e09626df17.jpg</url>
      <title>DEV Community: Sami Ullah Saleem</title>
      <link>https://dev.to/samiullahsaleem</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samiullahsaleem"/>
    <language>en</language>
    <item>
      <title>🚀 𝗗𝗶𝘃𝗲 𝗶𝗻𝘁𝗼 𝗗𝗼𝗰𝗸𝗲𝗿 𝘄𝗶𝘁𝗵 𝗗𝗼𝗰𝗸𝗲𝗿 𝗖𝗼𝗺𝗺𝗮𝗻𝗱𝗲𝗿! 🐳</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Sun, 16 Mar 2025 17:57:26 +0000</pubDate>
      <link>https://dev.to/aws-builders/-43lo</link>
      <guid>https://dev.to/aws-builders/-43lo</guid>
      <description>&lt;p&gt;I'm thrilled to introduce you to 𝗗𝗼𝗰𝗸𝗲𝗿 𝗖𝗼𝗺𝗺𝗮𝗻𝗱𝗲𝗿, a comprehensive learning tool designed to help you master Docker commands and workflows. Whether you're a developer, DevOps engineer, or just someone curious about Docker, this project is for you! 🌟&lt;/p&gt;

&lt;p&gt;𝗙𝗲𝗮𝘁𝘂𝗿𝗲𝘀 🌟&lt;/p&gt;

&lt;p&gt;𝗜𝗻𝘁𝗲𝗿𝗮𝗰𝘁𝗶𝘃𝗲 𝗧𝗲𝗿𝗺𝗶𝗻𝗮𝗹 🖥️&lt;br&gt;
Run Docker commands and see the output directly in your browser. &lt;/p&gt;

&lt;p&gt;𝗗𝗼𝗰𝗸𝗲𝗿 𝗪𝗼𝗿𝗸𝗳𝗹𝗼𝘄 𝗩𝗶𝘀𝘂𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻 📊&lt;br&gt;
Provides a graphical representation of various Docker workflows.&lt;/p&gt;

&lt;p&gt;𝗖𝗼𝗺𝗺𝗮𝗻𝗱 𝗚𝘂𝗶𝗱𝗲 📚&lt;br&gt;
Detailed explanations and examples for various Docker commands, helping you understand their usage and syntax.&lt;/p&gt;

&lt;p&gt;𝗦𝗶𝘁𝗲 𝗨𝗿𝗹: &lt;a href="https://lnkd.in/d_ZgFQeJ" rel="noopener noreferrer"&gt;https://lnkd.in/d_ZgFQeJ&lt;/a&gt;&lt;br&gt;
𝗥𝗲𝗽𝗼𝘀𝗶𝘁𝗼𝗿𝘆 𝗟𝗶𝗻𝗸: &lt;a href="https://lnkd.in/dSm9seFM" rel="noopener noreferrer"&gt;https://lnkd.in/dSm9seFM&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;𝗖𝗼𝗻𝘁𝗿𝗶𝗯𝘂𝘁𝗶𝗻𝗴 🤝&lt;br&gt;
The project can have bugs 🐛, and I want you to try this project and create an issue in the GitHub repo if you encounter any. Your feedback is invaluable and helps us improve the project! 💪&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3fx603fg0vj6cp2r4f1k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3fx603fg0vj6cp2r4f1k.jpg" alt="Docker Commander" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>opensource</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Building Container Images Using Dockerfiles</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Wed, 16 Aug 2023 11:43:21 +0000</pubDate>
      <link>https://dev.to/aws-builders/building-container-images-using-dockerfiles-4ijh</link>
      <guid>https://dev.to/aws-builders/building-container-images-using-dockerfiles-4ijh</guid>
      <description>&lt;p&gt;1- Create Dockerfile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ vi Dockerfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; httpd:2.4&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apt update &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt autoremove
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Dockerfile always start from &lt;em&gt;FROM&lt;/em&gt; keyword and after it we tell the image name like we are telling here httpd of which we want to create our container.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RUN&lt;/strong&gt; whatever we are going to write after RUN it will be run in our container.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ docker build &lt;span class="nt"&gt;-t&lt;/span&gt; wigetfactory &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Here you can see that we are creating our image from our Dockerfile and giving it a name which is wigetfactory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2- Let's update our Dockerfile and put our website content in it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; httpd:2.4&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apt update &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt autoremove
rm -f /usr/local/apache2/htdocs/
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /usr/local/apache2/htdocs/&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; ./web .&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Here you can see that I am changing my container work directory using *&lt;em&gt;WORKDIR *&lt;/em&gt; command and then copy my website content from my host directory to the container location which is htdocs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Let's run our Dockerfile again.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ docker build &lt;span class="nt"&gt;-t&lt;/span&gt; widgetfactory:0.3 &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here will be the output of it&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8m3o3jr777tkbiwz24mj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8m3o3jr777tkbiwz24mj.png" alt="Dockerfile output" width="800" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now run container using the image.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker  run &lt;span class="nt"&gt;--name&lt;/span&gt; weebproject &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 80:80 widgetfactory:0.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow me for more content&lt;/p&gt;

</description>
      <category>docker</category>
      <category>containers</category>
    </item>
    <item>
      <title>Storing Container Data in AWS S3</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Mon, 14 Aug 2023 17:35:40 +0000</pubDate>
      <link>https://dev.to/aws-builders/storing-container-data-in-aws-s3-170e</link>
      <guid>https://dev.to/aws-builders/storing-container-data-in-aws-s3-170e</guid>
      <description>&lt;h2&gt;
  
  
  Install awscli
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--upgrade&lt;/span&gt; &lt;span class="nt"&gt;--user&lt;/span&gt; awscli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  AWSCLI Configure
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ aws configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install sefs
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ yum &lt;span class="nb"&gt;install &lt;/span&gt;s3fs-fuse &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Mount S3 Bucket to local filesystem
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wEG3s3FR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bx1py8g3i25oh31mcr99.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wEG3s3FR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bx1py8g3i25oh31mcr99.png" alt="Mount s3 bucket to local system" width="688" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0pc6j8sj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuxg0rhhy7i666pkr7z0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0pc6j8sj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuxg0rhhy7i666pkr7z0.png" alt="Image description" width="800" height="57"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, what we have done here?&lt;br&gt;
We mount our s3 bucket to our local system and then bind mount it with the container. Now, if we copy any new file to our local directory. It will automatically go to our s3 bucket and in our containers&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>aws</category>
      <category>s3</category>
    </item>
    <item>
      <title>Storing Container Data In Docker Volumes</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Mon, 14 Aug 2023 17:06:54 +0000</pubDate>
      <link>https://dev.to/aws-builders/storing-container-data-in-docker-volumes-585d</link>
      <guid>https://dev.to/aws-builders/storing-container-data-in-docker-volumes-585d</guid>
      <description>&lt;p&gt;Let's learn about volumes in &lt;strong&gt;Docker&lt;/strong&gt;&lt;br&gt;
What you will learn?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anonymous Volumes&lt;/li&gt;
&lt;li&gt;Create a Docker Volume&lt;/li&gt;
&lt;li&gt;Use the Website Volume with Containers&lt;/li&gt;
&lt;li&gt;Clean Up Unused Volumes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. Anonymous Volumes&lt;/strong&gt;&lt;br&gt;
When we create a container then automatically docker creates an anonyous volume for that container. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NdecOPbR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ghp4tazz739xkq3h3s5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NdecOPbR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ghp4tazz739xkq3h3s5.png" alt="Anonymous Volume" width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, lets inspect the volume using the following command&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GjmAsi6O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m20c3z551wv32iu2f0us.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GjmAsi6O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m20c3z551wv32iu2f0us.png" alt="Inspect Information" width="800" height="199"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2- Create a Docker Volume&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ docker volume create webiste
~ docker volume &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mfSHKpj4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f3dagc2cidehns2mi2q0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mfSHKpj4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f3dagc2cidehns2mi2q0.png" alt="Creating Volume using docker" width="669" height="162"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Use the Website Volume with Containers&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; web1 &lt;span class="nt"&gt;-p&lt;/span&gt; 80:80 &lt;span class="nt"&gt;-v&lt;/span&gt; webiste:/usr/local/apache2/htdocs:ro httpd:2.4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4- Clean Up Unused Volumes&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ docker volume prune
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>docker</category>
      <category>devops</category>
    </item>
    <item>
      <title>Hosting site on httpd and nginx docker container</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Sun, 13 Aug 2023 20:18:37 +0000</pubDate>
      <link>https://dev.to/aws-builders/hosting-site-on-httpd-and-nginx-docker-container-50kk</link>
      <guid>https://dev.to/aws-builders/hosting-site-on-httpd-and-nginx-docker-container-50kk</guid>
      <description>&lt;p&gt;&lt;strong&gt;Docker Project&lt;/strong&gt;&lt;br&gt;
In this project, I created containers using httpd and nginx images using command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ docker pull httpd
~ docker run &lt;span class="nt"&gt;--name&lt;/span&gt; httpdproject httpd &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I first stop and then remove this container&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;*&lt;/span&gt; docker stop httpdproject 
&lt;span class="k"&gt;*&lt;/span&gt; docker &lt;span class="nb"&gt;rm &lt;/span&gt;httpdproject 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I mount my website content on my container using these commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ docker run --name mywebproject -p 8080:80 -v &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;/web:/usr/local/apache2/htdocs:ro -d httpd
~ docker ps 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;We can check our website will be running on 8080 port which it's redirecting to 80 port of container&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Same Process, we will do with nginx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~ docker run --name nginxproject -p 8082:80 -v &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;/web:/usr/share/nginx/html:ro -d nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we can see our site will be working on 8082 port.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dictionary&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;ps&lt;/strong&gt; command to check running containers&lt;br&gt;
&lt;strong&gt;images&lt;/strong&gt; command to see available images&lt;br&gt;
&lt;strong&gt;-p&lt;/strong&gt; this flag with run use for port redirecting&lt;br&gt;
&lt;strong&gt;-v&lt;/strong&gt; is used to mount volume on the container&lt;br&gt;
&lt;strong&gt;--name&lt;/strong&gt; flag with run is used to name our container&lt;br&gt;
&lt;strong&gt;-d&lt;/strong&gt; flag means run container in detached mode. It means that it should be run in the background&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
    </item>
    <item>
      <title>Django Notes</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Fri, 21 Jul 2023 11:56:27 +0000</pubDate>
      <link>https://dev.to/samiullahsaleem/django-notes-ch4</link>
      <guid>https://dev.to/samiullahsaleem/django-notes-ch4</guid>
      <description>&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;HTTP vs HTTPS:&lt;/strong&gt;
*&lt;em&gt;HTTP (Hypertext Transfer Protocol) *&lt;/em&gt; is the standard protocol used for communication between a web browser and a web server. It is not secure, meaning the data transmitted over HTTP is not encrypted, making it vulnerable to interception and tampering by attackers. On the other hand, HTTPS (Hypertext Transfer Protocol Secure) is a secure version of HTTP. It uses encryption protocols such as SSL (Secure Sockets Layer) or TLS (Transport Layer Security) to secure the communication between the web browser and the web server. HTTPS is identified by "https://" in the URL and ensures that data transmitted is encrypted and secure.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;2. UDP vs TCP:&lt;/strong&gt;&lt;br&gt;
    *&lt;em&gt;UDP (User Datagram Protocol) and TCP (Transmission Control Protocol) *&lt;/em&gt; are both transport layer protocols used to transmit data over a network. The main differences between them are:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UDP: Provides connectionless communication and is often used for real-time applications such as video streaming, online gaming, and VoIP. It is faster but less reliable since it does not guarantee data delivery, and packets may arrive out of order or be lost.

TCP: Provides reliable, connection-oriented communication. It ensures that data packets are delivered in the correct order and without loss. TCP uses a three-way handshake to establish a connection between the sender and receiver before data transmission.

DNS (Domain Name System):
DNS is a system used to translate human-readable domain names (e.g., www.example.com) into IP addresses (e.g., 192.0.2.1) that computers can understand. When you enter a URL in your browser, the browser sends a DNS query to a DNS server, which returns the corresponding IP address. This IP address is then used to establish a connection with the appropriate web server.

Request Life Cycle:
The request life cycle refers to the process of how a web server handles a request from a client (usually a web browser). It typically involves the following steps:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;a. DNS Resolution: The client resolves the domain name to an IP address using DNS.&lt;br&gt;
b. Connection Establishment: The client establishes a TCP connection with the web server.&lt;br&gt;
c. Request Handling: The client sends an HTTP request to the server, including the requested resource, method (GET, POST, etc.), and other headers.&lt;br&gt;
d. Server Processing: The web server receives the request, processes it, and generates an appropriate response.&lt;br&gt;
e. Response Sending: The server sends the response back to the client over the established TCP connection.&lt;br&gt;
f. Browser Processing: The client (browser) receives the response and renders the web page or handles the data as required.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP Request Types (GET, POST, PUT, etc.) and their Differences:
HTTP supports various request methods, each serving different purposes:

GET: Used to request data from the server. Parameters are sent in the URL, making it visible and limited in length. It is generally used for fetching data.

POST: Used to send data to the server in the request body. It is suitable for submitting forms or sending large amounts of data securely.

PUT: Used to update or replace existing data on the server with the data sent in the request body.

DELETE: Used to request the removal of a resource on the server.

PATCH: Used to apply partial modifications to a resource.

HEAD: Similar to GET but only retrieves the response headers, not the actual data.

OPTIONS: Used to request information about the communication options available for a resource.

Application Server vs. Web Server:

Web Server: A web server is responsible for handling HTTP requests from clients (browsers) and returning static content like HTML, CSS, and images. It manages the basic HTTP protocol, serves static files, and may support server-side includes. Examples include Apache HTTP Server and Nginx.

Application Server: An application server handles dynamic content and business logic. It interprets server-side code, interacts with databases, and generates dynamic HTML or other content to be sent to the client. Application servers are used to support web applications and APIs. Examples include Tomcat, Node.js, and Microsoft IIS.

How Encryption Works vs. How Hashing Works:

Encryption: Encryption is the process of converting plain text into a scrambled, unreadable form called ciphertext using an encryption algorithm and an encryption key. The recipient can decrypt the ciphertext back into the original plaintext using a decryption key. Encryption is used to secure data during transmission (e.g., HTTPS) and storage to prevent unauthorized access.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Hashing:&lt;/strong&gt; Hashing is a one-way process of converting input data (any size) into a fixed-size string of characters using a hash function. The resulting output, called a hash value or hash code, is unique to the input data. Unlike encryption, hashing is not reversible, meaning you cannot convert the hash value back into the original data. Hashing is commonly used for data integrity checks, password storage, and digital signatures.&lt;br&gt;
**&lt;br&gt;
 HTTP Headers:**&lt;br&gt;
    HTTP headers are additional pieces of information sent by the client or server in the request or response messages. They provide metadata about the request or response and allow clients and servers to pass various instructions, control caching behavior, enable CORS (Cross-Origin Resource Sharing), and set cookies, among other functionalities. Some common HTTP headers include "User-Agent," "Content-Type," "Accept," "Authorization," "Cache-Control," and "Location."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Comment Headers:&lt;/strong&gt;&lt;br&gt;
    "Comment headers" is not a standard term in web development or HTTP. It is possible that this refers to custom headers added to HTTP requests or responses for documentation purposes or additional information specific to an application or system.&lt;/p&gt;

&lt;p&gt;Above Average Topics:&lt;/p&gt;

&lt;p&gt;SSL/HTTPS Encryption and Handshake:&lt;br&gt;
&lt;strong&gt;SSL (Secure Sockets Layer)&lt;/strong&gt; and its successor TLS (Transport Layer Security) are cryptographic protocols used to secure communications over a computer network. HTTPS, as mentioned earlier, is the implementation of HTTP over TLS/SSL.&lt;/p&gt;

&lt;p&gt;The SSL/TLS handshake is the process of establishing a secure connection between a client (e.g., web browser) and a server. The handshake involves the following steps:&lt;/p&gt;

&lt;p&gt;a. Client Hello: The client sends a "Client Hello" message to the server, containing supported cryptographic algorithms and other information.&lt;/p&gt;

&lt;p&gt;b. Server Hello: The server responds with a "Server Hello" message, selecting the best cipher suite and providing its digital certificate (which includes the server's public key).&lt;/p&gt;

&lt;p&gt;c. Certificate Exchange: The client verifies the server's certificate against a trusted Certificate Authority (CA) to ensure the server's authenticity.&lt;/p&gt;

&lt;p&gt;d. Key Exchange: The client generates a random pre-master secret, encrypts it using the server's public key, and sends it to the server. Both client and server then derive the master secret from this pre-master secret.&lt;/p&gt;

&lt;p&gt;e. Session Key Generation: Both client and server independently generate session keys from the master secret, which will be used for encryption and decryption during the session.&lt;/p&gt;

&lt;p&gt;f. Encrypted Communication: The client and server exchange messages encrypted using the session keys, establishing a secure channel for further communication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nameservers:&lt;/strong&gt;&lt;br&gt;
    Nameservers are part of the Domain Name System (DNS) infrastructure and are responsible for translating domain names into IP addresses. When you enter a domain name into a browser, the browser queries a nameserver to obtain the IP address associated with that domain. There are two types of nameservers: authoritative nameservers and recursive/resolver nameservers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authoritative Nameservers:&lt;/strong&gt; These nameservers hold the official records for specific domains. They store information about the IP addresses of the servers associated with a domain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recursive/Resolver Nameservers:&lt;/strong&gt; These nameservers are used by clients (e.g., browsers) to resolve domain names. They recursively query authoritative nameservers to find the IP address associated with a given domain.&lt;/p&gt;

&lt;p&gt;Understanding SSL/HTTPS encryption, HTTP handshake, and the role of nameservers is valuable knowledge for web developers and administrators, as it helps ensure secure communication and proper functioning of web applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Django&lt;/strong&gt;&lt;br&gt;
Django is an open source web development framework. It's built on &lt;strong&gt;Jazz&lt;/strong&gt; philosophy. It means it's free and open source. &lt;br&gt;
Django also provides an optional administrative create, read, update and delete interface that is generated dynamically through introspection and configured via admin models. It provides you serialization, Caching, middleware, web server for testing, MVT architecture which is based on basically MVC and an interface to built python built in unit test. The main goals of python is simplicity, flexibility, reliability, and scalability. DRY philosophy — Don’t Repeat Yourself — which means developers can reuse existing code and focus on the unique one.&lt;br&gt;
**&lt;br&gt;
What You Can Do with Django **&lt;br&gt;
You can build ecommerce application, financial applications, face matching applications and many more. &lt;/p&gt;

&lt;p&gt;Summary,&lt;br&gt;
Django is a great addition to projects that need to handle large volumes of content (e.g., media files), user interactions or heavy traffic, or deal with complex functions or technology (e.g., machine learning). Yet it is simple enough for smaller-scale projects, or if you intend to scale your project to a much higher level. That’s why Django is used by so many companies that vary in size and goals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Loose Coupling means that your code should be modular and less dependent on other modules or dependencies.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Django Philosophy&lt;/strong&gt;&lt;br&gt;
In &lt;strong&gt;Templates&lt;/strong&gt;, avoid repetition, make it simple, using dynamic engine or interpolation for creating templates.&lt;br&gt;
In &lt;strong&gt;Model&lt;/strong&gt;, you should not assume things or characteristics. You should have good knowledge of the requirements.&lt;br&gt;&lt;br&gt;
In &lt;strong&gt;View&lt;/strong&gt;, it should be simple. Handle GET POST requests and should have loose coupling. &lt;br&gt;
In all cases, explicit is better than implicit, Simplicity, consistency, and best practices should be in mind.&lt;/p&gt;

</description>
      <category>django</category>
      <category>notes</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Devops Notes</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Thu, 20 Jul 2023 15:50:07 +0000</pubDate>
      <link>https://dev.to/samiullahsaleem/devops-notes-4mdl</link>
      <guid>https://dev.to/samiullahsaleem/devops-notes-4mdl</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is DevOPs?&lt;/strong&gt;&lt;br&gt;
There are lot of definition exist but in simple words it's all about development and operations. We automate things in it because manual work takes a lot of time to complete.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is CD/CI?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;CI&lt;/strong&gt; means &lt;strong&gt;Continuous Integration&lt;/strong&gt;. Let's suppose developers are coding for more than 3 weeks and after 3 weeks they take rest but when the code goes to build and testing. They find a lot of errors. This thing Just Sucks. So, We need to automate deployment so that we can see errors as soon we push our code or commit then automatically build and test and tells the errors if come&lt;br&gt;
Now, So we can use different tools for it like Jenkins, Circle CI etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CD&lt;/strong&gt; means &lt;strong&gt;Continuous Development&lt;/strong&gt;. Now, we have automate things from the development end and a lot of code coming to operations team because of automation. Now, we have to automate operations and testing. So, Continuous Delivery means The code automatically deploy on server and after deployment further testing can be performed by QA but this can also be automated. We can write automated test cases for our code.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python Notes</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Sun, 09 Jul 2023 14:33:57 +0000</pubDate>
      <link>https://dev.to/samiullahsaleem/python-notes-k9a</link>
      <guid>https://dev.to/samiullahsaleem/python-notes-k9a</guid>
      <description>&lt;p&gt;&lt;strong&gt;History&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python was founded by Guido and it's name taken from a BBC Comedy Series &lt;strong&gt;Monty Python's Flying Circus&lt;/strong&gt; because of it's complete and mysterious nature which python also has.&lt;/li&gt;
&lt;li&gt;It's a dynamically types language and strongly typed language.&lt;/li&gt;
&lt;li&gt;It's an interpretation language. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Syntax Rule&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It requires indentation. At least one space is required for a block.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
 &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello World"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;You can use Unicode symbol in python.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Operators in Python&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Arithmetic Operator&lt;/li&gt;
&lt;li&gt;Assignment Operator&lt;/li&gt;
&lt;li&gt;Logical Operator&lt;/li&gt;
&lt;li&gt;Bit wise Operator&lt;/li&gt;
&lt;li&gt;Comparison operator&lt;/li&gt;
&lt;li&gt;Identity Operator&lt;/li&gt;
&lt;li&gt;Membership Operator&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;pip and Virtual Environment&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;pip is a python package manager which we can use to install packages from python package index.&lt;/li&gt;
&lt;li&gt;You can create virtual environment where you can have complete copy of python, pip etc. It will help you to avoid dependencies error etc.&lt;/li&gt;
&lt;li&gt;Install virtualenv globally
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;virtualenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create virtual environment using
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;virtualenv&lt;/span&gt; &lt;span class="n"&gt;env&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Activate environment on 
linux
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nb"&gt;bin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;activate&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Windows&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;env&lt;/span&gt;\&lt;span class="n"&gt;Scripts&lt;/span&gt;\&lt;span class="n"&gt;activate&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;pipenv makes it easy because it combines pip and virtual environment in one single tool. It generate pipfile which has all dependencies with their versions. It also generates pipfile.lock which lock the versions of the packages so that they work fine.
&lt;strong&gt;Control Structures&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;While Loop:
The while statement repeats a body of code as long as a condition is true.&lt;/li&gt;
&lt;li&gt;For Loop:
It's mostly use to iterate over number of items.&lt;/li&gt;
&lt;li&gt;list comprehension:
A list comprehension allows you to easily create a list based on some processing or selection criteria.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;l1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Type Casting&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Type Conversion is the conversion of an object from one data type to another data type.&lt;/li&gt;
&lt;li&gt;Implicit Type Conversion is automatically performed by the Python interpreter.&lt;/li&gt;
&lt;li&gt;Python avoids the loss of data in Implicit Type Conversion.&lt;/li&gt;
&lt;li&gt;Explicit Type Conversion is also called Type Casting, the data types of objects are converted using predefined functions by the user.&lt;/li&gt;
&lt;li&gt;In Type Casting, loss of data may occur as we enforce the object to a specific data type.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Exception Handling&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;try/except block
If the code in try block failed then the code in except block will run&lt;/li&gt;
&lt;li&gt;try/except/else block
If the code in the try block failed then except block code will run and if the code in try block becomes successful then the code in the else block will run. If any exception occurs in the else block code then the above try/except block will not work. &lt;/li&gt;
&lt;li&gt;try/except/else/finally block
It has an extra finally block which always run either the code makes an error or not.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Functions&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Benefits of function are &lt;strong&gt;reuseability and readability&lt;/strong&gt;
&lt;strong&gt;Partial Function&lt;/strong&gt;
Partial functions allow us to fix a certain number of arguments of a function and generate a new function.
e.g
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;

&lt;span class="c1"&gt;# A partial function that calls f with
# a as 3, b as 1 and c as 4.
&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;partial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Calling g()
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Lambda Function&lt;/strong&gt;&lt;br&gt;
In Python, a lambda function is a special type of function without the function name. For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;greet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"sami"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;add&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can use &lt;strong&gt;filter&lt;/strong&gt; or &lt;strong&gt;map&lt;/strong&gt; to find filter out our list. E.g&lt;br&gt;
Filter return new list with new values and map return True or False list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;list1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;list2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;list1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# The Output will be -&amp;gt; [2,4]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Monkey Patching&lt;/strong&gt;&lt;br&gt;
In Python, the term monkey patch refers to dynamic (or run-time) modifications of a class or module. In Python, we can actually change the behavior of code at run-time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collection (Arrays)&lt;/strong&gt;&lt;br&gt;
There are four types of collection data types in python.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;List&lt;/li&gt;
&lt;li&gt;Set&lt;/li&gt;
&lt;li&gt;Dictionary&lt;/li&gt;
&lt;li&gt;Set&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;1.&lt;strong&gt;List&lt;/strong&gt;&lt;br&gt;
List is a collection which is ordered and changeable. Allows duplicate members.&lt;br&gt;
Time Complexity: O(1)&lt;br&gt;
Space Complexity: O(1)&lt;br&gt;
List operations:&lt;br&gt;
append,pop,remove,del sort, reverse, clear, and insert&lt;br&gt;
We use the extend() method to add all the items of an iterable (list, tuple, string, dictionary, etc.) to the end of the list&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;even_numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# add elements of even_numbers to the numbers list
&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;even_numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"List after append:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.&lt;strong&gt;Tuple&lt;/strong&gt;&lt;br&gt;
Tuple is a collection which is ordered and unchangeable. Allows duplicate members. Tuples are immutable &lt;br&gt;
&lt;strong&gt;Operations&lt;/strong&gt;&lt;br&gt;
append,comp,len,min,max,tuple&lt;br&gt;
3.&lt;strong&gt;Sets&lt;/strong&gt;&lt;br&gt;
A Set in Python programming is an unordered collection data type that is iterable, mutable and has no duplicate elements. This is based on a data structure known as a hash table. Since sets are unordered, we cannot access items using indexes as we do in lists.&lt;br&gt;
**Frozen sets **in Python are immutable objects that only support methods and operators that produce a result without affecting the frozen set or sets to which they are applied. It can be done with frozenset() method in Python.&lt;/p&gt;

&lt;p&gt;While elements of a set can be modified at any time, elements of the frozen set remain the same after creation. &lt;br&gt;
&lt;strong&gt;Operations:&lt;/strong&gt;&lt;br&gt;
add,discard, union, intersection, difference&lt;br&gt;
4.&lt;strong&gt;Dictionary&lt;/strong&gt;&lt;br&gt;
Dictionary is a collection which is ordered (prior to Python 3.6, dictionaries were&lt;br&gt;
unordered) and changeable. No duplicate members.&lt;br&gt;
&lt;strong&gt;Operations&lt;/strong&gt;&lt;br&gt;
pop, popitem, del, insert new values&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strings&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Escape Sequencing in Python
You use single quotes, double quotes or triple quotes for printing a string but you can't use quotes inside the string.So, we use backslash for it. The element next to backslash deal in new meanings rather than literal meanings.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;l1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;Hello World&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Formatting in Strings
We use &lt;em&gt;format()&lt;/em&gt; function for formatting 
Strings in Python can be formatted with the use of format() method which is a very versatile and powerful tool for formatting Strings. Format method in String contains curly braces {} as placeholders which can hold arguments according to position or keyword to specify the order.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Sami Ullah"&lt;/span&gt;
&lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"My name is {} and My age is: {}"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Methods&lt;/strong&gt;&lt;br&gt;
Capitalize, lower, upper, endswith, startswith&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Object Oriented Programming&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Abstraction -&amp;gt; In this you hide implementation of an object from the user.&lt;/li&gt;
&lt;li&gt;Encapsulation -&amp;gt; In this, you combine data and methods with in a class to protect the data from external interference. &lt;/li&gt;
&lt;li&gt;Inheritance -&amp;gt; It is a way to create new classes based on existing ones, allowing the new classes to inherit the attributes and methods of the parent class. &lt;/li&gt;
&lt;li&gt;Polymorphism -&amp;gt; It allows objects of different classes to be treated as if they were of the same class, making it possible to write generic code that can work with a variety of objects.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;There are two types of attributes 1) Instance Attribute -&amp;gt; This is described in constructor 2) Class Attribute -&amp;gt; This is described outside of the constructor.&lt;br&gt;
&lt;strong&gt;Name mangling&lt;/strong&gt; is a mechanism we use for accessing the class members from outside. The Python interpreter rewrites any identifier with “&lt;strong&gt;var” as “_ClassName&lt;/strong&gt;var”. And using this you can access the class member from outside as well.&lt;br&gt;
Namespaces and Scopes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When Python tries to interpret your code, one key task is to understand what variables and functions that you refer to. To get the job done, Python uses namespaces to track the variables and functions that it can search. Specifically, you can think of namespaces as dictionaries that store all the variables that are available to you — they are tools in your tool boxes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scopes are a concept closely related to namespaces. Scopes define boundaries where Python can resolve the variables (resolve means Python understands what variables it should use). As mentioned above, namespaces are tracking the tools in your boxes, while scopes are different tool boxes — some are larger and some are smaller (local scope for a function) and embedded in larger scopes (e.g., global scope for the module).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Python, an &lt;strong&gt;abstract function&lt;/strong&gt; is a function that is declared but does not have an implementation. It serves as a blueprint for subclasses to override and provide their own implementation. Abstract functions are typically used in the context of abstract classes or interfaces to enforce certain behaviors or contracts.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;abc&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abstractmethod&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Shape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ABC&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;abstractmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;area&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;pass&lt;/span&gt;

    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;abstractmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;perimeter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Rectangle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Shape&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;area&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;perimeter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Shape&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;area&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;perimeter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;

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

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Constructors&lt;/strong&gt;&lt;br&gt;
There are two types of constructors. &lt;br&gt;
1- Default Constructor&lt;br&gt;
2- Parametrized Constructor&lt;br&gt;
&lt;strong&gt;Class Methods&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s compare that to the second method, MyClass.classmethod. I marked this method with a @classmethod decorator to flag it as a &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static methods are like simple methods but belong to class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;classmethod receives the class as the first parameter (cls) and can access class-level data, while staticmethod does not receive any special parameters and does not have access to instance or class-level data.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inheritance Types&lt;/strong&gt;&lt;br&gt;
There are 5 inheritance types.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Single Inheritance&lt;/li&gt;
&lt;li&gt;Multiple Inheritance&lt;/li&gt;
&lt;li&gt;Multilevel Inheritance&lt;/li&gt;
&lt;li&gt;Hierarchical Inheritance&lt;/li&gt;
&lt;li&gt;Hybrid Inheritance&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Static Variable and Static methods&lt;/strong&gt;&lt;br&gt;
Static variables are related to class not objects and static methods related to class not objects. &lt;br&gt;
*&lt;em&gt;Function Overloading vs Function Overriding *&lt;/em&gt;&lt;br&gt;
Function overloading can be done without inheritance. In this we have two or more function with same name but with different parameters. Python doesn't support it. So, we can use parameterized functions to make it possible. It decide on compile time. It's make our code complex.&lt;br&gt;
While Function overriding occurs in inheritance. It need two classed at least. The functions should have same name and it decide on run time. It's makes our code complex.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File Handling&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;modes&lt;/strong&gt;&lt;br&gt;
r -&amp;gt; read&lt;br&gt;
w -&amp;gt; write and overridden data&lt;br&gt;
a -&amp;gt; append the file &lt;br&gt;
r+ -&amp;gt; read and write data and overridden data&lt;br&gt;
w+ -&amp;gt; write and read data and overridden data&lt;br&gt;
a+ -&amp;gt; append and read data from the file. It won't be override existing data&lt;br&gt;
You can remove file using &lt;strong&gt;os module&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'test.txt'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Iterators&lt;/strong&gt;&lt;br&gt;
An iterator is an object that can be iterated upon, meaning that you can traverse through all the values.&lt;/p&gt;

&lt;p&gt;Iterators are methods that iterate collections like lists, tuples, etc. Using an iterator method, we can loop through an object and return its elements.&lt;/p&gt;

&lt;p&gt;Technically, a Python iterator object must implement two special methods, &lt;strong&gt;iter&lt;/strong&gt;() and &lt;strong&gt;next&lt;/strong&gt;(), collectively called the iterator protocol.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# define a list
&lt;/span&gt;&lt;span class="n"&gt;my_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# create an iterator from the list
&lt;/span&gt;&lt;span class="n"&gt;iterator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;iter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# get the first element of the iterator
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterator&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# prints 4
&lt;/span&gt;
&lt;span class="c1"&gt;# get the second element of the iterator
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterator&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# prints 7
&lt;/span&gt;
&lt;span class="c1"&gt;# get the third element of the iterator
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterator&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# prints 0
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generators&lt;/strong&gt;&lt;br&gt;
A generator is a function that returns an object (iterator) which we can iterate over (one value at&lt;br&gt;
a time).&lt;br&gt;
Create Python Generator&lt;/p&gt;

&lt;p&gt;In Python, similar to defining a normal function, we can define a generator function using the def keyword, but instead of the return statement we use the yield statement.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generator_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# statements
&lt;/span&gt;    &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;something&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the yield keyword is used to produce a value from the generator.&lt;/p&gt;

&lt;p&gt;When the generator function is called, it does not execute the function body immediately. Instead, it returns a generator object that can be iterated over to produce the values.&lt;br&gt;
The yield keyword is used to produce a value from the generator and pause the generator function's execution until the next value is requested.&lt;/p&gt;

&lt;p&gt;The for loop iterates over the generator object produced by my_generator(), and the print statement prints each value produced by the generator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decorators&lt;/strong&gt;&lt;br&gt;
A decorator is a design pattern in Python that allows a user to add new functionality to an&lt;br&gt;
existing object without modifying its structure. Decorators are usually called before the definition&lt;br&gt;
of a function you want to decorate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;maketea&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Tea is making"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;maketea&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;pre&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Preperation has been done"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;Here pre is sending as argument to maketea function&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In Python, a &lt;strong&gt;first-class object&lt;/strong&gt; refers to a programming language feature where functions can be treated as values. This means that functions can be assigned to variables, passed as arguments to other functions, and returned as values from other functions. In Python, functions are first-class objects, which means they can be manipulated and used just like any other data type.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Chaining decorators&lt;/strong&gt; in Python can be done by applying multiple decorators to a function in a sequential manner&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;decorator1&lt;/span&gt;
&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;decorator2&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;example&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello World"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Shallow Copy vs Deep Copy&lt;/strong&gt;&lt;br&gt;
A shallow copy constructs a new compound object and then (to the extent possible) inserts&lt;br&gt;
references into it to the objects found in the original. A deep copy constructs a new compound&lt;br&gt;
object and then, recursively, inserts copies into it of the objects found in the original.&lt;br&gt;
Syntax of Deep copy&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Syntax: copy.deepcopy(x)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Syntax of Shallow copy&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Syntax: copy.copy(x)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Random Numbers&lt;/strong&gt;&lt;br&gt;
The Python standard library provides a module called random that offers a suite of functions for generating random numbers.&lt;/p&gt;

&lt;p&gt;Python uses a popular and robust pseudorandom number generator called the &lt;strong&gt;Mersenne Twister&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We use seed() function if we want reproduce able random numbers. Otherwise random function use epoch(1971). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PEP 8&lt;/strong&gt;&lt;br&gt;
Coding Style to follow&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Consistent Indentation&lt;/li&gt;
&lt;li&gt;The closing brace/bracket/parenthesis on multiline constructs may either line up under the first non-whitespace character of the last line of list or it may be lined up under the first character of the line that starts the multiline construct.&lt;/li&gt;
&lt;li&gt;Spaces are the preferred indentation method.&lt;/li&gt;
&lt;li&gt;Tabs should be used solely to remain consistent with code that is already indented with tabs.&lt;/li&gt;
&lt;li&gt;Python disallows mixing tabs and spaces for indentation.&lt;/li&gt;
&lt;li&gt;Import should be on seperate line&lt;/li&gt;
&lt;li&gt;Comments use and docstring use
&lt;strong&gt;Linter&lt;/strong&gt;
Linting highlights &lt;strong&gt;syntactical and stylistic&lt;/strong&gt; problems in your Python source code, which often helps you identify and correct subtle programming errors or unconventional coding practices that can lead to errors.
&lt;strong&gt;Formatter&lt;/strong&gt;
Formatter only format your code. It doesn't analyze your code and find errors in it&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;*&lt;em&gt;Difference between Linter and Formatter *&lt;/em&gt;&lt;br&gt;
Linting is distinct from Formatting because linting analyzes how the code runs and detects errors whereas formatting only restructures how code appears.&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
    </item>
    <item>
      <title>Steps to create RestAPI with Django Rest Framework</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Sun, 18 Jun 2023 20:19:23 +0000</pubDate>
      <link>https://dev.to/samiullahsaleem/steps-to-create-restapi-with-django-rest-framework-1a42</link>
      <guid>https://dev.to/samiullahsaleem/steps-to-create-restapi-with-django-rest-framework-1a42</guid>
      <description>&lt;p&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;br&gt;
1- Create a Project&lt;br&gt;
2- Create an App&lt;br&gt;
3- Create urls.py and Serializers.py file in your app&lt;br&gt;
4- Create a model&lt;br&gt;
5- Go to Serialzers.py file and create a class like TestSerializer(serliazer.ModelSerializer) and add model and fields values&lt;br&gt;
6- Go to views file and create a class TestView(APIView) and create functions like get, post, put, and delete in it&lt;br&gt;
7- Go to urls.py file and add path like path("/",TestView.as_view())&lt;br&gt;
8- Create another path to delete an object like path("/",TestView.as_view())&lt;br&gt;
Here you go, These are steps required to create restful api&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
    </item>
    <item>
      <title>The Complete Guide to Solidity Programming: Learn to Build Smart Contracts Like a Pro</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Sun, 07 May 2023 19:43:07 +0000</pubDate>
      <link>https://dev.to/samiullahsaleem/the-complete-guide-to-solidity-programming-learn-to-build-smart-contracts-like-a-pro-3cm2</link>
      <guid>https://dev.to/samiullahsaleem/the-complete-guide-to-solidity-programming-learn-to-build-smart-contracts-like-a-pro-3cm2</guid>
      <description>&lt;p&gt;As the popularity of blockchain technology increases, the demand for smart contracts has also risen. Smart contracts are digital agreements that are self-executing and can be used to automate various processes such as payments, identity verification, and more. One of the most popular programming languages used to create smart contracts is Solidity. In this guide, I will take you through everything you need to know about Solidity programming, from its basics to building complex smart contracts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction to Solidity programming&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Solidity is a high-level programming language used to write smart contracts on the Ethereum blockchain. It is similar to JavaScript and is designed to be simple, statically typed, and contract-oriented. Solidity was created by the Ethereum Foundation and is now being used by various organizations to develop decentralized applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why learn Solidity programming?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Solidity programming is a highly in-demand skill in the blockchain industry. As more businesses embrace blockchain technology, the demand for developers who can create smart contracts using Solidity has increased. Learning Solidity programming will enable you to build decentralized applications and smart contracts, which are the backbone of the blockchain ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting started with Solidity programming&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To get started with Solidity programming, you will need to install the Solidity compiler. The compiler is used to convert Solidity code into bytecode, which can run on the Ethereum Virtual Machine (EVM). Once you have installed the compiler, you can start writing your first smart contract.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solidity syntax and data types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Solidity syntax is similar to JavaScript syntax. Solidity supports various data types, including bool, int, uint, address, and more. The bool data type can have two values, true or false. The int data type is used to represent signed integers, while the uint data type represents unsigned integers. The address data type is used to represent Ethereum addresses.&lt;br&gt;
**&lt;br&gt;
Variables and functions in Solidity**&lt;/p&gt;

&lt;p&gt;Variables in Solidity are used to store data. Solidity supports various variable types, including integers, strings, and arrays. Functions are used to perform specific tasks and can be called by other functions or contracts. Solidity supports both external and internal functions.&lt;/p&gt;

&lt;p&gt;Here is the syntax to create variables and functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;MyContract&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;uint256&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;myUint&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;setMyUint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint256&lt;/span&gt; &lt;span class="n"&gt;_myUint&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;myUint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_myUint&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Control structures in Solidity&lt;/p&gt;

&lt;p&gt;Control structures are used to control the flow of code execution in Solidity. Solidity supports various control structures, including if-else statements, for loops, while loops, and more. If-else statements are used to execute code based on a condition. For loops are used to execute a block of code a specific number of times.&lt;/p&gt;

&lt;p&gt;Here is the syntax for a control structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;MyContract&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;uint256&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;myUint&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;setMyUint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint256&lt;/span&gt; &lt;span class="n"&gt;_myUint&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_myUint&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;myUint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_myUint&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;myUint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Object-oriented programming in Solidity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Solidity supports object-oriented programming concepts such as inheritance, polymorphism, and encapsulation. Inheritance is used to create a new contract that inherits from an existing contract. Polymorphism is used to create functions that can operate on different types of data. Encapsulation is used to protect data and functions from external access.&lt;/p&gt;

&lt;p&gt;Here is the syntax for object-oriented programming:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;Dog&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;view&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Woof!"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
**&lt;br&gt;
Building smart contracts with Solidity**&lt;/p&gt;

&lt;p&gt;Now that you have learned the basics of Solidity programming, it's time to build your first smart contract. In this example, we will create a simple smart contract that stores and retrieves a string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;MyContract&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;myString&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;setMyString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_myString&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;myString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_myString&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getMyString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;view&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;myString&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Popular Solidity frameworks and tools&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Solidity programming can be made easier with the use of various frameworks and tools. Here are some examples:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Truffle: A development framework that allows for easy testing, deployment, and management of smart contracts.

Remix: An online Solidity IDE that allows for easy writing, testing, and deployment of Solidity code.

Ganache: A personal blockchain that can be used for testing and development purposes.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Solidity programming is an essential skill for anyone interested in the blockchain industry. With this guide, you should now have a good understanding of Solidity syntax, data types, variables, functions, control structures, object-oriented programming, and building smart contracts. Keep practicing and experimenting with Solidity to become a pro in no time.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>smartcontract</category>
      <category>solidity</category>
    </item>
    <item>
      <title>How to create CD/CI pipeline using Jenkins</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Sat, 15 Apr 2023 08:26:02 +0000</pubDate>
      <link>https://dev.to/aws-builders/how-to-create-cdci-pipeline-using-jenkins-2n0k</link>
      <guid>https://dev.to/aws-builders/how-to-create-cdci-pipeline-using-jenkins-2n0k</guid>
      <description>&lt;p&gt;&lt;strong&gt;Today we are going to see the steps to create CD/CI pipeline&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a VM on &lt;strong&gt;AWS or Azure&lt;/strong&gt; and give security access according to your need&lt;/li&gt;
&lt;li&gt;Install docker and jenkins on your VM&lt;/li&gt;
&lt;li&gt;clone your github code on your VM&lt;/li&gt;
&lt;li&gt;Create a freestyle project on your jenkins and use Github Project url and Github repository url&lt;/li&gt;
&lt;li&gt;Your repository should contain &lt;strong&gt;Dockerfile&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Build Steps&lt;/strong&gt; options at the bottom and click on execute shell and write the same commands which you use to create a docker container using dockerfile on command line.&lt;/li&gt;
&lt;li&gt;We are automating it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, what will happens?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Jenkins fetch the code from the github and create a container using the docker file and your app will start running&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Errors:&lt;/strong&gt;&lt;br&gt;
Some errors may occur like giving permission denied you can google it and find the solution accordingly. Most of the times, it happens because of the docker user group creation. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus&lt;/strong&gt;&lt;br&gt;
Don't forget to connect your Jenkins and Github using ssh key before starting the below topic&lt;br&gt;
You can create &lt;strong&gt;Webhooks&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to your repository settings and go to webhooks.&lt;/li&gt;
&lt;li&gt;Add new Webhook and add jenkins url + /github-webhook&lt;/li&gt;
&lt;li&gt;Go to configure options of your project and go to  &lt;strong&gt;Build Triggers&lt;/strong&gt; options and select &lt;strong&gt;GitHub hook trigger for GITScm polling&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, whenever a trigger happens or your can say you change anything in your repository. Automatically, It will update the code with the new one&lt;/p&gt;

</description>
      <category>jenkin</category>
      <category>cd</category>
      <category>aws</category>
      <category>automation</category>
    </item>
    <item>
      <title>Jenkins Syntax and Logic</title>
      <dc:creator>Sami Ullah Saleem</dc:creator>
      <pubDate>Wed, 12 Apr 2023 23:42:43 +0000</pubDate>
      <link>https://dev.to/aws-builders/jenkins-syntax-and-logic-6pm</link>
      <guid>https://dev.to/aws-builders/jenkins-syntax-and-logic-6pm</guid>
      <description>&lt;p&gt;&lt;strong&gt;Environment Variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Environment variables are key-value pairs that can be used to store and retrieve data during a Jenkins build. They are often used to store sensitive data, such as API keys or passwords, that should not be hardcoded into your scripts.&lt;/p&gt;

&lt;p&gt;Here's an example of how to define an environment variable in Jenkins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipeline {
    agent any
    environment {
        MY_VARIABLE = "my value"
    }
    stages {
        stage('Example') {
            steps {
                echo "${env.MY_VARIABLE}"
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we define an environment variable called MY_VARIABLE and give it a value of "my value". We then use the echo command to print out the value of this variable.&lt;br&gt;
Parameters&lt;/p&gt;

&lt;p&gt;Parameters allow you to pass data into your Jenkins builds. They are often used to specify different configuration options or to allow users to select options at runtime.&lt;/p&gt;

&lt;p&gt;Here's an example of how to define a parameter in Jenkins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipeline {
    agent any
    parameters {
        string(name: 'MY_PARAMETER', defaultValue: 'default value', description: 'A description of the parameter')
    }
    stages {
        stage('Example') {
            steps {
                echo "${params.MY_PARAMETER}"
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we define a string parameter called MY_PARAMETER with a default value of "default value" and a description. We then use the echo command to print out the value of this parameter.&lt;br&gt;
Conditions and Logic&lt;/p&gt;

&lt;p&gt;Jenkins provides a number of different ways to perform conditional logic and branching within your builds. Here are a few examples:&lt;br&gt;
if statement&lt;/p&gt;

&lt;p&gt;The if statement allows you to perform conditional logic within a stage of your pipeline.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipeline {
    agent any
    stages {
        stage('Example') {
            steps {
                if (params.MY_PARAMETER == 'some value') {
                    echo "The parameter is set to 'some value'"
                } else {
                    echo "The parameter is set to something else"
                }
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we use an if statement to check if the value of MY_PARAMETER is equal to "some value". If it is, we print a message indicating that the parameter is set to "some value". If it is not, we print a different message.&lt;br&gt;
when condition&lt;/p&gt;

&lt;p&gt;The when condition allows you to control whether a stage should be executed based on some condition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipeline {
    agent any
    stages {
        stage('Example') {
            when {
                expression { params.MY_PARAMETER == 'some value' }
            }
            steps {
                echo "The parameter is set to 'some value'"
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we use a when condition to check if the value of MY_PARAMETER is equal to "some value". If it is, we execute the stage and print a message. If it is not, we skip the stage entirely.&lt;br&gt;
Loops&lt;/p&gt;

&lt;p&gt;Jenkins also provides a number of ways to perform loops within your pipeline. Here's an example of using a for loop to iterate over a list of items:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipeline {
    agent any
    stages {
        stage('Example') {
            steps {
                def items = ["one", "two", "three"]
                for (item in items) {
                    echo "Item: ${item}"
                }
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we define a list of items and&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloud</category>
      <category>docker</category>
      <category>jenkins</category>
    </item>
  </channel>
</rss>
