<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>web dev &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/web-dev/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Tue, 03 Dec 2024 09:34:39 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>web dev &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Let's build a website using XML!]]></title>
		<link>https://shkspr.mobi/blog/2023/08/lets-build-a-website-using-xml/</link>
					<comments>https://shkspr.mobi/blog/2023/08/lets-build-a-website-using-xml/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sat, 19 Aug 2023 11:34:35 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[web dev]]></category>
		<category><![CDATA[XML]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=46577</guid>

					<description><![CDATA[It is 2023. XHTML is dead and buried. HTML is a &#34;living standard&#34; with billions of users. So what kind of idiot would want to build a website using XML?  Me. I am that idiot.  Last year, I launched a &#34;web page&#34; which didn&#039;t use HTML. Called, appropriately enough, &#34;YOU DON&#039;T NEED HTML!&#34; That (ab)used Unicode to make a somewhat attractive page. This year, I decided to forego the Unicode silliness…]]></description>
										<content:encoded><![CDATA[<p>It is 2023. XHTML is dead and buried. HTML is a "living standard" with billions of users. So what kind of idiot would want to build a website using XML?</p>

<p>Me. I am that idiot.</p>

<p>Last year, I launched a "web page" which didn't use HTML. Called, appropriately enough, "<a href="https://shkspr.mobi/blog/2022/12/you-dont-need-html/">YOU DON'T NEED HTML!</a>" That (ab)used Unicode to make a somewhat attractive page. This year, I decided to forego the Unicode silliness and use XML silliness instead.</p>

<h2 id="demo"><a href="https://shkspr.mobi/blog/2023/08/lets-build-a-website-using-xml/#demo">Demo</a></h2>

<p>Visit <a href="https://xml.viii.fi/index.xml"></a><a href="https://xml.viii.fi/index.xml">https://xml.viii.fi/index.xml</a> and see for yourself. Take a look at the source-code to verify that it is, indeed, an XML document.</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2023/08/xml-fs8.png" alt="Screenshot of some XML code." width="732" height="372" class="aligncenter size-full wp-image-46586">

<p>All modern browsers <em>should</em> be able to render it. If you spot any glitches - please let me know.</p>

<h2 id="why"><a href="https://shkspr.mobi/blog/2023/08/lets-build-a-website-using-xml/#why">Why</a></h2>

<p>Because I can 😂</p>

<p>OK, there were three main reasons:</p>

<ol>
<li>I learned this stuff at University about a million years ago and I wondered if these skills were still relevant (they aren't!)</li>
<li>Browsers are constantly deprecating old features. I wanted to see if XML &amp; XSL still worked (they do!)</li>
<li>The voices in my head told me to (they didn't!)</li>
</ol>

<p>As an additional bonus reason - I'm bemused by the number of pages which are basically JSON files with client side Javascript rendering. So I thought I'd go old-skool and have the client rendering done <em>without</em> <strong>any</strong> JS!</p>

<p>Bonus bonus reason - semantics!</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2023/08/meme-xml-xslt.jpg" alt="Popular meme format. A young man points at a butterfly and says &quot;Is this the semantic web?&quot;
The butterfly is labelled &quot;XML + XSLT&quot;." width="556" height="500" class="aligncenter size-full wp-image-46587">

<h2 id="how"><a href="https://shkspr.mobi/blog/2023/08/lets-build-a-website-using-xml/#how">How</a></h2>

<p>Regular readers will recall that I wrote about <a href="https://shkspr.mobi/blog/2023/06/style-your-wordpress-atom-feed/">how to style your WordPress Atom feed</a>. The technique is pretty simple: take a well-formed XML document and link it to an XSL stylesheet, <i lang="fr">et voilà</i> there's a beautifully rendered document in your browser.</p>

<p>For this demo, I didn't bother with a proper document schema. I just bashed some random elements together.</p>

<p>The XSL tells the browser to render it as HTML and provides a scaffold for doing so.</p>

<p>It is all gussied up with some fairly generic CSS.</p>

<p>And that's it really.</p>

<p>I'm delighted that this technique still works. I don't think you should use this unless you absolutely need a lightweight way to render XML directly.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=46577&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2023/08/lets-build-a-website-using-xml/feed/</wfw:commentRss>
			<slash:comments>19</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[How and why to use Lynx - the faster web browser]]></title>
		<link>https://shkspr.mobi/blog/2020/12/how-and-why-to-use-lynx-the-faster-web-browser/</link>
					<comments>https://shkspr.mobi/blog/2020/12/how-and-why-to-use-lynx-the-faster-web-browser/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Fri, 11 Dec 2020 12:34:15 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[lynx]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web dev]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=37392</guid>

					<description><![CDATA[Lynx is a text based browser. You think the people who browse without JavaScript are weird? Lynx doesn&#039;t even do images or CSS!  It downloads HTML and renders it at blazing fast speed. If you ever wondered just how slow modern web development has made the web - Lynx will show you the meaning of haste.  I use Lynx most days. Not as my exclusive browser - I&#039;m not a masochist - but as a handy tool.…]]></description>
										<content:encoded><![CDATA[<p>Lynx is a text based browser. You think the people who browse without JavaScript are weird? Lynx doesn't even do images or CSS!</p>

<p>It downloads HTML and renders it at blazing fast speed. If you ever wondered just how slow modern web development has made the web - Lynx will show you the meaning of haste.</p>

<p>I use Lynx most days. Not as my exclusive browser - I'm not a masochist - but as a handy tool. If I'm on a bandwidth constrained connection, or a site is overloaded, or I just want to browse without distraction. Lynx is where it's at. It is also brilliant for seeing what weird markup bugs your site has.</p>

<p>Linux users can install it with <code>sudo apt install lynx</code> or similar. Everyone else can <a href="https://lynx.invisible-island.net/">download Lynx from the official website</a>.</p>

<p>This is what it looks like:
<img src="https://shkspr.mobi/blog/wp-content/uploads/2020/11/Screenshot-from-2020-11-29-09-36-02-fs8.png" alt="The Google home page rendered in text." width="1026" height="711" class="aligncenter size-full wp-image-37400"></p>

<p>Using it is simple. On the command line, type <code>lynx example.com</code> to go to example.com.</p>

<p>Arrow keys up and down move you... up and down. Left goes back a page, right follows a link. Q quits. And that's all you need to know for your first five minutes.</p>

<p>Pressing the letter <code>O</code> gets you to the option screen.  There are a bunch of things you can change here - and it shows off the UI pretty well.</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2020/12/Screenshot-from-2020-11-29-09-37-36-fs8.png" alt="Options on a screen." width="1026" height="711" class="aligncenter size-full wp-image-37402">

<p>There are some things you can't change here. If you want to <em>always</em> accept or reject cookies - rather than be prompted every time - you'll need to edit the <code>~/.lyncrc</code> file.</p>

<p>Set <code>accept_all_cookies=TRUE</code>.</p>

<h2 id="why-is-this-important"><a href="https://shkspr.mobi/blog/2020/12/how-and-why-to-use-lynx-the-faster-web-browser/#why-is-this-important">Why is this important</a></h2>

<p>Computers lie to us. CSS hides our worst sins. JavaScript covers-up our poor architectural choices. With Lynx, there's no escape. You see the HTML rendered and <em>that's it</em>. Lynx renders all the HTML5 elements:</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2020/12/Screenshot-from-2020-11-29-10-58-22-fs8.png" alt="HTML elements rendered in different colours." width="1026" height="711" class="aligncenter size-full wp-image-37403">

<p>It also does interactive elements as well:</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2020/12/Screenshot-from-2020-11-29-10-59-11-fs8.png" alt="Form elements." width="1026" height="711" class="aligncenter size-full wp-image-37404">

<p>I've found <em>so</em> many bugs this way. Little quirks of markup which show up in the most unexpected places.</p>

<p>To be clear, Lynx isn't about accessibility testing. You should do that with proper tools which expose ARIA, show colour contrast, and the like. But Lynx is a good first pass at seeing how the text renders and flows, whether images have alt text, and if the general structure is easy to navigate.</p>

<p>Take some time to use it on your favourite sites today.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=37392&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2020/12/how-and-why-to-use-lynx-the-faster-web-browser/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Coping with HEIC in the browser]]></title>
		<link>https://shkspr.mobi/blog/2020/12/coping-with-heic-in-the-browser/</link>
					<comments>https://shkspr.mobi/blog/2020/12/coping-with-heic-in-the-browser/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Thu, 03 Dec 2020 12:58:06 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[web dev]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=37349</guid>

					<description><![CDATA[Apple&#039;s HEIC format is... annoying. At the moment, Apple&#039;s products are the only mainstream cameras which use it. Forums are littered with people trying to upload HEIC files to web services and failing.  So, here are four quick tips for dealing with this formal.  Display in browser  Absolutely no browser supports HEIC. Not even Apple&#039;s own browser supports it. Why?  Terence Eden is on…]]></description>
										<content:encoded><![CDATA[<p>Apple's HEIC format is... annoying. At the moment, Apple's products are the only mainstream cameras which use it. Forums are littered with people trying to upload HEIC files to web services and failing.</p>

<p>So, here are four quick tips for dealing with this formal.</p>

<h2 id="display-in-browser"><a href="https://shkspr.mobi/blog/2020/12/coping-with-heic-in-the-browser/#display-in-browser">Display in browser</a></h2>

<p>Absolutely <a href="https://caniuse.com/heif"><em>no</em> browser supports HEIC</a>. Not even Apple's own browser supports it. Why?</p>

<blockquote class="social-embed" id="social-embed-1319384983866208256" lang="en" itemscope="" itemtype="https://schema.org/SocialMediaPosting"><blockquote class="social-embed" id="social-embed-1319384768090411008" lang="en" itemscope="" itemtype="https://schema.org/SocialMediaPosting"><header class="social-embed-header" itemprop="author" itemscope="" itemtype="https://schema.org/Person"><a href="https://twitter.com/edent" class="social-embed-user" itemprop="url"><img class="social-embed-avatar social-embed-avatar-circle" src="data:image/webp;base64,UklGRkgBAABXRUJQVlA4IDwBAACQCACdASowADAAPrVQn0ynJCKiJyto4BaJaQAIIsx4Au9dhDqVA1i1RoRTO7nbdyy03nM5FhvV62goUj37tuxqpfpPeTBZvrJ78w0qAAD+/hVyFHvYXIrMCjny0z7wqsB9/QE08xls/AQdXJFX0adG9lISsm6kV96J5FINBFXzHwfzMCr4N6r3z5/Aa/wfEoVGX3H976she3jyS8RqJv7Jw7bOxoTSPlu4gNbfXYZ9TnbdQ0MNnMObyaRQLIu556jIj03zfJrVgqRM8GPwRoWb1M9AfzFe6Mtg13uEIqrTHmiuBpH+bTVB5EEQ3uby0C//XOAPJOFv4QV8RZDPQd517Khyba8Jlr97j2kIBJD9K3mbOHSHiQDasj6Y3forATbIg4QZHxWnCeqqMkVYfUAivuL0L/68mMnagAAA" alt="" itemprop="image"><div class="social-embed-user-names"><p class="social-embed-user-names-name" itemprop="name">Terence Eden is on Mastodon</p>@edent</div></a><img class="social-embed-logo" alt="Twitter" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%0Aaria-label%3D%22Twitter%22%20role%3D%22img%22%0AviewBox%3D%220%200%20512%20512%22%3E%3Cpath%0Ad%3D%22m0%200H512V512H0%22%0Afill%3D%22%23fff%22%2F%3E%3Cpath%20fill%3D%22%231d9bf0%22%20d%3D%22m458%20140q-23%2010-45%2012%2025-15%2034-43-24%2014-50%2019a79%2079%200%2000-135%2072q-101-7-163-83a80%2080%200%200024%20106q-17%200-36-10s-3%2062%2064%2079q-19%205-36%201s15%2053%2074%2055q-50%2040-117%2033a224%20224%200%2000346-200q23-16%2040-41%22%2F%3E%3C%2Fsvg%3E"></header><section class="social-embed-text" itemprop="articleBody">OK, but *why* is the iPhone's default photo format HEIC if the iPhone's default browser can't display it?<br><a href="https://caniuse.com/?search=heic">caniuse.com/?search=heic</a></section><hr class="social-embed-hr"><footer class="social-embed-footer"><a href="https://twitter.com/edent/status/1319384768090411008"><span aria-label="22 likes" class="social-embed-meta">❤️ 22</span><span aria-label="0 replies" class="social-embed-meta">💬 0</span><span aria-label="5 reposts" class="social-embed-meta">🔁 5</span><time datetime="2020-10-22T21:06:56.000Z" itemprop="datePublished">21:06 - Thu 22 October 2020</time></a></footer></blockquote><header class="social-embed-header" itemprop="author" itemscope="" itemtype="https://schema.org/Person"><a href="https://twitter.com/ursonate" class="social-embed-user" itemprop="url"><img class="social-embed-avatar social-embed-avatar-circle" src="data:image/webp;base64,UklGRtgBAABXRUJQVlA4IMwBAACwCgCdASowADAAPrVKn0wnI6KiLjQLMOAWiWUAyNc1phBps2jBq+Tefiqz3acNkvJ+QtGg/kplOqb+XTA8mEi17OHrn6Ka9T38WReNmkUBfmA5huJU+iNYMZzqOnpwAP77LHvTpBafVOmAtZUfogf1WM9IEKubah444hX2ZfmKswVmn+O1IgP4z7BK8+ePlLhKHpfBe1B03N69dujAknutlQJoTSQHM9WrcPwO4H1O+fhCI9YqPgNsIZWUzUG0hdG0gJdYEX7JyV5lH7EQqypyFpgYG7RTgT+q2JChB0NNMizgOJemt9IzgbYFzRwB0+G+IG0wISofQO4lGucPJp6BxEjmDASNhYbqZhwO3OKjmOdqECqrSyUpyD1+1PrjgPc4yqhVUdZQDNy5fj4ec8GJjRTjAMEdoGq6roHzgYP17xGc2NNVuUXvUUmqZbfMRSV9yPnK+OouPQCI7MyGBoTkcxRX5P8CAyWitW1TKPeurLgnpkii5MtMI5Lx5e+X2PLEVtclHr8PA/xHhSfxIQ1l5Rs5nT9uRYfYKv9xssdVCaTWlNnONjAZwBVoUhTJ1SWquBvu4gFdPb066fRVtFbmO84XNwQREt8oAAAA" alt="" itemprop="image"><div class="social-embed-user-names"><p class="social-embed-user-names-name" itemprop="name">🅨🅞🅤 ⓜⓤⓢⓣ 𝘣𝘦 𝖘𝖊𝖊𝖎𝖓𝖌 .</p>@ursonate</div></a><img class="social-embed-logo" alt="Twitter" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%0Aaria-label%3D%22Twitter%22%20role%3D%22img%22%0AviewBox%3D%220%200%20512%20512%22%3E%3Cpath%0Ad%3D%22m0%200H512V512H0%22%0Afill%3D%22%23fff%22%2F%3E%3Cpath%20fill%3D%22%231d9bf0%22%20d%3D%22m458%20140q-23%2010-45%2012%2025-15%2034-43-24%2014-50%2019a79%2079%200%2000-135%2072q-101-7-163-83a80%2080%200%200024%20106q-17%200-36-10s-3%2062%2064%2079q-19%205-36%201s15%2053%2074%2055q-50%2040-117%2033a224%20224%200%2000346-200q23-16%2040-41%22%2F%3E%3C%2Fsvg%3E"></header><section class="social-embed-text" itemprop="articleBody"><small class="social-embed-reply"><a href="https://twitter.com/edent/status/1319384768090411008">Replying to @edent</a></small><a href="https://twitter.com/edent">@edent</a> The two teams hate each other.</section><hr class="social-embed-hr"><footer class="social-embed-footer"><a href="https://twitter.com/ursonate/status/1319384983866208256"><span aria-label="4 likes" class="social-embed-meta">❤️ 4</span><span aria-label="1 replies" class="social-embed-meta">💬 1</span><span aria-label="0 reposts" class="social-embed-meta">🔁 0</span><time datetime="2020-10-22T21:07:47.000Z" itemprop="datePublished">21:07 - Thu 22 October 2020</time></a></footer></blockquote>

<p>So, we have to use JavaScript.  There's a brilliant <a href="https://github.com/strukturag/libheif">open source library called libheif</a>.  It's possible to compile it to JavaScript - but I couldn't get it to work.  The official repo <a href="https://github.com/strukturag/libheif/issues/18">doesn't make a compiled version available</a>. Luckily, Kiril Vatev has released a <a href="https://github.com/catdad-experiments/libheif-emscripten">compiled emscripted version</a>.</p>

<p>It's about 1.5MB - which is a bit abusive to your users - although it zips down to about 350KB.</p>

<p>The image has to be loaded into a 2D canvas to be rendered. Even on a modern laptop this is likely to take a few seconds.</p>

<p>There's a <a href="https://github.com/strukturag/libheif/blob/gh-pages/index.html">demo page</a> which shows you how to get started. It's tedious, but it works.</p>

<h2 id="get-metadata"><a href="https://shkspr.mobi/blog/2020/12/coping-with-heic-in-the-browser/#get-metadata">Get Metadata</a></h2>

<p>Similarly, there's a <a href="https://github.com/exif-heic-js/exif-heic-js">separate library for reading HEIC metadata</a>. This one is a much more reasonable 20KB.</p>

<p>That's pretty easy to use - and quick. HEIC contains pretty standard EXIF. GPS co-ordinates, camera information, that sort of thing.</p>

<h2 id="server-side-php"><a href="https://shkspr.mobi/blog/2020/12/coping-with-heic-in-the-browser/#server-side-php">Server Side - PHP</a></h2>

<p>I struggled to find any libraries which were easy to use. It turns out, good old <a href="https://www.php.net/manual/en/class.imagick.php"><code>imagick</code></a> has support in modern versions.</p>

<pre><code class="language-php">$imagick = new Imagick();
$imagick-&gt;readImage('image.heic');
$exifArray = $imagick-&gt;getImageProperties("exif:*");
var_dump($exifArray);
</code></pre>

<h2 id="use-a-cdn-to-convert-images"><a href="https://shkspr.mobi/blog/2020/12/coping-with-heic-in-the-browser/#use-a-cdn-to-convert-images">Use a CDN to convert images</a></h2>

<p>I use <a href="https://www.cloudimage.io/en/home?ref=terenceeden1f">Cloud Image</a> (Affiliate Link). Use it proxy your images. You can convert them to JPG or a  modern format like WebP. It can resize and other effects.</p>

<p>You can write something like:</p>

<pre><code class="language-html">&lt;img src="https://abc.cloudimg.io/v7/example.com/image.heic/?w=600"/&gt;
</code></pre>

<p>to serve your HEIC images in a more sensible format.</p>

<h2 id="what-next"><a href="https://shkspr.mobi/blog/2020/12/coping-with-heic-in-the-browser/#what-next">What next?</a></h2>

<p>HEIC is a weird, patent-encumbered format. It isn't particularly useful. If you want high-quality images for editing, you probably want to shoot in RAW.  If you're displaying on the web, WebP gets you a small file size and broad compatibility.</p>

<p>But, if you want to deal with HEIC, I hope the above was useful.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=37349&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2020/12/coping-with-heic-in-the-browser/feed/</wfw:commentRss>
			<slash:comments>15</slash:comments>
		
		
			</item>
	</channel>
</rss>
