<?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 Dante Lombardi on Medium]]></title>
        <description><![CDATA[Stories by Dante Lombardi on Medium]]></description>
        <link>https://medium.com/@dantelombardi?source=rss-c62e6443f0d8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*5jPn-zHU3c-lEHFjH0WdTA.jpeg</url>
            <title>Stories by Dante Lombardi on Medium</title>
            <link>https://medium.com/@dantelombardi?source=rss-c62e6443f0d8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 10:22:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dantelombardi/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[LeetCode Problems]]></title>
            <link>https://dantelombardi.medium.com/leetcode-problems-27d88cf88f26?source=rss-c62e6443f0d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/27d88cf88f26</guid>
            <dc:creator><![CDATA[Dante Lombardi]]></dc:creator>
            <pubDate>Mon, 12 Jul 2021 20:20:34 GMT</pubDate>
            <atom:updated>2021-07-12T20:20:34.211Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Problem: Find First and Last Position of Element in Sorted Array</strong></h3><p>Given an array of integers numbers sorted in ascending order, find the starting and ending position of a given target value.</p><p>If target is not found in the array, return [-1, -1].</p><p>Problem statement taken from: <a href="https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array">https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/0*YPp_Inodsvxtu-TE.png" /></figure><p><strong>Example 1:</strong></p><pre>Input: nums = [5, 7, 7, 8, 8, 10], target = 8<br>Output: [3, 4]</pre><p><strong>Example 2:</strong></p><pre>Input: nums = [5, 7, 7, 8, 8, 10], target = 6<br>Output: [-1, -1]</pre><p><strong>Example 3:</strong></p><pre>Input: nums = [], target = 0<br>Output: [-1, -1]</pre><h3>Explanation</h3><h3>Brute force</h3><p>The brute force approach will be to do a linear scan of the array. We use two pointers leftIndex and rightIndex start with the first array element.</p><p>When the first occurrence of the target element is found, we assign that index to leftIndex variable. We keep on iterating till the element is different from target. We assign the current index — 1 value to rightIndex.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*ufJaLZum42E41i2SbwMBeQ.png" /></figure><h3>Binary search solution</h3><p>An efficient solution to this problem is to use binary search. Let’s check the algorithm below:</p><pre>- set i = 0, j = nums.size() - 1<br>- set leftIndex and rightIndex to -1</pre><pre>- loop while i &lt;= j<br>  - set mid = i + (j - i)/2</pre><pre>  - if nums[mid] &gt; target<br>    - set j = mid - 1<br>  - else if nums[mid] &lt; target<br>    - set i = mid + 1<br>  - else<br>    - leftIndex = mid<br>    - set j = mid - 1</pre><pre>- set i = 0, j = nums.size() - 1</pre><pre>- loop while i &lt;= j<br>  - set mid = i + (j - i)/2</pre><pre>  - if nums[mid] &gt; target<br>    - set j = mid - 1<br>  - else if nums[mid] &lt; target<br>    - set i = mid + 1<br>  - else<br>    - rightIndex = mid<br>    - set i = mid + 1</pre><pre>- return [leftIndex, rightIndex]</pre><p>The time complexity of the above approach is O(log(N)) and, space complexity is O(1).</p><h3><strong>Solution</strong></h3><pre>var searchRange = function(nums, target) {<br>    let i = 0, j = nums.length - 1, mid;<br>    let leftIndex = -1, rightIndex = -1;</pre><pre>    while(i &lt;= j){<br>        mid = ~~(i + (j - i) / 2);</pre><pre>        if(nums[mid] &gt; target){<br>            j = mid - 1;<br>        } else if (nums[mid] &lt; target){<br>            i = mid + 1;<br>        } else {<br>            leftIndex = mid;<br>            j = mid - 1;<br>        }<br>    }</pre><pre>    i = 0;<br>    j = nums.length - 1;</pre><pre>    while(i &lt;= j){<br>        mid = ~~(i + (j - i) / 2);</pre><pre>        if(nums[mid] &gt; target){<br>            j = mid - 1;<br>        } else if (nums[mid] &lt; target){<br>            i = mid + 1;<br>        } else {<br>            rightIndex = mid;<br>            i = mid + 1;<br>        }<br>    }</pre><pre>    return [leftIndex, rightIndex];<br>};</pre><h3>Valid Parentheses Problem</h3><p>Given a string <strong>s</strong> containing just the characters <strong>‘(‘</strong>, <strong>‘)’</strong>, <strong>‘{‘</strong>, <strong>‘}’</strong>, <strong>‘[‘</strong> and <strong>‘]’</strong>, determine if the input string is valid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/0*onZ6tmLzY7VReWqN.png" /></figure><p>An input string is valid if:</p><pre>1. Open brackets must be closed by the same type of brackets.<br>2. Open brackets must be closed in the correct order.</pre><p>Problem statement taken from: <a href="https://leetcode.com/problems/valid-parentheses">https://leetcode.com/problems/valid-parentheses</a></p><p><strong>Example 1:</strong></p><pre>Input: s = &quot;()&quot;<br>Output: true</pre><p><strong>Example 2:</strong></p><pre>Input: s = &quot;()[]{}&quot;<br>Output: true</pre><p><strong>Example 3:</strong></p><pre>Input: s = &quot;(]&quot;<br>Output: false</pre><p><strong>Example 4:</strong></p><pre>Input: s = &quot;([)]&quot;<br>Output: false</pre><p><strong>Example 5:</strong></p><pre>Input: s = &quot;{[]}&quot;<br>Output: true</pre><h3>Explanation</h3><p>The problem can be solved by using a stack or by recursion. For a large string, building up a stack of recursive calls consumes memory temporarily and may take more space than an iterative solution.</p><h3>Stack</h3><pre>- initialize stack st and i = 0.- return true if the string is empty.- Loop while i &lt; 0<br>  - if s[i] == &#39;(&#39; || s[i] == &#39;[&#39; || s[i] == &#39;{&#39;    // push the char to stack<br>    - st.push(s[i])  - else if s[i] == &#39;)&#39; &amp;&amp; !st.empty() &amp;&amp; st.top() == &#39;(&#39; ||<br>            s[i] == &#39;}&#39; &amp;&amp; !st.empty() &amp;&amp; st.top() == &#39;{&#39; ||<br>            s[i] == &#39;]&#39; &amp;&amp; !st.empty() &amp;&amp; st.top() == &#39;[&#39;    // pop the top element if the current char is a closing brace provided<br>    // stack is not empty.<br>    - st.pop()  - else    // the string is not a valid parenthesis<br>    - return false  i++- return true if st.empty()- return false.</pre><h3><strong>Solution</strong></h3><pre>var isValid = function(s) {<br>   let st = [];<br>   const legend = {<br>     &#39;(&#39;: &#39;)&#39;,<br>     &#39;{&#39;: &#39;}&#39;,<br>     &#39;[&#39;: &#39;]&#39;<br>   };   for (let i = 0; i &lt; s.length; i++) {<br>     if (s[i] === &#39;(&#39; || s[i] === &#39;{&#39; || s[i] === &#39;[&#39;) {<br>       st.push(s[i]);<br>     } else if (legend[st.pop()] !== s[i]) {<br>       return false;<br>     }<br>   }   return st.length ? 0 : 1;<br>};</pre><h3>Merge Two Sorted Array Problem</h3><p>You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively.</p><p>Merge nums1 and nums2 into a single array sorted in non-decreasing order.</p><p>The final sorted array should not be returned by the function, but instead, be stored inside the array nums1. To accommodate this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements are set to 0 and should be ignored. nums2 has a length of n.</p><p>Problem statement taken from: <a href="https://leetcode.com/problems/merge-sorted-array">https://leetcode.com/problems/merge-sorted-array</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/0*s6iAraQug_AVknm0.png" /></figure><p><strong>Example 1:</strong></p><pre>Input: nums1 = [1, 2, 3, 0, 0, 0], m = 3, nums2 = [2, 5, 6], n = 3<br>Output: [1, 2, 2, 3, 5, 6]<br>Explanation: The arrays we are merging are [1, 2, 3] and [2, 5, 6].<br>The result of the merge is [1, 2, 2, 3, 5, 6] with the underlined elements coming from nums1.</pre><p><strong>Example 2:</strong></p><pre>Input: nums1 = [1], m = 1, nums2 = [], n = 0<br>Output: [1]<br>Explanation: The arrays we are merging are [1] and [].<br>The result of the merge is [1].</pre><p><strong>Example 3:</strong></p><pre>Input: nums1 = [0], m = 0, nums2 = [1], n = 1<br>Output: [1]<br>Explanation: The arrays we are merging are [] and [1].<br>The result of the merge is [1].<br>Note that because m = 0, there are no elements in nums1.<br>The 0 is only there to ensure the merge result can fit in nums1.</pre><h3>Explanation</h3><p>The brute-force approach for the problem is to create a new array nums3 and keep adding elements from the two sorted arrays. Once all the elements from nums1 and nums2 are added to nums3 we copy back nums3 to nums1.</p><p>But the above solution will take an extra space of O(m + n). We need to sort the elements without any extra space.</p><p>The idea is to iterate both the arrays from right to left and keeping adding the elements to nums1 from right.</p><p>Let’s check the algorithm below:</p><pre>- set i = m - 1, j = n - 1, k = m + n - 1</pre><pre>- loop for i &gt;= 0 &amp;&amp; j &gt;= 0<br>  - if nums1[i] &gt; nums2[j]<br>    - set nums1[k] = nums1[i--]<br>  - else<br>    - set nums1[k] = nums2[j--]</pre><pre>- loop while i &gt;= 0<br>  - set nums1[k--] = nums1[i--]</pre><pre>- loop while j &gt;= 0<br>  - set nums1[k--] = nums2[j--]</pre><h3><strong>Solution</strong></h3><pre>var merge = function(nums1, m, nums2, n) {<br>    let i, j, k;</pre><pre>    for(i = m - 1, j = n - 1, k = m + n - 1; i &gt;= 0 &amp;&amp; j &gt;= 0; k--){<br>        if(nums1[i] &gt;= nums2[j]){<br>            nums1[k] = nums1[i--];<br>        } else {<br>            nums1[k] = nums2[j--];<br>        }<br>    }</pre><pre>    while(i &gt;= 0) {<br>        nums1[k--] = nums1[i--];<br>    }</pre><pre>    while(j &gt;= 0) {<br>        nums1[k--] = nums2[j--];<br>    }<br>};</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27d88cf88f26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a silent auction using Ruby, SQLite3, and ActiveRecord]]></title>
            <link>https://dantelombardi.medium.com/creating-a-silent-auction-using-ruby-sqlite3-and-activerecord-f32308a1f4b7?source=rss-c62e6443f0d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f32308a1f4b7</guid>
            <dc:creator><![CDATA[Dante Lombardi]]></dc:creator>
            <pubDate>Fri, 25 Jun 2021 21:00:32 GMT</pubDate>
            <atom:updated>2021-06-25T21:00:32.236Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re new to programming like I am some cool practice projects to work on would be to create a simple site that uses Ruby, SQLite3 and ActiveRecord to query backend databases for persistent data maintenance and displaying that data on a front end site. I am creating a simple silent auction site that can help build out my understanding of different frontend and backend tools that are commonly used in web development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*XmC9DvOOmRqmkF-I" /><figcaption>real image of me coding</figcaption></figure><p><strong>Create User Stories</strong></p><p>Your first steps to take would be to conceptualize your user stories. What is it that you want your site to do? How will users interact with your site and what kind of functionality will you need to build. To start I have laid out a couple of guidelines that I will work towards.</p><ol><li>Site will display a list of current active auctions that they can bid on.</li><li>User will be able to submit a bid with a bidder name and bid amount.</li><li>User will be able to update or a delete a bid on an active auction.</li><li>User will be able to end an auction, displaying who the highest bidder is and the winner.</li></ol><p><strong>Map Relationships</strong></p><p>Once you have a few user stories defined you should start to map out your data and your data relationships, take a few minutes to think about how your relationships will be structured. In my case, a auction can have many bids and many bidders , and a bidder can have many bids and many auctions. A bid belongs to a single bidder and a single auction, and thus is the ‘join’.</p><p>If you were to map it out visually it might looks like this:</p><p>Auctions &gt; — Bids — &lt; Bidders</p><p><strong>Create Your Migrations</strong></p><p>Now that you know how your data is going to be structured you can start to create the migrations to create the tables using Rake. I choose to create all the tables in one migration and my tables looked like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*XowdPZqJaoLlHGpldlHGhw.png" /><figcaption>very imaginative migration name</figcaption></figure><p>Notice how I have auction_id and bidder_id under bids, this is so that I can create those associations between these tables.</p><p>It can be helpful to check your schema to see that the migration was successful. I had to drop the table my first time and try again in order to get the scheme to load. The old turn it off and turn it back on again trick.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*0B4tQP2kZVjROQlR" /><figcaption>Don’t ask why it works, just be thankful it does.</figcaption></figure><p>Now that I’ve created my migrations I will create my associations between the data, with with bidders and auctions having many of bids and each other and bids belonging to both auctions and bidders.</p><p><strong>Seed dummy data and test your database</strong></p><p>Now that you’ve got you data structure all set up its time to start seeding that data! In my seeds.rb file I will hard code some fake auctions in, as well as create a random sampling of bidders from a bidders name array and some dummy bids using random number generator to create the bid amounts.</p><p>Using Rake console you can sample your data to make sure associations are working correctly and that the data sampled is in the correct format. Using this I first noticed that my bidder name was initially instantiated as integer when it should have been a name.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f32308a1f4b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Non-Primitive Data Structures]]></title>
            <link>https://dantelombardi.medium.com/non-primitive-data-structures-8485730f78d4?source=rss-c62e6443f0d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8485730f78d4</guid>
            <dc:creator><![CDATA[Dante Lombardi]]></dc:creator>
            <pubDate>Thu, 24 Jun 2021 20:51:53 GMT</pubDate>
            <atom:updated>2021-06-24T20:57:29.712Z</atom:updated>
            <content:encoded><![CDATA[<p>Data Structures can be broadly classified into primitive and non-privative types.</p><p>Primitive data structures are the basic data structures that typically hold singular points of data. They can be defined as data that is not an <a href="https://developer.mozilla.org/en-US/docs/Glossary/Object">object</a> and has no <a href="https://developer.mozilla.org/en-US/docs/Glossary/Method">methods</a>. In Javascript there are 7 primitive data types: <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a>, <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a>, <a href="https://developer.mozilla.org/en-US/docs/Glossary/BigInt">bigint</a>, <a href="https://developer.mozilla.org/en-US/docs/Glossary/Boolean">boolean</a>, <a href="https://developer.mozilla.org/en-US/docs/Glossary/undefined">undefined</a>, <a href="https://developer.mozilla.org/en-US/docs/Glossary/Symbol">symbol</a>, and <a href="https://developer.mozilla.org/en-US/docs/Glossary/Null">null</a>.</p><p>Non-Primitive data structures are more complicated, usually comprised of primitive data types grouped in ways to enable efficient management of larger sets of data based on the relationship between them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*kXzZ2VcInyGXnu_lLUYFUw.png" /></figure><h3>Arrays</h3><p>An <strong>Array </strong>is a linear collection of data elements having the same data type.</p><ul><li>Accessing an element: O(1) This is the primary advantage of an array because it stores elements at known location</li><li>Search an element: O(n)</li><li>Insertion of an Element: O(n)</li><li>Deletion of an Element: O(n)</li></ul><p>Advantages and Disadvantages of an Array:</p><ol><li>Accessing a known element is fast because the location is already known. You would not need to traverse an array like with a linked list.</li><li>Insertion and deletion can be expensive because an entire array may need to be modified when only one element needs to be changed.</li><li>In most languages arrays need to be contiguous. This often means that an array size will need to be predetermined when it is created. Modifying an array above its size means that a new array will need to be created of the new size.</li></ol><h3>Linked Lists</h3><p>A <strong>Linked list </strong>is a collection of nodes, where each node has a data element and a reference to the next and/or previous node in the sequence.</p><h4>Singly linked list</h4><p>Singly linked list stores data and the reference to the next node or a null value.</p><h4>Doubly linked list</h4><p>It has two references, one for the last node and one for the previous node. This helps us traverse in both the directions.</p><ul><li>Accessing an element: O(n)</li><li>Search an element: O(n)</li><li>Insertion of an Element: O(1)</li><li>Deletion of an Element: O(1)</li></ul><p>Advantages and disadvantages of Linked Lists:</p><ol><li>Linked Lists allow for faster insertion and deletion and modification of the list as reference pointers can easily be modified to snip or redirect the linked list</li><li>Random known elements cannot be as easily accessed as it requires the traversal of possibly the entire array to access the data at the needed location.</li><li>Extra memory is required to store not only the data, but the reference pointers as well, doubly so for double linked lists</li></ol><h3>Stack</h3><ul><li>A Stack is a FILO (First In Last Out) data structure where the element that is added first will be deleted last.</li></ul><p>It allows two operations — Push and Pop. Push allows us to add elements to the top while Pop allows removing the last element (removing the element at the top). Both operations can take place at the same end.</p><ul><li>Accessing an element: O(n)</li><li>Search an element: O(n)</li><li>Insertion of an Element: O(1)</li><li>Deletion of an Element: O(1)</li></ul><p><strong>Example</strong>:- As we navigate from one web page to another, those pages are placed on a stack. The current page is on the top and the first page we looked at is at the bottom of the stack. If we click on the back button, we begin to move in reverse order through the pages.(Popping each page).</p><h3>Queues</h3><ul><li>A Queue is a FIFO (First in First Out) data structure where the element that is added first will be deleted first.</li></ul><p>It is open at both its ends. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). In queue, we always dequeue (or access) data, pointed by front pointer and while enqueing (or storing) data in the queue we take help of rear pointer.</p><ul><li>Accessing time of an element: O(n)</li><li>Search time of an element: O(n)</li><li>Insertion of an Element: O(1)</li><li>Deletion of an Element: O(1)</li></ul><p>Examples of a queue might be a ticketing system, a input stream or something like a printer queue.</p><h3>Trees</h3><p>A tree is a non-linear data structure that can be defined as a collection of nodes where each node is a data structure consisting of a value, together with a list of references to nodes (the “children”). It is similar to a linked list, but instead of referencing just one next object it can reference multiple child objects.</p><ul><li>Search an element: O(n)</li><li>Insertion of an Element: O(n)</li><li>Deletion of an Element: O(n)</li></ul><h3>Graphs</h3><p>A graph is a common data structure that consists of a finite set of nodes (or vertices) and a set of edges connecting them.</p><h4>Types of graphs:</h4><h4>Undirected Graph:</h4><p>In an undirected graph, nodes are connected by edges that are all bidirectional. For example if an edge connects node 1 and 2, we can traverse from node 1 to node 2, and from node 2 to 1.</p><h4>Directed Graph</h4><p>In a directed graph, nodes are connected by directed edges — they only go in one direction. For example, if an edge connects node 1 and 2, but the arrow head points towards 2, we can only traverse from node 1 to node 2 — not in the opposite direction.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8485730f78d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apple vs Facebook]]></title>
            <link>https://dantelombardi.medium.com/apple-vs-facebook-35e10f278a8?source=rss-c62e6443f0d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/35e10f278a8</guid>
            <dc:creator><![CDATA[Dante Lombardi]]></dc:creator>
            <pubDate>Fri, 14 May 2021 04:34:32 GMT</pubDate>
            <atom:updated>2021-05-14T04:34:32.546Z</atom:updated>
            <content:encoded><![CDATA[<p>With Apple’s upcoming iOS 14.5 update there is a small feature being released that could significantly change the tech landscape.</p><p>It’s called App Tracking Transparency.</p><p>With the release of iOS 14.5, developers are now required to ask for and receive your permission before an app access your random advertising identifier, which is used to track your activity across apps and websites. It will look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*cwZRi_axQePS1IXQ" /></figure><p>According to <a href="https://www.flurry.com/blog/ios-14-5-opt-in-rate-att-restricted-app-tracking-transparency-worldwide-us-daily-latest-update/">Flurry Analytics</a>, only 4% of users are opting in to allow apps to track them. Considering that personalized advertising revenue is almost 98% of Facebook’s revenue in 2020 and <a href="https://www.statista.com/statistics/462370/share-of-mobile-facebook-ad-revenue/">92%</a> of that is from mobile advertising this will have a huge impact on Facebook and other “advertising” internet companies.</p><p>The internet has long been thought of as a paradise of free services, from e-mail to social media to search, it’s all free to the users. But as the saying goes, if you’re not paying for it, you are the product. Over the last few decades entire ecosystems have been built on building services that people would use, and then to capture the user data to build personalized advertising services to businesses looking to target certain markets. Business has been good, with Facebook pulling in over 27 Billion in 2020 from advertising.</p><p>With this new app tracking transparency feature Apple will potentially hamper apps ability to track user across different apps. By anonymizing the IDFA (ID For Advertisers) unless to user opts in advertising companies will have a more difficult time tracking user activity across different apps or to provide targeted advertising across different apps. One notable aspect of this change is a requirement that developers not track you in <em>other ways</em> to skirt the preferences that you select for anti-tracking, so if you choose not to allow an app to track you with a random advertising identifier, that app is not allowed to use non-Apple sanctioned tools to get around the rules.</p><p>User privacy rights have advanced a lot over the last years. With California’s CPRA passing in 2020 and Europe passing GDPR in 2018. But this Apple update may be another additional hurdle to companies that rely on selling user information to make a profit.</p><p>Facebook is not taking the fight sitting down, they have taken a full page ad out of the WSJ, claiming to stand up for small businesses. But these claims are falling flat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/0*1fQwNeym_pf4TXuX" /></figure><p>Instagram may also threaten to charge users that do no allow app tracking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*eDK0XLdS_2OUkEaJ" /></figure><p>It may be that in a few years we may need to rethink the entire internet ecosystem. Perhaps the giants of today may be the NetScapes of tomorrow. Or perhaps users with more control over their data may need to be enticed with revenue sharing options or perhaps even pay to use services that do not hand out their personal information.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35e10f278a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the difference between a NodeList and an HTMLCollection]]></title>
            <link>https://dantelombardi.medium.com/what-is-the-difference-between-a-nodelist-and-an-htmlcollection-161db45aeb25?source=rss-c62e6443f0d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/161db45aeb25</guid>
            <dc:creator><![CDATA[Dante Lombardi]]></dc:creator>
            <pubDate>Thu, 22 Apr 2021 05:25:11 GMT</pubDate>
            <atom:updated>2021-04-22T18:08:08.935Z</atom:updated>
            <content:encoded><![CDATA[<p>When using Javascript to manipulate the DOM there are a few ways to grab elements. Some of the most used are:</p><p>document.querySelectorAll();</p><p>or</p><p>document.getElementsByClassName();</p><pre>let a = document.querySelectorAll(‘#elements’)</pre><pre>a displays:</pre><pre>NodeList[div.elements]</pre><pre>let b = document.getElementsByClassName(‘elements’)</pre><pre>b displays:</pre><pre>HTMLCollection[div.elements]</pre><p>querySelector returns a nodeList and getElements returns an HTMLCollection. So what is the difference between a nodeList and an HTMLCollection? Both are collections of DOM objects, one distinction is nodeList is static while HTMLCollection is live. In a “live” collection, changes to DOM are reflected in the collection object. A static collection changes in DOM do not update the collection.</p><p>HTMLCollections are array-like but they are not exactly arrays. They might look like arrays, and they have various numbered elements and can call some properties like .length on them but they do not have all the functionality that actual arrays do and you cannot call forEach() or other array methods on them.</p><p>NodeLists are also array-like, but you can call many more array methods on them.</p><p><strong>Here is a list of HTMLCollection properties and methods:</strong></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/length">HTMLCollection.length</a> Returns the number of items in the collection.</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/item">HTMLCollection.item()</a>Returns the specific node at the given zero-based index into the list. Returns null if the index is out of range.</p><p>HTMLCollection.namedItem()Returns the specific node whose ID or, as a fallback, name matches the string specified by name.</p><p><strong>Here is a list of NodeList properties and methods:</strong></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList/length">NodeList.length</a>The number of nodes in the NodeList.</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList/item">NodeList.item()</a>Returns an item in the list by its index, or null if the index is out-of-bounds.</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList/entries">NodeList.entries()</a>Returns an iterator, allowing code to go through all key/value pairs contained in the collection. (In this case, the keys are numbers starting from 0 and the values are nodes.)</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach">NodeList.forEach()</a>Executes a provided function once per NodeList element, passing the element as an argument to the function.</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList/keys">NodeList.keys()</a>Returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection. (In this case, the keys are numbers starting from 0.)</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList/values">NodeList.values()</a>Returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection.</p><p>So how can you convert an HTMLCollection or NodeList to an Array? By using the spread operator!</p><p>const myArray = […document.getElementsByClassName(‘DOMElements’)]</p><p>const myArray = […document.querySelectorAll(‘#DOMElements’)]</p><p>Doing that would allow you to use all functionality just like any array.</p><p>It seems that some browsers are even confused about when to return nodeLists and HTMLCollections from different query calls.</p><p>Here’s what Mozilla says:</p><blockquote><em>Note: While the W3C DOM 3 Core specification says elements is a NodeList that was simply because of a an attempt to have the “core” specification not depend on the “html” specification at that time. The DOM 4 draft says that elements is an HTMLCollection.</em></blockquote><blockquote><em>Gecko/Firefox currently returns a NodeList (Bug 162927) but starting with Gecko/Firefox 19, this method will return HTMLCollection (Bug 799464). Internet Explorer returns a HTMLCollection. WebKit returns a NodeList. Opera also returns a NodeList, but with a namedItem method implemented, which makes it similar to a HTMLCollection.</em></blockquote><p>In conclusion, I’ve found that using querySelector to return nodeLists allows more flexibility on what to do with those objects. When in doubt I’ve preferred to use querySelector or to convert my collections to arrays.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=161db45aeb25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5G: Evolution or Revolution?]]></title>
            <link>https://dantelombardi.medium.com/5g-evolution-or-revolution-41ed073212d4?source=rss-c62e6443f0d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/41ed073212d4</guid>
            <category><![CDATA[5g]]></category>
            <category><![CDATA[futurism]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <dc:creator><![CDATA[Dante Lombardi]]></dc:creator>
            <pubDate>Fri, 03 May 2019 01:15:25 GMT</pubDate>
            <atom:updated>2019-05-11T14:46:31.261Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*qdCHe4Cr4vnLhC4wIdNBuA.png" /></figure><p>Cellular technology has reshaped how we interact with each other and the world, no other technology has had a greater impact on civilization in the 21st century and this is just the beginning. As companies begin to roll out 5G to select cities the technology will bring all new changes to industry and society. Blink and you might miss them.</p><p>5G technology is poised to bring improvements that are orders of magnitude greater than current 4G LTE technology. Right now, networks can deliver speeds around 20 MB/s, 5G can deliver up to 600 MB/s. Latency, the time it takes for your information to travel to its destination, is reduced from an average of ~70 milliseconds to less than 1 millisecond. Then there is connectivity, the number of unique connections that can be made within a square kilometer. 5G offers 10 times greater connectivity of 100,000 over 4G’s 10,000 as well as upping the reliability of these connections to 99.999%. Finally, the energy efficiency of 5G technology will allow 10 times longer battery life than current devices.</p><p>All these enhancements herald the creation of entirely new industries that will take advantage of these capabilities. When you think that Uber barely existed when 4G first rolled out, and now with the on demand economy there is an “Uber” for practically everything you begin to get a sense of how radical this transformation will be. How many startups of today will blossom into the titans of tomorrow on the backs of these networks?</p><p>The most obvious and immediate winner of this rollout will be the mobile broadband consumer. Faster download speeds mean you can download your movie in seconds and upload your selfies in milliseconds. You could probably livestream your entire life and barely make a dent in your available bandwidth. The full connectivity to the internet goes anywhere you go, no more asking for the café’s wifi password or worrying if your home broadband will reach all the way to your bedroom, the internet is now ubiquitous and faster than ever before. Thinking beyond that you could imagine that phone manufacturers will think of clever ways to improve their products and take advantage this new paradigm. Moore’s law begins to break down as we approach the 10nm processor size, we can only cram so much power into a handheld device, but networks continue to improve 10x by every generation. Maybe phones don’t need to be $1200 processing behemoths with 256 GB of storage but are rather connectivity tools that leverage the power of cloud-based supercomputers and near limitless cloud storage. A whole server rack in your pocket able to stream to your TV and talk to your smart home and plug in to your driverless car. Plenty of software already does this, Alexa sends your soundbites off to the cloud for the complex voice recognition processing. Google translate can process images in real time because it off loads that data to its powerful data centers. But that’s just sending pictures and soundbites, imagine what a bigger data pipe could handle? Real-time facial recognition technology, augmented reality that overlays data onto your smart glasses, high fidelity gaming running through phone sized devices. You thought Pokémon Go was fun? Wait until some enterprising gaming company turns all real space into a game world. Does that get your attention yet?</p><p>Mobile broadband is just the tip of the iceberg, as much fun as we will have on our new toys the real revolution is going to be the non-human agents interacting with the network. In addition to the faster speeds we also have the higher connectivity which will allow billions rather than millions of connections. An army of discrete agents running intelligent autonomous tasks all around us. There have been huge developments in machine learning and AI over that past few years. We have computers that can defeat the worlds greatest players in incredibly complex games like GO or DOTA 2. This intelligence is about to reach out and touch our lives on every street corner. Self-driving cars alone present a dauntingly complex problem; a vehicle needs to know its location, speed, surroundings, route, and traffic rules. It needs to be able to process that data in real-time as well as interact and relay necessary information to other smart vehicles around it. This simply would not be possible without the high capacity, low latency, and high reliability of a 5G connection. That’s not to even mention all the Netflix we are going to be binging in our new mobile entertainment pods. So yea, vehicles are about to get pretty smart, but we are about to start putting sensors in everything, trash cans, street lights, refrigerators, dog collars, luggage, everything! The IoT revolution is here and the data it creates is going to create an entirely new level of human and civilizational self-awareness. Our data sphere is going to start to know more about us than we know about ourselves. Health trackers are going to flag vitamin deficiencies and be able to detect early onset of diseases. Your fridge is going to know that your favorite food is in fact waffles, not pancakes, because you ate waffles 212 times this year. If this data is public or shared it could also enable greater cognition of our society, we could track viral outbreaks in real time, understand and avoid inefficient traffic patterns on a granular level, or predict energy usage to empower a smart energy grid. Again, these are things that we do in some capacity already, but we are sipping data through a straw right now and we are about to be blasted by a fire hose’s worth of information.</p><p>The most interesting and nebulous aspect is how this technology is going to affect society on a fundamental level. The Wall Street Journal and other publications have called the printing press the greatest invention of the last millennium, not because the invention was a technical achievement or spawned massive industries in its wake, but because it enabled the era of mass communication that altered the course of history. The printing press is synonymous with Luther’s 93 theses, the enlightenment, the scientific revolution, the democratic and communist revolutions that rocked the 18th, 19th, and 20th centuries. The printing press democratized information and gave the power of knowledge to the people. I believe we are living through a similarly revolutionary time and that the communication networks that we create will enable seismic shifts in all aspects of our life. From the way we work to the shape and layout of our cities to the nature of our political, financial, and social systems. How will our landscape change as telecommuting and remote work becomes the norm? What will money look like as decentralized payment platforms get more advanced? What does it mean to be educated when we can have all the information we would ever need at our fingertips? What is the nature of relationships in a time when you can be always connected to anybody? What does democracy look like as we forge new identities that cross geographical boundaries? We are on the precipice of a great unknown and I, for one, feel lucky to be alive during such a revolutionary time.</p><p>NOTE: The views expressed here are those of the authors and do not represent or reflect the views of any company or organization.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41ed073212d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>