<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chigozirim igweamaka on Medium]]></title>
        <description><![CDATA[Stories by Chigozirim igweamaka on Medium]]></description>
        <link>https://medium.com/@iamokwukwe?source=rss-e27960b4e0e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*oQCgPV2dYgZnfHO5</url>
            <title>Stories by Chigozirim igweamaka on Medium</title>
            <link>https://medium.com/@iamokwukwe?source=rss-e27960b4e0e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 06:26:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iamokwukwe/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using a Mutable Object as a Default Parameter in Python]]></title>
            <link>https://medium.com/@iamokwukwe/using-a-mutable-object-as-a-default-parameter-in-python-e2cb15b964b3?source=rss-e27960b4e0e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2cb15b964b3</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Chigozirim igweamaka]]></dc:creator>
            <pubDate>Tue, 22 Nov 2022 12:43:26 GMT</pubDate>
            <atom:updated>2022-12-03T20:33:06.524Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tw6p49LVIvZ_DoDUtCuqSw.jpeg" /></figure><p>In Python, when you define a function, you can specify default values for its parameters which allow you to call the function without providing all the arguments, and the default values will be used for any missing arguments.</p><p>For example, consider the following function:</p><pre>def greet(name, greeting=&#39;Hello&#39;):<br>  print(f&#39;{greeting}, {name}!)</pre><p>This function takes two arguments: name, which is a required argument, and greeting, which is an optional argument with the default value of ‘Hello’. You can call the function in the following ways:</p><pre>greet(&#39;Jane&#39;) # outputs &quot;Hello, Jane!&quot;<br>greet(&#39;John&#39;, &#39;Hi&#39;) # outputs &quot;Hi, John!&quot;</pre><p>In this case, the default value of ‘Hello’ is used for the greeting argument in the first call to the greet() function, and the provided value of ‘Hi’ is used in the second call.</p><p>However, when using mutable objects (such as lists and dictionaries) as the default values for a function parameter, things can get really confusing.</p><p>Consider the following example:</p><pre>def append_to_list(value, the_list=[]):<br>  the_list.append(value)<br>  return the_list</pre><p>This function takes two arguments: value, which is the value to be appended to the list, and the_list, which is the list to which the value will be appended. The default value of the_list is an empty list.</p><p>At first glance, this function seems to work as expected:</p><pre>append_to_list(1) # outputs [1]<br>append_to_list(2) # outputs [2]</pre><p>But, try it out yourself, call the append_to_list function multiple times and you’ll be amazed — actually, you’ll be confused!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*au9p-JeNw4UVvnfsRemm5Q.jpeg" /></figure><p>If you called the function multiple times, you would have seen that the default value of the_list is shared among all the calls to the function:</p><pre>append_to_list(1) # outputs [1]<br>append_to_list(2) # outputs [1, 2]<br>append_to_list(3) # outputs [1, 2, 3]</pre><h4>Why is this happening!?</h4><p>Remember that a function, in Python, is an object that has predefined attributes which are initialized when the function is defined. One of these attributes, called__defaults__, stores the values of default parameters when the function is defined. For every call to the function, the default parameters are not redefined but are obtained from this attribute and reused:</p><pre>&gt;&gt;&gt; dir(append_to_list)<br>[&#39;__annotations__&#39;, &#39;__builtins__&#39;, &#39;__call__&#39;, &#39;__class__&#39;, &#39;__closure__&#39;,<br>&#39;__code__&#39;, &#39;__defaults__&#39;, &#39;__delattr__&#39;, &#39;__dict__&#39;, &#39;__dir__&#39;, &#39;__doc__&#39;,<br>&#39;__eq__&#39;, &#39;__format__&#39;, &#39;__ge__&#39;, &#39;__get__&#39;, &#39;__getattribute__&#39;, &#39;__globals__&#39;, &#39;__gt__&#39;, &#39;__hash__&#39;, &#39;__init__&#39;,<br>&#39;__init_subclass__&#39;, &#39;__kwdefaults__&#39;, &#39;__le__&#39;, &#39;__lt__&#39;, &#39;__module__&#39;,<br>&#39;__name__&#39;, &#39;__ne__&#39;, &#39;__new__&#39;, &#39;__qualname__&#39;, &#39;__reduce__&#39;, &#39;__reduce_ex__&#39;, &#39;__repr__&#39;, &#39;__setattr__&#39;, &#39;__sizeof__&#39;,<br>&#39;__str__&#39;, &#39;__subclasshook__&#39;]<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; append_to_list.__defaults__<br>([1, 2, 3],)<br>&gt;&gt;&gt;</pre><p>Since the default value is a mutable list, its value can be modified by the function, and these modifications persist between calls to the function.</p><h4>How to avoid this</h4><p>To avoid this problem, you can use the None value as the default value for the_list, and then check for None in the function body and create a new list if needed:</p><pre>def append_to_list(value, the_list=None):<br>  if the_list is None:<br>    the_list = []<br>   the_list.append(value)<br>    return the_lsit</pre><p>Now, when you call the append_to_list() function multiple times, you will get the expected behavior:</p><pre>append_to_list(1) # outputs [1]<br>append_to_list(2) # outputs [2]<br>append_to_list(3) # outputs [3]</pre><h4>Conclusion</h4><p>As a general rule, using mutable objects as default parameters in Python is not advisable. If you do choose to use a mutable object as a default parameter, it is important to have a good understanding of what you are doing in order to avoid potential problems with your code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2cb15b964b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Praise A Barber And Warn People About A Barber]]></title>
            <link>https://medium.com/@iamokwukwe/praise-a-barber-and-warn-people-about-a-barber-26b0e9179cd3?source=rss-e27960b4e0e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/26b0e9179cd3</guid>
            <category><![CDATA[portfolio]]></category>
            <category><![CDATA[solutions]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Chigozirim igweamaka]]></dc:creator>
            <pubDate>Sun, 05 Jun 2022 15:41:19 GMT</pubDate>
            <atom:updated>2024-07-30T00:39:39.939Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*kP7_-rN3UbLJpC3R7uf_QQ.png" /></figure><h4>Introduction</h4><p>In 2018 I got up from a barber chair upset and disappointed — I had just got the hairstyle I’d maintained for a long time ruined by a barber I trusted could do a good job. The truth is this wasn&#39;t the barber shop I always visited to get a haircut. I had traveled to a different state in my country for an event and really had to get a haircut, so I visited the closest barbershop I could find. The barber seemed confident, and the shop was nice, so I let him cut my hair. Some minutes later I wished I hadn’t tried to get a haircut in the first place. It was so bad I had to change my hairstyle entirely.</p><p>I am very sure I’m not the only one who has had a bad experience like this. Some may be aware of the unskilled hands of a barber but have no better option. This is a problem, and this is where PraiseABarber comes in.</p><h4>The project</h4><p>PraiseABarber is a web application that helps people find the most rated barbers in any location they find themselves. It lets users rate and make reviews on barbers they’ve had a haircut with and lets barbers prove their proficiency in giving different kinds of hairstyles by letting them post photos of their work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cEFSuZ6Ol4htlUgvpQ75OQ.png" /><figcaption>A diagram showing how a customer and barber interact over the PraiseABarber app</figcaption></figure><h4>The team</h4><p>Though this solution is my idea, it was brought to life by a team of three amazing software engineers: <a href="https://www.linkedin.com/in/theophilus-menor-a06b56b2/"><strong>Theophilus Menor</strong></a>, <a href="https://www.linkedin.com/in/joseph-emmanuel-i/"><strong>Joseph Emmanuel</strong></a>, and <strong>Myself</strong>. While Theophilus handled the frontend of this project, I and Joseph handled the backend. Joseph set up the database and worked on the project’s deployment and I handled the APIs to make sure that the connection between frontend and backend is seamless.</p><p>For the frontend of this project, we chose to use <strong>HTML5</strong>, <strong>CSS3</strong>, and <strong>JavaScript</strong> without any additional frameworks. For the backend, we used <strong>Python</strong> with the <strong>Flask</strong> framework, <strong>PostgreSQL</strong> database, and <strong>SQLALchlemy ORM</strong> tool. We opted to use ORM to make the application more flexible should we decide to use a different database in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*q4sXp8zINePidjdCDbxLyg.png" /><figcaption>Simple diagram depicting the architecture behind PraiseABarber</figcaption></figure><p>Flask is really an amazing tool. With <a href="https://flask-restplus.readthedocs.io/en/stable/swagger.html">Flask Swagger</a> I created a <a href="http://praiseabarber.herokuapp.com/api/v1/docs/">user interface</a> for the documentation and testing of the APIs I created. It also allows the frontend developer, or literally anyone, to visualize and interact with the API’s resources without having any of the implementation logic in place.</p><p>To implement user login we used session management with JWT — JSON web token.</p><h4>Technical Challenge</h4><p>At some point in the project, I had to work on the frontend to implement the feature of searching for barbers in a specific state and city. The aim was to dynamically display barbers in the state a user may select and dynamically produce the cities in the selected state so that the user can narrow down their search on barbers by selecting any of the cities produced.</p><p>This was a challenge because, at the time of this project’s initial development, I wasn’t familiar with the technologies used for the frontend (HTML, CSS, and JS). I knew what was to be done but I didn&#39;t know how to implement it — this is where my googling skills came into play.</p><p>I began to research, and in the course of my research I learned how to use the JavaScript method, fetch(), to make requests to a server via an API, and receive responses in JSON format:</p><pre>fetch(&#39;https://praiseabarber.herokuapp.com/api/v1/user/barbers/&#39;).then((data)=&gt;{<br>   return data.json();<br>})</pre><p>Using the data I generated a select HTML element that I could append to an existing HTML element with the methods document.createElement() and document.appendChild(). Next, something had to happen when a state or city was selected — a function that would generate and display the barbers in the selected state or city had to be called. After another round of research, trials, and errors, I discovered the HTML event attribute onchangeand that brought the search feature to life.</p><p>Solving this problem took me two days. By 5:00 am of the second day, after staying up all night, I was able to get it to work as expected and closed all the tabs I’d opened in the course of my research— a satisfying thing to do, most programmers can relate.</p><p><strong>What I learned in the course of this challenge:</strong></p><ul><li>JavaScript isn’t popular for nothing — it’s really important and I’ve got to learn it.</li><li>Though I’ve known this one for a while, it was quite obvious during this challenge — the knowledge of a programming language doesn’t make a programmer a programmer.</li><li>In software engineering, there is always a solution or workaround for most problems. I just need to know where to look.</li><li>Understanding why you’re stuck is like solving 80% of the problem — you know the right questions to ask and keywords to use for your research.</li></ul><p>Above all the challenges I faced while working on this project, I had more fun with this one: I was working with things I wasn’t familiar with and I was learning a lot in the process.</p><h4>What I learned from this project</h4><ul><li>Going solo on a project is nice but working with a team is amazing.</li><li>Proper documentation (writing proper comments, pull requests, and commits) is important, especially when working with a team.</li><li>Storage planning and database design should be the first thing done at the implementation stage of any project that requires them. I learned this from Joseph.</li><li>API endpoints should be written in such a way that they can be easily remembered.</li><li>Management process is an important thing to consider when planning an API strategy.</li></ul><h4>About me</h4><p>I am a Software Engineer who is passionate about learning and solving problems with technology. I believe in doing <strong>hard things </strong>so as to stretch myself and positively impact my society and the world at large. I love automating things too!</p><p>GitHub link for the project: <a href="https://github.com/iChigozirim/Praise_A_Barber">https://github.com/iChigozirim/Praise_A_Barber</a></p><p>Deployed project page: <a href="https://paber.netlify.app/">https://paber.netlify.app/</a></p><p>Project’s landing page: <a href="https://paber.netlify.app/">https://paber.netlify.app/</a></p><p>My LinkedIn profile: <a href="https://www.linkedin.com/in/chigozirim-igweamaka-233775205/">https://www.linkedin.com/in/chigozirim-igweamaka/</a></p><p>Just before you leave 🙏, what do you think about the name of this project — hit the bull’s eye? Please leave a comment in the comment section below. I’d love to hear it 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26b0e9179cd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Postmortem Report I Wrote]]></title>
            <link>https://medium.com/@iamokwukwe/postmortem-report-d85e3a2e4d75?source=rss-e27960b4e0e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d85e3a2e4d75</guid>
            <category><![CDATA[postmortem-documentation]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Chigozirim igweamaka]]></dc:creator>
            <pubDate>Fri, 29 Apr 2022 21:13:48 GMT</pubDate>
            <atom:updated>2022-11-17T20:06:30.149Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*TNRml2lbWTVRKhdQtRfBTg.jpeg" /></figure><h3>1982_Web_01 Server’s Nginx installation failure to listen on port 80 incident report</h3><h3>Issue Summary</h3><p>From 9:32 AM to 10:02 AM GMT, Nginx installation on 1982_web_01 server rejected all packets directed at its port — 80/TCP. The server responded to all received HTTP requests with the error: (7) Failed to connect to 0 port 80: Connection refused. At its peak, the issue affected 60% of all traffic to this server as users could not view web pages. The root cause of the server’s rejection on this port was an undone configuration of the server’s firewall.</p><h3>Timeline (all times Greenwich Mean Time)</h3><ul><li>9:18 AM: Ngnix was installed on the server</li><li>9:32 AM: The server began to receive traffic</li><li>9:32 AM: Pagers alerted on-call Software Engineer, Chigozirim Igweamaka</li><li>9:40 AM: Cause of the server’s rejection on port 80 probed.</li><li>9:42 AM: Successful configuration to allow port 80 on the server</li><li>9:45 AM: Server restart begin</li><li>10:02 AM: 100% of traffic back online</li></ul><h3>Root Cause</h3><p>At 9:18 AM GMT Ngnix was installed on the server and was configured manually. The team forgot to give firewall permission to requests coming on port 80 to the server. Hence the firewall allowed requests from other specified ports except from port 80, which is essential to the provision of service by the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*ErgsRrkrIS2uAKJZbAxbvw.png" /><figcaption>Source:<a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.javatpoint.com%2Ffirewall&amp;psig=AOvVaw1S_j3gu1Sr_c3peMe_QpZd&amp;ust=1651352628599000&amp;source=images&amp;cd=vfe&amp;ved=0CA0QjhxqFwoTCOjmgM-XuvcCFQAAAAAdAAAAABAD"> Javatpoint</a></figcaption></figure><h3>Resolution</h3><p>At 9:32 AM GMT, the monitoring systems alerted the engineer on-call, Chigozirim Igweamaka, who probed the issue and proceeded to solve it.</p><p>AT 9:42 AM GMT, Chigozirim configured the server’s firewall — giving permission to port 80/TCP.</p><h3>Corrective and Preventative Measures</h3><p>To prevent and incident like this from happening in the future, the team should:</p><ul><li>use Server Control Management tools, Puppet for example, to configure servers</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87CM97GodCfXx6cumeeoEQ.png" /><figcaption>source: <a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.pinterest.ca%2Fpin%2F456200637236670307%2F%3Famp_client_id%3DCLIENT_ID(_)%26mweb_unauth_id%3D%7B%7Bdefault.session%7D%7D%26simplified%3Dtrue&amp;psig=AOvVaw0SYUjJ8_LsPxxjhcL9K3mf&amp;ust=1651352857823000&amp;source=images&amp;cd=vfe&amp;ved=0CA0QjhxqFwoTCMC3iYSXuvcCFQAAAAAdAAAAABAS">Pinterest</a></figcaption></figure><ul><li>run series of tests before a server is opened to traffic</li></ul><p>Sincerely,</p><p>Server Administering Team</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d85e3a2e4d75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Happens When You Type https://www.google.com In Your Browser And Press Enter]]></title>
            <link>https://medium.com/@iamokwukwe/what-happens-when-you-type-https-www-google-com-in-your-browser-and-press-enter-8ca7b7d4ff7b?source=rss-e27960b4e0e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ca7b7d4ff7b</guid>
            <category><![CDATA[website]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[web-infrastructure]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Chigozirim igweamaka]]></dc:creator>
            <pubDate>Fri, 29 Apr 2022 12:38:09 GMT</pubDate>
            <atom:updated>2022-05-21T09:55:58.328Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6k17qiac8GqJw-k_-MiuWw.jpeg" /></figure><p>Just as it was a mystery to us, while we were kids how people got into TVs and how they managed to fit into radios, it is a mystery to a lot of people how a browser takes them to a specific location on the internet upon typing in, pasting in, or even speaking in a domain name, or URL, into the browser. Does the browser go to the website owning the domain name or does the website come to the browser?</p><p>To unravel this mystery, I’ll take you through a series of steps your web browser takes upon receiving a URL, for example, <a href="https://google/">https://google</a>.com, to take you to a specific location on the internet.</p><p><strong>Terminologies</strong></p><p>Before we proceed though, here are some definitions of terms that will be relevant for the duration of this article:</p><ul><li>Server: A server is a computer software, with underlying hardware, that’s dedicated to providing a service to other computers. In the context of this article, the usage of the term “server(s)” will refer to the computer system(s) hosting a website.</li><li>Client: A client is computer software, with underlying hardware, that access services hosted on a server. in the context of this article, the usage of the term “client” will refer to the web browser.</li><li>Webserver: A webserver is a type of server that uses HTTP, or it’s variant, and other protocols to respond to web client requests made over the internet. It is its responsibility to display website content through storing, processing, and delivering web pages to the web browser.</li><li>Protocol: A protocol is an established set of rules or procedures that dictate how data is transmitted between different devices on a network.</li></ul><h4><strong>Step 0: The browser parses the URL</strong></h4><p>When you type in a URL, <a href="https://www.google.com/">https://www.google.com</a> , for example, the browser breaks it down into parts:</p><ul><li>Protocol — <em>https </em>— the data transfer method to be used between the client and server.</li><li>Subdomain — <em>www — </em>additional information added to the beginning of a domain name.</li><li>Domain name — <em>google — </em>the domain name that maps to the IP address of the webserver.</li><li>TLD — <em>.com — </em>the top level domain that classify a feature of the website.</li></ul><p>All of which you learn about in the course of this article.</p><h4>Step 1: The browser uses Domain Name System (DNS) To convert the domain name to an IP address</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*XkYbUemOmcAu9pJhW27TOg.png" /></figure><p>Computers on a network identify each other with IP addresses just as we humans identify each other with names. An IP address ranges from 12–16 digits, and we humans would find it difficult memorising and remembering one, let alone the dozens we come across every day. Thus, IP addresses are encoded as domain names.</p><p>You can type in an IP address directly to the browser and the browser would begin communication with the website’s server. However, if you decide to be a human and use a domain name instead, the browser tries to get the IP address behind the given domain name by using a system called DNS — Domain Name System</p><p>Before proceeding to DNS, the browser and OS first check their cache to see if they know the IP address of the specified domain name. If they do, the browser connects to the website server using the IP address and begins communication with it right away. However, if they don’t, the OS queries <strong>DNS resolver </strong>with<strong> </strong>the<strong> </strong>domain name.</p><blockquote><strong>DNS resolver </strong>is a server, usually your Internet Service Provider (ISP), designed to receive domain names from web browsers and other applications. It is responsible for tracking down the IP address for a given domain name.</blockquote><p>The DNS resolver goes through a series of predefined steps, known as the DNS hierarchy, to translate the domain name into an IP address. The first it takes is sending the domain name to a server called <strong>the root server. </strong>The root server serves as a reference — it refers requests sent by the resolver to another server called the <strong>Top Level Domain server</strong>, TLD for short.</p><p><strong>TLD</strong> servers are one step below the root servers in the DNS hierarchy. TLD servers take the domain name provided, <a href="http://www.google.com/">google.com</a> for example, and provide the IP of its <strong>Authoritative Name Server</strong> , `.com` in this case.</p><p>The Authoritative Name Server<strong> </strong>is a DNS server that contains information for a specific domain name. It is the final point in the search for the IP address of a domain name. This server takes the domain name and subdomain, and if both are valid it returns the correct IP address to the DNS Resolver.</p><p>Upon getting the IP address for the given domain name, the DNS Resolver tells the OS the IP address. The OS saves the address in its cache (so it wouldn’t have to involve the resolver the next time you type in the domain name) and tells it to the browser. Now, with the IP address in hand the browser knows the exact computer, web server, to communicate with over the internet.</p><h4>Step 2: The Browser Sends A Request To The Website’s Server To Communicate</h4><p><strong>TCP/IP (Transmission Control Protocol/Internet Protocol)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*jbDnhzl48UQvpo2Su-SBYw.jpeg" /></figure><p>The browser begins communication with the website’s server by sending a request to it. But no communication is successful without both ends sharing a common language, or message format, so a method for connection known as <strong>TCP/IP</strong> is used.</p><p>TCP/IP is a set of rules, conceptualized in layers, that dictate the way computer systems on the internet communicate. The layers are as follows:</p><ol><li>The <strong>Application layer</strong>, which is the first layer, is where programs like your browser directly interact with. This layer has protocols like HTTP (if you’re visiting websites), or SMTP (if you’re checking your email). The Application layer gets data from the browser and tells it to the second layer through something called a <a href="https://en.wikipedia.org/wiki/Port_(computer_networking)">port</a>.</li><li>The <strong>Transport Layer, </strong>which is the second layer<strong>, </strong>is<strong> </strong>where TCP is found, along with a second schema called UDP. Each protocol in the Application layer uses a different port to communicate with this layer so that TCP knows where the data is coming from. Once TCP gets the data, it chunks it up into small chunks called segments, also known as packets, where they could individually take the quickest route to get to their destination. To reunite the segments properly upon arrival at their destination, TCP adds a header unto each segment which contains the instructions on what order to reassemble the segments into as well as error checking information so that the computer knows whether the segments arrived without any mishaps. After this is done, the segments are pushed on to the third layer.</li><li>The<strong> Internet Layer, </strong>which is the third layer,<strong> </strong>receives the segments and attaches the origin and destination IP addresses on each segment so that irrespective of the route the segments may take, they know where they are going and where they came from. The segments are then sent to the final layer:</li><li>The<strong> Network Access Layer</strong>. It is responsible for the transmission of data between two devices on the same network. It defines how the data should be sent physically through the network.</li></ol><p><strong>HTTPS</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*kpweeGINesnMtoMG_2YxXg.jpeg" /></figure><p>With a common method of communication in place, the browser sends a HTTPS request, over TCP/IP, to the web server and waits for a response.</p><p>Yes, I remember too. HTTPS appeared in the first part of our URL from step 0: https:// . Lets see what that means and the purpose it serves:</p><p>HTTPS, Hypertext Transfer Protocol Secure, is a variation of HTTP protocol, a standard application-level protocol on top of <strong>TCP/IP</strong> that supports exchange of files such as text, image, audio, video, e.t.c, between a web client and a web server on the internet.</p><p>HTTPS, order than it’s variant, HTTP, ensures data security over a network by encrypting all requests sent by the web client to the web server as well as all responses sent by the web server to the web client. HTTPS is encrypted using a protocol called Transport Layer Security (TLS), formerly known as Secure Sockets Layer (SSL).</p><p>With HTTPS, highly confidential online transactions like online banking and online shopping order forms are safe from attackers. To assure web users of this security, most web browsers display a padlock icon in the address bar to visually indicate that a HTTPS connection is in effect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*27mfayu7Hs3ZCUkI6LNZ9w.jpeg" /></figure><h3>Step 3: The Web Server Responds With A Web Page</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*8yx-fZ8wXAOSzgOSaRRBIQ.jpeg" /></figure><p>What exactly is a web page? A web page is a document, usually written in HTML, that’s displayable by a browser.</p><p>Once the web client sends a request, the web server checks if the resource (which is usually a file, or files) required to satisfy the request is present. If it is, it sends a HTTPS response with the resource. Otherwise, it checks it’s static <strong>database</strong> for the resource. And if found, it sends a HTTPS response.</p><blockquote>A database is a collection of organized information set up for easy access, management, update and retrieval by a computer.</blockquote><p>Resources to some requests may not exist in the webserver or it’s static database and the request may need to be processed in order to generate the resource. To do this, the web server sends a request to an <strong>Application server</strong> which in turn would contact the Application database in order to get some details as it processes the request. Once done with the processing it sends a response to the web server which in turn process it and sends a HTTPS response to the web client.</p><p>An <strong>Application server </strong>is a server specifically designed to run applications. It includes both hardware and software that provide an environment for programs to run.</p><p>However, in cases where no resource was found, or generated for a request, a 404 -page not found- error code is sent as response to the client.</p><p>Before a request hits the actual web server, it goes through some technologies to ensure security and constant service rendering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*wpg6x5otHchJ90rqAaXg4A.jpeg" /></figure><p><strong>Load balancer</strong></p><p>It’s always satisfying when a website responds fast to users demands</p><p>Think of a laptop running multiple, heavy programs synchronously. It would grow real hot, begin to run slowly, and eventually crash. This ,too, happens to webservers when they begin to receive more requests than they can actually handle.</p><p>To keep this from happening, companies that receive high traffic on their websites, Facebook for instance, deploy multiple individual servers [that render the same services] to reduce the amount of load on an individual server. They use something called a load balancer to distribute the requests evenly across the servers-which in turn increase the availability, reliability and efficiency of their application.</p><p>A load balancer is an intermediary responsible for efficiently sharing incoming network traffic evenly across a cluster of servers.</p><p><strong>Firewall — Web Servers Can Reject Specific Requests over the Internet</strong></p><p>A firewall blocks unwanted traffic and permits wanted traffic. Its purpose is to create a safety barrier between a private network and the public. It works by filtering incoming data and determines by it’s rules if the data is allowed to enter a network.</p><p><strong>Monitoring</strong></p><p>In order to know when an individual server is down or not functioning as expected, a monitoring software is deployed. It renders constant surveillance and gives reports according to statistics such as the amount of traffic, the speed of the request handling, and the status of servers.</p><p><strong>In A Nut Shell. What happens when you type in type </strong><a href="https://www.google.com/"><strong>https://www.google.com</strong></a><strong> and press ENTER?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6k17qiac8GqJw-k_-MiuWw.jpeg" /></figure><ol><li>The browser receives the URL and parses it into its protocol (https ) , domain name (www.google.com ), port (443 ), and location (implicitly, root / ).</li><li>The browser checks if the IP address to the domain name is already in its own or the OS’s cache. If so, it begins communication with the webserver. Otherwise, it uses DNS to get the IP address of the domain name.</li><li>The browser communicates with the webserver over TCP/IP by sending a HTTPS request to the webserver.</li><li>The webserver receives the request, gets the resource to satisfy the request, and sends the resource to the client using HTTPS.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ca7b7d4ff7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>