<?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: Eisea904</title>
    <description>The latest articles on DEV Community by Eisea904 (@eisea904).</description>
    <link>https://dev.to/eisea904</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%2F451002%2Ff04872a1-7e9f-406b-96dd-cef917313bea.jpg</url>
      <title>DEV Community: Eisea904</title>
      <link>https://dev.to/eisea904</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eisea904"/>
    <language>en</language>
    <item>
      <title>Public Domain vs Open Source and copyright resources</title>
      <dc:creator>Eisea904</dc:creator>
      <pubDate>Thu, 15 Oct 2020 19:50:17 +0000</pubDate>
      <link>https://dev.to/eisea904/public-domain-vs-open-source-and-copyright-resources-59ni</link>
      <guid>https://dev.to/eisea904/public-domain-vs-open-source-and-copyright-resources-59ni</guid>
      <description>&lt;h2&gt;
  
  
  Public Domain
&lt;/h2&gt;

&lt;p&gt;*How is it different from Open Source?&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Open Source Licenses
&lt;/h2&gt;

&lt;p&gt;*Is your program copyrightable?&lt;/p&gt;

&lt;h2&gt;
  
  
  Citation and Resources
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt;&lt;br&gt;
 While the designations 'Public Domain' and 'Open Source' can both imply a communal goal they are distinct and well intentioned, careful programmers should make themselves aware of the difference.  Public Domain is a designation assigned and maintained by governments and can vary widely across &lt;br&gt;
borders.&lt;br&gt;&lt;br&gt;
 For instance, &lt;a href="https://imslp.org/wiki/Main_Page"&gt;IMSLP&lt;/a&gt; the International Music Score Library Project hosts an api that allows primarily classical music researchers and performers to access a massive database of musical scores (sheet music).  The server however is based in Canada where copyright ends sooner after the creator's death than in America.  If this api were used in an American for profit program, there could be penalties incurred if rights are infringed upon.    Another example comes from game systems. After all one of the most common applications of software is with gaming.  &lt;a href="https://5e.tools/"&gt;5e.Tools&lt;/a&gt; and &lt;a href="https://thetrove.is/"&gt;TheTrove&lt;/a&gt; are resources for tabletop gaming that must be hosted in other countries due to differences in what qualifies as Public Domain.  There is currently an explosion of applications designed for these games and systems and yet programmers must be careful not to use pirated sources that conflict with either their own morals or the laws of their governments.  On the internet piracy is everywhere, and the term 'piracy' often covers more shades of gray than just bootlegging movies.  In our work we may make programs for a wide variety of fields in which we ourselves are not professionals.  This is only one way in which we must always be aware of and investigating the implications of our work.&lt;/p&gt;

&lt;p&gt;As well, Open Source is not necessarily Public Domain.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Open Source is a label and license actively included by the author; Public Domain is a category of intellectual resources designated by governments&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Furthermore, a program or document are not inherently Open Source merely by the author's decision not to include licensing, rather in the USA the lack of clarity will force it to be considered under a type of implicit copyright, one that as collaborators take and build upon your project, may soon disclude you the original creator.  Some sharing sites include a form of open source documentation in their mandatory User Agreements, &lt;a href="https://github.com/"&gt;Github&lt;/a&gt; is just one of these.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; &lt;br&gt;
 There are many different &lt;a href="https://choosealicense.com/licenses/#unlicense"&gt;open source licenses&lt;/a&gt; .  Some confer more or less freedom to use, build upon, and distribute programs built upon the original code.  In general, programmatic systems cannot be copyrighted, but the literal written code and documentation and the expression thereof can.  And if your code builds on someone else's earlier code, then you may be able to copyright your additions, but this would not include any original components of the base code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; &lt;br&gt;
Referencing Code&lt;br&gt;
&lt;a href="https://runestone.academy/runestone/books/published/StudentCSP/CSPCreativity/referencing.html"&gt;https://runestone.academy/runestone/books/published/StudentCSP/CSPCreativity/referencing.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copyright Registration of&lt;br&gt;
Computer Programs&lt;br&gt;
&lt;a href="https://www.copyright.gov/circs/circ61.pdf"&gt;https://www.copyright.gov/circs/circ61.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do you know if your code is open source?&lt;br&gt;
&lt;a href="https://www.publicknowledge.org/blog/do-you-know-if-your-code-is-open-source/"&gt;https://www.publicknowledge.org/blog/do-you-know-if-your-code-is-open-source/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Types of Open Source Licenses&lt;br&gt;
&lt;a href="https://choosealicense.com/licenses/#unlicense"&gt;https://choosealicense.com/licenses/#unlicense&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Public Domain Is Not Open Source&lt;br&gt;
&lt;a href="https://opensource.org/node/878#:%7E:text=%E2%80%9COpen%20Source%E2%80%9D%20describes%20a%20subset,with%20the%20Open%20Source%20Definition.&amp;amp;text=%E2%80%9CPublic%20Domain%E2%80%9D%20means%20software%20(,is%20not%20restricted%20by%20copyright"&gt;https://opensource.org/node/878#:~:text=%E2%80%9COpen%20Source%E2%80%9D%20describes%20a%20subset,with%20the%20Open%20Source%20Definition.&amp;amp;text=%E2%80%9CPublic%20Domain%E2%80%9D%20means%20software%20(,is%20not%20restricted%20by%20copyright&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Common Mistakes when Beginning Rails</title>
      <dc:creator>Eisea904</dc:creator>
      <pubDate>Mon, 05 Oct 2020 14:37:49 +0000</pubDate>
      <link>https://dev.to/eisea904/common-mistakes-when-beginning-rails-16ok</link>
      <guid>https://dev.to/eisea904/common-mistakes-when-beginning-rails-16ok</guid>
      <description>&lt;p&gt;Several steps can go wrong when setting up a new rails api.  This article will hopefully help debug issues that may arise.&lt;/p&gt;

&lt;p&gt;Often when learning any new coding material, example variables like 'project name' are written with with brackets on either side.  This is a reminder not to include those brackets.  File and repository names can also be easier to reference without typos if they do not contain spaces.  The example code below to create a new rails project would be written in the following way:&lt;br&gt;
&lt;code&gt;$ rails new &amp;lt;project name&amp;gt; --api --database=postgresql&lt;/code&gt;&lt;br&gt;
&lt;code&gt;$ rails new project_name_api --api --database=postgresql&lt;/code&gt;&lt;br&gt;
By including 'api' in the project name we know that this repo only contains our back end and is separate from the frontend.&lt;/p&gt;

&lt;p&gt;Next we will talk about creating our migrations and models.  There are several pieces of information that go into creating a new model, the Name, attributes, associations, and more; these three will be discussed here with examples.  Our example will be a Teacher model that has_many assignments and a joiner model Assignment that belongs to both a Teacher and Student. &lt;br&gt;
&lt;em&gt;'g' is short for 'generate', either can be used here; I will be using 'g'.&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Teacher --&amp;lt; Assignment &amp;gt;-- Student&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ rails g model Teacher name:string&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the model name 'Teacher' is always capitalized&lt;/li&gt;
&lt;li&gt;if attribute type (name is a string) is not given, then the attribute type will default to a string.  Thus the above code could be written as:
&lt;code&gt;$ rails g model Teacher name&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;A Teacher has_many Assignments, however this is not the place to include has_many. &lt;strong&gt;Do NOT&lt;/strong&gt; include something like 'assignments:has_many' in this console command.  has_many associations only go in the 'app/models' folder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;$ rails g model Assignment name:string teacher_id:integer student_id:integer&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;OR&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;$ rails g model Assignment name:string teacher:belongs_to student:belongs_to&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For our Assignment model either of these will work.  The associations can be written either as &lt;code&gt;teacher_id:integer&lt;/code&gt; or with the &lt;code&gt;teacher:belongs_to&lt;/code&gt; macro which will generate a foreign_key as an integer.  The functionality is the same, but the result will look different in the migration folder.  If both are included in the console command, the error &lt;code&gt;ArgumentError: you can't define an already defined column 'user_id'&lt;/code&gt; will appear when you run db:create and you will not be able to make a 'db/schema' folder or seed any data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After this, you will put the associations &lt;code&gt;belongs_to :teacher&lt;/code&gt; and &lt;code&gt;belongs_to :student&lt;/code&gt; in the 'app/models' Assignment file.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Rails Landmarks - Don't Get Lost!</title>
      <dc:creator>Eisea904</dc:creator>
      <pubDate>Tue, 15 Sep 2020 04:51:20 +0000</pubDate>
      <link>https://dev.to/eisea904/rails-landmarks-don-t-get-lost-1hme</link>
      <guid>https://dev.to/eisea904/rails-landmarks-don-t-get-lost-1hme</guid>
      <description>&lt;p&gt;Opening a repository that uses &lt;strong&gt;Ruby on Rails&lt;/strong&gt; can be an intimidating experience to those new to the experience.  There are many folder with many folders with many files. However just like moving to a new city, once familiarized with major landmarks you can begin to enjoy your drive to work and find new things to love in this new big city!&lt;/p&gt;

&lt;p&gt;Let's take a look at the file tree to see what fun things there are in this town.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hd1Ae5T1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hps5461o9biadf7hqoir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hd1Ae5T1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hps5461o9biadf7hqoir.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There's a lot here, even before expanding most of these folders.  We're going to look at two groups - landmark folders in app_folder/app and landmark files outside the /app folder.  We'll go over the primary function of each item.  A simplified filed tree is below:&lt;/p&gt;

&lt;p&gt;app_folder/&lt;br&gt;
    --&amp;gt; app/assets/stylesheets/&lt;br&gt;
    --&amp;gt; app/controllers/&lt;br&gt;
    --&amp;gt; app/models/&lt;br&gt;
    --&amp;gt; app/views/&lt;br&gt;
app_folder/&lt;br&gt;
    --&amp;gt; config/routes.rb&lt;br&gt;
    --&amp;gt; db/&lt;br&gt;
    --&amp;gt; --&amp;gt; migrate/&lt;br&gt;
    --&amp;gt; --&amp;gt; schema.rb&lt;br&gt;
    --&amp;gt; --&amp;gt; seeds.rb&lt;/p&gt;

&lt;p&gt;The app folder houses our MVC, &lt;strong&gt;Model View Controller&lt;/strong&gt; folders.  These are three of the most beautiful parks in the city, and powerful tools that rails gives us.  Our model folder houses associations: our &lt;code&gt;belongs_to&lt;/code&gt;s &lt;code&gt;has_many&lt;/code&gt;s, and &lt;code&gt;validates&lt;/code&gt;es.  With this, our program can understand that a comment &lt;code&gt;belongs_to :post&lt;/code&gt; and that a user can &lt;code&gt;have_many :posts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Controller holds the methods that each model can use.  Most models (a site's &lt;em&gt;users&lt;/em&gt;, Facebook's &lt;em&gt;posts&lt;/em&gt;) can be created, read, updated, and destroyed (CRUD), among other capabilities like &lt;em&gt;sign in&lt;/em&gt;.  The view folder holds the .html files, literally what your audience views on the browser.  There should be a folder for each model, each with a .html.erb file for every action or page you give that model.  assets/stylesheets contains .css files, one for each model.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5noJi5vF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/l757jmoludjh9ta7s4pj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5noJi5vF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/l757jmoludjh9ta7s4pj.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you cruise through your new town you're likely to see many road signs, some with directions and arrows, others with advertisements of what is nearby.  Our config/routes.rb files is where to find most or all of the arrows and paths that a user on your site with be sent down.  This is where we find our verbs: &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;post&lt;/code&gt;, &lt;code&gt;patch&lt;/code&gt;, &lt;code&gt;delete&lt;/code&gt;, etc.  A simple tool for knowing how to write these paths is RESTular.com .  Your migrate folder houses all your migrations and the schema.rb folder shows all of the elements that go into your models.  &lt;/p&gt;

&lt;p&gt;If you have children you will no doubt want to help them feel safe at home in this new town.  The seeds.rb file is the backseat of your minivan, with plenty of room for all your rambunctious example material and class instances.&lt;br&gt;
There is a lot to see in this new home of yours. Relax and enjoy the ride!&lt;/p&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
    </item>
    <item>
      <title>A Common Error and a Debugging Tool, end &amp; pry</title>
      <dc:creator>Eisea904</dc:creator>
      <pubDate>Tue, 01 Sep 2020 17:02:30 +0000</pubDate>
      <link>https://dev.to/eisea904/a-common-error-and-a-debugging-tool-end-pry-9b4</link>
      <guid>https://dev.to/eisea904/a-common-error-and-a-debugging-tool-end-pry-9b4</guid>
      <description>&lt;p&gt;When starting Ruby, there are common errors you will undoubtedly encounter.  Here we will look at the most common of these and a powerful debugging tool, pry.&lt;/p&gt;

&lt;p&gt;Example 1&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KylNNzZM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dvgnwf1bxcuon8ncucj8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KylNNzZM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dvgnwf1bxcuon8ncucj8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most common errors will look like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;blog_examples.rb:10: syntax error, unexpected end-of-input, expecting end'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let’s dissect this…&lt;/p&gt;

&lt;p&gt;&lt;code&gt;file_name:line_that_returns_error: error_type, details&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This error is telling us that our file is missing an &lt;code&gt;end&lt;/code&gt;. The part that may confuse beginners is that it is line 10 that gives us the error. This may be misinterpreted as "line 10 needs an end." Actually, it is telling us that by the end of the file (line 10) it was expecting at least one more &lt;code&gt;end&lt;/code&gt; than is present. And now we know that one of our methods is missing an &lt;code&gt;end&lt;/code&gt;. Looking through, we can see that #gossip(name) needs this fix.&lt;/p&gt;

&lt;p&gt;Example 2&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CVy5j1tJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3aopxqygvp1pzpekh8ea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CVy5j1tJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3aopxqygvp1pzpekh8ea.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The sister error to this is&lt;br&gt;
&lt;code&gt;blog_examples.rb:8: syntax error, unexpected end', expecting end-of-input&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There is now an extra &lt;code&gt;end&lt;/code&gt; that we forgot to delete when we deleted #say_goodbye!&lt;/p&gt;

&lt;p&gt;Pry is an invaluable tool in debugging, but it can also be confusing so let's talk about how to use it and what it can and can't do.  Firstly, unless you know it's included elsewhere in your environment, add &lt;code&gt;require 'pry'&lt;/code&gt; to the first line of any file you want to use it in.  Go to the line or end of the section you want to test, hit enter/return to make a blank line and there put &lt;code&gt;binding.pry&lt;/code&gt; .&lt;br&gt;&lt;br&gt;
 When this program is run, it will pause at that line and be able to access everything within its scope that came prior.  The binding.pry will not be hit if that piece of code is not run.  If you are using it within a method, then at the end of your code you need to call that method to run it.  In the example above we call on &lt;code&gt;#say_goodbye&lt;/code&gt; at the end with &lt;code&gt;say_goodbye(John)&lt;/code&gt; .  If we put a &lt;code&gt;binding.pry&lt;/code&gt; inside of the &lt;code&gt;#say_goodbye&lt;/code&gt; method, it will only now be hit.  Pry can also only access information within its scope, so within a pry session, we cannot access variables defined within other methods, for example.&lt;/p&gt;

&lt;p&gt;Once pry is working, you will see in your computer's terminal the word pry and a colon.  Here you can type ideas for the following lines.  It's a sandbox, so instead of deleting your code to try an idea and then saving it only to delete that and try your next idea (and so on...) we can simply type ideas in the pry session.  When we are done, type exit to go up one layer toward your normal terminal (and usually pry sessions are only one layer deep). &lt;code&gt;exit!&lt;/code&gt; will always take you completely out of a pry session.&lt;/p&gt;

&lt;p&gt;In example 3 our binding.pry can be used to check what is being passed as the variable name_as_string.  When you type &lt;code&gt;name_as_string&lt;/code&gt; into the pry session in your terminal, it should give us "John".  However, anything inside the prior method #say_hello is outside the scope of #say_goodbye , so we cannot access those things while pry is on its current line.&lt;/p&gt;

&lt;p&gt;Example 3&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rapR3XV2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fsl25p4d4tbodjsqh41n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rapR3XV2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fsl25p4d4tbodjsqh41n.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A note on pry, it will not "tell you" what is wrong with your code.  It will however save you time and give you your error messages much more quickly than if you had to change your code within the file and save with each attempt or idea.  &lt;/p&gt;

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