<?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 James Bowen on Medium]]></title>
        <description><![CDATA[Stories by James Bowen on Medium]]></description>
        <link>https://medium.com/@jdbowen1994?source=rss-6e4a2352d438------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qnT68yw_8Bm5fGU2EOTiPw.jpeg</url>
            <title>Stories by James Bowen on Medium</title>
            <link>https://medium.com/@jdbowen1994?source=rss-6e4a2352d438------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:31:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jdbowen1994/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[How to Convert Zuken E3.series VBScript to Python]]></title>
            <link>https://medium.com/@jdbowen1994/how-to-convert-zuken-e3-series-vbscript-to-python-83d6334e05f7?source=rss-6e4a2352d438------2</link>
            <guid isPermaLink="false">https://medium.com/p/83d6334e05f7</guid>
            <category><![CDATA[zuken]]></category>
            <category><![CDATA[e3]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[vbscript]]></category>
            <dc:creator><![CDATA[James Bowen]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 00:00:53 GMT</pubDate>
            <atom:updated>2026-10-09T15:42:47.590Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*bhqafMJrqxfsd21X6L5XBQ.png" /></figure><p>If you automate Zuken E3.series, your scripts are almost certainly VBScript, and sooner or later you’ll need to convert them to Python. Microsoft is retiring VBScript from Windows, and Zuken now names Python as its preferred replacement. This guide covers the dates, what really changes in the code, and a way to plan the move that does not put your drawings at risk.</p><h3>The dates, and how firm they are</h3><p>Microsoft deprecated VBScript in October 2023 and set out three phases in May 2024.</p><ul><li><strong>Phase 1, now</strong> From Windows 11 version 24H2, VBScript is a Feature on Demand that is installed and enabled by default. Your scripts still run.</li><li><strong>Phase 2, around 2027</strong> The feature stops being enabled by default. Microsoft has also written “approximately 2026 or 2027” elsewhere, so treat the year as a guide rather than a promise.</li><li><strong>Phase 3, no date</strong> VBScript is removed from Windows. Microsoft’s wording is that its DLLs will be removed and “projects that rely on VBScript will stop functioning”.</li></ul><p>Phase 2 is the one to plan around. On the day a new laptop or a Windows feature update arrives with VBScript off, the add-on menu stops working for that user. IT can switch the feature back on, which buys time. It does not change where this ends.</p><h3>What Zuken has said</h3><p>Zuken’s position moved over 2026. In January its US blog said it “does not promote a specific scripting language for the E3.series API” while advising users to plan a conversion “before it is too late”. By September, writing about E3.series 2027, it said “Python is the preferred scripting language for E3.series”.</p><p>The practical support is already there:</p><ul><li>An official package, e3series, published on PyPI by Zuken E3 GmbH. It is a typed wrapper around the same COM interface VBScript uses.</li><li>A matching package for each product release since E3.series 26.10, according to Zuken.</li><li>Python examples alongside VBScript in the E3.series help from the 2026 release.</li><li>A public repository of examples covering setup, add-ons, printing to the message window and common problems.</li></ul><p>Zuken also runs a Python scripting course and offers conversion help of its own, which is worth knowing if you would rather train your team than hand the work out.</p><h3>What changes in the code</h3><p>The object model does not change. You still create a job object, ask it for IDs and point device, sheet and pin objects at them. Here is the same loop in both languages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*aXwNYgvcdtmLFOqUJNWxgw.png" /></figure><p>VBScript</p><pre>Set e3 = CreateObject(&quot;CT.Application&quot;) Set job = e3.CreateJobObject Set sheet = job.CreateSheetObject count = job.GetSheetIds(ids) For i = 1 To count sheet.SetId ids(i) e3.PutInfo 0, &quot;Sheet: &quot; &amp; sheet.GetName Next</pre><p>Python</p><pre>import e3series e3 = e3series.Application() job = e3.CreateJobObject() sheet = job.CreateSheetObject() count, ids = job.GetSheetIds() for sheet_id in ids: sheet.SetId(sheet_id) e3.PutInfo(0, f&quot;Sheet: {sheet.GetName()}&quot;)</pre><p>It looks like a tidy one-to-one translation. Four differences hide in it, and they are where converted scripts go wrong.</p><h3>1. Output parameters come back as a tuple</h3><p>VBScript passes ids by reference and the call fills it in. Python has no call by reference, so the package returns every output alongside the return value: count, ids = job.GetSheetIds(). Any call with an out parameter needs its line rewritten, not just its brackets added.</p><h3>2. Arrays are 0-based, and the dummy first element is gone</h3><p>E3.series hands VBScript arrays whose first element is empty, which is why every loop you have starts at 1. The Python package removes that element and gives you an ordinary 0-based tuple. A loop ported as for i in range(1, count) skips an item and raises no error. Iterate over the tuple directly and the problem disappears.</p><h3>3. On Error Resume Next has nowhere to go</h3><p>Plenty of E3.series VBScript leans on On Error Resume Next to carry on past a failure. Python has no such switch. The interface still reports most failures through return values, so the honest translation is to check those values, and to use try and except for the things that now raise, such as connecting when no E3.series is running.</p><h3>4. There is no “internal” script any more</h3><p>The usual VBScript helper checks whether it is running inside E3.series and either uses the host or creates CT.Application. Python always runs as its own process. e3series.Application() looks at the processes that started it and connects to that E3.series window, so a script launched from the add-on menu lands in the right project even with several copies open.</p><p><strong>One more to watch</strong> The enums in e3series.types are helpers. Zuken&#39;s notes say you pass Enum.value to the call, not the enum itself.</p><h3>Messages and print</h3><p>PutMessage and PutInfo work as before. The package also lets you redirect Python&#39;s own output to the E3.series message window, which makes scripts easier to write and to debug:</p><pre>import sys import e3series import e3series.tools e3 = e3series.Application() sys.stdout = e3series.tools.E3seriesOutput(e3, sys.stdout) print(&quot;This appears in the E3.series message window&quot;)</pre><h3>Getting Python onto users’ machines</h3><p>This is the part VBScript never asked of you, because the interpreter came with Windows. Zuken’s guidance comes down to a few points.</p><ul><li>Set the add-on up with pythonw.exe as the command and the script path as the argument.pythonw runs without a console window. From E3.series 2027 an administrator can define a default interpreter instead.</li><li>Use a virtual environment and point the add-on at its interpreter, so every user has the same package versions.</li><li>Do not install Python from the Microsoft Store. Zuken’s advice on that is three words long: “Don’t do it.”</li><li>Pin the e3series version. Its changelog shows array handling being corrected function by function across several releases, so an unplanned upgrade can change what a call returns.</li></ul><h3>A plan that does not break production</h3><ol><li><strong>Take an inventory</strong> List every script behind the add-on menu and every trigger. Note who uses it, how often, and which shared files it includes. Scripts nobody has run in two years can be retired instead of converted.</li><li><strong>Rank by risk, not size</strong> A script that writes to the project or produces a manufacturing document is higher risk than one that only reports. Start with something small and read-only.</li><li><strong>Capture what the VBScript does today</strong> Run each script on a fixed test project and keep its output: the cut list, the BOM, the log. That output is the specification.</li><li><strong>Convert the shared helpers first</strong> Connection, logging, attribute lookups and settings files usually sit in a few common files. Port those once into a module and every later script gets shorter.</li><li><strong>Compare old against new</strong> Run the Python version on the same test project and compare the output with what you captured. A difference is either a porting mistake or an old bug you have just found. Decide which before moving on.</li><li><strong>Run both for a while</strong> Keep the VBScript entry on the menu next to the Python one until users have been through a full release cycle on the new version.</li></ol><h3>When to start</h3><p>Nothing stops working this month. The reason to begin now is that the date you lose VBScript is not one you control. It arrives with a Windows update or a new PC, and the conversion is far easier to do well while the old scripts still run and can be used as the reference.</p><h3>Rather not do this yourself?</h3><p>I write and maintain E3.series scripts for wire harness manufacturing, and I convert E3.series VBScript to Python as a service, tested against the originals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E-fnYr_mPZEeJRsP" /></figure><h3>Sources</h3><p>James Bowen is an independent developer and is not affiliated with Zuken. E3.series is a trademark of Zuken. Dates were checked against the sources above on 5 October 2026 and may change. Code samples show the pattern; check them against your own E3.series version before relying on them.</p><p><em>Originally published at </em><a href="https://james-bowen.co.uk/blog/e3-series-vbscript-to-python/"><em>https://james-bowen.co.uk</em></a><em> on October 5, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83d6334e05f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Stop Spam Emails with reCAPTCHA, HTML & PHP]]></title>
            <link>https://medium.com/@jdbowen1994/stopping-spam-emails-with-recaptcha-6d5fe41867fb?source=rss-6e4a2352d438------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d5fe41867fb</guid>
            <category><![CDATA[spam]]></category>
            <category><![CDATA[recaptcha]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[James Bowen]]></dc:creator>
            <pubDate>Sun, 26 Jun 2022 23:10:39 GMT</pubDate>
            <atom:updated>2022-06-28T10:43:06.099Z</atom:updated>
            <content:encoded><![CDATA[<p>I set up a contact form on my website and recieved hundreds of spam emails, it was time to put a stop to that so I decided to add reCAPTCHA to my website to block those pesky bots.</p><figure><img alt="reCAPTCHA logo" src="https://cdn-images-1.medium.com/max/1024/1*5vwjFwl8qkfpaK00MIfZsw.png" /></figure><h3><strong>Step 1</strong></h3><p>Sign up and get your keys for the site from here <a href="https://www.google.com/recaptcha/admin">https://www.google.com/recaptcha/admin</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*4RHNmEyk4RnFXrwylXUR7w.png" /></figure><p>Enter all the info as required, this guide relates to reCAPTCHA v2 only so select that option, enter the domain of the website this will be used on.</p><p>You will get a site key and a secret key these will be used later on</p><h3><strong>Step 2</strong></h3><p>Add the following code to your sites header:</p><pre>&lt;script src=&quot;https://www.google.com/recaptcha/api.js&quot;&gt;&lt;/script&gt;</pre><h3><strong>Step 3</strong></h3><p>Add the following into your form and add your site key that you got previously:</p><pre>&lt;div class=&quot;g-recaptcha brochure__form__captcha&quot; data-sitekey=&quot;YOUR SITE KEY&quot;&gt;&lt;/div&gt;</pre><p>This is what my form looks like:</p><pre>&lt;form method=&quot;post&quot; action=&quot;contact.php&quot;&gt;</pre><pre>&lt;label for=&quot;email&quot;&gt;Email&lt;/label&gt;</pre><pre>&lt;input</pre><pre>type=&quot;email&quot;</pre><pre>id=&quot;email&quot;</pre><pre>name=&quot;email&quot;</pre><pre>placeholder=&quot;Email&quot;</pre><pre>required</pre><pre>/&gt;</pre><pre>&lt;label for=&quot;fname&quot;&gt;First Name&lt;/label&gt;</pre><pre>&lt;input</pre><pre>type=&quot;text&quot;</pre><pre>id=&quot;fname&quot;</pre><pre>name=&quot;firstname&quot;</pre><pre>placeholder=&quot;Name&quot;</pre><pre>required</pre><pre>/&gt;</pre><pre>&lt;label for=&quot;message&quot;&gt;Message&lt;/label&gt;</pre><pre>&lt;textarea</pre><pre>id=&quot;message&quot;</pre><pre>name=&quot;message&quot;</pre><pre>placeholder=&quot;Leave message here&quot;</pre><pre>style=&quot;height: 100px; resize: vertical&quot;</pre><pre>required</pre><pre>&gt;&lt;/textarea&gt;</pre><pre>&lt;div</pre><pre>class=&quot;g-recaptcha brochure__form__captcha&quot;</pre><pre>data-sitekey=&quot;YOUR SITE KEY&quot;</pre><pre>&gt;&lt;/div&gt;</pre><pre>&lt;input</pre><pre>type=&quot;submit&quot;</pre><pre>name=&quot;submit&quot;</pre><pre>value=&quot;Submit&quot;</pre><pre>class=&quot;center-button&quot;</pre><pre>/&gt;</pre><pre>&lt;/form&gt;</pre><h3>Step 4</h3><p>On form submission do this:</p><pre>$recaptcha = $_POST[&#39;g-recaptcha-response&#39;];<br>$res = reCaptcha($recaptcha);<br>if($res[&#39;success&#39;]){<br>  // Send email<br>}else{<br>  // Error<br>}</pre><p>Using this function:</p><pre><em>function</em> reCaptcha($recaptcha){<br>  $secret = &quot;YOUR SECRET KEY&quot;;<br>  $ip = $_SERVER[&#39;REMOTE_ADDR&#39;];<br><br>  $postvars = array(&quot;secret&quot;=&gt;$secret, &quot;response&quot;=&gt;$recaptcha, &quot;remoteip&quot;=&gt;$ip);<br>  $url = &quot;https://www.google.com/recaptcha/api/siteverify&quot;;<br>  $ch = curl_init();<br>  curl_setopt($ch, CURLOPT_URL, $url);<br>  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br>  curl_setopt($ch, CURLOPT_TIMEOUT, 10);<br>  curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);<br>  $data = curl_exec($ch);<br>  curl_close($ch);<br><br>  return json_decode($data, true);<br>}</pre><p>This is what it looks like all together:</p><pre>&lt;?php</pre><pre>if(isset($_POST[&#39;submit&#39;])){</pre><pre>$recaptcha = $_POST[&#39;g-recaptcha-response&#39;];</pre><pre>$res = reCaptcha($recaptcha);</pre><pre>if($res[&#39;success&#39;]){</pre><pre>$to = &quot;YOUR-EMAIL&quot;; // this is your Email address</pre><pre>$from = $_POST[&#39;email&#39;]; // this is the `sender&#39;s Email address</pre><pre>$first_name = $_POST[&#39;firstname&#39;];</pre><pre>$message = $first_name . &quot; wrote the following:&quot; . &quot;\n&quot; . $_POST[&#39;message&#39;];</pre><pre>$subject = &quot;Personal Portfolio Form&quot;;</pre><pre>$headers = &quot;From &quot; . $from;</pre><pre>mail($to,$subject,$message,$headers);</pre><pre>echo &quot;Mail Sent. Thank you &quot; . $first_name . &quot;, I will contact you shortly.&quot;;</pre><pre>}else{</pre><pre>// Failed reCAPTCHA</pre><pre>echo &quot;Failed to send&quot;;</pre><pre>}</pre><pre>}</pre><pre>function reCaptcha($recaptcha){</pre><pre>$secret = &quot;YOUR SECRET KEY&quot;;</pre><pre>$ip = $_SERVER[&#39;REMOTE_ADDR&#39;];</pre><pre>$postvars = array(&quot;secret&quot;=&gt;$secret, &quot;response&quot;=&gt;$recaptcha, &quot;remoteip&quot;=&gt;$ip);</pre><pre>$url = &quot;https://www.google.com/recaptcha/api/siteverify&quot;;</pre><pre>$ch = curl_init();</pre><pre>curl_setopt($ch, CURLOPT_URL, $url);</pre><pre>curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);</pre><pre>curl_setopt($ch, CURLOPT_TIMEOUT, 10);</pre><pre>curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);</pre><pre>$data = curl_exec($ch);</pre><pre>curl_close($ch);</pre><pre>return json_decode($data, true);</pre><pre>}</pre><pre>?&gt;</pre><p>Hopefully this all works as easily for you as it did for me, any edits or feedback is welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d5fe41867fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advantages of Cloud Computing]]></title>
            <link>https://medium.com/@jdbowen1994/advantages-of-cloud-computing-4eed13900c08?source=rss-6e4a2352d438------2</link>
            <guid isPermaLink="false">https://medium.com/p/4eed13900c08</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[James Bowen]]></dc:creator>
            <pubDate>Tue, 21 Jun 2022 23:14:14 GMT</pubDate>
            <atom:updated>2022-06-27T07:55:24.205Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*m2EYROfJI5miiC2jMR7bAA.jpeg" /></figure><h3>What is Cloud Computing</h3><p>“Cloud computing is the on-demand delivery of IT resources over the Internet with pay-as-you-go pricing. Instead of buying, owning, and maintaining physical data centers and servers, you can access technology services, such as computing power, storage, and databases, on an as-needed basis from a cloud provider like Amazon Web Services (AWS).”</p><h3>Advantages</h3><ul><li>Only pay for what you need when you are using it, resources can be scaled down as needed</li><li>Can get resources within a few minutes</li><li>Ability to scale rapidly</li><li>No upfront cost</li><li>Accessible anywhere</li></ul><h3>Things to consider</h3><ul><li>Internet stability is very important</li><li>Security all data is sent to the cloud service provider</li><li>May suffer downtime due to cloud provider suffering power loss, internet connectivity, maintenance</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4eed13900c08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running a Computer in the Cloud for Free (AWS) in 10 Minutes]]></title>
            <link>https://medium.com/@jdbowen1994/running-a-computer-in-the-cloud-for-free-aws-in-10-minutes-31191ce9e30c?source=rss-6e4a2352d438------2</link>
            <guid isPermaLink="false">https://medium.com/p/31191ce9e30c</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-services]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[James Bowen]]></dc:creator>
            <pubDate>Tue, 21 Jun 2022 23:13:18 GMT</pubDate>
            <atom:updated>2022-06-21T23:13:18.338Z</atom:updated>
            <content:encoded><![CDATA[<p>I set up an AWS account and had a computer running in the cloud within 10 minutes for free</p><p>Go to <a href="https://aws.amazon.com/">https://aws.amazon.com/</a> click create an AWS account in the top right corner</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OSNn8196d6Z53Z3HrbFJkw.jpeg" /></figure><p>Click create a new AWS account and fill out all the details requested, you will have to verify your email, mobile and debit/credit card</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wJDMbTW1RgeVvrSl3TZDCg.jpeg" /></figure><p>Sign into your account once everything has been verified</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*9K6w5QIijVM5psYhhLc6aQ.jpeg" /></figure><p>There are various options available, I chose the free one</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*MoWzKWm6Fzk1NeAdwsztLA.jpeg" /></figure><p>Finally you will be directed to the home page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bz0Kpm6lz6E8WGxKMPrumA.jpeg" /></figure><p>Scroll down and click “Launch a virtual machine”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bYYGFTGqjDJjQbhbomAHyA.jpeg" /></figure><p>I used the default options, but other OS’s can be selected, make sure Free tier eligible is shown as highlighted below, then click launch instance bottom right</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Jq3DdAclUys8U6cSchVgw.jpeg" /></figure><p>You will need to create a key pair to connect securely, I used mykey as the “Key pair name”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*vMyK6W8NH2cEdopd6E1lZw.jpeg" /></figure><p>Once you have launched click the link as highlighted below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXOEi4ypX7QC5daiBSdPBw.jpeg" /></figure><p>As you can see the instance is now running, click the instance ID</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IC4PmeCcaddG0Rsst0qhYg.jpeg" /></figure><p>EC2 Instance connect is through browser, just click “Connect”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*PblZVr_BEPdmFqdomu3YSw.jpeg" /></figure><p>Once connected you will see a command line screen and you are now connected to a PC on the cloud!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*m4_ocOaCb09NBVrDO7LRrA.jpeg" /></figure><p>I tried out some basic Linux commands as below:</p><p>pwd — shows the current directory</p><p>ls — lists all the directories and files in current directory</p><p>cd — changes directory, cd.. is used to go up a directory</p><p>mkdir — makes a new directory with whatever name you choose</p><p>touch — creates a file/directory with whatever name you give it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-KJ8NW-y9mxKUJsyAz7WgQ.jpeg" /></figure><p>You can terminate the instance by going back to this screen, right clicking on the instance ID and selecting “Terminate instance”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*TF153ufZa6YhrQyFjH9kaA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31191ce9e30c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Kubernetes + Docker]]></title>
            <link>https://medium.com/@jdbowen1994/understanding-kubernetes-docker-5c85abe5cfeb?source=rss-6e4a2352d438------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c85abe5cfeb</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[James Bowen]]></dc:creator>
            <pubDate>Tue, 21 Jun 2022 23:07:30 GMT</pubDate>
            <atom:updated>2022-06-21T23:07:30.341Z</atom:updated>
            <content:encoded><![CDATA[<p>I spent an hour as a complete beginner learning Kubernetes &amp; Docker this is what I learnt:</p><h3>Docker</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*GUVzssBqiHcPR6xdU5O0uQ.png" /></figure><p>A standard, reproducible environment, good for testing.</p><p>Before docker, a developer could send their code to someone else and it could fail to run on the testers machine e.g. different versions or dependencies, java 1.8 to 3, different root dirs, e.g between Windows/Linux</p><p>With docker you can now run the code on the exact same environment.</p><p>To make a docker image/container, you make a Dockerfile which is a script that allows you to choose any operating system to install then install specific things on that, this happens every time it boots.</p><p>Ubuntu:18.04</p><pre>RUN apt-get update &amp;&amp; \\</pre><pre>apt-get install -y redis-server &amp;&amp; \\</pre><pre>apt-get clean</pre><pre>sudo apt-get python</pre><h3>Kubernetes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*NNmkjW6mx7XWp6VD58zCTg.png" /></figure><p>Kubernetes comes in when you have more than one docker container that needs to talk to the others, e.g. in the land of micro services, you have lots of apps trying to talk to each other</p><p>Some things Kubernetes will do; container deployment (start up all the docker images), scaling (dno), healing (if a docker image dies or killed, it will start another) and load balancing of containers (if you have multiple docker images on your laptop, then Kubernetes will balance CPU and memory between them).</p><h3>How they work together</h3><p>Docker creates the containers Kubernetes manages them</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c85abe5cfeb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Squarespace jQuery Code Injection]]></title>
            <link>https://medium.com/@jdbowen1994/first-time-squarespace-code-injection-6eda0993fb66?source=rss-6e4a2352d438------2</link>
            <guid isPermaLink="false">https://medium.com/p/6eda0993fb66</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[jquery]]></category>
            <category><![CDATA[squarespace]]></category>
            <dc:creator><![CDATA[James Bowen]]></dc:creator>
            <pubDate>Mon, 02 May 2022 15:54:23 GMT</pubDate>
            <atom:updated>2022-05-18T18:24:29.016Z</atom:updated>
            <content:encoded><![CDATA[<h3>What to implement</h3><ol><li>Include a shipping dropdown selector that shows shipping times and prices, read in the shipping information from another page</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MKHf0vlCdO1hr8TZJYP0MQ.jpeg" /></figure><p>2. Add a search bar to the header that displays as a magnifying glass and then expands into a search bar when clicked, it should also popup with the search results when the user starts typing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/115/1*Yg58WSmtONtudNFs7auOgw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqTlc8LDhHoOjxRNUYqOQQ.jpeg" /></figure><p>3. Change how colours and sizes are displayed from dropdown list to colour selector palette</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*aDvXXVFDPX1NAubX947_tw.jpeg" /></figure><h3>Injecting My First Code</h3><p>I had never injected JavaScript into Squarespace before so first off I decided to try and get something very simple working to give me a good starting point.</p><p>I added the following JavaScript into the header, this should add the html &quot;&lt;h1&gt;Hello World!&lt;/h1&gt;&quot; into the element with the id of &quot;block-ca33eeb90eb2c5aa8c35&quot; :</p><pre>&lt;script&gt;<br>  window.onload = function() {<br>  	document.getElementById(&quot;block-ca33eeb90eb2c5aa8c35&quot;).innerHTML = &quot;&lt;h1&gt;Hello World!&lt;/h1&gt;&quot;;<br>  }<br>&lt;/script&gt;</pre><p>This is the website before saving the code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iEs6f-W9VYhG52DCyyQZyA.jpeg" /></figure><p>When saving the code it had the following effect:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hED3s7KV-W9qKELgL6G-Ig.jpeg" /></figure><p>I then decided to use the jQuery Javascript library as a lot of the features it offered would be beneficial for what I wanted to implement, I found the following website very useful to understand the syntax</p><p><a href="https://www.w3schools.com/jquery/">https://www.w3schools.com/jquery/</a></p><p>I loaded the jQuery library into my Squarespace site using the following line of code:</p><pre>&lt;script src=&quot;&lt;https://code.jquery.com/jquery-3.6.0.js&gt;&quot;&gt;&lt;/script&gt;</pre><h3>Implementing the Shipping Dropdown Box 1)</h3><p>First off I added a dropdown box and a div element using a HTML block:</p><pre>&lt;div class=&quot;country-container&quot;&gt;<br>	&lt;select id=&quot;country-select&quot; &gt;<br>      &lt;option value=&quot;&quot;&gt;Select your country&lt;/option&gt;<br>    &lt;/select&gt;<br>    &lt;div id=&quot;country-display&quot;&gt;Delivery Times and Cost&lt;/div&gt;<br>&lt;/div&gt;</pre><p>I created a new unlinked page and named it shipping, on this page I created a text block and inserted the shipping data for every country in the following format</p><p>COUNTRY_NAME, DELIVERY_TIME, DELIVERY_COST</p><p>Note the commas in the above are very important and are used to separate each input</p><p>Having the data for the shipping information on this page will allow anyone with access to the website in Squarespace the ability to update this information.</p><p>After a bit of playing around with jQuery I managed to get the following code to work:</p><pre>&lt;script&gt;<br>$(document).ready(function () {<br>	//read all options in from shipping page<br>	$.get(&quot;/shipping&quot;, function (data) {<br>		data = $(data).find(&quot;p&quot;);<br>		//print them into a hidden div so they can be read in through an each loop<br>		$(&quot;div#test&quot;).html(data);<br>		//for each item add an option element with number of days and cost data attributes<br>		$(&quot;div#test p&quot;).each(function () {<br>			const countryArray = $(this).text().split(&quot;,&quot;);  //Split each paragraph using the comma<br>		//Add each country to a select element and add the delivery days and costs as attributes	<br>		$(&quot;select#country-select&quot;).append(<br>				&quot;&lt;option data-country=&quot; +<br>					countryArray[0].trim() +<br>					&quot; data-days=&quot; +<br>					countryArray[1].trim() +<br>					&quot; data-cost=&quot; +<br>					countryArray[2].trim() +<br>					&quot;&gt;&quot; +<br>					countryArray[0].trim() +<br>					&quot;&lt;/option&gt;&quot;<br>			);<br>		});<br>		//Select the UK as the default option<br>		$(&quot;select#country-select option[data-country=UK]&quot;)<br>			.attr(&quot;selected&quot;, &quot;selected&quot;)<br>			.change();<br>	});<br>	//When the selected option is changed, change the text displayed in the div<br>	$(&quot;#country-select&quot;).change(function () {<br>		var optionSelected = $(this).find(&quot;option:selected&quot;);<br>		var day = optionSelected.data(&quot;days&quot;) + &quot; days - &quot;;<br>		var cost = &quot;£&quot; + optionSelected.data(&quot;cost&quot;);<br>		var country = optionSelected.data(&quot;country&quot;) + &quot; - &quot;;<br>		$(&quot;#country-display&quot;).text(country + day + cost);<br>	});<br>});<br>&lt;/script&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*OfvP4JZ8tS7kiqhoqTr6xg.gif" /></figure><h3>Limitations</h3><ul><li>The shipping information will only be updated when someone manually updates it, it is not in any way linked to the actual shipping price that is given to Squarespace at a different point</li></ul><h3>Implementing the Search Bar 2)</h3><p>Having a search bar in the header is not a standard feature in Squarespace, I found the following guide which explains how to add it there:</p><p><a href="https://www.will-myers.com/articles/adding-a-search-bar-to-your-header-in-squarespace-71">https://www.will-myers.com/articles/adding-a-search-bar-to-your-header-in-squarespace-71</a></p><p>After completing the above steps I then wanted to change it so that only a magnifying glass was shown until the user clicked it, to do this I used a magnifying glass from the font awesome icon library and added some jQuery and CSS to hide and show some elements when the user clicked.</p><pre>//Link to the fontawesome icon<br>&lt;script src=&quot;&lt;https://kit.fontawesome.com/95625e95a1.js&gt;&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>&lt;script&gt;<br>	$(document).ready(function(){<br>		$(function () {<br>			//Change the id to the id of the search block in the footer<br>			let searchBlock = $(&quot;#block-48b06b63c27b9bc086e0&quot;)<br>				.attr(&quot;id&quot;, &quot;&quot;)<br>				.addClass(&quot;header-search-bar&quot;);<br>	<br>			//Display the magnifiying glass icon<br>			$(&quot;&lt;i class=&#39;fa-solid fa-magnifying-glass&#39;&gt;&lt;/i&gt;&quot;).insertBefore(<br>				$(&quot;.showOnDesktop .header-actions-action--cart&quot;)<br>			);<br>			$(&quot;&lt;div class=&#39;search hide&#39;&gt;&lt;/div&gt;&quot;).insertBefore(&quot;header&quot;);<br>			$(&quot;div.search&quot;).append(searchBlock);<br>			$(&quot;div.search&quot;).append(&quot;&lt;i class=&#39;fa-solid fa-xmark&#39;&gt;&lt;/i&gt;&quot;);<br>	<br>			//When the magnificy glass is clicked<br>			$(&quot;i.fa-magnifying-glass&quot;).click(function () {<br>				//hide everything in the header and display the search bar full width<br>				$(&quot;header&quot;).addClass(&quot;hide&quot;); //hide the header<br>				$(&quot;div.search&quot;).removeClass(&quot;hide&quot;); //unhide the search bar<br>			});<br>			<br>			//Show an X mark icon that will re show the header when clicked<br>			$(&quot;i.fa-xmark&quot;).click(function () {<br>				$(&quot;header&quot;).removeClass(&quot;hide&quot;); //unhide the header<br>				$(&quot;div.search&quot;).addClass(&quot;hide&quot;); //hide the search bar<br>			});<br>		})<br>	});<br>&lt;/script&gt;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*WefRiuYaYOJpJdq6h_fHlQ.gif" /></figure><h3>Limitations</h3><ul><li>Search bar is currently limited to the functionality that Squarespace have added</li><li>Does not currently display on a customised menu</li></ul><h3>Implementing Colour and Size Selectors 3)</h3><p>I started by hiding the previous dropdown boxes:</p><pre>//Hides both dropdown boxes<br>$(&quot;div.variant-select-wrapper&quot;).hide();</pre><p>Then adding a &lt;ul&gt; tag, using the correct selectors here is slightly complex:</p><pre>$(&quot;div.variant-select-wrapper:has(select[data-variant-option-name=&#39;Color&#39;])&quot;)<br>.after(&quot;&lt;ul class=&#39;color-selector&#39;&gt;&quot;);</pre><p>Then for each option that is in the dropdown box except the first option which is used as a placeholder we add an &lt;li&gt; tag with some inline CSS to set the color</p><pre>//for every option in the select tag except the first<br>$(&quot;div.variant-select-wrapper:has(select[data-variant-option-name=&#39;Color&#39;]) option:not(:first)&quot;)<br>.each(function () {<br>		var color = $(this).val(); //store the color<br>		$(<br>			&quot;&lt;li class=&#39;color-selector-item&#39;&gt; &lt;button class=&#39;color-selector-button&#39; type=&#39;button&#39; title=&#39;&quot; +<br>				color +<br>				&quot;&#39; style=&#39;background-color: &quot; +<br>				color +<br>				&quot; !important;&#39;&gt;&quot; +<br>				color +<br>				&quot;&lt;/button&gt;&lt;/li&gt;&quot;<br>		).appendTo(&quot;ul.color-selector&quot;);<br>	});<br>	//after the loop close the &lt;ul&gt; tag<br>	$(&quot;li.color-selector-item:last&quot;).after(&quot;&lt;/ul&gt;&quot;);</pre><p>When any of the colour selectors are clicked we want to display the colour on the screen as text and select it through the dropdown box hidden in the background:</p><pre>$(&quot;button.color-selector-button&quot;).click(function () {<br>		//Chnage the text on the screen<br>		$(&quot;div.variant-option-title:contains(&#39;Color&#39;)&quot;).html(<br>			&quot;Color: &quot; + $(this).text()<br>		);<br>	});</pre><p>Unfortunately I encountered problems with setting the hidden dropdown selectors.</p><h3>Problems encountered implementing colour and size selector:</h3><p>Changing the value of the select element as below would not change the colour that was written in the dropdown menu on the screen</p><pre>$(&quot;select[data-variant-option-name=Color]&quot;)<br>			.val($(this).text());</pre><p>Even triggering the change event did not work:</p><pre>$(&quot;select[data-variant-option-name=Color]&quot;)<br>			.val($(this).text())<br>			.change();</pre><p>The only way I found to change what was in the dropdown was to change the data-text attribute highlighted in the above HTML</p><pre>&lt;div class=&quot;variant-select-wrapper color-wrapper&quot; data-text=&quot;White&quot; id=&quot;yui_3_17_2_1_1651002078249_616&quot;&gt;<br>      &lt;select aria-label=&quot;Select Color&quot; data-variant-option-name=&quot;Color&quot; id=&quot;yui_3_17_2_1_1651002078249_615&quot;&gt;<br>        &lt;option value=&quot;&quot;&gt;Select Color&lt;/option&gt;<br>        &lt;option value=&quot;Black&quot;&gt;Black&lt;/option&gt;&lt;option value=&quot;White&quot;&gt;White&lt;/option&gt;&lt;option value=&quot;Grey&quot;&gt;Grey&lt;/option&gt;&lt;option value=&quot;Teal&quot;&gt;Teal&lt;/option&gt;&lt;option value=&quot;Charcoal&quot;&gt;Charcoal&lt;/option&gt;&lt;option value=&quot;Purple&quot;&gt;Purple&lt;/option&gt;<br>      &lt;/select&gt;<br>    &lt;/div&gt;</pre><pre>$(&quot;div.variant-select-wrapper.color-wrapper&quot;)<br>			.attr(&quot;data-text&quot;, $(this).text())<br>			.change();</pre><p>Although this worked in terms of displaying the colour in the dropdown when one of the new color selectors was clicked it did not then allow me to add that item to the basket stating “Please select a Color and Size”</p><p>I looked through the HTML and noticed that when I manually made a selection through the dropdown boxes there were a few notable attributes that changed</p><pre>data-unselected-options=&quot;[&quot;Color&quot;,&quot;Size&quot;]&quot;</pre><p>The above would change to remove one or both of the items when selected, when color was selected:</p><pre>data-unselected-options=&quot;[&quot;Size&quot;]&quot;</pre><p>Also a new attribute would be added when both color and size were selected:</p><pre>data-selected-variant=&quot;{&quot;attributes&quot;:{&quot;Size&quot;:&quot;M&quot;,&quot;Color&quot;:&quot;White&quot;},&quot;optionValues&quot;:[<br>{&quot;optionName&quot;:&quot;Size&quot;,&quot;value&quot;:&quot;M&quot;},{&quot;optionName&quot;:&quot;Color&quot;,&quot;value&quot;:&quot;White&quot;}],<br>&quot;id&quot;:&quot;ae248023-a7b2-4ebb-89ef-55764797f7e1&quot;,&quot;sku&quot;:&quot;SQ2275958&quot;,&quot;price&quot;:4000,<br>&quot;salePrice&quot;:0,&quot;priceMoney&quot;:{&quot;currency&quot;:&quot;GBP&quot;,&quot;value&quot;:&quot;40.00&quot;},<br>&quot;salePriceMoney&quot;:{&quot;currency&quot;:&quot;GBP&quot;,&quot;value&quot;:&quot;0.00&quot;},&quot;onSale&quot;:false,&quot;unlimited&quot;:true,<br>&quot;qtyInStock&quot;:0,&quot;width&quot;:0,&quot;height&quot;:0,&quot;weight&quot;:0,&quot;imageIds&quot;:[],&quot;images&quot;:[],&quot;len&quot;:0}&quot;</pre><p>Also the following attribute would be added if the variant was in stock</p><pre>data-variant-in-stock=&quot;true&quot;</pre><p>If I manually hard coded these values and set the data-unselected-options to be empty, the data-variant-in-stock to be true and the data-selected-variant to be a real value I was able to add the item to the cart, the problem with this is that I would not be able to easily get all the information for the data-selected-variant attribute as well as whether the variant was in stock.</p><p>I need to find a way to select the dropdown box in the background as if a user was just clicking it manually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*DOT774Mtrlvf4g-wpo5oIQ.gif" /></figure><h3>The Solution</h3><p>Finally I found the solution to trigger the select of both the colour and size Squarespace selectors</p><pre>document.querySelector(&quot;select[data-variant-option-name=&#39;Color&#39;]&quot;).dispatchEvent(new Event(&quot;change&quot;));</pre><p>The following code shows simply how to select a colour and size using jQuery and then trigger the change event so when the add to cart button is pressed the correct item is added to the cart:</p><pre>$(document).ready(function () {<br>	let myColour = &quot;Grey&quot;;<br>	let mySize = &quot;M&quot;;<br>  <br>	$(&quot;.variant-option-title&quot;).click(function () {<br>		$(&quot;select[data-variant-option-name=Color]&quot;).val(myColour);<br>		document.querySelector(&quot;select[data-variant-option-name=&#39;Color&#39;]&quot;).dispatchEvent(new Event(&quot;change&quot;));<br>		$(&quot;select[data-variant-option-name=Size]&quot;).val(mySize);<br>    document.querySelector(&quot;select[data-variant-option-name=&#39;Size&#39;]&quot;).dispatchEvent(new Event(&quot;change&quot;));<br>	});<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*l-hp3001M6_Ih1Fk4fTeLw.gif" /></figure><h3>Limitations</h3><ul><li>The colours will only display if they are html colours as in <a href="https://www.w3schools.com/colors/colors_names.asp">this</a> list (supported by all browsers), this means that the product variant must also be named as this colour, it is possible to get around this in the future by linking colours to hex or RGB values or even pictures but this simplifies it for now (An alert is displayed when a colour does not exist, will detect typos etc)</li><li>The image does not change to display a different colour variant when it is changed</li></ul><h3>View the website here</h3><p><a href="https://crane-cinnamon-w8mr.squarespace.com/">https://crane-cinnamon-w8mr.squarespace.com/</a></p><p>Password — 123</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6eda0993fb66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a HTML5 Canvas Game with Javascript]]></title>
            <link>https://medium.com/@jdbowen1994/creating-a-html5-canvas-game-with-javascript-a354345f82f8?source=rss-6e4a2352d438------2</link>
            <guid isPermaLink="false">https://medium.com/p/a354345f82f8</guid>
            <category><![CDATA[javascript-game]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[James Bowen]]></dc:creator>
            <pubDate>Sun, 10 Oct 2021 23:05:04 GMT</pubDate>
            <atom:updated>2021-10-10T23:08:41.282Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>The Idea</strong></h3><p>The idea of the game is very simple, blocks fall down from the top of the screen and the player has to dodge them, once the blocks have fallen the player can jump on top of a block, the aim of the game is to reach the top without being squished by a falling block or being trapped by the rising snow.</p><figure><img alt="Storyboard Diagram" src="https://cdn-images-1.medium.com/max/406/1*lB_MNOY9EGohQ9tHHgEsbA.jpeg" /></figure><h3>Features</h3><p>Guidance on the first level</p><p>Multiple levels incresing in difficulty</p><p>Music and sound can be enabled and disabled</p><p>Cookies used to rember highscore, music and sound choice</p><p>Addictive freeplay level</p><h3><strong>Implementation</strong></h3><p>I created the game using using JavaScript, HTML and CSS these are all client side languages and therefore reduce load on the server which would allow multiple users to play the game on their machines at the same time.</p><p>I decided to use an additional library to help me deal with the sounds used by the canvas game the library I used was called Buzz and a reference can be found on the about page of the game website, it made playing the sounds much easier along with setting the volumes for both the music and sound effects therefore I could easily mute the volumes just by setting the volume to 0.</p><h4>Future Improvements</h4><p>Make the freeplay level continue until the player dies</p><p>Add a feature where the player can jump on top of a falling box</p><p>Make the game mobile friendly</p><p>Display the player as an animated sprite</p><p>Try the game out here <a href="https://james-bowen.co.uk/Avalanche/avalanche.html">Avalanche (james-bowen.co.uk)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a354345f82f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>