<?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 Chase on Medium]]></title>
        <description><![CDATA[Stories by Chase on Medium]]></description>
        <link>https://medium.com/@chaserabenn?source=rss-f149a281c093------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fo6Nr_IzE20VVfgH0ay9-g.jpeg</url>
            <title>Stories by Chase on Medium</title>
            <link>https://medium.com/@chaserabenn?source=rss-f149a281c093------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:50:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chaserabenn/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[Understanding Binary]]></title>
            <link>https://chaserabenn.medium.com/understanding-binary-a373fe1a2489?source=rss-f149a281c093------2</link>
            <guid isPermaLink="false">https://medium.com/p/a373fe1a2489</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[numbers]]></category>
            <category><![CDATA[binary]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Chase]]></dc:creator>
            <pubDate>Sun, 02 May 2021 16:43:38 GMT</pubDate>
            <atom:updated>2021-05-10T00:25:50.652Z</atom:updated>
            <content:encoded><![CDATA[<p>An Introduction to the 0s and 1s</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h3q0Gv0fu9MR9bnE" /><figcaption>Photo by <a href="https://unsplash.com/@daniellanner?utm_source=medium&amp;utm_medium=referral">Daniel Lanner</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Why you should read this article</h4><p>Even before I learned how to code, I knew there was something called binary and that it was the language computers spoke. I assumed that at some point during my 15 week bootcamp, we would discuss the elusive 0s and 1s but I was wrong. As it turns out, the code I was writing in JavaScript was being compiled and translated into 0s and 1s as instructions for the computer to understand. You may be thinking “ok, so I do not need to know about binary or number systems to code, then why should I bother learning it at all?” Even though understanding number systems is not required to code, it remains essential to our understanding of Computer Science. If you have any interest in taking a deep dive into how computers work, your starting point should be number systems and specifically, binary.</p><h4>The numbers we know, aka decimal</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AP_XYvl8ipEuelIn" /><figcaption>Photo by <a href="https://unsplash.com/@chrisliverani?utm_source=medium&amp;utm_medium=referral">Chris Liverani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Numbers are presented to us in something called place-value notation. This means that both the digit and its position(or place-value) must be known to determine its value.</p><p>Let’s look at this in the context of our number system. 5 by itself would be considered in the first position in our number system and therefore to determine its value we multiply it by 1 and get 5. What if the 5 is in the second position? The second positions in our number system multiplies the digit by 10, making its value 50. What if the 5 is in the third position? The third position multiplies the digit by 100, making its value 500.</p><p>I am sure most of you are saying “duh” right now. But breaking numbers down like this will help us understand other number systems we encounter. Another way of looking at the above is that each place value is determined by raising 10 to an ever increasing value (multiplying 10 by itself a certain number of times) and multiplying the result by the digit. For these reason, our number system is called base 10 or decimal. In the above examples:</p><blockquote>5 in the first position = 5 *10⁰ = 5 * 1 = 5<br>5 in the second position = 5 * 10¹ = 5 * 10 = 50<br>5 in the third position = 5 * 10² = 5 * 100 = 500</blockquote><p>The number 10 not only determines the order of magnitude for each place-value but also represents the number of possible values for each digit, which is 0–9. The above example only uses a single digit in different positions but what if we have multiple digits in different positions.</p><blockquote>2 in the first position = 2*1⁰ = 2* 1 = 2<br>5 in the second position = 5 * 1¹ = 5 * 10 = 50<br>6 in the third position = 6* 1² = 6* 100 = 600<br>600 + 50 + 2 = 652</blockquote><p>One thing to note is 0 which represents a position with no value, regardless of the position it is in. 0 times 10¹⁰ (10,000,000,000) is still 0. For this reason, the lowest digit that carries value is 1, not zero.</p><p>With only 10 possible digits in each position, what happens when the highest possible digit (9) increases by 1? We add the lowest digit that carries value to the next position and reset the current position to 0 or no value. In other words, 9 becomes 10.</p><h4>The numbers computers know, aka binary</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7vzbjzuqZ_aDRO5s" /><figcaption>Photo by <a href="https://unsplash.com/@umby?utm_source=medium&amp;utm_medium=referral">Umberto</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now that we have had a grade school math refresher and introduced some new glossary terms, we will break down binary in the same way we did our numeral system of base 10.</p><p>To begin, ask yourself what you know about binary. Odds are your answer will be that each position can only be a 0 or 1. Given what we discussed above, what base would binary be? The answer is 2. Base 2 not only means that each position can only have one of two possible digits but also that the order of magnitude of each place-value increases by powers of 2 instead of 10, as is the case with our number system.</p><p>Let us use the model from our base 10 examples to break down binary, using the number 1</p><blockquote>1 at the first position (1) = 1 * 2⁰ = 1 * 1 = 1<br>1 at the second position (10) = 1 * 2¹ = 1 * 2 = 2<br>1 at the third position (100) =1 * 2² = 1 * 4 = 4<br>1 at the fourth position (1000) =1 * 2³ = 1 * 8 = 8<br>1 at the fifth position (10000) =1 * 2⁴ = 1 * 16 = 16</blockquote><p>The above demonstrates how we can convert binary numbers to decimal based on 1 being at different positions and having different place-values. If the binary number is 11111, we can add all the above values up to get the total value in decimal</p><blockquote>11111 = 1 + 10 + 100 + 1000 + 10000 = 1 + 2 + 4 + 8 + 16 = 31</blockquote><p>Another way of looking at this is</p><blockquote>11111 is 100000 minus 1 or <br>(1 * 2⁵) - 1 = 32 - 1 = 31</blockquote><p>To make sense of this, we need to do some basic counting in binary. 0 and 1 are the only two possible numbers in each position with 1 being the number with the highest value. Starting with 0, if we add 1, we get 1 (same thing we see in decimal if we were to add 1 to 0). What happens if we add 1 to 1? Just as is the case with 9 in decimal, when we add 1 to 1 in binary, we add the lowest digit of value to the next position and reset the current position.</p><blockquote>1 + 1 = 10</blockquote><p>Following this pattern of increasing by 1</p><blockquote>0<br>1<br>10<br>11<br>100<br>101<br>110<br>111<br>1000</blockquote><p>Converting 0–100 in binary to decimal:</p><blockquote>0= 0 * 2⁰ = 0 * 1 = 0<br>1= 1* 2⁰ = 1 * 1 = 1<br>10=(1*2¹) + (0 * 2⁰) = (1 * 2) + (0 * 1) = 2 + 0 = 2<br>11=(1* 2¹) + (1* 2⁰) = (1 * 2) + (1 * 1) = 2 + 1 = 3<br>100=(1*2²) + (0 * 2¹) + (0 * 2⁰)= (1 * 4) + (0 * 2) + (0 * 1) = 4 + 0 + 0 =4</blockquote><p>This helps us understand binary as a number system but their true value in computers is more than simply representing decimal numbers in a different way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lujmH2mY_9CL5Gl3" /><figcaption>Photo by <a href="https://unsplash.com/@huefnerdesign?utm_source=medium&amp;utm_medium=referral">Tim Hüfner</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Turning binary in building blocks</h4><p>How does a series of 0s and 1s become every computer application that has ever existed? Just as letters can be grouped to form words, words to form sentences, and sentences to form paragraphs. Binary can be grouped to represent everything from a simple decimal number (as we saw above) to complicated and elaborate instructions dictating the behavior of a character in a computer game.</p><p>Above, 0s and 1s were referred to as digits in the context of comparing binary to our number system. However, in the context of the code where binary is the foundation of every computer operation, 0s and 1s are bits. That is to say a 0 by itself is a bit and a 1 by itself is also a bit. When eight bits are grouped together, they form a byte. Finally a familiar term!</p><p>Besides numbers, one of the simplest uses of a byte is to represent a letter. This is done with the American Standard Code for Information Interchange, or ASCII, which “is a character encoding standard for electronic communication. ASCII codes represent text in computers”.</p><blockquote>ABC: 01000001 01000010 01000011<br>Hello, world!: 01001000 01100101 01101100 01101100 01101111 00101100 00100000 01110111 01101111 01110010 01101100 01100100 00100001</blockquote><p><em>(Make your own secret messages in binary </em><a href="https://www.rapidtables.com/convert/number/ascii-to-binary.html"><em>here</em></a><em>)</em></p><p>If one byte can only hold a single letter, you can imagine how many are needed for a song, movie, or game.</p><p>This is obviously and extensive topic but as the subtitle of this article says, this is meant to be an “Introduction to the 0s and 1s”, not a definitive guide. I hope this article can serve as a starting point for your own exploration into binary and other Computer Science concepts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a373fe1a2489" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API and Object Interaction Extravaganza Part Two]]></title>
            <link>https://medium.com/analytics-vidhya/api-and-object-interaction-extravaganza-d0328e3f07a6?source=rss-f149a281c093------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0328e3f07a6</guid>
            <category><![CDATA[json]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[tty-prompt]]></category>
            <dc:creator><![CDATA[Chase]]></dc:creator>
            <pubDate>Mon, 01 Jun 2020 05:43:21 GMT</pubDate>
            <atom:updated>2021-05-17T14:28:57.410Z</atom:updated>
            <content:encoded><![CDATA[<h3>API and Object Interaction Extravaganza in Ruby</h3><h4>Part Two: From Execution to Integration</h4><h4>Continued from <a href="https://medium.com/@chaserabenn/api-and-object-interaction-extravaganza-a0ce928fbc2a">Part 1: From Sandbox to API Set Up</a></h4><p>Part Two Sections</p><ul><li><a href="#f4e8">Ruby API Step 5: Use an API</a></li><li><a href="#e1da">Ruby API Step 6: Make it Dynamic</a></li><li><a href="#372b">Conclusion</a></li></ul><h4>Step 5:</h4><p>It is time to make some magic with our endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DFJRYgiHGyPHVAP4" /><figcaption>Photo by <a href="https://unsplash.com/@nft?utm_source=medium&amp;utm_medium=referral">Nicolas Tissot</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Before we do that, we should get some definitions out of the way (some new, some review). The following definitions are oversimplified for the purpose of understanding the rest of this post. Each of these terms could be the subject of their own blog post so do not feel as if you need to completely understand what they are right now (because I do not). You just need to trust that, in this context, each of these things do an important thing.</p><pre>GET Request: an online request that our system sends to another systems that hosts information we are looking for.</pre><pre>Parse: when you break something down into parts so they can be read and manipulated. E.g. Breaking a sentence down into words and those words into individual characters.</pre><pre>Nested Data Structure: a sometimes maddening mix of hashes and arrays inside of each other. The JSON-parsed (see below) response to a GET request will be some form of nested data. Think of it as the coding equivalent of a Russian Nesting Doll.</pre><pre>Web Resource: Anything that can be obtained from the web and uniquely identified. E.g. that one puppy photo you love.</pre><pre>URI: Uniform Resource Identifier. A string of characters that identifies and names a web resource. Also, a Ruby Module with a library of methods and functions. When you see lowercase &quot;uri&quot;, it refers to the web resource identifier and when you see uppercase &quot;URI&quot;, it refers to the Ruby Module.</pre><pre>URL: Uniform Resource Locater. A web address that is the location of a web resource on a network. Since it is a unique location, the URL for a resource is also technically its name.</pre><pre>Net::HTTP : A built-in Ruby class that has a library of functions and methods that can be used to build user-agents like URI.</pre><pre>Net::HTTPOK : Ruby Class and the type of object that is returned when a GET request is called with Net::HTTP. It has a method “body” that you will be using. Loves enthusiastically saying &quot;OK&quot; after regular Net::HTTP has done all the work.</pre><pre>JSON: JavaScript Object Notation. A complex, yet human-readable, way of storing, transferring, and presenting the nested data from the GET response. Think of it as the drill sergeant of the GET Request response. JSON marches in and gets everyone in order.</pre><p>Remember, the goal of all of this is to GET data that your program can break apart and manipulate. We could try to build out a custom translator method that sorts through the GET response or we can just rely on the glorious library of built-in methods that Ruby has already made for us. I think I will go with the latter.</p><p>Please note that the apiKey listed is not real so you will not be able to create a real GET request to Spoontacular unless you sign up for an account.</p><p>Set up your system to use URI and Net::HTTP</p><pre>require ‘open-uri’</pre><pre>require ‘net/http’</pre><p>Save the the endpoint url to a variable &quot;url&quot;</p><pre>url = “https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc&amp;ingredients=onion+pepper&amp;number=10”<br></pre><p>Call the parse method on the URI module and pass the variable “url” in. The result is saved to variable “uri.&quot; In other words, we parse the url and get back a uri.</p><pre>uri = URI.parse(url)</pre><pre># =&gt; #&lt;URI::HTTPS https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc&amp;ingredients=onion+cheese&amp;number=10&amp;ranking=2&gt;</pre><p>Create a GET request with Net::HTTP.get_response and pass in the variable &quot;uri&quot;. The return value (or response) from this GET request is a Net::HTTPOK object that we will save to variable &quot;response&quot;</p><pre>response = Net::HTTP.get_response(uri)</pre><pre>#=&gt; #&lt;Net::HTTPOK 200 OK readbody=true&gt;</pre><p>We call the body method on “response” which retrieves the body text from the response. This is done because the body of the response has the data we want.</p><pre>response_body = response.body</pre><pre>#=&gt;”[{\”id\”:514079,\”title\”:\”Easy Pinwheel Steaks with Spinach and Cream Cheese\”,\”image\”:\”https://spoonacular.com/recipeImages/514079-312x231.jpg\&quot;,\&quot;imageType\&quot;:\&quot;jpg\&quot;,\&quot;usedIngredientCount\&quot;:1,\&quot;missedIngredientCount\&quot;:2,\&quot;missedIngredients\ . . . ”</pre><p>Wow, what a mess. As you can see, at this point, response_body is a string of nested data mixed with all kinds of formatting notation. It ain’t pretty. This jumble of characters contains the data we want but in a way that is not accessible. Luckily, we have a way to clean the response up.</p><p>Here comes JSON to save the day.</p><pre>require ’json’</pre><pre>json_response = JSON.parse(response_body)</pre><pre>#=&gt; [<br>     {“id”=&gt;514079, <br>     “title”=&gt;”Easy Pinwheel Steaks with Spinach and Cream Cheese”, <br>     “image”=&gt;”https://spoonacular.com/recipeImages/514079-312x231.jpg&quot;, <br>     “imageType”=&gt;”jpg”, <br>     “usedIngredientCount”=&gt;1, <br>     “missedIngredientCount”=&gt;2, <br>     “missedIngredients”=&gt;<br>         [{“id”=&gt;11457, <br>           “amount”=&gt;4.0,<br>           “unit”=&gt;”oz”, <br>           “unitLong”=&gt;”ounces”, <br>           “unitShort”=&gt;”oz”, <br>           “aisle”=&gt;”Produce”, <br>           “name”=&gt;”baby spinach leaves”, <br>            “original”=&gt;”4 oz. fresh baby spinach leaves”,        <br>            “originalString”=&gt;”4 oz. fresh baby spinach leaves”}]}]</pre><p>Beautiful! Finally something we can work with. We have used a Ruby library designed to deal with JSON and called the library’s “parse” method to take the response_body and get rid of all of the formatting notation that was preventing us from accessing and understanding the data we requested.</p><h4>Step 6:</h4><p>Time to bring it all together.</p><p>The code above is great but it is hardcoded. If you plan to manually enter the the user’s selected ingredients in every GET Request, you may as well not make a program at all and just have the users text you directly for the recipe information. The idea is to bring automation to the process</p><p>To demonstrate how the code above can be built into your application, we will go through snippets from UIOLI</p><p>We will need a class dedicated to making GET requests when called. Remember OlderKid from the sandbox? This is what OlderKid became. However, it would not make sense to call this calls OlderKid so instead we will go with GetRequester. GetRequester will take in a url and run it through all of the code we just discussed.</p><pre>require ‘net/http’</pre><pre>require ‘open-uri’</pre><pre>require ‘json’<br></pre><pre>class GetRequester</pre><pre>    def initialize(url)</pre><pre>        @url = url</pre><pre>    end<br></pre><pre>    def get_response_body</pre><pre>        uri = URI.parse(@url)</pre><pre>        response = Net::HTTP.get_response(uri)</pre><pre>        response.body<br>    end<br></pre><pre>    def parse_json</pre><pre>        JSON.parse(self.get_response_body)</pre><pre>    end</pre><pre>end</pre><p>With the class defined this way, we only need to call the #parse_json method on the instance of GetRequester. This is because parse_json also calls the other method in the GetRequest class definition: get_response_body. In one method we can parse the url with uri, creates a GET request with Net::HTTP, call the body method on the response to that request, and finally have JSON parse the data into pure NDS delight.</p><pre>recipe_url = “https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc&amp;ingredients=onion+pepper&amp;number=10”</pre><pre>recipes = GetRequester.new(recipe_url)</pre><p>We set the code up. Now we need to connect this class with the user input functions of Use It Or Lose It.</p><p>The TTY-Prompt in our app (thank you <a href="https://medium.com/u/9eba2377ff56">Grant Yoshitsu</a>) has just received a selection of ingredients from the user and saved it to an array.</p><pre>uioli_array = [&quot;onion&quot;, &quot;pepper&quot;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hA1SsrDuk6h97mmf" /><figcaption>Photo by <a href="https://unsplash.com/@davornisevic?utm_source=medium&amp;utm_medium=referral">Davor Nisevic</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We need to convert the data that we got from the user into the form necessary for interpolation. This form is a string of food items separated by “+” per the API documentation. The end result we are looking for is “onion+pepper” so we will use the join method on the array and save it to variable “uioli_items.”</p><pre>uioli_items = uioli_array.join(“+”)</pre><p>Now we can use recipe_url and it will have the correctly formatted user inputed pasted in where the string interpolation field used to be.</p><pre>recipe_url = “https://api.spoonacular.com/recipes/findByIngredients?apiKey=12abc12&amp;ingredients=#{uioli_items}&amp;number=10&amp;ranking=2&quot;</pre><p>Great! Our url is ready to be passed into an instance of GetRequester. We will call parse_json on the instance and save it to variable “response”</p><pre>recipe_url = “https://api.spoonacular.com/recipes/findByIngredients?apiKey=12abc12&amp;ingredients=onion+pepper&amp;number=10&amp;ranking=2&quot;</pre><pre>response = GetRequester.new(recipe_url).parse_json</pre><p>You may have noticed above, when we went over JSON parsing, that there is TONS of information about each of the 10 recipes that got returned from our GET. However, we only need two pieces of information from each recipe: name and id. For this reason, we will write a method called “clean_recipes” to clean up the nested data and only save the information we want to an array of hashes.</p><pre>recipes = [{“name” =&gt; “Chicken Soup”,</pre><pre>           “website_id” =&gt; “19283”},</pre><pre>           {“name” =&gt; “Spaghetti and Meatballs”,</pre><pre>           “website_id” =&gt; “39290”}]</pre><p>This method will create an empty array, iterate through each recipe, save the name and Id to the hash as key/value pairs, shovel the hash into the array we created, and return the array.</p><pre>def clean_recipes(recipes) </pre><pre>    recipes =[] </pre><pre>    <br>    url.each do |recipe| </pre><pre>        recipe_hash = {} </pre><pre>        recipe_hash[“name”] = recipe[“title”].titleize </pre><pre>        recipe_hash[“website_id”] = recipe[“id”] </pre><pre>        recipes &lt;&lt; recipe_hash</pre><pre>    end</pre><pre>    recipes </pre><pre>end</pre><p>Finally, we will call the clean_recipes method and pass in recipes (the json-parsed response to the GET request). This will be saved to variable “results”.</p><pre>results = clean_recipes(recipes)</pre><p>TTY-Prompt takes over from here and presents the recipe names to the user for selection.</p><h4>We have arrive at the end . . .</h4><p>Yowza! That was a lot of information. My goal with this article was provide some perspective on and insight into APIs. Earlier, I said that APIs are exciting and I meant it. As a novice programmer, learning how to use API brought my applications to life. No longer are my applications doomed to a MacBook prison. They can talk to and interact with a whole universe of systems and the data they hold. The possibilities of what we can create are endless.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0328e3f07a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/api-and-object-interaction-extravaganza-d0328e3f07a6">API and Object Interaction Extravaganza Part Two</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API and Object Interaction Extravaganza Part One]]></title>
            <link>https://medium.com/analytics-vidhya/api-and-object-interaction-extravaganza-a0ce928fbc2a?source=rss-f149a281c093------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0ce928fbc2a</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Chase]]></dc:creator>
            <pubDate>Mon, 01 Jun 2020 03:50:56 GMT</pubDate>
            <atom:updated>2021-05-17T14:28:03.753Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FmamdTU1rSPj4n34" /><figcaption>Photo by <a href="https://unsplash.com/@luca_tism?utm_source=medium&amp;utm_medium=referral">Luca Laurence</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>API and Object Interaction Extravaganza in Ruby</h3><p>APIs are exciting. I am serious. Stop laughing at me.</p><p>They have the ability to turn a sandboxed coding project into an application that interacts with the world outside of your computer and local files. There is a lot of information coming your way so let me list the sections in advance:</p><ul><li><a href="#51f8">Thinking About Object Interaction &amp; Program-to-Program Communication.</a></li><li><a href="#de6e">Connection the Dots</a></li><li><a href="#2955">The Client/Server Model.</a></li><li><a href="#02ef">Use It Or Lose It</a></li><li><a href="#65c0">Ruby API Step 1: Understanding</a></li><li><a href="#cd16">Ruby API Step 2: Searching &amp; Selecting</a></li><li><a href="#ee56">Ruby API Step 3: Get Access</a></li><li><a href="#b03c">Ruby API Step 4: Endpoints</a></li><li><a href="https://medium.com/analytics-vidhya/api-and-object-interaction-extravaganza-d0328e3f07a6">Ruby API Step 5: Use an API</a></li><li><a href="https://medium.com/analytics-vidhya/api-and-object-interaction-extravaganza-d0328e3f07a6">Ruby API Step 6: Make it Dynamic</a></li><li><a href="https://medium.com/analytics-vidhya/api-and-object-interaction-extravaganza-d0328e3f07a6">Conclusion</a></li></ul><h3>Thought Experiment Time</h3><p>Imagine a bunch of kids in a sandbox, in the middle of a field. In the distance, the kids can see people, buildings, cars, etc. They are generally aware of what these things are but have no way of interacting with them. One day, three of the children notice a bakery. With their eyes transfixed on the storefront, the children watch a typical interaction unfold: a customer enters, the cashier takes the customer’s order, a baker brings out a loaf of bread, the cashier requests payment, the customer gives payment, then takes the loaf and leaves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ZGY2KJSUIQR6-n9Jcr4Lng.jpeg" /></figure><p>The three children immediately start to play make-believe bakery and each of them assumes one of the three roles in the bakery (customer, cashier, baker). When it comes time for the customer to pay, the cashier says “that’ll be one million dollars.” An argument ensues between the cashier and the customer over the true price of the loaf.</p><p>The argument goes on and on due to the fact the children have no concept of how much the bread actually costs. Tired of all the bickering, the baker leaves her imaginary bakery and asks one of the older kids to walk over to the real bakery that inspired the game in the first place and get the true price of a loaf of bread. The older kid does just that and returns a few minutes later with the information. Thereby putting an end to the cashier-customer quarrel and allowing imaginary business to resume.</p><h3>Connecting The Dots</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_9qifL19za27lNsy" /><figcaption>Photo by <a href="https://unsplash.com/@alinenok?utm_source=medium&amp;utm_medium=referral">Alinenok</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The make-believe game described can be viewed as a Bakery application with four classes: Customer, Cashier, Baker, and OlderKid. The Customer, Cashier, and Baker serve as the conspicuous workings of our Bakery. However, without OlderKid, the Bakery is doomed to forever float in make-believe.</p><p>Imagine the kids continue their bakery into adulthood and eventually decide to start an online shop called Bread.com that allows online customers to order bread from bakeries across the city. Bread.com will do this by connecting with various bakeries’ websites,(e.g. Citybakery.com) and getting the type and price of each of the bread loaves they offer. All of the sudden, the importance of the OlderKid is much more apparent. OlderKid would be the determining factor in the viability of the the online bakery, since it would be OlderKid’s role to provide accurate information from all the bakeries around the city.</p><h3>The Client/Server Model</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*foB4e_aBvkbxduOR" /><figcaption>Photo by <a href="https://unsplash.com/@kelvin1987?utm_source=medium&amp;utm_medium=referral">Kelvin Ang</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The basic interaction between OlderKid and a bakery’s website is similar to one we use every time we visit a website. This interaction is called the Client/Server Model. The Client is your Browser, the Server is the machine hosting the website you are trying to view. The interaction can be viewed as a conversation between the Client and the Server. Think of clicking a link as initiating a dialogue:</p><p>You click a link, telling your browser to visit a website.</p><p>Your browser responds: “Great, I’ll get right on that”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*96fQp2BIhyjFx_wv" /><figcaption>Two Systems Communicating with Each Other by <a href="https://unsplash.com/@mihaisurdu?utm_source=medium&amp;utm_medium=referral">Mihai Surdu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Your browser says to the server hosting Google.com: “Hi! Can you send me the relevant files to display Google.com?”</p><p>The Server responds: “Sure thing! Here it is”</p><p>Your browser says to you: “I received the raw code and will now present it in format that is easy for humans like yourself to understand”</p><p>This entire conversation can happen in less than a second and if you look closely at the bottom of your browser when a website is loading, you can even catch the updates: “waiting for Google.com” “processing request.” This request and response interaction allows the server to control the flow of information and creates one gateway through which all clients can make requests. Essentially, the server makes it easy for any browser to contact and request info.</p><p>Comparing the client/server model to the relationship between Bread.com and Citybakery.com, we can see similarities. However, Bread.com is not a web browser that will just display Citybakery.com. Bread.com is trying to be the one-stop-shop for all of your bakery needs, pulling and presenting accurate data from bakeries around the city for its users. Luckily for Bread.com, we can build a mechanism for each of its partner bakeries that will allow OlderKid to get up-to-date information automatically, whenever he wants. That mechanism is an API.</p><h3>Use It Or Lose It</h3><p>At this point we are going to say goodbye to Bread.com and hello to “Use It Or Lose It,” an app that my classmate, <a href="https://medium.com/u/9eba2377ff56">Grant Yoshitsu</a>, and I made for our first project while attending <a href="https://medium.com/u/973c5cbfb09b">Flatiron School</a> (you can read more about Use It Or Lose It, from conception to execution by clicking <a href="https://medium.com/@chaserabenn/use-it-or-lose-it-a-debugging-story-825d55cd1ee">here</a>). The primary function of Use It Or Lose It(or “UIOLI” for short) is to provide recipes to users based on their selected pantry items. While conceptualizing UIOLI, we knew that an API would be required to execute this function.</p><h3>Using an API in Your Application</h3><h4>Step One</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7ksWkfZPbc9XxEdR" /><figcaption>Photo by <a href="https://unsplash.com/@emilymorter?utm_source=medium&amp;utm_medium=referral">Emily Morter</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The first step for Grant and I to make this happen, was to understand what the hell an API is.</p><p>API stands for Application Program Interface and is a set of rules that allow one program or system to communicate with another. The communication is accomplished through a GET request. Remember, the dialogue in the client/service model? When the client(your browser) sends a message to the server asking for more information, it is sending an HTTP GET Request. An API is utilized with its own GET request that can be used to integrate either data or functionality from one entity into another.</p><p>Examples of using an API for functionality include allowing visitors to your website the ability to create an account with their Facebook credentials or including a small Google Maps widget on your website. For UIOLI, we needed to find an API that could provide specific data which our application would then be able to manipulate and present to our users.</p><h4>Step Two</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OZDlluCJhlJBHrcW" /><figcaption>Photo by <a href="https://unsplash.com/@markuswinkler?utm_source=medium&amp;utm_medium=referral">Markus Winkler</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Once we sort of understood what we were dealing with, it was on to searching for and selecting an API. As this was my first time using an API, I ran a Google search for “easy to use food APIs.” I quickly found that there are thousands of options at your fingertips, but many of them are paid services so I changed the search to “easy to use food API free” to narrow the field. This new search provided a few options to compare. In order to do this, you need to look at an API’s documentation.</p><p>When you go to a particular API website, look for the “Doc” or “Documentation” link. This is where you will find an explanation from the API provider on what types of data you have access to and how you can get it. The API I found was from a company called “Spoontacular.” Below you will see the documentation for the particular endpoint (URL for a specific searchable dataset) called “Search Recipes by Ingredients.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9YouNXEM2WcgxzLVxg7WgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hKWozmqcl5plHpIirONACA.png" /></figure><p>After looking through the examples of GET requests on the documentation page, I decided Spoontacular would be perfect for UIOLI.</p><h4>Step Three</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6Z93oAmReEQeMGDH" /><figcaption>Photo by <a href="https://unsplash.com/@pechka?utm_source=medium&amp;utm_medium=referral">Dima Pechurin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It is time to get access to the API you selected. This is arguably the most straightforward step, as all you need to do is sign-up. You will either be signing up directly with the API company or with an API database, such as RapidAPI, that gives you access to thousands of APIs through one sign-up. After signing up, you will be given a unique API Key to access that company’s data.</p><h4>Step Four</h4><p>Next we needed to understand the endpoint, which is just the URL that we send our GET requests to. In other words, an endpoint is the thing you enter to get to the thing. Let’s look at endpoints in the context of an HTTP GET request to Google’s server for information about puppies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SFjO8eo2b_KdfFaG" /><figcaption>Photo by <a href="https://unsplash.com/@oddityandgrace?utm_source=medium&amp;utm_medium=referral">hannah grace</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>GET Request for Google homepage</p><pre>Endpoint: http://www.google.com</pre><p>GET Request for Google for Information about puppies</p><pre>Endpoint: https://www.google.com/search?q=puppies</pre><p>GET Request for Google for Images of puppies</p><pre>Endpoint: https://www.google.com/search?q=puppies&amp;tbm=isch</pre><p>GET Request for Google for Videos of puppies</p><pre>Endpoint: https://www.google.com/search?q=puppies&amp;tbm=vid</pre><p>Notice above, we include all information about our puppy search within the URL. An API Endpoint functions in a similar way. The main difference is that while you can visit Google.com without any queries attached, you cannot do this with an API endpoint. The purpose of the API is to send a query.</p><p>Let’s build the URL that we will use to access the API and as we do so, look at how different queries are delineated in the URL:</p><p>“?” marks the beginning of the queries</p><p>“&amp;” separates subsequent query types</p><p>“+” separates search items within one parameter type</p><p>Endpoint for getting recipes based on selected ingredients.</p><pre><a href="https://api.spoonacular.com/recipes/findByIngredients">https://api.spoonacular.com/recipes/findByIngredient</a>s</pre><p>There are no queries attached to the above URL so the response would be an error. The one query that is always required is the API key so we will add that first</p><pre><a href="https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc">https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc</a></pre><p>Wonderful! Now we have the authorization to access the data ready to send to the server with our GET request. There could be an API for “Returning all recipes” in which case no other queries would be required. In regards to this Spoontacular endpoint, the documentation does not allow a “return all” so at least one ingredient query is required</p><pre>https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc&amp;ingredients=onion</pre><p>Now we are searching for all recipes that have an onion as an ingredient. Maybe we should add one more for good measure:</p><pre><a href="https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc&amp;ingredients=onion+garlice">https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc&amp;ingredients=onion+garlic</a></pre><p>Spoontacular also allows you to set the number of search results you want to receive with the “number” parameter. For UIOLI, we only wanted 10 results per search:</p><pre><a href="https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc&amp;ingredients=onion+garlice&amp;number=10">https://api.spoonacular.com/recipes/findByIngredients?apiKey=123abc123abc&amp;ingredients=onion+garlice&amp;number=10</a></pre><p>Right now our URL includes three search parameters (apiKey, ingredients, and number) and we are ready to go!</p><h4><a href="https://medium.com/@chaserabenn/api-and-object-interaction-extravaganza-d0328e3f07a6">Click here for Part 2: From Execution to Integration</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0ce928fbc2a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/api-and-object-interaction-extravaganza-a0ce928fbc2a">API and Object Interaction Extravaganza Part One</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use It Or Lose It: A Debugging Story]]></title>
            <link>https://chaserabenn.medium.com/use-it-or-lose-it-a-debugging-story-825d55cd1ee?source=rss-f149a281c093------2</link>
            <guid isPermaLink="false">https://medium.com/p/825d55cd1ee</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[bootcamp]]></category>
            <dc:creator><![CDATA[Chase]]></dc:creator>
            <pubDate>Sat, 30 May 2020 06:19:12 GMT</pubDate>
            <atom:updated>2021-05-02T13:33:18.038Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Use It Or Lose It</strong></h3><h3>A Day in the Life of a Software Engineering Bootcamp Student</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*S_cSDBamjbs47d5mRKnK_Q.jpeg" /><figcaption>COMDEX ‘83</figcaption></figure><p>Let us revisit one of the most significant moments in computer history . . .</p><p>The year was 1983. Two young Fort Worth based engineers travelled to Las Vegas, where they planned to unveil their groundbreaking operating system at Comdex computer expo. There was a buzz in the air as the engineers set up their booth for the second day of Comdex. The only thing that exceeded the engineers’ hopes were the expectations of all the attendees. No one knew exactly what the engineers had created, only that it had the potential to be at the forefront of a computer revolution. A few hours later, the moment had arrived. Attendees packed-in along the aisle to get a glimpse of history. The engineers plugged in the computer, greeted the attendees, and with glowing and confident smiles, jointly pressed the return key. All of a sudden, the screen lit up, and the now famous words appeared . . .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*QJqlJvg07tvpXR7FIBHnoA.png" /></figure><p>A collective gasp was almost immediately drowned out by the mocking laughter of the attendees. One of the engineers put his head down in shame and closed his eyes. As he slowly opened them, he found himself not at Comdex but in a one-bedroom apartment in Williamsburg, Brooklyn.</p><p>After a momentary confusion, I put the pieces together: I was not an engineer at the dawn of the personal computer era but rather a software engineering student at <a href="https://medium.com/u/973c5cbfb09b">Flatiron School</a> and in the middle of a grueling debugging session. I had passed out while taking a quick break to watch an episode from one of my favorite shows: Halt and Catch Fire. Unfortunately, there was no hiding from this elusive NameError and even in my dreams, the bug found me. As I got back to work, I took a deep breath, let out a soft grunt, and thought “f**k this f**king error.” More on this later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*OftyfBSt6eR96Tesbo0llQ.jpeg" /><figcaption>The source of my debugging fever-dream. Courtesy of <a href="https://www.amc.com/shows/halt-and-catch-fire">Halt and Catch Fire on AMC</a></figcaption></figure><h4>The Bootcamp</h4><p>The <a href="https://medium.com/u/973c5cbfb09b">Flatiron School</a> Software Engineering bootcamp I am attending is 15 weeks long and divided into five three-week modules(or “mods”). The first two weeks of each mod are filled with lectures, discussions, group work, pair programming, and mini-projects. This leads to “Project Week” during which we discuss, plan, create, execute, debug, and present an application that will utilize everything we have learned up until that point and maybe a little more.</p><p>At the end of Mod 1, students are tasked with creating a CLI application. CLI stands for Command-Line Interface and was the precursor to the GUI, or Graphical User Interface, popularized by the Macintosh and Microsoft operating systems of the early 80s. Instead of windows, cursors, and colors, the CLI provides a simple text prompt to enter commands in order to interact with a computer. A CLI application is a great project for new coders as it allows them to focus on the foundation, database, and structure of a program rather than graphical bells and whistles. Those bells and whistles are certainly important, I just have not learned a thing about them yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Pb6bqczJxxg7yQuEHnaQ8A.gif" /><figcaption>Command Line Interface</figcaption></figure><h4>The Project</h4><p>On Tuesday of Mod 1 project week, we were assigned partners to tackle the CLI App and begin what, at the time, felt like an insurmountable task. I was paired with classmate <a href="https://medium.com/u/9eba2377ff56">Grant Yoshitsu</a>, with whom I had yet to interact. Grant and I quickly found common ground in our love of eating and decided that the focus of the app should be a pantry management system(exciting, right?). The next step was to decide how components of our program should interact with each other. That is to say, how should a user interact with their pantry, how should a pantry interact with a pantry item, and how should a pantry item interact with a user.</p><p>We continued spitballing ideas and discussed how cool it would be if we could generate recipes based on a user’s pantry items. However, no one with easy access to the internet has trouble finding recipes. We wanted to make an app that would not just mimic a simple google search but rather one that would solve a problem. Eventually, we found that problem: food waste.</p><p>We decided to provide our users with recipes that would maximize items nearing expiration. An item that either needed to be consumed or thrown away, where the user had two options: USE IT or LOSE IT. Just like that, we had the name of our app. Grant and I drew a diagram to reflect this new concept. We would have users, pantry items, “use it or lose it” items, recipe searches, recipe results, cookbooks, ingredients, and shopping lists. Each of these would be a different class of objects in our program and they would all be interacting with each other in an expansive web of chaos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mD3_7drTVxASkwdSzqJarg.png" /><figcaption>Original ORM for Use It Or Lose It</figcaption></figure><p>Even though our program would exist within the confines of a CLI, we were determined to provide easily accessible and relevant data to our users. Dividing up our responsibilities, Grant would handle the easily accessible aspect, while I would work on getting the relevant data. These would be created through TTY Prompt and API respectively, two things we knew little to nothing about. I am not going to get into how we learned and executed our aspects of the program but suffice it to say, it involved hours of blank stares, confusion, slowly reading documentation, trial-and-error, reading documentation even slower, and finally success.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*is6N4M9hVNXoJ29S-PQOpg.jpeg" /></figure><h4>Fall or Fly</h4><p>On Thursday morning, two days after our project was assigned, Grant and I were ready to bring our completed portions of the app together for testing. It was an amazing feeling. Not to be dramatic but it felt like I had jumped over a vast crevasse and just as I passed the halfway mark, certain I would imminently plummet to the ground, Grant caught me. We would either get our app working and fly or fail to do so and fall gloriously together.</p><p>Although the early debugging was flawless, at around 6pm, we hit a wall. Every time we ran our app from bin/run.rb, we would immediately be faced with the same error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*QJqlJvg07tvpXR7FIBHnoA.png" /><figcaption>HellError</figcaption></figure><p>Grant and I spent hours combing through every line of code. We followed the usual debugging protocol, searched message boards, and considered rewriting everything in new files just to make sure we were not missing the one line, the one command, the one god damn letter, that was causing this error. Nearly every project file and folder was moved, adjusted, or edited but no matter what we did, the result was the same and we continued our fast descent into the crevasse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*9rWRXbN1oksdjoDdcbZRjg.gif" /></figure><p>At this point, I was convinced the error had something to do with the environment.rb file, the mechanics of which I only had a superficial understanding(“superficial” is being generous). I copied and pasted into environment.rb with reckless abandon and, before I knew it, the file had quadrupled in size. Eventually, I snapped out of it, took a deep breath and looked at the current state of our sad environment.rb which was now as bloated as it was impotent. It was over, time to throw in the towel. “Is it too late for Grant and I to write something from scratch?” I thought.</p><p>I decided to manually revert all of the project files and folders back to their state when we first encountered the HellError. Manually because, in addition to everything else, I did not trust my novice GitHub skills and was concerned I would accidentally obliterate the entire project. As I put the final pieces back in place, I saw it. It was right in front of us the entire time: require_relative ‘../config/environment.rb’ was not at the top of bin/run.rb. It had either been removed on accident or had never been added at all. I added the missing line and upon running bin/run.rb got a new error. However, this was an error about TTY syntax. It was a great sign that we were back to our regular scheduled debugging. Grant took over and shortly thereafter he slacked me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*xGaHs0Km5QclU5Qvb3kIbQ.png" /></figure><p>Just like that, It was over. We ran the program a few dozen times with smiles glued to our faces. Use It Or Lose It, an idea that started as a few blocks and lines, had become a reality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q9BnKclGpaqFrq-CEzkBDg.png" /><figcaption>Welcome page for Use It Or Lose It by <a href="https://medium.com/u/9eba2377ff56">Grant Yoshitsu</a> &amp; <a href="https://medium.com/u/f149a281c093">Chase</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-fCNNYklnoT2rBiVzjcPTg.png" /><figcaption>TTY Prompt presenting data from API</figcaption></figure><p>I cannot begin to describe what an incredible experience this was and I could not have asked for a better partner. Use It Or Lose It may seem insignificant when compared to contemporary software but I am so proud of what we accomplished during those few days. It was the first time that I felt like I made a real application and I was fortunate enough to have an amazing partner to do it with.</p><p>The completion of our first project week marks the beginning of what is sure to be an exponentially challenging bootcamp. I know there will be many more stressful nights and TV-induced fever dreams but as I enter Mod 2, I am ready and excited for things to come.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=825d55cd1ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Avoiding the Sane-Drain:]]></title>
            <link>https://chaserabenn.medium.com/tips-on-staying-productive-mindful-relatively-sane-during-the-lockdown-7aa574e1a4c?source=rss-f149a281c093------2</link>
            <guid isPermaLink="false">https://medium.com/p/7aa574e1a4c</guid>
            <category><![CDATA[bootcamp]]></category>
            <category><![CDATA[mindfulness]]></category>
            <category><![CDATA[home]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Chase]]></dc:creator>
            <pubDate>Tue, 26 May 2020 22:57:21 GMT</pubDate>
            <atom:updated>2020-06-03T16:39:09.513Z</atom:updated>
            <content:encoded><![CDATA[<h4>Tips on Staying Productive &amp; Mindful While WFH.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*3Uh42dUoRQVJ6dQBxHdjow.png" /><figcaption>Photo by <a href="https://www.shutterstock.com/g/marish">Marish</a> on <a href="https://www.shutterstock.com/image-vector/working-home-coworking-space-concept-illustration-1675442791">Shutterstock.com</a></figcaption></figure><p>Working in isolation has been interesting. My daily life oscillates between two different realities; from dream remote work life to a post-apocalyptic world that somehow kept Netflix going.</p><p>My ability to manage my work environment was put to the test in late April, when I was accepted into the Flatiron School Software Engineering Bootcamp and had 80+ hours of prepwork to complete in just over a week. In response to this challenge, I decided to finally utilize a handful of the many work-life balance tips I had heard and immediately disregarded over the years. I am happy to report that not everything labeled #mindfulness is empty click-bate.</p><p>What follows are some of the practices that helped me prepare for and start the bootcamp with a positive mindset and healthy work environment. The best part is, these exercises can be done with minimal effort and you may notice results immediately. None of this is coming from a “look at me, I figured it out” position. These are three practices that dramatically improved my reality and I am happy to pass them along to anyone that finds themselves in a situation similar to what I described above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d8BWc5LOwwgXGARq" /><figcaption>Photo by <a href="https://unsplash.com/@hencetheboom?utm_source=medium&amp;utm_medium=referral">HENCE THE BOOM</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>Take Ten</strong></h3><p>The most important activity you can include in your daily schedule is to set 10 minutes aside for yourself. Sit in silence, with your eyes closed, and simply breathe. Set reminders, do it first thing in the morning, have an accountability buddy . . . just make it happen.</p><p>This is a chance for you to connect with yourself in a meaningful way. You may be thinking “the last person I need to spend more time with, after two months in lock-down, is myself.” Yes but consider the type of activities and quality of time you have been spending with yourself. Nothing can take the place of you carving out some time and truly being alone with nothing but the sound of your own breath to guide you.</p><p><em>[To get started with simple guided meditations before you take the training wheels off and go at it alone, visit </em><a href="https://www.headspace.com/meditation/10-minute-meditation"><em>Headspace</em></a><em>]</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*YpCUSD1r6sw3go-ZH69-KA.jpeg" /><figcaption>Napoleon in proper seated posture</figcaption></figure><h3><strong>Sitting 101</strong></h3><p>Is something crazy happening with your coffee tolerance? No matter how many cups you have, you find yourself utterly pep-less. Have you considered adding an extra scoop of grounds to the pot, figuring out how to combine the contents of two Keurig pods, or even googling “household chemicals possible stimulant safe?” Well, the solution is more simple and significantly safer: sit up straight.</p><p>How you sit and maintain your posture impacts every part of your body. Slouching inhibits the natural circulation throughout your body and keeps you in a consistently lethargic state. Sitting up “straight” allows for proper flow of your circulatory, respiratory, and digestive systems. When I say “straight”, I actually mean just the opposite: you should always sit in a way that allows all three natural curves of your spine to be properly supported.</p><p>Give it a shot and see how much more endurance and focus you have throughout the day. Circling back to “Take Ten,” one of my favorite meditation techniques involves flowing through body and making a note of anything that may be bothering you. Bring this awareness with you for the rest of the day and you will begin to notice how different posture impacts your mood and energy.</p><p><em>[More tips and trick on maintaining good seated posture from </em><a href="https://www.verywellhealth.com/how-to-sit-with-good-posture-296781"><em>Very Well Health</em></a><em>]</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*10f1K9pDGH_M9SC-" /><figcaption>Photo by <a href="https://unsplash.com/@amandadalbjorn?utm_source=medium&amp;utm_medium=referral">Amanda Dalbjörn</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>20–20–20</strong></h3><p>Even if you are not taking a coding bootcamp, you more than likely have a job that requires you to stare at a computer screen for long stretches of the day. This does not even include the amount of time you spend in front of a screen after work. If you just read the preceding sentences and said “yup, that’s me,” you are most likely headed for the land or eye-fatigue (if you have not already arrived).</p><p>Eye fatigue symptoms include: headaches, blurry vision, dry eyes, and light sensitivity. Some people swear by the benefits of blue-blocker glasses in preventing eye fatigue. However, before you jump on Amazon and start combing through reviews to find the best brand of blue-blockers, there is a simple eye exercise worth trying first: 20–20–20. Every 20 minutes, spend 20 seconds, focusing on something that is at least 20 feet away. That is all there is to it.</p><p><em>[More about 20–20–20 on </em><a href="https://www.healthline.com/health/eye-health/20-20-20-rule"><em>Healthline</em></a><em>]</em></p><p>No matter what tips or tricks you utilize to improve your mood and work environment, consistency is key. As I mentioned in “Take Ten,” set reminders, find an accountability partner to try these activities with, or whatever you need to do to make it happen and realize the long term benefits.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7aa574e1a4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>