<?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[Untitled Publication]]></title><description><![CDATA[Untitled Publication]]></description><link>https://blog.nuwanwick.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Apr 2026 19:43:05 GMT</lastBuildDate><atom:link href="https://blog.nuwanwick.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Understanding symmetric difference in arrays]]></title><description><![CDATA[Welcome to the intriguing world of algorithms! In this post, we're diving into a fascinating algorithm named 'Symmetric Difference' of arrays. I came across this algorithm when I going through Freecodecamp exercises. If you haven't solved this algori...]]></description><link>https://blog.nuwanwick.dev/understanding-symmetric-difference-in-arrays</link><guid isPermaLink="true">https://blog.nuwanwick.dev/understanding-symmetric-difference-in-arrays</guid><category><![CDATA[symmetric difference]]></category><category><![CDATA[algorithms]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Nuwan Wickramarachchi]]></dc:creator><pubDate>Tue, 23 Jan 2024 18:47:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1706035221436/f1583008-3e7c-4ebd-9a31-ab73a54b0c28.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome to the intriguing world of algorithms! In this post, we're diving into a fascinating algorithm named 'Symmetric Difference' of arrays. I came across this algorithm when I going through <a target="_blank" href="https://www.freecodecamp.org/learn/coding-interview-prep/algorithms/find-the-symmetric-difference">Freecodecamp exercises</a>. If you haven't solved this algorithm, I highly encourage you to pause reading and try to solve the algorithm first.  </p>
<p>Let's first try to understand what is meant by symmetric difference. At its core, the symmetric difference is a mathematical operation that, when applied to arrays, reveals a unique set of elements. Specifically, it identifies those elements that are present in either one of the arrays but not in both. For example, for sets <code>A = {1, 2, 3}</code> and <code>B = {2, 3, 4}</code>, <code>A △ B = {1, 4}</code>.  </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706033069658/964ab62a-2825-4dfb-990b-f6d467775714.png" alt class="image--center mx-auto" /></p>
<p>This concept becomes more complex when extended beyond two arrays. Our goal today is to unravel this complexity and understand how to effectively find the symmetric difference across multiple arrays. So to evaluate an expression involving symmetric differences among <em>three</em> elements (<code>A △ B △ C</code>), you must complete one operation at a time. Thus, for sets <code>A</code> and <code>B</code> above, and <code>C = {2, 3}</code>, <code>A △ B △ C = (A △ B) △ C = {1, 4} △ {2, 3} = {1, 2, 3, 4}</code>. You have to understand clearly that we are <strong>not doing the comparison for all arrays at once.</strong>  </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706032925361/fc699167-2ca0-46c4-850a-e4a143f24321.png" alt class="image--center mx-auto" /></p>
<p>Let's try to solve this problem with JavaScript. As inputs, there can be 2 or n number of arrays, and as output, we get the symmetric difference in one single array. The following is a solution to this problem. There can be much more efficient solutions to this problem. If you know a better solution please add a comment.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sym</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> args = [...arguments];

  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">symDiff</span>(<span class="hljs-params">arrayOne, arrayTwo</span>) </span>{
    <span class="hljs-keyword">const</span> result = [];

    arrayOne.forEach(<span class="hljs-function">(<span class="hljs-params">item</span>) =&gt;</span> {
      <span class="hljs-keyword">if</span> (arrayTwo.indexOf(item) &lt; <span class="hljs-number">0</span> &amp;&amp; result.indexOf(item) &lt; <span class="hljs-number">0</span>) {
        result.push(item);
      }
    });

    arrayTwo.forEach(<span class="hljs-function">(<span class="hljs-params">item</span>) =&gt;</span> {
      <span class="hljs-keyword">if</span> (arrayOne.indexOf(item) &lt; <span class="hljs-number">0</span> &amp;&amp; result.indexOf(item) &lt; <span class="hljs-number">0</span>) {
        result.push(item);
      }
    });

    <span class="hljs-keyword">return</span> result;
  }

  <span class="hljs-keyword">return</span> args.reduce(symDiff);
}


sym([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], [<span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>], [<span class="hljs-number">2</span>, <span class="hljs-number">3</span>])
</code></pre>
<p>The sym function is a JavaScript function designed to calculate the symmetric difference between multiple arrays. When the function is called, it takes any number of arrays as arguments. Initially, it converts these arguments into an actual array named args using the spread syntax, making it easier to manipulate them using array methods. Inside sym, there's a helper function named symDiff, which is responsible for computing the symmetric difference between two arrays at a time. This function works by iterating through each element of the first array, adding elements to a result array if they are not found in the second array and are not already in the result array. It then repeats this process for the second array. The result is an array of elements that are unique to each of the two arrays being compared.</p>
<p>The sym function then uses the reduce method on the args array. The reduce method applies the symDiff function across the args array, starting with the first two arrays and then consecutively applying the symmetric difference to the cumulative result and the next array in args. This approach allows the sym function to compute the symmetric difference across all provided arrays, resulting in a single array that represents the symmetric difference of all the input arrays.  </p>
<p>Hopefully, this deep dive into its inner workings has provided clarity on how symmetric differences are calculated in JavaScript. If you have any questions or if there's a specific part of this process you'd like to discuss further, please feel free to leave a comment below. I'm always here to help and love engaging with readers about these fascinating programming concepts!</p>
]]></content:encoded></item><item><title><![CDATA[How I made data onboarding 4X faster 🚀]]></title><description><![CDATA[The challenge
While I was working at Assetowl, a property management solutions company in Australia, I faced and solved a big problem that greatly improved how we brought data into our system.
When acquiring new customers we had to import their past ...]]></description><link>https://blog.nuwanwick.dev/how-i-made-data-onboarding-4x-faster</link><guid isPermaLink="true">https://blog.nuwanwick.dev/how-i-made-data-onboarding-4x-faster</guid><category><![CDATA[data onboarding]]></category><category><![CDATA[openpyxl]]></category><category><![CDATA[React]]></category><category><![CDATA[Redux]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[Python]]></category><dc:creator><![CDATA[Nuwan Wickramarachchi]]></dc:creator><pubDate>Sat, 13 Jan 2024 17:14:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1705158582736/24f53bdc-f784-4527-90fb-05994e893cd6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-the-challenge">The challenge</h2>
<p>While I was working at <a target="_blank" href="https://www.assetowl.com/">Assetowl</a>, a property management solutions company in Australia, I faced and solved a big problem that greatly improved how we brought data into our system.</p>
<p>When acquiring new customers we had to import their past data as a part of the onboarding process. Customers gave us inspection data in different formats, including PDF, Word, and Excel/CSV files for 100s properties they manage. In the onboarding process, this acts as a bottleneck because ~8 data entry operators had to do this manually. The variety of these data formats made the process of adding this data to our system slow and more likely to have mistakes. This was a huge challenge to make sales.</p>
<p>My main responsibility was to oversee data onboarding. I had to witness the difficulties and hurdles during this process. Top management had plans to implement a system to facilitate data onboarding but since Assetowl was a startup company top management did not have enough resources to invest in the onboarding system.</p>
<h2 id="heading-solution">Solution</h2>
<p>To tackle this challenge, I developed Python scripts, leveraging the capabilities of the Openpyxl library. This programming approach was aimed at converting data from CSV files into JSON files. JSON, or JavaScript Object Notation.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705161669095/8f1fbba1-1b90-4df5-9b4b-f2e10343ebd3.png" alt class="image--center mx-auto" /></p>
<p>This technical solution significantly minimized the need for manual data entry. Automating the conversion process, not only saved time but also greatly reduced the possibility of errors. The code for these scripts is accessible on GitHub at this link: <a target="_blank" href="https://github.com/nuwan93/PDF-to-JSON">PDF-to-JSON</a>.</p>
<h2 id="heading-again-a-problem">Again a problem</h2>
<p>Now I had JSON files ready to import into the system but there was an issue. Due to the inconsistency of customer-provided files, the JSON files were not 100% accurate. Even though JSON is humanly readable it was really hard to edit the JSON files.</p>
<h2 id="heading-next-solution">Next solution</h2>
<p>As a solution, I designed and developed a quality assurance web application using React, Typescript, and Redux. This application allowed users to upload above mentioned JSON files, make edits, and download the edited versions with ease, enhancing the overall data onboarding experience.</p>
<p>The source code is available on GitHub at this link: <a target="_blank" href="https://github.com/nuwan93/pcr-qa">pcr-qa on GitHub</a>. Additionally, a live demo of the application can be accessed at <a target="_blank" href="https://pcr-qa.netlify.app/">pcr-qa.netlify.app</a>, providing a hands-on experience of its functionality.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705164036534/c94627bc-2fe5-48a9-8490-360dc74b05c9.png" alt class="image--center mx-auto" /></p>
<p>With these solutions, data onboarding was 4X faster than manual data import. As a result of this increased efficiency, we were able to onboard more customers than ever before. The faster processing times allowed us to handle a larger volume of data without compromising on accuracy or quality. This was a significant step forward in meeting the growth of our clientele.</p>
]]></content:encoded></item></channel></rss>