<?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: Tushar Singh</title>
    <description>The latest articles on DEV Community by Tushar Singh (@curioushugo).</description>
    <link>https://dev.to/curioushugo</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%2F1018216%2Fa0da3207-4ad3-44a9-b092-ed0bc3b9ae76.png</url>
      <title>DEV Community: Tushar Singh</title>
      <link>https://dev.to/curioushugo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/curioushugo"/>
    <language>en</language>
    <item>
      <title># DJANGO-FRAMEWORK REVIEW PAPER</title>
      <dc:creator>Tushar Singh</dc:creator>
      <pubDate>Tue, 04 Apr 2023 13:04:27 +0000</pubDate>
      <link>https://dev.to/curioushugo/-django-framework-review-paper-25pn</link>
      <guid>https://dev.to/curioushugo/-django-framework-review-paper-25pn</guid>
      <description>&lt;h2&gt;
  
  
  By Tushar Singh (email: &lt;a href="mailto:susst94@gmail.com"&gt;susst94@gmail.com&lt;/a&gt;)
&lt;/h2&gt;



&lt;p&gt;The purpose of this paper is to serve as a review board for exploring and understanding the major outliers in the tools available and how the Django-Framework is structured to allow developers in following the &lt;strong&gt;DRY&lt;/strong&gt; architecture. The paper covers 3 of the core aspects of Django-Framework architecture namely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Settings&lt;/li&gt;
&lt;li&gt;Models&lt;/li&gt;
&lt;li&gt;Django ORM&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Settings:
&lt;/h2&gt;

&lt;p&gt;In the context of the Django framework, the settings file is a Python module that contains all the configuration settings for a Django project. It is a central location for defining various aspects of your project such as database connection, middleware, installed applications, time zone, static files, authentication, logging, and more.&lt;/p&gt;

&lt;p&gt;The settings file is typically named settings.py and is located at the root of the Django project directory. It is a crucial file that determines how your Django application behaves and interacts with other components such as the database and other third-party services.&lt;/p&gt;

&lt;p&gt;Now that you the reader are acquainted with what the settings file is, let us move on to exploring some of its features and components.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Secret Key:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the context of the Django framework, a secret key is a unique and random string of characters used for cryptographic signing and securing the session data, user authentication, and other sensitive information in a Django project. It is an essential security feature that helps protect your application against various forms of attacks such as CSRF, XSS (we shall explore these later in the paper), and others.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Default Django-Apps:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Django as a framework provides a set of default applications that are included whenever a new project is created via the &lt;strong&gt;django-admin startproject&lt;/strong&gt; command. These apps get included in the &lt;strong&gt;INSTALLED_APPS&lt;/strong&gt; list within the settings.py file of the project.&lt;/p&gt;

&lt;p&gt;Some of the default Django applications are as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;django.contrib.admin&lt;/strong&gt;: This app provides the built-in Django admin interface, which allows you to manage your application's data through a web-based user interface. It provides an easy way to perform CRUD (Create, Read, Update, Delete) operations on your models and manage your site's users and groups.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;django.contrib.auth&lt;/strong&gt;: This app provides the authentication system for your Django application. It includes user authentication, password management, and permission handling.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;django.contrib.contenttypes&lt;/strong&gt;: This app provides a framework for content types, which allows you to create and manage different types of content in your application, such as blog posts, comments, or user profiles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;django.contrib.sessions&lt;/strong&gt;: This app provides support for session management in your Django application. It allows you to store and retrieve user-specific data across different requests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;django.contrib.messages&lt;/strong&gt;: This app provides support for messages framework in your Django application. It allows you to display messages to the user, such as success messages, error messages, or warning messages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;django.contrib.staticfiles&lt;/strong&gt;: This app provides support for serving static files in your Django application, such as CSS, JavaScript, and images.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;django.contrib.sites&lt;/strong&gt;: This app provides support for managing multiple sites in a single Django project.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One question that comes as a follow-up is, there's already a decent amount of default applications that serve a lot of purposes for any project. Are there more such applications present? The answer to that is yes, there are. Django provides several other built-in apps that you can use based on your project's requirements. You can also install third-party apps or create your own custom apps to extend the functionality of your Django application.&lt;/p&gt;

&lt;p&gt;We will now focus on areas that focus on features that enforce security offered by Django-framework.&lt;/p&gt;

&lt;h3&gt;
  
  
  Middleware:
&lt;/h3&gt;

&lt;p&gt;In the context of the Django framework, middleware is a component that sits between the web server and the view and provides a way to perform processing on incoming requests or outgoing responses. Middleware can be used to modify or filter requests and responses, add headers, or perform authentication and security checks. Middleware operates on the principle of the chain of responsibility, where each middleware component can modify the request or response and pass it on to the next component in the chain. Middleware can be added to your Django project using the MIDDLEWARE setting in the settings file. Following are the different kinds of middleware in Django:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Process Request Middleware&lt;/strong&gt;: This middleware runs at the beginning of the request processing cycle and can modify the incoming request or add information to it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Authentication Middleware&lt;/strong&gt;: This middleware is used for authenticating requests and checking permissions. It can be used to ensure that only authenticated users have access to certain views or to add user information to the request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Middleware for Request and Response&lt;/strong&gt;: This middleware runs after the view has been called and can modify the response or add information to it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Exception Middleware&lt;/strong&gt;: This middleware is used to catch and handle exceptions that occur during the request processing cycle. It can be used to log errors, send email notifications, or display custom error pages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security Middleware&lt;/strong&gt;: This middleware is used to enforce security policies and prevent attacks such as cross-site scripting (XSS), cross-site request forgery (CSRF), or clickjacking. It can be used to set security headers, add CSRF protection tokens, or perform content security checks.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now we shall explore a few security features which are offered as part of the Django-Framework architecture for developers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cross-site request forgery (CSRF) protection:
&lt;/h3&gt;

&lt;p&gt;This is a type of attack that tricks users into performing actions on a website without their consent. Django protects against CSRF attacks by adding a unique token to each form rendered on the site, which is then validated when the form is submitted. This token ensures that the form was submitted by the user who requested it and not by a malicious attacker.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cross-site scripting (XSS) protection:
&lt;/h3&gt;

&lt;p&gt;This is a type of attack that injects malicious scripts into a website to steal user data or hijack user sessions. Django provides protection against XSS attacks by automatically escaping all output rendered in templates, ensuring that any user-generated content is safe to display.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clickjacking protection:
&lt;/h3&gt;

&lt;p&gt;This is a type of attack that tricks users into clicking on hidden or disguised elements on a website, leading them to perform actions they didn't intend to. Django provides protection against clickjacking by setting the X-Frame-Options header in HTTP responses, which prevents the site from being embedded within an iframe on another domain.&lt;/p&gt;

&lt;h3&gt;
  
  
  Web Server Gateway Interface:
&lt;/h3&gt;

&lt;p&gt;Perhaps one of the most crucial components in terms of allowing server interaction, the Web Services Gateway Interface (WSGI) is a standard interface between web servers and web applications or frameworks, including Django. It defines a common API for communication between servers and applications, allowing for flexibility in the choice of the web server and application server. In the context of Django, the WSGI interface is used to communicate with web servers such as Apache or Nginx. The WSGI application is responsible for handling incoming HTTP requests and returning responses to the web server. &lt;/p&gt;

&lt;p&gt;The Django Framework includes a built-in WSGI application that can be used with any WSGI-compatible web server. When deploying a Django application to a production environment, the WSGI interface is typically used to communicate with the web server.&lt;/p&gt;

&lt;p&gt;We now traverse into the next section of the Django Framework which helps in establishing our project database and allow working with it to serve the purpose of our application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Model:
&lt;/h2&gt;

&lt;p&gt;In the Django framework, the &lt;strong&gt;model&lt;/strong&gt; file is a Python module that defines the structure and behavior of a database table. It is one of the three major components of the Model-View-Controller (MVC) design architecture used in Django. The model file is responsible for defining the fields of a database table, their types, and any relationships between tables. It also defines the behavior of the table, such as validation rules, default values, and custom methods. The model file is an essential component of the Django-ORM system (explored in this paper). The Django-ORM provides a high-level interface for managing data and interacting with the database.&lt;/p&gt;

&lt;h3&gt;
  
  
  On_delete CASCADE:
&lt;/h3&gt;

&lt;p&gt;From the perspective of working with databases in our project which uses the Django-Framework, &lt;strong&gt;'on_delete'&lt;/strong&gt; is a parameter that used for dictating the behavior of a foreign key when the referenced object is deleted. The option &lt;strong&gt;'on_delete=CASCADE'&lt;/strong&gt; is a fairly common option that is used, which specifies that when the referenced object is deleted, all objects which have that specific foreign key shall be deleted.&lt;/p&gt;

&lt;p&gt;Consider the following code snippet which shows the usage of the &lt;strong&gt;'on_delete'&lt;/strong&gt; parameter while defining our database in models.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Batch(models.Model):
    name = models.CharField(max_length = 50)

class Review(models.Model):
    title = models.CharField(max_length = 30)
    entrant = models.ForeignKey(Batch, on_delete = models.CASCADE)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;strong&gt;Review&lt;/strong&gt; model has a foreign key to the &lt;strong&gt;Batch&lt;/strong&gt; model, and the on_delete parameter is set to CASCADE. This means that if a &lt;strong&gt;Batch&lt;/strong&gt; object is deleted, all &lt;strong&gt;Review&lt;/strong&gt; objects that have a foreign key pointing to that &lt;strong&gt;Batch&lt;/strong&gt; will also be deleted.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fields and Validators:
&lt;/h3&gt;

&lt;p&gt;Now we shall explore 2 more components which help add more depth and detail in defining our database for our project i.e. &lt;strong&gt;Fields&lt;/strong&gt; and &lt;strong&gt;Validators&lt;/strong&gt;. In the Django framework, fields and validators are used to define the structure and validation rules of the data stored in a database table. Fields represent the columns of the table, and validators are used to ensure that the data stored in those columns is valid.&lt;/p&gt;

&lt;p&gt;Fields in Django can be of different types, such as &lt;strong&gt;CharField&lt;/strong&gt;, &lt;strong&gt;IntegerField&lt;/strong&gt;, &lt;strong&gt;DateField&lt;/strong&gt;, and so on. Each field type has its own set of options that can be used to customize its behavior. For example, the &lt;strong&gt;CharField&lt;/strong&gt; has an optional max_length parameter, which sets the maximum length of the field.&lt;/p&gt;

&lt;p&gt;Validators, on the other hand, are functions that are used to validate the data stored in a field. They can be used to ensure that the data meets certain criteria, such as being within a certain range, or having a specific format.Django provides a number of built-in validators, such as MinValueValidator, MaxValueValidator, RegexValidator, etc.&lt;/p&gt;

&lt;p&gt;Following code snippet will help in getting a better idea of Fields and Validators:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator

class Shop(models.Model):
    toolName = models.CharField(max_length=100)
    toolDesigner = models.CharField(max_length=50)
    production_date = models.DateField()
    toolPrice = models.DecimalField(max_digits=5, decimal_places=2, validators=[
        MinValueValidator(0.01),
        MaxValueValidator(999.99)
    ])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code snippet, the Shop model has fields for different tools available (&lt;strong&gt;toolName&lt;/strong&gt;), the company designing the tool (&lt;strong&gt;toolDesigner&lt;/strong&gt;), production_date, and its price. The price field is a DecimalField, which has a maximum of 5 digits, with 2 digits after the decimal point. It also has two validators, MinValueValidator and MaxValueValidator, which ensure that the price is between 0.01 and 999.99.&lt;/p&gt;

&lt;h3&gt;
  
  
  Modules and Classes:
&lt;/h3&gt;

&lt;p&gt;Now this might be seem a bit strange to introduce this small section but no harm no foul in gaining a bit more conceptual clarity.&lt;/p&gt;

&lt;p&gt;A class in python is a template for creating objects with a set of attributes and methods. A class can be thought of as a user-defined data type that encapsulates data and functionality.&lt;/p&gt;

&lt;p&gt;A module on the other hand s a file containing Python definitions and statements. It can be thought of as a collection of related functions, classes, and variables that can be used in other Python programs. A module can be imported into a Python program using the &lt;strong&gt;import&lt;/strong&gt; statement.&lt;/p&gt;

&lt;p&gt;The final section of this paper will be dedicated to understanding the &lt;strong&gt;Object-Relational-Mapping (ORM)&lt;/strong&gt; technique and few concepts related to transactions in Database Management Systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Django ORM:
&lt;/h2&gt;

&lt;p&gt;In software engineering, ORM is a technique used in software engineering to convert data between incompatible type systems in object-oriented programming languages and relational databases.&lt;/p&gt;

&lt;p&gt;In the context of Django Framework, the ORM system provides a high-level API for querying and manipulating data in a relational database. Instead of writing SQL queries directly, developers can use Django's ORM to define models that represent the data in their application and then use a Pythonic syntax to perform database operations. Django's ORM allows developers to define database tables as Python classes, which can be used to create, retrieve, update, and delete data in the database. Each model represents a database table, and each attribute of the model corresponds to a column in the table.&lt;/p&gt;

&lt;p&gt;The following section acquaints the reader with using ORM queries in the Django shell and turning the ORM queries to SQL in the Django Shell:&lt;/p&gt;

&lt;h3&gt;
  
  
  ORM in Django Shell:
&lt;/h3&gt;

&lt;p&gt;The way to access the Django shell is simply with the use of the command&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;python manage.py shell&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once activated, developers can use Django's ORM to work with the database. Consider the following model saving  &lt;strong&gt;player&lt;/strong&gt; info for a tournament with fields defined as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Player(models.Model):
    name = models.CharField(max_length=50)
    country = models.CharField(max_length=30)
    age = models.IntegerField()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we wish to retrieve all players registered for the tournament, we can simply do the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from &amp;lt;appname&amp;gt;.models import Player

players = Player.objects.all()

for currentPlayer in players:
    print(currentPlayer.name, currentPlayer.age, currentPlayer.country)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To search for players who are above a certain age group we can simply do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adultPlayers = Players.objects.filter(age__gte = 21)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Methods such as &lt;strong&gt;get(), exclude(), order_by(), and count()&lt;/strong&gt; which are provided by Django's ORM can add more tools in performing even more queries.&lt;/p&gt;

&lt;h3&gt;
  
  
  ORM to SQL:
&lt;/h3&gt;

&lt;p&gt;The Django shell interface allows us to use the query attribute of a QuerySet object to get the corresponding SQL query that will be executed by the ORM. Following code snippets will help show how to do so:&lt;/p&gt;

&lt;p&gt;Let's use our previous model of players once again.&lt;/p&gt;

&lt;p&gt;To retrieve all players once again we will simply do as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from &amp;lt;appname&amp;gt;.models import Player

players = Player.objects.all()
player_query = players.query
print(player_query)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our previous age group filter can be converted into a query like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adult_query = adultPlayers.query
print(adult_query)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We shall now explore some concepts which draw a lot of relation with some important SQL concepts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Aggregations:
&lt;/h3&gt;

&lt;p&gt;Aggregations in general are operations that perform calculations on a set of database records and return a single value. These operations are typically used to summarize or analyze data in the database. Django's ORM provides several aggregation functions that can be used to perform aggregations on QuerySets. These functions are called on a QuerySet object and return a single value.&lt;br&gt;
Commonly used aggregation functions included in Django's ORM include &lt;strong&gt;Count, Sum, Avg, Min, Max&lt;/strong&gt; which all as you can expect actually mean what they mean in the literal sense.&lt;/p&gt;
&lt;h3&gt;
  
  
  Annotations:
&lt;/h3&gt;

&lt;p&gt;In Django's ORM, annotation is a feature that allows us to add extra information to each object in a QuerySet. This extra information can either be the result of a database aggregation, a related object, or a calculated value based on other fields in the model. Following is a snippet of a general annotation operation on a QuerySet of delivery data saved within a projects database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;runsData = deliveryData.objects.filter(match_id__season=2016).values('bowling_team').annotate(extra_runs=Sum('extra_runs'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Migration File and its Necessity:
&lt;/h3&gt;

&lt;p&gt;Perhaps a more commonly missed out file, yet maybe the most important file in a Django project structure (besides the settings file) is the &lt;strong&gt;migration&lt;/strong&gt; file. The migration file is a script that represents a set of changes to the database schema. Migration files are used to apply and track changes to the database schema as your Django application evolves over time.&lt;/p&gt;

&lt;p&gt;When a change is made to your models, such as adding a new field or changing the data type of an existing field,a new migration file needs to be created to represent those changes. The migration file contains instructions on how the database schema needs to be updated to match the new model definition.&lt;/p&gt;

&lt;p&gt;Migration files employ the &lt;strong&gt;makemigrations&lt;/strong&gt; management command, which analyzes our models and generates the appropriate migration files.&lt;/p&gt;

&lt;p&gt;The need and necessity for migration file come due to the fact that it is needed to keep the database schema in sync with our models and ensure that our application can function correctly. Without migrations, changes to our models could cause errors or data loss when running our application or performing database operations.&lt;/p&gt;

&lt;p&gt;Perhaps a very important concept related to maintaining and creating databases will be discussed in the following section.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL TRANSACTIONS and ATOMIC TRANSACTIONS:
&lt;/h2&gt;

&lt;p&gt;The following content references my previous paper on SQL, the link for which is provided in the references section. A brief summary of SQL Transactions and Atomic transactions requires an understanding of transactions in the first place.&lt;/p&gt;

&lt;p&gt;A transaction as we define it in the context of databases and management systems is an operation that has definite completion states i.e. complete or incomplete. To go more into detail, Transactions can be comprised of either a single reading, writing, deletion, or updation process or a combination of either of these processes. The simplest example that one can easily relate to is that of a banking withdrawal transaction via an ATM.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;Atomic Transaction&lt;/strong&gt; is a transaction that has the property Atomicity meaning it is a transaction that ensures that each statement that constitutes a transaction is treated like an individual unit. The statement is either going to end up being executed completely or the entirety of it isn't even bothered with in the first place.&lt;/p&gt;

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

&lt;p&gt;In conclusion, I hope this review paper has provided you with a good understanding of the key concepts and features of the Django Framework. We have covered a wide range of topics, from the basics of setting up a Django project to advanced topics such as ORM queries and web services.&lt;/p&gt;

&lt;p&gt;Whether you are new to Django or a seasoned developer, there is something in this review for everyone. By the end of this review, I hope you are satisfied with the contents and feel more confident in your ability to work with the Django Framework.&lt;/p&gt;

&lt;h3&gt;
  
  
  References:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.djangoproject.com/en/4.1/"&gt;Django-Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface"&gt;Web-Service-Gateway-Interface&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping"&gt;ORM&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/curioushugo/sql-concepts-technical-paper-2ccm"&gt;SQL-Paper&lt;/a&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
    </item>
    <item>
      <title>SQL CONCEPTS TECHNICAL PAPER</title>
      <dc:creator>Tushar Singh</dc:creator>
      <pubDate>Sat, 04 Mar 2023 12:11:48 +0000</pubDate>
      <link>https://dev.to/curioushugo/sql-concepts-technical-paper-2ccm</link>
      <guid>https://dev.to/curioushugo/sql-concepts-technical-paper-2ccm</guid>
      <description>&lt;h2&gt;
  
  
  Tushar Singh (&lt;a href="mailto:susst94@gmail.com"&gt;susst94@gmail.com&lt;/a&gt;)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;During my starting days in Software Development, I always knew in the back of my mind that I would have to end up learning SQL at some point without knowing why it is that I would need to learn a language for defining, creating, managing, and even running queries for databases. Perhaps it was just word of mouth with my peers that I took it for granted, and didn't ask them the question, "What purpose does SQL serve in the day-to-day life of a Software Developer?" My moment of realization came after completing a Python project which worked on CSV files and later working on that same database but this time using SQL after learning all the basic tools and concepts and working with those ideas and writing queries. It was at that point I realized how powerful SQL can be in performing the same operations that I did with Python which required at times 30 to 40 lines of code but could easily be boiled down to 5 to 6 lines of simple queries. That was the beauty of SQL and its syntactical nature designed to perform your operation and present it in an ordered manner. And it was just the tip of the iceberg.&lt;/p&gt;

&lt;p&gt;This paper is not designed to teach you the reader SQL, because the best teacher for learning SQL is you and nobody else. The purpose of this paper is to introduce the reader to a few tools that can express the unique nature and design aspects that make SQL the powerful tool it is for working with databases.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;ACID&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;Before we can begin explaining what ACID even is in the context of databases, we need to first understand what is a &lt;strong&gt;transaction&lt;/strong&gt;. A transaction as we define it in the context of databases and management systems is an operation that has definite completion states i.e. complete or incomplete. An example would be your electric bill every month. You either pay your bill or you don't and get a notification from the local electric board that you are due on your bills. Now that we know what a &lt;strong&gt;transaction&lt;/strong&gt; is, we can introduce the ACID properties for a transaction.&lt;br&gt;
The following are the ACID properties:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Atomicity(A):&lt;/p&gt;

&lt;p&gt;"Atomicity" is the property of a transaction that ensures that each statement that constitutes a transaction is treated like an individual unit. The statement is either going to end up being executed completely or the entirety of it isn't even bothered with in the first place.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Consistency(C):&lt;/p&gt;

&lt;p&gt;As the word says, the "Consistency" property of a transaction ensures that any changes which will take place due to a transaction are going to be predictable and predetermined as well. This property is important for establishing robustness in our data. Any possible corruption in errors should not create inadvertent circumstances which harm the integrity of our table.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Isolation(I):&lt;/p&gt;

&lt;p&gt;The "Isolation" property of a transaction allows multiple users to operate on the same table simultaneously without it affecting one another. The individual transaction request occurs as if they were executing in sequential order.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Durability(D):&lt;/p&gt;

&lt;p&gt;The "Durability" property of a transaction allows our data to save any changes after the successful execution of a transaction, regardless of whether a system failure occurs.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;CAP Theorem&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;The "CAP Theorem", introduced by Professor Eric Brewer allows us in choosing a data management system that has characteristics that are essential for our application. The theorem refers to three distributed system characteristics, which are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Consistency(C):&lt;/p&gt;

&lt;p&gt;Do not confuse this with "Consistency" in &lt;strong&gt;ACID&lt;/strong&gt;. They may sound the same, but they aren't one bit. Consistency in this theorem implies that all users at any point in time see the same data regardless of which node they are connected to at that point in time. There is a small caveat though. For this to be achieved, whenever data is written via one node, it should be mimicked across all other nodes. Then and only then can the write operation be declared a success.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Availability(A):&lt;/p&gt;

&lt;p&gt;Availability implies that regardless of a node being unresponsive, a client will always get a response for making a request for data, regardless of whether the response is a success or failure.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Partition Tolerance(P):&lt;/p&gt;

&lt;p&gt;The word Parition here means that a communication error or message failure event has taken place in a system. Naturally, the word Tolerance in this context implies that regardless of these events, the system should not fail.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Joins:
&lt;/h3&gt;

&lt;p&gt;Perhaps one of the most important operations in SQL is the &lt;strong&gt;JOIN&lt;/strong&gt; operation involving multiple tables. JOIN is what allows us to work with multiple tables at the same time and perform any operation which requires fetching data from those tables simultaneously and working with them.&lt;br&gt;
Before diving into the intricacies of &lt;strong&gt;JOIN&lt;/strong&gt;, we must first understand the concept of &lt;strong&gt;PRIMARY KEY&lt;/strong&gt;. In any table, depending upon the uniqueness of different table entries and in order to distinguish said entries, we make use of &lt;strong&gt;PRIMARY KEY&lt;/strong&gt;. What this means is that we are going to choose a column and the data contained within the column is a unique identifier to uniquely all different data entries. This unique identifier becomes the basis for performing &lt;strong&gt;JOIN&lt;/strong&gt; operation as it becomes the bridge for performing a relational map between tables and hence allows us to fetch data from those tables simultaneously.&lt;br&gt;
Following are all the different types of JOIN functions available:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;INNER JOIN&lt;/li&gt;
&lt;li&gt;OUTER JOIN&lt;/li&gt;
&lt;li&gt;LEFT JOIN&lt;/li&gt;
&lt;li&gt;RIGHT JOIN&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Aggregation:
&lt;/h3&gt;

&lt;p&gt;More often than not, we are required to fetch either some form of summary or some form of inference data from a table which allows us to encapsulate it. SQL supports its users by providing specific expressions (or functions) called aggregates that help us in accomplishing that task. Some of the most commonly used aggregate functions are mentioned as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MAX: This function returns the maximum value of the column in focus&lt;/li&gt;
&lt;li&gt;MIN: This function returns the minimum value of the column in focus&lt;/li&gt;
&lt;li&gt;SUM: This function returns the total sum value of the column in focus&lt;/li&gt;
&lt;li&gt;AVG: This function returns the average value of the column in focus&lt;/li&gt;
&lt;li&gt;COUNT: This function returns the count value (which aren't NULL) of the column in focus. To include NULL values in the total count, use the * operator in the aggregate function argument space.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Filters in queries:
&lt;/h3&gt;

&lt;p&gt;In any scenario, we make use of the &lt;strong&gt;WHERE&lt;/strong&gt; clause extensively, coupled with some condition(s) to filter data specific to our needs at the time. The filtering process takes place with the help of a comparison between our filtering clause and the data present in the table whose data needs to be filtered. Following are a few keywords that we make use of to formulate our filter queries in the &lt;strong&gt;WHERE&lt;/strong&gt; clause:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;KEYWORDS&lt;/th&gt;
&lt;th&gt;OPERATIONS&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;Equal to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!=&lt;/td&gt;
&lt;td&gt;Not Equal to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;&lt;/td&gt;
&lt;td&gt;Less than&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;=&lt;/td&gt;
&lt;td&gt;Less than or Equal to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;&lt;/td&gt;
&lt;td&gt;Greater than&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;=&lt;/td&gt;
&lt;td&gt;Greater than or Equal to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BETWEEN&lt;/td&gt;
&lt;td&gt;Value between two closed limits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NOT BETWEEN&lt;/td&gt;
&lt;td&gt;Value not between two closed limits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IN (conditional_set)&lt;/td&gt;
&lt;td&gt;Value present in set provided&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NOT&lt;/td&gt;
&lt;td&gt;Value, not suffixed condition&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Normalization:
&lt;/h3&gt;

&lt;p&gt;Database Normalization is a series of steps that are used to limit and reduce data redundancy with the aim of improving data integrity and consistency. The process constitutes the organization of both columns and tables in a database with the goal of ensuring that the dependencies are enforced in a proper fashion via the integrity constraints of the underlying database. There are some underlying formal rules, mainly the &lt;strong&gt;process of synthesis&lt;/strong&gt; or &lt;strong&gt;decomposition&lt;/strong&gt; which help in accomplishing this task.&lt;/p&gt;

&lt;p&gt;It is often good practice to carry out this process for every database that we design. The process by which we take a database, and apply the set of formal rules and conditions is called Normal Forms. Following are the various categories of Normal Forms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First Normal Form&lt;/li&gt;
&lt;li&gt;Second Normal Form&lt;/li&gt;
&lt;li&gt;Third Normal Form&lt;/li&gt;
&lt;li&gt;Boyce Codd or Fourth Normal Form&lt;/li&gt;
&lt;li&gt;Fifth Normal Form&lt;/li&gt;
&lt;li&gt;Sixth Normal Form&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Indexes:
&lt;/h3&gt;

&lt;p&gt;SQL employs a concept that is widely used by programmers spanning across almost all languages, which is Indexes. Indexes in SQL are used for performing faster search operations for specific columns. In a hypothetical scenario, if there were no Index, the SQL query must begin with the starting row and then the entire table is read to find the pertinent rows. An Index in this scenario helps to quickly determine the position to search from in the table, without caring about the rest of the data present in the table. Some of the commonly used Indexes are &lt;strong&gt;PRIMARY KEY&lt;/strong&gt;, &lt;strong&gt;UNIQUE&lt;/strong&gt;,&lt;strong&gt;INDEX&lt;/strong&gt;, etc. &lt;/p&gt;

&lt;p&gt;An important thing to note is, Indexes are deemed less important for queries involving small or big tables in which report queries to analyze most of, if not all the rows. Sequential reading is faster in these scenarios compared to using an Index when a query is required to read through most of the rows anyway.&lt;/p&gt;

&lt;h3&gt;
  
  
  Transactions:
&lt;/h3&gt;

&lt;p&gt;As mentioned before during the starting section of this paper, a transaction as we define it in the context of databases and management systems is an operation that has definite completion states i.e. complete or incomplete. To go more into detail, Transactions can be comprised of either a single reading, writing, deletion, or updation process or a combination of either of these processes. The simplest example that one can easily relate to is that of a banking withdrawal transaction via an ATM. In general, there are always three stages present in this process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Balance check of the account in question&lt;/li&gt;
&lt;li&gt;Money deduction operation from the account&lt;/li&gt;
&lt;li&gt;Saving withdrawal activity into the account/bank log.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After the successful completion of all processes during this transaction, permanent changes(modifications) are made to the database reflecting the occurrence of this transaction. However, in the event an error occurs during any of the stages of the transaction, all modifications done thus far are rolled-back to secure and maintain data integrity. All of these systems in place must remind you of the &lt;strong&gt;ACID&lt;/strong&gt; properties discussed earlier, and it is exactly that. Transactions in almost all cases are designed to have &lt;strong&gt;ACID&lt;/strong&gt; properties.&lt;/p&gt;

&lt;h3&gt;
  
  
  Locking mechanism:
&lt;/h3&gt;

&lt;p&gt;Talking about SQL server transactions, another extremely crucial thing associated with said transactions is a &lt;strong&gt;Locking mechanism&lt;/strong&gt;. This mechanism is essential for allowing SQL servers to work flawlessly within a multi-ser setting. This server locking is an essential part of the insulation of objects affected by a transaction. When objects are locked, SQL servers restrict any changes of data stored in objects affected by the underlying lock. Simply put, if and when a transaction imposes a lock on an object, the rest of the transactions that need access to that specific object are forced to wait until the lock gets released. A few of the lock modes which are used consistently are :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exclusive(X)&lt;/li&gt;
&lt;li&gt;Shared(S)&lt;/li&gt;
&lt;li&gt;Update(U)&lt;/li&gt;
&lt;li&gt;Intent(I)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Database Isolation Levels:
&lt;/h3&gt;

&lt;p&gt;Continuing on our topic of transactions and them having &lt;strong&gt;ACID&lt;/strong&gt; properties, we will now explore the concept of Isolation(I) a bit more. In SQL, there is something called Isolation levels, which is used to define the extent to which a transaction has to be isolated from the resource or from the data modifications due to other concurrent transactions. There are five different levels of isolation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read Uncommitted:
Transactions at this level don't provide shared locks to block other transactions from modifying read operations via the current transaction.&lt;/li&gt;
&lt;li&gt;Read Committed:
At this level, exclusive locks are issued by transactions during data modification time, hence not allowing other transactions to read modified data that hasn't been committed yet.&lt;/li&gt;
&lt;li&gt;Repeatable Read:
At this level, statements can't read data that hasn't been committed yet and has been modified by other transactions.&lt;/li&gt;
&lt;li&gt;Serializable:
At this level, statements can't read data that has been modified yet not committed by other transactions. Until the transaction is completed, no other transactions can modify the data that has been read by the current one.&lt;/li&gt;
&lt;li&gt;Snapshot: 
At this level, any statement in a transaction that reads data shall be the transactionally consistent version of the data that existed during the start of the transaction.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Triggers:
&lt;/h3&gt;

&lt;p&gt;Lastly, we present to you the reader, the statement &lt;strong&gt;TRIGGER&lt;/strong&gt;. A trigger is a piece of code that gets executed automatically as a response to a particular event occurrence on a table within the database. A trigger always has an association with a specific table. In the event a table gets deleted, all the triggers associated are deleted automatically.&lt;/p&gt;

&lt;p&gt;A trigger is executed with the following events either before or after:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;INSERT: During new row insertion&lt;/li&gt;
&lt;li&gt;UPDATE: During existing row updation&lt;/li&gt;
&lt;li&gt;DELETE: During row deletion.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;References&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.databricks.com/glossary/acid-transactions"&gt;ACID-Reference&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.ibm.com/topics/cap-theorem"&gt;CAP-Theorem-Ref&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.edureka.co/blog/normalization-in-sql/"&gt;Normalization&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.mysql.com/doc/refman/8.0/en/mysql-indexes.html"&gt;Indexes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.sqlshack.com/transactions-in-sql-server-for-beginners/"&gt;Transactions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.sqlshack.com/locking-sql-server/"&gt;Locking&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.sqlservercentral.com/articles/isolation-levels-in-sql-server"&gt;Isolation-levels&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sql</category>
    </item>
    <item>
      <title>HTML AND CSS TECHNICAL PAPER</title>
      <dc:creator>Tushar Singh</dc:creator>
      <pubDate>Thu, 02 Mar 2023 10:03:18 +0000</pubDate>
      <link>https://dev.to/curioushugo/html-and-css-technical-paper-51m</link>
      <guid>https://dev.to/curioushugo/html-and-css-technical-paper-51m</guid>
      <description>&lt;h2&gt;
  
  
  Tushar Singh (&lt;a href="mailto:susst94@gmail.com"&gt;susst94@gmail.com&lt;/a&gt;)
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;The Internet as we know it today has gone through so many hoops of changes and transformations based on changing demands and the availability of new resources for both developers and users from different domains across the world. A comprehensive list for ranking the 20 most influential inventions of the 20th Century on the basis of both impact over the course of time and relevance in today's day and age. The list included things like Electricity Integration, Airplanes, and Television and included two advancements that have taken the world by force i.e. &lt;strong&gt;Computers&lt;/strong&gt; and &lt;strong&gt;Internet&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The way to interact and explore the Internet has changed a lot. The primary and most widely used means of interacting with the Internet for users all across the world is &lt;strong&gt;Web Pages&lt;/strong&gt;. Today almost everybody knows what a webpage is and can explain how to distinguish between different web pages from a casual standpoint. It is a whole different story when it comes to understanding how the web page comes into existence in the first place.&lt;/p&gt;

&lt;p&gt;The two most well-known forms of Languages which become the backbone for &lt;strong&gt;Web Pages&lt;/strong&gt; across the world are &lt;strong&gt;HTML&lt;/strong&gt; &amp;amp; &lt;strong&gt;CSS&lt;/strong&gt;. This paper is written with the intention to get the reader acquainted with features and properties behind the most widely used interface which allows us to explore the Internet as we know it aka &lt;strong&gt;Web Pages&lt;/strong&gt;. Let us explore some of those properties and features:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Box Model&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To understand how to build a piece of art, it is important for a painter to do research regarding what type of canvas he will use for his project. Similarly, we as developers need to understand the base layout/skeleton of our webpage and how we can use it to dictate the structure and placement of our content in it. Here is the &lt;strong&gt;Box-Model&lt;/strong&gt; aka the canvas that we use:&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%2Fw95re6dif2bp6aa1d4p2.png" 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%2Fw95re6dif2bp6aa1d4p2.png" alt="Box-model-reference" width="384" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The main components of our Box Model include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Content: As the word says, the "Content" box contains the content pertaining to our item/element in consideration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Padding: Padding is the extra space that is either explicitly provided or the default spacing provided by the browser between the border and the content window.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Border: The outline of the content window including the padding space.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Margin: The final amount of spacing added between the border and the container which houses the item/elements content.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Inline vs Block Elements&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Block-level elements are elements that always begin on a new line and follow a stack layout by following one after another while also occupying the complete width present at that instance.&lt;/p&gt;

&lt;p&gt;Inline-level elements are elements that do not begin on a new line, unlike block-level. They follow a regular flow chart of a document by line in succession. Inline line elements allow nesting with one another. They, however, do not allow wrapping with block-level elements. In most cases, inline elements are used with small pieces of content for eg: a phrase or a quote, etc.&lt;/p&gt;

&lt;p&gt;Refer to the following codepen segment for understanding how these different elements work:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/curioushugo/embed/OJopZPr?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Positioning (Relative/Absolute)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Content positioning and placement are the cruces that define if a website is going to appeal to the masses and gain enough traction to increase traffic to the website. We as humans always try to look for patterns in anything that we witness and focus on details that improve the appeal of the subject matter. It is imperative that a web developer understand how positioning property works in CSS to get the most out of it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Absolute Positioning:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This positioning property is reliant upon the elements positioning relative to their near-most ancestor. Depending upon how we use the top, down, left, and right properties we can switch the position of the item while making sure that it does not occupy space in its original position. This could create overlapping scenarios with other pieces of content(elements/items) on the webpage.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Relative Positioning:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This positioning property depends upon the elements/item's original position in the document. This positioning property also makes use of the top, down, left, and right properties in altering the positions of items while also making sure that it occupies space in their original position. This could create complications since it may also affect the positioning of nearby elements on the webpage. &lt;/p&gt;

&lt;p&gt;Following codepen window demonstrates how relative and absolute positioning differ by simultaneously adjusting both positions for different items:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/curioushugo/embed/oNPZydv?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;CSS Structural Classes&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Perhaps the most important and key aspect apart from understanding layout and positioning in HTML and CSS is the hierarchical arrangement of all elements and different pieces of content with the help of classes. This hierarchy of arranging elements with a parent/child (in some cases even extended or nested child) relationship, makes for targeting and introducing stylistic changes based on design requirements for different pieces of content for a webpage. Some of the ways to access these child classes of parent elements in the hierarchy are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"first-child": This corresponds to elements that precede other siblings in a family hierarchy of an element/container.&lt;/li&gt;
&lt;li&gt;"nth-child": This corresponds to elements that fall into an evaluated position dictated by an expression.&lt;/li&gt;
&lt;li&gt;"last-child": As the word says, the last child corresponds to the last element in a sibling hierarchy of an element/container.&lt;/li&gt;
&lt;li&gt;"nth-last-child": Same as "nth-child" but this time the position will begin from the end and still employ the expression evaluation.&lt;/li&gt;
&lt;li&gt;"only-child": This represents the element in a hierarchy that is the sole offspring of a parent element and doesn't consist of any other child elements.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;CSS Styling Classes&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;It has become a norm from a readability, screen reading, browser ranking, and debugging standpoint to make HTML and CSS code semantic in nature. Thus following are the most commonly used CSS Styling classes used to inculcate the practice of writing semantic code for websites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;.container: Perhaps the most used block-level element for organizing elements in a content box with a wide variety of elements such as a navigation menu.&lt;/li&gt;
&lt;li&gt;.form: An important class if your website requires you to fetch info from the user in a structured manner for various purposes such as account creation, event registrations, ticket bookings, etc.&lt;/li&gt;
&lt;li&gt;.navbar: As the name suggests, this class is used for forming the navigation bar that is pretty much prevalent on every website today. The primary purpose of the navbar is to provide easy navigation options within different prominent sections of a website.&lt;/li&gt;
&lt;li&gt;.header: This class is mostly used as both a semantic and style option for adding the beginning section of either a blog post or perhaps even the main webpage.&lt;/li&gt;
&lt;li&gt;.footer: Similar to the header, his class is mostly used as both a semantic and style option for adding the ending section of either a blog post or webpage, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;CSS Specificity&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;CSS reads out as Cascading Style Sheets. From the name itself, you can infer that every style change is conducted in the top-to-bottom order and any change relevant to a specific element always refers back to the last instance of the style sheet query found in the CSS file. Unfortunately, with websites as big as they are today, it is important to have a distinct set of rules which will help determine the priority for bringing about a style change regarding a specific piece of content or perhaps for pieces of content in conjunction. CSS introduces a rule set for determining priority with regards to bringing about the style change, which is called the &lt;strong&gt;Specificity&lt;/strong&gt; algorithm. The algorithm is a weighted 3-digit number based on ID, CLASS, and TYPE respectively for determining the weight number that will be taken into consideration for bringing the final style change for the respective item in the webpage. The default weight digit starts from a &lt;strong&gt;0-0-0&lt;/strong&gt; and is updated on per case basis depending upon the CSS definition for all items. We shall look into the weight categories now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ID: Highest priority based on ID selectors. The contribution is &lt;strong&gt;1-0-0&lt;/strong&gt; to the final weight value.&lt;/li&gt;
&lt;li&gt;CLASS: Second in the priority order based on Class selectors (including pseudo-classes). The contribution is &lt;strong&gt;0-1-0&lt;/strong&gt; to the final weight value.&lt;/li&gt;
&lt;li&gt;TYPE: Base elements such as &amp;lt;p&amp;gt;, &amp;lt;h1&amp;gt;,&amp;lt;h2&amp;gt; etc belong to this category. The contribution to the weight value is &lt;strong&gt;0-0-1&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is another category which is called universal selector which adds no value to the weight calculator.&lt;/p&gt;

&lt;p&gt;To summarize:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ID(1-0-0) &amp;gt; Class(0-1-0) &amp;gt; Type (0-0-1)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  7. &lt;strong&gt;CSS Responsive/Queries&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;With the advent of mobile phones, it was only a matter of time that web browsers which could only be accessed via PCs at the start would get incorporated into mobile phones eventually. This meant that the permitted content space for web pages would be reduced significantly. Thus web pages need to adapt to changing resolutions and alter their behavior as well depending upon the type of device that is accessing the web page. At this point, we introduce the "CSS Responsive Queries" which allow us to incorporate these adaptive features for web pages on the basis of the device viewport and change its layout and structural integrity which wouldn't irk the user to move away from their preferred choice of peripherals. Following is a code segment of a typical &lt;strong&gt;media&lt;/strong&gt; query used for adding responsive design to a webpage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@media only screen and (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: .6fr .2fr repeat(3, minmax(100px,1.5fr)) .2fr .6fr;
        /* minmax used to set minimum width of a,b,c for small mobile devices */
        grid-template-areas:
            "Header"
            "."
            "a"
            "b"
            "c"
            "."
            "footer";
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8. &lt;strong&gt;Flexbox/Grid&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;It is borderline impractical to solely depend upon using relative and absolute positioning to dictate the placement of a website's content considering that today's websites are loaded with dense content and that is due to the fact that the resource pool for all browsers and the types of peripherals that people use keeps on growing. Thus to make the most out of the situation and increase the efficiency from both a development and structural standpoint of a website, developers make use of two very powerful layout options which are &lt;strong&gt;Flexbox&lt;/strong&gt; and &lt;strong&gt;Grid&lt;/strong&gt;. We shall see both briefly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flexbox:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The flexbox layout is an efficient way of laying out items in a container in a 1-dimensional fashion. The placement can be either row-based or column-based depending upon the direction attribute provided while setting the display option for a container to flex.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Grid:&lt;/p&gt;

&lt;p&gt;If the flex is a 1-dimensional option for placing items in a container in a stack-esque fashion, then the grid is a higher-order execution of that same concept but in a 2d layout. This allows for more control and freedom over organizing items in a container. This leads to ease of execution in designing complex layouts as well as making them responsive with the help of properties such as &lt;strong&gt;grid-template-areas&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Following codepen window can be used to demonstrate the difference in behavior and output generated via grid and flexbox.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/curioushugo/embed/OJopoKP?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  9. &lt;strong&gt;Common Header meta Tags&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In the head section of any HTML document, meta tags are used to provide additional information relevant to the browser and its operational needs for the webpage. We call these additional sets of information &lt;strong&gt;metadata&lt;/strong&gt;. The metadata allows the analysis of HTML files and easier content maintenance. Nowadays the importance of metadata has decreased on a consistent basis, yet it is considered a healthy practice to at the very least include some metadata that can be useful for search scripts for search engines. Following are some of the most important meta info still used and considered as a healthy practice for designing webpages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Title&lt;/li&gt;
&lt;li&gt;Character Encoding&lt;/li&gt;
&lt;li&gt;Description&lt;/li&gt;
&lt;li&gt;Author&lt;/li&gt;
&lt;li&gt;Copyright&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  10. &lt;strong&gt;Animations&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;Any successful website tries to bring in some form of either subtle or well-executed animation to add another level of detail for leaving a lasting impression in the user's mind to perhaps compel him/her to visit the website at a later point, sooner rather than later. Nowadays a user hardly spends more than 3 to 4 minutes on average while visiting a website. It becomes a task in itself to retain users on a consistent basis. Animations can be useful in that sense to add a unique feature. Following are some examples via codepen segments to display some simple yet introductory-level animations you can incorporate into your website:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/curioushugo/embed/LYJWgzo?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Try noticing the different animations that occur open hovering over the different sections of the boxes. You can even create your own timings and changes during animation by fidgeting with the CSS code.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I hope this paper managed to serve its purpose to the reader with the expectation of getting a second-hand idea of the different sets of features that can be considered as a starting point for building a stand-alone website. The requirements and tools needed for building a fully functional and scalable website keep on growing based on the expectations and aim set by the designer. Ultimately, the more you challenge yourself with websites and how you build them and retroactively learn from the experience in identifying your mistakes or approach and integrate those lessons for future projects, the better you will get at it.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.ionos.com/digitalguide/websites/web-development/the-most-important-meta-tags-and-their-functions/" rel="noopener noreferrer"&gt;Meta-tags&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/#aa-flex" rel="noopener noreferrer"&gt;Flexbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://css-tricks.com/snippets/css/complete-guide-grid/" rel="noopener noreferrer"&gt;Grid&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.web4college.com/css/web4-css-structural-classes.php" rel="noopener noreferrer"&gt;Structural-Classes&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>help</category>
      <category>api</category>
      <category>freebies</category>
    </item>
    <item>
      <title>SOLID PRINCIPLES TECHNICAL PAPER</title>
      <dc:creator>Tushar Singh</dc:creator>
      <pubDate>Wed, 22 Feb 2023 05:31:42 +0000</pubDate>
      <link>https://dev.to/curioushugo/solid-principles-technical-paper-5gae</link>
      <guid>https://dev.to/curioushugo/solid-principles-technical-paper-5gae</guid>
      <description>&lt;h2&gt;
  
  
  Tushar Singh (&lt;a href="mailto:susst94@gmail.com"&gt;susst94@gmail.com&lt;/a&gt;)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Introduction:
&lt;/h3&gt;

&lt;p&gt;Software development as we know it today has become resource centric from an efficiency standpoint. The metrics for efficiency which all the different designs have been aiming for a long time now are all boiling down to one term which is &lt;strong&gt;Resource Allocation&lt;/strong&gt;. This one term can be applied to all the components relevant to designing any small-scale or large-scale project.&lt;/p&gt;

&lt;p&gt;The most common components that require efficient &lt;strong&gt;Resource Allocation&lt;/strong&gt; in today's software are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expansive Architecture (Upgradation)&lt;/li&gt;
&lt;li&gt;Limited Dependency between features&lt;/li&gt;
&lt;li&gt;Efficient testing and bug tracking&lt;/li&gt;
&lt;li&gt;Efficient Maintenance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These components in conjunction with efficient &lt;strong&gt;Resource Allocation&lt;/strong&gt; become the make-or-break prerequisites for any software to either survive and thrive in today's fast-moving market or succumb to the pressure and not even see the light of day on any system and ultimately get shut down.&lt;/p&gt;

&lt;p&gt;Developers from their very early coding days are exposed to the idea of &lt;strong&gt;Object Oriented Programming (OOP)&lt;/strong&gt; and its features which become a stepping stone for building robust and efficient software. There is one other set of rules and principles that in conjunction with OOP become the very foundation for the inception of any software. Those principles are known as the &lt;strong&gt;SOLID&lt;/strong&gt; Principles of design architecture. The purpose of this paper is to get the reader a better perspective of these principles with the help of some code snippets to help form a relational map.&lt;/p&gt;

&lt;h2&gt;
  
  
  SINGLE RESPONSIBILITY PRINCIPLE (S):
&lt;/h2&gt;

&lt;p&gt;The long and short of this principle is that &lt;strong&gt;"A class should have only one reason to change"&lt;/strong&gt;. To further expand on this idea, what it means is that each class and its modules serve a singular purpose for the project to be undertaken and nothing else. This ensures having small and readable code for our project. Consider the following snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    class Library():

        def __init__ (self, Lib_name, pincode, regno):
            self.Lib_name = Lib_name
            self.pincode = pincode
            self.regno = regno

        def Lib_details(self):
            print('Library Name: ',self.Lib_name)
            print('Pincode: ',self.pincode)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will be making use of different projects to expand on all the design principles. In this snippet of our library project, we are defining our library class to contain primitive attributes such as the name of the library, its associated pincode and registration number, and a method to print out the first two details. This definition makes our purpose for the class clear and concise and that is to hold the address and registration info for any library and to only print out the name and its associated pincode.&lt;/p&gt;

&lt;h2&gt;
  
  
  OPEN CLOSED PRINCIPLE (O):
&lt;/h2&gt;

&lt;p&gt;This principle states that entities such as classes, and modules should be open only for extension and not for modification. This means that any new functionalities or features should be added with the help of either new classes, attributes, or methods and one should not try to modify the current existing classes, attributes, or methods. This principle is at times considered to be the most important principle for software design.&lt;br&gt;
Consider the following snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    class Library():

        def __init__ (self, Lib_name, pincode, regno):
            self.Lib_name = Lib_name
            self.pincode = pincode
            self.regno = regno

        def Lib_details(self):
            print('Library Name: ',self.Lib_name)
            print('Pincode: ',self.pincode)


    class Books_data():

        def __init__(self):
            self.books = []

        def add_books(self,book,author,year):
            current_book = [book,author,year]
            self.books.append(current_book)

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

&lt;/div&gt;



&lt;p&gt;Say we want to store the details of all the books stored in a specific library. Instead of changing our initialization parameters in the Library class, we can simply create another class that will take care of all details for all the books in the library. Here is where &lt;strong&gt;Books_data&lt;/strong&gt; comes into the picture.&lt;/p&gt;

&lt;h2&gt;
  
  
  LISKOV SUBSTITUTION PRINCIPLE (L):
&lt;/h2&gt;

&lt;p&gt;This principle states that any derived types or references to a class must be substituted for references to the base class. This can also be interpreted as an extension of the &lt;strong&gt;Open Closed Principle(O)&lt;/strong&gt;. A very important guideline to follow which enables Liskov Substitution in our design architecture is that our user client should always behave the same regardless of the derived type instance and any new classes should extend without clashing with any functions of already present classes.&lt;br&gt;
Consider the following snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   class Mclaren():

        def __init__(self, model_name, year):
            self.model = model_name
            self.year = year

        def model(self):
            print('Presenting Mclaren {self.model}')
            print('Year of production {self.year}')

    class Anniversary(Mclaren):

        def __init__(self,rgb_freq):
            Mclaren.__init__(self)
            self.freq = rgb_freq

        def lights(self):
            print('Using rgb lights at {self.freq} Hz')
            ""
            RGB lights code
            "" 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Say we have a class called Mclaren which creates instances for different Mclaren Models produced. Mclaren now decides for pushing a special Anniversary model with extra rgb lights into production and wants to maintain the necessary data. An efficient way would be to create a new Anniversary class with Mclaren as its base class and introduce a function in the class called lights which will take care of generating the new rgb lights as part of the anniversary model.&lt;/p&gt;

&lt;h2&gt;
  
  
  INTERFACE SEGREGATION PRINCIPLE (I):
&lt;/h2&gt;

&lt;p&gt;This principle states that the user should never be forced to depend on features of a project with which he doesn't have any reason to interact in the first place. Another interpretation of this is that a project's features should be broken down into smaller interfaces. Hence the user will interact with interfaces relevant to his needs. Consider the following snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    class Mclaren():

        def __init__(self, model_name, year, mileage, capacity):
            self.model = model_name
            self.year = year
            self.mileage = mileage
            self.capacity = capacity

        def model(self):
            print('Presenting Mclaren {self.model}')
            print('Year of production {self.year}')

        def distance(self):
            dist = self.mileage*self.capacity
            print('Max distance travel potential(miles)',dist)

        def maintenance(self):
            engine_life = 200000/(self.mileage*self.capacity)
            print('Potential engine life in years: ',engine_life)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Consider the code snippet provided. We will again expand on our Mclaren class and introduce a few more functions in the class definition which all achieve a different purpose and hold no relation to each other. The responsibility for accessing these features will fall on the user. This distributed availability of features is the premise for the Interface segregation principle. &lt;/p&gt;

&lt;h2&gt;
  
  
  DEPENDENCY INVERSION PRINCIPLE (D):
&lt;/h2&gt;

&lt;p&gt;This principle states that high-level modules should never depend upon lower-level modules, rather both should depend upon abstractions. It also states that the details should depend upon the abstractions and not the other way around. This may seem straightforward to understand at first, but to gain clarity we will make use of the &lt;strong&gt;Abstract Class&lt;/strong&gt; module to introduce abstraction. Consider the code snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from abc import ABC

class game(ABC):

    def elo_calc(self):
        pass


class ELO(game):

    def elo_calc(self, wins, loss):
        total = wins+loss
        ratio = wins/loss
        if total &amp;gt; 1000:
            if ratio &amp;gt;= 1:
                return(1500)
            elif ratio != 0:
                return(1000 - (ratio)*50)
            else:
                return(500)
        else:
            print('Need 1000 minimum matches to calculate ELO')
            return 0


class chess():

    def __init__(self, player, country, wins, loss,c: game):
        self.point = c
        self.player = player
        self.country = country
        self.wins = wins
        self.loss = loss

    def get_elo(self):
        self.rating = self.point.elo_calc(self.wins, self.loss)
        return self.rating


judge = ELO()
p1 = chess('Test','India',580,470,judge)
s = p1.get_elo()
print(s)   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Say we want to calculate elo ratings for chess players based on the win-loss ratio and the number of games they've played. The formula used for calculating is very rudimentary and is used with the purpose of just demonstrating &lt;strong&gt;Dependency Inversion&lt;/strong&gt;. In our snippet, we make use of the game abstract class to become the interface that helps in establishing a bridge between the higher level module &lt;strong&gt;ELO&lt;/strong&gt; class and the lower level module &lt;strong&gt;chess&lt;/strong&gt; class. The &lt;strong&gt;ELO&lt;/strong&gt; class inherits the abstract class &lt;strong&gt;game&lt;/strong&gt;, while the chess class requires an object &lt;strong&gt;c&lt;/strong&gt; of the abstract class &lt;strong&gt;game&lt;/strong&gt; hence completing the bridge. In the main function, we create a &lt;strong&gt;judge&lt;/strong&gt; instance of &lt;strong&gt;ELO&lt;/strong&gt; (in turn, game abstract class) and pass it as an argument for chess player p1. Thus we have inverted our dependency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion:
&lt;/h3&gt;

&lt;p&gt;I hope this paper served its purpose in getting you the reader acquainted with the SOLID principles and how they function. You cannot gain complete clarity of these principles without attempting to implement these principles in your projects and identifying your mistakes during execution and then retroactively improving upon those mistakes.&lt;/p&gt;

&lt;h3&gt;
  
  
  References:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.pythontutorial.net/python-oop/python-dependency-inversion-principle/"&gt;SOLID SUMMARY&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>solid</category>
      <category>desginprinciples</category>
    </item>
    <item>
      <title>Python Technical Paper (OOPs)</title>
      <dc:creator>Tushar Singh</dc:creator>
      <pubDate>Thu, 16 Feb 2023 07:24:05 +0000</pubDate>
      <link>https://dev.to/curioushugo/python-technical-paper-oops-30mh</link>
      <guid>https://dev.to/curioushugo/python-technical-paper-oops-30mh</guid>
      <description>&lt;h2&gt;
  
  
  Paper by Tushar Singh (&lt;a href="mailto:susst94@gmail.com"&gt;susst94@gmail.com&lt;/a&gt;)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Introduction:
&lt;/h3&gt;

&lt;p&gt;Today's programming languages are in some way shape or form, all derivatives of either &lt;strong&gt;C&lt;/strong&gt; or &lt;strong&gt;C++&lt;/strong&gt; and use those as the base skeleton to build upon and design most languages. One such design feature which is especially prevalent in &lt;strong&gt;C++&lt;/strong&gt; and is simply too good to pass up and not integrate with the derived programming language is the concept of Object Oriented Programming. Objective Oriented Programming or simply called OOPs is a programming framework that allows for introducing structured and sequential programming with a more linear and distributed flow of control. This linear flow is achieved with the help of something called &lt;strong&gt;Classes&lt;/strong&gt; and &lt;strong&gt;Objects&lt;/strong&gt;. What set out as a neat little concept for introducing a linear and distributed flow of control, has become the backbone for most large-scale projects in today's day and age for improving efficiency, layout, and tracking capability to improve error detection and correction.&lt;/p&gt;

&lt;p&gt;We shall now start diving a bit into the gift that &lt;strong&gt;C++&lt;/strong&gt; gave to the programming world and how it is integrated with one of the most widely used programming languages which is &lt;strong&gt;Python&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Classes and Objects&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;To put it in as few words as possible, Classes are a relational blueprint of instance variables with method definitions that describe how these variables and methods interact with each other. We can also define the type of our instance variables if we want to for the sake of transparency and improving debugging time.&lt;/p&gt;

&lt;p&gt;A very basic representation of a class looks something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Test:

    def __init__(self, argument):

        self.value1 = argument


    def Testing(self, argument 1: DataType) -&amp;gt; Output_DataType:

        Function defintions

        return Data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What we have defined over here is a basic class definition with the class name &lt;strong&gt;Test&lt;/strong&gt; and defined an attribute associated with the class &lt;strong&gt;value1&lt;/strong&gt;. Note: if you type this code block word for word it will not work, this is meant to provide a basic understanding for you to refer to in case you wish to test it out.&lt;/p&gt;

&lt;p&gt;We use this definition to initialize and create objects in memory and those objects can store values based on the arguments provided. This same blueprint is adopted for all sorts of in-built data types in Python be it int, strings, lists, sets, tuples, dictionaries, etc. Everything reverts back to the point that everything in Python is an object including functions.&lt;/p&gt;

&lt;p&gt;The syntax for creating an instance of an object is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;""instance_name = Class_name(arguments)""

Test1 = Test("Random")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this scenario, we have created an instance Test1 of the class Test and provided "Random" as the input argument to be used for creating our object. &lt;/p&gt;

&lt;p&gt;One thing to note, which is being repeated throughout this paper is that the objective for introducing &lt;strong&gt;Classes&lt;/strong&gt; and &lt;strong&gt;Objects&lt;/strong&gt; and integrating with any languages architecture is to help in introducing and adopting a clean structured format to not only improve the readability of our code but also help us in identifying the core areas of our code along with segmenting and identifying any crucial areas in terms of detecting errors and performing corrections. We shall now see the founding aspects upon which OOPs were built. These aspects will always be repeated over and over and made use of every step of the way.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encapsulation:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When we say &lt;strong&gt;Encapsulation&lt;/strong&gt;, we mean coupling and protecting. In short, our classes want to limit the level of access to the attributes of their objects. This enables a sense of security from other classes and their methods by preventing them from accessing any attributes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inheritance:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Perhaps the most important aspect of OOPs is the idea of allowing the  adoption of the blueprint of any class with the help of inheritance. Since the aim of OOPs is to introduce a linear and distributed flow of control, it makes sense to allow classes to inherit (copy the blueprints) the definitions of other classes if they wish to do so.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Polymorphism:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The dictionary definition of &lt;strong&gt;Polymorphism&lt;/strong&gt; is the state of existing in different forms. It so happens, that in essence that is what is being implemented in OOPs in terms of polymorphism. Consider the following definitions of two methods in a class&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
  def Testing(self, argument1, argument2):

        Body of function

        return value

  def Testing(self, argument1):

        Body of function

        return value
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two functions while sharing the same behave differently depending upon runtime which function is called depending upon the number of arguments provided during the function call&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  c = instance.Testing(a,b)
  d = instance.Testing(a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During the first instance call of object instance with the class Testing, it refers to the definition which has 2 arguments along with the object instance. Whereas the second function call, it refers to the method definition with only 1 argument list (excluding the object in the definition)&lt;/p&gt;

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

&lt;p&gt;This paper was meant to be an introductory paper for getting the reader just acquainted and perhaps curious enough for a deeper dive into the world of Object Oriented Programming. The primary focus was more on the need for having OOPs concepts and their underlying principle and need to be adopted by any developer in today's day and age.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python Technical Paper (Arrays and Strings)</title>
      <dc:creator>Tushar Singh</dc:creator>
      <pubDate>Thu, 16 Feb 2023 07:10:50 +0000</pubDate>
      <link>https://dev.to/curioushugo/python-technical-paper-arrays-and-strings-50i1</link>
      <guid>https://dev.to/curioushugo/python-technical-paper-arrays-and-strings-50i1</guid>
      <description>&lt;h2&gt;
  
  
  Paper by Tushar Singh (&lt;a href="mailto:susst94@gmail.com"&gt;susst94@gmail.com&lt;/a&gt;)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Introduction:
&lt;/h3&gt;

&lt;p&gt;As programmers, we always here this fact that everything in python is an "object" including and not limited to functions as well. This very fact becomes the backbone and the basis for how the python libraries and definitions (in-built and user-defined) are stored. This idea is what will be demonstrated with the help of various examples. Another thing to note is the concept of dealing with mutable and immutable objects and any operations surrounding those objects. List objects are said to be "mutable" and strings are treated as "immutable". This distinction has lot of implications in the usage of these types of data storage elements. Following section of this paper will dive into the basic idea, setup, nuances along with demonstrations for both objects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mutable / Immutable:
&lt;/h3&gt;

&lt;p&gt;Before going into the set of tools that python can provide to programmers for working with lists and string data types, it is very important to understand how referencing works in python.&lt;/p&gt;

&lt;p&gt;Consider the following code snippet and how it functions.&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%2Fnthhzbxbm3w6uam7cxcx.png" 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%2Fnthhzbxbm3w6uam7cxcx.png" alt=" " width="186" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We often say that strings and int data types are immutable and a nice way to understand the difference between the two is with the help of the "id" function. This function returns the memory location wherein our data is being stored. When we declare a variable by the name "x" and assign it an integer value, the python interpreter allocates space in memory and stores the starting value 35. Now suppose we were to change the value stored in the variable x to something different say 36, what will happen? Well as you can see with the help of "id", we notice that python allocated a separate memory in space for storing the value 36 in the variable named "x". We can also say that Python decided to create a new object and store the value 36 and assigned the name "x" to the object.&lt;/p&gt;

&lt;p&gt;Another angle of looking at immutability is with the help of the next example with the string value "Test". We declare 2 objects named 'a' and 'b' and assign the value "Test". Upon checking the id for both objects, we see that both have the same id.&lt;/p&gt;

&lt;p&gt;Consider this snippet now and notice the "id".&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%2Fp5b6nwrq2ypxcvn22p12.png" 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%2Fp5b6nwrq2ypxcvn22p12.png" alt=" " width="179" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we are declaring the same list, like with strings, and checking their id to see if anything is different. And of course it is different. This difference in "id" even when passing the same list to both object variables is the basis of all the differences in terms of mutability and immutability and extends to method executions between strings and lists.&lt;/p&gt;

&lt;h2&gt;
  
  
  List Methods
&lt;/h2&gt;

&lt;p&gt;We shall now see some of the more commonly used list methods that programmers like to use on a consistent basis. The general syntax skeleton for all list methods follows the format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;list_name.method_name(arguments)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;append()&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This method is used to add elements to the end sequence of the list. Refer to the image to understand how append works.&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%2Fuf7ggogbyasm46yur7z2.png" 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%2Fuf7ggogbyasm46yur7z2.png" alt=" " width="179" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;insert()&lt;/p&gt;

&lt;p&gt;This method operates like append, except the user has the freedom to add value based on which index he wishes to insert the value in.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Fsx2i8eixohje0s7x17lj.png" 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%2Fsx2i8eixohje0s7x17lj.png" alt=" " width="179" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we are inserting the element 6 in our list at index value 2.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;pop()&lt;/p&gt;

&lt;p&gt;This method is used to return and remove elements from a list based on what index argument is provided. Stress on the word return here, since in some cases the user might want to retain what element it was that removed during the pop operation.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Fzexdmottsrgzf8yx8pbz.png" 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%2Fzexdmottsrgzf8yx8pbz.png" alt=" " width="176" height="223"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice how pop function alters its behavior based on when an index argument is provided or not.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;reverse()&lt;/p&gt;

&lt;p&gt;This method is used to reverse the order of the elements in a list.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2F12hl55hvurserue7yr91.png" 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%2F12hl55hvurserue7yr91.png" alt=" " width="172" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice how the id through all the operations remains the same since the operations are being performed on the same object.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;sort()&lt;/p&gt;

&lt;p&gt;This method is used for performing in-place(within the object memory location) sorting of elements of a list based on the argument list provided.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Fjsh101kppyl03lw64k68.png" 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%2Fjsh101kppyl03lw64k68.png" alt=" " width="161" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The argument list allows the user to either revere sort the list or set other criteria for sorting with the help of the keyword "key".&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;index()&lt;/p&gt;

&lt;p&gt;This method is used for detecting and returning the index of first occurrence of the first argument in the method syntax notation with the starting search position as argument 2 if provided or from index = 0 if not provided.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Ff6eqhbrz08qkf3ngzacd.png" 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%2Ff6eqhbrz08qkf3ngzacd.png" alt=" " width="357" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice how in the first case upon providing the start position as index 5 for search element 3 in the list, we get a ValueError stating that element 3 is not present in the list after index 5.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;count()&lt;/p&gt;

&lt;p&gt;This method is used for finding the total count of an occurrence of an element in a list based on the argument provided.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2F2srjatrguk9d2wmmeg5i.png" 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%2F2srjatrguk9d2wmmeg5i.png" alt=" " width="357" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  String Methods:
&lt;/h2&gt;

&lt;p&gt;We shall now see some of the more commonly used string methods that programmers like to use on a consistent basis.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;startswith()&lt;/p&gt;

&lt;p&gt;This method is used to return if a string starts with a certain specific string sequence which is provided as argument to test along with starting position and end position if present. The default value for starting position is 0.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Fve4y0aq1vwidv8sxv7eh.png" 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%2Fve4y0aq1vwidv8sxv7eh.png" alt=" " width="357" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;endswith()&lt;/p&gt;

&lt;p&gt;This method is used to return if a string ends with a certain specific string sequence which is provided as argument to test along with starting position and end position if present. The default value for starting position is last position of the string.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Fxzhexjoe2222pe2uke4p.png" 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%2Fxzhexjoe2222pe2uke4p.png" alt=" " width="303" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;count()&lt;/p&gt;

&lt;p&gt;This method is used to return the total count of a character in a string which is provided as argument to test along with starting position and end position if present. The default value for starting position is 0.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Fyzobim8nwytt0kdvx1jk.png" 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%2Fyzobim8nwytt0kdvx1jk.png" alt=" " width="278" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;index()&lt;/p&gt;

&lt;p&gt;This method is used to return the index of first occurrence of a character in a string which is provided as argument to test along with starting position and end position if present. The default value for starting position is 0.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2F429wijz1ci1zutlvsc35.png" 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%2F429wijz1ci1zutlvsc35.png" alt=" " width="357" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;isalnum()&lt;/p&gt;

&lt;p&gt;This method is used to return presence of alphanumeric characters in a string.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Fpr0a2v04dilloclbizrd.png" 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%2Fpr0a2v04dilloclbizrd.png" alt=" " width="232" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;isdigit()&lt;/p&gt;

&lt;p&gt;This method is used to return presence of only numeric characters in the complete string.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2F5fo3qiegnrmanzyn2xxw.png" 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%2F5fo3qiegnrmanzyn2xxw.png" alt=" " width="232" height="114"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;isupper()&lt;/p&gt;

&lt;p&gt;This method is used to return presence of upper-case characters in a string.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2F293b9vvd20a8r9kx7hw6.png" 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%2F293b9vvd20a8r9kx7hw6.png" alt=" " width="232" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;islower()&lt;/p&gt;

&lt;p&gt;This method is used to return presence of lower-case characters in a string.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2F2eu78p8cs9vy8rhmj16t.png" 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%2F2eu78p8cs9vy8rhmj16t.png" alt=" " width="238" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;split()&lt;/p&gt;

&lt;p&gt;This method is used to return an iterable data based on the delimiter argument provided. The default delimiter is space (' ').&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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%2Fshqilsj9l0lub5hz66v5.png" 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%2Fshqilsj9l0lub5hz66v5.png" alt=" " width="299" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;I hope that by the end of this, you not only get well acquainted with how the methods function but also understand why they are structured the way they are based on if you are dealing with a mutable or immutable data type.&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>CLI CONCEPTS TECHNICAL PAPER</title>
      <dc:creator>Tushar Singh</dc:creator>
      <pubDate>Thu, 02 Feb 2023 10:12:29 +0000</pubDate>
      <link>https://dev.to/curioushugo/cli-concepts-technical-paper-m1e</link>
      <guid>https://dev.to/curioushugo/cli-concepts-technical-paper-m1e</guid>
      <description>&lt;p&gt;It is incredibly important in today's day and age for any software developer or engineer to be well-versed and comfortable in interacting with Command Line Interface. The purpose of this paper is to demonstrate the utility of CLI in select scenarios where CLI comes through in spades.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Create/Read/Update/Delete/Move files and folders from the command line&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is a plethora of commands and syntax for said commands to achieve this functionality. We will first explore files and then folders.&lt;/p&gt;

&lt;h3&gt;
  
  
  Files:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;To just create a file you can use the "touch" command&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;touch {file-name}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To read the said file you can make use of the "cat" command&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;touch {file-name}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To update a file you can use "touch" with -a or -d flag if you either want to change the access time or the timestamp of said file&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;touch -d {yyyy/mm/dd} {file-name}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For deletion, the "rm" command is quite handy. But there are a few exceptions. In the case of write-protected files, you will be asked to validate the deletion operation. To avoid that prompt you can simply use rm with the -i flag. To add to this, file deletion in Linux using CLI does not allow recovery of said files. Hence you have to be certain that you wish to delete the file.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rm -i {file-name}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For moving the "mv" command is your friend. Simply providing the main file and target folder/directory makes the operation simple and straightforward. This command also allows moving multiple folders into a single folder.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mv {file arguments} {target folder}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;The "mv " is also useful in renaming files. You only have to supply the final file name instead of the target folder to rename your desired folder.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mv {main-file} {new-file-name}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Folders:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For creating folders we make use of the "mkdir" command which stands for &lt;strong&gt;make directory&lt;/strong&gt;. The "mkdir" has a lot of small nuances in its usage such as making multiple directories in 1 command line execution. Those directories could either be independent or connected based on the formatting of the command.&lt;br&gt;
Independent directories:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir {directory-names-space-separated}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Connected directories:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir  {parent-directory}/{child-directories}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To access any directory you make use of the "cd" which stands for &lt;strong&gt;change directory&lt;/strong&gt;. This command allows for relative path syntax or absolute path syntax in its execution based on your preference and your current working directory. Here are a few scenarios showcasing usage of "cd":&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd
cd ..
cd ../..
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;For deletion, we make use of the "rmdir" and "rm" commands once again. But there are a few things that you need to be aware of. Usually, when you use a GUI or a desktop manager to delete files they simply the Trash or recycle bin based on your operating system and can still be recovered. This freedom of recovery is not offered when using CLI for deleting, just as it was shown to be the case with files previously. Also, deleting a directory requires "write permission"" on the directory and its contents. The following examples will help showcase that.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Removing with "rmdir":
&lt;/h3&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;If the directory you wish to delete is empty, you can simply use the "rmdir" command as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rmdir {directory-name}
rm -r {directory-name}
rm -rf {directory-name}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it's not empty, you will get an error stating rmdir failed to remove said directory. In such cases, we employ the use of the "rm" command like in files. By default "rm" without any option doesn't allow the deletion of directories. The command, when coupled with -d option, allows deleting non-empty directories and when used with -r allows all contents.&lt;/p&gt;

&lt;p&gt;If a directory is write protected, you will again be prompted like in the case of files, and be asked to validate. To avoid this based on your preference, you can simply use the -f option in conjunction with "rm" to complete the operation and avoid validation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Check disk status&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To keep tabs on the disk space available on your system, Linux has provided users with the "df" command which stands for &lt;strong&gt;disk free&lt;/strong&gt;, and comes with various options to meet users' requirements for gathering information with regards to their disk space management. We shall look at a few cases with both commands.&lt;/p&gt;

&lt;p&gt;## df:&lt;/p&gt;

&lt;p&gt;Simply use the command like so&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will come across this output:&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%2F5my3q94xba3o3eci3csj.png" 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%2F5my3q94xba3o3eci3csj.png" alt="Image description" width="588" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Check the status of processes, able to extract process ids&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;strong&gt;ps&lt;/strong&gt; command is of excellent use in getting information regarding all active processes in your system. There are a few options that come with &lt;strong&gt;ps&lt;/strong&gt; which help in sorting processes as per the users' requirements. As a standalone command &lt;strong&gt;ps&lt;/strong&gt; just displays the shell and the process running within the shell as shown:&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%2Fq3nvqbukb7mh3kyfso1z.png" 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%2Fq3nvqbukb7mh3kyfso1z.png" alt="Image description" width="325" height="105"&gt;&lt;/a&gt;&lt;br&gt;
 When used in conjunction with options such -e we get all running processes.&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%2F8aoo881smrvcn56zd87l.png" 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%2F8aoo881smrvcn56zd87l.png" alt="Image description" width="508" height="421"&gt;&lt;/a&gt;&lt;br&gt;
To find the senior-most parent process of any file, we simply couple the ps command with grep to find our parent process like so:&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%2F7qfpocmjutmfuqvbjxg6.png" 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%2F7qfpocmjutmfuqvbjxg6.png" alt="Image description" width="535" height="232"&gt;&lt;/a&gt;&lt;br&gt;
The numbers denoted in those listed outputs are the process IDs that we can use to specifically kill the said process if need be.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Change file permissions&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the most crucial things a developer needs while working in a team with multiple people is handling files with different permission levels for reading, writing , and executing depending upon project hierarchy and specifications. To help with this task, CLI has provided two extremely useful commands namely &lt;strong&gt;chmod&lt;/strong&gt; and &lt;strong&gt;chown&lt;/strong&gt;. The first command &lt;strong&gt;chmod&lt;/strong&gt; allows the user to change file permission to either make the file readable, write-able or executable not only for the user but also for groups and other people accessing the file. Consider the following snippet.&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%2F1qzg7tvzdp5x6u9zkeky.png" 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%2F1qzg7tvzdp5x6u9zkeky.png" alt="Image description" width="652" height="81"&gt;&lt;/a&gt;&lt;br&gt;
Notice the leftmost string in all the files and directories shown. The 10-character string denotes the file type and file permissions. The 2 names following showing &lt;strong&gt;fufstmata fufstmata&lt;/strong&gt; is for ownership details. The formatting for file permission is as follows:&lt;/p&gt;

&lt;p&gt;Character 1: file type (directory or file)&lt;br&gt;
  Characters 2-4: Permissions for user&lt;br&gt;
  Characters 5-7: Permissions for groups&lt;br&gt;
  Characters 8-10: Permissions for others&lt;br&gt;
  The permissions are denoted by characters &lt;strong&gt;r,w,x&lt;/strong&gt; which means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;r = Read&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;w = Write&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;x = Execute&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now how do &lt;strong&gt;chmod&lt;/strong&gt; and &lt;strong&gt;chown&lt;/strong&gt; come into play? Following demonstrations will help understand their purpose.&lt;/p&gt;
&lt;h2&gt;
  
  
  chmod:
&lt;/h2&gt;

&lt;p&gt;To change the permissions of a file you can do so with the focus on a specific party namely user, group or others with the help of options &lt;strong&gt;u&lt;/strong&gt;, &lt;strong&gt;g&lt;/strong&gt;, or &lt;strong&gt;o&lt;/strong&gt; in conjunction with altering specific permission with relevant characters (&lt;strong&gt;r,w,x&lt;/strong&gt;) either with  &lt;strong&gt;+ or -&lt;/strong&gt;.&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%2Fqi34tc8godhfvb9civ9u.png" 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%2Fqi34tc8godhfvb9civ9u.png" alt="Image description" width="649" height="177"&gt;&lt;/a&gt;&lt;br&gt;
In this instance, we are changing the permissions of the file &lt;strong&gt;Goblet.txt&lt;/strong&gt; with the help of chmod command. We simply use the necessary designation for which we wish to change permission (in this case g for groups and o for others) and supply the necessary additional permissions with the help of the &lt;strong&gt;+&lt;/strong&gt; sign and permission characters (&lt;strong&gt;r,w,x&lt;/strong&gt;). We finally revert back our file permissions to their original state with the help of &lt;strong&gt;-&lt;/strong&gt; sign and removed the additional permissions we had provided. Another alternate way of changing permissions is demonstrated as follows:&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%2Fnvm9hvp5cx6axqebc6wx.png" 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%2Fnvm9hvp5cx6axqebc6wx.png" alt="Image description" width="641" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, instead of using &lt;strong&gt;+ or -&lt;/strong&gt; signs and altering permissions by way of adding or subtracting, we simply equate the necessary permissions and alter them. Finally, we revert the permissions to their original state.&lt;/p&gt;

&lt;p&gt;Another alternative way of changing permissions is by way of using the bit-wise convention for changing permissions for all parties (&lt;strong&gt;u,g,o&lt;/strong&gt;). Notice that the permissions for all parties are set in the same sequence i.e. it always follows as&lt;br&gt;
  r--&amp;gt;w--&amp;gt;x. This arrangement allows developers to go for a short-hand approach based on relative positioning and assigning bit values for respective permissions. The MSB (most significant bit) position assumed by &lt;strong&gt;r&lt;/strong&gt; and LSB (least significant bit) assumed by &lt;strong&gt;x&lt;/strong&gt; allows us to do bit-wise operations of changing permissions as demonstrated:&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%2Fr5vzvddpysb4mh2f7993.png" 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%2Fr5vzvddpysb4mh2f7993.png" alt="Image description" width="641" height="169"&gt;&lt;/a&gt;&lt;br&gt;
 In this scenario, we are supplying 675 as our bit-wise decimal permission code. The first code 6 associates with the user, the second code 7 associates with groups, and the third code 5 with others. Since our bit-wise convention for &lt;strong&gt;r,w,x&lt;/strong&gt; follows MSB to LSB convention for 3 bit decimal code, the decimal code 675 can be deciphered as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;6 : 110 = &lt;strong&gt;rw-&lt;/strong&gt; for user&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;7:  111 = &lt;strong&gt;rwx&lt;/strong&gt; for groups&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;5:  101 = &lt;strong&gt;r-x&lt;/strong&gt; for others&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the end, we revert the permissions to the original state with the code 664.&lt;/p&gt;
&lt;h2&gt;
  
  
  chown:
&lt;/h2&gt;

&lt;p&gt;To change the ownership of a file, you make use of the &lt;strong&gt;chown&lt;/strong&gt; command. Now, to be able to use &lt;strong&gt;chown&lt;/strong&gt; you need to have &lt;strong&gt;sudo&lt;/strong&gt; privileges, which makes sense since no one should be able to change ownership of a file that easily. Once you have those privileges, simply using the syntax as shown will allow ownership changes.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo chown {options} user{:group} {file-list}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Extract the last x lines from files and the word count for a particular word&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For such file-based operations, the &lt;strong&gt;tail&lt;/strong&gt; command is of very good use.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tail -n x {file-name}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;By default, the tail command extracts the last 10 lines of a file and prints it out on the terminal. With the help of the -n option, we can extract the last "x" number of lines in the file. During runtime, we will of course supply the numeric value which will replace "x", instead of just supplying the character "x".&lt;/p&gt;

&lt;p&gt;To fulfill a word count-based operation for a file, the &lt;strong&gt;grep&lt;/strong&gt; command in conjunction with &lt;strong&gt;wc&lt;/strong&gt; proves to be very effective. The following snippets demonstrate the process:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;grep -i {relevant-word} {file-name}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;The -i option allows case-insensitive search with grep and the relevant word is the word the user is searching for in the file of interest (file-name).&lt;/p&gt;

&lt;p&gt;To find the total word count, we simply pipe the input from &lt;strong&gt;grep&lt;/strong&gt; into the &lt;strong&gt;wc&lt;/strong&gt; command like so:&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%2Fxq25hmd380kwu8t7710f.png" 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%2Fxq25hmd380kwu8t7710f.png" alt="Image description" width="617" height="82"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Absolute and Relative paths&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Linux terms, an absolute path always begins from the root directory whereas the relative path begins from the current working directory. Consider the snippet shown:&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%2Fzjwsjq4kww3hrmlznoqb.png" 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%2Fzjwsjq4kww3hrmlznoqb.png" alt="Image description" width="617" height="69"&gt;&lt;/a&gt;&lt;br&gt;
In this example, the user starts from the home directory denoted by the &lt;strong&gt;~&lt;/strong&gt; sign before &lt;strong&gt;$&lt;/strong&gt;. Upon using&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;cd /etc/kernel&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 the user can switch from the home directory straight to the kernel directory which lies in the root directory. This is due to the absolute path provided with the help of the starting forward slash "/" which denotes root. After entering the kernel directory, the user is still able to swap over to a different directory &lt;strong&gt;tmp&lt;/strong&gt; with the help of absolute path as shown.&lt;br&gt;
  The following snippet shows how the relative path works:&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%2Fmr884z2l29vqx0rr10qj.png" 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%2Fmr884z2l29vqx0rr10qj.png" alt="Image description" width="800" height="88"&gt;&lt;/a&gt;&lt;br&gt;
In this example, we are starting of with the Books directory present in the DSA section of the Coding directory. If we want to juggle and switch over to the Books directory of "C-Code folder" we make use of the relative path with the help of "../.." which helps in switching between layers of the parent directory and then switching over to our target directory.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Using the find command&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Perhaps one of the most important commands for software developers is the find command. The immense amounts of utility that it offers with all its different options and argument lists make it one of the best commands for use by developers, especially in bash scripts with search operations. The default syntax for using this command is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;find {option-list} {path} {expression-format}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;The options-list dictates the control method for finding either links, names, file types, file sizes, date modified etc. The path argument dictates the starting point for the search operations. The expression-format provides the final search pattern to be searched for in conjunction with the option-list and starting path.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ls with the 5 most commonly used flags&lt;/strong&gt;*&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The ls command is one of the most commonly used commands by developers in keeping track of the file system and gathering relevant information from viewing hidden files in directories, to viewing files in sorted order based on size or time created. We shall look at a few of these cases to understand them better.&lt;/p&gt;

&lt;h3&gt;
  
  
  ls:
&lt;/h3&gt;

&lt;p&gt;Simply using the command "ls" lists all the files and folders present in your current working directory as shown below:&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%2F45ox9o8o855d9mr12r6s.png" 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%2F45ox9o8o855d9mr12r6s.png" alt="Image description" width="800" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ls -l:
&lt;/h3&gt;

&lt;p&gt;Using the -l flag with ls gives a more concise and neat formatted output of all files and directories present in our current working directory with relevant information such as date of creation, permissions, ownerships, and file size in bytes.&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%2F1x3d57sxjcjb3ujdmxh4.png" 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%2F1x3d57sxjcjb3ujdmxh4.png" alt="Image description" width="729" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ls -a:
&lt;/h3&gt;

&lt;p&gt;For seeing all hidden files in our current working directory, we simply make use of the -a option with ls.&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%2Fzc62pntch0m1xfm56l20.png" 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%2Fzc62pntch0m1xfm56l20.png" alt="Image description" width="729" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ls -h:
&lt;/h3&gt;

&lt;p&gt;For seeing all files in human-readable file size (megabytes(M), gigabytes(G)) we use the -h option with ls.&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%2Fr6pujqxxg8w6n6o9prrs.png" 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%2Fr6pujqxxg8w6n6o9prrs.png" alt="Image description" width="617" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ls -t:
&lt;/h3&gt;

&lt;p&gt;For sorting the files and directories based on when they were created we make use of the -t option with ls.&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%2Fe1b50kl7d9yed25cnmuy.png" 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%2Fe1b50kl7d9yed25cnmuy.png" alt="Image description" width="678" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Terminal control codes such as Ctrl + D, Ctrl + C, Ctrl + Z&lt;/strong&gt;
For any software developer when he is busy working on any project, it is often extremely handy to have at your disposal to make you more efficient. Following are a few important terminal shortcut keys and their utility.&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Ctrl + C:
&lt;/h3&gt;

&lt;p&gt;This shortcut key allows you to break or terminate either a command or process during its runtime. Basically, this kills any process.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Ctrl + Z:
&lt;/h3&gt;

&lt;p&gt;This shortcut key allows you to suspend any process during runtime instead of killing it completely as it has done with Ctrl + C. This suspension followed by the retention of shell control to the user allows us to resume the process later if need be.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Ctrl + D:
&lt;/h3&gt;

&lt;p&gt;This shortcut allows the user to log out of the current terminal window. Think of it like an "end of file" operation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  Ctrl + R:
&lt;/h3&gt;

&lt;p&gt;There might be scenarios wherein you forget what command did you use for a particular operation and browsing the history can be a bit cumbersome. In such situations, the &lt;strong&gt;Ctrl + R&lt;/strong&gt; shortcut is very useful as it allows you to search back the command you wrote by simply providing the string that you can remember. The shortcut will then look for commands matching your string input and provide with you relevant commands from history.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tab autocompletion&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Software developers often have to work in a very fast-paced environment and get a lot of work done while juggling with so many different tools and managing immense directories. It can be tough to work with at times, especially with so many different CLI tools at their disposal. It comes to a point where at times, the names of directories become too long or there are different versions of an application on his pc that he has to work on. The CLI allows one small yet powerful feature to aid developers in juggling through different commands, files, and directories which is the tab completion feature. Tab completion allows a developer to simply provide the initial characters of any command or directory or an executable file that they wish to access and with the help of the &lt;strong&gt;Tab&lt;/strong&gt; key on the keyboard the terminal will either provide the list of commands matching the initial string or the directory that they wish to access or the executable file that they wish to run.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Using the arrow keys to navigate the history&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The command line history of a developer is safe to say extremely long. Navigating through all of that can be quite cumbersome. You could use the arrow keys but that would be an absolute time if you were to browse through hordes of command lines executed over time. The &lt;strong&gt;pgup&lt;/strong&gt; and &lt;strong&gt;pgdn&lt;/strong&gt; and &lt;strong&gt;end&lt;/strong&gt; keys can be of good use in such situations. You can also couple the &lt;strong&gt;history&lt;/strong&gt; command with &lt;strong&gt;tail&lt;/strong&gt; or &lt;strong&gt;head&lt;/strong&gt; to view your last x or first x command lines executed like so:&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%2Flp30dgjnz7005bafdy1r.png" 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%2Flp30dgjnz7005bafdy1r.png" alt="Image description" width="617" height="766"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CONCLUSION:
&lt;/h2&gt;

&lt;p&gt;I hope that by the end of reading this paper, you got some idea about how useful of a tool CLI is for developers in making them even better at saving time.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>blockchain</category>
      <category>crypto</category>
      <category>offers</category>
    </item>
  </channel>
</rss>
