<?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 Bryan Ortiz on Medium]]></title>
        <description><![CDATA[Stories by Bryan Ortiz on Medium]]></description>
        <link>https://medium.com/@bryanortiz_4077?source=rss-8616b118779a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*E_JUpQ6EvUF3MrlV6R0niw.jpeg</url>
            <title>Stories by Bryan Ortiz on Medium</title>
            <link>https://medium.com/@bryanortiz_4077?source=rss-8616b118779a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 06:43:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bryanortiz_4077/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[Everything is an object in Python]]></title>
            <link>https://medium.com/swlh/everything-is-an-object-in-python-f073f6a4b9b6?source=rss-8616b118779a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f073f6a4b9b6</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[holberton-school]]></category>
            <dc:creator><![CDATA[Bryan Ortiz]]></dc:creator>
            <pubDate>Wed, 03 Jun 2020 00:50:13 GMT</pubDate>
            <atom:updated>2020-06-04T00:06:31.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*hv5HvaB84ceDRVD1kmcUjQ.jpeg" /><figcaption><strong>Bottom-line, everything we see in this world is composed of atoms (little tiny objects)</strong></figcaption></figure><blockquote>“When all you have is a hammer, then everything looks like a nail” — Bernard Baruch.</blockquote><p>If you have heard the saying from Bernard Baruch that’s written above, then you know that it means: open your mind, not everything is a nail just because you have a hammer. But even though that explanation applies for the real world, if you immerse yourself in the artificially created universe of python, then you can safely assume that everything that looks like an object is in fact an object, and anything that does not, is an object as well.</p><p>Because in Python, <strong>E-V-E-R-Y-T-H-I-N-G</strong> is an object, from the types: int, float, bool, strings and tuples; to lists, dictionaries, and many more.</p><blockquote><strong>Mutable Vs Immutable Objects</strong></blockquote><p>An <strong>immutable object</strong> is the one that cannot be changed or edited once its been created (i.e. string or float).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*S8Xn1KZe96RR09gbvJZztg.png" /><figcaption>If we try to modify a letter of string_1 we get an error because strings are immutable and do not support item assignment.</figcaption></figure><p>Python understands that if you write something in between apostrophes like the word <em>“hello”</em> for example, then that word becomes a <strong>string object</strong> automatically. And if we assign that string object to a variable (i.e. string_1), then the variable becomes a <strong>label</strong> for that object. Furthermore, any object can be pointed by several labels(variables) at the same time. However, if we change <em>“hello”</em> for <em>“hi”</em>, for the variable<strong> string_1</strong>, then that variable will be the label for another object, which is <em>“hi”,</em> who has a different <strong>id, </strong>because <strong>each object can only have one unique identifier or id.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*sXi553aZ4uhaMPv8F0_qQA.png" /><figcaption>In this case, the immutable object “hello” has two labels (string_1 and string_2) until string_1 changes to be the label of the object “hi”</figcaption></figure><p>On the other hand, a <strong>mutable object</strong> is the one that can change throughout the run-time of the program, just as a blue car that was painted red, and had its wheels replaced did not become another car, the same happens with a “list” (an example of a mutable object type) in python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*rNLwvFH5rKz14g12HEGtrg.png" /><figcaption>List that contains 3 types of elements (int, float and string).</figcaption></figure><p>You can change some elements from it through time, but the<strong> “id” </strong>of the list would remain the same, meaning the list would be the same object throughout the run-time of the program, unless being deleted before, off course. In the following picture, you can see that we replaced the string “forty two” for the string “meaning of life”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*3AM4Pe4CMZAJWsATf6GnXA.png" /><figcaption>The <strong>id</strong> of <strong>list_1 </strong>remained the same after one of it’s elements was modified.</figcaption></figure><p>Bellow you can see a diagram which classifies each type in Python as mutable or immutable, and the relationship between those types and the variables that are assigned to them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*9kiAZD84Si42iszuGZ8A-Q.png" /></figure><p>But wait, by this time you may be asking yourself, how are the objects created on python?. Well there are objects that come by default, like the ones mentioned above (tuple, int, string, etc.), and some that we as users can create.</p><blockquote><strong>Classes and Instances</strong></blockquote><p>The first step to create an object, is through a <strong>class. </strong>A class is like a blueprint, in which the general requirements are written, like in cars, some basic requirements to consider are: it needs to have wheels, engine and doors for people to be able to enter. We don’t need to specify what color, or how powerful the engine needs to be at the class level, we can leave that to the instance level. The instance is the same as the object that belongs to the class.</p><p>Let&#39;s say we make a class <strong>Car</strong>, so the object in this class is off course a car, but personalized; meaning it has some specific attributes. Let say we want to build a blue Camaro with an engine of 3000 cc and two doors, or we could make another Car object (a caprice) that’s yellow, with 1300 cc, and four doors. Both of them are cars but with different attributes, which in python are called <strong>instance attributes</strong>, precisely because they can be different for each object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*9hQG-IeLcj7ZyH_DRcAhUA.png" /><figcaption>Note: The __init__method is used in Python to initialize instance attributes</figcaption></figure><blockquote><strong>How arguments are passed to functions</strong></blockquote><p>When you pass an object as an argument in a function, what python does is to pass a new reference (or label) of that object into the function, so for example, if we pass a list (mutable object) as an argument, changes can be made to the list from within the function through the new reference that points to it. Remember, a new reference does not mean a new copy of the list, so thats why every change made to the reference is made to the original list itself, like we can see in the picture bellow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H5yDyNaI8yTQ3j2siALEqw.png" /><figcaption><strong>n</strong> (the argument)<strong> </strong>is the new reference or label to the list <strong>l1,</strong> if you change the fist element of<strong> n, t</strong>hen you the original list is modified as you can see above<strong>. This type of functions are </strong>called <strong>modifiers</strong> and the changes they make are called <strong>side effects</strong>.</figcaption></figure><p>But off course if you assign <strong>n</strong> to point to the object <strong>v</strong> is pointing, then if you print <strong>n </strong>is going to print [4, 5, 6] but <strong>l1</strong> would still print the original list [“Item changed”, 2, 3], like you can see in the example bellow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h3BaSSMgEGJgkRYznPMPDg.png" /></figure><p>If you don’t want an argument in a function to modify your original list, then you need to use <strong>pure functions</strong>, which are the ones that make a copy of the object first, and then work on that copy, like you may see on the next image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5P1aZXqZHyRxzAqccVpDjw.png" /><figcaption><strong>copy = n[:] </strong>makes a copy of the original list, so any change that comes after that, does not affect the object pointed by<strong> l1.</strong></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f073f6a4b9b6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/everything-is-an-object-in-python-f073f6a4b9b6">Everything is an object in Python</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What happens when you type ls -l in the shell]]></title>
            <link>https://medium.com/@bryanortiz_4077/what-happens-when-you-type-ls-l-in-the-shell-7007c39ea350?source=rss-8616b118779a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7007c39ea350</guid>
            <category><![CDATA[shell]]></category>
            <dc:creator><![CDATA[Bryan Ortiz]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 04:39:41 GMT</pubDate>
            <atom:updated>2020-04-17T10:47:36.889Z</atom:updated>
            <content:encoded><![CDATA[<h3>Shell for dummies</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*bxcz4NLUg9vqfhifB1lY3A.jpeg" /></figure><p>If you are trying to build a shell in c language, this is the blog that you should read.</p><p>The shell is a command line interpreter, what it does is help the user communicate with the operating system via the kernel. The Kernel is at the core of the OS and its in charge of handling processes and only understands binary (zeros and ones), so what the shell does is to translate human language to computer language so that is easier for a user to interact with the operating system the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*E5zAuv4aViGzaR2u63KTjg.jpeg" /></figure><p>The mechanism by which an application requests a service to the operating system receives the name of a system call. A system call provides the services of the OS to the user programs via the Application Program Interface(API).</p><p>One very important system call used to make a shell work is “fork()”. When this function is called, the operating system clones the current process so that a command can be executed inside this newly creayed independent copy, without affecting the main process of the shell (also called the parent process). This cloned process receives the name of child, and can be used among another system call named “execve” (which takes over this child process) to be able to execute the command typed by the user in the command line.</p><p>The command that’s going to be executed is always the first word typed by the person, and the shell needs to be able to associate it with an executable file stored somewhere in a directory, but in order to be able to find it, the program has to be capable of accessing the PATH variable, where all the directory names who store an executable file related to any shell command, are located.</p><p>The problem is that all this directory names are linked together in one sentence, only separated by a column “:”, so in order to get them one by one as an independent string, we need to use a system call named “strtok”. What this function does is to break a sentence into different tokens using any symbol as a separation parameter (also used for the command line inputted by users in the prompt).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ovquv9qyDRpVo1Spt-kqQ.png" /><figcaption>Directories stores in the PATH variable (they need to be separated into tokens)</figcaption></figure><p>Now, if the shell verifies that a line of command is valid using a syscall named “stat”, then it immediately associates that command to an executable file located in one of the directories of the PATH. What follows is the execution of that file using the“exceve” system call in the child process, and once the execution of the file is completed, the child or cloned process exits and lets the parent process continue running the shell, waiting for another command to be typed in the promtp ($: ), so that another child process can be created and executed once more. The way the shell makes the parent wait for the child process to be executed, and continue after its exit, is made possible by the “wait()” syscall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*EF7DjoX21RM4NiBfOMi6eA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7007c39ea350" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What happens when you type gcc main.c]]></title>
            <link>https://medium.com/@bryanortiz_4077/what-happens-when-you-type-gcc-main-c-da33809677ab?source=rss-8616b118779a------2</link>
            <guid isPermaLink="false">https://medium.com/p/da33809677ab</guid>
            <dc:creator><![CDATA[Bryan Ortiz]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 04:30:23 GMT</pubDate>
            <atom:updated>2020-02-06T04:30:23.604Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/304/0*Ck5zHU04bTUnbfSw" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da33809677ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What happens when you type ls *.c]]></title>
            <link>https://medium.com/@bryanortiz_4077/what-happens-when-you-type-ls-c-3203d646239d?source=rss-8616b118779a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3203d646239d</guid>
            <dc:creator><![CDATA[Bryan Ortiz]]></dc:creator>
            <pubDate>Tue, 04 Feb 2020 04:03:49 GMT</pubDate>
            <atom:updated>2020-02-04T04:03:49.751Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/748/0*vgqpsh4hJ1JMBKXb.jpg" /></figure><p>Ls *.c is a command that displays all files that end with .c, in other words, it filters and finds the files that has some code written in c language inside them. files like this:</p><blockquote>file_written_in_c_language.c</blockquote><p>And since it has the “*” command, which is a wildcard, then it looks for all of the c files available inside the directory in Linux.</p><p>Next time you want to see only the files with c code written inside, try this scrip, and if you desire to see the file in long format you can add and “<em>-l</em>” to it like this:</p><blockquote>0x03-shell_variables_expansions$ ls -l *c</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3203d646239d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference between a hard link and a symbolic link]]></title>
            <link>https://medium.com/@bryanortiz_4077/difference-between-a-hard-link-and-a-symbolic-link-96badb70f282?source=rss-8616b118779a------2</link>
            <guid isPermaLink="false">https://medium.com/p/96badb70f282</guid>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Bryan Ortiz]]></dc:creator>
            <pubDate>Tue, 04 Feb 2020 03:39:24 GMT</pubDate>
            <atom:updated>2020-07-05T20:39:48.042Z</atom:updated>
            <content:encoded><![CDATA[<h3>Difference between a hard link and a symbolic (soft) link</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fAmOjKw2biWaXHWz.jpg" /></figure><p>This article is part of a Holberton School project, therefore is to be taken as an informal article which helps to understand <strong>hard links</strong> and <strong>symbolic links </strong>and their main differences in Linux.</p><p><strong>Hard Links:</strong></p><p>A hard link is a shortcut to another file, like its name says, it is linked with a the <strong>inode </strong>of an existing file in Unix operating systems. The inode is a data structure which stores important information (metadata, location, access, modification, permission data) of a file, and its a unique number that acts as an address of the file, just like a home address does for a house in a city.</p><blockquote>Creating a hard link: “<strong>ln file_name_file hardlink”</strong></blockquote><p><strong>Symbolic Link (Soft links)</strong></p><p>A <strong>symbolic link</strong> is a file-system object that points to another file system object. The object being pointed to is called the target.Its also called soft link because unlike hard links they are not linked to the inode of a file, therefore if the file is deleted the symbolic link will be useless. But its main advantage is that it can be linked to directories since directories are nothing more than folders than contain the files, and this folders do not have a <em>inode address.</em></p><blockquote>Creating a symbolic link: “ln -s file_name softlink”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96badb70f282" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>