<?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: tmblog</title>
    <description>The latest articles on DEV Community by tmblog (@tmblog).</description>
    <link>https://dev.to/tmblog</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%2F211088%2F56b16588-a2e4-4134-920c-a5f6397b30c4.png</url>
      <title>DEV Community: tmblog</title>
      <link>https://dev.to/tmblog</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tmblog"/>
    <language>en</language>
    <item>
      <title>Favourite free places to learn to code</title>
      <dc:creator>tmblog</dc:creator>
      <pubDate>Mon, 04 Nov 2019 21:32:24 +0000</pubDate>
      <link>https://dev.to/tmblog/favourite-free-places-to-learn-to-code-1g6m</link>
      <guid>https://dev.to/tmblog/favourite-free-places-to-learn-to-code-1g6m</guid>
      <description>&lt;p&gt;I teach programming to children aged from 11 onwards, admittedly it is a very hard thing to do. It isn't like your traditional subjects in academia like languages or maths.&lt;br&gt;
Although smart devices are ubiquitous, and majority of children are familiar with using them, learning to understand how a program works/created is very different.&lt;/p&gt;

&lt;p&gt;We start with ideas of repetition (loops) and saving things (variables) for later use. Some get it some don't, it's hard for students to understand how this is fits in without knowing the inner workings or without any other background knowledge.&lt;/p&gt;

&lt;p&gt;I find practicing to code a good way to learn so here are a few places I use in the classroom, all are free of course!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://scratch.mit.edu/projects/editor/?tutorial=all"&gt;Scratch&lt;/a&gt;, easy to get into very interactive for novices. Helps students understand by using easy to use blocks to make complex things.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.freecodecamp.org/"&gt;Freecodecamp&lt;/a&gt;, a very good place to learn about really complex stuff. Includes HTML, CSS, JS, OOP, and so much more! And all certified as well! Highly recommended. Students read small tutorials and complete code challenges so instantly see result's feedback.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://open.appacademy.io/"&gt;App Academy&lt;/a&gt;, amazing full stack engineer course. This is for the ones who have already learned to code and want to persue a career.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.codecademy.com/learn/learn-python"&gt;Code Academy Python&lt;/a&gt;, learn to program using Python 2. They have Python 3 and others but it is premium. But the free Python 2 is well worth the time to learn the ideas and concepts behind it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.learnpython.org/"&gt;Learn Python&lt;/a&gt;, somewhat easy to use but gets hard very quickly but still good for free!&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I hope this helps others, if you have any questions and or know of other interactive programming tools online to teach coding please share, the children and I would highly appreciate!&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Load JSON to modal</title>
      <dc:creator>tmblog</dc:creator>
      <pubDate>Fri, 01 Nov 2019 19:38:51 +0000</pubDate>
      <link>https://dev.to/tmblog/load-json-to-modal-2fdd</link>
      <guid>https://dev.to/tmblog/load-json-to-modal-2fdd</guid>
      <description>&lt;p&gt;Hi, I need a bit help loading some JSON onto a modal window using Javascript. Here's the JSON:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
"Shirts":[{"id":63, "name":"Winter Style", "price":9.99,&lt;br&gt;
 "options": [{"name":"large", "price":2.99},{"name":"Small", "price":1.99}]&lt;br&gt;
}]&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I create markup with the parent product above e.g. &lt;strong&gt;Winter Shirt and price&lt;/strong&gt; with an add to cart button, I would like to load a modal with the &lt;strong&gt;options&lt;/strong&gt; and then add to the price of the parent product e.g. 9.99 + 1.99.&lt;/p&gt;

&lt;p&gt;What would be a good way to go about loading the options on a modal and then matching it up with its parent product. There will be a few products that may or may not have the options.&lt;/p&gt;

&lt;p&gt;EDIT:&lt;br&gt;
Currently I have some items without the options which gets added to an array &lt;code&gt;items&lt;/code&gt; with a javascript event. The item data are loaded onto a button with data attributes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;button class="proAdd btn-sm" data-id="2117" data-price="3.45" data-name="Basic Jeans"&amp;gt;Add&amp;lt;/button&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On the event handler:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var name = $(this).attr("data-name");&lt;br&gt;
var price = parseFloat($(this).attr("data-price"));&lt;br&gt;
var id = parseInt($(this).attr("data-id"));&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var item = {"id":id, "name": name,"price": price}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is just part of the code:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cartItems.items.push(item);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I suppose I'd need to somehow check if the product contains options then combine it with the &lt;code&gt;item&lt;/code&gt; object, I'd imagine it'd look something like this after adding the options:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var item = {"id":id, "name": name,"price": price, "options":[{"name":large, "price":2.95}]}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Not entirely sure how to go about it, Any help/techniques would be highly appreciated.&lt;/p&gt;

</description>
      <category>help</category>
    </item>
    <item>
      <title>Any football/soccer fanatics?</title>
      <dc:creator>tmblog</dc:creator>
      <pubDate>Mon, 02 Sep 2019 21:22:34 +0000</pubDate>
      <link>https://dev.to/tmblog/any-football-soccer-fanatics-38lb</link>
      <guid>https://dev.to/tmblog/any-football-soccer-fanatics-38lb</guid>
      <description>&lt;p&gt;I love my football especially the Premier League in England, can't wait for the champions league too.&lt;br&gt;
Will LFC win the league finally or will City be too strong? What's your team? &lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>I am a secondary/high school teacher and programmer, Ask Me Anything!</title>
      <dc:creator>tmblog</dc:creator>
      <pubDate>Fri, 30 Aug 2019 15:52:06 +0000</pubDate>
      <link>https://dev.to/tmblog/i-am-a-secondary-high-school-teacher-and-programmer-ask-me-anything-20l6</link>
      <guid>https://dev.to/tmblog/i-am-a-secondary-high-school-teacher-and-programmer-ask-me-anything-20l6</guid>
      <description>&lt;p&gt;OK so I teach Computer Science full time in a Secondary/High school. And have my own software company for which I write/maintain the programs. I teach 11-18 years the theory of programming and how to write programs in Python.&lt;/p&gt;

&lt;p&gt;I teach anywhere between 75 to 150 teenagers (boys and girls) a day, 5 days a week. Today is the last day of my summer holiday :-(&lt;/p&gt;

&lt;p&gt;AMA&lt;/p&gt;

</description>
      <category>ama</category>
    </item>
    <item>
      <title>Login best practices</title>
      <dc:creator>tmblog</dc:creator>
      <pubDate>Fri, 30 Aug 2019 14:45:03 +0000</pubDate>
      <link>https://dev.to/tmblog/login-best-practices-3hpc</link>
      <guid>https://dev.to/tmblog/login-best-practices-3hpc</guid>
      <description>&lt;p&gt;Wanting a bit of advice regarding logging in using php and mysql.&lt;/p&gt;

&lt;p&gt;The general flow is after validating data etc:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT username, password FROM users WHERE username = $_POST['username'];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then using &lt;code&gt;password_verify()&lt;/code&gt; to check if the hashes match.&lt;/p&gt;

&lt;p&gt;The question is if it is better to just query for the username first e.g.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT username FROM users WHERE username = $_POST['username'];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If that yields a result then:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT password FROM users WHERE username = $_POST['username'];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;followed by:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;password_verify($_POST['password'], $passwordFromDatabase);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Is this a better more secure approach? At least on the face of it, it looks like the password isn't exposed if username isn't correct. Any suggestions on best practices and which is a better/different approach(es) would be highly appreciated!&lt;/p&gt;

</description>
      <category>help</category>
      <category>discuss</category>
      <category>php</category>
    </item>
    <item>
      <title>Protect local pages with JWT token</title>
      <dc:creator>tmblog</dc:creator>
      <pubDate>Fri, 30 Aug 2019 13:20:19 +0000</pubDate>
      <link>https://dev.to/tmblog/protect-local-pages-with-jwt-token-3hbp</link>
      <guid>https://dev.to/tmblog/protect-local-pages-with-jwt-token-3hbp</guid>
      <description>&lt;p&gt;I have created a JWT using PHP following &lt;a href="https://dev.to/robdwaller/how-to-create-a-json-web-token-using-php-3gml"&gt;this tutorial&lt;/a&gt;. This is fine and as long as the token has not expired I can view other pages on the server. &lt;/p&gt;

&lt;p&gt;I have a scenario like this: &lt;br&gt;
&lt;strong&gt;login page&lt;/strong&gt;, creates a JWT token on successful authentication.&lt;br&gt;
&lt;strong&gt;View posts page&lt;/strong&gt;, this retrieves posts from the server by passing the JWT.&lt;/p&gt;

&lt;p&gt;I wondered how I can also protect this &lt;strong&gt;view posts page&lt;/strong&gt; from direct access without having to create local sessions. As it stands view posts page can be accessed but nothing will be shown if there isn't a JWT token passed.&lt;/p&gt;

&lt;p&gt;Normally the flow is to create a session locally on successful login and maintain the state like, just wondering if there is a way to see use the JWT token locally as well. Hope that makes sense. And if there any security considerations I should make.&lt;br&gt;
Cheers&lt;/p&gt;

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