<?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 Muhammad Ullah on Medium]]></title>
        <description><![CDATA[Stories by Muhammad Ullah on Medium]]></description>
        <link>https://medium.com/@muhammadhullah23?source=rss-b0bdd18eb8b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fD_lFMWrldweyo8WmIgSyg.jpeg</url>
            <title>Stories by Muhammad Ullah on Medium</title>
            <link>https://medium.com/@muhammadhullah23?source=rss-b0bdd18eb8b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 01:34:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@muhammadhullah23/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[My Philosophy on Pride]]></title>
            <link>https://muhammadhullah23.medium.com/my-philosophy-on-pride-72957df9aedd?source=rss-b0bdd18eb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/72957df9aedd</guid>
            <category><![CDATA[pride]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[deep-thoughts]]></category>
            <category><![CDATA[debate]]></category>
            <dc:creator><![CDATA[Muhammad Ullah]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 00:57:48 GMT</pubDate>
            <atom:updated>2026-10-27T00:57:48.711Z</atom:updated>
            <content:encoded><![CDATA[<p>First we must define pride. To me pride is the self-confidence in oneself based on who they are and their achievements. That is the definition we will use.</p><p>A person’s pride should only come from truths of yourself. To take pride in oneself, you must first know yourself. A person cannot take pride in what they are not. For example, I train Brazilian Jiu Jitsu and I am questionable blue belt that trains only twice a week. The two days that I do train, I give it my absolution all to to get better and be the best that I can be. I take pride in that because it is the truth. I want to beat my opponent, but I cannot take pride in claiming that I could beat him because it is not certain. But the pride I take in my training gives me the confidence I need to still stand against my opponent. If I do take false pride in that I could beat them, but end up losing then it will only leave a residue of shame. Uncle Iroh said, “Pride is not the opposite of shame, but its source. True humility is the anecdote to shame”. False pride leads you to shame in which humility will teach you to let go of the false pride.</p><p>I want to tackle the second portion of my definition of pride in achievements. When you accomplish something like winning a game or getting a promotion then you can take pride in it because it is the truth. But, the achievements only happen in the moment and it comes to an end. So, the pride can only last as long as the moment does then you move on. The moment becomes history and you must leave your pride their too.</p><p>I am not proud because I think I am the best. I am proud because I work to to be the best that I can be.</p><p>*I want to note that my philosophy on pride is ongoing as I learn through living.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72957df9aedd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Workout Plan React Project]]></title>
            <link>https://muhammadhullah23.medium.com/workout-plan-react-project-e355892c84b7?source=rss-b0bdd18eb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e355892c84b7</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <dc:creator><![CDATA[Muhammad Ullah]]></dc:creator>
            <pubDate>Mon, 13 Dec 2021 03:28:50 GMT</pubDate>
            <atom:updated>2021-12-13T03:28:50.752Z</atom:updated>
            <content:encoded><![CDATA[<p>For my Phase 5 React project, I decided to create (if you haven’t guessed already) an app where a user gets to create a work plan and exercises for the workout plan. For my backend, I am using a Rails API to persist my data using the PostgreSQL database. For my frontend, I am using Javascript with the React library with Redux and redux-thunk middleware to modify state change and makes use of Hooks.</p><h3>Requirements</h3><p>the requirements for this project are to use thecreate-react-app generator to start the project, render one HTML page, have 5 stateless components, have 4 routes, make use of react-router and proper RESTful routing, use Redux middleware to respond to and modify state change, make use of async actions and redux-thunk middleware to send data to and receive data from a server, client-side application should handle the display of data with minimal data manipulation, and have minimal styling.</p><h3>Rails Backend</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*rVpclgoa3rRMyl7ICzP3KA.png" /></figure><p>The migration for the backend consists of two tables. A ‘Workout’ table that has a title and focus. An ‘Exercise’ table that has a name, target, sets, and reps. Workouts has many exercises and an exercise belongs to a workout.</p><h3>Containers</h3><p>I have two containers which are a ‘WorkoutContainer’, and ‘ExerciseContainer’ The ‘ExerciseContainer’ fetches all the exercises from the backend and mounts it to the the DOM, and calls the ‘WorkoutComponent’ that passes the exercises into the component. It also creates 2 routes for exercise list page and exercise form. The ‘WorkoutComponent’ fetches the all the workouts and mounts it to the DOM so now it has access to all workouts and exercises. It has 3 routes for workout list page, workout form, and workout show page. The use of these containers is to fetch the data we need and pass them to the components that will present the data.</p><h3>Components</h3><p>In total I have 7 components. The only stateful components are the forms to create a workout and create an exercise. Local state is needed in these components to alter the value inside the textboxes and to send the data to the fetch action.</p><h3>Forms, Actions, and Reducers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*OaMR6TnDurH_3IHvSqoM9g.png" /><figcaption>Workout Form</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*7v7suxupn6j1pjV4ktSPeA.png" /></figure><p>Using state in forms is the best way to keep it controlled. The initial state object is blank. Then using the onChnage event handler updates the state to whatever the value is set to whatever the key is. Once you have filled out the form, updates the state, and click ‘submit’, it will take the data and dispatch createWorkout function action with data as the arguments. The createWorkout() function will send a fetch request with the data to create a new object in the back end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qyW8-xu0WEnJWqz7rjjtkQ.png" /><figcaption>Create workout action and reducer</figcaption></figure><p>Once the fetch has been resolved and brings back a response which is that workout object, it dispatches it to redux store using the “ADD_WORKOUT” reducer you see on right in the picture above with the already state that has bet set in the store. The same idea and methods go for creating an exercise, but it needs to have the workout id in which I pass it down to the exercise form from Workout show page.</p><h3>UseHooks</h3><p>Using hooks has made this project a lot more easier to work with and read using it to hook on React features. The ‘useState’ hook helped add React state to function components. The ‘useDispatch’ hook returns a reference to the dispatch function from the Redux store to dispatch actions. The ‘useNavigate’ hook I used to navigate back to a certain page after dipatching an action. Most importantly, the ‘useSelector’ hook which allowed my components to to extract data from the Redux store state. There were some other I also used, but these were the most useful to my project.</p><h3>Conclusion</h3><p>This was a tough project for me for sure especially being a beginner at React and Redux, but I do have to say I have learned a tremendous amount through the struggle. This project is no where close to being perfect, but it works and I am happy about that.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e355892c84b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PostgreSQL: Connection and Role error solutions]]></title>
            <link>https://muhammadhullah23.medium.com/postgresql-connection-and-role-error-solutions-3fb0366c627d?source=rss-b0bdd18eb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fb0366c627d</guid>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[Muhammad Ullah]]></dc:creator>
            <pubDate>Tue, 07 Dec 2021 08:37:34 GMT</pubDate>
            <atom:updated>2021-12-10T10:08:06.839Z</atom:updated>
            <content:encoded><![CDATA[<p>I am glad to be writing this blog to showcase how I was able to fix errors when trying to use PostgreSQL as the database for my project. I tried to create the database using rails db:create but it had other plans and threw errors. After searching for hours on StackOverflow and copying the top commented answers without a second thought(because they are always right… duh!), I had no luck. It all started when I was… wait... you’re probably on this blog to find answers for your errors, so let me just get straight to the point.</p><h3>Connection Error</h3><p>The first error that came up was a connection error.</p><pre>Running via Spring preloader in process 9221<br>/usr/share/rvm/gems/ruby-2.6.1/gems/spring-3.1.1/lib/spring/application.rb:209: warning: Insecure world writable dir /mnt/c in PATH, mode 040777<br>connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory<br>        Is the server running locally and accepting connections on that socket?<br>Couldn&#39;t create &#39;bounce_backend_development&#39; database. Please check your configuration.<br>rake aborted!<br>ActiveRecord::NoDatabaseError: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory<br>        Is the server running locally and accepting connections on that socket?</pre><pre>...</pre><pre>Caused by:<br>PG::ConnectionBad: connection to server on socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot; failed: No such file or directory<br>        Is the server running locally and accepting connections on that socket?</pre><p>Now I did not understand what any of it meant. My coach told me that I probably did have PostgreSQL installed, but I did.</p><p>To see the Postgre cluster running on your device type in your terminal pg_lsclusters and it outputted:</p><pre>Ver Cluster Port Status                Owner    Data directory              Log file</pre><pre>11  main    5433 online                postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log</pre><pre>13  main    5432 down,binaries_missing postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log</pre><pre>14  main    5434 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log</pre><p>Now I saw that I had 3 versions and version 13 has port 5432 which is the one having connection errors. I’m not sure how I ended up with 3 versions (probably because I did not install it properly and did multiple takes). My coach then sent me a link to a proper guide for installing PostgreSQL, so I uninstalled the PostgreSQL I had downloaded before using this code.</p><pre>sudo apt-get --purge remove postgresql postgresql-*</pre><p>If you do not wish to uninstall everything then refer to this forum: <a href="https://askubuntu.com/questions/32730/how-to-remove-postgres-from-my-installation">https://askubuntu.com/questions/32730/how-to-remove-postgres-from-my-installation</a></p><p>The next step was to reinstall PostgreSQL. Instead of copying the guide, here is the <a href="https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-database">link</a> my coach sent me in which I used.</p><p>If the above solution does not work for you then you can also read this blog: <a href="https://harshityadav95.medium.com/postgresql-in-windows-subsystem-for-linux-wsl-6dc751ac1ff3"><strong>PostgreSQL In Windows Subsystem for Linux (WSL)</strong></a><strong> </strong>by<strong> </strong><a href="https://harshityadav95.medium.com/?source=post_page-----6dc751ac1ff3-----------------------------------">Harshit Yadav</a></p><h3>Role Error</h3><p>YAY! We fixed the connection error… oh wait… now I’m getting these role errors.</p><blockquote>“ A role is an entity that can own database objects and have database privileges; a role can be considered a “user”, a “group”, or both depending on how it is used.” — <a href="https://www.postgresql.org/docs/9.1/sql-createrole.html"><strong>PostgreSQL</strong></a></blockquote><pre>FATAL:  role &quot;&lt;role_name&gt;&quot; does not exist<br>Couldn&#39;t create &#39;&lt;app_name&gt;_development&#39; database. Please check your configuration.<br>PG::ConnectionBad: FATAL:  role &quot;&lt;role_name&gt;&quot; does not exist</pre><p>Luckily the solution was simple and all I had to do was create a role.</p><pre>#start the server if not started<br>sudo service postgresql start</pre><pre>#open the psql shell <br>sudo -u postgres psql</pre><pre>#create role <br>CREATE ROLE name LOGIN PASSWORD &#39;my_password&#39;<br>#when you enter this code it should return the name of the role back to you.</pre><p>This created the role for me and I was thankful that it did. If CREATE ROLE name LOGIN PASSWORD &#39;my_password&#39; does not work for you then you could refer to this <a href="https://www.postgresql.org/docs/9.1/sql-createrole.html">CREATE ROLE</a> documentation by PostgreSQL.</p><p>Now my role was created, but my problem with roles was not over as I received this new error:</p><pre>PG::InsufficientPrivilege: ERROR: permission denied for relation schem_migrations</pre><p>First, go into your psql shell using sudo -u postgres psql then enter in \du in which something like the following should pop up:</p><pre>Role name |       Attributes     | Member of<br>-----------+------------------------------------------------------------+-----------<br> new_role |                      | {}<br> other    | Superuser, Create role| {}</pre><p>As you can see, the new role that I created did not have any attributes. I had to upgrade my new role to Superuser.</p><pre>#go into your psql shell<br> sudo -u postgres psql</pre><pre>#alter your role<br>ALTER USER rolename WITH SUPERUSER;</pre><p>With that PostgreSQL errors were fixed and when I ran rails db:create it created the database for me and my hope is that this blog helped you in fixing your errors. Finally, all my problems came to an end… for now.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F4YWtPFasSBZMFrs7ML%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F4YWtPFasSBZMFrs7ML%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F4YWtPFasSBZMFrs7ML%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="333" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ce8870f32d3e05f7306edc8cad6a6f1/href">https://medium.com/media/0ce8870f32d3e05f7306edc8cad6a6f1/href</a></iframe><h3>References</h3><ol><li><a href="https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-database"><strong>Get started with databases on Windows Subsystem for Linux</strong></a></li><li><a href="https://www.postgresql.org/docs/9.1/sql-createrole.html"><strong>CREATE ROLE</strong></a></li><li><a href="https://askubuntu.com/questions/32730/how-to-remove-postgres-from-my-installation"><strong>How to remove Postgres from my installation?</strong></a></li><li><a href="https://stackoverflow.com/questions/8092086/create-postgresql-role-user-if-it-doesnt-exist"><strong>Create PostgreSQL ROLE (user) if it doesn’t exis</strong></a>t</li><li><a href="https://newbedev.com/rails-pg-insufficientprivilege-error-permission-denied-for-relation-schema-migrations"><strong>Rails:PG::InsufficientPrivilege: ERROR: permission denied for relation schem_migrations</strong></a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fb0366c627d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[‘Self’ in Ruby]]></title>
            <link>https://muhammadhullah23.medium.com/self-in-ruby-2be40c8bc0bb?source=rss-b0bdd18eb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2be40c8bc0bb</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[self]]></category>
            <dc:creator><![CDATA[Muhammad Ullah]]></dc:creator>
            <pubDate>Sun, 28 Nov 2021 23:31:00 GMT</pubDate>
            <atom:updated>2021-11-29T00:26:23.140Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog intends to give more insight to beginners on what ‘Self’ is in Ruby and how it works in instance methods and class methods. When I first came upon learning ‘self’, it was very confusing to me because of the context it was in, but the more I practiced using ‘self’, the more I came to understand this special variable, the better I was at implementing it in different situations.</p><h3>What is ‘Self’?</h3><p>‘Self’ is a special variable that refers to the object that “owns” the executing code. One way to look at it is to ask yourself “Who am I?”. Who ‘self’ is, depends on where it is. It can be either in an instance method or a class method.</p><p>So far it sounds pretty obvious and it is, but it can become tricky trying to implement it, so we will go through some examples.</p><h3>‘Self’ in an Instance Method</h3><p>When creating a new instance of a class, that instance is now also known as an object. When you create an instance method and implement ‘self’, ‘self’ refers to that specific object/instance of that class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*V-xPFAosIshHstRM-MOtlA.png" /></figure><p>Here is an example that has a Book class with each instance having attributes of ‘title’ and ‘author’. On <strong>line 14</strong>, a new instance/object has been created and set to the variable ‘newBook’ with a title=“Self” and author=“Mo”. On <strong>lines 9–11</strong>, there is a “title_author” instance method that puts out a sentence of “title by author”. You can also see that it uses ‘self’. Then on <strong>line 17</strong>, the new instance/object that was created calls the “title_author” instance method. Now ‘self’ in the instance method refers to that specific ‘newBook’ instance/object that calls the “title_author” instance method. The output is “Self by Mo” because ‘self.title=newBook.title’ and ‘self.author=newBook.author’. ‘Self’ belongs to whatever object/instance calls the instance method.</p><h3>‘Self’ in a Class Method</h3><p>When it comes to ‘self’ in a class method, ‘self’ refers to the entire class(not an instance/object of the class)</p><figure><img alt="Book class that showcases the use of self in a class method." src="https://cdn-images-1.medium.com/max/1001/1*R9p2aUGXka_C8gbktf4-Ug.png" /><figcaption>Self is also being used in other areas of this example. Can you figure out what self is within the context? Remember to ask yourself “Who self is” based on where it is.</figcaption></figure><p>Here we are continuing with our Book class example. Notice anything different? On <strong>line 4 </strong>we have a class variable that is an array of all Book instances/objects. The array contains 3 three objects because three new instances were created from <strong>lines 17–19</strong> and pushed into the array when the instance/object was initialized. <strong>Line 12</strong> is where the class method is and you can tell it is a class method because “self.” comes before the name of the method. All class methods are defined as “ def self.class_method_name”. To reiterate, ‘self’ in the class method refers to the entire class. Self is not within an instance scope but the class scope. Our class method is defined as “self.all” which returns to us “@@all” variable which is an array of every instance of the Book class. So, when we called the class method on <strong>line 21</strong>, it outputs us that array.</p><h3>Conclusion</h3><p>So we’ve gone through what ‘self’ is and how it is used within an Instance Method and Class Method. There are more in-depth ways you can use ‘self’, but these are the basic examples. It might take some practice getting used to knowing what self is referring to in that context, but just look at where you are in the code and ask yourself “Who am I?”. It’s all about context.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2be40c8bc0bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Herbal Healers Javascript Project]]></title>
            <link>https://muhammadhullah23.medium.com/herbal-healers-javascript-project-1a71cbd7066b?source=rss-b0bdd18eb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a71cbd7066b</guid>
            <dc:creator><![CDATA[Muhammad Ullah]]></dc:creator>
            <pubDate>Mon, 11 Oct 2021 10:01:10 GMT</pubDate>
            <atom:updated>2021-10-11T10:01:10.233Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to my blog reader, where I will be taking you through my Javascript project for Phase 4 of the Flatiron Software Engineering Program. If you had read my blogs on my other projects, you would know that they were on books and stories. For this project, I went in a different direction. I decided to do my project people being able to create homemade remedies for different illnesses.</p><h3>Requirements</h3><p>The requirements on the frontend for this project are that the application has to be a single page where it should not reload or refresh, the application must use object-oriented Javascript, must be asynchronous, the application must have at least 3 fetch requests to cover 2 CRUD actions and something else, and must use JSON communication format.</p><p>The requirements on the backend for this project are rails API has to be the backend, has to have has_many/belongs_to relationship, and API should follow restful conventions.</p><h3>The Setup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/222/1*NL0zd7_lTijWrNH_OaBapQ.png" /></figure><p>When it comes to object-oriented programming, we always have to think of separation of concern. That is why the classes have been broken up into different files. The files inside the src folder are for that specific object which has its own job to do. Index.html is the only HTML page that will be used to follow the requirement of the project being a single page application. Index.html is where we also load up our Javascript files using script tags. The script tags should have the ‘defer’ attribute so the script is downloaded along with parsing the page. Either that or you could place the script tags towards the end of the index page so that the page is not blank because the javascript is loading.</p><h3>remedy_api.js &amp; illness_api.js</h3><p>The files have classes to make fetch requests. There is a constructor that takes in a URL that creates and initializes a new object.</p><p>Fetch requests can be used to make requests(obviously) to the backend to get information from the database. You can also send data to the backend using fetch requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*M1a-8ieG7k80U2AaQ7tAfQ.png" /></figure><p>As you can see getRemedies is sending a fetch request using the URL object plus an additional string to go the right method. It goes to the .then which make a promise to get a response. If this promise is not fulfilled then it gets an error which .catch catches. If it does fulfill the promise it then goes to the next .then which makes a promise to get the data, create new instances and attach it to the DOM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*rn6f4d4N91wz4S4S8zxVdw.png" /></figure><p>The next fetch request is being used to create new remedies, so it is sending data to the backend to be saved. First, you set a variable to an object which will hold the information that was submitted. configObject is basically a map that makes configuration entries which in this case would be to post. The JSON.stringify takes the new data and converts it to a JSON string. It then makes the fetch request with the URL and configObject. The new data gets saved and get that saved data back in a response which will be used to create a new Remedy instance in JavaScript.</p><h3>remedy.js</h3><p>this is where a lot of behavior is being held.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*o_GttSr7kZx9Dl0pRPw57g.png" /><figcaption>That&#39;s just the start</figcaption></figure><p>This Remedy class starts with a constructor to instantiate new instances. It also attaches elements tags, id, and an event listener that will be used to for that specific instance. The Remedy class is where I get to choose my display of the remedy in a function. It has an event listener that works with the handleClick function to edit and delete the remedy. If someone were to click on “Edit Remedy”, it would create the form with the values inside the textboxes. Once someone finishes editing their remedy and hits “Save Remedy”, makes the fetch request to the backend to update in the database.</p><h3>index.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*bwDNjDEhnQGWZxJMsSHwxw.png" /></figure><p>This file is not a class, but it is being used to save get specific information from the DOM and save it as a variable to be used in other classes. It also calls The RemedyApi and IllnessApi with taking in a URL saved as ‘port’ to fetch all of the data from that ‘port’ and attach it to the DOM. The form is also on the index.html page, so index.js includes the event listener to submit the form working handleSubmit() function to send the data to the backend.</p><h3>Conclusion</h3><p>My biggest obstacle for me was that I find Javascript to be confusing(for now) which I believe, with that and the time I had open, held me back from making this a fulfilling project instead of just trying to meet the requirements. There is a lot more work to be done on this project after I pass the assessment which is promised ready to be fulfilled.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a71cbd7066b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Imagine Pad Rails Project]]></title>
            <link>https://muhammadhullah23.medium.com/my-imagine-pad-rails-project-420121568022?source=rss-b0bdd18eb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/420121568022</guid>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <dc:creator><![CDATA[Muhammad Ullah]]></dc:creator>
            <pubDate>Mon, 16 Aug 2021 00:18:58 GMT</pubDate>
            <atom:updated>2021-08-16T00:18:58.018Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome Back! To another project created by… me, of course. This time it is for the FlatIron Phase 3 Ruby On Rails project. My first two projects were on books and reviewing books, but with this project, I felt it kind of repetitive to base it off again on books, but at the same time I wanted to relate my project to it. I’ve decided to create a project that allowed Users to create their own concepts for a story/idea, but to limit the User to just books, I’ve added a Media Type model, so that their concept can be for books, magazines, cinema, radio, etc. This idea came to me, by waking up one day, and scrolling through Reddit, and seeing people write novel ideas and other users pitching in their own ideas to that novel. My project is called Imagine Pad(totally did not google free names online).</p><h4><strong>Models/Flow</strong></h4><p>Imagine Pad consists of 4 models: User, Concept, Genre, and Media Type. User has many concepts, has many genres &amp; media types through concepts. Concept belongs to a user, genre, and media type. Genre has many concepts, has many users &amp; media types through concepts. Media Type has many concepts, has many users &amp; genres through concepts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*s55h9p1okVu2SNvnGSwddw.png" /><figcaption>Model Flow Chart</figcaption></figure><p>Once I’ve planned what my project was going to be about and what needed to be done, it was time to start. This project is a lot similar to waht we did for Sinatra project in what the web app needed to do, but the difference is that we had to use Ruby on Rails which is a lot more intuitive than Sinatra, and we’re able to do a lot more with. This includes using partials, helpers, before action, private methods, strong params, routes/custom routes/nested routes, nested forms, scope methods, and omniauth. Yeah, this is a lot to learn and implement, but once you get more acquainted with these new concepts(lol), the more you see how it makes your life a lot easier and follow a very important principle D.R.Y (Don’t Repeat Yourself).</p><h4>D.R.Y</h4><p>The ‘Don’t Repeat Yourself’ principle is exactly what it sounds like. Its focus is to reduce repetition within your code. If you have a repeat code or logic in your program, and they realize that you’ve made a mistake or need to change something, then you would have go to every instance where you implemented that code to fix, and you still might miss some. Would it not be easier if the code or logic was in one place, so you will only have to fix/change in that place without breaking your program. This is where partials, helpers, and private methods come in handy. Private methods are methods that belongs in your controller to help take out repeat code. The most common example you will see is when using strong params.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s4MOqZBcXvNL_RSLFypWJg.png" /></figure><p>As you can see if we used ‘params.require…’ in multiple actions, it will stray away from the D.R.Y principle and make your code look ugly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*vbmfRs4jgu-O7c-LppT8-Q.png" /><figcaption>Partial that does not take in a variable</figcaption></figure><p>Next are partials and helpers which both take out repeat code and logic from your views, so what&#39;s the difference. Helpers are meant for smaller use logic with the views while Partial is for larger chunks of code and logic. A great example of when to render a partial is when you have a form and that same form can be used in a new page and edit page. So, instead of putting the same form twice, we put it in a partial that starts with a ‘_’ to let it be known that it is a partial and not an actual page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*oLw3hCpbeIABVLeUnwrStQ.png" /></figure><p>Another great example of when to use a partial is to list any error. This will live in the layout folder, but wait… this partial is supposed to be used on pages with different variables. This is when we render a partial that can set local and instant variables. You set the variable to the variable you want and the code in the partial will use that variable which will represent the original.</p><h4>Omniauth</h4><p>This project also requires a user to be able to sign in from another service. Omniauth is a gem that allows us to do just that. I decided to do Facebook since that is something I’ve already in a previous lab, so I figured it would be easy which it was and at the same time was not. The gems I had to implement were ‘omniauth’, ‘omniauth-facebook’, and ‘omniauth’. Then I had to give Omniauth my apps’ OAuth credentials that would go in its own omniauth.rb file that lives in ‘config/initializers. The OAuth credentials need to be hidden in an env file that comes from the dotenv gem. With Facebook, you’ll have got to the Facebook Developers app and follow the instructions to get the credentials necessary. Lastly is to route the OAuth flow into our application by creating a route and an action in the controller that sets the attributes. All this and I still do not understand completely how everything works.</p><h4>Biggest Obstacle</h4><p>My biggest obstacle did not come from working on the project(well maybe setting up the Omniauth is a runner-up). My biggest obstacle came from life in general, when something happens to hinder your mind and soul from completing any objectives and goals. Nothing has happened to me, but just questioning myself and having to find those answers really was big hit upon the two weeks of creating the project because although I was able to complete the project and meet the requirements, I did not give it my all and that was disappointing. This is life in general, you have your ups and downs, you fall down and get back up, but the important thing is to remember why you’re doing it that makes you get back up and build the discipline of working through troubled times.</p><h4>Final Thoughts</h4><p>This project was definitely a big one and it took a lot of elbow grease to get it done. It was definitely overwhelming at first and throughout the project, but what I found made it easy, is to just break it down into small pieces and get them in, and eventually before you know it all those small pieces will be your grand design. I can honestly say though that I thoroughly enjoyed this project as well as the previous ones. It’s time for the next phase of this course.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=420121568022" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creation of my BookMarked Sinatra Project]]></title>
            <link>https://muhammadhullah23.medium.com/creation-of-my-bookmarked-sinatra-project-3c4442997421?source=rss-b0bdd18eb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c4442997421</guid>
            <category><![CDATA[book-review]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[sinatra]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[sqlite]]></category>
            <dc:creator><![CDATA[Muhammad Ullah]]></dc:creator>
            <pubDate>Tue, 15 Jun 2021 00:20:24 GMT</pubDate>
            <atom:updated>2021-06-15T00:20:24.502Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello, fellow reader as I take you on a journey to the creation of Sinatra Project, Bookmarked! If you have read my blog, Library of Mo, then you would know that my CLI project for Flatiron School was a library of books. For this Sinatra project, I want to go on a similar theme involving books and stories. At first, I want my project to be about Users being able to create their own short stories. A User would have many Stories and a Story would belong to a User, but the only problem I had was being able to create a third model that would have a ‘has many through’ relationship. That is when I decided to create my project on Reviewing Books.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*rB-J6H0_qtyLPOIcd_H8Gw.png" /><figcaption>3 Models and Relationships</figcaption></figure><p>Once I had my mindset on what I wanted my Sinatra Project to be on, the ideas kept flowing in and in even while I was at my job, but I knew I had to ground myself before I became disappointed with not fulfilling all of my ideas, so I started small and created 2 models of a User(has many reviews) and a Review(belongs to user). To get started I used the Corneal gem to create a new file where my project will be. Instead of creating everything from scratch, the Corneal gem creates all of the necessary files required for the Sinatra Project(such as config.ru, rakefile, evironment.rb, layout.erb, application controller, etc).</p><p>One principle that Phase 2 of Flatiron school taught was ‘Separation Of Concern’ which is separating files and classes into different sections. When the sections are separated then it makes it much easier for the programmer to locate bugs, keep bugs from affecting all files, and creates order.</p><figure><img alt="Following this principle of ‘Seperation of Concern’ saved me a lot of headaches. I cannot count the number of mistakes I have made during this project but because of this one principle, it has helped me become a better programmer and improved my ability to solve problems. Without this principle, I probably would have not been able to finish the project, or would have taken me a lot longer than it already did." src="https://cdn-images-1.medium.com/max/232/1*xTXYsOr3XnF3f122zUYtsg.png" /></figure><h3>S.O.C Principle</h3><p>Following this principle of ‘Separation of Concern’ saved me a lot of headaches. I cannot count the number of mistakes I have made during this project but this one principle has helped me become a better programmer and improved my ability to solve problems. Without this principle, I probably would have not been able to finish the project, or would have taken me a lot longer than it already did.</p><p>Next came for Users being able to log in or sign up to create an account and write reviews. Through validations, a user must fill in the textboxes of username and password in order to log in or sign up. When it came down to the password, I used the gem BCrypt that works with has_secure_password which takes the password and salts it which means that it turns the string into a bunch of random data which it then hashes. When a User is logging in and types in their password, it salts the string, and using ‘.authtenticate’ sees if it matches the salted password in the database.</p><p>Once a User has created their account, then they are able to create a new review or edit/delete a previous review they have created. A User can only edit/delete their own reviews and this is possible by creating a private redirect_if_not_logged_in method created in the application controller because it is needed in the other controllers and is called in routes where a user can create, edit, and delete reviews. The second private method is the redirect_if_not_authorized method which is created only in the review controller because that is where it is only used since that is where a user can create, edit, and delete reviews.</p><h3>Migration Table and Relationships</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*90oHZzEg2aTPZDkBXW5lgA.png" /></figure><p>The reviews table is the joining table because it belongs to a user and belongs to a review, so it makes it easier for the object to track who it belongs to and connected to. Using the foreign key of users and books we can set it to user_id and book_id which is how the relationship book has many users through review and vice versa get connected.</p><h3>My Biggest Obstacle</h3><p>The biggest obstacle that I faced during this project was the has_many_through relationship, but not because of the objects connected, but how to access them and connect the views and controllers. The first thing I did was googling, but after scouring the internet for some time, I could not find an article nor video explaining the one thing I was confused about. Every article and video only explained the relationship. I also when back to the Phase 2 modules and I saw a section where it was titled for what I was looking for, or at least thought it did. Even that only explained the relationship, but not how it is used. So, using previous labs, and a lot of trial and error, I was able to find my answer and my code was working. Since my struggle to find an article explaining how to use the has_many_through relationship was a failure, maybe I can create another blog explaining that.</p><h3>Final Thoughts</h3><p>I went through a variety of emotions when creating this project such as frustration, overwhelmingness, feelings of failure, but most of all joy. Whatever frustrations I went through or negative feelings I had whether it was from the project or life, I can say with confidence that I am really enjoying this everlasting journey I am on. I even developed some obsessiveness for programming(which I won’t let it get out of hand). All in all, I cannot wait for the next phase, the next trials, the next failure, the next success as I will always be falling forward.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c4442997421" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Library Of Mo]]></title>
            <link>https://muhammadhullah23.medium.com/library-of-mo-8a46a2172aea?source=rss-b0bdd18eb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a46a2172aea</guid>
            <category><![CDATA[cli-project]]></category>
            <category><![CDATA[amateur]]></category>
            <category><![CDATA[first-project]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <dc:creator><![CDATA[Muhammad Ullah]]></dc:creator>
            <pubDate>Sun, 18 Apr 2021 01:52:44 GMT</pubDate>
            <atom:updated>2021-04-18T01:52:44.124Z</atom:updated>
            <content:encoded><![CDATA[<p>Well…I have finally finished my first CLI project for Flatiron School. After two failed attempts of creating a superhero and comic book project, I had decided to create a library. One of my goals is to have a full library in my home because it’s not just a room full of books and information, it is a room full of different lives you can live and experience. Since that is a goal that will take some time to achieve, I will settle for a virtual library.</p><h4>The API</h4><p>My project is extracting information from the New York Times Best Sellers Categories List API which gives a list of categories in an array of hashes and in each has there is a book array which contains a hash of the top 5 best seller books that falls under that category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*igoIG2Ozq2u6N1v4EFuJjA.png" /></figure><h4>The Code</h4><p>My code is fairly simple since this is only my first project after all. It goes 2 levels deep which brings you to a list of categories and the user selects their favorite category and it puts out 5 books with the author, publisher, description(if it was in the API), highest rank reached, and how many weeks it was on the list.</p><p>In order for my code to work it first needed the ability to GET the user’s input, so I defined a method user_input and for a solid 2 minutes, I was trying to rembember what is that we use to GET the user’s input and it poped into to my head to use gets with a .strip to trim any leading and trailing white lines.</p><p>The code starts off with a start method that asks the user to enter their name and then following that would be to invoke the class method API.get_data which takes the information from the API and instantiates new instances. Once the user puts in their name and the class method, it then calls on the greetings method which greets the user and instruction to see a the categories list or to exit using a puts statement which the calls on the menu method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/323/1*f8_P6lcvO3zLeI5TFF5lKw.png" /><figcaption>Menu method</figcaption></figure><p>The menu, although it is nothing new or extravagant, it still intrigued me. Using ‘if’ and ‘else’ statements and depending on what the user inputs will decide what method it will call on next. If the user types in ‘yes’ it will call on the category_list method which will print out all of the categories. Or if the user types ‘exit’, it will then have a goodby message and exits out. And if they type in anything else it will call on the invalid method which is a puts statment to “enter a valid entry” then calls on the menu method, so the user has to pick one of those two before moving on.</p><p>The category_list method invokes the class method Library.all(contains a class variable thats is set equal to an array of all the keys and values that I needed to initialize) and we need to iterate through the array using .each.with_index to retrieve the the name of the category and its index to be put ot a puts statements containg those objects which then gives a list of numbered categories, and then calls on the select_category method. This is where the user enters the category of their choosing and once they hit enter the class method Library.find_by_category gets invoked as the chosen category becomes the argument to check where the category that was entered exists. If what they enters was ‘exit’, it invokes the leaving_library method, and if what was inputted is not ‘exit’ or any of the categories, then it invokes the invalid method then the select_category method, so they can enter a valid entry. But if the user inputs a category and it checks out then it invokes the books_list(cat_name) method with the chosen category as the argument.</p><p>The books_list method was a bit confusing for me at first because the information I needed was in an array of hashes that was inside an array of hashes, but luckily with the help of pry and my genius of a cohort leader pointed out that when we passed the chosen category as an argument we were then inside inside of the hash and all I needed to do was iterate through the array and hashes the same way I was able to do with the categories by using .each. This method then puts out the list of book that falls under that category with the author, publisher, description(if given), highest rank reached, and how many weeks it was on the list.</p><h4>The Most Challenging Part</h4><p>As soon as I thought I was done, I ran into an annoying problem. When the books_list(cat_name) method got invoked to put out the information of the books, the titles of the books came out all uppercased because that is how it is in the API. Now the code worked perfectly don’t get me wrong, and I thought I could just leave it alone, so I decided to save and turn off my laptop and go to sleep, but I could not sleep. The though of the title being all uppercased was gnawing at my brain, and this is my code no matter how simple it is, it is still my code and I must take care of it. I decided to strap on my boots and get back to work. I kept thinking to myself, because that is what I do best, how can i take the title of the books and capitalized them. At first I thought I could downcase the the titles then call on the string class method ‘capitalize’ on the titles, but that would only capitailize the first word, and some of the books have titles more than two words. I was stumped, but after taking a walk, I realized I had done something similar in previous labs. I would have to split the titles into multiple strings, then use .map to itterate each string in the array to be capitalized then finally using .join to for back into one string with the whole title being capitalized. Everything I just mentioned is being the done in a method called capitalize_title(title) which gets invoked in the books_list with the title of the book being passed as the argument.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*PaRenHOBwjosQ6bzZjl1_A.png" /><figcaption>It’s not much, but it’s honest work.</figcaption></figure><h4>Lessons Learned</h4><p>Through out this project I’ve learned a great deal about coding, and Iwould like share it in my ending</p><ol><li>The importance of design.</li><li>The importance of classes having a single responsibility and their methods being alligned with that responsibility.</li><li>‘PRY’ is a powerful tool</li><li>A life lesson also is to take your time and take one step after the other. Taking you time each step of the way will relieve you of a lot of headaches</li></ol><p>Well…This is the end of my blog talking about my first CLI project that I’m damn proud not because it is perfect which it is not, but because it is something I had created. Hope you enjoyed reading as much as i enjoyed writing this… and the code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a46a2172aea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I decided to study Software Engineering.]]></title>
            <link>https://muhammadhullah23.medium.com/why-i-decided-to-study-software-engineering-a75f74ff9f09?source=rss-b0bdd18eb8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a75f74ff9f09</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[my-journey]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Muhammad Ullah]]></dc:creator>
            <pubDate>Sun, 28 Feb 2021 18:36:08 GMT</pubDate>
            <atom:updated>2021-02-28T18:36:08.923Z</atom:updated>
            <content:encoded><![CDATA[<p>Why I decided to study Software Engineering.</p><p>It’s funny to think that I have ended up in a Software Engineering program. If you told me two years ago this is where I’d be; I’d think you flew over the cuckoo’s nest. I had absolutely no desire of learning programming as I did not understand and I thought I would be a complete failure at it. It wasn&#39;t until I took a class at the New Jersey Institute of Technology where I met professor Osama that changed my perspective on software engineering. We had a four-person group project where we had to develop a website using HTML, Javascript, and CSS that would be beneficial to society. My group ended up creating a website of putting up ‘Lost Pet’ flyers virtually. When our group presented our website, I had to talk about the code of the part I worked and when it was opened, I saw how basic it was compared to everyone else’s, but that did stump me as I still felt good when I was creating it. That&#39;s the keyword, “creating”, that got me thinking that programming might be right up my alley. This was two years ago.</p><p>So, why now did I decide to study Software Engineering? Throughout those two years, I have matured a lot and saw just how important programming is in a world where technology is progressing incredibly fast. It’s as if it should be taught to everyone, at least the fundamentals. I was also at a point where I could not continue to go to college anymore due to financial reasons, and that really put me in a slump for quite some time. It was not until my sister suggested me the Flatiron School Software Engineering Programming where I started to see some hope for me yet. It also reminded me of my time in Professor Osama’s course and I decided to attend Flatiron School to study Software Engineering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oCNC_Km6MPvG0xwg" /><figcaption>Photo by <a href="https://unsplash.com/@joshuaryanphoto?utm_source=medium&amp;utm_medium=referral">Joshua Reddekopp</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a75f74ff9f09" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>