<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Fishon Amos</title>
    <description>The latest articles on DEV Community by Fishon Amos (@fishonamos).</description>
    <link>https://dev.to/fishonamos</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1013422%2F98078c91-ef39-42a8-b650-d35c4e94dd5b.png</url>
      <title>DEV Community: Fishon Amos</title>
      <link>https://dev.to/fishonamos</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fishonamos"/>
    <language>en</language>
    <item>
      <title>Managing Packages with NPM: How to use the package JSON file</title>
      <dc:creator>Fishon Amos</dc:creator>
      <pubDate>Tue, 17 Jan 2023 12:58:51 +0000</pubDate>
      <link>https://dev.to/fishonamos/managing-packages-with-npm-how-to-use-the-package-json-file-3mpo</link>
      <guid>https://dev.to/fishonamos/managing-packages-with-npm-how-to-use-the-package-json-file-3mpo</guid>
      <description>&lt;p&gt;Managing packages is a major aspect of the backend development process because it allows you to keep track of your software, update it, and upgrade them where necessary. For Node, we used NPM (node package manager) to manage packages and libraries which your node applications need to run successfully.&lt;/p&gt;

&lt;p&gt;In this tutorial, we will learn how to use a Package.Json file.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How to use Package JSON&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Package.JSON is the most important part of any Node.js project because it contains important specifications and requirements for your program.&lt;/p&gt;

&lt;p&gt;Just as the human brain serves as the control center of the body, package.json functions in the same way by acting as the control point of your node projects. A simple package.json file will look like the one below.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;name: New project,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;version: 1.0.0,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;description: A simple Node.js project,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;},&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dependencies: {&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Express: ^4.18.2,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;},&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;devDependencies: {&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mocha: ^10.2.0,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;chai: ^4.3.7&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;},&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;author: FishonsNote,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;license: MIT&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;}&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Understanding key components of a Package.Json File&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Package.json has some key components. We will explain all of them below in order of importance.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Dependencies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Dependencies form the most essential components of your package.Json file. We can compare dependencies to recipes used to make cakes. To bake a cake, you need flour, sugar, and an egg.&lt;/p&gt;

&lt;p&gt;So all also for your node project to work, you must specify and use essential dependencies. For example, if you are building an application using an express framework, you must specify the express package as a dependency if not your web app with not work.&lt;/p&gt;

&lt;p&gt;Dependencies are codes that your project references when it is running. If these codes are missing or outdated, your product is bound to have issues.&lt;/p&gt;

&lt;p&gt;The code below shows how to specify a dependency.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dependencies: {&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Express: ~4.18.2,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The first item specifies the name of the dependency, while the second item specifies the version of the dependency. Make sure you install and use the latest versions of each dependency to avoid issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Dependency versions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Dependency versioning is managing versions of packages or libraries that node.js projects references during runtime. The package.json file is where all packages in versioned using the format major, minor, and patch formats.&lt;/p&gt;

&lt;p&gt;From your package.json file, you can specify the specific updates type your package can receive. Let us specify a package version range up to 1.0.3 below.&lt;/p&gt;

&lt;p&gt;Patch: &lt;code&gt;1.0 or 1.0.x or ~1.0.3:&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Minor update: &lt;code&gt;1 or 1. x or ^1.0.3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Major updates: &lt;code&gt;* or x&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;DevDependencies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Not all dependencies are shipped to production. That is what dev dependencies are. Because devdependecies simply help programmers to test and execute programs locally, they are not needed in the final product. Devdependencies are listed in a separate section in the package.json file.&lt;/p&gt;

&lt;p&gt;One of the most popular devdependencies used in many node projects is the webpack. Webpack helps in bundling node files together so they can run efficiently in a browser. However, it is not useful post-production and is mostly discarded after the project is shipped.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Other components of a package.json&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Version&lt;/strong&gt; : Each update either major, minor, or patch upgrades your project version level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author&lt;/strong&gt; : This is the owner of the project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;License:&lt;/strong&gt; This refers to the type of project license. The most popular type is the MIT open license.&lt;/p&gt;

&lt;p&gt;In conclusion, package.json represents the core of any node application. Therefore, understanding how to manage this package.json is an essential skill required to create and deploy successful applications.&lt;/p&gt;

</description>
      <category>learning</category>
      <category>career</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Common beginner Python errors (and how to fix them)</title>
      <dc:creator>Fishon Amos</dc:creator>
      <pubDate>Fri, 06 Jan 2023 09:29:08 +0000</pubDate>
      <link>https://dev.to/fishonamos/common-beginner-python-errors-and-how-to-fix-them-3oan</link>
      <guid>https://dev.to/fishonamos/common-beginner-python-errors-and-how-to-fix-them-3oan</guid>
      <description>&lt;p&gt;Python is a popular language known for its simplicity and ease of use, which makes it a great choice for beginners. However, self-taught Python learners may encounter certain errors that can be frustrating.&lt;/p&gt;

&lt;p&gt;Below, I have compiled some common errors that Python learners may encounter and ways to overcome them.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Not getting any error as well as an output&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This is one of the most common errors Python users face. However, not all code is written to produce an output. If you simply define a variable or function, your code will not produce any output.&lt;/p&gt;

&lt;p&gt;For example, if you write and run the following code:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;#Definining a variable with pythonname = 'Fishon Amos'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;The code name = 'Fishon Amos' simply assigns the string 'Fishon Amos' to the variable name. It will not produce any output unless you add the &lt;strong&gt;print&lt;/strong&gt; () function as you can see below:&lt;/p&gt;

&lt;h1&gt;
  
  
  Definining a variable with python
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;name = 'Fishon Amos'&lt;/code&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;print(name)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;|&lt;br&gt;
| &lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;To produce output from your code, you will need to use statements like &lt;strong&gt;print&lt;/strong&gt; or &lt;strong&gt;return&lt;/strong&gt; to display or return the result of your code.&lt;/p&gt;

&lt;p&gt;Aside from checking that the appropriate function is called, check your code for syntax errors, and ensure that all necessary libraries and dependencies are installed.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. Maximum recursion exceeded error&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This error happens mostly when you try to execute factorials and large numbers. In Python, the recursion limit is the maximum depth of the recursive calls allowed in the interpreter. If a recursive function calls itself too many times, it can exceed the recursion limit (&amp;lt;1000) and raise a Recursion error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh4.googleusercontent.com%2FwyLoCCjkNNB7oebCuh9fudVJAyEdLWJWHekV_rmPvqOsKQd9pEfOWqQ2CnbNebYfEux6gt4XXh1BSN7cZHv3XLuVRn27Eewmr5Pfh31C9ferjZdd_MFK3eaMW5i_WfNWNa79nCybCcg8RRi74Dx9kUfTeX3suMdauf7cydGYgm4xs04KH3gR1hsFI_bVdg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh4.googleusercontent.com%2FwyLoCCjkNNB7oebCuh9fudVJAyEdLWJWHekV_rmPvqOsKQd9pEfOWqQ2CnbNebYfEux6gt4XXh1BSN7cZHv3XLuVRn27Eewmr5Pfh31C9ferjZdd_MFK3eaMW5i_WfNWNa79nCybCcg8RRi74Dx9kUfTeX3suMdauf7cydGYgm4xs04KH3gR1hsFI_bVdg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To handle this error, you can add the &lt;strong&gt;try-except&lt;/strong&gt; block in your code to catch the &lt;strong&gt;Recursion Error&lt;/strong&gt; and provide a fallback solution. For example:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;try: # code that may exceed the recursion limitexcept RecursionError: # fallback solution&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Assignment and equality operators error&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This is one type of error that most python programmers face regardless of their level of experience. Because of how similar these two operators are, programmers tend to use them wrongly in their programs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The assignment operators&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
In the code below, an equality operator (==) was used instead of an assignment operator (=) to define the variable age and it returned a &lt;strong&gt;Name Error&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;#Using an equality operator to define a variable will return a name error.age == 12&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;To fix the error above, use only one (=) to define the age variable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh4.googleusercontent.com%2FDrT3-CZQ_sfq3VVLnv8XrxrrkAvdm6T6GeOqhrMZvv3_OMcYkkRKmLN7XP7uGDfs1I1GSNrMw2jhrBr5waZFSXYCFwW7rpch6nTfSZd9sWLAxVHp70sZphiIgKNRK2FoSlsDRrfD_R1f22pMz1O_JrnxSDSVjCAiK-0w9BH4lA1coQ20ztFsR6mc61rNmw" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh4.googleusercontent.com%2FDrT3-CZQ_sfq3VVLnv8XrxrrkAvdm6T6GeOqhrMZvv3_OMcYkkRKmLN7XP7uGDfs1I1GSNrMw2jhrBr5waZFSXYCFwW7rpch6nTfSZd9sWLAxVHp70sZphiIgKNRK2FoSlsDRrfD_R1f22pMz1O_JrnxSDSVjCAiK-0w9BH4lA1coQ20ztFsR6mc61rNmw" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The variable age should now print correctly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Equality Operator&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can use the equality operator (==) to check if two values are equal. For example,&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;x = 5y = 5z = 6print(x == y) # Trueprint(x == z) # False&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;|&lt;/p&gt;

&lt;p&gt;The above code will display output as shown in the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FIgLZ5PeSE3xexJ7G4n6KeDzQL4nVj59vj5pEh2qinoJxgc_p_D4GJVRi-d1LHGN1yoHqTKGcoMe5uG2-131uhzMJgUdYEYsByuLvPol_JmRd7ZRVUvIlD6ZzMgvFDgYfKKrXSqu1Z9vY32rS70RdPC-bRqV5mwRFhV1VZrOjjPCSX_TnKRCXc7iSBZxSZg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FIgLZ5PeSE3xexJ7G4n6KeDzQL4nVj59vj5pEh2qinoJxgc_p_D4GJVRi-d1LHGN1yoHqTKGcoMe5uG2-131uhzMJgUdYEYsByuLvPol_JmRd7ZRVUvIlD6ZzMgvFDgYfKKrXSqu1Z9vY32rS70RdPC-bRqV5mwRFhV1VZrOjjPCSX_TnKRCXc7iSBZxSZg" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, if you use an assignment operator, your code will return a &lt;strong&gt;Type error&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh5.googleusercontent.com%2FpdDHkAcsP0kMwlD1AFK140LYVCwACQq1WAlXtcwQAEsNRPM5rBwM8tbgpB-RX3k2QzNMFeZF5uYktiY4eULKZbKfQIuO95KARq9WTrRXUH9prNoB_2opn-iLuexNpTiEsvbpGpHxsPQ1f10F0zqpy9DwJA32sZO4NFh8asyLVYq3ClJ84gpE5x481lbNOw" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh5.googleusercontent.com%2FpdDHkAcsP0kMwlD1AFK140LYVCwACQq1WAlXtcwQAEsNRPM5rBwM8tbgpB-RX3k2QzNMFeZF5uYktiY4eULKZbKfQIuO95KARq9WTrRXUH9prNoB_2opn-iLuexNpTiEsvbpGpHxsPQ1f10F0zqpy9DwJA32sZO4NFh8asyLVYq3ClJ84gpE5x481lbNOw" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is important to know that these types of errors are small but sometimes difficult to spot, especially if you are dealing with large lines of code.&lt;/p&gt;

&lt;p&gt;Therefore, it is important to check your code properly because the errors identified above are common, especially for beginners.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Errors are a natural part of the coding process&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While we strive to ensure our code is error-free, we must acknowledge that encountering errors is a natural part of the programming process which helps us to improve our skills and become more proficient.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
