<?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 Diego Armando Gusava on Medium]]></title>
        <description><![CDATA[Stories by Diego Armando Gusava on Medium]]></description>
        <link>https://medium.com/@diegogusava?source=rss-d94c78b08d0a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FlfduWSMcg6zgHeeX_7cFw.jpeg</url>
            <title>Stories by Diego Armando Gusava on Medium</title>
            <link>https://medium.com/@diegogusava?source=rss-d94c78b08d0a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:32:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@diegogusava/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[What is the difference between reduce and reduceRight in JavaScript?]]></title>
            <link>https://itnext.io/what-is-the-difference-between-reduce-and-reduceright-in-javascript-82d871f19cc2?source=rss-d94c78b08d0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/82d871f19cc2</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[functional-programming]]></category>
            <dc:creator><![CDATA[Diego Armando Gusava]]></dc:creator>
            <pubDate>Sun, 23 Sep 2018 11:15:13 GMT</pubDate>
            <atom:updated>2018-09-23T19:48:59.398Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rZRd2lWbZFwAW4rn" /><figcaption>Photo by <a href="https://unsplash.com/@boshkov?utm_source=medium&amp;utm_medium=referral">Ilija Boshkov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever wonder how these two functions work under the hood in JavaScript? First I would like to demonstrate the built-in functions and afterwards, we will create our own reduce and reduceRight functions. Let’s get down to business!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f9fac9ed48ee178fec63f952872442a/href">https://medium.com/media/1f9fac9ed48ee178fec63f952872442a/href</a></iframe><p>I created a list and declared a function that adds one to each element in the list and returns a new list in each iteration, but I applied two different functions to the same list, first reduce function and second the reduceRight function. Do you know what the difference is besides the function name?</p><p>The reduce function goes from left to right and when it reaches the last element, the function is applied to the element and in the next iteration the accumulator will be returned. When the reduceRight function is used, the iteration goes from right to left and when the last element is reached the accumulator will be empty and it runs backward, so actually, the first element is the last element, is the same as reverse the list and then apply the reduce function.</p><p>Therefore the list above for the reduce function returns [5,4,3,2] and for the reduceRight function returns [2,3,4,5]. To better exemplify this we are going to build our own functions. Let’s start with reduce:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/24aaf6caf5c516edd06600569af00859/href">https://medium.com/media/24aaf6caf5c516edd06600569af00859/href</a></iframe><p>The reduce function above receives three arguments, first the list, second the accumulator and third the reduce function. For each iteration, the accumulator is built up, and it goes until it reaches the end of the list, when there is no element, the function returns the accumulator. In other words, if we want to apply reduce to a list [1,2,3,4] where the reduce function is (acc, element) =&gt; [element + 1, …acc], the iteration will be like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/061608db9793e8663dbfd2ef13e6abc3/href">https://medium.com/media/061608db9793e8663dbfd2ef13e6abc3/href</a></iframe><p>Reduce right function will be slightly different from the previous:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d981bb4e78626a2385c8509896d5045/href">https://medium.com/media/4d981bb4e78626a2385c8509896d5045/href</a></iframe><p>The reduce right function above receives the same three arguments, first the list, second the accumulator and third the reduce function. For each iteration, it goes to the next element until it reaches the end of the list and then it starts to run backward. When there is no element it returns the accumulator.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e642252cd93a4e8188515fc790a217f/href">https://medium.com/media/9e642252cd93a4e8188515fc790a217f/href</a></iframe><p>Usually, you will use the reduce function and not the reduceRight function. I hope that now it is clear to you the difference between these two functions!</p><p>Happy coding :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82d871f19cc2" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/what-is-the-difference-between-reduce-and-reduceright-in-javascript-82d871f19cc2">What is the difference between reduce and reduceRight in JavaScript?</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging your Angular application in Intellij IDEA]]></title>
            <link>https://itnext.io/debugging-your-angular-application-in-intellij-idea-411a9b08759f?source=rss-d94c78b08d0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/411a9b08759f</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[intellij]]></category>
            <dc:creator><![CDATA[Diego Armando Gusava]]></dc:creator>
            <pubDate>Sun, 12 Aug 2018 07:15:59 GMT</pubDate>
            <atom:updated>2018-08-14T13:31:58.903Z</atom:updated>
            <content:encoded><![CDATA[<p>Its interesting that I found this feature in Intellij IDEA only after I started to use Visual Code, one day I was pissed off because I couldn’t debug using my preferred IDE and I came across to Visual Code that was free and served with tons of plugins, but the problem was that I didn’t get used to the interface and I missed some shortcuts that Intellij IDEA provide, so I came back to Intellij.</p><p>The first thing we need to do is install the Intellij IDEA Support plugin on Chrome:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bisZHthnLNXPIaCu" /></figure><p>With the plugin installed we need to set up our IDE. Create a new javascript debug configuration like the picture below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HYyXDkV0jDhgGszqbpIZlA.png" /></figure><p>The two important things that you need to do here are:</p><ol><li>Set the Remote URL for your root folder: <strong>webpack:///.</strong></li><li>Set the Remote URL for your src folder: <strong>webpack:///.src/</strong></li></ol><p>Save the configuration, place breakpoints in your code and start a new debug session. The browser will open on <a href="http://localhost:4200/">http://localhost:4200/</a>. Of course the application needs to be running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EJhqLVH3phk81Y_3o9Q0ZQ.png" /></figure><p>Happy coding :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=411a9b08759f" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/debugging-your-angular-application-in-intellij-idea-411a9b08759f">Debugging your Angular application in Intellij IDEA</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to integrate mxgraph with Angular 6]]></title>
            <link>https://itnext.io/how-to-integrate-mxgraph-with-angular-6-18c3a2bb8566?source=rss-d94c78b08d0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/18c3a2bb8566</guid>
            <category><![CDATA[mxgraph]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Diego Armando Gusava]]></dc:creator>
            <pubDate>Sun, 05 Aug 2018 08:03:42 GMT</pubDate>
            <atom:updated>2018-08-08T14:17:29.179Z</atom:updated>
            <content:encoded><![CDATA[<p>When you want to integrate external libraries with Angular, you also need to remember that Angular uses Typescript and typescript is a typed language that compiles to Javascript and because of that we need to declare classes, so Typescript can be compiled with no errors.</p><p>But how can we do that? I’ve created a project on my Github that shows that, but I would like to give some explanations here, so that code can be better understood.</p><p>I assume that you have a angular project already set up, so what we need to do now is install mxgraph:</p><pre>npm install mxgraph — save</pre><p>After you’ve installed mxgraph we need to configure Angular, so it imports our library. Go to angular.json and add the following code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/03d48811ba2bfd9f90e8f96ce690d4d4/href">https://medium.com/media/03d48811ba2bfd9f90e8f96ce690d4d4/href</a></iframe><p>We changed the assests and the scripts properties, to the scripts we added two js files, mxgraph.conf.js that contains some mxgraph configuration and the mxClient.js that is mxgraph library. With these two lines, we are saying to angular to bundle together our scripts.</p><p>The second change we’ve made is to the assets property, with these changes we can be explicitly to where we want to dump the scripts, in our case, we want to dump all the assets that mxgraph provide to “/assets/mxgraph” folder.</p><p>Now we can use mxgraph with angular, but wait, how can we import the classes from mxgraph? mxGraph has no typescript implementation, so we need to declare the classes ourself, but because I am lazy, I’ve just copied the declarations from another project that is on github <a href="https://github.com/gooddaytoday/mxgraph-typescript-definitions">https://github.com/gooddaytoday/mxgraph-typescript-definitions</a>.</p><p>I’ve copied all the files from the link above to a folder that I called mxtypes, with all files in place I had to inform typescript to compile these files, so I created new file mxtypes.d.ts that references all the other files.</p><pre><em>/// &lt;reference path=&quot;./mxtypes/Handlers.d.ts&quot; /&gt;<br>/// &lt;reference path=&quot;./mxtypes/Model.d.ts&quot; /&gt;<br>/// &lt;reference path=&quot;./mxtypes/mxGraph.d.ts&quot; /&gt;<br>/// &lt;reference path=&quot;./mxtypes/Shape.d.ts&quot; /&gt;<br>/// &lt;reference path=&quot;./mxtypes/Util.d.ts&quot; /&gt;<br>/// &lt;reference path=&quot;./mxtypes/View.d.ts&quot; /&gt;</em></pre><p>In this way, we can create graphs using mxgraph:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b99b303b8b36b5207ba8558e2e8860da/href">https://medium.com/media/b99b303b8b36b5207ba8558e2e8860da/href</a></iframe><p>All the code is hosted on <a href="https://github.com/diegogusava/angular-mxgraph">https://github.com/diegogusava/angular-mxgraph</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18c3a2bb8566" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/how-to-integrate-mxgraph-with-angular-6-18c3a2bb8566">How to integrate mxgraph with Angular 6</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>