<?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: Tim</title>
    <description>The latest articles on DEV Community by Tim (@tim_tr).</description>
    <link>https://dev.to/tim_tr</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%2F208462%2F7bddfbb0-a003-4981-bcf7-407b89a6153b.png</url>
      <title>DEV Community: Tim</title>
      <link>https://dev.to/tim_tr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tim_tr"/>
    <language>en</language>
    <item>
      <title>When did you start programming? Do you wish you started earlier?</title>
      <dc:creator>Tim</dc:creator>
      <pubDate>Sun, 11 Aug 2019 10:01:55 +0000</pubDate>
      <link>https://dev.to/tim_tr/when-did-you-start-programming-do-you-wish-you-started-earlier-1abb</link>
      <guid>https://dev.to/tim_tr/when-did-you-start-programming-do-you-wish-you-started-earlier-1abb</guid>
      <description>&lt;p&gt;I started programming when I was 15 (I'm 17 now) and I'm quite happy about that I think. I'm happy partly because I've had the chance to explore the world of coding and tech so I can make a good choice about what I want to specialize in later.&lt;/p&gt;

&lt;p&gt;Although I say this, I still feel there is so much more to learn and sometimes I wonder if starting out earlier would've helped. Although I should have enough time to learn all those things later in my life, I think starting out early would benefit me as you learn the most when you're young.&lt;/p&gt;

&lt;p&gt;This got me wondering about at what age the developers in here started programming and when they wish they started programming.&lt;/p&gt;

&lt;p&gt;Thanks for all the replies in advance!&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Advanced Python: OOP polymorphism</title>
      <dc:creator>Tim</dc:creator>
      <pubDate>Thu, 08 Aug 2019 12:05:35 +0000</pubDate>
      <link>https://dev.to/tim_tr/advanced-python-oop-polymorphism-5a80</link>
      <guid>https://dev.to/tim_tr/advanced-python-oop-polymorphism-5a80</guid>
      <description>&lt;p&gt;A great deal in programming is about the so called 'Object Oriented' side of programming.&lt;/p&gt;

&lt;p&gt;Python supports OOP  as well. This tutorial will show you how to implement polymorphism in your Object Oriented code.&lt;/p&gt;

&lt;p&gt;Polymorphism is all about a superclass that has multiple subclasses. The subclasses inherit from the superclass and the superclass doesn't need to know which subclass is currently inheriting and executing.&lt;br&gt;
Don't worry if this doesn't make sense yet, take a look at the following example for clarification:&lt;/p&gt;

&lt;p&gt;Let's say we have a program that shows images, but the image can be either of PNG  or JPG format. In our case the program will print different things based on the format of the image.&lt;/p&gt;

&lt;p&gt;So we'll start by making the base class that all the subclasses will inherit from. The class will also print an error when the image has a wrong extension.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvh70wqipsmoss7174oba.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvh70wqipsmoss7174oba.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now onto the subclasses which will inherit from the 'Image' class. The classes also have a method called 'show' which will print a custom message.&lt;br&gt;
Notice how the parent/superclass doesn't need to know which subclass is inheriting in order to work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fh86jutvfnoi8eawba7cq.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fh86jutvfnoi8eawba7cq.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's make the objects and call the 'show' methods:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Farz6qeurpiap0xun91py.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Farz6qeurpiap0xun91py.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here's the output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fnhjmekj59h9x3seze0s3.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fnhjmekj59h9x3seze0s3.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you learned something and see you in the next post :) !&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Why you should always HTML encode your input</title>
      <dc:creator>Tim</dc:creator>
      <pubDate>Wed, 07 Aug 2019 23:52:37 +0000</pubDate>
      <link>https://dev.to/tim_tr/why-you-should-always-html-encode-your-input-1gmf</link>
      <guid>https://dev.to/tim_tr/why-you-should-always-html-encode-your-input-1gmf</guid>
      <description>&lt;p&gt;The website you just built might be a beautiful, well-coded masterpiece but the time it may take to break/crash is not very long without this piece of code.&lt;/p&gt;

&lt;p&gt;You probably already heard of the topic: website security.&lt;br&gt;
I will show you a simple trick that will work as a defense against hackers that try to break in or exploit your website using 'xss' (cross-site scripting).&lt;/p&gt;

&lt;p&gt;Of course this is just a basic countermeasure and if you want to know more, google will guide you by typing in xss ;) . Also, this is my first post here so any advice or suggestions regarding my post are always welcome.&lt;/p&gt;

&lt;p&gt;Now onto the more interesting stuff:&lt;/p&gt;

&lt;p&gt;Let's say for example you have a section on your website where you ask for the user's input and show that exact input back to them (think of comments on a blog, etc). If we didn't sanitize the input given by the user, we would have a lot of problems.&lt;/p&gt;

&lt;p&gt;What if the user were to type in "alert(&amp;amp;#39;oops&amp;amp;#39;)" for example?&lt;br&gt;
Well, the comment that the website will show back will contain that very string which in fact will show nothing (an empty comment), what it will however do is give every user on the page a pop-up saying "oops".&lt;br&gt;
Now, this is all very fun and not too serious yet, because the hacker could also start loading in malicious scripts and start modifying the page.&lt;/p&gt;

&lt;p&gt;Now, take a look at this little test website:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fgoqtw6tgeefbjn2aghs2.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fgoqtw6tgeefbjn2aghs2.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This website will take whatever the user types into the input box and show it into a div below that box.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fccrrxmvz9assz7g2o9ws.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fccrrxmvz9assz7g2o9ws.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To sanitize that input in PHP is very simple, in fact we only need to use 1 function: htmlspecialchars();&lt;br&gt;
 Take a look at the following code snippet:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6svlebabbu8tcao1023l.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6svlebabbu8tcao1023l.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's test it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fx6kyn043j1kqvzk2wen7.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fx6kyn043j1kqvzk2wen7.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa0mbcw049vlmr1h5fz78.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa0mbcw049vlmr1h5fz78.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But what happened behind the scenes?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fpih57gzjjfi8ts2upnmo.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fpih57gzjjfi8ts2upnmo.PNG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PHP changed '&amp;lt;' into '&amp;amp; lt;' and '&amp;gt;' into '&amp;amp; gt;'. Now HTML can properly show these characters without thinking it is an actual tag.&lt;/p&gt;

&lt;p&gt;So there we go, we made our first step to a safer website!&lt;/p&gt;

&lt;p&gt;Thank you for taking your time to read my post!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>php</category>
    </item>
  </channel>
</rss>
