<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Simon Carr on Medium]]></title>
        <description><![CDATA[Stories by Simon Carr on Medium]]></description>
        <link>https://medium.com/@simonjcarr?source=rss-4cb30a4e956d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Yhi8S_zkjKa9zmO7pG9Klw.jpeg</url>
            <title>Stories by Simon Carr on Medium</title>
            <link>https://medium.com/@simonjcarr?source=rss-4cb30a4e956d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 00:46:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@simonjcarr/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Pay As You Go AI Chatbots]]></title>
            <link>https://simonjcarr.medium.com/pay-as-you-go-ai-a47307c8a4f0?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a47307c8a4f0</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[anthropic-claude]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 22:51:22 GMT</pubDate>
            <atom:updated>2024-11-17T23:20:24.630Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mQk47j69WaAUkodipopdMQ.png" /></figure><p>Having access to AI is becoming more important everyday. Companies like Anthropic, OpenAI and others are providing services that have made many of us so much more productive, and provides a real advantage over those not using it.</p><p>The speed that AI is advancing, also means that one model offers advantages over another, until another model becomes the new leader. At the time of writing Anthropic’s Clause 3.5 is arguably better for software development and code generation, but they don’t offer any image generation services, for which OpenAI’s DALL-E 3 is very popular for. Both Claude 3.5 and GPT-4o have vision capabilities, giving them the capability to describe images, but Anthropic is again arguably better at this….At the moment.</p><p>While both OpenAI and Anthropic offer a free tier, it is limited, and really frustrating, when your in the middle of a conversation and your told you have you used your quota for the day. You can of course subscribe, which is a great option if you want to commit to one company. If money is no object, and you want the benefits different companies offer, you might decide to subscribe to more than one.</p><p>At $20 per month for a subscription though, even subscribing to one is not an option for many. Most people just don’t use AI enough to warrant the subscription, even if they could afford it. Most people peoples usage pattern is a couple of conversations a month, while a few people in trades like Data Science and Software Development might have 4 or 5 conversations an hour.</p><p>Pay As You Go the best option for any usage pattern. Being able to top up with anything from $5 and then not having to worry about a subscription, will open up the word of AI to many more low usage users. For those of us who use AI multiple times a day and are aware of the differences and benefits of each company, being able to just select any model to use within the same app is a game changer.</p><p><a href="https://payg-ai.com/">payg-ai.com</a> as it’s name suggests offers Pay As you Go Access to AI models. At the time of writing, this includes Clause 3.5 Sonnet, Claude 3.5 Haiku, DALL-E 3, GPT 4o, and GPT Turbo. This flexibility, being able to top with with as little as $5 and the low usage prices, will open up the world of AI to many more people.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a47307c8a4f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unleashing the Power of AI and Machine Learning: Practical Tools for Business Success and Future…]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/unleashing-the-power-of-ai-and-machine-learning-practical-tools-for-business-success-and-future-933d999bfdad?source=rss-4cb30a4e956d------2"><img src="https://cdn-images-1.medium.com/max/1792/1*rP18tbvNlsHxC7Mo5qb12w.png" width="1792"></a></p><p class="medium-feed-snippet">Introduction</p><p class="medium-feed-link"><a href="https://medium.com/swlh/unleashing-the-power-of-ai-and-machine-learning-practical-tools-for-business-success-and-future-933d999bfdad?source=rss-4cb30a4e956d------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/unleashing-the-power-of-ai-and-machine-learning-practical-tools-for-business-success-and-future-933d999bfdad?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/933d999bfdad</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[small-business]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[customer-service]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Sun, 21 Jan 2024 10:48:55 GMT</pubDate>
            <atom:updated>2024-01-21T10:48:55.640Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Navigating the Complexities of AI Ethics: A Comprehensive Guide]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/navigating-the-complexities-of-ai-ethics-a-comprehensive-guide-f27db188b25b?source=rss-4cb30a4e956d------2"><img src="https://cdn-images-1.medium.com/max/1792/1*MDwQ0mngQUWwkpyPGLIqwA.png" width="1792"></a></p><p class="medium-feed-snippet">A Comprehensive Guide</p><p class="medium-feed-link"><a href="https://medium.com/swlh/navigating-the-complexities-of-ai-ethics-a-comprehensive-guide-f27db188b25b?source=rss-4cb30a4e956d------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/navigating-the-complexities-of-ai-ethics-a-comprehensive-guide-f27db188b25b?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f27db188b25b</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[fairness-and-bias]]></category>
            <category><![CDATA[transparency]]></category>
            <category><![CDATA[ethics]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Sat, 20 Jan 2024 22:31:32 GMT</pubDate>
            <atom:updated>2024-01-20T22:42:31.564Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[VueJS 3 Composition API and Netlify CD]]></title>
            <link>https://simonjcarr.medium.com/vuejs-3-composition-api-and-netlify-cd-ebc21d345142?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebc21d345142</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Sun, 01 Nov 2020 21:34:39 GMT</pubDate>
            <atom:updated>2020-11-01T21:53:23.311Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nB4bHUE2qmkBJKNZ8bFmoA.png" /></figure><h3>Deploy a VueJS 3 App on Netlify using Continuous Deployment for Free</h3><p>In this article, I will take you through developing a simple VueJS 3 App using the new composition API and deploying it for free on Netlify.</p><h4>About the App</h4><p>The App I will create will be a simple ToDo app, but it could be much more complex but the process of deploying to Netlify would be just the same.</p><h4>About Netlify</h4><p>Netlify host Apps in a way that makes it very simple for the developer. It is basically a 3 step process proving a Continuous Deployment service.</p><ol><li>Develop your App and push to GIT</li><li>Create build settings on Netlify that point to our App’s GIT repo</li><li>Deploy your App.</li></ol><p>Netlify pulls your App from GIT (You get to choose the branch it pulls from), builds it and deploys it for you. What’s great, is that as soon as you push new changes to the GIT branch Netlify is watching, Netlify will pull, build and redeploy the new version of the app almost instantly, this is what is known as Continuous Deployment</p><h4>Prerequisites</h4><p>I am assuming that you already have the following installed or setup.</p><ul><li>Git installed <a href="https://git-scm.com/">https://git-scm.com/</a></li><li>An account on Github, BitBucket, or some other internet-accessible Git server<br>- <a href="https://github.com/">https://github.com/</a><br>- <a href="https://bitbucket.org/product">https://bitbucket.org/product</a></li><li>Node.js and NPM installed <a href="https://nodejs.org/en/">https://nodejs.org/en/</a></li><li>An IDE for writing your code. I use VSCode <a href="https://code.visualstudio.com/">https://code.visualstudio.com/</a></li></ul><h3>Developing the ToDo App</h3><h4>Installing VueJS</h4><blockquote>Even if you already have the VueJS CLI installed, you should still follow this step to ensure you have the latest version.</blockquote><p>Open a terminal window. You don’t have to be in any specific folder for this step. Enter the following code.</p><pre>npm install -g <a href="http://twitter.com/vue/cli">@vue/cli</a></pre><p>The above command will install the VueJS CLI globally, allowing you to create new VueJS applications.</p><h4>Create a VueJS starter App</h4><p>When we create a new VueJS app, a new folder will be created that contains all the VueJS application files and folders.</p><p>In a terminal window, navigate to where you want the application folder to be created and enter the following command</p><pre>vue create vuejs_netlify</pre><p>vuejs_netlify is just the name of the app we want to create. It will also be the name of the folder that the Vue CLI will create.</p><p><strong>Selecting application presets</strong></p><p>Select Manually select features and press enter.</p><blockquote>Use your keyboards arrow keys to move up and down the list</blockquote><p><strong>The next screen will ask you to choose the features you want to include in this project.</strong></p><p>Select the following features.</p><ul><li>Choose Vue version</li><li>Babel</li></ul><blockquote>Use your keyboards arrow keys to move up and down the list. Use the space bar to select/deselect features.</blockquote><p>Hit enter on your keyboard, when done.</p><p><strong>Configure the features you have selected</strong></p><ul><li>Pick a preset<br>Choose 3.x (Preview)</li><li>Where to place the config for Babel<br>Chooses In dedicated config files</li><li>Save this preset?<br>Choose N</li></ul><p>The Vue CLI will now create your new project.</p><p>When it’s finished enter the following command in the terminal to go into the folder created by the Vue CLI</p><pre>cd vuejs_netlify</pre><h4>Installing tailwind CSS</h4><p>I like to use <a href="https://tailwindcss.com/">tailwind CSS</a> in my VueJS projects. It’s very easy to add tailwind to a VueJS project using the plugin system. Just enter the following command in the terminal.</p><pre>vue add tailwind</pre><p>When prompted, select minimal and hit enter.</p><h4>Open the app folder in your IDE</h4><p>If you&#39;re using VSCode, just enter code . in the terminal. This will open VSCode, the . tells VSCode to open the current folder</p><p>We will look at the code in a moment, but let’s get the Vue development server up and running first and make sure the basic app created by the Vue CLI is working.</p><p>In the terminal enter the following command</p><pre>npm run serve</pre><p>You should see something like the screenshot below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s9Ir_MUGv4FjE1AkG6jCEQ.png" /></figure><p>Navigate to the Local URL: <a href="http://localhost:8080/">http://localhost:8080</a></p><blockquote>If you already have something else running on port 8080, Vue will choose another port.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*zxxCr2RlnfJuhlqQ6ewjDg.png" /></figure><p>Don’t worry if the formatting looks a bit off, this is because we have installed tailwind css, it is conflicting with some of the CSS classes that come with the default VueJS project</p><h4>Create the files we need</h4><p>Open VSCode, the initial project structure should look like the screenshot below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*JQA7jO_JLeNTOUfR-MOLbw.png" /></figure><p><strong>Rename HelloWorld.vue</strong></p><p>In the src/components folder. Rename HelloWorld.vue to ToDo.vue</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*o-hPQpbPVABxewtFnzXnPA.png" /></figure><blockquote>To rename a file in VSCode, right-click the file and click Rename</blockquote><p>Delete everything in the ToDo.vue file and replace with the code below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66c843e9c05e170d29819a9d2ee2588f/href">https://medium.com/media/66c843e9c05e170d29819a9d2ee2588f/href</a></iframe><blockquote>The code I have used in ToDo.vue uses the newComposition API available in VueJS 3. To learn more about the Composition API, see my article <a href="https://levelup.gitconnected.com/developing-a-full-app-using-the-vue-3-composition-api-4fd9431f2136">https://levelup.gitconnected.com/developing-a-full-app-using-the-vue-3-composition-api-4fd9431f2136</a></blockquote><p><strong>Update App.vue</strong></p><p>Open src/App.vue and change it to contain the code shown below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cac00968832971ece5cb9af54c8a8038/href">https://medium.com/media/cac00968832971ece5cb9af54c8a8038/href</a></iframe><blockquote>Notice in the template, that Vue3 now allows us to have multiple root elements. In Vue2, these two div’s would have needed to be wrapped in a single parent div.</blockquote><h4>App Summary</h4><p>That is the basic ToDo App complete. As you can see, the code is simple and concise. If you take a look at your browser, you can add todo’s, toggle the complete status and delete them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a7gWAKt2CAIlzO2Wd9z4pQ.png" /></figure><h3>Deploy the app to Netlify</h3><p>Now the app is complete. Let&#39;s get it deployed to Netlify.</p><h4>Add and commit our code to GIT.</h4><p>In a terminal window, go into your projects folder.</p><p>When we created our project, the Vue Create command already add a local GIT repository for us. We just need to stage our files and commit them with the two commands below.</p><pre>git add .<br>git commit -m &quot;Initial commit&quot;</pre><blockquote>The above commands will stage all the new and changed files and then commit them to the local repository, with the message Initial commit Our project already has a default .gitignore file, you don’t need to change anything in here, but anything in that file will be ignored by git, i.e. node_modules, which we never want to push to GIT.</blockquote><p>The result will look like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*FwzVNFYLr86kufdBhJPGEQ.png" /></figure><h4>Creating a GIT Repository</h4><p>To use Netlify, we need to push our code to a GIT repository that is accessible through the internet. I am going to use GitHub, but you can also use BitBucket</p><p>Log in to <a href="https://github.com/">GitHub</a> and create a new blank repository by clicking the New button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*xDCFk4NheuZvHQ9o6-d_ww.png" /></figure><p>In the Create a new repository page, enter vuejs_netlify as the repository name. Mark it as Public and click the Create repository button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3OKS2apU-ueI80m0kowgqg.png" /></figure><p>Git will create the repository and amongst, other details, you will see the following</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYDcFKrE1Yw0d3O7VWEtdg.png" /></figure><p>The URL <a href="https://github.com/simonjcarr/vuejs_netlify.git">https://github.com/simonjcarr/vuejs_netlify.git</a> is what will become the remote address for the local GIT repository. Let’s tell the local repository about that remote repo now.</p><blockquote>Remember, the URL above is for my GIT hub repository and won’t work for you. Make sure to use your repository address.</blockquote><p>In the terminal enter the following command, <strong>replacing the GIT URL with yours.</strong></p><pre>git remote add origin <a href="https://github.com/simonjcarr/vuejs_netlify.git">https://github.com/simonjcarr/vuejs_netlify.git</a></pre><p>The term origin is a standard used to refer to the default upstream remote. You can have multiple remotes but each must have a unique name.</p><p>Now we can push our code to GIT with the following command.</p><pre>git push origin master</pre><p>The above command tells GIT to push the master branch to the remote named origin. The result will look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_pBtB0g_gTe6TFWcyspckw.png" /></figure><h3>Deploying code to Netlify</h3><p>If you don’t already have an account with Netlify, you should visit their site now and create one. <a href="https://app.netlify.com/">https://app.netlify.com</a> They have a free tier, so it won’t cost you anything.</p><p>After you log in to Netlify, click the Sites menu and then click New site from Git</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4SLBPDGtcOjs72Ippg4biQ.png" /></figure><p>You will need to give Netlify access to your GitHub repository through OAuth2, you can do this by clicking the GitHub logo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J8uhZKiBBbwRye0MYb2uXA.png" /></figure><p>You will be shown a list of all your Git repositories. If like me you have a lot of them, you can use the search box to find the repo we just created, in my case simonjcarr/vuejs_netlify</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gkmL_RqM3T6YvRm2gyRnsQ.png" /></figure><p>Click the repository name.</p><p>On the next page, fill in the following details</p><p><strong>Branch to deploy</strong><br>Select the master branch, or if you a separate branches for test, pre-prod and prod select the appropriate branch.<br><strong>Build command<br></strong>In our case for VueJS, it is npm run build<br><strong>Publish directory<br></strong>For VueJS the build command will publish the files to the dist folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mvIV52JtPnRu02Ryt2ohVg.png" /></figure><p>Once you have completed the form, hit the Deploy site button.</p><p>You will be taken to your Apps control panel and while the site is deploying, you will see the following</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TlaTEYvFvj3EztKBrJeSuQ.png" /></figure><p>After about a minute, the message will change to show the temporary URL for your site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lW7KgCL-qKefT3MOEGahLQ.png" /></figure><p>If you click the link, you will see your live site, deployed on Netlify. You can check out my site at the following link. <strong>The link above will not work for you, </strong>read on to find out why. The working URL is here <a href="https://gallant-shirley-a42ed3.netlify.app/">https://gallant-shirley-a42ed3.netlify.app/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*idSLApc542sVyF6iWq-NnQ.png" /></figure><p><strong>Your own domain name is optional</strong></p><p>You can see in the screenshots above, Netlify gives you the option to point your own custom domain to your deployed App. Your own domain has its own obvious advantages. A less obvious one, but which will be become clear in the section below, is that each time you push new code to GitHub and your App is updated, the domain name Netlify provides will change.</p><h4>Modifying and redeploying the application</h4><p>Netlify makes it very easy to modify and redeploy your code. In fact, all we have to do is push new code to our repository and Netlify will take care of the rest automatically.</p><blockquote><strong>Please note</strong> my comments at the end of the last section about your own domain name. When you push new code to GitHub and Netlify redeploys your App, the domain name provided by Netlify will change.</blockquote><p>In your IDE, open the ToDo.vue file.</p><p>Add the following code to the bottom of the template section</p><pre>&lt;div <em>v-if</em>=&quot;<em>todos.</em>length == 0&quot;&gt;<br>  &lt;div <em>class</em>=&quot;text-2xl font-bold&quot;&gt;Your ToDo list is empty&lt;/div&gt;&lt;/div&gt;</pre><p>The full ToDo.vue file should look like this</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7aed259e6f5c7be8696acf6c69999d66/href">https://medium.com/media/7aed259e6f5c7be8696acf6c69999d66/href</a></iframe><p><strong>Commit the changes and push to GitHub</strong></p><p>In the terminal run the following commands</p><pre>git add .<br>git commit -m &quot;Added a message when todo list is empty&quot;<br>git push origin master</pre><p>After about 60 seconds, refresh your Netlify Apps control panel to get the new domain name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ez0CxSYythIzBYI8cy-Ebw.png" /></figure><p>The updated App ( <a href="https://gallant-shirley-a42ed3.netlify.app/">https://gallant-shirley-a42ed3.netlify.app/</a> )is now deployed with the updated code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6U91yqL1b-TK4FVf3fy0Q.png" /></figure><h3>Summary</h3><p>Netlify makes it very easy to deploy your Apps into production and keep them in sync with GitHub using Continuous Deployment. To make the most out of Netlify you will need to point your own Domain Name at the new app, but that is something you would do anyway for a production site.</p><p><strong>If you like my articles please follow me and give me a clap if you liked this article.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebc21d345142" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[find and filter arrays in JavaScript and Node.js]]></title>
            <link>https://simonjcarr.medium.com/find-and-filter-arrays-in-javascript-and-node-js-9c4abac65c52?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c4abac65c52</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Thu, 29 Oct 2020 15:43:48 GMT</pubDate>
            <atom:updated>2020-10-29T15:43:48.294Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yu8bZEpYO_zQkp0wVN4Hzw.png" /></figure><p>If you need to search or filter an array of objects, then this article will show you the most common ways of doing so using JavaScript’s built-in functions.</p><h4>Find Vs Filter</h4><p>Just to be clear finding and filtering produce different results.</p><ul><li>find will return a single value: the first matching value found.</li><li>filter will return multiple values: all matching values</li></ul><h4>Example data</h4><p>If you want to follow along, this is the example data I will be using.</p><p>data.json</p><pre>[<br>  {<br>    &quot;id&quot;: 1,<br>    &quot;name&quot;: &quot;Joe Bloggs&quot;<br>  },<br>  {<br>    &quot;id&quot;: 2,<br>    &quot;name&quot;: &quot;Jane Doe&quot;<br>  },<br>  {<br>    &quot;id&quot;: 3,<br>    &quot;name&quot;: &quot;John Doe&quot;,<br>    &quot;address&quot;: {<br>      &quot;street&quot;: &quot;21 Lime Street&quot;,<br>      &quot;city&quot;: &quot;London&quot;<br>    }<br>  }<br>]</pre><h3>Find</h3><p>Let’s start with finding data.</p><h4>Finding one record by a fields absolute value</h4><pre>let users = require(&#39;./data.json&#39;);<br><br>let findId1user = users.find(user =&gt; user.id == 1)<br>console.log(findId1user)</pre><p><strong>result</strong></p><pre>{ id: 1, name: &#39;Joe Bloggs&#39; }</pre><p>The above example correctly finds the object with id: 1</p><h4>If we try to find a value that could relate to more than one record, we will only get the first matching record.</h4><pre>let users = require(&#39;./data.json&#39;);<br><br>let findDoeUsers = users.find((user) =&gt; user.name.includes(&#39;Doe&#39;));<br>console.log(findDoeUsers);</pre><p><strong>result</strong></p><pre>{ id: 2, name: &#39;Jane Doe&#39; }</pre><p>The above example shows that only Jane Doe is returned, even though John Doe also matches.</p><p>If we need to return all matching records, we need to use filters, which we will look at further down.</p><h4>Finding a value where the field does not exist in all records.</h4><p>The following example will give an error</p><pre>let users = require(&#39;./data.json&#39;);<br><br>let findCityLondon = users.find(user =&gt; {<br>  return user.address.city.includes(&quot;London&quot;)<br>})<br>console.log(findCityLondon)</pre><p><strong>result</strong></p><pre>TypeError: Cannot read property &#39;city&#39; of undefined</pre><p>The reason for the above error is that only one of the three records has an address element.</p><p>We can overcome this error with a try/catch block</p><pre>let users = require(&#39;./data.json&#39;);<br><br>let findCityLondon = users.find((user) =&gt; {<br>  try {<br>    return user.address.city.includes(&#39;London&#39;);<br>  } catch {<br>    return false<br>  }<br>});<br>console.log(findCityLondon);</pre><p><strong>result</strong></p><pre>{<br>  id: 3,<br>  name: &#39;John Doe&#39;,<br>  address: { street: &#39;21 Lime Street&#39;, city: &#39;London&#39; }<br>}</pre><p>The try/catch catches the error and returns false, which simply means the record will not be included in the result.</p><h4>Find summary</h4><p>Although you can do more complex searches with tools such as <a href="https://lodash.com/">lodash </a>, the built-in find will be enough for 90% of the time.</p><h3>Filter</h3><p>As mentioned above, filter will return multiple records that match the filter criteria.</p><p>In the example above where we used find to return records with a name field containing Doe we only got one record returned, the first record that matched.</p><p>In the following example, I use filter with the same criteria.</p><pre>let users = require(&#39;./data.json&#39;);<br><br>let filterDoe = users.filter(user =&gt; user.name.includes(&quot;Doe&quot;))<br>console.log(filterDoe)</pre><p><strong>result</strong></p><pre>[<br>  { id: 2, name: &#39;Jane Doe&#39; },<br>  {<br>    id: 3,<br>    name: &#39;John Doe&#39;,<br>    address: { street: &#39;21 Lime Street&#39;, city: &#39;London&#39; }<br>  }<br>]</pre><p>As you can see, filter returns an array and it contains both records with the name field that contains the Doe</p><h4>Filter Summary</h4><p>Just as I summarised the find section above, tools such as lodash can do far more, but in most cases, JavaScript’s built-in filter method will be all you need.</p><h3>Summary</h3><p>The methods listed above are synchronous, that is they will block until the result is returned. There are other</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c4abac65c52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use Dockerized Keycloak with a reverse proxy]]></title>
            <link>https://simonjcarr.medium.com/how-to-use-dockerized-keycloak-with-a-reverse-proxy-94aef0f74491?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/94aef0f74491</guid>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[reverse-proxy]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[keycloak]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Sun, 25 Oct 2020 14:17:54 GMT</pubDate>
            <atom:updated>2020-10-25T14:17:54.585Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*_jkejqmpzxzK5SkEI9e5Yw.png" /></figure><p>When using Keycloak in a development environment, all the connections to your app, database, and Keycloak are made on your internal network. When you put your app into production, then your users may well be accessing your Keycloak server from outside your network. This is especially true when developing Single Page Applications SPA’s.</p><p>It is common practice to run the Keycloak server over HTTP behind a reverse proxy, which in turn provides your users with the HTTPS connection to keep their credentials private. This is where problems can start to arise with mixed content error messages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*Y9Itt5gpOyq_MIdAGf_RPA.png" /><figcaption>Network Diagram showing Keycloak behind a Reverse Proxy</figcaption></figure><p>The solution is quite straight forward and requires only the addition of two environment variables to the Keycloak Service in the docker-compose.yaml file.</p><p>The two environment variables you need to add are</p><pre>PROXY_ADDRESS_FORWARDING: &quot;true&quot;<br>REDIRECT_SOCKET: &quot;proxy-https&quot;</pre><p>A full example of a docker-compose.yaml is shown below to give you some context.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d7fc24e74bd21965679a03539ad5b29/href">https://medium.com/media/6d7fc24e74bd21965679a03539ad5b29/href</a></iframe><p>Let me know in the comments how you get on and subscribe to my medium channel to get notified of new full-stack development articles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94aef0f74491" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using async inside a Javascript Promise]]></title>
            <link>https://simonjcarr.medium.com/using-async-inside-a-javascript-promise-f32957617d78?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f32957617d78</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[asyncawait]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Sat, 24 Oct 2020 20:16:36 GMT</pubDate>
            <atom:updated>2020-10-24T20:28:13.436Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using async/await inside a Javascript Promise</h3><p>What is the correct way to use async/await inside a Javascript promise?</p><p>If you&#39;re asking the question, then this short and to the point article will show you the quick and easy way to use async/await inside a JavaScript Promise.</p><p>If you’re a Javascript programmer and you use promises, then you have probably come across the need to use async/await inside of a promise.</p><p>Does this code look familiar?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38086cfe559acd05cdfb83e1a16fa609/href">https://medium.com/media/38086cfe559acd05cdfb83e1a16fa609/href</a></iframe><p><strong>The above code is an anti-pattern</strong>. The problem is the use of async in the promise creation. This can cause all sorts of unexpected problems.</p><p>But, I hear you ask, “How can I use await if I don’t decorate the function with async?”</p><h4>The correct way to use async/await in a Javascript Promise</h4><p>The secret is to create a self-invoking function and decorate that with async. Don’t worry, it’s simple, and the following code solves the above problem.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd633811f2dd5643173198c26ab5fff9/href">https://medium.com/media/bd633811f2dd5643173198c26ab5fff9/href</a></iframe><p>Notice in the above code, I have corrected the issue by removing async from the promise creation and created a self-invoking function and decorated it with async.</p><pre>(async () =&gt; { your code goes here .... })()</pre><p>A self-invoking function will do exactly what it says on the tin, it runs immediately. You don’t have to call it to make it run.</p><p>You learned a fundamental Javascript pattern today that evades many programmers. Follow me to get more snippets of wisdom.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f32957617d78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Portainer — The easy way to manage Docker]]></title>
            <link>https://levelup.gitconnected.com/portainer-the-easy-way-to-manage-docker-a982a17146c1?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a982a17146c1</guid>
            <category><![CDATA[portainer]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Sun, 23 Aug 2020 19:04:06 GMT</pubDate>
            <atom:updated>2020-10-05T07:12:16.079Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*3OJbS-uzx-cWO8g-fR8geg.png" /></figure><h3>Portainer — The easy way to manage Docker</h3><p>There are still a lot of Developers and IT Professionals that have no experience with Docker. My personal experience is they think Docker is complex and challenging to manage.</p><p>In this tutorial, I’m going to demonstrate how to get Docker up and running quickly and how to simplify Docker management with the Web-Based graphical management tool, Portainer.</p><h3>Docker vs Virtual Machines</h3><p>Before we start, a quick overview of the difference between Docker and Virtual Machines might be helpful. If your already familiar with Docker just skip this section.</p><p><strong>A Virtual Machine</strong> (VM) is an encapsulated operating system, running on top of another operating system. The VM uses the memory, processor and disk resources of the underlying hardware. The critical point here is that the Operating System running in the VM requires a substantial amount of the host machines resources to run. On a typical 16GB, i5 machine, you would struggle to run five virtual machines simultaneously. Even if they were not running any applications, you would quickly see a significant degradation in the performance of the underlying operating system and the VM’s start to freeze.</p><p><strong>Docker containers,</strong> on the other hand, make use of the hardware resource through the underlying Operating System almost as though they were an installed application (That is a very simplistic description). The images used to build a Docker container are very small in comparison to a VM, often only a 40 or 50 MB. Since there is not a full operating system to maintain inside a Docker container, memory and processor resource usage is typically very low. I often have 20+ containers running on my 16GB Mac Book Pro. That would be impossible using VM’s.</p><h3>Portainer</h3><p>By default, we manage Docker through the command line. Portainer provides an excellent and highly informative user interface for managing all aspects of Docker. It charts, and dashboards provide realtime charts of container resource usage. Starting and managing containers and stacks can be done with a few mouse clicks.</p><h3>Installing Docker</h3><h4>Installing on Windows</h4><p>Ideally, you need to be running Windows 10 Pro to take advantage of the Windows Linux sub System. If you’re using a works computer where a lot of options are disabled, you might struggle, but see how far you get, then ask your IT administrators for help if required.</p><p>Download docker from the following URL. Choose the stable version.</p><p><a href="https://hub.docker.com/editions/community/docker-ce-desktop-windows/">Docker Desktop for Windows - Docker Hub</a></p><p>Run the installer. Make sure to select WSL (Windows Sub Systems for Linux)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*YqT2uP8YKBEIqIXOhOzakA.png" /></figure><p>When the installation is complete, restart Windows.</p><p>Once the system has restarted, you might see a prompt to install an updated WSL 2 Linux Kernal. Just click the link and follow the instructions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*isbn9tjSwgVzYQeWDCk9tw.png" /></figure><p>If you get an error about WSL not being enabled. Try the following command.</p><p>Open PowerShell as an Administrator and run</p><pre>dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart</pre><h4>Installing on Linux</h4><p>Linux is the preferred environment for Docker as it offers the best performance in a native environment.</p><p>Due to the many distributions of Linux and various platforms that you may be running it on, you will have to follow the instructions on the docker web site for installation. <a href="https://docs.docker.com/engine/install/">https://docs.docker.com/engine/install/</a> There are links on this web page that take you to specific instructions for your distribution.</p><h4>Installing on macOS</h4><p>You can download and install Docker desktop for Mac by visiting the following web site. <a href="https://hub.docker.com/editions/community/docker-ce-desktop-mac/">https://hub.docker.com/editions/community/docker-ce-desktop-mac/</a></p><p>Make sure to get the Stable version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y2yIWBIKxM69PM2ufWKt-w.png" /></figure><p>After downloading open the .dmg installer file, drag the Docker application in the Applications folder, as shown above.</p><h3>Installing Portainer</h3><p>Whichever operating system you’re running, the commands from this point will be the same. Where I mention opening a terminal, I am referring to the Command Prompt on windows.</p><p>Open a terminal and run the following command to create a</p><pre>docker volume create portainer_data</pre><p>The above command creates a data volume on your disk that Portainer will use to save configuration data. Without it, data would be stored in the container and lost each time the container restarts.</p><p>Next, run the following the command to download and run the Portainer image and start up the Portainer Container.</p><pre>docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer</pre><h3>Connecting to Portainer</h3><p>Installing Portainer was easy and connecting to it, is just as easy. Open a web browser and visit <a href="http://loaclhost:9000/">http://localhost:9000</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tXueJlaKV8whwhM_CRLOjg.png" /></figure><p>The default user name is admin as this is the first time you have logged in, you will be asked to create a new password and confirm it.</p><p>On the next screen, select Local and click Connect</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fNEMTT2EZXAlLMA6Qj2yog.png" /></figure><h3>The Portainer home screen</h3><p>The Docker instances that Portainer knows about are displayed in the central portion of the screen. There will only be one at this time, “local”. On the left is a menu that offers many of the options you would have in the Docker command line plus many more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLAceg0PgAbmxNvsPc1uUQ.png" /></figure><p>Click the Local Docker instance, to see the Dashboard showing a high-level overview of what is currently running in Docker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YbRCQ_yED9nKuGt0Y1t_0g.png" /></figure><p>Unless you have already been using Docker, you won’t have much running yet.</p><h3>Adding a new image and starting a container</h3><p>Let’s get a MariaDB Docker container up and running to see the workflow and how easy it is.</p><p>The first thing to do is create a Volume that will hold the database data — Click Volumes in the left menu panel.</p><h4>Create a volume</h4><p>Click Add volume</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFUGG7dxkIRRrgnvYQxO-w.png" /></figure><p>Name the volume MariaDB and click Create the volume</p><h4>Create a MariaDB Container</h4><p>Click Containers in the left menu panel</p><p>Click the Add container button</p><p>Name the container MariaDB</p><p>In the image text box type mariadb:latest</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iDUhvAlMJgCZdVUF8SH7Bw.png" /></figure><p>Click publish a new network port</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eIVRa26f24HRBUvBBFQo7Q.png" /></figure><p>Enter <strong>3306</strong> for the host and container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uuAHcf3INpGjhuBJ4AM0Gw.png" /></figure><p>At the bottom of the page in Advanced container settings, click Volumes, then click map additional volumes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3M465LuLKUZl2DIKip7nWw.png" /></figure><p>Add the following to container and volume</p><ul><li><strong>container:</strong> /var/lib/mysql</li><li><strong>volume: </strong>Select the MariaDB volume you created earlier from the dropdown, which will be namedMariaDB — local</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O90kwop2RjSyE_JJIbT9lQ.png" /></figure><p>Finally, select the Env tab and click add enviroment variable</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gGesKKqe188odi4VlyqE0w.png" /></figure><p>We need to tell MariaDB what the root user password should be set too. We do this by providing an environment variable. Fill the name and value text boxes as below</p><ul><li><strong>name: </strong>MYSQL_ROOT_PASSWORD</li><li><strong>value: </strong>password Please use a more suitable password!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1vftGv1coTp9d0ofhkFbrw.png" /></figure><p>To finish the configuration of the MariaDB container, click theDeploy the container button.</p><p>After a short while, you will be taken back to the container list and you should see your MariaDB container in the <strong>running</strong> state</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I0cRdfcBOEO8P_2H4RoKyw.png" /></figure><h4>Create an Adminer container</h4><p>We could connect to the MariaDB container through the console and issue MySQL commands on the command line. A better way is to use a Graphical interface. I prefer adminer which we will add as a container now.</p><p>Making sure you still on the container list screen, click theAdd container button.</p><p>Name the container Adminer and enter adminer:latest as the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wd77V0IDdThO4uG_ay1OfQ.png" /></figure><p>In Network ports configuration section, click publish a new network port</p><p>Enter 8080 for the host and 8080 for the container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1UcZNRugcR6lHso_p5z4A.png" /></figure><p>We don’t need to make any other changes. Click Deploy the container</p><h3>Checking everything works</h3><p>Open your browser and navigate to <a href="http://localhost:8080/">http://localhost:8080</a></p><p>You should see the Adminer login screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gScHdXIcIEIADoAxxJQrAQ.png" /></figure><p>Before we try to connect, be aware that you can’t use localhost for the Server setting. Why? Because Adminer is running in its own container, localhost refers to <strong>its</strong> container. Instead, you will need to provide the IP address of your computer. In my case that is 192.168.30.100.</p><p>The username will be root, and the password is whatever you set the value of MYSQL_ROOT_PASSWORD too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CAuisZC8BpC223YLDOKN8A.png" /></figure><p>Now click Login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WzEBdubaj6mQuqjslwMINw.png" /></figure><p>Congratulations, your life will never be the same! :-) Being able to bring up containers in Docker quickly and without affecting the underlying operating system, opens so many opportunities.</p><p>There are a lot of prebuilt container templates included in Portainer. If you click App Templates in the left-hand toolbar, you will find some interesting apps.</p><p>Eventually, you will be looking for a container not included in the App Templates. The first place you should look is <a href="https://hub.docker.com/">https://hub.docker.com/</a>.</p><h3>Resource monitoring</h3><p>Let&#39;s check the resource being used by MariaDB. Click Containers in the left-hand menu. Click the small chart icon next to MariaDB in the Quick Actions column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ojdn2MfhgTgOcxU1lH24Lg.png" /></figure><p>You will see three real-time charts that cover Memory usage, CPU usage, and Network usage</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G9vFrMkJv1z7qBSrgMptKw.png" /></figure><h3>Inspecting Logs</h3><p>Go back to the Containers screen. Click the Document icon next to the Adminer container in the Quck actions column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tOTahJ-o26rVcsjiBUwGcQ.png" /></figure><p>The logs you will see are the PHP web server logs for Adminer. Open the Adminer web page <a href="http://localhost:8080/">http://localhost:8080</a> and refresh the screen. You will see the logs update a second later with the latest entries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qrfGvLlsjqHMf0TQL4lfTw.png" /></figure><h3>Moving forward with Docker</h3><p>There is a lot more than Portainer can do. In future tutorials, I will look at other Docker and Portainer features. To use some of the more advanced features of Docker, even with the help of Portainer, you are going to need a bit more knowledge about how Docker works and the tool docker-compose. I suggest you start by visiting <a href="https://docs.docker.com/get-started/">https://docs.docker.com/get-started/</a>.</p><p><a href="https://docs.docker.com/get-started/"></a></p><h3>Summary</h3><p>To make sure you don’t miss any of my tutorials, you can follow me by clicking <a href="https://medium.com/u/4cb30a4e956d">Simon Carr</a>.</p><p>I hope you found this tutorial informative, and you learned what you expected. Let me know in the comments if you enjoyed it, or give me some suggestions about how the tutorial or writing style could be improved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a982a17146c1" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/portainer-the-easy-way-to-manage-docker-a982a17146c1">Portainer — The easy way to manage Docker</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The skills that make great developers stand out]]></title>
            <link>https://simonjcarr.medium.com/the-skills-that-make-great-developers-stand-out-1d50e07d8c35?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d50e07d8c35</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Fri, 21 Aug 2020 16:22:53 GMT</pubDate>
            <atom:updated>2020-08-21T22:52:13.679Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*AU7rVlPrSr0kAhB4-FQlFg.png" /></figure><p>I have spent most of my career in the IT industry in varying roles, but what I love most is development. It offers the most opportunities for creativity and innovation, especially web development.</p><p>In this article I will take you through some of the skills you need to be a great developer.</p><h3>Languages</h3><p>You can never have too many languages under your belt. On the other hand, it’s no good being a Jack of all trades and master of none.</p><p>You should be a Ninja with one language and a challenger with one or two others. Have a good understanding of the strengths and weakness of many languages will allow you to select the right tool for a particular job.</p><p>A great developer can pick up almost any language and start working with its basic concepts quite quickly. Over time you pick up the intricacies through reading the docs and asking loads of questions.</p><h3>Frontend Web Development</h3><p>Learning languages is only part of web development. Being able to use multiple frontend libraries and frameworks effectively makes you stand out.</p><p>There are many libraries and frameworks out there, and which ones you need will depend on your circumstances, but in general, a great web developer will know:</p><ol><li>Javascript</li><li>React &amp; Redux</li><li>VueJS &amp; Vuex</li><li>Angular</li><li>Jquery</li></ol><p>You also need to know some of the more common templating languages</p><ol><li>Smarty</li><li>Edge</li><li>Handlebars</li><li>Pug</li></ol><h3>Backend Development</h3><p>The user of a web application only thinks about a backend developer when things go wrong, but they marvel at the talents of frontend developers. As developers, we know that the frontend guys are relying on the quality of the backend.</p><p>You often get much room to innovate on the backend as you try to find solutions to connectivity and speed issues. As such, you need language skills and knowledge of infrastructure.</p><p>The languages great backend developers may need</p><p>Which you need will depend on the company your with, but knowing there strengths and weaknesses is essential.</p><ol><li>NodeJS — Essential</li><li>Python — Essential</li><li>PHP — Essential</li><li>Java — Familiarity</li><li>Go — Familiarity</li></ol><h3>Continuous Integration, Automated Testing and Version Control</h3><p>Users of our applications expect that bug fixes and new features to be delivered within hours or at least days. Fast delivery like this is only possible with Continuous Integration and Automated Testing. A great developer has the following skills.</p><p><strong>Version Control</strong></p><ol><li>Git — Essential</li><li>Subversion — Familiarity</li></ol><p><strong>CI/CD</strong></p><p>You will understand the difference between the following and the popular tool chains used in each.</p><ol><li>Continuous Integration</li><li>Automated Testing</li><li>Continues Delivery</li></ol><p><strong>CI/CD tools</strong></p><p>You will also have a good working knowledge of at least one of the following continuous integration tools.</p><ol><li>Jenkins</li><li>GitLab</li><li>Bamboo</li></ol><p><strong>Testing</strong></p><p>You will know what to test and how much to test. This skill requires that you have embraced testing as a necessity rather than a nicety. Seeing good tests is a clear sign of great developer.</p><h3>Infrastructure</h3><p>Many problems that developer’s face come from issues with the infrastructure he or she is working with. As a developer, you might be the first person to identify the problem. Being able to describe the issues to Architects and Database teams and have the knowledge to recommend solutions is another sign of a great developer.</p><p>Some areas of infrastructure &amp; technology that a great developer might have are</p><ul><li>Docker and orchestration tools such as Kubernetes</li><li>Event streaming such as Apache Kafka</li><li>Database engines such as Oracle, MSSQL, MySQL, Postgres, and MongoDB</li><li>API Gateways</li><li>Email</li><li>Networking, Routers and Proxy Servers</li></ul><h3>SQL</h3><p>A Great developer will be able to write SQL in different dialects and know how to write queries that give the best performance.</p><p>Some frameworks provide ORM’s, which will automate the creation of SQL. A great developer will make the best use of these, but bypass them if significantly better performance is achievable with a raw query.</p><p>You should be able to write SQL in at least two of the following dialects and be familiar with the others.</p><ul><li>Oracle</li><li>MySQL</li><li>MSSQL</li><li>PostgeSQL</li></ul><p>You should also know when triggers and views are required and preferably have skills to create and maintain them.</p><h3>No SQL and Object Storage</h3><p>As the type of data we deal with has evolved over the last decade or more, more and more data is now unstructured. Emails, Tweets, and other documents now make up a larger volume of data than relational.</p><p>A great developer knows when No SQL or Object Storage is more appropriate than a relational database. You will have the skills to create and manage datastores as well as set up new databases for development environments.</p><p>You will be comfortable using JSON and XML and know how to employ technologies such as parquet files and interact with them in your code.</p><h3>API’s</h3><p>A great developer knows that access to data sources such as databases should be via an API. If your code will access a database, one of the first things you should design and write is the API. You will be able to collaborate with architects, and network teams make sure the API’s are reusable and managed via a secure gateway.</p><h3>Summary</h3><p>To be a great developer is not just about code. It is about developing software that deliver’s a high quality solution to the customer. Software solutons are more often part of a complex infrastructure. A great developer will understand how this architecture is interlinked and be able to write code that brings it together in a stable, structured and supportable fashion.</p><h3>The most important takeaways</h3><p>No one is born a great developer. It’s a never ending cycle of learning and experimenting. If your new to development, don’t feel disheartened if you don’t have the skills I discuss in this article, see it as a todo list. If you take anything away from this article, it should be these three things.</p><ol><li>Great developers are always learning.</li><li>You don’t have to know everything about everything. Anyone who says they do is full of shit.</li><li>It’s normal to have imposter syndrome. Get used to it; it means your passionate about your trade and eager to learn more.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d50e07d8c35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create an SMTP server with NodeJS]]></title>
            <link>https://simonjcarr.medium.com/create-an-smtp-server-with-nodejs-5688d8fd882e?source=rss-4cb30a4e956d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5688d8fd882e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[smtp]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Simon Carr]]></dc:creator>
            <pubDate>Fri, 21 Aug 2020 09:53:52 GMT</pubDate>
            <atom:updated>2020-08-22T18:25:31.265Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*6rBCO-6n7mg_iu-3vmei2w.png" /></figure><p>In this article, I will show you how simple it is to create an SMTP server using NodeJS and be up and running in a few minutes. You can then send emails to your node application, either as a method of remote control or for 1001 other reasons.</p><p>An SMTP receives emails from other email servers or email clients. If you want an application to process emails in realtime, then your own SMTP server is the way to go. Writing your own server provides some added benefits, like being able to use your own domain name with unlimited email addresses at no extra cost.</p><p>There is a bit more work to get it up and running, but I promise, it’s not that much.</p><h4>What you&#39;re going to need.</h4><ul><li>Your own domain name with the ability to edit DNS records.</li><li>NodeJS</li><li>A fixed IP Address</li><li>If you&#39;re on a home network you will need to be able to set up port forward rules on your Internet Router.</li></ul><h3>DNS setup</h3><p>In order for a domain to receive emails, it needs to know about the mail server that will handle incoming email.</p><p>I already have a domain hackmail.net which I will use as an example throughout this tutorial.</p><p>Here is how you need to configure your domain records. I use 123-reg.co.uk for domain registration. They provide their own <a href="https://www.123-reg.co.uk/support/domains/how-do-i-set-up-my-domain-name-to-point-to-my-own-mail-server/">guide on mail server setup</a>. Your registrar may have a similar guide.</p><h4>Step 1</h4><p>Delete any existing MX records on your domain.</p><h4>Step 2</h4><p>Add a new A record that points to your internet router IP Address.</p><pre>Hostname: mail<br>Type: A<br>Desination IP Address: &lt;Your routers Public IP Address&gt;</pre><h4>Step 3</h4><p>Create a new MX record that points to the fully qualified hostname</p><pre>Hostname: @<br>Type: MX<br>Priority: 10<br>Destination MX: mail.hackmail.net.</pre><p>Notice the full stop (period) after the Destination. MX records must be terminated with a period or they will not work.</p><p>That’s it, Your DNS is configured.</p><h3>Port Forwarding</h3><p>You only need to do this if the server, computer, laptop that you will be running the server on, is behind a network router. How you configure this will be different for every router brand. At a high level, you need to tell the router to forward all traffic arriving on port 25 to the internal IP address of the computer running the SMTP server.</p><pre>Forward all traffic arriving on port: <strong>25</strong></pre><pre>TO</pre><pre>IP Address: <strong>&lt;Your internal IP Address&gt;</strong><br>port: <strong>25</strong></pre><h3>Firewall configuration</h3><p>If you have a firewall set up on your network or computer, you will need to make sure that traffic on port 25 is allowed through. Consult the docs for the firewall your using.</p><h3>Writing the code</h3><p>Create a new folder called node_smtp_server</p><p>In the new folder, run the following command</p><pre>npm init -y</pre><p>Create a new file called app.js</p><pre>touch app.js</pre><p>Before I add any code, I am going to install two npm modules. Run the following command to install them.</p><pre>npm install smtp-server mailparser --save</pre><p>Now open app.js in your editor of choice and add the following code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/633571a2ec58a38e91a9049e6cd1a377/href">https://medium.com/media/633571a2ec58a38e91a9049e6cd1a377/href</a></iframe><p>On line 1, I import smtp-server this is the core of the application.</p><p>On line 2, I have imported mailparser, this will convert the received emails that are a simple string into a JSON object. This makes it easy to get the data I need or save them to a database like MongoDB.</p><p>Line 4 creates a new SMTP Server. It takes an object containing configuration as the constructor. In this example, I am passing in two options. I will cover the second option first.</p><p>disabledCommands is an array of commands you want to disable. In this case I am disabling AUTH. If you don’t do, this, any emails you send to this server will be bounced with an error. 530 Error: authentication Required</p><p>onData is a method that can take 3 parameters stream, session, and callback. In this case, I only require the stream and callback. The session is used for email clients, when a user is logging into the server with a client.</p><p>stream is a readable stream for the incoming email.<br>callback is run when the stream is ended. If you return an error object, it will reject the email.</p><p>Line 18 puts the server online. It only requires one parameter the port number In this case, I am also passing the optional IP address to listen on.</p><p>You can read more about the smtp-server module and it’s many options here <a href="https://nodemailer.com/extras/smtp-server/">https://nodemailer.com/extras/smtp-server/</a></p><h3>Testing it out</h3><p>I am going to send an email from my Gmail Account to simon@hackmail.net. When the message is received a few seconds later, the following is outputted to the terminal.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3da9ebd149bdb7ff5e96e16219d7ff3/href">https://medium.com/media/b3da9ebd149bdb7ff5e96e16219d7ff3/href</a></iframe><p>As you can see it’s an easy to use JSON object, thanks to the mailparser module.</p><h3>Conclusion</h3><p>Writing a mail server in NodeJS is really simple and can provide some really powerful features for an application.</p><p>Let me know in the comments, your ideas for using an SMTP server in an application.</p><p>As long as you can edit your domain’s DNS records, you can be up and running a few minutes.</p><p>If you liked this article, please show your appreciation and leave me a message. If you didn’t like it, I still appreciate the feedback, it keeps me on my toes 🙂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5688d8fd882e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>