<?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: Richie Moluno</title>
    <description>The latest articles on DEV Community by Richie Moluno (@realrichi3).</description>
    <link>https://dev.to/realrichi3</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%2F805332%2F09f3ac79-9c70-4d77-a659-188519059d3f.png</url>
      <title>DEV Community: Richie Moluno</title>
      <link>https://dev.to/realrichi3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/realrichi3"/>
    <language>en</language>
    <item>
      <title>Control Structures</title>
      <dc:creator>Richie Moluno</dc:creator>
      <pubDate>Tue, 19 Apr 2022 20:38:17 +0000</pubDate>
      <link>https://dev.to/realrichi3/control-structures-30mj</link>
      <guid>https://dev.to/realrichi3/control-structures-30mj</guid>
      <description>&lt;p&gt;Control Structures enable developers to control the order of events in a program. They can be considered as the building blocks of computer programs. Control structures are commands that enable a program to “take decisions”, follow one execution path or another, repeat code, or continue linearly.&lt;/p&gt;

&lt;p&gt;There are three basic types of control structures namely;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sequential flow&lt;/li&gt;
&lt;li&gt;Selection or Conditionals&lt;/li&gt;
&lt;li&gt;Repetition (Loops or iteration)&lt;/li&gt;
&lt;/ul&gt;







&lt;h3&gt;
  
  
  Sequential flow
&lt;/h3&gt;

&lt;p&gt;For sequential flow, the program is executed in an ordered form, basically in the form in which the code blocks are written in the program. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RYHnVDiF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8psqs4ki0ft4uhn3toqh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RYHnVDiF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8psqs4ki0ft4uhn3toqh.png" alt="Source: GeekforGeetks.org" width="121" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first command in the sequence is executed first, the next command will only be executed after executing the previous one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = "Richie"
print(name)

age = 99
print(age)

print("Richie is 99 years old")

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

&lt;/div&gt;



&lt;p&gt;The code block above is an example of a python code. This would be the order of execution.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Assign the string "Richie" to the variable "name"&lt;/li&gt;
&lt;li&gt;Print name&lt;/li&gt;
&lt;li&gt;Assign an integer value of 99 to the variable "age"&lt;/li&gt;
&lt;li&gt;Print age&lt;/li&gt;
&lt;li&gt;Print "Richie is 99 years old"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt;&amp;gt;&amp;gt; Richie
&amp;gt;&amp;gt;&amp;gt; 99
&amp;gt;&amp;gt;&amp;gt; Richie is 99 years old

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

&lt;/div&gt;



&lt;p&gt;You can see that the print statements were executed according to the order in which they were written, it first printed the name then the age, followed by "Richie is 99 years old"&lt;/p&gt;







&lt;h3&gt;
  
  
  Selection or Conditional flow
&lt;/h3&gt;

&lt;p&gt;The idea behind conditional flow is that they allow you to control the code execution based on different conditions in the program. There are different types of conditional statements in programming.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if Statements&lt;/li&gt;
&lt;li&gt;while Statements&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  if statements
&lt;/h4&gt;

&lt;p&gt;Here you're essentially telling the computer to check if a certain value is true or false. If the condition is true, the computer needs to perform a certain action. If the condition is false, then the computer would perform a different action or continue in the original sequence of code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VUKopMeZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z2xhv2bt7skm4n17jj0u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VUKopMeZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z2xhv2bt7skm4n17jj0u.png" alt="If statements" width="474" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The general syntax for if statements are&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (condition/Boolean expression):
       statement A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br&gt;
Here's an example in python code&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8Qk_Nsl2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4nekkyiha8e5ebcuqkf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8Qk_Nsl2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4nekkyiha8e5ebcuqkf.png" alt="Image description" width="829" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, the "2 &amp;gt; 1" was the condition placed, and &lt;strong&gt;print("Hello world")&lt;/strong&gt; is the statement. Since 2 is greater than 1 the Boolean expression returns True. Now, that the condition has been met, python will proceed to execute the code within the if statement.&lt;/p&gt;

&lt;p&gt;What do you think will happen if the condition wasn't met? &lt;br&gt;
In this case, python will ignore the statement within the &lt;strong&gt;if&lt;/strong&gt; code block, and, continue to follow the original path of execution.&lt;/p&gt;

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

&lt;p&gt;Here, i changed the condition, so we have &lt;strong&gt;2 &amp;gt; 4&lt;/strong&gt; as the condition. 2 isn't greater than 4, this condition returns false. Now, python will ignore the statement within the if code block and continue in the original flow.&lt;/p&gt;

&lt;p&gt;Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; My name is Richie
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of printing "Hello world", our output would be "My name is Richie"&lt;/p&gt;

&lt;p&gt;For the example above, we had only two path of execution, there are cases where we may need more alternatives.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
If (Condition):
     [Module A]
Else:
     [Module B]
[End if structure]

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

&lt;/div&gt;



&lt;p&gt;Here, if the &lt;strong&gt;if&lt;/strong&gt; condition isn't met, the code within the &lt;strong&gt;else&lt;/strong&gt; block will be executed&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LlDa7HH3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/li2wjepzakvpxnyziiol.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LlDa7HH3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/li2wjepzakvpxnyziiol.png" alt="Double Alternative control flow" width="409" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To add multiple alternatives, you can use the &lt;strong&gt;else if&lt;/strong&gt; of &lt;strong&gt;elif&lt;/strong&gt; structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
If (condition A), then:
     [Module A]
Else if (condition B), then:
     [Module B]
        ..
        ..
Else if (condition N), then:
     [Module N]
[End If structure]

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br&gt;
This flow adds conditions to the &lt;strong&gt;else&lt;/strong&gt; code block. Here's an example below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--anw_xt-N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rixlj95fztl01lvzaj9d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--anw_xt-N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rixlj95fztl01lvzaj9d.png" alt="Image description" width="771" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 2 is less than 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output was so because, of all the conditions stated, only &lt;strong&gt;2 &amp;lt; 4&lt;/strong&gt; returned true, so python will proceed to execute the code within this block.&lt;/p&gt;







&lt;h3&gt;
  
  
  Repetition (Loops) structure
&lt;/h3&gt;

&lt;p&gt;For loops, the program repeats a sequence of steps as often as long as the conditions placed are valid. It is similar to selection and conditional flow, since they both have a condition. And this condition has to be met before executing the code within the block.&lt;br&gt;
The difference is that, the code within the block will be executed continuously as long as the condition is True.&lt;/p&gt;

&lt;p&gt;Here, it requires a statement that initializes the condition controlling the loop, and there must also be a statement inside the module that will change this condition leading to the end of the loop.&lt;/p&gt;

&lt;p&gt;There are generally two types of looping techniques namely;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;While loops&lt;/li&gt;
&lt;li&gt;For loops&lt;/li&gt;
&lt;/ol&gt;


&lt;h4&gt;
  
  
  While loops
&lt;/h4&gt;

&lt;p&gt;In while loops, a condition is first evaluated. If this condition returns True, only then will the program proceed to execute the statements within the block.&lt;br&gt;
Below, is the general syntax for while loops&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
while condition:
      statements

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

&lt;/div&gt;



&lt;p&gt;A While loop will run as long as the condition returns true. To avoid this there has to be a statement within the block that'll change the condition. This will lead to the end of the loop.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zn46yESn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x69hs468mibu7zivubor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zn46yESn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x69hs468mibu7zivubor.png" alt="source: geeksforgeeks.org" width="239" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's an example where i implemented while loops in python&lt;/p&gt;

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

&lt;p&gt;Condition --&amp;gt; counter &amp;lt; 5&lt;br&gt;
Module --&amp;gt; print hello world&lt;br&gt;
           print the value of the counter variable&lt;br&gt;
           increase counter by 1&lt;/p&gt;

&lt;p&gt;By increasing the counter by 1, it'll get to a point where the counter value will no longer satisfy the condition attached to the loop.&lt;/p&gt;

&lt;p&gt;The program will execute in the following manner&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Program starts.
2. counter is initialized with value 1.
3. Condition is checked. 1 &amp;lt; 5 yields true.
  3.a) "Hello World" gets printed 1st time.
  3.b) Updation is done. Now counter = 2.
4. Condition is checked. 2 &amp;lt; 5 yields true.
  4.a) "Hello World" gets printed 2nd time.
  4.b) Updation is done. Now counter = 3.
5. Condition is checked. 3 &amp;lt; 5 yields true.
  5.a) "Hello World" gets printed 3rd time
  5.b) Updation is done. Now counter = 4.
6. Condition is checked. 4 &amp;lt; 5 yields true.
  6.a) "Hello World" gets printed 4th time
  6.b) Updation is done. Now counter = 5.
7. Condition is checked. 5 &amp;lt; 5 yields false.
8 . Flow goes outside the loop.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Hello world
1
Hello world
2
Hello world
3
Hello world
4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  For loops
&lt;/h4&gt;

&lt;p&gt;In for loops, a set of instructions are repeated for every value in a sequence. The sequence may be a list, a dictionary, a tuple or even a string.&lt;/p&gt;

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

&lt;p&gt;The general syntax of a for loop is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
for loopingVariable in sequence:
      code block

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

&lt;/div&gt;



&lt;p&gt;Here the loop assigns the value of the first element in the sequence to the loopingVariable, then it executes the code. Then it assigns the second variable in the sequence to the loopingVariable, then it executes the code in the code block.&lt;br&gt;
It will do this for every element in the sequence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FpWeuDfu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vsvw6pz7vvlp8zt5j8o2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FpWeuDfu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vsvw6pz7vvlp8zt5j8o2.png" alt="Image description" width="854" height="104"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, letter is the loopingVariable&lt;br&gt;
"Hello" is the string&lt;/p&gt;

&lt;p&gt;What is happening here?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, the first element in the string "Hello" is 'H'. This first element is assigned to the variable letter. Then the print statement prints the letter and its' position index.&lt;/li&gt;
&lt;li&gt;The looping variable is then assigned to the second letter in the sequence, which is &lt;strong&gt;e&lt;/strong&gt;. Then the print statement prints the letter &lt;strong&gt;e&lt;/strong&gt; and its' position.&lt;/li&gt;
&lt;li&gt;The looping variable is then assigned to the second letter in the sequence, which is &lt;strong&gt;e&lt;/strong&gt;. Then the print statement prints the letter &lt;strong&gt;l&lt;/strong&gt; and its' position.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This will be repeated for all elements within the sequence till there are no more elements to assign to the looping variable.&lt;/p&gt;

&lt;p&gt;Output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
H is in position 0
e is in position 1
l is in position 2
l is in position 2
o is in position 4

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

&lt;/div&gt;



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

&lt;p&gt;Control structures change the flow of programs and enable us to construct complex sets of instructions out of simpler building blocks.&lt;/p&gt;

&lt;p&gt;As long as you understand the nature of the flow, the different control structures can be combined in any way. Conditionals can contain loops, Loops can also contain conditional. You can go a step further by adding loops within loops within conditionals. It all depends on what you want to achieve.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
      <category>devops</category>
    </item>
    <item>
      <title>Variable Declaration and Initialization</title>
      <dc:creator>Richie Moluno</dc:creator>
      <pubDate>Mon, 11 Apr 2022 18:47:40 +0000</pubDate>
      <link>https://dev.to/realrichi3/variable-declaration-and-initialization-50ek</link>
      <guid>https://dev.to/realrichi3/variable-declaration-and-initialization-50ek</guid>
      <description>&lt;h2&gt;
  
  
  VARIABLES
&lt;/h2&gt;

&lt;p&gt;In Programming languages, variables allow programs to store, load, and manipulate information which can be referenced later on. They also provide a means to store data with a label, this label is usually a descriptive name to give a developer an idea of the type of data stored. &lt;/p&gt;

&lt;h3&gt;
  
  
  Variable properties
&lt;/h3&gt;

&lt;p&gt;There are 4 major properties associated with variables;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A name&lt;/li&gt;
&lt;li&gt;A type&lt;/li&gt;
&lt;li&gt;A value&lt;/li&gt;
&lt;li&gt;Scope&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The name of a variable should describe the information that is stored within the variable. The name is very important because this is how we access the value stored in a location in memory.&lt;/p&gt;

&lt;p&gt;The type refers to the kind of data being stored, in some programming languages the data type must be defined before initializing the variable. This tells the compiler the kind of value to expect. Languages like this are, C++, Java, etc.&lt;/p&gt;

&lt;p&gt;In other languages, the data type of each variable doesn't need to be specified before initialization, for this case, the data type is inferred based on the value passed. Example is Python;&lt;/p&gt;

&lt;p&gt;All actions carried out within variables can be grouped into three major parts;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Variable Declaration&lt;/li&gt;
&lt;li&gt;Initializing the Variable: Access(Read) and Assign(Write)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Variable Declaration
&lt;/h3&gt;

&lt;p&gt;In declaring variables, this is basically where we announce the existence of the variable to the computer, the declarations simply gives an identifier to a value stored in memory&lt;br&gt;
The code below is a variable declaration example in type script&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let age: number;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here the identifier age refers to a number value stored at a certain location in memory, the general syntax for declaring variables her is&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let &amp;lt;name&amp;gt; : &amp;lt;type&amp;gt;;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;for C++ the syntax for declaring variables is&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;type&amp;gt; &amp;lt;name&amp;gt;:&lt;/code&gt;&lt;br&gt;
example &lt;/p&gt;

&lt;p&gt;&lt;code&gt;int age;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This tells the processor to reserve  a location in the computers memory, this location should be enough to store any value of integer type. &lt;br&gt;
After declaring the variable, whenever we refer to the variable name, the program knows the exact location in memory it reserved.&lt;/p&gt;

&lt;p&gt;There are specific rules to how we name variables;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Variables can not contain spaces&lt;/li&gt;
&lt;li&gt;Variables can only contain letters, numbers and undrescores.&lt;/li&gt;
&lt;li&gt;Variables names must begin with a letter&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Initializing a Variable
&lt;/h3&gt;

&lt;p&gt;Initializing a variable refers to the process wherein a variable is assigned its' initial value before it is used within the program. &lt;br&gt;
Initializing a variable comes after declaring the variable. A variable can not be used without first declaring it. &lt;br&gt;
In some programming languages, the declaration and initialization process can be done in one line.&lt;/p&gt;

&lt;p&gt;In python,  if we say &lt;code&gt;age = 50&lt;/code&gt;, the age variable is first declared and we don't need to specify the data type, since we passed in an integer, python infers the data type automatically.&lt;/p&gt;
&lt;h3&gt;
  
  
  Assigning a value
&lt;/h3&gt;

&lt;p&gt;Considering the example below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;height = 20
height = height + 60
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First the program, reserves a location in memory and assigns the label 'height' to it, it then stores the value 20 in that memory location.&lt;/p&gt;

&lt;p&gt;For the second line, python first evaluates what's on the right hand side, then passes that value to the memory location with the label 'height'. &lt;br&gt;
On the right hand side, python is faced with a variable &lt;code&gt;height&lt;/code&gt;, it goes to the location in memory with this label and retrieves the value stored within that location. &lt;br&gt;
The value stored here is 20, it then retrieves the stored value and evaluates 20 + 60 to 80, this is the new value.&lt;br&gt;
This value is then stored in a location in memory, then it's labelled 'height'. &lt;/p&gt;

&lt;p&gt;So whenever we call the variable height, the program searches for the location in memory with the label height, and returns the value within.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python: Syntax and Semantics</title>
      <dc:creator>Richie Moluno</dc:creator>
      <pubDate>Fri, 25 Mar 2022 01:19:20 +0000</pubDate>
      <link>https://dev.to/realrichi3/syntax-and-semantics-5ac9</link>
      <guid>https://dev.to/realrichi3/syntax-and-semantics-5ac9</guid>
      <description>&lt;h3&gt;
  
  
  SYNTAX
&lt;/h3&gt;

&lt;p&gt;The syntax of a programming language refers to the order to which different elements are combined to from valid expressions. These elements may be words, operators, or phrases. The syntax of a programming language doesn't have any relationship with the meaning.&lt;/p&gt;

&lt;p&gt;An example of a syntax rule for programming is the assignment statement:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;print(expression)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is a valid syntax for using the print statement in python. If we try this without the closed bracket --&amp;gt; print(expression, it'll return a SyntaxError since we didn't follow the correct syntax.&lt;/p&gt;



&lt;h3&gt;
  
  
  SEMANTICS
&lt;/h3&gt;

&lt;p&gt;Semantics emphasizes the meaning of a program, so it'll be understandable and easy to predict the outcome of execution.Semantics provides significant information needed to understand a program&lt;br&gt;
For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;while &amp;lt;Boolean expression&amp;gt; :
    &amp;lt;statement&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the general form of a WHILE statement in python. For the semantics,  when the value of the boolean expression is met, the embedded statement would run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;statement&amp;gt;
while &amp;lt;Boolean expression&amp;gt;:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code above has no valid meaning because, we placed the statement before the starting the While loop. In this case the syntax is correct, but the semantics is wrong.&lt;/p&gt;




&lt;p&gt;Another example is when we try to divide an integer by a string.&lt;br&gt;
For instance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = 3
y = "Richie"

print(x/y)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax for the code above is correct, but the semantics is wrong, because it doesn't send a valid meaning. An integer can not be divided by a string.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>programming</category>
      <category>python</category>
      <category>coding</category>
    </item>
    <item>
      <title>Python3 - Virtual Environments</title>
      <dc:creator>Richie Moluno</dc:creator>
      <pubDate>Thu, 10 Mar 2022 03:31:58 +0000</pubDate>
      <link>https://dev.to/realrichi3/python3-virtual-environments-5bc</link>
      <guid>https://dev.to/realrichi3/python3-virtual-environments-5bc</guid>
      <description>&lt;p&gt;In python, any interpreter you install by default works on the global environment which is not unique to each project. So, any project you start, for the packages needed, when installed or uninstalled they'll have an impact on the global environment.&lt;/p&gt;



&lt;h3&gt;
  
  
  Why Virtual environment
&lt;/h3&gt;

&lt;p&gt;For example Project_A and Project_B requires a certain package to work, lets call this package PackageB.&lt;br&gt;
At first it doesn't seem like a big deal, but lets say the two projects need a different version of the same package (PackageB), this is where the issue arises.&lt;/p&gt;

&lt;p&gt;A good approach to solving this issue is introducing a Virtual environment. It solves this by isolating each project in a seperate environment. In this case, any package installed in the virtual environment are specific to that environment i.e they are only installed in that environment alone when activated.&lt;/p&gt;

&lt;p&gt;As we proceed, i'll show you how to setup and activate a virtuanenv for python3&lt;/p&gt;



&lt;h3&gt;
  
  
  Install virtualenv for Python3
&lt;/h3&gt;

&lt;p&gt;Here are some of the prerequisite for setting up a virtualenv&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python3&lt;/li&gt;
&lt;li&gt;pip&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; To install Virtualenv with python3 run &lt;code&gt;python3 -m pip -U install virtualenv&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F4ok1tqb0m7u3ej20bodm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F4ok1tqb0m7u3ej20bodm.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2&lt;/strong&gt; After installing, we need to check the directory where python3 is installed on the system, to do this run &lt;code&gt;where python3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxnnfcuacrevoyk6shobe.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxnnfcuacrevoyk6shobe.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my case it's &lt;code&gt;C:/Users/HP/AppData/Local/Microsoft/WindowsApps/python3.exe&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Create the Virtualenv
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; After getting the python3 path, the next step is to create the virtual environment. To do this i first create my working folder &lt;code&gt;python-venv&lt;/code&gt; then navigate to this folder using &lt;code&gt;cd python-venv&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;python3 -m venv /path-to-new-virtual-environment&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Femk001ge5mlj3a134yvk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Femk001ge5mlj3a134yvk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the screenshot above, i used a relative path instead of the full path, for more on this refer to my previous article on &lt;a href="https://dev.to/realrichi3/relative-and-absolute-paths-2ll6"&gt;Relative and absolute paths&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2&lt;/strong&gt; &lt;br&gt;
If you navigate to your new venv folder you will notice a set of new folders (Lib, Include, Scripts), it shows that your venv was created successfully.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F5d6ogzv1sqxi5w0pr4uk.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F5d6ogzv1sqxi5w0pr4uk.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3&lt;/strong&gt; Now your virtual environment is set. To check for available commands and options for working with virtualenvs run&lt;/p&gt;

&lt;p&gt;&lt;code&gt;python -m venv -h&lt;/code&gt; this will display more like a reference summary of different command options available&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fkkne08e5nniuubfffsv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fkkne08e5nniuubfffsv2.png" alt="vevn help reference"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h3&gt;
  
  
  Activate the virtualenv
&lt;/h3&gt;

&lt;p&gt;At the current state if we run pip install any package, it will still install them globally, which is not what we want. In order to  install packages to our virtualenv we have to activate it. &lt;/p&gt;

&lt;p&gt;To activate the virtualenc, navigate to the root directory of the virtualenv and run &lt;code&gt;.\scripts\activate&lt;/code&gt; (note the slash direction).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F8gyu1b1sho4jctfwrwjy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F8gyu1b1sho4jctfwrwjy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your environment is activated you’ll see (python-venv) before your path in your terminal prompt like in the image above. Now all packages installed will be in the new virtualenv.&lt;/p&gt;

&lt;p&gt;To deactivate an active virtualenv, run &lt;code&gt;deactivate&lt;/code&gt; &lt;/p&gt;



&lt;h3&gt;
  
  
  Exporting the virtualenv
&lt;/h3&gt;

&lt;p&gt;Let's say you successfully finished a program that required you to install certain packages using pip, and you want your program to be available to others, a problem will arise since they'll need the exact packages and version. To fix this we have to export a list of packages used. To do this run &lt;code&gt;pip freeze &amp;gt; requirements.txt&lt;/code&gt;. This command exports a list of the packages to the requirements.txt file which can later be installed by others using &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>opensource</category>
    </item>
    <item>
      <title>CSS Selectors</title>
      <dc:creator>Richie Moluno</dc:creator>
      <pubDate>Mon, 07 Mar 2022 11:05:33 +0000</pubDate>
      <link>https://dev.to/realrichi3/css-selectors-35b8</link>
      <guid>https://dev.to/realrichi3/css-selectors-35b8</guid>
      <description>&lt;p&gt;CSS selectors are components of the CSS rule set, they are implemented for selecting the content of your web page you wish to style. CSS selectors choose elements in HTML based on the class, type, attribute, id etc.&lt;/p&gt;

&lt;p&gt;Selectors are those names that you give to your different styles.&lt;br&gt;
While creating a style, you define how each selector should work in terms of the size, color etc.&lt;/p&gt;

&lt;p&gt;Below are a few basic types of selectors for CSS;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CSS class selector&lt;/li&gt;
&lt;li&gt;CSS id selector&lt;/li&gt;
&lt;li&gt;CSS Universal selector&lt;/li&gt;
&lt;li&gt;CSS element selector.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  Class Selectors
&lt;/h3&gt;

&lt;p&gt;The CSS class selector selects the element to style based on it's specific class attribute.  It is used with a dot symbol " . " followed by the class name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.nameOfClass {
    CSS Declarations
              }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the general syntax for class selectors in CSS.&lt;br&gt;
Below is an example of how it is applied.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    width: 360px;
    height: 420px;
    background: rgba(216, 190, 190, 0.6);
    color: #fff;
    position: center;
    top: 150px ;
    border-radius: 15px;
    box-shadow: 0px 11px 35px 2px rgba(0,0,0,0.8);
    margin:auto;
    position: relative;    
}

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

&lt;/div&gt;






&lt;h3&gt;
  
  
  ID Selectors
&lt;/h3&gt;

&lt;p&gt;The CSS ID selector selects the element to style based on it's specific ID attribute. Each id is unique to a page, so only one element is attached to one ID although it's possible to use the same ID for more than one element, but this isn't done because it's against the normal convention. The ID selector is used with a hash symbol " # " followed by the ID name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#nameOfID {
    CSS Declarations
              }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the general syntax for ID selectors in CSS.&lt;br&gt;
Below is an example an ID selector applied with a login form.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#login-form {
    background-color: #FFFFFF;
    height: 400px;
    width: 400px;
    margin: 7em auto;
    border-radius: 1.5em;
    box-shadow: 0px 11px 35px 2px rgba(0,0,0,0.8)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Universal Selectors
&lt;/h3&gt;

&lt;p&gt;The CSS Universal selector is used to select all the elements on the page. It is used with an asterisk symbol " * ".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* {
    css declarations;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the general syntax for Universal selectors, in this case it'll point to all elements on the page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div * {
     font-family: sans-serif;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here it selects all the elements within the div tag and sets the font to sans-serif.&lt;/p&gt;




&lt;h3&gt;
  
  
  Element Selectors
&lt;/h3&gt;

&lt;p&gt;The Element selector selects the HTML elements by name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;element {
    CSS Declarations
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>css</category>
    </item>
    <item>
      <title>Relative and Absolute Paths</title>
      <dc:creator>Richie Moluno</dc:creator>
      <pubDate>Wed, 16 Feb 2022 10:44:54 +0000</pubDate>
      <link>https://dev.to/realrichi3/relative-and-absolute-paths-2ll6</link>
      <guid>https://dev.to/realrichi3/relative-and-absolute-paths-2ll6</guid>
      <description>&lt;h3&gt;
  
  
  WHAT ARE PATHS
&lt;/h3&gt;

&lt;p&gt;A path is a slash-separated list of directory names followed by either a directory name or a file name. Paths are similar to directories, a directory refers to a folder on a computer which has relationship with other folders within and around it.&lt;br&gt;
A path can be classified into Relative paths and Absolute paths.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RELATIVE PATHS&lt;/strong&gt;&lt;br&gt;
As the name suggests, it is a path relative to the current working directory. Relative paths make use of some special symbols (. and ..) which refer to the current directory and the parent directory. Since directories are hierarchical these symbols are used in moving up in the hierarchy.&lt;br&gt;
One major drawback of relative paths is, for instances where we want to move a document or file, we'll have to move the referenced data too&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ABSOLUTE PATHS&lt;/strong&gt;&lt;br&gt;
An Absolute Path is a full path specifying the location of a file or directory, The specialty of this pathway is that it begins from the root directory and leads to the locations i.e it is specified from the root directory or the start of the filesystem.&lt;/p&gt;

&lt;p&gt;Below is an example to illustrate how relative and absolute paths work.&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;C:

&lt;ul&gt;
&lt;li&gt;Desktop&lt;/li&gt;
&lt;li&gt;Scripts

&lt;ul&gt;
&lt;li&gt;NewFolder

&lt;ul&gt;
&lt;li&gt;name.txt&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;maindistro&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Files&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this case C: is the root directory, considering a case where we're working from  the "Scripts" folder and we want to access the name.txt file, the relative path would be &lt;code&gt;./NewFolder/name.txt&lt;/code&gt;, but the absolute path would start from the root directory which is &lt;code&gt;C:&lt;/code&gt; so it'll be &lt;code&gt;C:/Scripts/NewFolder/name.txt&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introduction to Charsets</title>
      <dc:creator>Richie Moluno</dc:creator>
      <pubDate>Tue, 08 Feb 2022 20:44:45 +0000</pubDate>
      <link>https://dev.to/realrichi3/introduction-to-charsets-3gkc</link>
      <guid>https://dev.to/realrichi3/introduction-to-charsets-3gkc</guid>
      <description>&lt;p&gt;&lt;strong&gt;CHARSETS&lt;/strong&gt;&lt;br&gt;
A charset is a set of different cahracters  that are being used or supported by a software and hardware, it's the key component behind displaying and editing numbers, text and symbols on a computer. These character sets are created through a process known as encoding.&lt;/p&gt;

&lt;p&gt;A computer or software has different purposes or tasks to carry out, the characters needed to perform a specific purpose are then grouped into a character set. When text is inputed through a keyboard or some other means, the character encoding map then maps  the characters you chose  to the specific byte memory.&lt;/p&gt;

&lt;p&gt;Some example of Charsets are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ASCII&lt;/li&gt;
&lt;li&gt;UNICODE&lt;/li&gt;
&lt;li&gt;UTF-8&lt;/li&gt;
&lt;li&gt;UTF-16&lt;/li&gt;
&lt;li&gt;UTF-32&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;ASCII and UNICODE&lt;/strong&gt;&lt;br&gt;
ASCII is short for American Standard Code for Information Interchange. Unicode and ASCII are the two most used character encoding standards in the Technology sector, they are basically standards on how to represent set of characters in written form, these characters include, symbols, digits, lowercase letters and uppercase letters.&lt;/p&gt;

&lt;p&gt;Most of these characters are represented in binary form since it is easier for computers to store numbers than letters, these characters are then written, stored and transmitted in digital media.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Differences between ASCII and UNICODE&lt;/strong&gt;&lt;br&gt;
One of the major differences between ASCII and UNICODE is the way they encode characters, ASCII only encodes a set of characters which include, letters, numbers and symbols but in the case of UNICODE, it encodes a much larger range of characters.&lt;/p&gt;

&lt;p&gt;Originally ASCII used seven bits to encode each character which was inadequate, to sort out this issue Extended ASCII was introduced, it then increased from 7bits to 8bits. &lt;br&gt;
For UNICODE, it uses a variable bit encoding program, here you can choose between 8, 16 and 32 bit encodings.&lt;/p&gt;

&lt;p&gt;One other significant difference is the number of characters being accomodated by each of the encoding standards. UNICODE accomodates more characters than ASCII this is why most written languages are supported by UNICODE, Chinese is a good example of these languages. It also supports right-to-left scripts like Arabic.&lt;/p&gt;

&lt;p&gt;Unicode is the IT standard for encoding texts for both Computers and telecommunication devices, but ASCII only encodes characters for electronic communication only.&lt;/p&gt;

&lt;p&gt;Larger space is occupied by UNICODE because it is a superset of ASCII, and ASCII uses less space.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Git Branches and Collaborative workflow</title>
      <dc:creator>Richie Moluno</dc:creator>
      <pubDate>Thu, 03 Feb 2022 22:03:45 +0000</pubDate>
      <link>https://dev.to/realrichi3/git-branches-and-how-they-work-29e1</link>
      <guid>https://dev.to/realrichi3/git-branches-and-how-they-work-29e1</guid>
      <description>&lt;br&gt;
Before going into what Git and Github is, lets go over version control systems and it's appliction to the tech space. VCS is short for Version control system, it is a Version management system that tracks changes in files along with the order in which the changes to these files were made.

&lt;p&gt;Git is an example of a Version control system (VCS), Github is different from Git, but since they are used side by side it is often confused for Git. Github is more like a shared hosting platform for all repositories and applies Git for effective collaboration within organizations and developers. One of the  features Github provides is forking. Forking is basically creating a copy of the main repo on your user account so experimental changes can be made without affecting the main product.&lt;/p&gt;

&lt;h3&gt;
  
  
  Collaborative workflow
&lt;/h3&gt;

&lt;p&gt;With collaboration being one of the major strengths of Git and Github, it also allows for synchronous development within teams of developers or organizations. &lt;br&gt;
Below is a visual representation of Github workflow, references will be made to this diagram as we continue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xcseUBmD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l22r1a696n8rq14b25ha.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xcseUBmD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l22r1a696n8rq14b25ha.png" alt="Workflow" width="880" height="672"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Assuming you want to start working on a project&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fork:&lt;/strong&gt; 
A fork is basically a remote copy of the original repo. To make a fork of the original repo, &lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Navigate to the top right corner of  the repository and click "Fork". &lt;/li&gt;
&lt;li&gt;Select the destination of the Fork, you'll most likely choose your Github profile. In this case we'll refer to the main repository as &lt;em&gt;upstream&lt;/em&gt; and the forked repos on you profile as &lt;em&gt;origin&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clone:&lt;/strong&gt; The next step would be making a copy of the remote repository and sending it to your local machine. To do this, simply Open your terminal and navigate to the directory of your choice on your working machine then run &lt;code&gt;git clone &amp;lt;url to remote repository&lt;/code&gt;. Here we're cloning the forked repo.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now you're ready to start working and editing file, before doing anything, you'll have to create a new branch and this will be your development branch. To do this, run:&lt;br&gt;
&lt;code&gt;git checkout master&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git checkout -b name_of_new_branch&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If some changes has been made to the original repository maybe by other devs, you can update your local repo by running the &lt;em&gt;fetch&lt;/em&gt; command. &lt;br&gt;
&lt;code&gt;git fetch upstream&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git merge upstream/master&lt;/code&gt;  &lt;em&gt;To merge changes with master branch.&lt;/em&gt;&lt;br&gt;
This will make sure you have the latest version of the repo.&lt;br&gt;
If changes were found you'll have to sync your remote forked repo to keep it upto date, run &lt;code&gt;git push origin branchname&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pull Request&lt;/strong&gt;: This is done when changes from the local repo are synced with the forked repo and they are ready to be pushed to the main repository. These changes are not fully merged to the main repo, they'll have to go through review by the admin before the merge request will be accepted.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  BRANCHES
&lt;/h3&gt;

&lt;p&gt;A branch is used to create a copy of a repository at a particular time, it stores the state of the repo at that point in time and forms an independent line of development, i.e changes made to the repository while in this branch won't affect the state of the main project. &lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Branches
&lt;/h3&gt;

&lt;p&gt;Branches can be classified based on their use, some examples of these branches are namely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The master branch&lt;/li&gt;
&lt;li&gt;The dev branch&lt;/li&gt;
&lt;li&gt;The feature branch&lt;/li&gt;
&lt;li&gt;The hotfix branch&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These branches have unique applications in collaborating with git.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Master branch&lt;/strong&gt;: The master branch is the main working line, like the main state of the project. It has to be with as little errors as possible this is why it isn't used as the main working branch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Dev/Develop branch&lt;/strong&gt;: It is normally used as a kind of staging environment or testing environment where new features will be developed and tested before being merged to the master branch to effect the changes of the new code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Features branch&lt;/strong&gt;: Most work in projects may have several features to be rolled out at different point in time, development of these features usually start from the master branch so it'll carry along the code history of the whole project and start from the most recent release state of the application. After development of each feature, it is  then branched out and then merged with the Dev branch, it has no direct access to the master branch. There can only be one master and dev branch, but git allows for multiple features branch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Hotfix branch&lt;/strong&gt;: This branch is used in cases where the application has a bug and needs to be rectified urgently, here a branch is created from the master branch, then work is done to fix the bug before being merged with the Dev branch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common branch operations
&lt;/h3&gt;

&lt;p&gt;It's good to understand that branches are just git pointers to commits in time, creating a branch doesn't change the repository&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating a branch&lt;/strong&gt;&lt;br&gt;
To create a branch named feature1 use&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git branch feature1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This only creates a new branch &lt;em&gt;feature1&lt;/em&gt; any commit made now won't be saved on this branch because we're still on the master branch, to switch to the new branch, we use&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout feature1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now any changes or commits made to the code will be saved in the new branch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deleting a branch&lt;/strong&gt;&lt;br&gt;
Once you've finished working on a branch, you can merge it to the master or dev branch before deleting it, deleting the branch won't affect the repositories history except the changes made in the branch has not been merged.&lt;br&gt;
To delete the &lt;em&gt;feature1&lt;/em&gt; branch, use&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git branch -D feature1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note that the previous command will only delete the copy of the &lt;strong&gt;feature1&lt;/strong&gt; branch on the local machine, another copy will still be on the remote repository, to delete the &lt;em&gt;feature1&lt;/em&gt; branch from the remote repository, run&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push origin --delete feature1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pull a remote branch&lt;/strong&gt;&lt;br&gt;
To pull a branch from the remote repo use &lt;em&gt;git pull&lt;/em&gt; against the origin and specify the branch name.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git pull origin &amp;lt;branch name&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git branch&lt;/code&gt; to check the list of available branches&lt;br&gt;
&lt;code&gt;git checkout &amp;lt;branch name&amp;gt;&lt;/code&gt; to switch the pointer to the new branch&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Merging branches&lt;/strong&gt;&lt;br&gt;
To merge branches we use the &lt;code&gt;git merge&lt;/code&gt; command, but before doing that, you have to switch to the branch you want to merge to example &lt;em&gt;master&lt;/em&gt; branch.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout master&lt;/code&gt; to switch to the master branch&lt;br&gt;
&lt;code&gt;git merge feature1&lt;/code&gt; to merge the &lt;em&gt;feature1&lt;/em&gt; branch to master&lt;/p&gt;

&lt;p&gt;This is only valid for a local repository, to merge with a remote branch, we use &lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push --set-upstream origin &amp;lt;branch name&amp;gt;&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
