<?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>Forem: Haider Ali</title>
    <description>The latest articles on Forem by Haider Ali (@haider__ali).</description>
    <link>https://forem.com/haider__ali</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%2F515785%2F9c551fdb-727a-44ec-b50c-3dc3f74ec78f.jpeg</url>
      <title>Forem: Haider Ali</title>
      <link>https://forem.com/haider__ali</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/haider__ali"/>
    <language>en</language>
    <item>
      <title>Why should you learn Rust?</title>
      <dc:creator>Haider Ali</dc:creator>
      <pubDate>Wed, 02 Mar 2022 20:53:47 +0000</pubDate>
      <link>https://forem.com/haider__ali/why-should-you-learn-rust-1pdg</link>
      <guid>https://forem.com/haider__ali/why-should-you-learn-rust-1pdg</guid>
      <description>&lt;p&gt;First of all if you think I'm talking about "crypto" here then this is not the place. I'm not a "crypto guy" and Rust is not made for blockchain stuff.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fast
&lt;/h3&gt;

&lt;p&gt;Do you program in Python? Maybe JavaScript? but you need something which is faster and efficient. Well Rust is here, it compiles code fast and creates a single system binary.&lt;/p&gt;

&lt;h3&gt;
  
  
  Memory Model
&lt;/h3&gt;

&lt;p&gt;The fun part, Rust is memory safe unlike C/C++. Rust has a memory called "Ownership" each variable created in a function is owned by that function and if it passed onto another function (without the &lt;code&gt;&amp;amp;&lt;/code&gt;) the ownership is transferred to that function. After the execution of that function (to one which we passed the variable) the "variable" is destroyed or no longer available to use again. To prevent transferring ownership and reusing that specific variable we use borrowing. Lets demonstrate using an real example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;print_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"{}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;print_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// error here because the ownership is transferred to `print_value`&lt;/span&gt;
    &lt;span class="nf"&gt;print_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now with borrowing, first we need to tell the function that we are gonna borrow this &lt;code&gt;type&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// &amp;amp;i32 -&amp;gt; in the function construction tells the function that this is going to be borrowed&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;print_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;i32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"{}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;print_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// no error because `main` function still has the ownership&lt;/span&gt;
    &lt;span class="nf"&gt;print_value&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;print_value(&amp;amp;age)&lt;/code&gt; means we are borrowing &lt;code&gt;&amp;amp;age&lt;/code&gt;, alright now lets move forward.&lt;/p&gt;

&lt;h3&gt;
  
  
  Type Safety
&lt;/h3&gt;

&lt;p&gt;Rust is type safe too. &lt;br&gt;
&lt;a href="https://i.giphy.com/media/3ohzdIuqJoo8QdKlnW/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3ohzdIuqJoo8QdKlnW/giphy.gif" alt="rust is awesome" width="498" height="230"&gt;&lt;/a&gt;&lt;br&gt;
Means not all those stupid errors that JavaScript or Python gives you LOL.&lt;/p&gt;

&lt;p&gt;You make &lt;code&gt;Data Structures&lt;/code&gt; in Rust with the &lt;code&gt;struct&lt;/code&gt; keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// error here you cant put anything you want&lt;/span&gt;
  &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;user_1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Haider"&lt;/span&gt;&lt;span class="nf"&gt;.to_owned&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="c1"&gt;// ✔️ correct way to do&lt;/span&gt;
  &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;user_1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Haider"&lt;/span&gt;&lt;span class="nf"&gt;.to_owned&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;99&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;### Is Rust high level or low level?&lt;/p&gt;

&lt;p&gt;Rust is a high level language but also provides features of a low level language. Cool right? It also works on OS systems like Windows, Linux and mac.&lt;/p&gt;

&lt;h3&gt;
  
  
  Operating System Support
&lt;/h3&gt;

&lt;p&gt;Rust also works on Raspberry Pi and Arduino here are two videos which will explain how to run rust on them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://youtu.be/Yi0WRF5WPFw"&gt;Rust Runs on Everything, Including the Raspberry Pi Pico | Adventures in Embedded Rust Programming
&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/ZPSqhb4KKNc"&gt;Rust Runs on EVERYTHING, Including the Arduino | Adventures in Embedded Rust Programming&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Great package manager and build tool
&lt;/h3&gt;

&lt;p&gt;Rust has a package manager called "cargo" and it is also its build tool. If you don't know what is a build tool, it simply compiles the code into binary runs and if you want you generate a production binary.&lt;/p&gt;

&lt;p&gt;For production build:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;cargo build —-release 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;For running code (and which is also a development build)&lt;br&gt;
&lt;code&gt;&lt;/code&gt;&lt;code&gt;bash&lt;br&gt;
$ cargo run&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
Let's about package management,like npm rust also has a website which lists all the &lt;code&gt;crates&lt;/code&gt; (which simply means a package but in rust we call it a crate &lt;a href="https://crates.io"&gt;crates.io&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Great for Web Development
&lt;/h3&gt;

&lt;p&gt;I love Rust, its soo good for web development. Crates like &lt;code&gt;actix&lt;/code&gt; and &lt;code&gt;rocket&lt;/code&gt;(which is not maintained now).&lt;/p&gt;

&lt;p&gt;You don't have worry about someone sending the wrong data, the type system will handle it, everything is fast (as I mentioned Rust is fast). I created some apis from which some are listed on my github and some private. Once you learn Rust you should try making api with it. In fact some developers made created crate with which you can make Frontend UIs with Rust, its called &lt;code&gt;Yew&lt;/code&gt; &lt;a href="https://yew.rs/"&gt;Yew's Docs&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Others things with Rust
&lt;/h3&gt;

&lt;p&gt;Rust is also used for game development, embedded systems, writing interpreters and much more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://wiki.mozilla.org/Areweyet"&gt;AreWeYet?&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources to learn Rust
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://academy.zerotomastery.io/p/learn-rust"&gt;Zero To Mastery: Rust Programming: The Complete Developer's Guide&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://doc.rust-lang.org/book/"&gt;Rust Book&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are the two best resources in my opinion. &lt;/p&gt;

&lt;p&gt;Thank you if you read the whole blog post in return I want to you subscribe me on my Youtube and also drop me a follow on Twitter and Dev.to.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCuP62HBRH9h5ROEP6ciCA4w"&gt;Youtube&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/Haider_Ali__Dev"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>rust</category>
      <category>programming</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Want to learn Rust Programming Language </title>
      <dc:creator>Haider Ali</dc:creator>
      <pubDate>Mon, 03 Jan 2022 01:33:58 +0000</pubDate>
      <link>https://forem.com/haider__ali/want-to-learn-rust-programming-language-2kjk</link>
      <guid>https://forem.com/haider__ali/want-to-learn-rust-programming-language-2kjk</guid>
      <description>&lt;p&gt;Hey if you want to learn &lt;strong&gt;Rust Programming Language&lt;/strong&gt; I will be making a series of Rust videos on my YouTube channel you can ask me anything in comments if you have any doubts and I will surely reply. I want everyone to know this great language. I’m planning to make some projects for the course too. We will be using rocket framework for making an web api. We will use image crate for image manipulation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/l7rbqL20evY"&gt;&lt;strong&gt;CLICK HERE TO GET STARTED&lt;/strong&gt;&lt;/a&gt; &lt;/p&gt;

</description>
      <category>rust</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Setup your python package within seconds</title>
      <dc:creator>Haider Ali</dc:creator>
      <pubDate>Fri, 19 Nov 2021 18:27:48 +0000</pubDate>
      <link>https://forem.com/haider__ali/setup-your-python-package-within-seconds-11aj</link>
      <guid>https://forem.com/haider__ali/setup-your-python-package-within-seconds-11aj</guid>
      <description>&lt;p&gt;Hello, today I'm going to tell you about a new project/package that I made related to python packages or pypi packages. Before we deep dive I really want y'all to drop a follow on Twitter &lt;a href="https://twitter.com/Haider_Ali999"&gt;Twitter Profile&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So many of you while making a python package have suffered the pain of setting up the files and folders. Well not anymore I made a "Open Source" project called "create-pypi-project" what this does is makes creates a folder and creates all the file needed for a pypi package. Not only the files and folders, it also sets their content, no need to go to google and suffer the pain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lets get started&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install create-pypi-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;createpypiproject --name helloworld --author Haider
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--name&lt;/code&gt; will the name the folder and also name the package so its required&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--author&lt;/code&gt; is also required because it is necessary who published the package.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Remember to change the details in setup.cfg, like the github repo, author_email and etc&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Soon we will add option in which you can static or dynamic way of setup files&lt;/p&gt;

&lt;p&gt;Now you will something like this in your terminal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hey Pythoneer or Pythonista, are you sure you want to name your project helloworld [y/N]: y
Started creating a Pypi project helloworld
Made a directory named helloworld
Created project.toml
Created setup.cfg
Created README.md
Created LICENSE file with defualt license
You can choose a different license from https://choosealicense.com/
Sucessfully created Pypi project: helloworld
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Done, this took like 2 or 3 seconds and your project is ready to be developed.&lt;/p&gt;

&lt;p&gt;Now you use this anytime you're wanting create a new package :)&lt;/p&gt;

&lt;p&gt;Here is the &lt;a href="https://github.com/Haider-Ali-Dev/create-pypi-project"&gt;GitHub Repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the package link &lt;a href="https://pypi.org/project/create-pypi-project/"&gt;create-pypi-project&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure to follow me on Twitter :) &lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>opensource</category>
    </item>
    <item>
      <title>New Feature in Python 3.10</title>
      <dc:creator>Haider Ali</dc:creator>
      <pubDate>Fri, 01 Oct 2021 22:13:21 +0000</pubDate>
      <link>https://forem.com/haider__ali/new-feature-in-python-3-10-4371</link>
      <guid>https://forem.com/haider__ali/new-feature-in-python-3-10-4371</guid>
      <description>&lt;p&gt;Python 3.10 will be released on 4 October 2021, there is a new feature &lt;code&gt;match&lt;/code&gt; do you know JavaScript, you know how &lt;code&gt;switch&lt;/code&gt; works the no need to worry it works same as that but if you don't here are some examples.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'python'&lt;/span&gt;
&lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="s"&gt;'java'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Java'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;case&lt;/span&gt; &lt;span class="s"&gt;'python'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Python'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works like a &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;elif&lt;/code&gt;, and &lt;code&gt;else&lt;/code&gt; together&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Tired of finding api on google?</title>
      <dc:creator>Haider Ali</dc:creator>
      <pubDate>Tue, 21 Sep 2021 09:40:16 +0000</pubDate>
      <link>https://forem.com/haider__ali/tired-of-finding-apis-on-google-2gbd</link>
      <guid>https://forem.com/haider__ali/tired-of-finding-apis-on-google-2gbd</guid>
      <description>&lt;p&gt;I know its very hard to find apis, it takes ages to search for a good api. Well &lt;a href="https://www.npmjs.com/package/apiwrappers.js"&gt;apiwrappers.js&lt;/a&gt; got your back, the developers of &lt;code&gt;apiwrappers.js&lt;/code&gt; are finding the best apis on the net, making useful functions out of them and now they published this package, which is open source. In what why can this help you?&lt;/p&gt;

&lt;p&gt;When they're first version came, they made functions which used promises for example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;randomfunc&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Suppose &lt;code&gt;randomfunc&lt;/code&gt; is an api wrapper function which gives you some random jokes, so the problem with promises were that you have to use &lt;code&gt;.then&lt;/code&gt; or if you use &lt;code&gt;Aysnc/Await&lt;/code&gt;, it would be same like you do a fetch request so what they did is now they made functions which work asynchronous and they take a &lt;code&gt;callback&lt;/code&gt; function. Well this has not been applied to all functions only, two of the apis are using this because they wanted to know how the community responds to them, whether they like it or not. We today will show you some of the very good apis they have wrapped. Lets get started&lt;/p&gt;

&lt;p&gt;Before we see some examples, here is the list of apis they have wrapped:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chuck Norris API&lt;/li&gt;
&lt;li&gt;Animal API (Cats, Dogs, Fox and etc)&lt;/li&gt;
&lt;li&gt;Apple API&lt;/li&gt;
&lt;li&gt;DadJoke API&lt;/li&gt;
&lt;li&gt;Oxford API (One of the best ones, used by Google)&lt;/li&gt;
&lt;li&gt;Meme API&lt;/li&gt;
&lt;li&gt;Urban Dictionary&lt;/li&gt;
&lt;li&gt;Currency Converter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step One, install the package:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install apiwrappers.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step Two, import it using ES6&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;nameOfTheFunction&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apiwrappers.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok now lets get started with examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getChuckNorrisJoke&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apiwrappers.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="nx"&gt;getChuckNorrisJoke&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again I'm saying, they will soon replace all of the functions from promises to callbacks in the next major update.&lt;/p&gt;

&lt;p&gt;ChuckNorris api hmm nice, now lets see the Oxford:&lt;br&gt;
First of all get your Oxford api key from &lt;a href="https://developer.oxforddictionaries.com/"&gt;https://developer.oxforddictionaries.com/&lt;/a&gt; and then come back to test the example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Oxford&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apiwrappers.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;api&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Oxford&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;appId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;appKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en-gb&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getWordDefination&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;people&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wow, I just got the definition of the word &lt;code&gt;people&lt;/code&gt;, this is cool. Right?&lt;/p&gt;

&lt;p&gt;Well here is some of the examples of &lt;code&gt;apiwrappers.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I'll some of the important links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.npmjs.com/package/apiwrappers.js"&gt;apiwrappers.js&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/MakeJavaScriptEasy/apiwrappers.js"&gt;Github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>api</category>
      <category>npm</category>
    </item>
    <item>
      <title>Python File I/O Now Easier</title>
      <dc:creator>Haider Ali</dc:creator>
      <pubDate>Mon, 20 Sep 2021 12:06:59 +0000</pubDate>
      <link>https://forem.com/haider__ali/python-file-i-o-now-easier-1efd</link>
      <guid>https://forem.com/haider__ali/python-file-i-o-now-easier-1efd</guid>
      <description>&lt;p&gt;Are you tired of doing this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'main.txt'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'w'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;File Content
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Well &lt;a href="https://filehandling.netlify.app/index.html"&gt;EasyFileHandling&lt;/a&gt; solves the problem. Questions rising up in your mind.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How is this useful
Ok so first of all its Open Source, here is the &lt;a href="https://github.com/ProjectsWithPython/FileHandling"&gt;Github&lt;/a&gt; repo link. Its useful because its &lt;code&gt;object oriented&lt;/code&gt;, it has good documentation, lets you do soo much with file. You manipulate images with &lt;em&gt;ImageHandler&lt;/em&gt;, you can edit, write, and much more with the &lt;em&gt;FileHandler&lt;/em&gt;, you also use &lt;em&gt;JsonHandler&lt;/em&gt; for &lt;em&gt;JSON&lt;/em&gt; files and &lt;em&gt;AsyncFileHandler&lt;/em&gt; for async File I/O tasks. All these handlers are classes. Too much talks lets see some examples.
Run:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install EasyFileHandling
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://pypi.org/project/EasyFileHandling/"&gt;Package Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FileHandler&lt;/strong&gt;&lt;br&gt;
We have file named &lt;em&gt;main.txt&lt;/em&gt; which has this in it:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Hello World! I like Files LOL&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Magic Time&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;EasyFileHandling.main&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FileHandler&lt;/span&gt; 
&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FileHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"main.txt"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;what_type_of_file&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;change_file_extension&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'.txt'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'.js'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me explain what it did, firstly it told told you what type of file &lt;em&gt;.txt == Text&lt;/em&gt;. Get it I hope so then we told it to change the extension from &lt;em&gt;.txt&lt;/em&gt; to &lt;em&gt;.js&lt;/em&gt;.&lt;br&gt;
You saw how great it is?&lt;/p&gt;

&lt;p&gt;One more thing to show rest you find by yourself :)&lt;br&gt;
Sometimes you want to do simple tasks but reading documentation is frustrating. You wanna add filter to an image or add text to it. We have simplified &lt;em&gt;PILLOW&lt;/em&gt; library for you.&lt;br&gt;
Need some Blur?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;EasyFileHandling.imagehandler&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ImageHandler&lt;/span&gt;
&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ImageHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'robot.png'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter_image&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'blur'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No need to save the image like you did in &lt;code&gt;PILLOW&lt;/code&gt; library. Just press run and it will create a folder automatically and save this file to it.&lt;/p&gt;

&lt;p&gt;Well this was the magic of &lt;code&gt;EasyFileHandling&lt;/code&gt;, Open Source and Easy&lt;/p&gt;

&lt;p&gt;One last thing do you know that &lt;code&gt;EasyFileHandling&lt;/code&gt; developers are making &lt;code&gt;easyfilehandling.js&lt;/code&gt; for npm. Its out &lt;a href="https://www.npmjs.com/package/easyfilehandler.js"&gt;NPM&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important Link&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/ProjectsWithPython/FileHandling"&gt;Github Repo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pypi.org/project/EasyFileHandling/"&gt;EasyFileHandling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/easyfilehandler.js"&gt;easyfilehandling.js&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>file</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
