<?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 Arif Hassan on Medium]]></title>
        <description><![CDATA[Stories by Arif Hassan on Medium]]></description>
        <link>https://medium.com/@ah7318811?source=rss-3dd3a47e3753------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ghczYkNUOHuOXo6VygUdHQ.jpeg</url>
            <title>Stories by Arif Hassan on Medium</title>
            <link>https://medium.com/@ah7318811?source=rss-3dd3a47e3753------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 17:31:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ah7318811/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[Linear Algebra Deep Learning part 1]]></title>
            <link>https://medium.com/@ah7318811/linear-algebra-deep-learning-part-1-30b4d1d80f68?source=rss-3dd3a47e3753------2</link>
            <guid isPermaLink="false">https://medium.com/p/30b4d1d80f68</guid>
            <category><![CDATA[linear-algebra]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Arif Hassan]]></dc:creator>
            <pubDate>Sat, 15 Mar 2025 09:02:55 GMT</pubDate>
            <atom:updated>2025-03-15T09:02:55.547Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Scalars</blockquote><p>It just a singular number, simple magnitude. It represents in italic and lowercase variables. Example let <em>n </em>∈ <strong>ℕ </strong>be the number of units.</p><blockquote>Vectors</blockquote><p>A vector is mostly 1D array of numbers(we call any array of numbers having directions as vectors). It can be real, binary, integer etc.. Let <strong><em>x = </em></strong>[<strong><em>x</em></strong>1 <strong><em>x</em></strong>2 . . . <strong><em>x</em></strong>n] explicitly defined the <strong><em>x. </em></strong>We can think of vectors as identfying points in space, with each element giving the coordinate along a different axis. We use the — sign to index the complement of a set. Such as <strong><em>x</em></strong>-1 vector containing all elements except for<strong><em> x</em></strong>1.</p><blockquote>Matrices</blockquote><p>It’s a 2D array of numbers; so we identified each element with indices. If a real valued matrix A has a height of m and a width of n, then we can say that A∈R^(m×n)</p><blockquote>Tensors</blockquote><p>An array of numbers arranged on a regular rigid with a variable number of axes in known as a tensor.</p><blockquote>Matrices &amp; Vectors Multiplication</blockquote><p>Hadamard or element wise product : Elements corresponding to same row and columns of given vectors/matrices are multiplied together to form a new vector/matrix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/168/0*pGfqZUuqyOxi7akh" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/0*3j-FUyejA3kUtj28" /></figure><p>It is used in image compression technique such as JPEG, also used in LSTM calls of RNN.</p><p>The dot product between two vector x &amp; y of same dimensionality is the matrix product xᵀy.</p><p><em>xᵀy=(xᵀy)ᵀ=yᵀx</em></p><p>A system of linear equation</p><p><em>Ax=b</em></p><p><em>A∈R^(m×n)</em> is a known matrix</p><p><em>b∈R^n </em>is a vector</p><p><em>x∈R^n</em> is a vector of unknown variables</p><blockquote>Indentity &amp; Inverse Matrices</blockquote><p>On multiplication of vector by matrix if the any of the vector does not change, then the matrix is called identity matrix. Identity matrix of n dimensional vectors as I_n(I base n).</p><p><em>In∈Rm×n, ∀x∈Rm×n, I_n*x=x</em></p><p>The matrix inverse of A is given by A⁻¹. It is defined as :</p><p><em>A*A⁻¹=I_n</em></p><p><em>let Ax=b</em></p><p><em>A⁻¹Ax=A⁻¹b</em></p><p><em>I_n*x=A⁻¹b</em></p><p><em>x=A⁻¹b</em></p><p>However A⁻¹ should not be used in practise as it can be represented only with limited precision on a digital computer.</p><blockquote>Norms</blockquote><p>A norm is a way to measure the size or length of a vector in a real or complex space. It always gives a non-negative number. A norm follows these rules:</p><ol><li><strong>Scaling Rule</strong> — If you make the vector bigger or smaller (by multiplying it by a number), the norm changes in the same way.</li><li><strong>Triangle Rule</strong> — The norm of the sum of two vectors is never bigger than adding their norms separately (like how the shortest path between two points is a straight line).</li><li><strong>Zero Rule</strong> — The norm is zero only if the vector itself is zero.</li></ol><p>In machine learning norm function is used to measure the size of a vector.</p><p>Let p≥1 be a real number. The p-norm (also called ℓp-norm) of vector x=(x1,…,xn) is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/170/0*Cn6sJiQhncVtMa1_" /></figure><p>ℓp-norm functions map systen vectoors to non-negative values.</p><p>Norm of a vector x = distance measures from to origin to point x.</p><p>A norm of a function f satisfy the following:</p><p><em>f(x) =0 =&gt; x=0</em></p><p><em>f(x+y)≤f(x)+f(y)</em> (triangle inequality)</p><p><em>∀x∈R; f(αx)=|α|f(x)</em></p><p>ℓp-norm, p=2 is known as euclidean norm since it’s simply the euclidean distance from origin to point x.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/0*bOEbiypyHqeAFE8w" /></figure><p>In some ML application, it is important to discriminate between elements that are exaclty zero and other that are small but non zero value. In that case we turn to function that grows at the same rate in all directions, but also retain mathematical simplicity, and that can be achieved using L1 norm.</p><p><em>||x||₁ = |x₁| + |x₂| + … + |xₙ|</em></p><p>So if to keep the difference zero and non-zero valued elements is important use L1 norm.</p><p>Number of non-zero entries in a vector is not a norm since scaling the vector by α (eigen value) does not change the number of non-zero entries.</p><p>The maximum norm is also called the <strong>infinity norm</strong> or <strong>L∞norm</strong> of a vector x is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/133/0*H-q7y5R3iqkK6tyv" /></figure><p>To measure the size of a matrix, the most common method is to use Frobenius norm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*AqWGj-97aLojKktkQzrFXA.png" /></figure><p>Frobenius norm is analogous to L2 norm of a vector.</p><p>Vector dot product in norm <em>x^Ty=||x||2||y||2cosθ , where </em>θ is the angle between x and y.</p><blockquote>Other matrices and vectors</blockquote><p><em>D</em> is a diagonal matrix; if and only if <em>Di,j=0; ∀ i</em> not equal to <em>j.</em></p><p><em>diag(v)</em> is a sqyare diagonal matrix. Diagonal entries are given by the entries of vector<em> v</em>. It is computationally effecient.</p><p><em>diag(v)x=v⊙x</em></p><p>Inverse of diagonal matrices exist only if every diagonal matrix is non-zero.</p><p><em>diag(v)⁻¹=diag([1/v1,…,1/vn]^T)</em></p><p>Non-square diagonal matrices have no inverses.</p><p>A symmetric matrix is any matrix that is equla to it’s own transpose.</p><p><em>A=A^T</em></p><p>A unit vector is a vector with unit norm.</p><p><em>||x||2=1</em></p><p>An orthogonal matrix is a square matrix with rows and columns mutually orthonormal.</p><p><em>(A^T )A=A(A^T )=In</em></p><p><em>A⁻¹=A^T</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30b4d1d80f68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UART Unlocked: Maximizing Data Communication in Embedded Systems and Beyond]]></title>
            <link>https://medium.com/@ah7318811/uart-unlocked-maximizing-data-communication-in-embedded-systems-and-beyond-856051be1cf0?source=rss-3dd3a47e3753------2</link>
            <guid isPermaLink="false">https://medium.com/p/856051be1cf0</guid>
            <dc:creator><![CDATA[Arif Hassan]]></dc:creator>
            <pubDate>Mon, 01 Apr 2024 16:22:42 GMT</pubDate>
            <atom:updated>2024-04-01T16:22:42.144Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction to UART and its importance in embedded systems</h3><p>UART stands for Universal asynchronous receiver-transmitter is a peripheral device for asynchronous serial communication in which the data format and transmission speeds are configurable. It is a versatile and widely used serial communication interface in embedded systems.. UART provides a simple and efficient way to transmit and receive data between devices, making it an essential component in various applications ranging from industrial automation to Internet of Things (IoT) devices.</p><p>This article aims to provide a comprehensive overview of UART, from its basic principles to its hardware and software implementation. We will explore the advantages of using UART in embedded systems, the communication protocol, and the hardware architecture. We will also discuss common UART libraries and drivers, as well as best practices and design considerations for UART implementation. By the end of this article, you will have a solid understanding of UART and its role in data communication.</p><h4>Definition of UART and its Role in Data Communication</h4><p>Universal Asynchronous Receiver/Transmitter (UART) is like a digital translator that enables seamless communication between different devices by converting parallel data into a serial format and vice versa. It can be define as a protocol, or set of rules, for exchanging serial data between two devices. UART uses two wires between transmitter and reciever to transmit and receive data in both directions. Both the ends are also provided with ground connection. Regarding the communication in UART, it can be simplex (which means data is transferred in one direction only), half-duplex (which means data can be in both direction but the condition in one direction at a time) or full-duplex (which means data can be transferred in both directions simlutaneously).</p><p>In essence, UART is the bridge that connects the digital world, allowing devices to communicate with each other and work together towards a common goal. Whether it’s in industrial automation, IoT devices, or communication between microcontrollers and sensors, UART plays a crucial role in enabling data communication and facilitating seamless integration of devices in a wide range of applications.</p><p>The primary functions of UART include:</p><ol><li>Data transmission and reception: UART enables the transfer of data between devices using a serial communication protocol. It can transmit and receive data at different baud rates and with varying numbers of data bits.<br>2. Asynchronous communication: UART supports asynchronous communication, which means that the transmitter and receiver can operate independently and at different clock speeds.<br>3. Multi-device communication: UART can support multiple devices on a single bus, making it an ideal interface for communication between multiple peripherals in an embedded system.<br>4. Low overhead: UART has low overhead in terms of hardware and software resources, making it an attractive choice for resource-constrained embedded systems.<br>5. Flexibility: UART can be used for both synchronous and asynchronous communication, and it supports a variety of data formats and protocols.</li></ol><h3>UART communication protocol</h3><h4>Basic principles of UART communication</h4><p>The Universal Asynchronous Receiver/Transmitter (UART) is a widely used serial communication interface in embedded system. The basic principles of UART communication lies in asynchronous communication, serial communication, bit timing, start and stop bits, data bits, parity bits (if used), frame format , and handshaking.</p><p>The principle is to transmit binary data bits through data lines. UART system communication mainly composed of two crucial parts:</p><p>Transmitter (sending end)</p><p>Receiver (receiving end)</p><p>The main purpose of a transmitter and receiver for each device is to transmit and receive serial data intended for serial communication (means that data is transmitted bit-by-bit at a time over a single wire).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*PBdzv3kSzLBVke0tYXM6oQ.png" /></figure><p>The asynchronous communication takes place between transmitter and receiver meaning that they operate independently and at a different clock speeds. The transmitting UART is connected to controlling data bus that sents the data in parallel form. The parallel form data is transmitted by the transmitter (sending end) serially i.e, bit-by-bit making simple and more effecient communication interface than parallel form. The receiver (receiving end) receives the serial format data which then convert to parallel form to be used by the controlling data bus in contact. The controlling data bus remove the start and stop bits, also parity bit (if used) and used the remaining data as the main information present in the remaining data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hJEn3rVX3IWurQ-wa85CqQ.png" /></figure><blockquote>Baud is the number of symbols transferred per second. 1 baud is equivalent to one bit per second.</blockquote><h4>Baud Rate</h4><p>Baud Rate is defined as bits per symbol (bps) is the rate of symbols transferred across a transmission medium per second. It is another important aspect of UART communication. The higher the baud rate, the faster data can be transmitted and received.</p><blockquote>The baud rate equation:</blockquote><blockquote>Baud Rate = Bit rate (bps) / Number of bits per unit data</blockquote><h4>Start and stop bit</h4><p>The start bit is a transition between the idle high state to a low state, which is followed by user data bits. After the data bits is over , the stop bit come into play where it takes the transition from low to high or idle state that can be 1 or 2 bit indicate the end of user data.</p><h4>Data bits</h4><p>Data bits are the bits that contain the user given data information. There can be 5 to 9 user data bits, although 7 or 8 bits are the most common. These bits are often transmitted with the least significant bit first and most significant bit later at end.</p><p>Example:<br>To transmit the capital letter “S” in 7-bit ASCII, we need to reverse the bit order to 1 1 0 0 1 0 1 for least significant bit order transmission. Once the data bit is sent, a stop bit is added to signal at the end of the frame, after which the line goes back to the idle state.</p><blockquote>7-bit ASCII ‘S’ (0x52) = 1 0 1 0 0 1 1</blockquote><blockquote>LSB order = 1 1 0 0 1 0 1</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E5VYNkF3zYKN7cM9I9tB5g.png" /><figcaption><strong>start, stop and data bits</strong></figcaption></figure><h4>Parity bit</h4><p>The frame of UART can also contain an optional parity bit if user want that can be used for error detection. The parity bit is inserted in the UART frame in between end data bit and stop bit. The value of the parity bit depends on the type of parity being used.</p><p>The parity bit can be of two type <em>even parity</em> or <em>odd parity</em></p><p><em>Even parity </em>: If the total number of 1s in a frame along with the parity bit is even then it is called as even parity.</p><p><em>Odd Parity </em>: If the total number of 1s in a frame along with the parity bit is odd then it is called as odd parity.</p><p>Example:<br>In the ‘Capital S’ pattern (1 0 1 0 0 1 1), there are 4 ones and 3 zeros. If we use even parity, the parity bit remains 0, as there are already an even number of ones. However, if we use odd parity, we need to add a parity bit of 1, making the total number of ones odd. Parity bits can detect if a single bit has been flipped, but they cannot reliably detect if multiple bits have been changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*dhX-4yOQIPTR6gUHijAMfw.png" /><figcaption>example parity bit</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=856051be1cf0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resolving ENOTFOUND Error in npm: A Case Study]]></title>
            <link>https://medium.com/@ah7318811/resolving-enotfound-error-in-npm-a-case-study-640e80ca62f6?source=rss-3dd3a47e3753------2</link>
            <guid isPermaLink="false">https://medium.com/p/640e80ca62f6</guid>
            <dc:creator><![CDATA[Arif Hassan]]></dc:creator>
            <pubDate>Sat, 06 Jan 2024 02:39:26 GMT</pubDate>
            <atom:updated>2024-01-06T02:39:26.030Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction: In the world of Node.js development, encountering unexpected errors during project setup can be a common frustration. One such issue, discussed in <a href="https://github.com/nodejs/help/issues/4093">GitHub issue #4093</a>, revolves around the ENOTFOUND error when using npm or npx to create a React app. In this blog post, we’ll delve into the details of this specific issue and explore a real-world case study where I successfully overcame the challenge.</p><h3>Understanding the ENOTFOUND Error</h3><p>Before we dive into the case study, let’s briefly understand what the ENOTFOUND error signifies and why it can be particularly perplexing.</p><h3>GitHub Issue #4093: An In-Depth Look</h3><p>In <a href="https://github.com/nodejs/help/issues/4093">GitHub issue #4093</a>, a user faced difficulties creating a React app due to the ENOTFOUND error. We’ll examine the key details of the issue, including the reported symptoms and initial attempts to resolve the problem.</p><h3>Troubleshooting Steps</h3><h4>1. Verifying Network Connectivity</h4><ul><li>Checking internet connection status</li><li>Pinging the npm registry</li></ul><h4>2. Checking Proxy Settings</h4><ul><li>Reviewing proxy configurations</li><li>Resolving conflicts and duplicates</li></ul><h4>3. Node.js and npm Configuration</h4><ul><li>Ensuring Node.js is installed correctly</li><li>Updating npm to the latest version</li></ul><h4>4. Clearing npm Cache</h4><ul><li>Understanding the purpose of the npm cache</li><li>Clearing the cache to resolve potential issues</li></ul><h3>Case Study: Navigating npm Configurations</h3><p>In this section, we’ll explore how the user in GitHub issue #4093 addressed the problem by editing npm configurations. The step-by-step guide will showcase how to locate and modify the necessary settings, specifically addressing the reported https-proxy issue.</p><p>Solution:</p><p>After encountering the ENOTFOUND error, I found success by using the following solution:</p><ol><li>Type npm config edit in your terminal to open the npm configuration file.</li><li>Search for https-proxy. If it is set to null, that&#39;s okay. Additionally, check for any duplicates and, if found, delete them.</li><li>If there are no duplicates, set https-proxy to null.</li></ol><p>Implementing these steps resolved the issue for me, allowing me to seamlessly create a React app without encountering the ENOTFOUND error.</p><h3>Additional Insights</h3><p>To provide a comprehensive overview, we’ll share additional insights, tips, and best practices for resolving network-related errors in npm.</p><h3>Conclusion</h3><p>By dissecting the details of GitHub issue #4093 and learning from the user’s successful resolution, developers facing similar challenges can gain valuable insights. The ENOTFOUND error may seem daunting, but armed with the right knowledge and troubleshooting techniques, developers can navigate these issues with confidence.</p><h3>Reference Links</h3><ul><li><a href="https://github.com/nodejs/help/issues/4093">GitHub Issue #4093</a></li><li><a href="https://docs.npmjs.com/">Official npm Documentation</a></li><li><a href="https://github.com/nodejs">Node.js GitHub Repository</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=640e80ca62f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>