<?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 Ben Yoss on Medium]]></title>
        <description><![CDATA[Stories by Ben Yoss on Medium]]></description>
        <link>https://medium.com/@benyoss4?source=rss-c21c74701afc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*g5opvB84hhIkO3L-YfX9WA.jpeg</url>
            <title>Stories by Ben Yoss on Medium</title>
            <link>https://medium.com/@benyoss4?source=rss-c21c74701afc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 03:52:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@benyoss4/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[The Fundamentals of SASS/SCSS]]></title>
            <link>https://levelup.gitconnected.com/the-fundamentals-of-sass-scss-42252bf3fded?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/42252bf3fded</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[sass]]></category>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Mon, 11 Oct 2021 06:32:12 GMT</pubDate>
            <atom:updated>2021-10-14T12:23:45.455Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*meQqf4x34ik692uhao5F-A.jpeg" /></figure><p>As a software developer who works on the styling of an application’s <strong>Front End</strong> using <strong>CSS</strong>, there are various challenges which can appear throughout the development process. These challenges could be the duplication of similar styles or the elongated naming conventions for <strong>class</strong> or <strong>id </strong>elements to name a few.</p><p>However, these conflicts could be simply avoided if there was a way to integrate <strong>CSS</strong> with scripting language principals. That is the same question which was brought to the attention of <a href="https://en.wikipedia.org/wiki/Hampton_Catlin"><strong>Hampton Catlin</strong></a>, who developed the innovative solution, <strong>SASS</strong>.</p><p>Today I am going to be talking about the scalable utilities SASS can provide to greatly improve the CSS experience. Let’s get started.</p><h3>What is SCSS/SASS?</h3><p>To clarify, <strong>SCSS</strong> and <strong>SASS</strong> are <strong>not</strong> the same format type.</p><p><strong>SASS </strong><em>(Syntactically Awesome Style Sheets) </em>is a scripting language which is used as a <strong>super-set</strong> to the more standard approach, <strong>CSS</strong> <em>(Cascading Style Sheets)</em>. The language piggy-backs off of CSS such that the code contained within the file at run-time compiles into the CSS equivalent.</p><p><strong>SCSS</strong> <em>(SASSY Cascading Style Sheets)</em> is a fusion between the standard CSS format and the SASS format, allowing for <strong>both</strong> languages to exist in the same codebase.</p><h3>What can be done with SASS?</h3><p>SASS adds the behaviors of typical scripting language principals <em>(i.e. Functions, Variables, Conditionals) </em>to the style sheet, allowing for a more <strong>flexible</strong> and <strong>simplistic </strong>environment. Let’s take a look at some features that SASS can bring:</p><h4>Datatypes</h4><p>SASS provides several additional datatypes which can be used in the CSS environment:</p><p><strong>Map:</strong> An <strong>immutable</strong> sequence of <strong>key-value pairs</strong>. Maps are initialized by specifying the key name separated by comma and a value inside of parenthesis.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c6f5166281a8a6df74622b2640b5da6/href">https://medium.com/media/9c6f5166281a8a6df74622b2640b5da6/href</a></iframe><p><strong>List:</strong> An immutable <strong>sequence of values</strong>. Lists can be initialized by adding multiple values separated by a comma or space.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fcb94e956082e6ad944f8a2fb44f917a/href">https://medium.com/media/fcb94e956082e6ad944f8a2fb44f917a/href</a></iframe><p><strong>Booleans/Null:</strong> Just like any scripting language, SASS contains <strong>Boolean</strong> values as well as a <strong>Null</strong> values.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8ab6c162f997daa411edba67b3ee1ed/href">https://medium.com/media/b8ab6c162f997daa411edba67b3ee1ed/href</a></iframe><h4>Variables</h4><p>In a standard CSS environment there lies the tedious task of having to <strong>manually</strong> change each individual style in a list of elements despite the similarities of styles between elements.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c094d07999b30a95d51f47976bedd33/href">https://medium.com/media/4c094d07999b30a95d51f47976bedd33/href</a></iframe><p>The image above showcases a scaled down representation of repeating styles in the scope of CSS elements. Notice how the <strong>color</strong> and <strong>background-color</strong> contain the same values. However, if you were to change the value to be consistent with the rest of the elements, you would have to alter each individual style within each element.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a3bf6ba328765375ab2f30442288681/href">https://medium.com/media/3a3bf6ba328765375ab2f30442288681/href</a></iframe><p>The snippet above indicates the difference that SASS could bring to this issue. By incorporating <strong>variable declaration</strong>, all the developer has to do is tweak the values of the variables above and all of the elements are consistently tweaked as a result.</p><h4>Element Nesting</h4><p>CSS elements are always in their own individual scopes even when the elements contain nearly identical properties. This results in the style sheet to have a greater complexity and file size.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef6699ff31cdeac31ca26d106efbf04b/href">https://medium.com/media/ef6699ff31cdeac31ca26d106efbf04b/href</a></iframe><p>The snippet above shows 3 elements — .<em>Header, .header, and .description</em> — which all contain similar properties.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dcf09ca051106cb7da7050b7aaa25f99/href">https://medium.com/media/dcf09ca051106cb7da7050b7aaa25f99/href</a></iframe><p>SASS introduces the ability to <strong>nest elements </strong>within each other to make a cleaner and more <strong>robust</strong> codebase.</p><h4>Functions</h4><p>Unlike the CSS environment, SASS allows for functions to exist within the stylesheet. <strong>Functions</strong> in SASS behave similarly to the functions in standard scripting languages except they are inside of a stylesheet. You can get very creative with the different implementations of this feature.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b605b3295f78dff45e938e52a94c5c6/href">https://medium.com/media/0b605b3295f78dff45e938e52a94c5c6/href</a></iframe><h4>Mixins</h4><p>Mixins define styles that can be <strong>reused</strong> throughout the stylesheet environment. This removes verbose repetition of styles and <strong>avoids</strong> non-semantic utilities.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5379302eb6864cc2fa0177d11be08ed5/href">https://medium.com/media/5379302eb6864cc2fa0177d11be08ed5/href</a></iframe><h4>Conditionals</h4><p>When styling <strong>selectors </strong>there is the occasional encounter where the styles should vary depending on the<strong> type of element</strong>. This can result in a entirely new selector developed with the same styles except one or more styles are altered. Fortunately for SASS developers, this is not an issue. <strong>Conditionals</strong> can be created in the SASS environment and behave identically to scripting language conditionals.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b1c1f3c74824cae1d16c924219b3d1a2/href">https://medium.com/media/b1c1f3c74824cae1d16c924219b3d1a2/href</a></iframe><h4>For/While/Each</h4><p>SASS provides an iterative solution to the stylesheet environment through the use of looping. <strong>@For </strong>rules are utilized when looping through a fixed number of times depending on the index value. <strong>@While</strong> rules continuously iterate a block of code until a specified condition is met to which it then “breaks” from it’s cycle. Finally, the <strong>@Each</strong> rule allows for a list of elements or pairs in a map to be iterated from.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c0be62d8e7e00855f26262512abfe4f/href">https://medium.com/media/6c0be62d8e7e00855f26262512abfe4f/href</a></iframe><h3>Conclusion</h3><p>Through the course of this blog we have covered what SASS is along with the utilities that the language can provide to enhance the stylesheet codebase. We have discussed what datatypes SASS has to offer and what variables, loops, and conditionals are. Additionally, we covered functional programming using Functions/Mixins along with the basic principles of element nesting. Hopefully you have found this blog to be useful on your journey to becoming a SASS developer!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42252bf3fded" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/the-fundamentals-of-sass-scss-42252bf3fded">The Fundamentals of SASS/SCSS</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Caching REST Data for Instant Response Time with Redis]]></title>
            <link>https://levelup.gitconnected.com/caching-rest-data-for-instant-response-time-w-redis-25b21c29c4b6?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/25b21c29c4b6</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cache]]></category>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Tue, 19 Jan 2021 05:12:31 GMT</pubDate>
            <atom:updated>2021-01-20T22:50:02.831Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*VkjhREG12Vq8s2w7.jpg" /><figcaption>Image source found by <a href="https://www.helpnetsecurity.com/2018/06/01/redis-compromise/">https://www.helpnetsecurity.com/2018/06/01/redis-compromise/</a></figcaption></figure><p><strong>REST </strong><em>(Representable State Transfer)</em>, is commonly used among all web applications for the purpose of <strong>passing/editing/retrieving</strong> data between the client and server. However, one of the greatest difficulties in working with RESTful requests is the <strong>bandwidth</strong> it takes to retrieve the data back from the server itself. This common issue normally occurs when either <strong>big data</strong> is being retrieved from a database or if there is <strong>slow</strong> connection due to a request being made to a<strong> remote API</strong>.</p><p>Typically, if this is the case, developers would either have to resort to <strong>descaling </strong>the amount of data retrieved from the database or <strong>create</strong> a caching algorithm of their own in the backend.</p><p>This, as it sounds, seems to be a tedious and irritating process. However, <strong>Salvatore Sanfilippo </strong>heard these voices and built the ultimate caching solution, <strong>Redis</strong>.</p><p>Today I am going to be showcasing Redis, and describe what it does as a storage system, and how this tool can be used to make all slow-responsive requests instantaneous. Let’s get started.</p><h3>What is Redis?</h3><p>Redis stands for <em>(Remote Dictionary Server)</em> and is a <strong>RDMS </strong><em>(Relational Database Management System)</em> that incorporates in-memory data storage to persist REST requests sent to its cache. Redis has a built-in replication system to prevent data loss, and different modes that provide different flexibilities such as <strong>Redis Sentinel</strong>, for better accessibility, or <strong>Redis Cluster </strong>for automatic divisions between data.</p><h3>Using Redis — Installation:</h3><p>Before we proceed any further into this blog, the Redis server should be downloaded onto the local machine.</p><p>If you have an <strong>Linux/Ubuntu OS</strong>, a resourceful tutorial on how to install the Redis server locally can be found <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04">here</a>. If you happen to have an <strong>OSX</strong>, follow <a href="https://medium.com/@petehouston/install-and-config-redis-on-mac-os-x-via-homebrew-eb8df9a4f298">this</a> useful tutorial instead.</p><h3>Using Redis — Configuration:</h3><p>Now that we have the Redis server installed onto our local machine, we can proceed with setting up our app.</p><p>To start, we will first need to create a new directory, let’s call it <strong>redis-respect</strong>.</p><pre>$ mkdir redis-respect</pre><p>Now we would want to enter into scope of this newly created directory, once we are in, we can proceed to install our node dependencies by issuing the command below:</p><pre>$ npm init -y //for configuring node package.json</pre><pre>$ npm i node-fetch express redis</pre><p>Perfect. Now we should have the installed dependencies for our application. What what we would want to do is create the start script for the application to run the server. In the <em>package.json</em>, add the following script into the “scripts” category. <em>(For the sake of this blog, I am using the package nodemon)</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f0f7a0e5a781b8ed7cdebb4b2829bc2/href">https://medium.com/media/4f0f7a0e5a781b8ed7cdebb4b2829bc2/href</a></iframe><h3>Using Redis — Server Setup:</h3><p>Now that we have configured the layout of the application, we can now proceed to creating the server. In the root directory of the application, create a new file called <em>index.js</em>. Once the index is built, insert the provided information inside the file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca2302639f66c6b4766a0f569dd8d443/href">https://medium.com/media/ca2302639f66c6b4766a0f569dd8d443/href</a></iframe><p>Now if we were to take a look at our localhost through postman, we will notice that the first request’s ping remains in a relatively normal range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*msi1jP5u3qxSokpuiWPnrQ.png" /></figure><p>However our second call will retrieve information in the blink of an eye!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQ287c5B585ZWPJz6tD_Fw.png" /></figure><p>Wow! Take a look at that improvement. This is an almost instantaneous result.</p><h3>Conclusion:</h3><p>Redis is a storage utility that uses in-memory caching to persist data received from REST requests and as a result makes responses instantaneous. Hopefully this article helped provide more clarity on the features and utilities Redis has to offer.</p><h3>Level Up Coding</h3><p>Thanks for being a part of our community! <a href="https://www.youtube.com/channel/UC3v9kBR_ab4UHXXdknz8Fbg?sub_confirmation=1"><strong>Subscribe to our YouTube channel</strong></a> or join the <a href="https://skilled.dev/"><strong>Skilled.dev coding interview course</strong></a>.</p><p><a href="https://skilled.dev/">Coding Interview Questions + Land Your Dev Job | Skilled.dev</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25b21c29c4b6" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/caching-rest-data-for-instant-response-time-w-redis-25b21c29c4b6">Caching REST Data for Instant Response Time with Redis</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Encryption made Simple with CryptoJS]]></title>
            <link>https://levelup.gitconnected.com/encryption-made-simple-with-cryptojs-3628f5867d78?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/3628f5867d78</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[cipher]]></category>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Mon, 28 Dec 2020 06:42:14 GMT</pubDate>
            <atom:updated>2021-01-26T16:06:16.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mpom-wM-ISxga7YQ.jpg" /></figure><p><strong>Encryption</strong> in the JavaScript environment is the primary focus of keeping private information secure through <strong>binary algorithms</strong>. Through the process of scrambling strings and integers, these algorithms follow a most suitable result to protect against hackers.</p><p>However, developers tend to not <strong>self-encrypt</strong> private information in their web applications due to the tediousness and insecurities that follow it. Instead most tend to turn towards a <strong>library</strong> which does the work for them in a more experienced manner, but the problem with these libraries is that they continue to complicate the practice. This is when simplification took a step further and <strong>Crypto-JS</strong> was born.</p><p>Crypto-JS is a <strong>cryptographic library</strong> meant to enforce algorithms followed by <strong>best practice</strong> means condensed into the simplified use of <strong>classes/method </strong>calls.</p><p>Today I am going to present a demo showcasing the features Crypto-JS can bring to <strong>secure</strong> your next web application. Let’s get started.</p><h3><strong>Encrypting a string:</strong></h3><p>What we will be covering first is how to utilize basic functions from Crypto-JS to create a encrypted array of characters. We can accomplish this task by first demonstrating how to encrypt a basic string:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e152e11fda81fcd35dfcff7a1626303/href">https://medium.com/media/3e152e11fda81fcd35dfcff7a1626303/href</a></iframe><p>A basic hash function such as the variants listed above will normally require a <strong>toString</strong> method attached to the back in order to see the stringed hash created. Typically these strings will look similar to this:</p><pre>Raw: {[Array]}<br>Stringified: 78e731027d8fd50ed642340b7c9a63b3</pre><p>This hash function can still be encrypted even further. By applying a additional method known as <strong>enc</strong>, we can encrypt the hash into any format we desire. For the sake of this presentation, I will demonstrate using <strong>Base64</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c5866f53079bef68cd8fea72d86a584/href">https://medium.com/media/3c5866f53079bef68cd8fea72d86a584/href</a></iframe><h3>Creating Ciphers:</h3><p>Before we jump straight into decrypting, there is one important detail that is needed to be discussed. Hashes CANNOT be decrypted once created. In order to decrypt a hash, they must first be defined with a secret by using a <strong>cipher</strong>. Ciphers are best used when dealing with encrypted hashes that need to be compared with another hash.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ceca0f8d730453572c75d53acbf52e8d/href">https://medium.com/media/ceca0f8d730453572c75d53acbf52e8d/href</a></iframe><p>Now if we wanted to, we could add additional options such as <strong>salt</strong> to further encrypt our ciphertext for extra security, or deal with <strong>progressive hashing</strong>, which combines the results of 2 or more hashes to create a ciphertext. But for the sake of this blog, we are keeping it simple.</p><h3>Decrypting a Encrypted Cipher:</h3><p>Now that we have covered how to create a basic hash and encrypt that hash using ciphers, let’s talk about the vise-versa; <strong>Decryption</strong>. Decryption, as stated earlier, can only be applied to ciphers since ciphers are persisted and can e called with the secret string defining them. Let’s decrypt the ciphertext we have created earlier:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9994b91349afd34be866819c02a79f14/href">https://medium.com/media/9994b91349afd34be866819c02a79f14/href</a></iframe><p>And boom! The cipher that was created earlier was retrieved based on the secret assigned is decrypted back to its original string form. Now if we wanted to we could decrypted our ciphertext into any format, such as <strong>base64</strong>, <strong>ASCII</strong>, or even <strong>binary</strong> to name a few.</p><h3><strong>Conclusion:</strong></h3><p>Through the course of reading this article, we have covered exactly what Crypto-JS does as a library and touched on how to create hashes in the four various forms. Additionally, we have demonstrated how to encrypt strings using ciphers and decrypting ciphertext back into a string. Hopefully this article has shed some light on the world of encryption and that you have left this article learning more than entering.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3628f5867d78" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/encryption-made-simple-with-cryptojs-3628f5867d78">Encryption made Simple with CryptoJS</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rendering 3D objects and animation in React using Three Fiber]]></title>
            <link>https://levelup.gitconnected.com/rendering-3d-objects-and-animation-in-react-using-three-fiber-bf0255e642be?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf0255e642be</guid>
            <category><![CDATA[threejs]]></category>
            <category><![CDATA[react-three-fiber]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[3d-modeling]]></category>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Mon, 21 Dec 2020 01:32:26 GMT</pubDate>
            <atom:updated>2021-02-22T01:25:18.089Z</atom:updated>
            <content:encoded><![CDATA[<h3>Rendering 3D Objects/Animation in React using Three Fiber</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BM6fHV4_rnOH3eFD.jpg" /></figure><p><strong>Three.js</strong> is a <strong>3D rendering/animation</strong> library which incorporates <strong>WebGL</strong> to display models on a canvas. If you are interested in taking a in-depth look at the utilities Three.js can provide to the JavaScript environment, refer to the <a href="https://medium.com/nerd-for-tech/rendering-3d-models-and-animation-using-threejs-ded9088b40a0">previous article</a> I have wrote on this topic. However, in this blog, we will be covering a library that further <strong>simplifies</strong> the utilization of Three.js in the environment, <strong>React</strong>.</p><p>Today I will provide a quick demonstration that showcases the simplified features which can be used to render 3D models via <strong>React Three Fiber components</strong>. Let’s get started.</p><h3>Setting up the Scene:</h3><p>Before we proceed into this blog, what should be required first is the installation of the core dependencies listed below:</p><pre>npm i react react-dom react-three-fiber three drei</pre><p>When it comes to rendering 3D models in the web environment, there would first have to be a scene that is set for the model to render in. Let’s start by creating a basic react component which will store our work as we progress through this blog.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d4b9b616aa650731907528ae09400da/href">https://medium.com/media/8d4b9b616aa650731907528ae09400da/href</a></iframe><p>Inside the contents of the code snippet above, we would first want to create a scene. But how can this be achieved? 3D models on a website are actually projected from a canvas, so we should start there. This can be accomplished just by invoking the <strong>&lt;Canvas /&gt; </strong>component provided by the React Three Fiber library. And that’s it! Now if we were to take a look at our app, we would see a white window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UUxyCL4mm5l7Te-FOsgToA.png" /></figure><p>This may appear as if the scene has not rendered on our webpage but that is due to the white background.</p><h3><strong>Rendering a 3D Shape</strong></h3><p>Now that the scene is rendered successfully on the webpage, let’s add a basic shape in there. In order to render a shape, we would first have to create a new function which will hold our shape’s properties.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0fa3e79b12efad3b3767b42e887c08e7/href">https://medium.com/media/0fa3e79b12efad3b3767b42e887c08e7/href</a></iframe><p>Within the code above, we are returning the HTML needed to create the basic shape. Shapes in ThreeJS are known as meshes which hold all of the 3D object’s properties in calculated data known as Geometries. From here we can now have the ability to render our 3D model by declaring the <strong>&lt; Mesh /&gt;</strong> function we just made in the scope of our canvas scene.</p><p>Now our webpage will look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJklT7C-AdShhrJPOsRv-g.png" /></figure><p>Not quite what we wanted, but this does not mean our shape isn’t rendering properly. We have just not added any lighting, so the shape is surrounded in complete darkness. Let’s change that by adding a lighting and spotlight to our HTML:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89e3137c3baa9ef9635b56a7a1aa5e2c/href">https://medium.com/media/89e3137c3baa9ef9635b56a7a1aa5e2c/href</a></iframe><p>Let’s break down what is going on in this code snippet above:</p><p>In the code above we are declaring <strong>ambientLight</strong> to create a light source in the surrounding scene, and with this <strong>directionalLight</strong> so that the ambient light is shining in a specific direction. The last component, <strong>spotLight</strong>, will render a spotlight in the environment which will shine on the object in a specific position/angle. Lastly we have added <strong>OrbitControls</strong> to allow for cursor movement/rotation in the 3D environment.</p><p>Let’s take a look at our object now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J0cxG5TrSefau7t9z2PDtg.png" /></figure><p>Much better. The Object is now illuminated by the light we produced. Now if we wanted to, we can change the shape of the mesh to one of the numerous meshes provided in the <a href="https://threejs.org/docs/#api/en/objects/Mesh">Three.js documentation</a>, as well as the material the object is made of.</p><h3>Importing Pre-made Meshes:</h3><p>Previously we have just finished creating a scene instance and rendering a 3D model in that scene with appropriate lighting. However, what if we were to take this a step further and import a model from online into our local environment? To accomplish this, we will need to import new dependencies into our component, but don’t worry, there will be no need of installing any new packages.</p><p>Let’s say that we wanted to import this table into our scene:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qTBsGzt8s69xWBbduHUYzA.png" /></figure><p>In order to import this table into our environment, we would first have to create a new function. In the scope of the new function, there should contain the texture overlays of the imported 3D object as variables along with a group to persist the 3D object. In addition, you will also notice the invoking of <strong>GLTFLoader</strong>, which was a imported package linked to Three.js and allows for retrieving data from GLTF files.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5605c482e0564307fe224f80889c0443/href">https://medium.com/media/5605c482e0564307fe224f80889c0443/href</a></iframe><p>In the code snippet above, the mesh component also takes in a new option, <strong>geometry</strong>. This option will render the geometry of any model passed into the scope. Additionally, the <strong>mesh material</strong> tag also contains a texture option which will apply any texture image to the surface of a specific mesh.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f01a04317803f9f18cd8cef6208efbd/href">https://medium.com/media/3f01a04317803f9f18cd8cef6208efbd/href</a></iframe><p>Lastly, we would want to have a backup model to take the place of the 3D object we are trying to import if the mesh <strong>asynchronously</strong> renders. This can be achieved by creating a new mesh function as a placeholder and surround the imported mesh with a suspense method. The suspense method will invoke the backup mesh <em>(the mesh in the fallback option) </em>if the mesh in the <strong>scope</strong> of the component does not execute at call time.</p><h3>Conclusion:</h3><p>Through the course of this blog, we have covered what Three.js is as a library and how Three Fiber can render 3D models in a react environment as well as covering how to import 3D models from external sources into your scene. Hopefully this blog was considered a useful resource for any future developers who happen to be curious about incorporating 3D models/animations for their websites in the most efficient way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf0255e642be" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/rendering-3d-objects-and-animation-in-react-using-three-fiber-bf0255e642be">Rendering 3D objects and animation in React using Three Fiber</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image uploading with Google Cloud Storage — React — Express — Axios]]></title>
            <link>https://benyoss4.medium.com/image-uploading-with-google-cloud-storage-react-express-axios-8517376fb3a0?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/8517376fb3a0</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Mon, 14 Dec 2020 07:38:51 GMT</pubDate>
            <atom:updated>2021-02-01T22:05:10.269Z</atom:updated>
            <content:encoded><![CDATA[<h3>Image Uploading Made Easier with Google Cloud Buckets— React — Express</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*MtVWv5rjL-omEJ9H.jpg" /></figure><p>When handling an upload feature for a web application, persistence with the file data can be considered a rigorous task, since this uploaded file is converted into a temporary primitive format known as a “blob”. However, despite this fallback, the blob may not have the properties needed for database persistence, but that does not mean the data cannot be accessed remotely. This is where we enter into the world of cloud computing.</p><p>Today, I will be discussing one of the most prevalent sources of cloud storage out there on the web, Google Cloud Buckets. In this blog, we will cover what cloud computing is as a whole, and how you can configure your own file uploading feature with persistence using Google’s Cloud Buckets. Let’s get started.</p><h3>What is Cloud Computing?</h3><p>Cloud computing is a vital resource for data persistence and services in web applications and provides the availability of system resources — primarily data storage — without the dependency of the user. Cloud computing includes all deployment services available, all virtually persisted databases, and essentially anything that is managed virtually online.</p><h3>Getting started with Google Cloud Buckets</h3><p>Before we begin with any code, what would be needed first is the configuration of a service account. Assuming that a google cloud account has been made initially, in the cloud developer console, navigate your way to the “Api’s and services” option, and from there, go to credentials. At the bottom of the credentials window, there will be a service accounts section. Luckily, a service account is pre-made when a project is created. Click on the service account, and add a new key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDwrQozfVU_hnMuA2KTtrw.png" /></figure><p>A prompt will then pop up indicating what file format the key will be built in. For the sake of this demo, choose JSON for the formatting. The key file will then be automatically downloaded onto your local machine. Store this key very securely within the root of your application, since the file contains confidential keys and links for accessibility.</p><p>Now that a key is created let’s begin programming our import feature. To start, be sure to download the required dependencies necessary for this demo as listed below:</p><pre>npm i @google-cloud/storage multer filepond react-filepond</pre><h3>File Uploader — Configuration</h3><p>Now that the required dependencies are installed, we can get to work on configuring the cloud storage for our app to utilize. What would be required first is to hold our google cloud files in a directory; we can call this config. In the config, place the JSON key we have obtained earlier into the directory and create a file called storage.js.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*6SGp2_KyHufbSitk689pNQ.png" /></figure><p>Inside of our new storage file, we will begin to flesh out the inner contents needed to connect our cloud storage bucket to our application which will require our service account key file as authentication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*BI9wQgN43ezsXb7kWiJ-5Q.png" /></figure><p>Once we create our storage variable we can now get to work on the next phase of our configuration process. We will now begin developing the method for uploading the image data obtained to the bucket instance and creating the respective URL which will access the image contents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*WEQfxw186baplRJYr8A9OQ.png" /></figure><h3>File Uploader — Server</h3><p>Now that our file is completed, we can move on to implementing this exported method into our server index. But before we get to creating our new upload route, we first have to create a multer for the file data to be converted. Multers are the core necessity for file uploading, since the middleware specializes in handling multi-part form data. Assuming that an express app is already created for us, let’s create a multer for reading our uploaded file data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*bHm6VZzbYib5FmvLroD2KQ.png" /></figure><h3>File Uploader — Client</h3><p>Now we will have the ability to receive data when uploading an image to our server. We can now assume that if we were to make a POST request to record the file data, we can with the method we have created in the config directory initially. However, what about getting the uploaded file data in the first place? In the front-end, there will need to be a file uploading library which will prompt the user with the option to upload a file from their local machine onto the web environment.</p><p>For the sake of this blog, we will be using filepond for the file uploading library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*EfwBHVWGSS8xujyBDxYCcQ.png" /></figure><p>We can now connect our POST request created on the server-side using Axios and.. vioala! An image uploader fully functional and ready to use for your next web application!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8517376fb3a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rendering 3D models and animation using ThreeJS]]></title>
            <link>https://levelup.gitconnected.com/rendering-3d-models-and-animation-using-threejs-ded9088b40a0?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ded9088b40a0</guid>
            <category><![CDATA[threejs]]></category>
            <category><![CDATA[tweenmax]]></category>
            <category><![CDATA[webgl]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Mon, 14 Sep 2020 06:23:09 GMT</pubDate>
            <atom:updated>2021-02-16T15:33:09.007Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*h-nMXG1MEolhbGQ5.jpg" /></figure><p><strong>ThreeJS</strong> is a javascript library that uses <strong>WebGL’s</strong> enhancement behaviors to render 3D models on the web as well as <strong>Tweenmax</strong> to better enhance animation qualities. Today I am going to dive into the basics of ThreeJS and discuss the <strong>demo</strong> that I have incorporated which better taught me how to understand the library as a whole. Let’s get started.</p><h3>What is ThreeJS?</h3><p><strong>ThreeJS</strong> is a <strong>cross-platform Javascript library</strong> meant for the creation and display of <strong>3D graphics</strong> and <strong>animation</strong> onto the web environment. This feat is achieved through the utilization of <strong>WebGL</strong>, a JavaScript API for rendering interactive <strong>2D</strong> and <strong>3D</strong> graphics within any compatible web browser. There are also additional plugins that can be added to a ThreeJS environment — such as <strong>Tweenmax</strong> for smoother animation rendering or <strong>PhysiJS</strong> to incorporate a physics engine for the 3D environment.</p><h3>ThreeJS Basics:</h3><p>Now that we know bit about what ThreeJS is, let’s begin with the basics:</p><h4><strong>Setting the Scene:</strong></h4><p>So let’s say that we would like the create a quick app that will render and display a <strong>3D object</strong> with some basic animation tweening. First, we would need to create an <strong>index.html</strong> file to display our app onto the web environment.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a5f2a52656ed93f6233a4acf57a287a/href">https://medium.com/media/2a5f2a52656ed93f6233a4acf57a287a/href</a></iframe><p>Once we create our html file, inside of the file itself we would like to insert two web scripts that will be used as our modules. ThreeJS will be the library we are going to use, and <strong>TweenMax</strong> is an optional package used to enhance the animation process of 3D objects easier <em>(which blends very well with ThreeJS)</em>.</p><p>Now that we have the html file in place, let’s get to work on the functionality of our app. For the purpose of this blog, I will be adding everything within the contents of this html file alone to demonstrate the flexibility this library can offer. What we want to do next is create a script tag and generate the scene. We can invoke the <strong>THREE.Scene</strong> class which will allow us to generate a scene for our 3D model to render on. Next, it’s time for the camera. We can issue <strong>THREE.PrespectiveCamera</strong> to allow us to set a specific camera angle to display our environment through the lens of the user. This camera can be further tweaked by updating its <strong>x/y/z </strong>values respectively.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e2b0b06e33c6fe384e93420611e2dc0f/href">https://medium.com/media/e2b0b06e33c6fe384e93420611e2dc0f/href</a></iframe><p>Lastly, we would want to create a renderer instance that will render our environment to begin with. We can call <strong>THREE.WebGLRenderer</strong> to accomplish this task effectively, thanks to WebGL’s package contributions. It’s also important to set the <strong>antialias</strong> to<strong> true</strong> otherwise the rendering environment will turn out to be choppy and very jagged.</p><p>Now if we were to issue into the console <strong>live-server</strong> to start our app, we would be greeted with this blank canvas on the webpage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C4jivnXwRnAHFjn-" /></figure><h4><strong>Shapes, meshes, and materials:</strong></h4><p>Next, let’s move on to rendering some shapes on our webpage. First, what we would need to do is define a specific shape to work with. By issuing the class <strong>THREE.SphereGeometry</strong> we can generate a 3D object that takes the form of a <strong>sphere</strong>. This applies to almost any shape that exists in the documentation. Now that we have a shape, let’s define a <strong>texture</strong>, since without one our shape would look very bare and lifeless.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/07defbfecaea20be40cee36c280cb44e/href">https://medium.com/media/07defbfecaea20be40cee36c280cb44e/href</a></iframe><p>To add a texture, using the class <strong>THREE.MeshLambertMaterial</strong> will do just that <em>(read more on the documentation to see the material list)</em>. For the purpose of this blog I set the color to a hex-code of <strong>“yellow”</strong> to give our shape a defined color. And after all of these steps are achieved we can finally create the mesh model by issuing <strong>THREE.Mesh</strong> and add the mesh into our scene using <strong>scene.add(mesh)</strong>.</p><p>Now our webpage will display a black sphere, not quite what we wanted…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dGbssAqaia1Y8Ix-" /></figure><p>To fix this, we can add lighting to our app to give some shine to our shape. We can accomplish this by invoking <strong>THREE.PointLight</strong> to create a light instance and set the position of the light using <strong>light.position.set</strong>, and lastly we can add the light just like how we added the shape in earlier.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8c0a11e55ea27577ace1565f79f8cec/href">https://medium.com/media/f8c0a11e55ea27577ace1565f79f8cec/href</a></iframe><p>Now if we were to take a look at the webpage once more, you will notice that our shape is displaying with a lighting shining and defining the color we gave it. Awesome.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mqw37km2LcAbSi_Y" /></figure><h3>Conclusion:</h3><p>Through the course of this article, we have covered the essential basics of ThreeJS starting with the description of what the library is, as well as how the library can be used to render perfectly geometric 3D objects in a scene. Hopefully you are leaving this article knowing more about ThreeJS than entering.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ded9088b40a0" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/rendering-3d-models-and-animation-using-threejs-ded9088b40a0">Rendering 3D models and animation using ThreeJS</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting to Know the In-s and Out-s of Axios]]></title>
            <link>https://benyoss4.medium.com/getting-to-know-the-in-s-and-out-s-of-axios-ee5f6e429400?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee5f6e429400</guid>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Mon, 07 Sep 2020 13:50:18 GMT</pubDate>
            <atom:updated>2020-09-07T13:50:18.733Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*VvNCLKsW6rthLCkv.jpg" /></figure><p>Today I am going to be discussing how Axios can be utilized as a efficient tool for sending data to the server-side from the client-side and how to obtain information gathered back from RESTful API’s. Let’s get started.</p><h3>What is Axios?</h3><p>Axios is known for being a Node package designed to make HTTP request easier through using bluebirds, “Javascript promises” to asynchronously send/receive data from HTTP requests. The place where Axios primarily shies the most, however, is making RESTful requests to either an API to send/receive data, or to pass data from the client-side environment to the server-side.</p><h3>The Basics:</h3><p>In order to install Axios locally, you must first have npm installed onto your machine. Let’s say for the purpose of this blog, NPM is already installed. In this case, you can just issue the terminal command below to install.</p><p><strong>Installation:</strong></p><pre>npm install axios</pre><p><strong>Importing into a file:</strong></p><pre>const axios = require(‘axios’); //importing into a node environment</pre><pre>import axios from ‘axios’; //importing in a client-side module </pre><p>Before we dive any deeper into this blog, first we should get to know the basics of what Axios can do.</p><p><strong>Making a basic GET request:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*v4NimbBAqtL58acS00sj9g.png" /></figure><p>Above is a bare-bones example of how a get request looks while using Axios. On line 3 inside of the arg, the string would be the link to the website you want to obtain data from (this could also be localhost) and on line four within the scope of this then block you will be able to access your data from the request and do anything you would like with it.</p><p><strong>Making a basic POST request:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*BNt17fBbUh3K4z673heiOg.png" /></figure><p>In this visual depiction above, the structure looks similar, but the behavior is entirely different. Notice how on line 3 now there is an additional argument with an object inside. This object is what will be sent to the server via your POST request, and it is important for this object to be in a JSON format. The then block on line 4 will now be able to return the OK, ensuring that what data is being sent to the server is the correct data, and will be logged as the ‘result’ parameter.</p><p><strong>Making a basic PUT request:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*Vd2oyvmNSlg6ueuZPiZyHw.png" /></figure><p>In the almost identical structure to the POST request, the PUT request will be sending data to the server, and will be able to change the contents of a stored value in the database. Normally this feature is built within the website’s server-side PUT request.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee5f6e429400" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Machine Learning Algorithms on the Web with TensorflowJS]]></title>
            <link>https://benyoss4.medium.com/building-machine-learning-algorithms-on-the-web-with-tensorflowjs-3ad34060763e?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ad34060763e</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[tensorflowjs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Mon, 31 Aug 2020 04:28:42 GMT</pubDate>
            <atom:updated>2020-08-31T04:50:47.298Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Machine Learning Models on the Web with TensorflowJS — Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q5xkCCp0_3OEAMgT.jpg" /></figure><p><strong>TensorFlow</strong> is a highly-known open-source software library meant to <strong>process dataflow</strong> and make predictions based on machine learning models. However, for the longest time, TensorFlow has been restricted as a “<strong>python-oriented” </strong>software, limiting the use of the library for websites. This has caused many developers to resort to creating machine learning algorithms from scratch for web-pages, until their voices have been heard and thus <strong>TensorFlowJS</strong> was born.</p><p>Today I’ll be covering<strong> Part 1</strong> of a brand new series dedicated to the ins and outs of TensorFlowJS, and creating machine learning models in the <strong>web environment</strong>. In this blog we will be covering the <strong>basics of machine learning </strong>and give a brief introduction to TensorflowJS itself, as well as resources that can be used to further understand the library. Let’s get started.</p><h3><strong>What is TensorflowJS?</strong></h3><p>Before we dive too deep, let’s first understand what TensorflowJS actually is:</p><p><strong>TensorflowJS</strong>, like <strong>Tensorflow</strong>, is a library that is able to build, train, and makes predictions from <strong>machine learning models</strong>, but in a<strong> Javascript environment</strong>. TensorflowJS has the ability to bring Python-built ML algorithms to function in a web-app by using <strong>Tensorflow Sequential</strong>, which acts similar to<strong> Keras</strong>, but built for <strong>Node</strong>.</p><h3>Understanding TensorflowJS:</h3><h4>Datasets:</h4><p>When it comes to training a machine learning model, one of the <strong>first</strong> steps is to find a set of examples to <strong>guide</strong> the model on what the <strong>expectation</strong> may be. These examples are normally contained in what is known as <strong>CSV files</strong>, which you could think of as a built-in table containing columns and rows of sample data, which is called a <strong>dataset</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/0*DyoXOhfGDkdzwPgL.png" /><figcaption>A visual of how a CSV dataset looks</figcaption></figure><p>Some datasets like <strong>XGBoost</strong><em> (which is used to predict malicious websites) </em>require a CSV format since most data is compared based on statistics, while other datasets such as <strong>Mnist</strong> <em>(dataset used to predict hand written integers) </em>are stored in its most compressed form as a png file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*X-qU73eYsEQieqOB" /><figcaption>A visual depiction of what the Mnist dataset looks like.</figcaption></figure><h4>Convolutionals:</h4><p>Let’s say that the sample data we are going to use for our machine learning model is going to require the <strong>Mnist dataset</strong>, what we will need for our model to do next is read our sample data, but how can our model see the image? <strong>Everything</strong> a computer can see is made up of <strong>integers</strong>, so if the model were to break down each pixel of the image into integers, then the model will be able to read the image based on the values of <strong>each</strong> pixel. This process is known as a <strong>convolutional</strong>, where pixel units of an image are the sum of n by n slots.</p><p>Let’s break down this visual depicting a convolutional taking place:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*vYTIwdZxINMw91ge.gif" /></figure><p>Let’s narrow down and focus on the process of the first selected units of 9. Notice how in the center there is a 9 unit square known as a “<strong>kernel</strong>”. If we were to do the math for the first 9 slots in the first square, the kernel will <strong>multiply</strong> the values of <strong>all</strong> units and then<strong> sum </strong>up the results. So automatically 121 will be negated since you get nothing when multiplying it by zero while 73 and 113 will be -186 because the kernel multiplies them by -1, and finally 60 will be multiplied by 5 to get 300, and if we were to get the sum, we will have 114, which is the result value placed in the last square. That’s how convolutionals work!</p><h4>Neural Networks:</h4><p>Now that we know what datasets are and how the model will read the sample data using convolutions, let’s take a look at the training phase a machine learning model will take. If we were to analyze the visual depiction below, we will notice how all pixel instances read will be plugged into one of the circles to the very right. This is what is known as the “<strong>hidden layer</strong>”, which is where the convolutionals take place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/0*VDmw8mSHqqcsd7ut" /></figure><p>The structure of a neural network can also often vary. There are numerous varieties based on either what datasets the model is training for, how advanced the model is going to be, if the model will be comparing from a built in database, or maybe it’s just the developer’s preference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*A0BRvrT1MxSJgstj" /></figure><h4>Losses:</h4><p>For the machine learning model to understand the do-s and don’t-s, the model must first compare input values and determine if the prediction is good or bad based on a <strong>decimal grade</strong>. Depending on how far or close the value is to the whole number 1 will determine if the prediction is either <strong>good </strong>or <strong>bad</strong>. If the grade is considered bad, then the model will be <strong>penalized</strong> and scrap the instance entirely, but if the grade is good, then the grade will be<strong> recorded</strong> for future training instances. This is how the model learns and adapts per <strong>epoch </strong><em>(number of training instances set)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/0*iUQSVBZi4_RHWOAD" /></figure><h4>Optimizers:</h4><p>Once each instance in the hidden layer resolves its convolutionals, the model moves onto the next phase in training; learning between what is considered <strong>right</strong> and what is <strong>wrong</strong>, and balances the weight and learning rate of your model. This method is known as an <strong>optimizer</strong>, which is used to find the<strong> cross entropy</strong> <em>(the comparison between two probable outcomes and gathers loss sum)</em> and the <strong>generalization</strong><em> (the process of creating correct predictions for new data)</em> based on the type of optimizer used <em>(such as </em><strong><em>adam</em></strong><em> or </em><strong><em>adagrad</em></strong><em>)</em>, and the conditions of previous losses to prevent future losses from occurring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*Z3ep4DrA2GW5ECCN.gif" /></figure><h4><strong>Gradient Descent:</strong></h4><p>Lastly, after the Optimizer finishes its course, the model’s final stage of training phase is to map the results from the optimized instances and finds the <strong>local minima</strong> <em>(lowest projected value)</em> in the graph of instances. This is known as a <strong>Gradient Descent</strong>, which is used to automatically tweak the <strong>weights </strong>and <strong>biases</strong> of the model. This is how the model checks for accuracy between all instances and reaches the most viable result.</p><h3>Conclusion:</h3><p>Within the course of this blog we have covered exactly what TensorFlowJS is, what a dataset is and how to read visual data using convolutionals, what neural networks are and how they compare results and losses, what optimizers are and how they can gather the sum of losses to prevent future losses, and what gradient descent is and how it’s used to map the results of training and testing data from a model. Hopefully you learned more about machine learning and TensorFlowJS when leaving this blog than entering, and be sure to follow the next part whenever it is released to see how we can use what we taught here in this blog to create an app using TensorFlowJS.</p><h4><strong>Resources:</strong></h4><p><a href="https://www.kaggle.com/datasets">Kaggle</a>: For open-source datasets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ad34060763e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML and Javascript can co-exist using EJS]]></title>
            <link>https://benyoss4.medium.com/html-and-javascript-can-co-exist-using-ejs-317815983e7b?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/317815983e7b</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Mon, 27 Jul 2020 04:32:49 GMT</pubDate>
            <atom:updated>2020-07-27T04:32:49.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*nySvOkdIJ6DMGcXD" /></figure><p>Today I am going to be going over what I believe to be the quickest way to make a working client-side for a full-stack application, EJS. I’ll be taking a look over what EJS actually is, how EJS works, and the benefits this package can bring to your next application. Let’s get started.</p><h4><strong>Addressing the problem:</strong></h4><p>Let’s say we want to iterate over HTML without frameworks/libraries — such as React or Angular — since we would have to set up individual components or deal with a MVC format.</p><p>Additionally we can’t return HTML from a JS file and we also can’t interact with HTMl itself when inserting script tags.</p><p>So what is the solution?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/0*1JV_wSgJuq0z_v9m" /></figure><p>We could use EJS to replicate an HTML file and insert a for-loop to iterate over components directly in the HTML itself. So this way we can have all of our code condensed under one file and we’re able to not require any frameworks or additional packages that would slow down the application.</p><h4>What is EJS?</h4><p>EJS is an acronym that stands for Embedded Javascript, and allows for there to be html markup existing within Javascript. These files are known as EJS files, capable of not only rendering html onto a webpage but also having the ability to pass in data from the server-side and sharing that data among the html.</p><h4>Basic EJS syntax:</h4><p>Let’s take a look at the different syntax’s EJS utilizes and what each one does specifically.</p><p><strong>&lt;%= %&gt;: Outputs global variables/methods.</strong></p><p><strong>&lt;% %&gt;: Javascript temperate literal syntax for conditionals and for-loops.</strong></p><p><strong>&lt;%# %&gt;: Provides comment tags for code.</strong></p><p><strong>&lt;%_ %&gt;: Whitespace removal for code.</strong></p><p><strong>&lt;%- %&gt;: Outputs local variables/methods.</strong></p><h4>Benefits of EJS:</h4><p>So there are alot of benefits to working with EJS as a package to act as a structure to your client-side of your fullstack application. EJS is light-weight, and is able to allow for super quick debugging, not to mention the lack of numerous files taking up storage space. Additional benefits are listed below:</p><ul><li>You now are able to have JS- and HTML-syntax coexist in one file using EJS.</li><li>You can pass data from the server-side directly into the client-side HTML.</li><li>You can use Express to send data directly to the respective EJS file.</li></ul><h3>And That’s It!</h3><p>EJS is capable of having both html and javascript coexist in one file — which save up space and debug time — and also having the ability to pass in data from the scope of express functions using the express.render method. Hopefully there was something learned from this article about EJS, providing the skills to hopefully create a light-weight client-side to a full-stack app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=317815983e7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React-Router: Working with server routes in the front-end]]></title>
            <link>https://benyoss4.medium.com/react-router-working-with-server-routes-in-the-front-end-11b0a5ef60ca?source=rss-c21c74701afc------2</link>
            <guid isPermaLink="false">https://medium.com/p/11b0a5ef60ca</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Ben Yoss]]></dc:creator>
            <pubDate>Mon, 20 Jul 2020 02:58:28 GMT</pubDate>
            <atom:updated>2020-07-20T03:02:36.259Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JiEsBAidB6mOr1l0.png" /></figure><p>Today I will be addressing and taking an in-depth look into both the problems with multi-routed react apps and the most viable solution: React Router. Let’s get started.</p><h4><strong>Addressing the issue:</strong></h4><p>When building a full-stack application using react, there may be a point in time when a developer will be given a task that requires utilizing react’s JSX files under multiple routes. In this case, a developer would immediately run into a serious issue.</p><p>Normally when dealing with react in full-stack apps, there would need to be a web-pack client installed as a dependency, and utilizing the bundle.js as a means to encode the react code into a readable ES5 format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/0*AJ7WFU74hJqiZOC-" /><figcaption>The visual above depicts an instance of how an app would look with a webpack and bundle installed.</figcaption></figure><p>Normally, this is how JSX files are computed into working data — read off of the assigned index.html file. However if we were to try and say for instance.. assign different react components for different routes on the website, then that’s a different story entirely. For someone who may not know about react-router, the first conclusion one would make is to try and use express, since express uses a <strong><em>use</em></strong> method and <strong><em>static</em></strong> method to generate html files onto a webpage under a specific route.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/0*RQ1xkzh-YseKYL1s" /></figure><p>This logic could work, if it were just a plain html file without react. Since we are using react components that are being accessible to the bundle using an index.html, this approach would not work.</p><p>Now another conclusion that one would also make is to add multiple html files to pass in specific components and using their own respective bundles. In this sense, utilizing the <strong><em>use</em></strong> and <strong><em>static</em></strong> methods from express could work, but creating every individual html file and processing individual bundles could be taxing to not only the application itself but to the developer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/0*dBZ7VwxImAelWjJo" /></figure><p>Looking at this visual above could give a developer anxiety because of the clutter. Luckily, there is a solution to all of this mess and the solution is very simple. One could issue <strong>npm install react-router</strong> to add as a dependency, and import the package into a react JSX file and use the router tag to set router conditionals in the html itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PDxwZSz9aylz0BYW" /></figure><p>Let’s dissect what is happening above:</p><p><strong>Router</strong>: a tag used to set React-Router methods.</p><p><strong>Switch</strong>: a tag that allows for multiple set router paths.</p><p><strong>Route path</strong>: a tag used to create a router.</p><p><strong>Route exact path</strong>: a tag used to create an exact router path.</p><h4>The Pros of React-Router</h4><ul><li><strong>It’s dynamic:</strong> React-Router allows the developer to fire different components depending on different routes.</li><li><strong>Can use javascript to manipulate route behavior</strong>: In addition, React-Router allows for javascript code to manipulate the behavior of routes, letting the developer use conditionals, iteration, recursion, or data transfer to manipulate routes.</li><li><strong>Can bring server-side routes to the client-side </strong>: React-Router allows for routes to be controlled under the client-side now rather than just being manipulated in the server-side.</li></ul><h3><strong>And That’s It!</strong></h3><p>In conclusion, it would help tremendously to use React-Router to handle multi-routed react applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11b0a5ef60ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>