<?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: Bryan Sun </title>
    <description>The latest articles on DEV Community by Bryan Sun  (@truetallman).</description>
    <link>https://dev.to/truetallman</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%2F941920%2F5544433f-9b0a-43a0-8441-5089d4395d49.png</url>
      <title>DEV Community: Bryan Sun </title>
      <link>https://dev.to/truetallman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/truetallman"/>
    <language>en</language>
    <item>
      <title>Final Project walkthrough P.1</title>
      <dc:creator>Bryan Sun </dc:creator>
      <pubDate>Tue, 24 Jan 2023 19:58:25 +0000</pubDate>
      <link>https://dev.to/truetallman/final-project-walkthrough-p1-3lme</link>
      <guid>https://dev.to/truetallman/final-project-walkthrough-p1-3lme</guid>
      <description>&lt;p&gt;At the end of the bootcamp we are to create an app as our capstone project. With the ability to pick whatever topic you want to work on, it gives the students a chance to really explore coding with a something they have a connection to. This has a similar feel to our previous group project but this time working solo. However no matter how much time you are given it will never feel like enough. &lt;/p&gt;

&lt;p&gt;Armed with the knowledge of a ruby backend and react as the face, it is a challenge nonetheless. Working with visible milestones helped pace out the completion of the project. This blog will talk about the set up of the backend of ruby and the implementation of a log-in function. &lt;/p&gt;

&lt;p&gt;The backend was fairly simple as the vision for this application is a blog with the flair of Instagram/Pinterest. The app is to be centered around interior design and decor and allowing users to post and share photos they found on the internet or of their own design/curation. The unique feature is to be that users are encourage to highlight pieces in the photo so that others who are curious can identify and look for the piece if they want to it. &lt;/p&gt;

&lt;p&gt;So the app will have Users, Posts, Likes, Comments, and Descriptions on the back end. Utilizing a template to set up the app made it fairly simple. While an error did occur early on with no resolution requiring a hard restart, it did lead to a learning that while copy and pasting of code is not bad, it can easily lead to a domino effect of issues down the line. &lt;/p&gt;

&lt;p&gt;Another learning was understanding how your tables talk to each other. How does an user interact with a post via their likes or their comments. how does it look in the back end. what belongs to what or what only has one of? understanding this concept will lead to a strong foundation that will not need to be modified, leading to potential issues. &lt;/p&gt;

&lt;p&gt;After triple or quadruple checking your tables, you can then finally run the following commands: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails db:create&lt;br&gt;
rails db:migrate&lt;br&gt;
rails db:seed&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Seeing no errors means that you have a working database and now is onto connecting the tables together and giving them functionality. This will be for the next part of the final project walkthrough.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>The Auth Boys</title>
      <dc:creator>Bryan Sun </dc:creator>
      <pubDate>Thu, 05 Jan 2023 16:24:58 +0000</pubDate>
      <link>https://dev.to/truetallman/the-auth-boys-5575</link>
      <guid>https://dev.to/truetallman/the-auth-boys-5575</guid>
      <description>&lt;p&gt;Authorization and authentication are important concepts in security, and are often implemented in web applications to control access to  resources or functionalities. &lt;/p&gt;

&lt;p&gt;Authentication refers to the process of verifying the identity of a user or client, often through the use of a username and password. In a Ruby application, authentication can be implemented using the Devise gem, which provides a flexible and easy-to-use authentication solution.&lt;/p&gt;

&lt;p&gt;To use Devise, you will first need to install it by adding it to your Gemfile and running the bundle install command. Next, you will need to run the Devise generator to create the necessary configuration files and routes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rails generate devise:install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running the generator, you will need to set up your application to use Devise by adding it to your model (e.g. User) and specifying the authentication strategies you want to use (e.g. :database_authenticatable, :registerable, etc.).&lt;/p&gt;

&lt;p&gt;Once you have configured Devise, you can use its helper methods to authenticate users in your controllers and views. For example, you can use the authenticate_user! method in a controller to require that a user be signed in before accessing a certain resource:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;before_action :authenticate_user!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use the current_user helper method in your views to display information about the currently signed-in user.&lt;/p&gt;

&lt;p&gt;Authorization, on the other hand, refers to the process of determining whether a user or client has the necessary permissions to access a certain resource or perform a certain action. In a Ruby on Rails application, authorization can be implemented using the CanCanCan gem, which provides a flexible and easy-to-use authorization solution.&lt;/p&gt;

&lt;p&gt;To use CanCanCan, you will first need to install it by adding it to your Gemfile and running the bundle install command. Next, you will need to run the CanCanCan generator to create the necessary configuration files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rails generate cancan:ability
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running the generator, you will need to define the abilities of your users in the Ability class that was created. This is typically done using a block syntax, where you specify the actions that a user is allowed to perform and the conditions under which they are allowed to perform them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;can :read, Article, published: true
can :create, Article, user_id: user.id
can :update, Article, user_id: user.id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then use the authorize! method in your controllers to ensure that a user has the necessary permissions to access a certain resource or perform a certain action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;authorize! :read, @article
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In summary, Devise and CanCanCan are useful tools for implementing authentication and authorization in a Ruby on Rails application. Devise provides a flexible and easy-to-use authentication solution, while CanCanCan provides a flexible and easy-to-use authorization solution. Together, these tools allow you to control access to resources and functionality in your application, helping to ensure the security of your application and its users.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Sinatra</title>
      <dc:creator>Bryan Sun </dc:creator>
      <pubDate>Tue, 06 Dec 2022 17:44:59 +0000</pubDate>
      <link>https://dev.to/truetallman/sinatra-5cj4</link>
      <guid>https://dev.to/truetallman/sinatra-5cj4</guid>
      <description>&lt;p&gt;We all know that the internet sends and receives data. But how does it really work? Where is the information stored and how? &lt;/p&gt;

&lt;p&gt;Sinatra is a web framework that helps build small web applications. with rack-based application, we can now handling HTTP request and response which is how the internet operates. &lt;/p&gt;

&lt;p&gt;Within our code we will want to include &lt;code&gt;gem 'sinatra'&lt;/code&gt;. Then we will want to run "bundle install:" in our terminal to get the Sinatra gem from the Gemfile.&lt;/p&gt;

&lt;p&gt;then you can create a file with any name and end it with a .rb ex: file_name.rb&lt;/p&gt;

&lt;p&gt;within that file, include at the top &lt;code&gt;require 'sinatra'&lt;/code&gt; and in order to start a simple run we will include this code:&lt;/p&gt;

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

&lt;p&gt;then in the terminal run ruby file_name.rb. Now in the output after running the .rb file we will see a line that is showing "listening on tcp::// XXX.X.X.X.XXXX. the last four digits will be the local host port.&lt;/p&gt;

&lt;p&gt;putting locahost:XXXX into your browser will display the code we had inputted earlier. Now we have a simple Sinatra application running.&lt;/p&gt;

&lt;p&gt;Sending HTML &amp;amp; JSON Responses:&lt;br&gt;
A feature of note in Sinatra is it's ability to send responses back in different formats, such as ruby into HTML or to JSON. This simplifies our server side code and provides flexibility.&lt;br&gt;
You can simply write string method into your Sinatra code for it to be output. &lt;/p&gt;

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

&lt;p&gt;While a JSON strong can be created by utilizing the &lt;code&gt;.to_json&lt;/code&gt; method at the endo the code you want to output &lt;/p&gt;

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

&lt;p&gt;This will be an ongoing blog as I learn more about the usages of Sinatra. For a further dive into the different routes with Sinatra, take a look at this link: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://sinatrarb.com/intro.html"&gt;https://sinatrarb.com/intro.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ruby</category>
    </item>
    <item>
      <title>My thoughts on learning coding</title>
      <dc:creator>Bryan Sun </dc:creator>
      <pubDate>Mon, 24 Oct 2022 19:48:34 +0000</pubDate>
      <link>https://dev.to/truetallman/my-thoughts-on-learning-coding-2eda</link>
      <guid>https://dev.to/truetallman/my-thoughts-on-learning-coding-2eda</guid>
      <description>&lt;p&gt;Learning to code is something that has been a mainstay in my adult life. From young adults who want to get into a new career or adults who want to "learn something new".&lt;/p&gt;

&lt;p&gt;Growing up around technology and the progress it has made in my lifetime has built an association that computers and technology is approachable but the systems that propagate up us end-users is a vast sea of numbers and texts that will either engulf you or spit you right out. &lt;/p&gt;

&lt;p&gt;And that's where I stood not knowing what would happen to me. As someone who has little to no knowledge of the back-end workings, I was worried that this transition in my professional life would land me right at where I started more confused and frustrated than before.&lt;/p&gt;

&lt;p&gt;However after a few weeks of being in a coding bootcamp, there was a self realization that you have to be self serving. How dedicated, how curious you are will grow your inner-developer into the professional that you see yourself as. So while the progress can be slow, it can amount to something comprehensive, like rivers fueling the ocean.&lt;/p&gt;

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