<?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 John Daise on Medium]]></title>
        <description><![CDATA[Stories by John Daise on Medium]]></description>
        <link>https://medium.com/@jdaise?source=rss-9dc89ebcb01c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MyayllmY8aZjcZ1D</url>
            <title>Stories by John Daise on Medium</title>
            <link>https://medium.com/@jdaise?source=rss-9dc89ebcb01c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:06:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jdaise/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[My First Project]]></title>
            <link>https://medium.com/@jdaise/my-first-project-cc754d0241a5?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc754d0241a5</guid>
            <category><![CDATA[music]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[semantic-ui]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Wed, 18 Sep 2019 13:36:05 GMT</pubDate>
            <atom:updated>2019-09-18T13:36:05.820Z</atom:updated>
            <content:encoded><![CDATA[<p>This the first project that I completed on my own for bootcamp. It is called SetBuilder. SetBuilder is a simple organizational tool for singers/songwriters that uses vanilla javascript and ruby on rails.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F354874993%3Fapp_id%3D122963&amp;dntp=1&amp;url=https%3A%2F%2Fvimeo.com%2F354874993&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F807513676_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1003" frameborder="0" scrolling="no"><a href="https://medium.com/media/b89ccad315c1d797196c62a7c7722cc4/href">https://medium.com/media/b89ccad315c1d797196c62a7c7722cc4/href</a></iframe><p>Also check out my other projects below:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F350098125%3Fapp_id%3D122963&amp;dntp=1&amp;url=https%3A%2F%2Fvimeo.com%2F350098125&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F801256577_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea210cd1f62230dcc3c6cbf6a2ef1ae6/href">https://medium.com/media/ea210cd1f62230dcc3c6cbf6a2ef1ae6/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F348815785%3Fapp_id%3D122963&amp;dntp=1&amp;url=https%3A%2F%2Fvimeo.com%2F348815785&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F799566131_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1003" frameborder="0" scrolling="no"><a href="https://medium.com/media/14ec0bd61350751dd155b10e039b045e/href">https://medium.com/media/14ec0bd61350751dd155b10e039b045e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc754d0241a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connect 4]]></title>
            <link>https://medium.com/@jdaise/connect-4-1ccb68a21d46?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ccb68a21d46</guid>
            <category><![CDATA[connect-four]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Wed, 28 Aug 2019 15:29:12 GMT</pubDate>
            <atom:updated>2019-08-28T15:37:02.197Z</atom:updated>
            <content:encoded><![CDATA[<p>For a recent take home code challenge, I was tasked with creating a version of Connect 4 with several requirements. My only previous experience in developing a game was in a React tutorial where I created a version of Tic Tac Toe. For this reason I felt it made sense to employ React to handle the user interface. Here are a few takeaways that I got from the experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4wF6GJluBKURs7IHNJfrA.png" /></figure><p>In my most recent work experience, I mostly used Angular and we did not use any state management tools. Going back to React was pretty fun because it felt like I was able to get things up and running quickly. I almost forgot how valuable state management is in React. Being able to keep track of the board relatively easily.</p><p>Sadly while I was issued this challenge, I had to work a lot of hours for my part-time job and could not get a sub. This caused me to rush through this challenge. In doing so, the biggest mistake I made was using a functional programming approach rather than an object oriented approach. Had I used an object oriented approach, I could have created a GameState class and represented every possible move as an instance of said class. All possible moves/game states could be represented as a tree. And any time a winning or draw game state is reached, the game will end.</p><p>Using a functional programming approach opened up a can of worms because it made the game more susceptible to bugs. An object oriented approach would have almost immediately accessed a particular game state whereas using a functional approach would require the game to actively “think” about what piece is where on the board and what that might mean for the game’s outcome.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F2YnrEW3r9MXhrKIKew%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F2YnrEW3r9MXhrKIKew%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F2YnrEW3r9MXhrKIKew%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="324" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ae70d03b2a5a91a29eaad995730b156/href">https://medium.com/media/7ae70d03b2a5a91a29eaad995730b156/href</a></iframe><p>I think a good analogy for this would be to consider a musician who is improvising during a song. A functional programming approach would be to think about a note, process whether or not it fits within a particular chord of that song and then play that note if it is a valid note. An object oriented approach could be thought of as choosing notes considering the key that the song is in. An improvising musician who considers a song’s key could be much more efficient in their performance.</p><p>When I get more time, I’m going to revisit Connect 4. This was a great exercise and I really got an even deeper understanding of the value of object oriented programming. I highly recommend that anyone who is interested in learning about React or building games check out the Tic Tac Toe tutorial below.</p><p><a href="https://reactjs.org/tutorial/tutorial.html">Tutorial: Tic-Tac-Toe - React</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ccb68a21d46" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unison Project]]></title>
            <link>https://medium.com/@jdaise/unison-project-29fc2131cfae?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/29fc2131cfae</guid>
            <category><![CDATA[semantic-ui]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Thu, 25 Jul 2019 13:22:35 GMT</pubDate>
            <atom:updated>2019-07-25T13:22:35.229Z</atom:updated>
            <content:encoded><![CDATA[<p>Here is a brief video demoing my final project for bootcamp</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F350098125%3Fapp_id%3D122963&amp;dntp=1&amp;url=https%3A%2F%2Fvimeo.com%2F350098125&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F801256577_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea210cd1f62230dcc3c6cbf6a2ef1ae6/href">https://medium.com/media/ea210cd1f62230dcc3c6cbf6a2ef1ae6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29fc2131cfae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Frame Project]]></title>
            <link>https://medium.com/@jdaise/frame-project-faa8fdd31178?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/faa8fdd31178</guid>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Thu, 18 Jul 2019 12:54:27 GMT</pubDate>
            <atom:updated>2019-07-18T12:54:27.527Z</atom:updated>
            <content:encoded><![CDATA[<p>While in bootcamp, I built a simple marketplace app with two classmates. We had a blast putting this together.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F348815785%3Fapp_id%3D122963&amp;dntp=1&amp;url=https%3A%2F%2Fvimeo.com%2F348815785&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F799566131_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1003" frameborder="0" scrolling="no"><a href="https://medium.com/media/14ec0bd61350751dd155b10e039b045e/href">https://medium.com/media/14ec0bd61350751dd155b10e039b045e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=faa8fdd31178" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reseting Forms Using Redux]]></title>
            <link>https://medium.com/@jdaise/reseting-forms-using-redux-29ee185157ed?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/29ee185157ed</guid>
            <category><![CDATA[route]]></category>
            <category><![CDATA[withrouter]]></category>
            <category><![CDATA[props]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Tue, 11 Dec 2018 04:27:28 GMT</pubDate>
            <atom:updated>2018-12-11T04:27:28.945Z</atom:updated>
            <content:encoded><![CDATA[<p>While working on my final project I came across a little bug that was really annoying me. In my app whenever I selected an item in a dropdown menu on one page navigated away and back to that same menu, the value of the dropdown would remain at the same selected value. My goal was simply to have this dropdown reset to an unselected value. I googled around and found a couple solutions that did not quite work for me so I decided I needed to attack this problem from another angle.</p><p>What it boiled down to is that I needed to complete two tasks:</p><ol><li>Have a function in my actions that would reset the dropdown.</li><li>Find a way for the Dropdown component to “listen” for when the user navigates to another page.</li></ol><p>The first task was pretty straight forward. I used the code below to create a function that would reset my dropdown menu. This function is simply dispatched from my actions file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AH0Yr9M6YDlPNFfdKa2qIA.png" /></figure><p>Step 2 was a bit trickier in that I had to become more familiar the props are included within “withRouter” the package react-router-dom. The first step here is to wrap the Dropdown component with a higher order component in order to access to these props.</p><p>I already had my entire App component wrapped in the Browser Router component so that I could have access to withRouter. I next wrapped my Dropdown component with the withRouter, so that I could then have access to the history prop. Within the history prop there is a listen function that detects a route change. I utilized the function this way below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RX_P5IanTfnI0mbEv8wqrQ.png" /><figcaption>History has a listen function that can detect a change in the route</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mV_lH9sGUifo0SHvWbOvHw.png" /><figcaption>Dropdown Component (called PickEvent) is wrapped in withRouter</figcaption></figure><p>This function above calls on the dispatched reset dropdown function whenever it detects a change in the route. And this was how I was able to reset my dropdown.</p><ul><li><a href="http://www.ilonacodes.com/blog/clear-form-in-redux-when-navigating-with-react-router/">Clear Form in Redux when Navigating with React-Router</a></li><li><a href="https://github.com/ReactTraining/react-router/issues/3554">Is there any event/hook to detect route change? · Issue #3554 · ReactTraining/react-router</a></li><li><a href="https://stackoverflow.com/questions/37406584/react-router-redux-dispatch-an-async-action-on-route-change">React Router + Redux - Dispatch an async action on route change?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29ee185157ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working on a React App]]></title>
            <link>https://medium.com/@jdaise/working-on-a-react-app-56ff146d3e26?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/56ff146d3e26</guid>
            <category><![CDATA[filters]]></category>
            <category><![CDATA[semantic-ui]]></category>
            <category><![CDATA[atomic-music]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[keyword-search]]></category>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Wed, 03 Oct 2018 17:32:02 GMT</pubDate>
            <atom:updated>2018-10-07T20:41:37.168Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Working on a React App</strong></p><p>For practice, I decided to take a weekend to build a simple website using my newly learned skills in React. It was a learning experience and I am beginning to understand the enthusiasm around React. For my side project I built a simple guitar store site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hMkH2e5uqYTkGAxVIoGR9Q.png" /></figure><p>I set forth a list of features that I wanted to build out with this project:</p><ol><li>Render an inventory of instruments from a database.</li><li>Create, Read, Update and Delete items in the inventory.</li><li>Build a Keyword Search that would filter the items in the inventory.</li><li>A dropdown that will sort the items in the database (by price or alphabetically by name, brand or condition)</li><li>The ability to save a list of favorite items.</li><li>The ability to add items to a shopping cart.</li><li>Authorization/Authentication so that users are allowed to perform particular actions. (ie. only the Admin login can create, update or delete items from the inventory).</li><li>The ability to visit different pages by using React Router.</li></ol><p>Using React along with Semantic UI React allowed me to create/design the base of my website fairly quickly. Using React components allows me to organize my site into easily updatable pieces that can be rendered and re-rendered based on props that are passed to them or by changes in state.</p><p>Semantic UI React makes it easy to apply styling in a even more readable format. Rather than applying class names to each div, using Semantic UI React allows me to simply use a name to call a particular type of div that I would like rendered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pCBPoWkTx81kthm3C2RUlA.png" /></figure><p>In the example above, I was able to render a styled card div simply by having a component named “&lt;Card /&gt;”. I could also render a particular layout by having each card belong to a “&lt;Grid.Column /&gt;” component. This yields the following view fairly quickly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VU4E1Zd010n0F6ZkDVGcZg.png" /></figure><p><strong>Keyword Search</strong></p><p>After rendering the items within the database within a card, the first feature I implemented was a keyword search. This feature allows the user to easily search the inventory and filters the results as the user types. This keyword search is based on “brand”, “category” and “condition” of the instruments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*-6QU0wc0Oe9xrfifvs5GUw.gif" /></figure><p><strong>Modals</strong></p><p>One feature about Semantic UI React that is fairly nice is the ability to easily render modals (a sort of popup). Not only can one render a modal, but you can even render a modal within a modal. I applied this feature when a user would like to view the details of a particular instrument.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ocqLRux4qY2EefAU7rZ8JA.png" /></figure><p>I have the update form render as a secondary modal and after clicking the update button, the selected instrument card immediately renders with the new updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2jT1tFKNIB1Vvnbpi50qZA.png" /><figcaption>Edit Form a secondary modal</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQ3S-C8qohGkJgKHSQ6Cwg.png" /><figcaption>Updated selected Instrument Card</figcaption></figure><p>The challenging part about using these secondary modals had to do with managing the state of each modal. Upon updating a particular instrument and after submitting the edit form, I had to change the state of the secondary modal to close. Using Redux here might make this slightly easier to deal with because I would not have to worry as much about passing props so many levels down.</p><p><strong>Challenges</strong></p><p>The first real challenge I faced involved capturing the selected value of a dropdown menu. This was fairly simple using a &lt;select&gt; tag however using the built-in &lt;Dropdown/&gt; component in Semantic UI required a couple of extra steps.</p><p>First off, I needed to use state within that component to represent the currently selected value as well as a function to set the state of the dropdown menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6sIHj9Yg5KNdJY-jNDUMQ.png" /></figure><p>I then created a constant to represent the dropdown menu options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c_vLo-aG0bHAXZKabWMWMg.png" /></figure><p>Lastly I used the &lt;Dropdown /&gt; component in Semantic UI React. Here I put ‘choices’ array into options prop to render the menu options. I also utilized a filter function that I passed down as props in the onChange prop. I used this callback to capture the value of the selected menu option to bring it back up to the parent component that renders the list of instruments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eKoNuA5vFlir5YZ7OXHaPQ.png" /></figure><p>I still have a little more work to do finish the dropdown but I am fairly close. I plan on implementing the other aforementioned features after completing the dropdown. So far so good.</p><ul><li><a href="https://react.semantic-ui.com/">Introduction - Semantic UI React</a></li><li><a href="https://stackoverflow.com/questions/48807924/react-es6-get-selected-value-in-dropdown-list-using-semantic-ui">React ES6: Get selected value in dropdown list using semantic UI</a></li><li><a href="http://shop.atomicmusic.com/?l=1&amp;action=main&amp;category=12&amp;sortby=listed:d">Guitars &amp; Basses - Atomic Music Online</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56ff146d3e26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why is Python so Popular?]]></title>
            <link>https://medium.com/@jdaise/why-is-python-so-popular-cdf1e73a6a8d?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdf1e73a6a8d</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Thu, 06 Sep 2018 17:26:40 GMT</pubDate>
            <atom:updated>2018-09-06T17:26:40.340Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*_wbDOXgPIxEsHLu7KEFY_w.png" /></figure><p>There are a lot of programming languages out there and it appears that many developers claim their primary languages like badges of honor. I myself primarily am familiar with Javascript and Ruby. I am becoming more curious about other languages and want to understand why people get so jazzed about those languages that they all claim to be the best. One of the those languages I’ve heard mentioned often is Python. Python is utilized for machine learning, in search engines, analytics, web applications and more, but what is the big deal?</p><h3><strong>Who uses Python?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*iQtQ2E0AReEsCcvJjVjc2w.png" /></figure><p>A number of larger organizations use Python to serve different purposes. Probably the biggest player in this is Google. Google is considered partly responsible for raising the profile of Python. Python is the primary language among Google developers and is used in a wide variety of contexts such as the Google Engine App (building of web applications using Python), and Youtube( for viewing videos, control templates, etc.)</p><p>A good number of developers at Netflix use python to handle data analysis as well as other places.</p><p>Dropbox uses Python in its desktop application.</p><p>Instagram first started out using Django(a Python framework)</p><p><strong>What’s the big deal about Python?</strong></p><p>Readability — Many claim that its much easier to program in Python because you are not bogged down with syntax, which for some can translate into the ability to code more in a shorter amount of time. Also in Python there is an emphasis on using whitespace/indentation to mark the beginning and ending of code blocks. I could see how this could be appealing when a programmer is dealing with a lot of complex raw data.</p><p>✔️</p><pre>def perm(l):<br>        # Compute the list of all permutations of l<br>    if len(l) &lt;= 1:<br>                  return [l]<br>    r = []<br>    for i in range(len(l)):<br>             s = l[:i] + l[i+1:]<br>             p = perm(s)<br>             for x in p:<br>              r.append(l[i:i+1] + x)<br>    return r</pre><h3>❌</h3><pre>def perm(l):                       # error: first line indented<br>    for i in range(len(l)):             # error: not indented<br>        s = l[:i] + l[i+1:]<br>            p = perm(l[:i] + l[i+1:])   # error: unexpected indent<br>            for x in p:<br>                    r.append(l[i:i+1] + x)<br>                return r                # error: inconsistent dedent</pre><p>Libraries — Python is known for have an extensive and still growing collection of libraries. These libraries is suited for specific tasks whether its web scraping, text processing, graphical user interfaces(GUI) and more.</p><p><strong>What is not so great about Python?</strong></p><p>When developers say that Python is faster, this is mainly attributed to the fact that its easier to type. Technically when it comes to efficiency in terms of runtime, its not really any faster because its an interpreted language.</p><p>I came to the conclusion that when learning or considering learning new programming languages, these are all really just tools. And tools are only as good as the situation to where they are applied.</p><ul><li><a href="https://en.wikipedia.org/wiki/Python_(programming_language)">Python (programming language) - Wikipedia</a></li><li><a href="https://www.economist.com/graphic-detail/2018/07/26/python-is-becoming-the-worlds-most-popular-coding-language">Python is becoming the world&#39;s most popular coding language</a></li><li><a href="https://realpython.com/world-class-companies-using-python/">8 World-Class Software Companies That Use Python - Real Python</a></li><li><a href="https://www.netguru.co/blog/8-top-companies-that-use-python-for-their-apps-examples-of-top-notch-python-applications">8 Top Python App Examples from Top-notch Companies</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdf1e73a6a8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First Look at XMLHttpRequests]]></title>
            <link>https://medium.com/@jdaise/my-first-look-at-xmlhttprequests-9be1996c57b?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9be1996c57b</guid>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[xml]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Thu, 09 Aug 2018 20:29:59 GMT</pubDate>
            <atom:updated>2018-08-09T20:29:59.890Z</atom:updated>
            <content:encoded><![CDATA[<p>An XMLHttpRequest (XHR) is an API and a special object used to request data from a web server. XHR is commonly used under Ajax (“<strong>A</strong>synchronous <strong>Ja</strong>vascript and <strong>X</strong>ML” — a collection of technologies ). Most current browsers include a built in XMLHttpRequest object. This is an necessary tool for using asynchronous web applications in that XHR objects contain methods that operate in the background.</p><p><strong>XML?-Http?-Request?</strong></p><p>Let’s take a closer look.</p><p>XML stands for e<strong>X</strong>tensible <strong>M</strong>arkup <strong>L</strong>anguage. XML is a markup language thats main purpose is to carry data ( in comparison to HTML which is used to display data).</p><p>Http (<strong>H</strong>yper<strong>t</strong>ext <strong>T</strong>ransfer <strong>P</strong>rotocol)Request refers to the request that a client makes to a server.</p><p><strong>What are the capabilities of using an XMLHttpRequest?</strong></p><ul><li>Request and receive data after the page has loaded</li><li>Update a webpage without reloading the page</li><li>Send data to a server independently in the background</li></ul><p><strong>How does it work?</strong></p><p>An example of an XMLHttpRequest:</p><pre>var xhttp = new XMLHttpRequest();<br>xhttp.onreadystatechange = function() {<br> if (this.readyState == 4 &amp;&amp; this.status == 200) {<br> // Typical action to be performed when the document is ready:<br> document.getElementById(“demo”).innerHTML = xhttp.responseText;<br> }<br>};<br>xhttp.open(“GET”, “<em>filename</em>”, true);<br>xhttp.send();</pre><p>The first line assigns the new XMLHttpRequest object to a variable. The second line calls the “onreadystage” property on the request. This “onreadystage” property is an event handler that triggers every time the “readystate” attribute of the XMLHttpRequest changes. Looking at this block it appears we have a conditional that when we have a particular state and the status is 200 there is a change in the text within the element that has “demo” id. At the “open” line is where the XMLHttpRequest object is initialized. At the “send” line is where a HTTP request is sent. This step is where the data is sent along with the request.</p><p>Overall using XMLHttpRequest objects can be great because utilizing them allows for a really dynamic user experience and also allow for fewer reloads meaning fewer calls to the server.</p><ul><li><a href="https://en.wikipedia.org/wiki/XMLHttpRequest">XMLHttpRequest - Wikipedia</a></li><li><a href="https://www.w3schools.com/xml/xml_http.asp">XML HttpRequest</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest">XMLHttpRequest - Web APIs | MDN</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9be1996c57b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Problem with Problems]]></title>
            <link>https://medium.com/johnsthoughts/the-problem-with-problems-ea443c67a517?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea443c67a517</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[p-vs-np]]></category>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Thu, 02 Aug 2018 18:24:52 GMT</pubDate>
            <atom:updated>2018-08-02T18:24:52.744Z</atom:updated>
            <content:encoded><![CDATA[<p>In 1971, a computer-scientist by the name of Stephen Cook proposed a profound theoretical problem. This problem was so profound that it was selected as one of the 7 <a href="http://www.claymath.org/millennium-problems">Millennium Prize Problems</a> :</p><p><strong>The P versus NP Problem</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*DDAOdFkMEDwAeUQys32sEg.jpeg" /><figcaption>Stephen Cook : Klaus Tschira Stiftung / Peter Badge (<a href="http://www.heidelberg-laureate-forum.org/blog/laureate/stephen-a-cook/">http://www.heidelberg-laureate-forum.org/blog/laureate/stephen-a-cook/</a>)</figcaption></figure><p><strong>What is the P vs NP problem?</strong></p><p>Essentially this is a problem about solving problems. In his proposal, Cook described classes of problems which centered around the <a href="https://en.wikipedia.org/wiki/Turing_machine">Turing Machine</a> as the standard for computation:</p><p>P( for <em>polynomial time</em>) and NP (for <strong><em>n</em></strong><em>ondeterministic </em><strong><em>p</em></strong><em>olynomial time</em>).</p><p>Cook describes the P class as “…the class of decision problems solvable by some algorithm within a number of steps bounded by some fixed polynomial in the length of the input.” (Stephen Cook)</p><p>In other words these are problems that a deterministic Turing machine can solve within a “reasonable” amount of time. “Reasonable” meaning that the execution time of the algorithm that was used to solve a problem would be measured within polynomial time (See: <a href="https://www.google.com/search?q=time+complexity&amp;oq=time+comple&amp;aqs=chrome.0.0j69i60j69i57j0l3.2181j0j7&amp;sourceid=chrome&amp;ie=UTF-8">Time Complexity</a>). Examples within this realm would include performing simple mathematical operations to slightly more complex problems like the <a href="https://www.geeksforgeeks.org/sum-fibonacci-numbers/">Sum of Fibonacci Numbers Function</a> or finding all the odd factors of a smaller number.</p><p>When discussing the NP class Cook explains that “[the] notation NP stands for “nondeterministic polynomial time”, since originally NP was defined in terms of <a href="https://en.wikipedia.org/wiki/Non-deterministic_Turing_machine">nondeterministic Turing machines</a> (that is, machines that have more than one possible move from a given configuration)….”(He goes on to explain in further and complex detail :<a href="http://www.claymath.org/sites/default/files/pvsnp.pdf"><em>here</em></a>). Problems that are part of the NP class are computational decision problems that are easily checked but would require more complex steps in order to be solved. (Note: This is a simplification of the NP class. I would highly recommend researching further on the topic of <a href="https://en.wikipedia.org/wiki/Non-deterministic_Turing_machine">nondeterministic Turing machines</a> to get a better sense for how this computing process works.)</p><p><a href="https://en.wikipedia.org/wiki/NP-completeness">NP-complete</a> and <a href="https://en.wikipedia.org/wiki/NP-hardness">NP-Hard</a></p><p>NP-complete problems are easily checked but there is not a known way to quickly solve them.</p><p>NP-Hard class is described as “at least as hard as the hardest problems in <a href="https://en.wikipedia.org/wiki/NP_(complexity)">NP</a>”.</p><p>Examples:</p><p>NP-complete Examples</p><ul><li><a href="https://en.wikipedia.org/wiki/Sudoku">Sudoku</a></li><li><a href="https://en.wikipedia.org/wiki/Minesweeper_(video_game)#Computational_complexity">Minesweeper Consistency Problem</a></li><li><a href="https://en.wikipedia.org/wiki/Battleship_(puzzle)">Battleship</a></li></ul><p>NP-hard</p><ul><li><a href="https://en.wikipedia.org/wiki/Travelling_salesman_problem">Traveling salesman</a>*</li><li><a href="https://en.wikipedia.org/wiki/Nurse_scheduling_problem">Nurse Scheduling Problem</a></li><li><a href="https://en.wikipedia.org/wiki/Closest_string">Closest String</a></li></ul><p>(*Note: Some problems, when set under certain parameters can be considered either NP-hard or NP-complete)</p><p>Let’s go back to the original problem: <strong>P = NP?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*8nni9HdodzdSBLJ5jIG8vg.png" /><figcaption><a href="https://en.wikipedia.org/wiki/NP_(complexity)#/media/File:P_np_np-complete_np-hard.svg">https://en.wikipedia.org/wiki/NP_(complexity)#/media/File:P_np_np-complete_np-hard.svg</a></figcaption></figure><p>The picture above diagrams two differing view points. As of now, we generally operate under the general assumption that there is this gradience in the complexity of problems, that <strong>P</strong> ≠ <strong>NP </strong>even though this has not been formally proven . What would it mean if P=NP? In simple terms, this would mean that the problems we perceive as being complex in nature and scope would actually be readily solvable and they could even be as solvable as a P class problem. Some consider this within the realm of possibility because our standards of computing are becoming more advanced. (See: <a href="https://www.google.com/search?q=quantum+computing&amp;oq=quantum+&amp;aqs=chrome.1.69i57j35i39j0l4.2318j0j7&amp;sourceid=chrome&amp;ie=UTF-8">Quantum Computing</a>)</p><p><strong>What are the implications here?</strong></p><p>One immediate example is in the realm of cryptography. Cryptography relies heavily on the notion that certain codes are “unsolvable” however if P =NP were proven to be true, this would shake the foundations of cryptography because this would mean all the methods that we rely on for making things “secure” would actually be insecure and readily solvable.</p><p>There are other implications which go beyond the realm of computing which I encourage you to look into.</p><p><strong>Side Thought:</strong></p><p>As we are learning to become developers, we face many problems that we attempt to solve. Understanding the nature and scope of any given problem is important to figuring out the best approach for how to reach a desired solution. If we have a particular goal in mind and we reach a problem where the nature is too complex and/or the scope is too wide, we may come to the conclusion that a particular problem may not be worth solving.</p><p>After wrestling with trying to understand P vs. NP, I and others can be assured that most of the problems that we will encounter as developers will most likely be able to be solved within a practical amount of time. However if we do encounter and recognize such a complex problem, it might be best to walk away. Although in the process of trying to solve a such a problem may lead you to discover something new.</p><p>Suggested Reading:</p><ul><li><a href="https://en.wikipedia.org/wiki/P_versus_NP_problem">P versus NP problem - Wikipedia</a></li><li><a href="http://www.claymath.org/millennium-problems/p-vs-np-problem">P vs NP Problem</a></li><li><a href="https://www.theglobeandmail.com/news/toronto/the-problem-of-p-versus-np/article1377814/">The problem of P versus NP</a></li><li><a href="https://www.nytimes.com/2009/10/08/science/Wpolynom.html">Solving the P-NP Puzzler</a></li><li><a href="http://techtales.co/2017/08/08/explained-p-vs-np-probme/">What is the P vs. NP problem and why is it so important?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea443c67a517" width="1" height="1" alt=""><hr><p><a href="https://medium.com/johnsthoughts/the-problem-with-problems-ea443c67a517">The Problem with Problems</a> was originally published in <a href="https://medium.com/johnsthoughts">johnsthoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning about Memoization]]></title>
            <link>https://medium.com/johnsthoughts/memoization-ff94ae944611?source=rss-9dc89ebcb01c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff94ae944611</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[memoization]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[John Daise]]></dc:creator>
            <pubDate>Wed, 18 Jul 2018 18:04:52 GMT</pubDate>
            <atom:updated>2018-07-19T13:08:47.544Z</atom:updated>
            <content:encoded><![CDATA[<p>While going through the pre-work for bootcamp, I came upon an exercise where had to build a method that required a particular function to run only once. Within that method there had to be a check to see whether said function had already been performed. If that function had already been performed, the method would skip running the step of running that particular function again. With my limited knowledge I decided to consult Google for answers. In my search I came across a symbol “||=” (“or-equals”). I immediately used this operator and magically my code worked! But what really is happening here…</p><p><strong>What is “||=”??</strong></p><p>“||=” or “or-equals” is a special operator that allows a programmer to perform a technique called memoization.</p><p><strong>What is Memoization? Why is it useful?</strong></p><p>Memoization is a technique that allows a computer to process more efficiently. There are certain processes that are considered to be “expensive” (processes that would be a lot of work for the computer to perform). Anytime you are dealing with “expensive” code, this may be a situation where memoization could be useful. More specifically one can take any previously computed results to be stored and used again later rather than repeating a particular computation over and over again.</p><p><strong>How does “||=” (“or-equals”) work?</strong></p><p>Example:</p><p>x ||= y</p><p>Let’s look at a basic example above. So imagine that you have a method and you get to a line that looks like what is written above. Going from left to right, the computer is going to evaluate “x”. If “x” already has a value or is defined, then the computer will go about using x for whatever it is to be used for. If you come to a situation where “x” is undefined, nil or false, then “x” will become equal to “y” (or will be assigned to the value “y”). From my understanding the “y” portion of this line does not have to be a single value but it could also be a larger, more “expensive” block of code that a programmer may not necessarily want the computer to run again.</p><p>At this current point in my coding journey, I am simply learning the basics of how to program. From what I know, when anyone is looking to build more efficient code or refactor code, memoization is a technique that one can use. In scenarios where you begin to notice that you are computing a series of smaller functions repeatedly or where the number of computations may grow exponentially, even after recursive methods are employed, memoization may be the solution.</p><p><strong>Side thought</strong>:</p><p>From my understanding there are some mysteries around how “||=” (“or-equals”) can be utilized. Supposedly there are some flaws in using the operator to perform memoization compared to other approaches. I have yet to learn about any of that but if you learn or know anything please let me know.</p><p>Suggested Reading:</p><p><a href="https://en.wikipedia.org/wiki/Memoization">https://en.wikipedia.org/wiki/Memoization</a></p><p><a href="http://www.rubyinside.com/what-rubys-double-pipe-or-equals-really-does-5488.html">http://www.rubyinside.com/what-rubys-double-pipe-or-equals-really-does-5488.html</a></p><p><a href="https://allenan.com/ruby-or-equals-operator-default-booleans/">https://allenan.com/ruby-or-equals-operator-default-booleans/</a></p><p><a href="http://gavinmiller.io/2013/basics-of-ruby-memoization/">http://gavinmiller.io/2013/basics-of-ruby-memoization/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff94ae944611" width="1" height="1" alt=""><hr><p><a href="https://medium.com/johnsthoughts/memoization-ff94ae944611">Learning about Memoization</a> was originally published in <a href="https://medium.com/johnsthoughts">johnsthoughts</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>