<?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"><channel><title><![CDATA[John Dust's Blog]]></title><description><![CDATA[I drink coffee therefore I (can) blog...]]></description><link>https://blog.virtually.coffee</link><generator>RSS for Node</generator><lastBuildDate>Sat, 02 May 2026 20:14:37 GMT</lastBuildDate><atom:link href="https://blog.virtually.coffee/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[I reinvented the wheel… Well actually the terminal.]]></title><description><![CDATA[This project was a blast to create! And quite possibly, one of my more challenging projects to date.
When going into it, I started with a pen and paper(well actually an iPad and pencil) and tried to picture how I wanted the request cycle to go for st...]]></description><link>https://blog.virtually.coffee/i-reinvented-the-wheel-well-actually-the-terminal</link><guid isPermaLink="true">https://blog.virtually.coffee/i-reinvented-the-wheel-well-actually-the-terminal</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 19:31:27 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1643916615135/cSxdHn-4F.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This project was a blast to create! And quite possibly, one of my more challenging projects to date.</p>
<p>When going into it, I started with a pen and paper(well actually an iPad and pencil) and tried to picture how I wanted the request cycle to go for starting a command line interface project from a virtual terminal. I knew I needed a webpage, along with some AJAX to update the view and send inputs. I also knew that that, a virtual terminal couldn't be shared like a web server, I mean, what if there was only one virtual terminal shared between all users? That would be chaos.</p>
<p><strong>So I had my work cut out for me.</strong></p>
<h3 id="heading-a-classy-rewrite">A classy rewrite.</h3>
<p>My first step was migrating the demo.coffeedust simple rack server to something a bit more usable. I didn't want to go rails since I had no use for really any of its features. The only thing I needed was a better routing system and sessions, so when I implemented the new terminal I could have controllers, routes and sessions up and running in no time. So I decided to go with Sinatra. The rewrite took a little longer than expected but in the long run, it made the implementation of the new terminal feature much easier.</p>
<h3 id="heading-lets-get-to-building-some-terminals">Let's get to building some terminals.</h3>
<p>Now to begin the tricky part, having one session = one new virtual terminal instance.</p>
<p>As I mentioned before, each user had to have their own terminal, with their own independent running project demo. So I started crafting a virtual terminal object and it's properties, mainly it's thread that the project will run on. I've previously dealt with multithreading in ruby before. Much like JavaScript, multithreading in ruby is concurrent, it operates on a single system level thread in a loop.</p>
<p>This thread would need to be responsible for dispatching commands and catching outputs. It would also need to keep track of the output history and somehow, it would need to sync up with the web controller to send the output to display on the webpage.</p>
<p>I was able to override the puts and gets methods on my project, that way I didn't have to do any major altering in my project's original code.</p>
<p>I overrode the gets method to where is doesn't even response to the Kernel, but instead to my terminal's project thread in a similar manor. Syncing all of this up was very technical, but I was able to mirror the functionality of those methods, so it communicated perfectly with my controller and web page.</p>
<h3 id="heading-the-bugs">The bugs.</h3>
<p>There were plenty but I worked through them and it was a great learning experience for me.</p>
<p>A big issue I had was memory sharing between terminal sessions. Even though I had separated everything into different threads, I noticed that any objects that were created and stored in a separate file in the project, would not be scoped to that thread, but rather, it was scoped to that file, meaning you could have 2 instances of my Inventory Manager project running, but the .all class methods for non persistent storage, was all shared between instances because they required the same file. This would cause issues of objects being duplicated and removed in memory for all sessions. That wasn't going to work!</p>
<p>So I was able to override some of those storage methods, and assign them to arrays and hashes that were held in that thread instead of a file that was shared between everything.</p>
<p><strong>Problem solved.(at least that one 😬)</strong></p>
<blockquote>
<p>What do you mean "command not found"? It worked on my system!</p>
</blockquote>
<p>Now to run some implementation tests on the server, And… I found a strange bug. All of the virtual terminal code worked, however my project, Inventory Manager, was not recognizing commands when trying to view items. But it appeared to be random, and sometimes allowed for an item to be shown as it normally should.</p>
<p>After quite a while of some deep think debugging, I determined the issue was actually an error when calling a method, however because of try-catch implementation(it was my first project 😬) it would default to "command not found."</p>
<p>What was the error? Because I was using ObjectSpace and id2ref to find Items in memory (I know, again I plead first project) I was getting a "could not find object with that id" error, but only when an object was assigned an ID that was negative. I never had this issue on my computer because it has plenty of RAM that it never needed to assigned negative ID's, whereas the server, has much less RAM.</p>
<p>After going into a binding.pry, I was able to figure out that, for some reason, the object ID that was being passed to my search method, did not include the negative symbol (-). Turns out, the regex I had, only matched digits and not letters when sending that method. After updating the regex pattern, success, it all functioned properly. 👌</p>
<p>Overall, as I mentioned, the main reason I didn't use REPL-IT to run my CLI projects was because it felt like cheating. After all this is my portfolio site, there to demonstrate my skills. If possible, everything on that site should all be made by me. Also I really wanted to challenge myself, and I knew I would enjoy every minute of it, and I did!</p>
<p>Check demo.dust.coffee's innards here on GitHub: <a target="_blank" href="https://github.com/Coffee-Dust/demo-coffeedust-io">https://github.com/Coffee-Dust/demo-coffeedust-io</a></p>
<p><strong>And don't forget to try it out yourself by starting the Virtual Terminal interactive demo at</strong> <a target="_blank" href="https://dust.coffee/projects/inventory_manager">https://dust.coffee/projects/inventory_manager</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643916576822/IoTWLDjr3.png" alt="1*0p5dTAhIwqF29WAQ9IX9zg.png" /></p>
<blockquote>
<p>Screenshot of the virtual terminal running Inventory Manager on demo.dust.coffee</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Adding a new feature to an old project]]></title><description><![CDATA[Returning to old code and adding a new feature can be challenging. Some developers end up spending hours trying to figure out where and how you would implement the code for that feature. However, for me, diving into my project My-Coffee-Table wasn't ...]]></description><link>https://blog.virtually.coffee/adding-a-new-feature-to-an-old-project</link><guid isPermaLink="true">https://blog.virtually.coffee/adding-a-new-feature-to-an-old-project</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 19:23:31 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1643916190952/G5kO_iFKc.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Returning to old code and adding a new feature can be challenging. Some developers end up spending hours trying to figure out where and how you would implement the code for that feature. However, for me, diving into my project My-Coffee-Table wasn't that challenging. In fact, it was actually quite easy to implement my new feature. It only took me about an hour to build a new on screen iFrame element that could display embedded YouTube videos. But how and why was it so easy? I mean I did end up building this project from the ground up in the span of a week and it even has been a few months since I even have touched this project.</p>
<blockquote>
<p>Well, I'll tell ya. I was thinking ahead!</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643916113190/nLkcHGr79.gif" alt="1*aJ8zV-fRqRtg91P5IaP7Hw.gif" /></p>
<p>When designing the database, I knew I wanted to add more 'elements' in the future. So I planned for such a thing. I used a polymorphic database model for those elements, which allow me to keep my code DRY and pretty.</p>
<p>When coding the frontend, it was slightly more complicated to implement this functionality. I had to make sure I named everything in a semantic way, so I could easily figure out where code for the new element needed to go.
With me following the Separation of concerns principle during the initial creation, I was able to figure out which files were responsible for 'element' objects and I setup the new FancyiFrame element, in around an hour!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643916147357/eCNbVcbw-A.png" alt="My personal music coffee table" /></p>
<p>Now I just need to improve the UI and UX for creating elements 🤔</p>
]]></content:encoded></item><item><title><![CDATA[Every Programmer’s Worst Nightmare - My Website Part 2]]></title><description><![CDATA[One of the features I always imagined my portfolio site would have, is the ability to view and start a full interactive demo for each of my projects. There were various (and expensive ways) to do this. Some of my fellow alumni decided to host each of...]]></description><link>https://blog.virtually.coffee/every-programmers-worst-nightmare-my-website-part-2</link><guid isPermaLink="true">https://blog.virtually.coffee/every-programmers-worst-nightmare-my-website-part-2</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 19:15:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1643915707692/tD33chhAh.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>One of the features I always imagined my portfolio site would have, is the ability to view and start a full interactive demo for each of my projects. There were various (and expensive ways) to do this. Some of my fellow alumni decided to host each of their rails project/api’s on something like heroku, and then had a seperate frontend host. I didn’t much care for this strategy for many reasons. One, it would be tedious to manage. Two, it might get expensive. I know some cloud services do a pay as you go/per project you want to host, but I’m cheap and prefer to spend my money on cups of coffee ☕️.</p>
<blockquote>
<p>Do I sacrifice a few cups of coffee to pay for hosting all my demos?</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643915386934/EM0aPBB1J.jpeg" alt="no.jpeg" /></p>
<p>You probably already guessed my answer to that, <strong>no</strong>. Instead, I bought some coffee and got to thinking. I figured that there was no reason to host all my projects separately and have them run all the time. Instead I asked myself “what if I could have a server that started other servers?” A server within a server? :O</p>
<h5 id="heading-how-could-i-do-such-a-thing">How could I do such a thing?</h5>
<p>It was actually pretty simple to setup. I used Rack(what rails is built on) as a basic web server that would listen for a button press on coffeedust.io and then dispatch a start command in bash to run that demo. I foresaw a few issues with that approach however. One issue would be, how would I make that demo server run without blocking the main parent thread? Also, how would I have the server shutoff after a certain amount of time inactive?</p>
<h5 id="heading-giving-parallelization-a-good-bashscript">Giving Parallelization a Good Bash(script)</h5>
<p>As I have quite a bit of experience with Unix commands along with multithreading in Ruby, I was pretty confident in my ability to make this idea come alive and solve those issues. I first solved the issue of the main thread being blocked while the demo was starting and running. So I decided to make a parallel process with Unix’s Fork command and… Viola! No more blocked thread. However, the demo keep giving me an error when I ran it’s start command. Saying how it was missing a gem that was definitely in it’s Gemfile.</p>
<blockquote>
<p>Then every programmers worst fear. <strong>No answers on stack-overflow!</strong></p>
</blockquote>
<p>After quite a bit of googling, I realized that no-one else has either attempted what I was doing, or never had this issue before. I was getting pretty discouraged, but I never gave up and I started doing some deep think debugging. First, I tried to figure out what exactly the problem was. I ran bundle install and got a success message. But I looked at the gems it installed, and they weren’t the correct ones, it was actually using the gem file for my Rack server, not the demo!</p>
<p>Very confused about this, I figured that maybe I wasn’t in the correct directory when running the server. After confirming I was indeed in the right directory, I was very much confusion. I then ‘traced’ the code’s steps and looked through the gem files, bundler settings for both servers and I found nothing that could be causing the Gemfile location issue.</p>
<p>After taking what I knew already and ruling out what I knew wasn’t causing it, I realized that the issue was not with my code, it was almost like it was an invisible configuration.</p>
<p>Then it hit me! There is an invisible configuration hash at the system level. The ENV hash! I then looked at it at runtime, and sure enough, there was a configuration for the Bundler Gemfile location. As the demo sever is a forked process of the Rack server, the ENV hash would have been copied. Thus the Gemfile that the demo Rails server was using, was indeed the one belonging to its parent process, the Rack server.</p>
<p>After resetting that ENV hash attribute in the context of the new forked process, the rails server for my demo ran, and it was all sunshine from here on.</p>
<blockquote>
<p>But I don’t want the demo to run all the time if it’s not being used…</p>
</blockquote>
<p>If this was Javascript, I could simply do a setTimeout to send a shutdown command to the process after a certain amount of time. However, this is Ruby, and asynchronous tasks ain’t that simple. Some might even say, such a thing is impossible, however, Ruby does have a concurrent multithreading system built in! So, I used that system to create an asynchronous shutdown timer, so after 15 mins, it will stop the demo server process, all without blocking the main thread.</p>
<p><strong>Next</strong>, all I had left to do was configure this server to be able to run my different projects and code some bash scripts for correctly installing those demos and their dependencies on the server’s machine. After wrapping everything in a nice Docker container, it was ready to be installed on my one server machine.</p>
<p>It was quite a challenge but I loved every minute of it! It made me realize that backend and technical development is my passion, much more enjoyable than frontend development with CSS &amp; HTML.</p>
<p>Mission accomplished! Just one server needed to run and host them all! All my project demos. Thanks for reading 😄</p>
<p>github repo for the project: <a target="_blank">https://github.com/Coffee-Dust/demo-coffeedust-io</a></p>
]]></content:encoded></item><item><title><![CDATA[In the beginning, I had a vision - My Website Part 1]]></title><description><![CDATA[When I started my curriculum at Flatiron school, I slowly began to have a vision of my ultimate project, my portfolio website. This website would need to showcase all the skills I learned, look awesome and allow users to view and interact with all my...]]></description><link>https://blog.virtually.coffee/in-the-beginning-i-had-a-vision-my-website-part-1</link><guid isPermaLink="true">https://blog.virtually.coffee/in-the-beginning-i-had-a-vision-my-website-part-1</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 19:08:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1643915279002/BiB4he7nr.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When I started my curriculum at Flatiron school, I slowly began to have a vision of my ultimate project, my portfolio website. This website would need to showcase all the skills I learned, look awesome and allow users to view and interact with all my projects. As time went on and I learned more, my vision continued to evolve. I continued to think of cool new features I wanted to add, and made mental notes of them.</p>
<h4 id="heading-then-that-fateful-day-came">Then that fateful day came.</h4>
<p>I was staring at the assessment report of my final portfolio project, reading about how it explained that I passed with flying colors. It was at this point I realized, it was time, time to make that vision of my website a reality!
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643915090031/7iYlmjnQl.png" alt="image.png" /></p>
<h4 id="heading-building-coffeedustionow-dustcoffee">Building Coffeedust.io(now dust.coffee)</h4>
<p><a target="_blank" href="https://github.com/Coffee-Dust/coffeedust-io-site">Github Repo</a></p>
<p>Creation of coffeedust.io, was relatively simple. It is an web application built in React, and hosted on Firebase.
I first started with a sketchpad and I drew up the basic layout.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643915182061/D8qro-Adc.png" alt="My Sketch.png" /></p>
<blockquote>
<p>My original sketch for coffeedust.io layout(I'm not an artist)</p>
</blockquote>
<p>Next, I slowly but surely, hit enough keys on my keyboard to make it appear that way in a web browser. Then, I started to get really fancy with the CSS, and wrote transitions, fade-ins and animations for various views (actually, pretty much all of them😬).</p>
<p>After creating some data files to store information for my projects and language experience, I took a (figurative) step back and a full sip of coffee to admire my work and I was really happy with how it turned out.</p>
<blockquote>
<p>Don’t forget to read part 2! It discusses my demo server creation process.</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[How I React(ed)]]></title><description><![CDATA[Dipping into a new framework can be confusing and scary. It’s like visiting a different country. After all you aren’t very familiar with the customs, conventions and possibly even the syntax of the language spoke there. Similarly, when diving into th...]]></description><link>https://blog.virtually.coffee/how-i-reacted</link><guid isPermaLink="true">https://blog.virtually.coffee/how-i-reacted</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 19:02:06 GMT</pubDate><content:encoded><![CDATA[<p>Dipping into a new framework can be confusing and scary. It’s like visiting a different country. After all you aren’t very familiar with the customs, conventions and possibly even the syntax of the language spoke there. Similarly, when diving into the world of React, it was different. I struggled to find a good pattern, some sort of conventions on how to structure my files and code. I was reading through the official docs trying to find some sort of file structure conventions for React, but came up short. I realized after reading through various blogs, there is no right or wrong pattern. Unlike in Rails, where things are convention over configuration, React is more ‘free’ and open. This of course has its pro’s and con’s, because I was not only starting out with a new approach to writing frontend code, but I also felt like I was sometimes writing code that wasn’t very DRY, hard to debug and overall, not very structured and organized.</p>
<h5 id="heading-redux-pattern">Redux pattern:</h5>
<p>This pattern seemed to improve on a lot of issues I had with React. No more did I struggle with managing state and passing down so many props and callbacks that it made my brain want to power down. However, even though redux was an improvement, I still was noticing ‘code-smells’ such as repeated code and I felt like things could be organized better. So I decided to try and rethink my approach to organizing and following the programming rule of “Separation of concerns”. After learning the React pattern(but now I guess no longer recommended) of using container and presentational components, I was able to organize my code quite a lot better, but it still feels like there could be better separation of concerns.</p>
<h5 id="heading-mvc-in-react">MVC in React?</h5>
<p>After looking at my container components, I noticed they were very bloated and it was getting difficult to debug when a container has so much code and logic in it. Maybe this is why Container/Presentation paradigm is not really recommended anymore. I found myself thinking of better ways of organizing my code. A thought came across my mind, about how container components reminded me of Controllers in the Model View Controller architecture, and how presentational components could be considered ‘views’. Well, what about models? How could they fit in? After all, I am storing and displaying data from my server that came from and was organized as Models . Why not just abstract and separate code related to a specific model into its own file and class? At that point, I decided to make a models folder, and populate it with basic Javascript classes. Those classes would not only keep track of and organize properties/data for my server data models, but also get rid of unnecessary and repetitive code on my container components, business logic that has no real reason of being a concern of the containers. So in the end, my file structure turned out to be MVC, that is Model, View(Presentational) and Container(controller).</p>
<h5 id="heading-conclusion">Conclusion</h5>
<p>As there are not very many rules and standards to React, most of my time was spent figuring out what patterns I wanted to follow and how I could structure my project in a clear, semantic and “code smell” free way. Although it was confusing and somewhat of a challenge at first, it was a real learning experience and I not only enjoyed it but I’m glad React is one of the things added to my stack.</p>
]]></content:encoded></item><item><title><![CDATA[The End of a Milestone and the Start of a Journey]]></title><description><![CDATA[“Congratulations, you just graduated! What are you going to do next?” My answer to that question probably wouldn’t be “I’m going to Disney World” (although I’m completely open to it). But how would I answer? After all, I’ve just completed a major mil...]]></description><link>https://blog.virtually.coffee/the-end-of-a-milestone-and-the-start-of-a-journey</link><guid isPermaLink="true">https://blog.virtually.coffee/the-end-of-a-milestone-and-the-start-of-a-journey</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 19:00:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1643914809830/v2XRC7r6_.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>“Congratulations, you just graduated! What are you going to do next?” My answer to that question probably wouldn’t be “<a target="_blank" href="https://youtu.be/_-pu7MeIhUM">I’m going to Disney World</a>” (although I’m completely open to it). But how would I answer? After all, I’ve just completed a major milestone in my life. What am I going to do next? Before I answer that, let me reflect on my achievements that brought me here.</p>
<h3 id="heading-my-achievements">My achievements:</h3>
<h6 id="heading-swiftspritekit-the-8-bit-master">Swift/SpriteKit — The 8-bit Master:</h6>
<p>After graduating high school, I went full force into learning programming on my own. I had a vision of a game I wanted to create. Although I did not have any formal/professional training in the language, I quickly got the hang of Swift and SpriteKit. I even did all of the graphics, artwork and even the music. I learned many things along the way, not just about Swift, but about software engineering in general. Before I knew it, I had a functional and pretty impressive game published on the App Store.</p>
<h6 id="heading-flatiron-school-and-my-portfolio-projects">Flatiron School and my Portfolio Projects:</h6>
<p>After completing my game, I realized that I should get some professional education in an employable field. I decided on full stack web development and enrolled in Flatiron school. During my curriculum, I learned many programming techniques, especially in Object Oriented programming. I further grew and improved on my previous experience in programming and learned the best practices and rules when writing and code and designing applications, along with many other things that I previously did not know.</p>
<h6 id="heading-ruby-tictactoe-with-ai">Ruby — TicTacToe with AI:</h6>
<p>(Many references to WarGames(1983). You have been warned.) Tic tac toe, a strange game, the only way to win against my AI is to press control + c before getting a tie. This was one of my first challenging projects with my school. My approach to building this project was a bit different than most students, basically I reversed engineered TicTacToe in order to build an unbeatable algorithm. I drew diagrams to help me visualize the logic flow of how such an AI would need to function. I went through and made notes of steps it would need to take in order to win, and also figured out how to prioritize those steps based on the state of the game. Ultimately, I built an unbeatable AI from scratch that may or may not eventually figure out “the only winning move is not to play.” This project was very challenging, especially for not having that much experience in programming, but it was a lot of fun to design, build and figure out on my own.</p>
<h6 id="heading-ruby-inventory-manager">Ruby — Inventory Manager:</h6>
<p>This project is a full SQL-less command-line interface database program. Why is it SQL-less? Up until this point, I had no knowledge of Structured Query Languages or how databases worked. What I did know, was how to create ruby objects in memory and relate them to each other. Now, the main premise of this project was to scrape data from the internet and allow the user to interact with that data via CLI. I read a little too much into it(actually a lot) and I ended up building a full inventory software that can Create, Read, Update, and Delete data, as well as organize and categorize that data. It scraped mock data for items from Publix’s website and as such, that took a long time. I realized that it would be pointless and take forever to scrape data every time the program ran and lose that data whenever the program quit. I looked into ways to quickly save data and decided to convert those ruby objects into hashes that can be written to a JSON file. The school’s courses never taught me on how to do this. I learned and built this parser by reading documentation and StackOverflow. In the end I had built a really impressive data manager with an intuitive command-line interface.</p>
<h6 id="heading-ruby-in-sinatra-framework-the-local-coffeeshop">Ruby in Sinatra Framework — The Local Coffeeshop:</h6>
<p>This was my first project in the world of Server Side web programming, as well as relational database design. I used technologies such as SQLite, the ORM ActiveRecord, Rake and Rack. I learned a lot about how the internet works, how browsers interact with servers on getting and posting data as well as conventions in web design, such as RESTful routing. Overall it was a great learning experience and I went above and beyond the basic project requirements.</p>
<h6 id="heading-ruby-on-rails-coffee-beans">Ruby on Rails — Coffee-Beans:</h6>
<p>This project really cemented things I had previously learned. It also taught me about important things that make the internet the useful place it is today, such as sessions and cookies and how they work with authentication of users. I implemented views to display data using ERB and as far as the database design was concerned, I implemented something that the school had previously not taught me, polymorphic associations. You can read more about it here: https://coffee-dust.github.io/coffee-beans_social_my_rails_project</p>
<h6 id="heading-javascript-my-coffee-table">Javascript — My Coffee Table:</h6>
<p>Learning a new language is hard, and Javascript is no different! In fact, some may argue that it is one of the most frustrating languages to learn. However, although it was very different from all previous languages I have learned, with its prototypal inheritance model and functional based programming, I did enjoy getting the hang of it and applying that knowledge to a real world use. This project really demonstrates that. With my use of OO ES6 Javascript syntax and design, event driven DOM manipulation and fetching data from my rails server and parsing that data into something Javascript can use. Overall it was a fun learning experience and I really enjoyed building this project.</p>
<h6 id="heading-reactredux-react-coffee-beans">React/Redux — React Coffee-Beans:</h6>
<p>Javascript can be difficult to design and organize when you have to update the DOM and build interfaces that react to user input. It can get even more difficult to keep code organized when you have to update the DOM based on an async event, such as when you fetch and receive new data from a server. This was something I realized on my last project. JSX was a great thing to learn about and learning how the React framework can auto update the DOM when values in state changes, along with how it organizes elements into reusable components, was a great improvement over dealing with countless query selectors and adding event listeners that update values using more query selectors all while trying to connect it to a separate HTML file. Although React was a bit confusing at first, it is a very powerful tool that I am glad I learned. This project really demonstrates all the things I learned about react and I was able to build a single page version of my rails project ‘Coffee-Beans’ that can do everything, all without ever refreshing or redirecting the page.</p>
<h6 id="heading-so-what-about-that-initial-question">So what about that initial question?</h6>
<p>Along this journey, I have learned a lot and built a lot of impressive things. So what will I do next? Well, for one, I will continue to learn, grow and create software that will hopefully enhance the lives of those who use it, and find a Team/Company that will help me do just that.</p>
]]></content:encoded></item><item><title><![CDATA[The Tears and Fears Are Gone]]></title><description><![CDATA[(At least when it comes to Javascript)
I have to admit, going into Javascript made me a bit nervous. I’ve heard quite a lot of negativity about JS (and also seen really funny memes too) and that affected my view of the language, to the point where I ...]]></description><link>https://blog.virtually.coffee/the-tears-and-fears-are-gone</link><guid isPermaLink="true">https://blog.virtually.coffee/the-tears-and-fears-are-gone</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 18:53:19 GMT</pubDate><content:encoded><![CDATA[<p><strong>(At least when it comes to Javascript)</strong></p>
<p>I have to admit, going into Javascript made me a bit nervous. I’ve heard quite a lot of negativity about JS (and also seen really funny memes too) and that affected my view of the language, to the point where I was worried that it was something I was not going to get the hang of. All previous languages that I have learned and used before are very different. The first language I officially learned was Swift, and then Ruby. Going from Ruby to JS was quite a difference. This strange new world of curly brackets, functions, fetch, then, undefined and vague error messages took quite a while to get used to. After the Pokemon Teams Lab (a project in Flatiron School), I really felt like I got the hang of it. I was really proud of my solution to that lab, mainly because I felt like I structured my code in a clear semantic way. At this point, the rest of the course was smooth and I finally was beginning to get comfortable with Javascript and even enjoy writing it!</p>
<h5 id="heading-the-project">The Project</h5>
<p>My Coffee Table. Even though it never will be optimized for mobile, ever, it is still a really cool project. I first thought of it a while back when brainstorming future project ideas. The idea you have your own virtual table to place/move objects around freely seemed like a great JS project idea. The day finally came when I got to “Javascript Project Instructions.” At this point, my first step is to always draw out my database domain model. Initially I didn’t have many issues but then I got to the point where I asked myself, “what do I want my JSON data to look like?” So I decided to refactor the database to reflect data that is more JS friendly, data that can basically be passed in without much need for going through it and manually assigning values.</p>
<h5 id="heading-a-polymorphic-join-table">A Polymorphic Join Table?</h5>
<p>I ran into another snag. If you recall, on my rails project, I implemented a polymorphic relationship in my models. That was challenging but I enjoyed the challenge of figuring out something new that I wasn’t taught. Now when I was sketching out my database, I was wanting elements to share attributes(such as style) and different attributes(such as href in a link). My end goal after all was to have many different elements, like links, sticky notes and pictures. However a link shouldn’t have an imageLink property, and having all of these properties shared between one class just felt like a bad design that would be hard to implement and be especially difficult to add new features to, such as new elements. So at this point I decided to make Elements a polymorphic join table and making the different element types into their own table. This way my json data would be a lot more semantic and easier to implement in javascript.</p>
<h5 id="heading-conclusion">Conclusion</h5>
<p>This was a difficult project, but I enjoyed every moment of it. On pretty much every step of the way, I felt like I made good, DRY design choices and structured the code in a clear and semantic way. I look forward to what the future holds for me in Javascript!</p>
]]></content:encoded></item><item><title><![CDATA[Coffee-Beans Social: My Rails Project]]></title><description><![CDATA[Are you tired of social media and all of the negativity? Are you tired of all the division and political strife on social media platforms? Oh and do you like coffee? Well if you answered yes to any or all of the above questions, you are the perfect c...]]></description><link>https://blog.virtually.coffee/coffee-beans-social-my-rails-project</link><guid isPermaLink="true">https://blog.virtually.coffee/coffee-beans-social-my-rails-project</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 18:50:30 GMT</pubDate><content:encoded><![CDATA[<p>Are you tired of social media and all of the negativity? Are you tired of all the division and political strife on social media platforms? Oh and do you like coffee? Well if you answered yes to any or all of the above questions, you are the perfect candidate for an ALL NEW and totally original social media website called Coffee-Beans. With this website, meet fellow coffee enthusiasts, read about their favorite coffee drinks even view pictures of fancy latte art they post. Share your own thoughts on different types of coffee, maybe even your favorite Local Coffeeshop in the area. Oh and be sure every ‘coffee-bean’ you post is about coffee, otherwise the auto-mod will permanently delete your ENTIRE account(we can’t be letting this website turn into other stressful social media sites. So keep your posts about coffee or else, no more account for you.) Join today, and you will probably regret it when you post something without the word coffee in it. NOTE: Auto-mod may delete accounts even if the post was about coffee. We do not apologize if this happens and it cannot be undone… Have fun sharing your own coffee beans @ Coffee-Beans Social!</p>
<blockquote>
<p>If you think that advert was bad, wait until you see the code behind it all. Wait.</p>
</blockquote>
<p><strong>My Process of Building:</strong>
When beginning a huge project like this, it is easy to get overwhelmed. You might think to yourself, “where do I even start?” Well, first thing I always do is draw (and I mean literally draw) a diagram of how my database will work. I write out every model and their attributes in their own box. Next, I draw lines to represent how data will associate with each other. Only after the point where I know the in’s and out’s of my database domain, I will start implementing it into code, such as writing migrations and models with the appropriate ActiveRecord association macros.</p>
<blockquote>
<p>Wait, what is a Polymorphic?</p>
</blockquote>
<p>When coming up with this domain, I ran into a problem. I wanted users to be able to react(like/dislike) to both posts and comments. But how could I do this in the DRYest way possible? I thought, maybe having two tables, a comments_reactions and posts_reactions table. However I knew there had to be a better way, because this was pattern was just too much of a code smell. I kept thinking of possible ways I could accomplish this only using one table. Then I thought to myself, “I know if I just have one Reactions table, the foreign id key won’t be unique since a post and a comment can have the same id. So what if I have a key that will store the name of the table(i.e. either posts or comments) along with the standard foreign id key.” At this point I realized that was the solution. But the question now is, how do I get Active Record to automagicly incorporate both foreign keys? Would I have to write out my own query methods in order to get it to work? Well, after some time googling, I discovered that this database pattern not only already exists, but it is fully supported in ActiveRecord! It is called Polymorphic Relationships. I read through the docs and breathed a sigh of relief knowing I wouldn’t have to manually write out a bunch of sql queries for my Post and Comment models to allow them both have many Reactions associated to them.</p>
<blockquote>
<p>Now the tricky part… Controlling these objects.</p>
</blockquote>
<p>When I am programming, my mind is constantly trying to be one step ahead, figuring out how to solve the puzzle and alerting me of any roadblocks that may come up when I’m coding in new features. When I was writing out the Reactions controller, I ran into a lot of roadblocks because of this polymorphic model relationship. Like, what if my Reactions controller was expecting a dependency of the Post model but couldn’t find it because that request was from a Comment? After a short while of thinking through these roadblocks, it all started to fall into place. Delegating responsibility to helper methods to make the controller more clean and semantic, a little refactoring here and there and Voilà! We now have one smart controller that can create or delete a reaction regardless of whether it is of type Post or Comment. Oh and of course we can’t have a user “like” a post twice. So I had to make sure that it would ONLY create a new reaction if that user had not reacted to that post/comment before. Just as any like button acts as a toggle switch, I had to make the controller smart enough to figure out if it needed to create a reaction or delete it, all in one route! This seemed like the best course of action since there was so much logic involved because of it being polymorphic. With this much logic, such as needing to find what the reaction belongs to, along with all of those database queries, it seemed like more of a concern of the Controller and Model instead of having the logic in the view’s form. With the most challenging part out of the way, the rest of it all just fell into place.</p>
]]></content:encoded></item><item><title><![CDATA[The Local Coffeeshop: My Sinatra Project]]></title><description><![CDATA[Have you ever wanted to visit a coffeeshop, but you are not sure if it is any good? Or maybe you are not sure what to order, unsure of which drink is most popular? Well, with The Local Coffeeshop web app, you don’t have to worry about those questions...]]></description><link>https://blog.virtually.coffee/the-local-coffeeshop-my-sinatra-project</link><guid isPermaLink="true">https://blog.virtually.coffee/the-local-coffeeshop-my-sinatra-project</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 18:46:08 GMT</pubDate><content:encoded><![CDATA[<p>Have you ever wanted to visit a coffeeshop, but you are not sure if it is any good? Or maybe you are not sure what to order, unsure of which drink is most popular? Well, with The Local Coffeeshop web app, you don’t have to worry about those questions anymore. The Local Coffeeshop will show coffeeshops in your area, and will allow you to look at the average rating on them, the reviews posted by other users, what drinks are popular and allow you to write a review based on your very own visit there. You can also keep track of your favorite coffeeshops, and look at, revise, or delete your reviews. So what are you waiting for? Sign up today!</p>
<blockquote>
<p>Cool ad bro. But what about the code?</p>
</blockquote>
<p>This was a blast to create and overall, I would say creation of it went smoothly. I started out by writing down all the specifications I wanted this app to do. Then I designed the schema of the database, I prefer to use pencil and paper for this process, mainly because I do not own software for such application. I sketched out the main tables, then the join tables. Once I completed the sketches of the schema, I created migrations for all the tables. After that, I tested out all of the model associations and acted out the functionality between all of them in pry. Next I went to create the views and controllers in steps of importance, the application controller, the user controller, the coffeeshop controller and so on…</p>
<p>Once completed, everything functioned according to plan. I look forward to adding styling and more functionality to this when I get the chance.</p>
<p>Try it out with an interactive demo @ <a target="_blank" href="https://dust.coffee/projects/local_coffeeshop">demo.dust.coffee</a></p>
]]></content:encoded></item><item><title><![CDATA[Inventory Manager: My Ruby CLI Project]]></title><description><![CDATA[The idea behind Inventory Manager is simple but important. Keeping track of inventory is a very important thing at any store, whether it is just an office, grocery or department store. With Inventory Manager, managing your store’s inventory can be si...]]></description><link>https://blog.virtually.coffee/inventory-manager-my-ruby-cli-project</link><guid isPermaLink="true">https://blog.virtually.coffee/inventory-manager-my-ruby-cli-project</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 18:42:39 GMT</pubDate><content:encoded><![CDATA[<p>The idea behind Inventory Manager is simple but important. Keeping track of inventory is a very important thing at any store, whether it is just an office, grocery or department store. With Inventory Manager, managing your store’s inventory can be simple. With its many powerful commands, you can add, change, modify, store by department, category and sub-category, all the items you need. When you close the program, it automatically saves to JSON files. Worrying about running out of an item? No problem! Inventory Manager can keep track and let you know what items are low, and it can also keep track of the last time you ordered more of that item.</p>
<h3 id="heading-now-we-are-talking-technical">Now we are talking technical.</h3>
<p>For real, Inventory Manager can do a lot. Not only was it made from scratch with love, it also gets data to seed the JSON file though scraping publix.com using the Nokogiri gem.</p>
<p>The process was quite complicated, I started by drawing out, on a large poster board, the object structure, how the objects relate to each other and what their attributes are. From there I made the file structure, which can be seen under the structure directory in the lib folder. Next I made the scraper and a few tests to see that my structure of objects has the right relationships. Making the scraper was quite complicated, since it was dealing with at least 8,000 individual items scraped from publix.com. The same could be said about designing the CLI from scratch. I made sketches of what I wanted my home screen to look like. I made lists of commands I want, and countless sessions of thinking about how to make it all work together. Eventually, I did it, Inventory Manager was completed!</p>
<p>View more details on this project via <a target="_blank" href="https://dust.coffee/projects/inventory_manager">dust.coffee</a></p>
]]></content:encoded></item><item><title><![CDATA[A Fight with AI in Ruby]]></title><description><![CDATA[WarGames(1983) AI Joshua playing TicTacToe

Tic tac toe, a strange game, the only way to win against my AI is to press control + c before getting a tie.
This was one of my first challenging projects with my school. My approach to building this projec...]]></description><link>https://blog.virtually.coffee/a-fight-with-ai-in-ruby</link><guid isPermaLink="true">https://blog.virtually.coffee/a-fight-with-ai-in-ruby</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 18:39:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1643913461507/NfYuCQGvp.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643913461507/NfYuCQGvp.jpeg" alt="1*7TuC2HShf-pHoFXlqKk5vw.jpeg" /></p>
<blockquote>
<p>WarGames(1983) AI Joshua playing TicTacToe</p>
</blockquote>
<p><strong>Tic tac toe, a strange game,</strong> the only way to win against my AI is to press control + c before getting a tie.
This was one of my first challenging projects with my school. My approach to building this project was a bit different than most students, basically I reversed engineered TicTacToe in order to build an unbeatable algorithm. I drew diagrams to help me visualize the logic flow of how such an AI would need to function. I went through and made notes of steps it would need to take in order to win, and also figured out how to prioritize those steps based on the state of the game. I had to make my AI think to the future and decide which move to take, a move that will not only cause it to stop the other player from winning, but immediately identify threats that would cause it to loose and ultimately pull off a win/tie.</p>
<p>Ultimately, I built an unbeatable AI from scratch that may or may not eventually figure out "the only winning move is not to play." This project was very challenging, especially for not having that much experience in programming, but it was a lot of fun to design, build and figure out on my own.
You can find my project Github repo here.</p>
]]></content:encoded></item><item><title><![CDATA[Why I Started Programming]]></title><description><![CDATA[While I was growing up, I always had a fascination with technology and how it worked. One of the things I enjoyed during that time was gaming, and I discovered an online sandbox game. This game allowed you to create and program your own mini-games us...]]></description><link>https://blog.virtually.coffee/why-i-started-programming</link><guid isPermaLink="true">https://blog.virtually.coffee/why-i-started-programming</guid><dc:creator><![CDATA[John Dust]]></dc:creator><pubDate>Thu, 03 Feb 2022 18:35:38 GMT</pubDate><content:encoded><![CDATA[<p>While I was growing up, I always had a fascination with technology and how it worked. One of the things I enjoyed during that time was gaming, and I discovered an online sandbox game. This game allowed you to create and program your own mini-games using the Lua Scripting language. Since I was still in grade school, I never was able to get around to learning the API and building a full on game, but I did learn one thing, the basics of programming! This experience was enough to get my attention in programming for the rest of my life.</p>
<h3 id="heading-when-programming-concepts-all-started-to-click">When programming concepts all started to click.</h3>
<p>During high school, I was given the option to choose from various classes for my electives. Since I already had an interest and a career outlook towards being a software developer, I decided to go with the classes they had on technology and programming. Those classes helped me cement my previous knowledge on programming along with helping me learn the ends and outs of computers and how they function. It also helped me understand important programming concepts such as Object Oriented paradigms and much more.</p>
<h3 id="heading-swift-andamp-the-8-bit-master-game">Swift &amp; The 8-bit Master Game.</h3>
<p>After graduating high school, I went full force into learning a programming language on my own. As I owned a few Apple products, I decided to learn Swift. It seemed like the perfect choice since it was a powerful, high level language with a simple, yet familiar syntax. I quickly got the hang of the language and was able to get an understanding of the iOS API.
I had a vision of a game I wanted to create. Although I did not have any formal/professional training in the framework, I was very resourceful and I quickly got the hang of SpriteKit. I even created all of the graphics, artwork and even the music for my game, The 8-bit Master.
I learned many things along the way, not just about Swift, but about software engineering in general and before I knew it, I had a fully functional and pretty impressive game published on the App Store.</p>
<h3 id="heading-flatiron-school">Flatiron School</h3>
<p>After completing my game, I realized that I needed to get some professional education in an employable field. After doing a lot of research, I decided on starting a career in full stack web development. I continued to do more research as regards to education and I found Flatiron School. After looking into this school, I decided to apply for enrollment and got accepted. I am very much looking forward to this new opportunity to learn and grow in my programming abilities!
So, about the title…
Why did I start programming? I guess, just like with any activity, it started out as a fascination during childhood and then grew into something more… <em>a passion</em>.</p>
]]></content:encoded></item></channel></rss>