<?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: Ted Larsson</title>
    <description>The latest articles on DEV Community by Ted Larsson (@larssonted).</description>
    <link>https://dev.to/larssonted</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%2F112818%2F4563e06d-881d-4381-af35-f26b1b6c8259.jpg</url>
      <title>DEV Community: Ted Larsson</title>
      <link>https://dev.to/larssonted</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/larssonted"/>
    <language>en</language>
    <item>
      <title>need trello mongodb schema</title>
      <dc:creator>Ted Larsson</dc:creator>
      <pubDate>Wed, 17 Jun 2020 16:04:06 +0000</pubDate>
      <link>https://dev.to/larssonted/need-trello-mongodb-schema-10kk</link>
      <guid>https://dev.to/larssonted/need-trello-mongodb-schema-10kk</guid>
      <description>&lt;p&gt;So I've been trying to find the schemas that trello use for their backend. I have an assignment in my backend course to create a trello clone but with less features, now all i want to know is if they use arrays to keep references&lt;br&gt;
(Example: boardSchema {title: string,&lt;br&gt;
 Lists[&lt;br&gt;
  mongoose.Types.ObjectId, &lt;br&gt;
  ref: List&lt;br&gt;
]}) or if they only keep a reference to the parent &lt;br&gt;
(Example:&lt;br&gt;
 ListSchema {&lt;br&gt;
 Title: string&lt;br&gt;
 BoardId: &lt;br&gt;
 mongoose.Type.ObjectId,&lt;br&gt;
 Ref: Board&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;Anybody got any ideas?&lt;/p&gt;

</description>
      <category>help</category>
    </item>
    <item>
      <title>HELP! can I set a methods value to values from the object in javascript?</title>
      <dc:creator>Ted Larsson</dc:creator>
      <pubDate>Fri, 25 Oct 2019 11:41:42 +0000</pubDate>
      <link>https://dev.to/larssonted/set-a-methods-value-to-values-from-the-object-in-javascript-550f</link>
      <guid>https://dev.to/larssonted/set-a-methods-value-to-values-from-the-object-in-javascript-550f</guid>
      <description>&lt;p&gt;function Rectangle(width, height, x, y){&lt;br&gt;
  this.width = width;&lt;br&gt;
  this.height = height;&lt;br&gt;
  this.x = x;&lt;br&gt;
  this.y = y;&lt;br&gt;
  this.widthString = '\''+width+'px'+'\'';&lt;br&gt;
  this.heightString = '\''+height+'px'+'\'';&lt;br&gt;
  this.area = function() {&lt;br&gt;
    console.log("area: " + this.width * this.height);&lt;br&gt;
  };&lt;/p&gt;

&lt;p&gt;this.newWidth = function (width){&lt;br&gt;
    this.width = width;&lt;br&gt;
  };&lt;/p&gt;

&lt;p&gt;this.newHeight = function (height){&lt;br&gt;
    this.height = height;&lt;br&gt;
  };&lt;/p&gt;

&lt;p&gt;this.translate = function(x,y){&lt;br&gt;
    this.x = x;&lt;br&gt;
    this.y = y;&lt;br&gt;
  };&lt;/p&gt;

&lt;p&gt;this.logValues = function(){&lt;br&gt;
    console.log('width: ' + this.width + '\n' + 'height: ' + this.height + '\n'&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;'top: ' + this.x + '\n' + 'left: ' + this.y);
};&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;this.scale = function(scale){&lt;br&gt;
    this.width *= scale;&lt;br&gt;
    this.height *= scale;&lt;br&gt;
  };&lt;/p&gt;

&lt;p&gt;this.render = function(width, height, x, y, color){&lt;br&gt;
    let rectangle = document.createElement('DIV');&lt;br&gt;
    document.body.appendChild(rectangle);&lt;br&gt;
    rectangle.className = 'rectangle';&lt;br&gt;
    rectangle.style.background = color;&lt;br&gt;
    rectangle.style.width = width;&lt;br&gt;
    rectangle.style.height = height;&lt;br&gt;
    rectangle.style.position = 'absolute'&lt;br&gt;
    rectangle.style.top = x;&lt;br&gt;
    rectangle.style.left =y;&lt;br&gt;
    // rectangle.style.display = 'block';&lt;br&gt;
    // rectangle.style.visibility= 'visible'&lt;br&gt;
    // let text = document.createTextNode("Hi");&lt;br&gt;
    // rectangle.appendChild(text);&lt;br&gt;
  };&lt;br&gt;
  };&lt;/p&gt;

&lt;p&gt;let rectangleOne = new Rectangle(100, 100, 0, 0);&lt;br&gt;
rectangleOne.render('100px', '100px', '0px','0px','green' )&lt;br&gt;
console.log(rectangleOne.widthString, rectangleOne.heightString);&lt;/p&gt;

&lt;p&gt;let rectangleTwo = new Rectangle(200, 300, 10, 10);&lt;br&gt;
rectangleTwo.render('100px','100px','100px','100px','blue' )&lt;br&gt;
rectangleTwo.scale(2);&lt;/p&gt;

&lt;p&gt;is there a way for me to set the height, width, x, y, values in my this.render method to use the values in my function Rectangle(width, height, x ,y)??&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Looking for Linux front-end developer programs</title>
      <dc:creator>Ted Larsson</dc:creator>
      <pubDate>Mon, 12 Aug 2019 15:53:43 +0000</pubDate>
      <link>https://dev.to/larssonted/linux-front-end-developer-programs-2gc4</link>
      <guid>https://dev.to/larssonted/linux-front-end-developer-programs-2gc4</guid>
      <description>&lt;p&gt;So I'm starting a frontend developer course now at the end of August and I want to run Linux on my laptop. Now the school recommend using Windows because of compability reasons. But I wanted to know if there are any good programs for front-end developers on Linux? &lt;/p&gt;

</description>
    </item>
    <item>
      <title>School project</title>
      <dc:creator>Ted Larsson</dc:creator>
      <pubDate>Tue, 11 Dec 2018 13:52:52 +0000</pubDate>
      <link>https://dev.to/larssonted/school-project-5h9p</link>
      <guid>https://dev.to/larssonted/school-project-5h9p</guid>
      <description>&lt;p&gt;So i´m finally done with my calculator, its working and most bugs are done with.&lt;br&gt;
Now i would like to know how to tidy up the code, is there ways to make it more efficient, more user foolproof, simply better ways to code it?&lt;/p&gt;

&lt;pre&gt;&lt;code class="c++"&gt;

// looped calculator

#include 

//variables
float num1;
float num2;
float sum;
char oper;

//functions


int main()
{
    //greets the user
    std::cout &amp;lt;&amp;lt; "welcome to the calculator\n";
    
    //instructions on how to use the program
    std::cout &amp;lt;&amp;lt; "press ENTER after each input and please use only + - * / or 'q' to quit\n";       
    
    //Prompts the user to input number
    std::cout &amp;lt;&amp;lt; "enter number: ";                                                  
    
    // user inputs number
    while (!(std::cin &amp;gt;&amp;gt; num1))
    {
        std::cout &amp;lt;&amp;lt; "enter a number please (enter to confirm): ";
        std::cin.clear();
        std::cin.ignore(100, '\n');
    }
    
    //Prompts the user to input operator or quit the program
    std::cout &amp;lt;&amp;lt; "enter operator or quit (enter to confirm): ";                                     
    
    //user inputs operator or quits
    std::cin &amp;gt;&amp;gt; oper;                                                                       
    

    //Prompts the user to input number
    std::cout &amp;lt;&amp;lt; "enter number (enter to confirm): ";                                                   
    
    while (!(std::cin &amp;gt;&amp;gt; num2))
    {
        std::cout &amp;lt;&amp;lt; "enter a number please (enter to confirm): ";
        std::cin.clear();
        std::cin.ignore(100, '\n');
    }                                                               
    
    //switch loop depending on what operator was chosen
        switch (oper)                                                                           
        {
        case '+':
            sum = num1 + num2;
            break;
        case '-':
            sum = num1 - num2;
            break;
        case '*':
            sum = num1 * num2;
            break;
        case '/':
            sum = num1 / num2;
            break;
        default:
            std::cout &amp;lt;&amp;lt; "enter only valid operators + - * /  (enter to confirm) \n";
            break;
        }
        
        

        while (true)
        {
            //outputs the sum
            std::cout &amp;lt;&amp;lt; sum &amp;lt;&amp;lt; std::endl;                                  
            
            //Prompts the user to input operator
            std::cout &amp;lt;&amp;lt; "enter operator or quit (enter to confirm): ";                         
            
            //user inputs operator or quit the program
            std::cin &amp;gt;&amp;gt; oper;                                                       
            
            //Quits the program
            if (oper == 'q')
                break;
            
            // Prompts the user to input number
            std::cout &amp;lt;&amp;lt; "enter number (enter to confirm): ";                                   
            
            while (!(std::cin &amp;gt;&amp;gt; num2))
            {
                std::cout &amp;lt;&amp;lt; "enter a number please (enter to confirm): ";
                std::cin.clear();
                std::cin.ignore(100, '\n');
            }
            
            //switch loop depending on what operator was chosen
            switch (oper){                                                              
                case '+':
                    sum = sum + num2;
                    break;
                case '-':
                    sum = sum - num2;
                    break;
                case '*':
                    sum = sum * num2;
                    break;
                case '/':
                    sum = sum / num2;
                    break;
                default:
                    std::cout &amp;lt;&amp;lt; "enter only valid operators + - * /  (enter to confirm)\n";
                    break;
            }

        }
            

        
        //outputs sum then quits the program
    std::cout &amp;lt;&amp;lt; sum;                                                                   
    std::cin.ignore();
    std::cin.get();
    return 0;   
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I tried making it look pretty but this is the best i could do :P&lt;/p&gt;

&lt;p&gt;I´ll gladly accept help with how to make code look nice on here because i think i´ll post some more here in the future :D&lt;/p&gt;

</description>
      <category>schoolproject</category>
      <category>neatercode</category>
      <category>beginners</category>
      <category>cpp</category>
    </item>
    <item>
      <title>need help with c++ calculator</title>
      <dc:creator>Ted Larsson</dc:creator>
      <pubDate>Wed, 14 Nov 2018 18:28:46 +0000</pubDate>
      <link>https://dev.to/larssonted/need-help-with-c-calculator-3797</link>
      <guid>https://dev.to/larssonted/need-help-with-c-calculator-3797</guid>
      <description>&lt;p&gt;So I am taking a c++ course and I am on my third assignment. The first was a simple calculator, get 2 numbers and then Display the results for added, subtracted, divided and multiplied. The second one was a simple game that measured the time it took to press a key after the game said go. Now they've turned it up several notches and I'm doing a full blown calculator without the GUI, and I'm stuck. I don't even know where to start. The user must be able to add, subtract, multiply and divide as many times as he/she/it wants then get the result of be able to clear and start over. Now as far as pseudo code goes I've gotten so far as : Get user input number 1, operator, number 2, sum, put sum into vector, show sum and get next input, sum, put into vector loop this until user either decides to clear or wants the sum. An I totally wrong here? Now I don't want all the code written for me, I mean I want to learn this I just want a nudge in the right way of thinking 😊&lt;/p&gt;

</description>
      <category>help</category>
      <category>cpp</category>
      <category>homework</category>
    </item>
    <item>
      <title>what keyboard to choose?</title>
      <dc:creator>Ted Larsson</dc:creator>
      <pubDate>Sun, 11 Nov 2018 23:01:37 +0000</pubDate>
      <link>https://dev.to/larssonted/in-need-of-help-4j7m</link>
      <guid>https://dev.to/larssonted/in-need-of-help-4j7m</guid>
      <description>&lt;p&gt;so as the title says, i am in need of help here.&lt;br&gt;
I am currently using a steelseries Apex m800 to type on.&lt;br&gt;
I started to take a coding class about a month ago and realized that the keyboard i am using is not comfortable to type on.&lt;br&gt;
So i tried a bunch of different keyboards and i am now trying to choose between 2 keyboards that are vastly different. A 60% ducky one 2 mini with silent red Cherry mx switches and a Logitech Craft. i tried the Little brother to the Craft and enjoyed the experience but there where minor things that bothered me, namely no light on the keycaps and the placement of the Arrow keys. Now the reason i am considering the ducky one 2 mini is the portability and i just like the over all look of it. Now on to the main dilemma, i like using the arrowkeys and the numpad. but is there an advantage to choosing the mini and Learning to use short commands and remapping of the keys?  &lt;/p&gt;

</description>
      <category>discuss</category>
      <category>devtips</category>
      <category>help</category>
    </item>
  </channel>
</rss>
