<?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: M-Shkreli21</title>
    <description>The latest articles on DEV Community by M-Shkreli21 (@m_shkreli21).</description>
    <link>https://dev.to/m_shkreli21</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%2F958713%2F7d24980e-b78f-4a81-afc0-24e69ae8ae57.png</url>
      <title>DEV Community: M-Shkreli21</title>
      <link>https://dev.to/m_shkreli21</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/m_shkreli21"/>
    <language>en</language>
    <item>
      <title>Python If/else statements</title>
      <dc:creator>M-Shkreli21</dc:creator>
      <pubDate>Fri, 24 Mar 2023 21:40:28 +0000</pubDate>
      <link>https://dev.to/m_shkreli21/python-ifelse-statements-n27</link>
      <guid>https://dev.to/m_shkreli21/python-ifelse-statements-n27</guid>
      <description>&lt;p&gt;Today I decided to tackle one of my first Python labs on conditional statements. At first glance the simpleness of Pythons syntax writing really stands out compared to JavaScript. &lt;/p&gt;

&lt;p&gt;In JavaScript a developer has to know operators like "||"(or) as well as "&amp;amp;&amp;amp;"(and), in Python its as simple as using the words and/or. While it doesn't seem like a huge difference maker, when I first started learning JavaScript, I saw that I would often times overlook the operators or forget which were which.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bX2C0aQm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pnznt99f5nqxo425y3wf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bX2C0aQm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pnznt99f5nqxo425y3wf.png" alt="Image description" width="880" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even though the examples above are straight forward and not complex, i'm still proud of my ability to translate what I know from JS so easily into writing Python functions. With Python, we don't need parenthesis or curly brackets left and right. If you are like me thats a small difference that can go a long way when writing a lot of code and debugging.&lt;/p&gt;

&lt;p&gt;In Python, prior to version 3.10, there was no equivalent to a switch/case statement, we are able to flawlessly integrate a regular if/else statement, as shown with the calculator function example.&lt;/p&gt;

&lt;p&gt;One aspect of Python functions that is new to me and I am excited to learn is the use of Dictionary Mapping. With Dictionary Mapping we are able to take a long list of conditions and instead of writing if/else statements until our hands hurt we are able to group all the conditions and values into a dictionary.&lt;/p&gt;

&lt;p&gt;`dog = "cuddly&lt;/p&gt;

&lt;p&gt;dict_map = {"hungry": "Refilling Bowl",&lt;br&gt;
            "Playful": "Play a game",&lt;br&gt;
            "Cuddly": "Snuggle"}&lt;/p&gt;

&lt;p&gt;owner = dict_map.get(dog, "Reading Newspaper")&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;With this above method, we are able to apply the state of the dog to the dictionary keys and apply the state of the owner to the values of the dictionary.&lt;/p&gt;

&lt;p&gt;So far for my first week with Python, I can see why this is considered one of the most popular programming languages, I am excited as I continue down the path of mastering Python!&lt;/p&gt;

</description>
      <category>python</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Journey into Python</title>
      <dc:creator>M-Shkreli21</dc:creator>
      <pubDate>Thu, 23 Mar 2023 01:36:16 +0000</pubDate>
      <link>https://dev.to/m_shkreli21/journey-into-python-4mj2</link>
      <guid>https://dev.to/m_shkreli21/journey-into-python-4mj2</guid>
      <description>&lt;p&gt;Hi All,&lt;/p&gt;

&lt;p&gt;I recently graduated from Flatiron Schools Software Engineering program. Thanks to hard work and a lot of studying I am now able to call myself a Full Stack Software Engineer. Before I began my journey I tried teaching myself Python but felt that I needed a more structured environment so I stopped. &lt;/p&gt;

&lt;p&gt;Now that I am done with the program I wanted to add more to my tech stack to help myself stand out more with employers. &lt;/p&gt;

&lt;p&gt;During my first couple labs and readings, I feel as though Python is easier to learn than I previously thought, I am really excited to continue my journey and learning the language that got me interested in programming to begin with.&lt;/p&gt;

&lt;p&gt;I will continue to post as my journey continues, thank you all for reading!&lt;/p&gt;

</description>
      <category>python</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Hiding API keys with Rails</title>
      <dc:creator>M-Shkreli21</dc:creator>
      <pubDate>Mon, 23 Jan 2023 15:35:32 +0000</pubDate>
      <link>https://dev.to/m_shkreli21/hiding-api-keys-with-rails-5a9m</link>
      <guid>https://dev.to/m_shkreli21/hiding-api-keys-with-rails-5a9m</guid>
      <description>&lt;p&gt;As developers, we tend to use API's to help us bring in the necessary data for our applications. API's themselves are a great resource that every developer should learn to use. Most API's require something that is called an API key, this 'key' is essentially a code that gives you as the developer access to use said API. However, due to the key being specific to each user that has signed up for one, this can pose a huge security concern if you try to use a simple fetch in your front end with the key in the url. There are plenty of ways that developers can hide API keys, but the one that I have used and found to be the most productive is to hide it in the backend.&lt;/p&gt;

&lt;p&gt;By setting up your API calls in your backend, you enable yourself to create custom routes that can be used in your front end fetches. There are a few steps that need to happen in order to successfully hide your 'keys' in the backend of your app.&lt;/p&gt;

&lt;p&gt;Step 1: if one doesn't already exist, create a .ENV file in which you will assign a variable to each API that you will be using.&lt;/p&gt;

&lt;p&gt;Step 2: In your application should exist a .gitignore file in which you can choose what in your application gets pushed to github for other developers to view. Within that git ignore file we add the simple line of &lt;code&gt;.env&lt;/code&gt;. Now when you commit and push changes to github the .env file will not be pushed with it.&lt;/p&gt;

&lt;p&gt;Step 3: Once you have the env file setup and ignored, we can create an "API_controller" file that will enable us to write methods for each api path we plan on using. Within the url we will assign that variable from the env file for the actual API url. Example below:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1j6u165b63hpm7k299s.png" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1j6u165b63hpm7k299s.png" alt="Image description" width="800" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 4: Now that our controller has been set up our next step is to create custom routes that go to that respective api method. When creating routes it could be as simple as &lt;code&gt;get "/company_profile, to: "api#[custom api method]&lt;/code&gt;. Whats important to remember is that each custom route must have an HTTP method like GET, POST, PATCH, DELETE. &lt;/p&gt;

&lt;p&gt;Step 5: Now the final step, with the backend successfully hiding each api we can use our fetches efficiently in the front end. instead of having the long api url in our fetch we can simply set it as &lt;code&gt;fetch('/company_profile)&lt;/code&gt; and our app will know to go to the backend method, communicate to the api and bring in the necessary data without jeopardizing the security of our application. &lt;/p&gt;

</description>
      <category>softwaredevelopment</category>
      <category>career</category>
      <category>discuss</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Serializers with Ruby on Rails</title>
      <dc:creator>M-Shkreli21</dc:creator>
      <pubDate>Mon, 23 Jan 2023 15:21:15 +0000</pubDate>
      <link>https://dev.to/m_shkreli21/serializers-with-ruby-on-rails-1n64</link>
      <guid>https://dev.to/m_shkreli21/serializers-with-ruby-on-rails-1n64</guid>
      <description>&lt;p&gt;With our final learning phase at the Flatiron School we began by learning about Rails, which is a library used for the Ruby language. Rails has done an amazing job of simplifying and automating a lot from plain old ruby. One of my favorite things about rails is the inclusion of serializers for the data that exists in your backend. Serializers are files within your app that allow us as developers to customize how users will see the data that exists. When creating our tables in rails we can enter 'Rails g resource [tablename]' and the serializer file will automatically be created.&lt;/p&gt;

&lt;p&gt;After the file has been created it will default to show every column in your table (except the timestamps), from here we can edit which attributes we want to show when viewing data in our app. One thing that I have noticed most people take off is showing the id column from each table, since users themselves don't typically need to see the id for each data point brought in.&lt;/p&gt;

&lt;p&gt;Serializers can do a lot more than just edit one tables data view. If associations exist between tables whether they are many-to-many, one-to-many, etc. we are able to show that relationship through serializers.&lt;/p&gt;

&lt;p&gt;Think of a blogging application, a user can have multiple blog posts but each blog post belongs to one user. In our serializers we can establish the relationship like normal, users: &lt;code&gt;has_many :posts&lt;/code&gt; &amp;amp; posts: &lt;code&gt;belongs_to :user&lt;/code&gt;. From here we can see that when we use a tool like postman to view users we can see the associated posts that exist for each respective user. Even with associations like this, we can still filter through which attributes we want out user to see.&lt;/p&gt;

&lt;p&gt;Rails has been an amazing resource for me when trying to create full stack applications. The initial setup and modifications make it so simple and helps ruby developers speed up the process in which they design and apply the backend files they need for each project.&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>ai</category>
      <category>career</category>
      <category>productivity</category>
    </item>
    <item>
      <title>React with MUI</title>
      <dc:creator>M-Shkreli21</dc:creator>
      <pubDate>Mon, 28 Nov 2022 15:00:04 +0000</pubDate>
      <link>https://dev.to/m_shkreli21/react-with-mui-1a0f</link>
      <guid>https://dev.to/m_shkreli21/react-with-mui-1a0f</guid>
      <description>&lt;p&gt;As a part of phase-2 in the Flatiron School's Software Engineering bootcamp, we expanded our knowledge of JavaScript by learning how to use the popular JS library called React. At first I struggled a lot with react but as the week progressed, I felt more comfortable with how simple React makes JavaScript. One of the most fun learning aspect was teaching myself Material UI which is a comprehensive library of UI tools that developers can use for their web applications.&lt;/p&gt;

&lt;p&gt;MUI does a great job of limiting how much CSS a developer needs when developing a web application. With most components using MUI we can add styling straight within the component code and most of the work just requires using separate code than the usual JSX we become accustomed to.&lt;/p&gt;

&lt;p&gt;Regular JSX:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RxtpNjGH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2jtljjm0sv2fsb1vyj8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RxtpNjGH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2jtljjm0sv2fsb1vyj8.png" alt="Image description" width="880" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MUI:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pf3Oyvlt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o52a0xfqz1sn7ch6w9fn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pf3Oyvlt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o52a0xfqz1sn7ch6w9fn.png" alt="Image description" width="880" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see with the two screenshots above, we implement component UI's from MUI and add our own styling for size, color, etc. MUI has a long list of possible UI tools that can help make any web application more appealing for both the developer and then end user.&lt;/p&gt;

&lt;p&gt;A very important note to mention about using MUI is that when you include all your tools within your application, it will error out until you run the traditional "npm install" within the projects terminal. This will tell your application that you need to download the necessary modules in order to use the MUI tools you have written out.&lt;/p&gt;

&lt;p&gt;My project partner and I decided to take full advantage of the tools MUI has at its disposal for our phase-2 project. Instead of having a long list of CSS styling for each component, we were able to import tools and make our application more professional looking. This was a very interesting learning experience given that we had just spent the last week learning React and now we decided to go above and beyond and try and teach ourselves MUI within the 4 days we had to create our project. It was a hurdle but at the end of the day, learning MUI has made React much more interesting to me than it was on day 1.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>JavaScript Event Listeners</title>
      <dc:creator>M-Shkreli21</dc:creator>
      <pubDate>Fri, 28 Oct 2022 23:45:47 +0000</pubDate>
      <link>https://dev.to/m_shkreli21/javascript-event-listeners-3h41</link>
      <guid>https://dev.to/m_shkreli21/javascript-event-listeners-3h41</guid>
      <description>&lt;p&gt;When I first began my journey in changing careers I felt a lot of stress and anxiety. That feeling only got worse my first day of Software Engineering bootcamp. I sat there listening to the overview of the course and found myself feeling the biggest case of imposter syndrome. &lt;/p&gt;

&lt;p&gt;As we began our first week we started learning about something called "Event Listeners" using the Javascript language. Similar to a lot of beginners, event listeners sounded complex. My first example or two with event listeners just made me feel even worse about the concept. Knowing that I was going to struggle with this concept I decided to put more effort into mastering it than I would have imagined. Thankfully I have phenomenal class mates and technical coaches to help simplify event listeners and understand the logic behind them. &lt;/p&gt;

&lt;p&gt;Now if anyone has read the above and feels like they also struggled with some new concepts, I would love nothing more than to share my understanding of the logic and application of javascript event listeners.&lt;/p&gt;

&lt;p&gt;First and foremost, what are Event Listeners in JavaScript? Instead of providing a textbook definition i'd rather just share my own definition. Event listeners are pretty much exactly what they sound like. They are essentially built in listeners within Javascript that await user action to do something. In simpler terms, imagine you are on Yelp and you just visited a very lovely restaurant. You decide you want to share your thoughts and experience on yelp, you would write a review and click submit to send it for others to see. That submit action that takes your review and posts it for others to see is an Event Listener! Instagram is another example in that whenever you like a post you are clicking the heart and the application knows to listen to your click and update the server to display that you liked said post.&lt;/p&gt;

&lt;p&gt;Setting up an Event Listener takes a few steps and I will gladly display how to go about setting up these events. The example I will be using is actually from a project I just finished this week. The project I made was a video game database based on a very popular FPS game. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;element.addEventListener('EventType', function/arrow function{})&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Step 1: Decide what event you want your code to listener for. Some very popular events include 'click', 'dblclick', 'submit', 'mouseover', etc. For a full list of possible events please check out the MDN documentation that I will paste below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;"&lt;a href="https://developer.mozilla.org/en-US/docs/Web/Events"&gt;https://developer.mozilla.org/en-US/docs/Web/Events&lt;/a&gt;"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Step 2: Decide what you want to happen once you have chosen an event. This step is a little interested because you have two options. You can use an arrow function to keep the event and function bundled together in one block of code. Your other option is to use whats called a callback function. A callback function is essentially a function that you declare somewhere else in your code, but you can call it from within the event listener.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Arrow Function in Event Listener:&lt;/u&gt;&lt;br&gt;
&lt;code&gt;element.addEventListener('EventType', (e) =&amp;gt; {})&lt;/code&gt;&lt;br&gt;
The (e) is basically the event, now the first thing you should do when setting up this syntax is to include the line e.preventDefault(). e.preventDefault is used to prevent the browser from executing the default action. Within these curly brackets is where the programmer will write the code block that will execute when you submit whatever event you have chosen.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Callback Function in Event Listener:&lt;/u&gt;&lt;br&gt;
&lt;code&gt;element.addEventListener('EventType', callbackFunction())&lt;/code&gt;&lt;br&gt;
The difference in this set up is that instead of defining the block of code within the event listener you have defined the function in another part of your code. Programmers will typically chose to use callback functions because it allows you to use a function multiple times without having repetitive blocks of similar code.&lt;/p&gt;

&lt;p&gt;-Step 3: Choosing what element of your code you want to listen for events. Whether you want to have the listener tied to an image, tab, button, etc.&lt;/p&gt;

&lt;p&gt;For the project example I will show you the code I used to display the information about the in game characters:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PmSevdT3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3pamoz0u2pbk8ksoqocv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PmSevdT3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3pamoz0u2pbk8ksoqocv.png" alt="Image description" width="880" height="746"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above code the element I am choosing from is the image of the "agent" I had set up earlier in the code. The click event is essentially what it sounds like, when the image is clicked on do this =&amp;gt;. In my example I opted for an arrow function due to my code being more linear and this being the only instance of me using this function. I use different variables to create elements in the HTML file and assigned those variables text contents that are pulled from the free API that I was using. Once I have set up the desired content needed I appended each element to the desired div container I had set up in the beginning of the code. Now with the event set up, anytime I click on an "agent" in my browser their name, abilities and description are displayed for the user.&lt;/p&gt;

&lt;p&gt;I am truly thankful that this project required so many event listeners because this allowed me to truly master the concept and be able to apply it in the future without any struggles. I hope that this post helps fellow beginners as they try to simplify concepts and apply them to their own projects. &lt;/p&gt;

&lt;p&gt;As I continue this path to becoming a Software Engineer I look forward to learning more concepts and mastering them and truly turning this passion into a full fledged career.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
