<?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 Sadansubedi on Medium]]></title>
        <description><![CDATA[Stories by Sadansubedi on Medium]]></description>
        <link>https://medium.com/@sadansubedi?source=rss-bc7fe91ee79a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4_h3vb4z-eH-Ax5E</url>
            <title>Stories by Sadansubedi on Medium</title>
            <link>https://medium.com/@sadansubedi?source=rss-bc7fe91ee79a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:43:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sadansubedi/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 Subarray, Subsequences, Contiguous elements while solving leetcode problem?]]></title>
            <link>https://medium.com/@sadansubedi/what-is-subarray-subsequences-contiguous-elements-while-solving-leetcode-problem-9825c8462669?source=rss-bc7fe91ee79a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9825c8462669</guid>
            <category><![CDATA[contiguous-elements]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[subarray]]></category>
            <category><![CDATA[subsequence]]></category>
            <category><![CDATA[problem-solving]]></category>
            <dc:creator><![CDATA[Sadansubedi]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 03:28:49 GMT</pubDate>
            <atom:updated>2026-03-10T03:28:49.744Z</atom:updated>
            <content:encoded><![CDATA[<p>These three terms appear <strong>very frequently in LeetCode questions</strong>, so understanding them clearly will help you solve many problems.</p><p>Let’s go step-by-step.</p><p>1️⃣ Contiguous Elements</p><p><strong>Contiguous means elements that are next to each other with no gaps.</strong></p><p>Example array:</p><pre>[1, 2, 3, 4, 5]</pre><p>Examples of <strong>contiguous elements</strong>:</p><p>[1,2]<br>[2,3,4]<br>[3,4,5]</p><p>Not contiguous:</p><p>[1,3] ❌ (2 is skipped)<br>[2,5] ❌<br>[1,4,5] ❌</p><p>So:</p><p>👉 <strong>Contiguous = consecutive elements in order with no skipping</strong></p><h3>2️⃣ Subarray</h3><p>A <strong>subarray is a contiguous part of an array</strong>.</p><p>This means <strong>elements must stay together</strong>.</p><p>Example array:</p><pre>[1, 2, 3]</pre><p>All possible <strong>subarrays</strong>:</p><p>[1]<br>[2]<br>[3]<br>[1,2]<br>[2,3]<br>[1,2,3]</p><p>Invalid subarrays:</p><p>[1,3] ❌ (not contiguous)</p><h3>Key rule</h3><pre>Subarray = contiguous elements</pre><p>That is why <strong>sliding window works on subarrays</strong>.</p><h3>3️⃣ Subsequence</h3><p>A <strong>subsequence allows skipping elements</strong> but the <strong>order must remain the same</strong>.</p><p>Example array:</p><pre>[1, 2, 3]</pre><p>Possible <strong>subsequences</strong>:</p><p>[1]<br>[2]<br>[3]<br>[1,2]<br>[1,3] ✅ (skip 2)<br>[2,3]<br>[1,2,3]</p><p>Invalid subsequence:</p><p>[3,1] ❌ (order changed)</p><h3>Key rule</h3><pre>Subsequence = can skip elements but order must stay same</pre><p>Important:</p><pre>All subarrays are subsequences<br>BUT<br>Not all subsequences are subarrays</pre><p>Because subsequence allows <strong>skipping elements</strong>.</p><h3>5️⃣ Simple Visualization</h3><p>Array:</p><pre>[1,2,3,4]</pre><p>Subarray example:</p><pre>[2,3,4]   ✅ contiguous</pre><p>Subsequence example:</p><pre>[1,3,4]   ✅ skip allowed</pre><p>Invalid subsequence:</p><pre>[4,2] ❌ order changed</pre><h3>6️⃣ Why This Matters in LeetCode</h3><p>Different problems use different concepts:</p><h3>Subarray problems</h3><p>Usually solved with:</p><ul><li><strong>Sliding Window</strong></li><li><strong>Prefix Sum</strong></li><li><strong>Kadane’s Algorithm</strong></li></ul><p>Example:</p><pre>Maximum subarray sum</pre><h3>Subsequence problems</h3><p>Usually solved with:</p><ul><li><strong>Dynamic Programming</strong></li><li><strong>Recursion / Backtracking</strong></li></ul><p>Example:</p><pre>Longest Increasing Subsequence</pre><h3>7️⃣ Quick Trick for Interviews</h3><p>If the problem says:</p><p><strong>“subarray”</strong></p><p>👉 elements must be <strong>contiguous</strong></p><p>If the problem says:</p><p><strong>“subsequence”</strong></p><p>👉 you can <strong>skip elements</strong></p><h3>Common concept in both <strong>subarray and subsequence </strong>is</h3><p>In <strong>both subarray and subsequence, we cannot change the order of elements</strong></p><pre>[3,1] ❌<br>[2,1] ❌</pre><p>Because the original order is:</p><pre>1 → 2 → 3</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9825c8462669" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important Idioms]]></title>
            <link>https://medium.com/@sadansubedi/important-idioms-1eae6a2b84fe?source=rss-bc7fe91ee79a------2</link>
            <guid isPermaLink="false">https://medium.com/p/1eae6a2b84fe</guid>
            <category><![CDATA[english-language]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[idioms]]></category>
            <category><![CDATA[practice-eng]]></category>
            <dc:creator><![CDATA[Sadansubedi]]></dc:creator>
            <pubDate>Tue, 03 Mar 2026 03:28:02 GMT</pubDate>
            <atom:updated>2026-03-14T16:27:09.762Z</atom:updated>
            <content:encoded><![CDATA[<p>Most useful idioms use in our daily life and useful for ilets as well, you can provide as much as you want</p><p>Great idea — learning idioms helps a lot in daily English speaking and also boosts your IELTS Speaking &amp; Writing scores (especially for Lexical Resource). Below is a big, practical list of high-use idioms with simple meanings and examples.</p><p>I grouped them by situation so they’re easier to remember.</p><h3>✅ Most Useful Daily Life + IELTS Idioms</h3><h3>🔹 Very Common Conversation Idioms</h3><ol><li>Break the ice — start a conversation<br>→ He told a joke to break the ice.</li><li>Hit the nail on the head — say exactly right<br>→ You hit the nail on the head with that answer.</li><li>Piece of cake — very easy<br>→ The exam was a piece of cake.</li><li>Under the weather — feeling sick<br>→ I’m feeling under the weather today.</li><li>Spill the beans — reveal a secret<br>→ Who spilled the beans?</li><li>In hot water — in trouble<br>→ He is in hot water with his boss.</li><li>On the same page — agree<br>→ We are on the same page now.</li><li>Call it a day — stop working<br>→ Let’s call it a day.</li><li>Once in a blue moon — very rarely<br>→ I eat junk food once in a blue moon.</li><li>The ball is in your court — your decision now<br>→ I’ve done my part — the ball is in your court.</li></ol><h3>🔹 Idioms for Work &amp; Study (Great for IELTS Speaking)</h3><ol><li>Burn the midnight oil — study/work late<br>→ I burned the midnight oil before my exam.</li><li>Learn the ropes — learn basics<br>→ It takes time to learn the ropes.</li><li>Think outside the box — think creatively<br>→ We need to think outside the box.</li><li>Back to square one — start again<br>→ The plan failed — back to square one.</li><li>Get the hang of it — understand after practice<br>→ You’ll get the hang of it soon.</li><li>In the long run — over time<br>→ Exercise helps in the long run.</li><li>Short-handed — not enough people<br>→ Our team is short-handed today.</li><li>Pull your weight — do your share<br>→ Everyone must pull their weight.</li></ol><h3>🔹 Idioms for Success &amp; Failure</h3><ol><li>Make it big — become successful<br>→ She wants to make it big.</li><li>Go the extra mile — do more than expected<br>→ He always goes the extra mile.</li><li>Miss the boat — miss opportunity<br>→ I missed the boat on that job.</li><li>Fall flat — fail badly<br>→ His idea fell flat.</li><li>Bounce back — recover quickly<br>→ She bounced back after failure.</li><li>Hit rock bottom — lowest point<br>→ He hit rock bottom last year.</li></ol><h3>🔹 Idioms for Emotions</h3><ol><li>Over the moon — very happy<br>→ I’m over the moon about my result.</li><li>Down in the dumps — sad<br>→ He looks down in the dumps.</li><li>On edge — nervous<br>→ I was on edge before the interview.</li><li>Lose your cool — get angry<br>→ Don’t lose your cool.</li><li>Keep your chin up — stay positive<br>→ Keep your chin up — things improve.</li></ol><h3>🔹 Money &amp; Cost Idioms</h3><ol><li>Cost an arm and a leg — very expensive<br>→ That phone costs an arm and a leg.</li><li>Dirt cheap — very cheap<br>→ I got it dirt cheap.</li><li>Make ends meet — manage expenses<br>→ It’s hard to make ends meet.</li><li>Break the bank — too expensive<br>→ It won’t break the bank.</li></ol><h3>🔹 Time Idioms</h3><ol><li>Better late than never — late is okay<br>→ You came — better late than never.</li><li>Against the clock — in a hurry<br>→ We’re working against the clock.</li><li>At the eleventh hour — last moment<br>→ He submitted at the eleventh hour.</li><li>Time flies — time passes fast<br>→ Time flies when you’re busy.</li></ol><h3>🔹 Social &amp; Relationship Idioms</h3><ol><li>See eye to eye — agree<br>→ We see eye to eye.</li><li>A shoulder to cry on — emotional support<br>→ She is my shoulder to cry on.</li><li>Fair-weather friend — only there in good times<br>→ He’s a fair-weather friend.</li><li>Hit it off — like each other immediately<br>→ We hit it off quickly.</li></ol><h3>🔹 Problem &amp; Decision Idioms (Excellent for IELTS Speaking Part 3)</h3><ol><li>A blessing in disguise — good result from bad event<br>→ Losing the job was a blessing in disguise.</li><li>A double-edged sword — has pros &amp; cons<br>→ Technology is a double-edged sword.</li><li>Add fuel to the fire — make worse<br>→ His comment added fuel to the fire.</li><li>On thin ice — risky situation<br>→ You’re on thin ice.</li><li>Take it with a grain of salt — don’t fully believe<br>→ Take that news with a grain of salt.</li></ol><h3>🔹 Communication Idioms</h3><ol><li>Get straight to the point — be direct<br>→ Let’s get straight to the point.</li><li>Beat around the bush — avoid main topic<br>→ Stop beating around the bush.</li><li>Read between the lines — understand hidden meaning<br>→ Read between the lines.</li><li>Put it in a nutshell — summarize<br>→ To put it in a nutshell…</li></ol><p>Other grammar rule</p><pre>&#39;s+ v3 =has =&gt; He&#39;s worked hard<br><br>&#39;d+v3=  had =&gt; He&#39;d worked hard  <br><br>&#39;s+v4= is  =&gt; He&#39;s working hard<br><br>&#39;d+rather= would  =&gt; He&#39;d rather do that<br><br>&#39;d+v1=would      =&gt; He&#39;d help me<br><br>&#39;d+better= had   =&gt; You&#39;d better understand </pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1eae6a2b84fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connect to Your VPS with a Shortcut Using SSH Config]]></title>
            <link>https://medium.com/@sadansubedi/connect-to-your-vps-with-a-shortcut-using-ssh-config-074ab687344b?source=rss-bc7fe91ee79a------2</link>
            <guid isPermaLink="false">https://medium.com/p/074ab687344b</guid>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[vps]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Sadansubedi]]></dc:creator>
            <pubDate>Fri, 06 Jun 2025 06:59:28 GMT</pubDate>
            <atom:updated>2025-06-06T06:59:28.053Z</atom:updated>
            <content:encoded><![CDATA[<p>Tired of remembering long SSH commands with IPs and ports every time you log in to your server? With a simple SSH config file, you can connect using just a shortcut name like ssh username.</p><p>Before:</p><pre>ssh -p 22 rakesh@123.123.123.20</pre><p>Now:</p><pre>ssh rakesh</pre><p>Now you login into remote server how?</p><p>Here’s how to set it up <strong>using only the Windows Command Prompt</strong>:</p><h3>🗂️ 1. Navigate to Your .ssh Folder</h3><p>Open <strong>Command Prompt (CMD)</strong> and run:</p><pre>cd %USERPROFILE%\.ssh</pre><p>This takes you to:</p><pre>C:\Users\YourUsername\.ssh</pre><p>If the folder doesn’t exist, you can create it by running:</p><pre>mkdir %USERPROFILE%\.ssh</pre><h3>📝 2. Create or Edit the SSH Config File</h3><p>To create or open the SSH config file, run:</p><pre>notepad config</pre><p>If you see <strong>“File not found. Do you want to create a new file?”</strong>, choose <strong>Yes</strong>.</p><h3>✍️ 3. Paste the Following into that Notepad</h3><pre>Host ssh username<br>    HostName your.server.ip.address<br>    User ssh username<br>    Port 22<br>    IdentityFile C:\Users\YourUsername\.ssh\id_rsa</pre><pre>Example:-<br>Host rakesh<br>    HostName 123.123.123.20<br>    User rakesh<br>    Port 22<br>    IdentityFile C:\Users\YourUsername\.ssh\id_rsa</pre><p>💡 If your private key is named id_rsa and stored in the default .ssh folder, you can even delete that the IdentityFile line!</p><h3>💾 4. Save and Close Notepad</h3><p>Once you paste and edit the details, save the file and close Notepad.</p><h3>✅ Rename a File in CMD (Remove .txt Extension)</h3><ol><li>Open <strong>CMD</strong></li><li>Run the following command:</li></ol><pre>ren %USERPROFILE%\.ssh\config.txt config</pre><p>✅ This will rename the file config.txt to just config.</p><h3>🔍 Confirm It Worked</h3><p>You can verify with:</p><pre>dir %USERPROFILE%\.ssh</pre><p>You should now see:</p><pre>config<br>id_rsa<br>id_rsa.pub<br>...</pre><h3>🛠️ Troubleshooting</h3><h3>🚫 Problem: Could not resolve hostname username</h3><p>Make sure:</p><ul><li>The file is named <strong>config</strong> — <em>not</em> config.txt</li><li>It is saved under:<br> C:\Users\YourUsername\.ssh\config</li></ul><h3>✅ To verify:</h3><p>Run:</p><pre>dir %USERPROFILE%\.ssh</pre><p>Look for a file named exactly config.</p><pre>config<br>id_rsa<br>id_rsa.pub<br>...</pre><p>Now login into server only by :</p><pre>ssh username</pre><pre>ssh rakesh</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=074ab687344b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to disable login into remote server from any other device or system?]]></title>
            <link>https://medium.com/@sadansubedi/how-to-disable-login-into-remote-server-from-any-other-device-or-system-d6a3db2e5da3?source=rss-bc7fe91ee79a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6a3db2e5da3</guid>
            <category><![CDATA[vps]]></category>
            <category><![CDATA[disable-password]]></category>
            <category><![CDATA[paasword]]></category>
            <dc:creator><![CDATA[Sadansubedi]]></dc:creator>
            <pubDate>Fri, 09 May 2025 03:40:58 GMT</pubDate>
            <atom:updated>2025-05-09T04:05:46.924Z</atom:updated>
            <content:encoded><![CDATA[<p>Ok yesterday we work on loging into remote server passwordlessly but only doing this isnot enough to protect your remote server, why?</p><p>The answer is</p><p>Although we did passwordlessly from our own computer, still we can login through password from another system so today we are going to do disable password</p><p>for this first login into remote server from root</p><p>and then run</p><pre>nano /etc/ssh/sshd_config</pre><p>if you don’t have root access then ask for sudo access from your boss haha then run</p><pre>sudo nano /etc/ssh/sshd_config</pre><p>This lets you edit the file with <strong>admin privileges</strong>.</p><h3>Once you’re in the file, look for these lines and change them:</h3><pre>PasswordAuthentication no</pre><p>if you don’t find this line search by pressing ctrl-w and type PasswordAuthentication, if it was commented form ”#PasswordAuthentication yes” then uncomment it and change yes into no</p><p>then press ctrl-x, then y and press enter</p><p>Now restart the server by</p><pre>Any one from these 2=&gt;<br><br>systemctl restart sshd <br>OR<br>service ssh restart</pre><p>Note: again if you don’t have root access then ask for sudo access and run</p><pre>Any one from these 2=&gt;<br><br>sudo systemctl restart sshd <br>OR<br>sudo service ssh restart</pre><p>==== Important note!</p><p>Password authentication is ENABLED by default (as of January 2024)</p><p>It means that even if you <strong>change </strong><strong>PasswordAuthentication no</strong> in /etc/ssh/sshd_config, <strong>your server might still allow password logins</strong> because of a <strong>different file</strong> that overrides your setting.</p><p>so the solution for this is</p><pre>nano /etc/ssh/sshd_config.d/50-cloud-init.conf<br><br>if you don&#39;t have root access then=&gt;<br><br>sudo nano /etc/ssh/sshd_config.d/50-cloud-init.conf</pre><p>Change:</p><pre>PasswordAuthentication yes<br><br>TO<br><br>PasswordAuthentication no</pre><p>Then save and restart SSH just like before ok</p><p>We MUST change the setting at this file from PasswordAuthentication( yes to no)</p><p>OR</p><p>another method is removing the file:</p><pre>rm /etc/ssh/sshd_config.d/50-cloud-init.conf<br>OR <br>sudo rm /etc/ssh/sshd_config.d/50-cloud-init.conf</pre><p>and restart SSH to disable password authentication</p><p>Now you can’t login into remote server from other devices or system, your server is only access from your computer as we already did passwordless authentication yesterday, so there is only one way to access to your remote server is only from your computer</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6a3db2e5da3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Access a Server via SSH and Set Up SSH Key for Passwordless Authentication]]></title>
            <link>https://medium.com/@sadansubedi/how-to-access-a-server-via-ssh-and-set-up-ssh-key-for-passwordless-authentication-5127c9f8b14b?source=rss-bc7fe91ee79a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5127c9f8b14b</guid>
            <category><![CDATA[linux-commands]]></category>
            <category><![CDATA[passwordless]]></category>
            <category><![CDATA[vps-hosting]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Sadansubedi]]></dc:creator>
            <pubDate>Thu, 08 May 2025 04:16:39 GMT</pubDate>
            <atom:updated>2025-05-08T04:16:39.387Z</atom:updated>
            <content:encoded><![CDATA[<p>Secure Shell (SSH) is a widely used protocol to remotely access and manage servers securely. However, when connecting to a server using SSH, you’re usually required to enter a password every single time. This can quickly become tedious, especially if you’re managing multiple servers.</p><p>To make the process seamless and more secure, you can set up <strong>SSH key-based authentication</strong>, allowing you to log in <strong>without typing your password</strong> each time.</p><p>In this guide, you’ll learn how to:</p><ul><li>Access a server via SSH</li><li>Generate SSH keys</li><li>Set up passwordless authentication</li><li>Copy SSH keys to your remote server (Windows &amp; Linux/macOS)</li></ul><p>🔐 Why Use SSH Key-Based Authentication?</p><p>Unlike password-based authentication, SSH keys provide stronger security and are less vulnerable to brute-force attacks. Once set up, you won’t need to enter your password every time you connect to the server — saving time and effort.</p><p>🧭 Step 1: Accessing the Server via SSH</p><p>Before setting up passwordless authentication, let’s understand how to access your server using SSH with a password.</p><pre>Syntax:- ssh -p PORT USERNAME@HOSTIP<br>Example:- ssh -p 21350 root@216.32.44.12</pre><p>You’ll be prompted to enter your password unless you’ve already configured SSH keys.</p><p>🛠️ Step 2: Generate SSH Keys (Run on Your Local Machine)</p><p>To set up passwordless login, first generate a pair of SSH keys (private and public) on your <strong>local computer (CMD)</strong> — Not on your remote server.</p><p>There are 2 ways, 1st one is default way and 2nd one is where do you want to put these keys on your computer, both are correct way so choose any one of them</p><p><strong>Command :</strong></p><p>1&gt;</p><pre>ssh-keygen -t rsa -b 4096 </pre><p>OR</p><p>2&gt;</p><pre>ssh-keygen -f C:\Users\YourUsername\.ssh\my_key -t rsa -b 4096</pre><p>This will generate two files:</p><ul><li>id_rsa (private key – keep it secure)</li><li>id_rsa.pub (public key – to be copied to the server)</li></ul><p>📤 Step 3: Copy Public Key to Remote Server</p><p>1. Make sure you have .ssh folder in remote server if not :-&gt;</p><pre><br>Syntax:- ssh -P PORT USERNAME@HOSTIP &quot;mkdir /home/USERNAME/.ssh&quot; (run it in windows cmd, not in remote server)<br>Example:- ssh -P 21350 u27653@216.32.44.12 &quot;mkdir /home/u27653/.ssh&quot;</pre><p>OR simple way is to create folder directly in S<strong>erver</strong> by running (mkdir .ssh) and then check that folder (.ssh) whether it is available or not by command (ls -a) after that</p><h4>2. Copy Public Key Using SCP</h4><p>Use scp to transfer your public key to the server:</p><p><strong>Syntax:</strong></p><p>Note: run it in your local computer <strong>cmd </strong>not in remote server</p><pre>scp -P PORT SSH_PUBLIC_KEY_PATH USERNAME@HOSTIP:/USERNAME/.ssh/authorized_keys</pre><p>for example:</p><pre><br>scp -P 21350 C:\Users\YourUsername\.ssh\id_rsa.pub u27653@216.32.44.12:/u27653/.ssh/authorized_keys</pre><p>Alternative way of Create file again naming (authorized_keys) directly on remote server by</p><pre>touch authorized_keys</pre><p>opening this file by</p><pre>nano authorized_keys</pre><p>paste the public key which is located in</p><pre>C:\Users\User name/.ssh/id_rsa.pub</pre><p>then press ctrl-x</p><h3>🧪 Final Step: Test Your Passwordless SSH Login</h3><p>Now that everything is set up, try logging into your server again:</p><pre>ssh -p 21350 u27653@216.32.44.12</pre><p>If all went well, you should no longer be prompted for a password. Doing these makes you to login into your remote server passwordless from your computer only but people can login into your remote server from another computer through the password just like before we use to do</p><p>if you want blog article on how to disable password login from any other computer but only login from our own computer, wait for it okay thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5127c9f8b14b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of error in javascript]]></title>
            <link>https://medium.com/@sadansubedi/types-of-error-in-javascript-8888e7ca8ce1?source=rss-bc7fe91ee79a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8888e7ca8ce1</guid>
            <dc:creator><![CDATA[Sadansubedi]]></dc:creator>
            <pubDate>Tue, 29 Apr 2025 05:09:02 GMT</pubDate>
            <atom:updated>2025-04-29T05:09:02.876Z</atom:updated>
            <content:encoded><![CDATA[<p>Types of error in javascript</p><h3>Syntax, logical and runtime errors</h3><p>By the end of this reading, you’ll be able to:</p><ul><li>Recognize common types of errors in JavaScript</li></ul><p>Here are some of the most common errors in JavaScript:</p><ul><li>ReferenceError</li><li>SyntaxError</li><li>TypeError</li><li>RangeError</li></ul><p>There are some other errors in JavaScript. These other errors include:</p><ul><li>AggregateError</li><li>Error</li><li>InternalError</li><li>URIError</li></ul><p>In this reading, I’ll focus on Reference, Syntax, Type, Range, and Logical errors.</p><h3>1 ReferenceError</h3><p>A ReferenceError gets thrown when, for example, one tries to use variables that haven’t been declared anywhere.</p><p>An example can be, say, attempting to console log a variable that doesn’t exist:</p><p>1&gt; console.log(username);</p><p>If the variable named username hasn’t been declared, the above line of code will result in the following output:</p><p>1 &gt;Uncaught ReferenceError: username is not defined</p><h3>2 SyntaxError</h3><p>Any kind of invalid JavaScript code will cause a SyntaxError.</p><p>For example:</p><p>2 &gt;var a “there’s no assignment operator here”;</p><p>The above line of code will throw the following error:</p><p>2&gt; Uncaught SyntaxError: Unexpected string</p><p>There’s an interesting caveat regarding the SyntaxError in JavaScript: it cannot be caught using the try-catch block.</p><h3>3 TypeError</h3><p>A TypeError occurs when a method is used on an incompatible data type.</p><p>A simple example is attempting to run the pop() method on a string:</p><p>3 “hello”.pop() // Uncaught TypeError: “hello”.pop is not a function</p><p>Strings, though array-like, do not support array methods such as pop(). This array-like behavior of strings was discussed in an earlier lesson in this course. However, strings lack many of the array methods, and attempting to use such methods on a string will result in a TypeError.</p><h3>4 RangeError</h3><p>A RangeError is thrown when we’re giving a value to a function, but that value is out of the allowed range of acceptable input values.</p><p>Here’s a simple example of converting an everyday <em>Base 10 </em>number (common decimal system) to a <em>Base 2 </em>number (binary number).</p><p>For example:</p><p>4 (10).toString(2);</p><p>// Converts the number 10 into its binary representation: ‘1010’</p><p>The value of 2 when passed to the toString() method, is like saying to JavaScript: <em>convert the value of</em> 10 <em>of the Base 10 number system, to its counterpart in the Base 2 number system</em>.</p><p>JavaScript obliges and <em>translates</em> the <em>regular</em> number 10 to its binary counterpart.</p><p>Besides using Base 2 number system, I can also use the Base 8, like this:</p><p>4 (10).toString(8); // 12</p><p>I get back the value 12, which is the plain number 10, written in <em>Base 8</em> number system.</p><p>However, if I try to use a non-existing number system, such as an imaginary <em>Base 100</em>, since this number system effectively doesn’t exist in JavaScript, I will get the RangeError, because a non-existing <em>Base 100</em> system is <strong>out of range</strong> of the number systems that are available to the toString() method:</p><p>(10).toString(100);</p><p>// Uncaught RangeError: toString() radix argument must be between 2 and 36</p><h3>5 Logical Errors</h3><p>Logical errors cause incorrect behavior in programs despite the absence of syntax or runtime errors.</p><p>function addNumbers(a, b) {</p><p>return a — b; // Logical error</p><p>}</p><p>console.log(addNumbers(5, 3));</p><p>// Output: 2 (Incorrect, expected: 8)</p><p>As a beginner, there are several logical errors that you may encounter and there are a few steps you can integrate in your practice over time such as:</p><ul><li><strong>Debug Using Breakpoints:</strong> Inspect variable values step-by-step. Breakpoints are a common feature available in most modern IDEs such as VS Code.</li><li><strong>Review Logic:</strong> Walk through the code to confirm it meets the intended functionality.</li><li><strong>Peer Review:</strong> Another perspective can reveal hidden issues.</li></ul><h3>6 Error Object Properties</h3><p>JavaScript errors are essentially objects with useful properties that are accessible.<strong> </strong>These include:</p><ol><li><strong>name</strong>: The type of error (e.g., TypeError, RangeError)</li><li><strong>message</strong>: A description of the error</li><li><strong>stack</strong>: A stack trace showing where the error occurred</li></ol><p>Let us look at an example:</p><p>try {</p><p>let a = b; // ReferenceError</p><p>} catch (error) {</p><p>console.log(error.name); // ReferenceError</p><p>console.log(error.message); // b is not defined</p><p>console.log(error.stack); // Stack trace</p><p>}</p><h3>Best Practices for Handling Errors</h3><ol><li><strong>Use Try-Catch Blocks:</strong> To handle predictable runtime errors gracefully</li><li><strong>Validate Inputs:</strong> Helps prevent invalid operations by checking inputs</li><li><strong>Use Specific Error Types:</strong> Throw custom errors where necessary, for clarity</li></ol><p>While these concepts will be familiar after regular practice, here is an example for demonstration of these best practices:</p><p>function divide(a, b) {</p><p>if (b === 0) {</p><p>throw new Error(“Division by zero is not allowed.”);</p><p>}</p><p>return a / b;</p><p>}</p><p>try {</p><p>console.log(divide(5, 0));</p><p>} catch (error) {</p><p>console.error(error.message); // Division by zero is not allowed.</p><p>}</p><h3>Distinguishing factors between Error Types</h3><p>Finally let us look at the distinguishing factors for Syntax, Logical, and Runtime Errors:</p><ul><li><strong>Syntax Errors:</strong> Prevent code execution due to invalid syntax</li><li><strong>Logical Errors:</strong> Allow execution but cause incorrect output</li><li><strong>Runtime Errors:</strong> Occur during execution and halt the program unless handled</li></ul><p>With this reading, you’ve learned about common JavaScript errors, how to identify them, and best practices for handling them effectively.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8888e7ca8ce1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[All about http protocol]]></title>
            <link>https://medium.com/@sadansubedi/all-about-http-protocol-4e538b6f1b28?source=rss-bc7fe91ee79a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e538b6f1b28</guid>
            <dc:creator><![CDATA[Sadansubedi]]></dc:creator>
            <pubDate>Thu, 24 Apr 2025 03:05:14 GMT</pubDate>
            <atom:updated>2025-04-24T03:05:14.097Z</atom:updated>
            <content:encoded><![CDATA[<p>HTTP is the communication protocol we use whenever we browse the web. HTTP stands for Hypertext Transfer Protocol. It is a protocol used for transferring web resources such as HTML documents, images, styles, and other files. HTTP is a request response based protocol. A web browser or client sends an HTTP request to a server and the web server sends the HTTP response back to the browser</p><p>. An HTTP requests consists of a method, path, version and headers. The HTTP method describes the type of action that the client must performed. The primary or the most commonly used HTTP methods are, GET, POST, PUT, and DELETE. The GET method is used to retrieve information from the given server. The POST request is used to send data to the server. The PUT method updates whatever currently exists on the web server with something else. The DELETE method removes the resource. The path is the representation of where the resource is stored on the web server, for example if I wanted to request an image from a page in a website, then the URL in the address bar would need to contain the full path to that particular file on the web server, such as example dot com, forward slash images, forward slash image dot jpg.</p><p>There are multiple versions of the HTTP protocol. I won’t explore these right now, but I want you to be aware that Versions 1.1 and 2.0 are the most used. Finally, there are the headers. Headers contain additional information about the request and the client that is making the request. For certain requests methods, the request will also contain a body of content that the client is sending.</p><p>HTTP responses follow a format similar to the request format. Following the header, the response will optionally contain a message body consisting of the response contents such as the HTML document, the image file and so forth.</p><p>HTTP status codes contained within the header indicate if the HTTP request successfully completed. The code values are in the range of 100–599 and are grouped by purpose. The status message is a text representation of the status code. During your web browsing, have you ever encountered pages that display 404 error not found or 500 errors? Server is not responding. These are HTTP status codes. I want to briefly explain to you about the status codes and their grouping. There are five groups of status codes. They are grouped by the first digit of the error number. Informational is grouped 100–199.</p><p>Successful responses are grouped from 200–299. Redirection message are 300–399. Client error responses range from 400–499, and server error responses are 500–599. Information responses are provisional responses sent by the server. These responses are interim before the actual response. The most common information response is 100 continue, which indicates that the web client should continue to request or ignore the response if the request is already finished. Successful responses indicate that the request was successfully processed by the web server, with the most common success response being 200 OK. You’re receiving these responses every day when you receive content successfully from a website. The meaning of OK, depends on the HTTP method. If the method is GET, it means that the resource is found and is included in the body of the HTTP response. If it’s POST, it means that the resource was successfully transmitted to the web server and if it’s PUT, the resource was successfully transmitted to the web server. Finally, if the method is DELETE, it means the resource was deleted.</p><p>Redirection responses indicate to the web client that the requested resource has been moved to a different path. The most common response codes used are 301 moved permanently and 302 found. The difference between the redirection messages 301 and 302 is that 302 indicates a temporary redirection.The resource has been temporarily moved. When web browsers receive these responses, they will automatically submit the request for the resource at the new path. Client error responses indicate that the requests contained bad syntax or content and cannot be processed by the web server. The most common codes used are 400 is used when the web browser or client submitted bad data to the web server, 401 is used to indicate that the user must log into an account before the request can be processed, 403 is used to indicate the request was valid, but that the web server is refusing to process it. This is often used to indicate that a user does not have sufficient permissions to execute an action in a web application, 404 is used to indicate that the request resource was not found on the web server. Server error responses indicate that a failure occurred on the web server while trying to process the request. The most common code used is 500 internal server error, which is a generic error status indicating that the server failed to process the request.</p><p>Now, have you ever bought something online and needed to enter your credit card information? You wouldn’t want someone else to get this information from the HTTP request. This is where HTTPS is involved. HTTPS is the secure version of HTTP. It is used for secure communication between two computers so that nobody else can see the information being sent and received. It does this by using something called encryption. We won’t cover encryption right now. Like in HTTP, the requests and responses still behave in the same way and have the same content. The big difference is that before the content is sent, it is turned into a secret code. Only the other computer can turn the secret code back into its original content. If someone else was to look at the code, it wouldn’t be understandable.You use HTTPS every day. This is the lock icon you see beside the URL in your web browser.</p><p>Before I finish, I want to leave you with a brief summary of HTTP. Firstly, it is a protocol used by web clients and web servers. It works to transfer web resources such as HTML files, and is the foundation of any data exchanges on the web. Also, remember that by using HTTPS, we send the information securely. Requests are sent by the client, usually a web browser, and the server replies with responses which may be the return of an image or an HTML page. HTTPS requests have a syntax that includes method, path, versions and headers. HTTP responses follow a similar format to the request. HTTP status codes indicate whether the HTTP requests successfully completed. The status code is a three-digit number that corresponds with groups representing different types of results. Well, now you know how the HTTP protocol request and response cycle works.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e538b6f1b28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[why you should have habit of writing blog]]></title>
            <link>https://medium.com/@sadansubedi/why-you-should-have-habit-of-writing-blog-a6ee1c529ecc?source=rss-bc7fe91ee79a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6ee1c529ecc</guid>
            <dc:creator><![CDATA[Sadansubedi]]></dc:creator>
            <pubDate>Mon, 13 May 2024 13:20:14 GMT</pubDate>
            <atom:updated>2024-05-13T13:20:14.716Z</atom:updated>
            <content:encoded><![CDATA[<p>Developing a habit of writing a blog can offer numerous benefits, both personally and professionally:</p><p>1. **Enhances Communication Skills**: Regularly writing helps you articulate thoughts more effectively. You learn to express complex ideas clearly and concisely, which is a valuable skill in any field.</p><p>2. **Builds Authority and Credibility**: Sharing your knowledge and expertise through blogging establishes you as an authority in your niche. Over time, this can lead to increased credibility and trust among your audience.</p><p>3. **Expands Network**: Blogging allows you to connect with like-minded individuals, influencers, and professionals in your industry. It opens doors for collaborations, partnerships, and networking opportunities.</p><p>4. **Boosts Creativity**: Consistently coming up with new ideas for blog posts challenges your creativity and encourages you to think outside the box. It helps you develop a creative mindset that can be applied to other aspects of your life and work.</p><p>5. **Improves Critical Thinking**: Writing blog posts often involves researching and analyzing information to present a well-informed perspective. This process enhances your critical thinking even more</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6ee1c529ecc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>