<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Layman's Guide to Computing - Season 13</title><link href="https://ngjunsiang.github.io/laymansguide/" rel="alternate"></link><link href="https://ngjunsiang.github.io/laymansguide/feeds/season-13.atom.xml" rel="self"></link><id>https://ngjunsiang.github.io/laymansguide/</id><updated>2022-04-23T08:00:00+08:00</updated><entry><title>Issue 169: Search engine optimisation</title><link href="https://ngjunsiang.github.io/laymansguide/issue169.html" rel="alternate"></link><published>2022-04-23T08:00:00+08:00</published><updated>2022-04-23T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-04-23:/laymansguide/issue169.html</id><summary type="html">&lt;p&gt;By better understanding how search bots categorise pages, a website owner can use keywords and other techniques to optimise the ranking of their page for specific search&amp;nbsp;terms.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; A search engine uses bots to build up a database of URLs and their contents. The search engine uses various algorithms to determine the most relevant results for a search&amp;nbsp;request.&lt;/p&gt;
&lt;p&gt;Let’s get to it: why are search results so bad so&amp;nbsp;often?&lt;/p&gt;
&lt;h2&gt;PageRank&lt;/h2&gt;
&lt;p&gt;While PageRank is no longer the only or even the dominant algorithm for ranking search results, it is probably the most familiar one to most people and is easy to&amp;nbsp;understand.&lt;/p&gt;
&lt;p&gt;PageRank ranks your page higher if there are many other pages (on other domains) linking to it, so one way to raise its rankings is to make other websites with links that point to your&amp;nbsp;page.&lt;/p&gt;
&lt;h2&gt;&lt;meta&gt; tags&lt;/h2&gt;
&lt;p&gt;Every &lt;span class="caps"&gt;HTML&lt;/span&gt; page, if you check the page source, has a section that looks&amp;nbsp;like &lt;code&gt;&amp;lt;head&amp;gt;...&amp;lt;/head&amp;gt;&lt;/code&gt;. This section is not displayed in the webpage, and usually contains metadata: information about the page. This is what many site-crawling bots use to gather information about the page, instead of trying to parse the entire page’s&amp;nbsp;content.&lt;/p&gt;
&lt;p&gt;By putting appropriate keywords or descriptions, you can make the page appear higher in search rankings. This is a well known way to increase discoverability so search engines are savvy at downranking pages that simply spam keywords. But many subtle hacks also exist for pushing a page higher in search results for specific keywords, whether that page deserves to appear higher or&amp;nbsp;not.&lt;/p&gt;
&lt;p&gt;As more and more page categorisation is automated, pages increasingly have to be bot-savvy to be correctly categorised and indexed for appearing in search&amp;nbsp;results.&lt;/p&gt;
&lt;h2&gt;Advertising&lt;/h2&gt;
&lt;p&gt;Naturally, Google runs an online advertising business and it puts advertised results first, so this obviously skews the&amp;nbsp;rankings.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; By better understanding how search bots categorise pages, a website owner can use keywords and other techniques to optimise the ranking of their page for specific search&amp;nbsp;terms.&lt;/p&gt;
&lt;p&gt;Not very detailed, because I am not an &lt;span class="caps"&gt;SEO&lt;/span&gt; master! This issue is probably the least helpful for more savvy readers, but everyone finds out about page keywords at some point and I hope this issue is that first time for some readers&amp;nbsp;:)&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;I am &amp;#8230; done! With the main part of Layman’s Guide to Computing at&amp;nbsp;least.&lt;/p&gt;
&lt;h3&gt;Going even&amp;nbsp;slower&lt;/h3&gt;
&lt;p&gt;What this means is I still have bits of content to post, but they are no longer substantial enough to form seasons of 13 issues. Instead, I’m going to be posting in dribs and drabs, guided by current affairs and any new technologies that have gone mainstream. This also means my posting frequency is going to be going way down; expect 1–2 issues a month, instead of the current 4–5. And I’m going to be taking the next 2 weekends off for a little celebration of my own, plus some thinking and&amp;nbsp;reflecting.&lt;/p&gt;
&lt;h3&gt;Better&amp;nbsp;archives&lt;/h3&gt;
&lt;p&gt;I also realised that &lt;a href="https://buttondown.email/laymansguide/archive/"&gt;Buttondown’s archive page&lt;/a&gt; no longer provides a browseable listing of all issues. I am looking into setting up my own issue index instead through Github Pages, on https://ngjunsiang.github.io/laymansguide/. Fortunately I have been using Github to archive past issues, so now it’s simply a matter of editing links for past issues and providing some kind of navigation. More updates on this when I make some kind of&amp;nbsp;progress.&lt;/p&gt;
&lt;h3&gt;Refactoring&lt;/h3&gt;
&lt;p&gt;Code refactoring is when developers reorganise and rewrite their code in a way that makes it easier for them moving&amp;nbsp;forward.&lt;/p&gt;
&lt;p&gt;You might have noticed how often I am linking to past issues, because so many concepts in computing build on each other. I knew this was going to be a problem when trying to explain computing to anyone, and I had initially envisioned some kind of wiki where pages will link to each other so you can theoretically start exploring from any topic and unpack technical terms as you&amp;nbsp;go.&lt;/p&gt;
&lt;p&gt;The main bottleneck for this had been content: it’s rather overwhelming to think about where and even how to start. And that was how this newsletter was born. Thanks to Layman’s Guide, I now have a steady base of content for publishing Layman’s Wiki, and work on it has been slow but progressing. I’ll put up a link through this newsletter once it is ready for more eyes&amp;nbsp;:)&lt;/p&gt;
&lt;h2&gt;What I&amp;#8217;ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; &lt;a href="https://ngjunsiang.github.io/laymansguide/issue170.html"&gt;Issue 170: Machine learning&amp;nbsp;models&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After a long hiatus, Layman&amp;#8217;s Guide returns with Season 14! But first, let&amp;#8217;s understand what models are and how they&amp;nbsp;work.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;As always, thank you for&amp;nbsp;reading!&lt;/p&gt;</content><category term="Season 13"></category></entry><entry><title>Issue 168: Search engines</title><link href="https://ngjunsiang.github.io/laymansguide/issue168.html" rel="alternate"></link><published>2022-04-16T08:00:00+08:00</published><updated>2022-04-16T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-04-16:/laymansguide/issue168.html</id><summary type="html">&lt;p&gt;A search engine uses bots to build up a database of URLs and their contents. The search engine uses various algorithms to determine the most relevant results for a search&amp;nbsp;request.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Fragmentation is likely a contributor of system slowdown, particularly for mobile devices: the database used by most mobile apps tend to store data in many small chunks rather than fewer big chunks, which slows down data search operations. The most effective measure for improving device responsiveness is usually to clear the app cache, so the app does not attempt to read previous data from&amp;nbsp;storage.&lt;/p&gt;
&lt;p&gt;Last issue, we shed a little light on the mystery of why phone and laptop systems slow down over time—apparently the way a file database works is to&amp;nbsp;blame?&lt;/p&gt;
&lt;p&gt;This week, we switch topics, to look at something we definitely take for granted: search&amp;nbsp;engines!&lt;/p&gt;
&lt;h2&gt;What is a search&amp;nbsp;engine?&lt;/h2&gt;
&lt;p&gt;Forgive me if you think I am belabouring the obvious. There is the user definition, which is something like “a search box that answers my questions”. Then there is the developer definition which is more like “an indexed database of URLs, descriptions, and ranks”. Let’s unpack&amp;nbsp;that.&lt;/p&gt;
&lt;h2&gt;Indexing and&amp;nbsp;arachnids&lt;/h2&gt;
&lt;p&gt;Another obvious point: at the point when you submit your search query, there is no way the search engine could have trawled the entire internet so quickly to give you the results. It must have know about these pages beforehand &amp;#8230; but&amp;nbsp;how?&lt;/p&gt;
&lt;p&gt;Search engines run “bots”, also know as web spiders, or web crawlers. These are programs that retrieve pages, makes a note of the content (text, images, links, …) on that page, determine keywords for that page, and then follows the links to other pages and repeats the process. Like following the links of a (very messy) web!&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;When we “search the internet”, we are really searching the database that has been built up by these&amp;nbsp;bots.&lt;/p&gt;
&lt;h2&gt;Ranking&amp;nbsp;results&lt;/h2&gt;
&lt;p&gt;So there’s a huge database … how does the search engine determine which are the most relevant&amp;nbsp;results?&lt;/p&gt;
&lt;p&gt;Google’s PageRank algorithm is by now well known for disrupting the old directory-based method of organising information, and built for Larry Page and Sergey Brin a sizable empire. This is one way of determining how important/useful a page is: by seeing how many other pages link to it. There are other ways, but this is a layman’s newsletter and I don’t want to dive into a technical analysis and comparison of different ranking algorithms&amp;nbsp;😬&lt;/p&gt;
&lt;p&gt;Instead, consider that there are by now many different algorithms for determining the relevance of database entries for each search, even within Google itself. A search engine is essentially a way to access this database, use one or more appropriate algorithms to determine the most relevant results, and return them to the&amp;nbsp;user.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; A search engine uses bots to build up a database of URLs and their contents. The search engine uses various algorithms to determine the most relevant results for a search&amp;nbsp;request.&lt;/p&gt;
&lt;p&gt;I know &amp;#8230; nobody really cares &lt;em&gt;how&lt;/em&gt; a search engine works. We just want to know &lt;em&gt;why&lt;/em&gt; it&amp;#8217;s not giving us the results we&amp;nbsp;want!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 169: Search engine&amp;nbsp;optimisation&lt;/p&gt;
&lt;p&gt;I am not a consultant for search engine optimisation (&lt;span class="caps"&gt;SEO&lt;/span&gt;), but we can look at some of the ways people attempt to “game the system” and exploit features of the algorithms that search engines use. More next&amp;nbsp;week!&lt;/p&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Yep, we all know spiders don’t actually do this.&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 13"></category></entry><entry><title>Issue 167: Database fragmentation</title><link href="https://ngjunsiang.github.io/laymansguide/issue167.html" rel="alternate"></link><published>2022-04-09T08:00:00+08:00</published><updated>2022-04-09T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-04-09:/laymansguide/issue167.html</id><summary type="html">&lt;p&gt;Fragmentation is likely a contributor of system slowdown, particularly for mobile devices: the databases used by most mobile apps tend to store data in many small chunks rather than fewer big chunks, which slows down data search operations. The most effective measure for improving device responsiveness is usually to clear the app cache, so the app does not attempt to read previous data from&amp;nbsp;storage.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; There are easy and quick ways to check the validity of the most common advice for resolving system slowdown. But it still seems to happen even after these tips have been&amp;nbsp;tried.&lt;/p&gt;
&lt;p&gt;Last issue, we talked about caches and why they are no longer as effective as a performance-boosting&amp;nbsp;measure.&lt;/p&gt;
&lt;p&gt;This issue, let’s look into a solved problem that is not-as-solved on Android: file&amp;nbsp;fragmentation.&lt;/p&gt;
&lt;h2&gt;Storage fragmentation on mobile&amp;nbsp;devices&lt;/h2&gt;
&lt;p&gt;I mentioned in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue119.html"&gt;Issue 119&lt;/a&gt;) that fragmentation is not an issue for faster SSDs; the much lower latency of SSDs makes the retrieval of multiple file chunks from multiple locations trivially easy. But for slower storage devices, whether they are hard disk drives or SSDs over a &lt;span class="caps"&gt;UFS&lt;/span&gt; interface, fragmentation is very real. Unfortunately, its not just a simple matter of defragmenting a disk regularly&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;. the source of this fragmentation comes from the way apps themselves store&amp;nbsp;data.&lt;/p&gt;
&lt;h2&gt;SQLite, a blessing and a&amp;nbsp;curse&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://sqlite.org/index.html"&gt;SQLite&lt;/a&gt; is a popular file-based relational database (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue087.html"&gt;Issue 87&lt;/a&gt;)) used by many Android apps (including WhatsApp!). This means that unlike other databases, which require a separate database program to run, SQLite just requires the programmer to bundle an appropriate library for their programming language instead of running a separate program. It makes management of data much easier for the app developers, and it is also&amp;nbsp;fast—usually.&lt;/p&gt;
&lt;p&gt;However, &lt;a href="https://www.tuxera.com/blog/why-is-my-android-phone-slowing-down/"&gt;a 2016 study found that it contributes to fragmentation&lt;/a&gt; on the Android filesystem. Even after clearing the app’s data, once SQLite starts storing data again, it tends to store them in many small chunks instead of fewer but larger chunks. On Android devices, which use the slower &lt;span class="caps"&gt;UFS&lt;/span&gt; interface, searching through the database involves reading each database chunk to see if the requested data is there; this gets slower as the database grows, and SQLite adds more chunks to the storage&amp;nbsp;device.&lt;/p&gt;
&lt;p&gt;The study ends on a pretty pessimistic note: there doesn’t seem to be any feasible mitigation other than making upstream code changes to SQLite, or designing a different filesystem that overcomes this limitation. But that was five years ago; with any luck some positive developments might have been made into this area. I’m still looking into&amp;nbsp;it!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Fragmentation is likely a contributor of system slowdown, particularly for mobile devices: the databases used by most mobile apps tend to store data in many small chunks rather than fewer big chunks, which slows down data search operations. The most effective measure for improving device responsiveness is usually to clear the app cache, so the app does not attempt to read previous data from&amp;nbsp;storage.&lt;/p&gt;
&lt;p&gt;That’s all I’ve managed to find out from reading; further research will either involve detailed tinkering and experimentation, or deeper reading, both of which are&amp;nbsp;time-consuming.&lt;/p&gt;
&lt;p&gt;Short issue this time, because if I made it any longer I think it would be more technical than I would really like. Enjoy the&amp;nbsp;brain-break!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 168: Search&amp;nbsp;engines&lt;/p&gt;
&lt;p&gt;How do search engines &amp;#8230; know&amp;nbsp;everything?&lt;/p&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Defragmentation is discouraged on solid-state devices, as each read/write operation causes the storage medium to degrade. Under typical usage, a solid-state device can be expected to last many years. Defragmentation involves lots of read/write (as you are reading files and storing them elsewhere on the disk), hastens the degradation, and will shorten the lifespan of solid-state devices unnecessarily.&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 13"></category><category term="cache"></category></entry><entry><title>Issue 166: A cause of system slowdown: caches</title><link href="https://ngjunsiang.github.io/laymansguide/issue166.html" rel="alternate"></link><published>2022-04-02T08:00:00+08:00</published><updated>2022-04-02T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-04-02:/laymansguide/issue166.html</id><summary type="html">&lt;p&gt;Caches speed up app operations by storing temporary data on the device’s storage. This assumes that access to storage is much faster than access to the file’s original source. On Android, users can clear an app’s cache, but not the system&amp;nbsp;cache.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; There are easy and quick ways to check the validity of the most common advice for resolving system slowdown. But it still seems to happen even after these tips have been&amp;nbsp;tried.&lt;/p&gt;
&lt;p&gt;Last issue, I walked through common causes of system slowdown suggested by generic tech websites, and explained simple ways of checking if these are really the cause. Quite often, they are not, especially if you are the kind who is careful about internet usage and does regular system&amp;nbsp;maintenance.&lt;/p&gt;
&lt;p&gt;So what is going&amp;nbsp;on?&lt;/p&gt;
&lt;h2&gt;Caches, caches, and more&amp;nbsp;caches&lt;/h2&gt;
&lt;p&gt;In &lt;a href="https://ngjunsiang.github.io/laymansguide/issue039.html"&gt;Issue 39&lt;/a&gt;), I explained what caches are: places where you (temporarily) store the result of lookups, so you don’t have to keep performing the lookup again. In context, this referred to &lt;span class="caps"&gt;DNS&lt;/span&gt; lookups: operations that translate a domain name (such&amp;nbsp;as &lt;code&gt;google.com&lt;/code&gt;) to an &lt;span class="caps"&gt;IP&lt;/span&gt; address (such&amp;nbsp;as &lt;code&gt;173.194.217.100&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;But caches are everywhere, not just in &lt;span class="caps"&gt;DNS&lt;/span&gt;.&lt;/p&gt;
&lt;h3&gt;Examples&lt;/h3&gt;
&lt;p&gt;When you open any Microsoft Office application, it shows you your most recently accessed documents: that’s a cache! (The info has to be stored somewhere,&amp;nbsp;right?).&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.thewindowsclub.com/windows-installer-folder-to-delete-or-not-to-delete-that-is-the-question"&gt;Windows caches your old installation files&lt;/a&gt; “just in&amp;nbsp;case”.&lt;/p&gt;
&lt;p&gt;Your browser definitely caches your browsing data (they are called “Temporary internet&amp;nbsp;files”).&lt;/p&gt;
&lt;p&gt;And most apps have a cache of some kind or other to hold data which they think you will want to access again&amp;nbsp;soon.&lt;/p&gt;
&lt;p&gt;These are generally harmless uses of caches, albeit possibly annoying (when Adobe Premiere caches video files that take up gigabytes of space …). Caches are predicated on the notion that access from a storage disk (on the same device), while slow, is still faster than its alternative (fetching the data from its source, over the internet or through a computationally expensive&amp;nbsp;calculation).&lt;/p&gt;
&lt;h2&gt;App caches: a short&amp;nbsp;history&lt;/h2&gt;
&lt;p&gt;Before the internet went mainstream, a lot of software came on compact discs or diskettes. These were slow to spin up, slow to read, and slow to swap out. They were nonetheless necessary in the days when hard disks were still low on storage, and&amp;nbsp;expensive.&lt;/p&gt;
&lt;p&gt;As hard disks increased in capacity and decreased in price, it made sense to copy the information from these diskettes or compact discs into the hard disk, and subsequently access the data from disk. This process is what we know as &lt;strong&gt;software installation&lt;/strong&gt; (bet you saw that one&amp;nbsp;coming!).&lt;/p&gt;
&lt;p&gt;These days, the disk-is-faster assumption is less true across a spectrum of uses. Especially when it comes to mobile&amp;nbsp;devices.&lt;/p&gt;
&lt;h2&gt;Mobile storage and&amp;nbsp;internet&lt;/h2&gt;
&lt;p&gt;A quick note on mobile storage, which I unfortunately missed out on &lt;a href="https://ngjunsiang.github.io/laymansguide/issue119.html"&gt;Issue 119&lt;/a&gt;) on laptop and desktop solid-state disks&amp;nbsp;(SSDs).&lt;/p&gt;
&lt;p&gt;Mobile devices generally do not use the same kinds of SSDs that laptops use. Those are bulkier, use more power (not good for mobile battery life), and run hotter. Laptop SSDs use an interface called NVMe (which iPhones use as well), while most Android devices’ storage use an interface called &lt;span class="caps"&gt;UFS&lt;/span&gt; which is slower (but uses less&amp;nbsp;energy).&lt;/p&gt;
&lt;p&gt;At the same time, internet access on phones is speeding up. 4G/5G technology has increased throughput, while maintaining more or less the same latency. On the other hand, with the cloud becoming a staple of everyday life, tech companies have poured immense resources into increasing their servers’ responsiveness, resulting in lower latency for internet&amp;nbsp;access.&lt;/p&gt;
&lt;p&gt;Disk caching is no longer&amp;nbsp;king.&lt;/p&gt;
&lt;h2&gt;Caches on mobile&amp;nbsp;devices&lt;/h2&gt;
&lt;p&gt;On Android, a tip not mentioned in the previous issue is to &lt;a href="https://www.howtogeek.com/183004/why-android-phones-slow-down-over-time-and-how-to-speed-them-up/"&gt;clear the app cache&lt;/a&gt;. For many apps, the app cache can grow to tens or hundreds of megabytes. As Android device storage slows down over time, the app cache gets slower and no longer serves to speed up the app. So clearing the cache regularly can help keep performance from degrading too&amp;nbsp;much.&lt;/p&gt;
&lt;p&gt;However, Android itself uses caches for system processes as well, and these are usually not accessible to the user. That means the only practical way for most users to clear this cache is usually to perform a factory&amp;nbsp;reset.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Caches speed up app operations by storing temporary data on the device’s storage. This assumes that access to storage is much faster than access to the file’s original source. On Android, users can clear an app’s cache, but not the system&amp;nbsp;cache.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 167: Database&amp;nbsp;fragmentation&lt;/p&gt;
&lt;p&gt;This issue, I explained why caches no longer work as well as&amp;nbsp;expected.&lt;/p&gt;
&lt;p&gt;Next issue, let’s poke a little deeper: why does clearing the cache&amp;nbsp;work?&lt;/p&gt;</content><category term="Season 13"></category><category term="cache"></category></entry><entry><title>Issue 165: The myths of system slowdown</title><link href="https://ngjunsiang.github.io/laymansguide/issue165.html" rel="alternate"></link><published>2022-03-26T08:00:00+08:00</published><updated>2022-03-26T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-03-26:/laymansguide/issue165.html</id><summary type="html">&lt;p&gt;There are easy and quick ways to check the validity of the most common advice for resolving system slowdown. But it still seems to happen even after these tips have been&amp;nbsp;tried.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Linux software is distributed through Linux distros. The maintainers of distros maintain repositories of software that have been tested with the distro. Most users will access software in the distro’s repositories through a program called a package manager. So users have full control over when updates and new software should be&amp;nbsp;installed.&lt;/p&gt;
&lt;p&gt;Once your laptop hits the magical 1-year window, it somehow seems to … get slower. And slower. Everything takes just a fraction longer. What used to happen near-instantaneously now seems to take a split-second pause. The loading spinner animation feels like it plays just a little longer. And it just gets worse from there with&amp;nbsp;age.&lt;/p&gt;
&lt;p&gt;Google search results have a number of things to say about why it&amp;nbsp;happens:&lt;/p&gt;
&lt;h2&gt;Programs starting up when&amp;nbsp;booting&lt;/h2&gt;
&lt;p&gt;This is primarily an issue when you are booting up your laptop (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue112.html"&gt;Issue 112&lt;/a&gt;)) and logging in. Once you log in to your operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;), your &lt;span class="caps"&gt;OS&lt;/span&gt; will run the startup programs (which you can disable), so if you are trying to use your laptop right after logging in, this may cause some&amp;nbsp;slowdown.&lt;/p&gt;
&lt;p&gt;If your laptop is still slow about 10 minutes after &lt;span class="caps"&gt;OS&lt;/span&gt; login, this is probably not the&amp;nbsp;cause.&lt;/p&gt;
&lt;h2&gt;Programs running in&amp;nbsp;background&lt;/h2&gt;
&lt;p&gt;You can check this easily: open Task Manager (in Windows), and see if &lt;span class="caps"&gt;CPU&lt;/span&gt;, Memory, or Disk are significantly high. You can click on those columns to put the highest-usage processes at the top. Often it is some kind of antivirus or malware scanner that is hitting the disk and causing things to be slow. Wait for these programs to finish (if legitimate), then see if your computer still feels&amp;nbsp;slow.&lt;/p&gt;
&lt;h2&gt;Insufficient&amp;nbsp;memory&lt;/h2&gt;
&lt;p&gt;This is easy to check in Task Manager too. On the performance charts on the right, see if memory usage is near 100%. If it is, try closing some applications until usage drops below 100%, and see if system performance improves after a few&amp;nbsp;minutes.&lt;/p&gt;
&lt;h2&gt;Malware&lt;/h2&gt;
&lt;p&gt;Malware that slows down your laptop usually does so by taking up a lot of &lt;span class="caps"&gt;CPU&lt;/span&gt; time, or using a lot of memory. You can test this using the above tip&amp;nbsp;too.&lt;/p&gt;
&lt;p&gt;If your computer fan is spinning noisily even though &lt;span class="caps"&gt;CPU&lt;/span&gt;/Memory/Disk are low, it’s either malware that is smart enough to hide itself, or blocked computer vent (which is causing your &lt;span class="caps"&gt;CPU&lt;/span&gt; fan to be ineffective). These are easy checks to make&amp;nbsp;too.&lt;/p&gt;
&lt;h2&gt;&lt;span class="caps"&gt;OS&lt;/span&gt;&amp;nbsp;updates&lt;/h2&gt;
&lt;p&gt;Just update your &lt;span class="caps"&gt;OS&lt;/span&gt;. Most of the time this does not fix system&amp;nbsp;slowness.&lt;/p&gt;
&lt;h2&gt;Disk&amp;nbsp;full&lt;/h2&gt;
&lt;p&gt;Open My Computer (in Windows), which should show how full your system partition is. If it is below 80% full, this probably isn’t the issue, regardless of whether your system is on a hard disk or solid state disk (&lt;span class="caps"&gt;SSD&lt;/span&gt;, see &lt;a href="https://ngjunsiang.github.io/laymansguide/issue119.html"&gt;Issue 119&lt;/a&gt;)).&lt;/p&gt;
&lt;h2&gt;File&amp;nbsp;fragmentation&lt;/h2&gt;
&lt;p&gt;You can run Drive Optimizer on your system partition. Yes, there is a lot of discussion about how defragmenting an &lt;span class="caps"&gt;SSD&lt;/span&gt; is bad; fortunately Drive Optimizer is pretty smart about this and will only carry out defragmentation on hard disks; the option is called Optimize if your system partition is on a solid state&amp;nbsp;disk.&lt;/p&gt;
&lt;p&gt;This usually helps a little, especially if the hard disk is quite badly fragmented. If it is only lightly fragmented, or if you are using a solid state disk, this usually won’t resolve any&amp;nbsp;slowdown.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;These are some quick ways to check on the validity of these myths about the causes of system slowdown. In many cases they do help! But there seems to be this general malaise that affects even the most cared-for and most well-maintained laptop, after an operating system has been used for years without a&amp;nbsp;reinstall.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; There are easy and quick ways to check the validity of the most common advice for resolving system slowdown. But it still seems to happen even after these tips have been&amp;nbsp;tried.&lt;/p&gt;
&lt;p&gt;Knowing what we know, this far into this layman’s guide, I’ll look into some other possible causes next&amp;nbsp;issue!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 166: A cause of system slowdown:&amp;nbsp;caches&lt;/p&gt;</content><category term="Season 13"></category><category term="memory"></category></entry><entry><title>Issue 164: Linux, the universal operating system</title><link href="https://ngjunsiang.github.io/laymansguide/issue164.html" rel="alternate"></link><published>2022-03-19T08:00:00+08:00</published><updated>2022-03-19T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-03-19:/laymansguide/issue164.html</id><summary type="html">&lt;p&gt;Linux software is distributed through Linux distros. The maintainers of distros maintain repositories of software that have been tested with the distro. Most users will access software in the distro’s repositories through a program called a package manager. So users have full control over when updates and new software should be&amp;nbsp;installed.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Software that we use usually comes from the &lt;span class="caps"&gt;OS&lt;/span&gt; makers, or from third-party developers. These two groups of developers are not the same, and might even have conflicting intentions and&amp;nbsp;goals.&lt;/p&gt;
&lt;p&gt;Last issue, we looked at the following categories of software that an end-user might&amp;nbsp;need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;System&amp;nbsp;updates&lt;/li&gt;
&lt;li&gt;Software by the &lt;span class="caps"&gt;OS&lt;/span&gt; maker (first-party&amp;nbsp;software)&lt;/li&gt;
&lt;li&gt;Software from other developers (third-party&amp;nbsp;software)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In general, “trusted” software comes from other sources: compact discs or the internet. While “trusted” software comes from a central, authorised source: usually some kind of app&amp;nbsp;store.&lt;/p&gt;
&lt;p&gt;This leads to a lot of conflict over who gatekeeps the list of “trusted” software. This privilege gives app store owners a lot of power, which they claim to earn by investing capital into making the &lt;span class="caps"&gt;OS&lt;/span&gt; possible, and implementing screening and filtering processes to ensure only secure software makes its way into the&amp;nbsp;list.&lt;/p&gt;
&lt;p&gt;I will not contest those claims here, but instead invite you to consider: what if it were possible for other app store makers to join in curating lists of software for that operating&amp;nbsp;system?&lt;/p&gt;
&lt;h2&gt;What is&amp;nbsp;Linux?&lt;/h2&gt;
&lt;p&gt;Today the term “Linux” refers to a lot of things, which is why we need to clarify here: the term originally referred to &lt;a href="https://www.redhat.com/en/topics/linux/what-is-the-linux-kernel"&gt;the Linux kernel&lt;/a&gt;, which is the core of the operating&amp;nbsp;system.&lt;/p&gt;
&lt;p&gt;The kernel by itself doesn’t do anything without all the other programs that make it actually useable by an informed user: to create, edit, and browse files and folders, run service programs, etc. This collection of programs, along with the kernel itself, is &lt;a href="https://www.getgnulinux.org/en/linux"&gt;officially referred to as &lt;span class="caps"&gt;GNU&lt;/span&gt;/Linux&lt;/a&gt; (but s’okay, you can just say “Linux” and we understand you mean &lt;span class="caps"&gt;GNU&lt;/span&gt;/Linux).&lt;/p&gt;
&lt;p&gt;So, &lt;span class="caps"&gt;GNU&lt;/span&gt;/Linux is similar to Windows and MacOS: they are &lt;em&gt;base operating systems&lt;/em&gt;, capable of doing stuff but not actually useful&amp;nbsp;yet.&lt;/p&gt;
&lt;p&gt;Where all our software&amp;nbsp;at?&lt;/p&gt;
&lt;h2&gt;Software for&amp;nbsp;Linux&lt;/h2&gt;
&lt;p&gt;In the very early days, because there were a number of different hardware configurations that weren’t as compatible as they are now, Linux software was distributed as source code. You downloaded a zip file containing programming code, you ran a compiler program to compile the code (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue054.html"&gt;Issue 54&lt;/a&gt;)) into an executable program. Then there is usually an &lt;strong&gt;installer&lt;/strong&gt;, a shell script that puts the compiled program in the correct place so the &lt;span class="caps"&gt;OS&lt;/span&gt; can find it, and creates other helper files (like configuration&amp;nbsp;information).&lt;/p&gt;
&lt;p&gt;And then you had to check their website (or even email them, in the days before the mainstream Internet) regularly to see if there are any bugfixes, and if yes, you downloaded the &lt;em&gt;new&lt;/em&gt; source code and repeated the process&amp;nbsp;…&lt;/p&gt;
&lt;p&gt;This was obviously tedious, so people started to compile the useful programs into their own list. This effort expanded, and became automated, so that it was not only a list, it was a collection of different versions of compiled programs for different CPUs (each version of the program is called a &lt;strong&gt;package&lt;/strong&gt;). If you were a developer for one of the programs in that list, once you made a new version of your package you could submit it to these guys, they would incorporate the required changes and then add a listing for the newest&amp;nbsp;version.&lt;/p&gt;
&lt;p&gt;These projects came to be called &lt;strong&gt;Linux distributions&lt;/strong&gt;, or &lt;strong&gt;Linux distros&lt;/strong&gt; in short. Distros maintained &lt;strong&gt;repositories&lt;/strong&gt; of software for their specific distribution—the people involved are called &lt;strong&gt;maintainers&lt;/strong&gt;. Maintainers check new versions of software to ensure that it will work as expected on their distro. Another category of software, called &lt;strong&gt;package managers&lt;/strong&gt;, were created for users to be able to use these repositories easily: to check for updates, install them, and perform any other required&amp;nbsp;maintenance.&lt;/p&gt;
&lt;p&gt;More and more distros started in the 80s and 90s, as groups of Linux users and developers decided to branch off based on differing principles and philosophies for managing a Linux computer and its software. Today, you have distros focused on reliability and stability, distros focused on simplicity, distros focused on user-friendliness, distros focused on scientific computing, distros focused on hackability,&amp;nbsp;…&lt;/p&gt;
&lt;p&gt;It is important to note that the Linux kernel development team itself does not maintain any distros. Any updates to the kernel are for distro maintainers to incorporate into their respective&amp;nbsp;repositories.&lt;/p&gt;
&lt;h2&gt;Linux software&amp;nbsp;distribution&lt;/h2&gt;
&lt;p&gt;This means that for the bulk of users, software distribution on Linux is &lt;strong&gt;centred around the distro’s repository&lt;/strong&gt;. Through the package manager, users can search for software, install it, and update it. They can also add the URLs of external repositories to access software from&amp;nbsp;them.&lt;/p&gt;
&lt;p&gt;At the same time, if users wish, they are still able to download compiled executables from the internet and run them (with the usual caveats, of course). They can also download source code, compile it themselves, and then run it. These options do not offer the same ease of maintainability as software installed through a package manager, since there is no repository to check for&amp;nbsp;updates.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Steam website showing Install Steam button for Linux. A popup asks what should Firefox do with the file, steam_latest.deb" src="https://ngjunsiang.github.io/laymansguide/issue164_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;This is what many install pages look like on Linux, for software with Linux versions.&lt;br /&gt;The Install button usually downloads a compiled executable, which can be run on the computer.&lt;br /&gt;But installing through the distro’s package manager is&amp;nbsp;recommended.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;No system updates sneaking up on you from the &lt;span class="caps"&gt;OS&lt;/span&gt; maker; updates and new software all come from the repository through the package manager. Unless you decide&amp;nbsp;otherwise.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Linux software is distributed through Linux distros. The maintainers of distros maintain repositories of software that have been tested with the distro. Most users will access software in the distro’s repositories through a program called a package manager. So users have full control over when updates and new software should be&amp;nbsp;installed.&lt;/p&gt;
&lt;p&gt;This is as far as I’ll go for technical detail on Linux. I meant this to pick up from &lt;a href="https://ngjunsiang.github.io/laymansguide/issue092.html"&gt;Season 8&lt;/a&gt;) on apps. It’s easier to go into the bird’s-eye view of how this works on Linux, because I’m more familiar with it; on the Windows and MacOS side of things it tends to be more esoteric and&amp;nbsp;proprietary.&lt;/p&gt;
&lt;p&gt;And it’s instructive to know this because … so far this season, we have been talking about distribution—content, code, and software. Notice how all of them involve infrastructure: worldwide clusters of servers for content distribution, a history of code changes for code distribution (and collaboration), and now we have repositories and package managers for software&amp;nbsp;distribution.&lt;/p&gt;
&lt;p&gt;What happens as this infrastructure&amp;nbsp;ages?&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 165: The myths of system&amp;nbsp;slowdown&lt;/p&gt;
&lt;p&gt;We won’t dive into topics as broad as digital infrastructure aging; that’s beyond the scope for a layperson’s newsletter I&amp;nbsp;think!&lt;/p&gt;
&lt;p&gt;Let’s bring it back to personal scale: what happens as your system ages? The predominant symptom that manifests itself is general slowdown: your computer takes longer to switch on, open any app, save any file, and even to shut down. For years I have been googling for reasons why this happens, and satisfying/useful/sensible answers are almost non-existent. The pithy, vague answers about background services (“bloatware”), outdated apps, malware etc are almost insulting; I have relatives who use the same handful of apps, and even after clearing old/large files their phone is still&amp;nbsp;slow!&lt;/p&gt;
&lt;p&gt;Next issue, I attempt to look into these stated reasons and see if they make&amp;nbsp;sense.&lt;/p&gt;</content><category term="Season 13"></category></entry><entry><title>Issue 163: System &amp; software ecosystems</title><link href="https://ngjunsiang.github.io/laymansguide/issue163.html" rel="alternate"></link><published>2022-03-12T08:00:00+08:00</published><updated>2022-03-12T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-03-12:/laymansguide/issue163.html</id><summary type="html">&lt;p&gt;Software that we use usually comes from the &lt;span class="caps"&gt;OS&lt;/span&gt; makers, or from third-party developers. These two groups of developers are not the same, and might even have conflicting intentions and&amp;nbsp;goals.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Typeface families consist of multiple fonts for each style in the typeface. Each font consists of glyphs, which are mathematical shapes described by curves joining points. These shapes need to be rasterised for display on a computer screen, or for printing on paper. Font files usually come&amp;nbsp;in &lt;code&gt;.ttf&lt;/code&gt;, &lt;code&gt;.otf&lt;/code&gt;,&amp;nbsp;or &lt;code&gt;.woff&lt;/code&gt; formats.&lt;/p&gt;
&lt;p&gt;Brief recap of the past few&amp;nbsp;issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Content distribution:&lt;/strong&gt; Images and other media are distributed with the help of content distribution networks (CDNs, &lt;a href="https://ngjunsiang.github.io/laymansguide/issue160.html"&gt;Issue 160&lt;/a&gt;)), which have regional servers closer to&amp;nbsp;users.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Code distribution:&lt;/strong&gt; Webpage documents and web scripts (in Javascript) are distributed from the host server (which may comprise more than one&amp;nbsp;computer).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And all of these takes place over the World Wide Web, often through the &lt;span class="caps"&gt;HTTP&lt;/span&gt; protocol (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue007.html"&gt;Issue 7&lt;/a&gt;)). That is how data gets to us when we use the&amp;nbsp;internet.&lt;/p&gt;
&lt;p&gt;What about the software we use, and the oft-dreaded Windows Updates? How does that get to&amp;nbsp;us?&lt;/p&gt;
&lt;h2&gt;Software distribution on Windows and&amp;nbsp;MacOS&lt;/h2&gt;
&lt;p&gt;Okay there’s not actually anything new to say here, just checking if we have the same understanding of how to find new&amp;nbsp;software:&lt;/p&gt;
&lt;p&gt;You’ve got your system updates and whatnot, inconveniences that sometimes force themselves on you. These generally come from a secure server from the operating system (&lt;span class="caps"&gt;OS&lt;/span&gt;) maker, which is Microsoft or&amp;nbsp;Apple.&lt;/p&gt;
&lt;p&gt;You’ve got software made by Microsoft/Apple, which you either download from their website or install through your&amp;nbsp;browser.&lt;/p&gt;
&lt;p&gt;Then there’s the software in their app stores. These app stores are listings of software which developers pay to have their software listed in. A big selling point of app stores is their supposed security: app stores usually have a screening process to ensure that submitted apps are not doing Evil Things™ which harm their users. So when you download an app it is assumed that this app has passed some kind of rigorous screening&amp;nbsp;process.&lt;/p&gt;
&lt;p&gt;Developers often pay a proportion of their revenue to the app stores for this&amp;nbsp;“privilege”.&lt;/p&gt;
&lt;p&gt;And then there is … all the other software you can download from the&amp;nbsp;internet.&lt;/p&gt;
&lt;p&gt;I’m guessing the internet is where most of the desktop/laptop software you use comes&amp;nbsp;from.&lt;/p&gt;
&lt;h2&gt;Software distribution on Android and&amp;nbsp;iPhone&lt;/h2&gt;
&lt;p&gt;On the mobile side of things, it looks remarkably similar, but with the weightage somewhat&amp;nbsp;different.&lt;/p&gt;
&lt;p&gt;System updates, coming from the &lt;span class="caps"&gt;OS&lt;/span&gt; maker —&amp;nbsp;check.&lt;/p&gt;
&lt;p&gt;Software made by the &lt;span class="caps"&gt;OS&lt;/span&gt; maker — check, but coming through app store instead of&amp;nbsp;internet.&lt;/p&gt;
&lt;p&gt;App stores — check, still the&amp;nbsp;same.&lt;/p&gt;
&lt;p&gt;Software from the internet — Android allows installing software from “unknown sources”, but you’ll have to enable a system setting to allow that. It is off by default. On iPhone, this is just not possible.&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;I’m guessing the app store is where most of the mobile apps you use come&amp;nbsp;from.&lt;/p&gt;
&lt;h2&gt;Software as an&amp;nbsp;ecosystem&lt;/h2&gt;
&lt;p&gt;Notice that in neither case is finding software like foraging for berries: there is an entire ecosystem that goes into making these actions&amp;nbsp;possible!&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;&lt;span class="caps"&gt;OS&lt;/span&gt; makers&lt;/strong&gt; obviously have to distribute their &lt;span class="caps"&gt;OS&lt;/span&gt;, supporting software, and updates reliably and securely, so that other software can rely on its continued existence. An &lt;span class="caps"&gt;OS&lt;/span&gt; by itself doesn’t usually do much for users; they need software to create and manage their files, and access the internet. And much of this software is going to be created by other developers, not the &lt;span class="caps"&gt;OS&lt;/span&gt;&amp;nbsp;makers.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;developers&lt;/strong&gt; need documentation and sample code to understand how to write the software, and these usually come from the &lt;span class="caps"&gt;OS&lt;/span&gt; makers. But it can also come from a thriving community of other developers who are writing software for the same&amp;nbsp;system.&lt;/p&gt;
&lt;p&gt;And then there are the &lt;strong&gt;discovery mechanisms&lt;/strong&gt; that users need to find useful software; Google is the fallback when this doesn’t exist, but you usually want users to have a better experience than googling for installers and potentially installing&amp;nbsp;malware.&lt;/p&gt;
&lt;p&gt;Even this understanding is incomplete, but it’s the beginning of a more nuanced model of software development that will help you understand why software often does not do what it should. We are talking about factions in software&amp;nbsp;development.&lt;/p&gt;
&lt;p&gt;Far too often I see users who have no awareness of this divide, and seem to operate on an assumption that software comes from “programmers”, a hallowed, unreachable group of entities that blesses users with features or curses them with bugs at their&amp;nbsp;whim.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Software that we use usually comes from the &lt;span class="caps"&gt;OS&lt;/span&gt; makers, or from third-party developers. These two groups of developers are not the same, and might even have conflicting intentions and&amp;nbsp;goals.&lt;/p&gt;
&lt;p&gt;If I keep going on in this vein I’m going to bring in politics, and I don’t want to do that. Instead, I’ll introduce a slightly different kind of software ecosystem, which non-Linux users are likely not familiar with. My hope is for you to see that *handwaves at above paragraphs* &lt;em&gt;this&lt;/em&gt; isn’t the only way for software distribution to&amp;nbsp;work!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 164: Linux, the universal operating&amp;nbsp;system&lt;/p&gt;
&lt;p&gt;What does a model look like when there is no central app store, controlled by the &lt;span class="caps"&gt;OS&lt;/span&gt; makers? That is how the Linux distribution system&amp;nbsp;works!&lt;/p&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Okay not true, you can replace the &lt;span class="caps"&gt;OS&lt;/span&gt; on your phone through a process called &lt;strong&gt;jailbreaking&lt;/strong&gt;, but this is a layperson’s newsletter and I do not recommend this without much more extensive reading and careful consideration.&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 13"></category></entry><entry><title>Issue 162: Fonts</title><link href="https://ngjunsiang.github.io/laymansguide/issue162.html" rel="alternate"></link><published>2022-03-05T08:00:00+08:00</published><updated>2022-03-05T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-03-05:/laymansguide/issue162.html</id><summary type="html">&lt;p&gt;Typeface families consist of multiple fonts for each style in the typeface. Each font consists of glyphs, which are mathematical shapes described by curves joining points. These shapes need to be rasterised for display on a computer screen, or for printing on paper. Font files usually come&amp;nbsp;in &lt;code&gt;.ttf&lt;/code&gt;, &lt;code&gt;.otf&lt;/code&gt;,&amp;nbsp;or &lt;code&gt;.woff&lt;/code&gt; formats.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Cross-site scripting attacks occur when a webpage loads malicious code from a third-party, usually carried out by a script in the page. Today, websites are protected from loading unauthorised scripts through cross-origin resource sharing (&lt;span class="caps"&gt;CORS&lt;/span&gt;) policy implemented in browsers, which only allows a website to load scripts from authorised&amp;nbsp;domains.&lt;/p&gt;
&lt;p&gt;This is the issue that doesn’t really fit anywhere, but this season is about lots of things we take for granted and fonts are one of&amp;nbsp;them.&lt;/p&gt;
&lt;p&gt;I could probably fill at least half a season talking about fonts and typesetting, but let’s stick to the basics&amp;nbsp;here.&lt;/p&gt;
&lt;h2&gt;What is a&amp;nbsp;font?&lt;/h2&gt;
&lt;p&gt;I’m going with &lt;a href="https://fonts.adobe.com/fonts/source-sans"&gt;Source Sans&lt;/a&gt;, an open-source &lt;strong&gt;typeface&lt;/strong&gt; designed in-house by Adobe. Let’s open one up one of its &lt;strong&gt;font&lt;/strong&gt;s&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;, Source Sans Pro Regular, in a font editor&lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="#fn:2"&gt;2&lt;/a&gt;&lt;/sup&gt; and&amp;nbsp;see:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Fontforge with Source Sans Pro Regular open, showing glyphs" src="https://ngjunsiang.github.io/laymansguide/issue162_01.png" /&gt;&lt;br /&gt;
&lt;em&gt;Source Sans Pro Regular, in&amp;nbsp;Fontforge.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;You might already be aware that fonts contain &lt;strong&gt;glyphs&lt;/strong&gt;, which are the shapes of each separate character. What makes up those&amp;nbsp;glyphs?&lt;/p&gt;
&lt;p&gt;&lt;img alt="Uppercase Q from Source Sans Pro Regular" src="https://ngjunsiang.github.io/laymansguide/issue162_02.png" /&gt;&lt;br /&gt;
&lt;em&gt;Uppercase Q from Source Sans Pro&amp;nbsp;Regular.&lt;/em&gt;    &lt;/p&gt;
&lt;p&gt;These glyphs are mathematical shapes. They are stored as a series of points, joined by curves&lt;sup id="fnref:3"&gt;&lt;a class="footnote-ref" href="#fn:3"&gt;3&lt;/a&gt;&lt;/sup&gt; or straight lines&lt;sup id="fnref:4"&gt;&lt;a class="footnote-ref" href="#fn:4"&gt;4&lt;/a&gt;&lt;/sup&gt;, which are stored as numbers. The diagrams we draw in Microsoft Word are much the&amp;nbsp;same!&lt;/p&gt;
&lt;h2&gt;Font&amp;nbsp;variants&lt;/h2&gt;
&lt;p&gt;When you bold or italicise text, the operating system swaps in the appropriate glyphs from the bold or italic fonts from the same typeface family. A lot of careful work goes into ensuring that these fonts are recognised as belonging to the same typeface, or this feature would not&amp;nbsp;work.&lt;/p&gt;
&lt;p&gt;This means that when you install fonts, remember to grab the bold and italic fonts as&amp;nbsp;well!&lt;/p&gt;
&lt;p&gt;Many applications, if they are unable to find the bold/italic fonts, will artificially “bold” or “italicise” the regular font by thickening the glyph, or slanting it. Any graphic designer worth their salt will notice this immediately; even without scrutinising the font, it will feel “off” in some vaguely inscrutable way until you take a closer look and notice the proportions are&amp;nbsp;wrong.&lt;/p&gt;
&lt;h2&gt;Font&amp;nbsp;display&lt;/h2&gt;
&lt;p&gt;For an application to be able to support text formatting, it must have a program called a text rendering engine. This program takes a single long string of text and determines the appropriate places to chop it up with line breaks. To do that, it first needs to convert the glyph shapes from mathematical formulas into actual real lit pixels or real inky droplets (in a process called &lt;strong&gt;rasterisation&lt;/strong&gt;, &lt;a href="https://ngjunsiang.github.io/laymansguide/issue122.html"&gt;Issue 122&lt;/a&gt;)).&lt;/p&gt;
&lt;p&gt;Then their dimensions have to be considered in the line of text, to know where the line breaks should be placed. Because glyphs are not actually rectangular boxes and they protrude in different ways, optically they need some horizontal adjustment (called &lt;strong&gt;kerning&lt;/strong&gt;) to look evenly spaced optically, so that needs to be done too&lt;sup id="fnref:5"&gt;&lt;a class="footnote-ref" href="#fn:5"&gt;5&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Kerning for some common glyph pairs in Source Sans Pro Regular" src="https://ngjunsiang.github.io/laymansguide/issue162_03.png" /&gt;
&lt;small&gt;Kerning for some common glyph pairs in Source Sans Pro Regular.&lt;br /&gt;&lt;br /&gt;
A kern value of 0 or blank means no kerning is required. A negative value means the letters need to be brought closer, and a positive value means they need to be spaced further (quite rare).&lt;/small&gt;&lt;/p&gt;
&lt;p&gt;Advanced renderers might even do other things, like avoiding too many terminal hyphens on consecutive lines (looks ugly), or making microadjustments to letter spacing. But, oops! This changes the line length, so the engine needs to go back to re-check the line breaks. This is an iterative&amp;nbsp;process.&lt;/p&gt;
&lt;p&gt;Text rendering engines are an art in themselves, and we are not going to go in depth&amp;nbsp;here.&lt;/p&gt;
&lt;h2&gt;Font&amp;nbsp;formats&lt;/h2&gt;
&lt;p&gt;The classic file extension&amp;nbsp;is &lt;code&gt;.ttf&lt;/code&gt;, which stands for Truetype font, a font format created by Apple in the late 1980s and subsequently adopted by other&amp;nbsp;systems.&lt;/p&gt;
&lt;p&gt;These days, you might also&amp;nbsp;see &lt;code&gt;.otf&lt;/code&gt;, which stands for Opentype font. This is a more modern font format, co-developed in the mid-90s by Microsoft and Adobe. This adds much more functionality and new features, which after some deliberation I have decided not to write about—it is simply not a layperson&amp;nbsp;topic!&lt;/p&gt;
&lt;p&gt;If you do web development, you might also&amp;nbsp;see &lt;code&gt;.woff&lt;/code&gt;, the Web Open Font Format, co-developed by Mozilla and other type organisations. It shares some features in common with &lt;span class="caps"&gt;TTF&lt;/span&gt; and &lt;span class="caps"&gt;OTF&lt;/span&gt;, but adds other features for licensing information, which is usually more important for the web, where these font files need to be downloaded to the users’&amp;nbsp;computers.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Typeface families consist of multiple fonts for each style in the typeface. Each font consists of glyphs, which are mathematical shapes described by curves joining points. These shapes need to be rasterised for display on a computer screen, or for printing on paper. Font files usually come&amp;nbsp;in &lt;code&gt;.ttf&lt;/code&gt;, &lt;code&gt;.otf&lt;/code&gt;,&amp;nbsp;or &lt;code&gt;.woff&lt;/code&gt; formats.&lt;/p&gt;
&lt;p&gt;This difference in representation vs display, fonts-as-mathematical-shapes vs fonts-as-pixels-or-dots, has been and continues to be the cause of much weeping and gnashing of teeth. But I’ve decided it’s not worth delving into that for a layman’s guide to computing—perhaps in a separate&amp;nbsp;publication!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 163: System &lt;span class="amp"&gt;&amp;amp;&lt;/span&gt; software&amp;nbsp;ecosystems&lt;/p&gt;
&lt;p&gt;With this diversion over, let’s return to talking about distribution. Content distribution, code distribution, and next issue I’ll move on to software&amp;nbsp;distribution!&lt;/p&gt;
&lt;p&gt;With this I have also cleared my backlog of questions, and will be closing the below section as&amp;nbsp;well.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;del&gt;OpenType? And what are fonts anyway? [Issue 42]&lt;/del&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;A font is a single style in a typeface family. The full family will usually have regular/bold/italic styles. More advanced typefaces may have small caps, display, and caption fonts.&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;The one I use is called &lt;a href="https://fontforge.org"&gt;Fontforge&lt;/a&gt;, and it is open-source.&amp;#160;&lt;a class="footnote-backref" href="#fnref:2" title="Jump back to footnote 2 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;For the curious, the specific type of curve used in fonts are &lt;a href="https://jdhao.github.io/2018/11/27/font_shape_mathematics_bezier_curves/"&gt;Bézier curves&lt;/a&gt;.&amp;#160;&lt;a class="footnote-backref" href="#fnref:3" title="Jump back to footnote 3 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:4"&gt;
&lt;p&gt;Don’t be alarmed if the mathematicians among us casually remark that a straight line is a trivial example of a curve.&amp;#160;&lt;a class="footnote-backref" href="#fnref:4" title="Jump back to footnote 4 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:5"&gt;
&lt;p&gt;The kerning information is created by the font designer and embedded in the font file. Applications usually pass this information to the text rendering engine, although some might not actually use it.&amp;#160;&lt;a class="footnote-backref" href="#fnref:5" title="Jump back to footnote 5 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 13"></category></entry><entry><title>Issue 161: Security and XSS</title><link href="https://ngjunsiang.github.io/laymansguide/issue161.html" rel="alternate"></link><published>2022-02-26T08:59:00+08:00</published><updated>2022-02-26T08:59:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-02-26:/laymansguide/issue161.html</id><summary type="html">&lt;p&gt;Cross-site scripting attacks occur when a webpage loads malicious code from a third-party, usually carried out by a script in the page. Today, websites are protected from loading unauthorised scripts through cross-origin resource sharing (&lt;span class="caps"&gt;CORS&lt;/span&gt;) policy implemented in browsers, which only allows a website to load scripts from authorised&amp;nbsp;domains.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; A content delivery network comprises multiple servers around the world that are able to quickly distribute static content (typically images and video) to viewers that request it. This avoids overloading the hosting server, which would otherwise have to serve data over the network, possibly through many intermediary&amp;nbsp;hops.&lt;/p&gt;
&lt;p&gt;When you load a modern webpage with all its bells and whistles, it is usually loading its content from a content delivery network (&lt;span class="caps"&gt;CDN&lt;/span&gt;; see previous issue). At the same time, it is running scripts that came with the webpage. These scripts may load other scripts on the same server (first-party scripts), or scripts on other servers (third-party&amp;nbsp;scripts).&lt;/p&gt;
&lt;p&gt;What could go&amp;nbsp;wrong?&lt;/p&gt;
&lt;h2&gt;First-party&amp;nbsp;scripts&lt;/h2&gt;
&lt;p&gt;These are scripts you trust, because you host them on your own server (or a server you administer). Ideally you also have network security measures in place and other ways to ensure those scripts are not modified by malicious&amp;nbsp;actors.&lt;/p&gt;
&lt;p&gt;It’s usually safe to load them in the webpage because they are from the same site (i.e. same&amp;nbsp;server).&lt;/p&gt;
&lt;h2&gt;Third-party&amp;nbsp;scripts&lt;/h2&gt;
&lt;p&gt;These are scripts that are loaded from a remote server. You’d usually do this to load scripts from service providers: for analytics, to serve online ads, or to use libraries and frameworks (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue017.html"&gt;Issue 17&lt;/a&gt;), &lt;a href="https://ngjunsiang.github.io/laymansguide/issue018.html"&gt;Issue 18&lt;/a&gt;)). This is mightily convenient: as a third-party service provider, you have the flexibility of updating this script and immediately benefiting your client without them having to do anything. Can’t beat that for&amp;nbsp;convenience!&lt;/p&gt;
&lt;p&gt;But once you open the door to third-party scripts, they could be loaded from &lt;em&gt;anywhere&lt;/em&gt;. And without some mechanism for verification, the client won’t actually know if they are loading your script, or someone&amp;nbsp;else’s.&lt;/p&gt;
&lt;h2&gt;Cross-site scripting (&lt;span class="caps"&gt;XSS&lt;/span&gt;)&lt;/h2&gt;
&lt;p&gt;If a webpage is insecurely scripted, e.g. by inserting data directly from a request without verification, a malicious actor might be able to subvert the source of the request and inject malicious code into the page. This malicious code, though sandboxed by the browser, still has access to data that is on the&amp;nbsp;page.&lt;/p&gt;
&lt;p&gt;This is called a &lt;strong&gt;cross-site scripting&lt;/strong&gt;&amp;nbsp;attack.&lt;/p&gt;
&lt;h2&gt;The weakest&amp;nbsp;link&lt;/h2&gt;
&lt;p&gt;The chain of security is only as strong as its weakest link, so even if your own security is tight, a malicious actor would look at your tech stack (the set of hardware/software/services your company uses), notice that your webpage is loading scripts from a third party, and attempt to hack the third-party&amp;#8217;s servers (which might be less secure). When you draw on features from multiple libraries, you are in effect setting up a circle of trust that is only as secure as the least secure library/third-party in your&amp;nbsp;web.&lt;/p&gt;
&lt;h2&gt;Protections&lt;/h2&gt;
&lt;p&gt;This is why all browsers today have &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS"&gt;cross-origin resource sharing (&lt;span class="caps"&gt;CORS&lt;/span&gt;)&lt;/a&gt; active by default. This prevents scripts from loading other third-party scripts; only loading of first-party scripts are supported by default. To enable loading of scripts from other sources, your server must include special data in the &lt;span class="caps"&gt;HTTP&lt;/span&gt; response header (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue008.html"&gt;Issue 8&lt;/a&gt;)) that specify these sources explicitly. It’s tedious, but it is much more secure, and it is also why learning web programming is much harder today than it was a few years&amp;nbsp;ago.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Cross-site scripting attacks occur when a webpage loads malicious code from a third-party, usually carried out by a script in the page. Today, websites are protected from loading unauthorised scripts through cross-origin resource sharing (&lt;span class="caps"&gt;CORS&lt;/span&gt;) policy implemented in browsers, which only allows a website to load scripts from authorised&amp;nbsp;domains.&lt;/p&gt;
&lt;p&gt;Ughh, this is already getting more tedious and bureaucratic to write about. As you can see, even in the world of programming there is a load of red-tape to cut through, all to protect our works from malicious actors and ensure there is a chain of authorisation running through everything. I guess there’s a life lesson in here&amp;nbsp;somewhere.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 162:&amp;nbsp;Fonts&lt;/p&gt;
&lt;p&gt;I’ve covered content distribution, code distribution (for the web), and now I think we can go a little wider: let’s talk about software&amp;nbsp;distribution!&lt;/p&gt;
&lt;p&gt;But before that I want to slot in a little issue about fonts: just what are they? And how do they&amp;nbsp;work?&lt;/p&gt;
&lt;p&gt;// Hopefully all my readers have had the experience of searching for and actually downloading software. What kind of system is behind this? And how do system and software updates actually get to our&amp;nbsp;devices?&lt;/p&gt;
&lt;p&gt;Get ready for a deeper&amp;nbsp;dive!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;del&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue 8]&lt;/del&gt;&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 13"></category></entry><entry><title>Issue 160: CDNs and content distribution</title><link href="https://ngjunsiang.github.io/laymansguide/issue160.html" rel="alternate"></link><published>2022-02-19T08:00:00+08:00</published><updated>2022-02-19T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-02-19:/laymansguide/issue160.html</id><summary type="html">&lt;p&gt;A content delivery network comprises multiple servers around the world that are able to quickly distribute static content (typically images and video) to viewers that request it. This avoids overloading the hosting server, which would otherwise have to serve data over the network, possibly through many intermediary&amp;nbsp;hops.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Instead of &lt;span class="caps"&gt;GPS&lt;/span&gt; satellites, smartphones can also use wifi points and cell towers to determine their position (if enabled in the &lt;span class="caps"&gt;OS&lt;/span&gt;).&lt;/p&gt;
&lt;p&gt;All businessmen know that distribution is everything. How good your product is, is secondary to how you get your product to the customer. This act of getting things to your customer—it’s called distribution, and entire businesses have been built around excellent&amp;nbsp;distribution.&lt;/p&gt;
&lt;p&gt;In &lt;a href="https://ngjunsiang.github.io/laymansguide/issue157.html"&gt;Issue 157&lt;/a&gt;), I described how time is synchronised from time source to server and on to other servers, down the strata of the hierarchy tree of time servers. Whereas &lt;span class="caps"&gt;GPS&lt;/span&gt;/wifi location (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue158.html"&gt;Issue 158&lt;/a&gt;)) has a much shallower distribution system: everybody gets their location directly from a &lt;span class="caps"&gt;GPS&lt;/span&gt; satellite if there’s nothing else available, otherwise they get it from the nearest wifi point or cell&amp;nbsp;tower.&lt;/p&gt;
&lt;p&gt;What about&amp;nbsp;content?&lt;/p&gt;
&lt;h2&gt;The difficulties of&amp;nbsp;content&lt;/h2&gt;
&lt;p&gt;You make a website, type in the headers and body text, upload the images and videos … and it just works&amp;nbsp;right?&lt;/p&gt;
&lt;p&gt;Let’s think through the &lt;strong&gt;distribution&lt;/strong&gt; of that content. Text is generally small in size and easy to pass around, even through multiple hops (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue036.html"&gt;Issue 36&lt;/a&gt;)) from server to&amp;nbsp;client.&lt;/p&gt;
&lt;h3&gt;Server&amp;nbsp;load&lt;/h3&gt;
&lt;p&gt;What about the heavy stuff, like hi-res images and videos? Thousands or millions of clients all requesting the same large video file from your hosting server. That server is going to be spending many &lt;span class="caps"&gt;CPU&lt;/span&gt; cycles (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue058.html"&gt;Issue 58&lt;/a&gt;)) receiving requests, retrieving the data, splitting and encapsulating it into data packets to be sent out. All that processing adds to the server load. If there are too many clients waiting for the same data &amp;#8230; they gonna wait. And that adds to latency (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue036.html"&gt;Issue 36&lt;/a&gt;)); those viewers are going to be seeing loading spinners for a&amp;nbsp;while.&lt;/p&gt;
&lt;p&gt;Some of that processing can be mitigated with techniques such as caching (&lt;a href="https://ngjunsiang.github.io/laymansguide/issue039.html"&gt;Issue 39&lt;/a&gt;)), but not enough; you will eventually need to add more&amp;nbsp;servers.&lt;/p&gt;
&lt;h3&gt;Bandwidth and transfer&amp;nbsp;fees&lt;/h3&gt;
&lt;p&gt;Your hosting provider is going to be paying lots of egress fees to transfer your data out of their servers (imagine sending the same &lt;span class="caps"&gt;4GB&lt;/span&gt; video to a few thousand Youtube viewers), and they’ll likely pass on the fees to you as&amp;nbsp;well.&lt;/p&gt;
&lt;h3&gt;Latency&amp;nbsp;again&lt;/h3&gt;
&lt;p&gt;If the client is geographically far away from the server, possibly even on the other side of the world, the data is going to go through a lot of hops from server to server. And if any of the servers along the way drop the packet, it is going to need to be&amp;nbsp;resent.&lt;/p&gt;
&lt;h2&gt;Improving content&amp;nbsp;distribution&lt;/h2&gt;
&lt;p&gt;So how do we lighten the server load on the hosting company’s servers, reduce the amount of data to transfer from that server, and improve latency for the&amp;nbsp;clients?&lt;/p&gt;
&lt;p&gt;You place distribution servers as close as possible to the clients, wherever they may be. This usually means you have your servers globally distributed, with regional&amp;nbsp;clusters.&lt;/p&gt;
&lt;p&gt;You place the most often requested files from that region in its distribution server, so that it can serve those files without the request hitting the hosting server. Because the distribution server is so near the client, the data goes through fewer hops to get to the&amp;nbsp;client.&lt;/p&gt;
&lt;p&gt;The main document data is still served from the hosting provider, so that any changes you make to the page get served to clients almost immediately. Otherwise every little change you make has to be reflected in every distribution server that has a copy of that data. For this reason, distribution servers are typically used for &lt;strong&gt;static data&lt;/strong&gt;: data that doesn’t change frequently, or at all—images and videos&amp;nbsp;especially.&lt;/p&gt;
&lt;h2&gt;A content delivery network (&lt;span class="caps"&gt;CDN&lt;/span&gt;)&lt;/h2&gt;
&lt;p&gt;These distribution servers, along with their supporting infrastructure, are collectively known as a &lt;strong&gt;content delivery network&lt;/strong&gt; (&lt;span class="caps"&gt;CDN&lt;/span&gt;). Sometimes, when you are grabbing the &lt;span class="caps"&gt;URL&lt;/span&gt; of an image, you might see “cdn” in the &lt;span class="caps"&gt;URL&lt;/span&gt; domain—now you know what it&amp;nbsp;means!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; A content delivery network comprises multiple servers around the world that are able to quickly distribute static content (typically images and video) to viewers that request it. This avoids overloading the hosting server, which would otherwise have to serve data over the network, possibly through many intermediary&amp;nbsp;hops.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 161: Security and &lt;span class="caps"&gt;XSS&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;With this piece of info, our mental picture of the loading of a webpage is getting more and more complex. No longer can we assume that the web document itself, its images, videos, and other content are all being loaded from the same server: static content might be coming from a &lt;span class="caps"&gt;CDN&lt;/span&gt;, and other content (e.g. ads) might be loaded from&amp;nbsp;elsewhere.&lt;/p&gt;
&lt;p&gt;Let’s talk about this from a security standpoint next&amp;nbsp;issue.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 13"></category></entry><entry><title>Issue 159: Wifi &amp; cell tower location tracking</title><link href="https://ngjunsiang.github.io/laymansguide/issue159.html" rel="alternate"></link><published>2022-02-12T08:00:00+08:00</published><updated>2022-02-12T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-02-12:/laymansguide/issue159.html</id><summary type="html">&lt;p&gt;nstead of &lt;span class="caps"&gt;GPS&lt;/span&gt; satellites, smartphones can also use wifi points and cell towers to determine their position (if enabled in the &lt;span class="caps"&gt;OS&lt;/span&gt;).&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; To get your location using &lt;span class="caps"&gt;GPS&lt;/span&gt;, your phone requests information from four overhead &lt;span class="caps"&gt;GPS&lt;/span&gt; satellites: their location, and the distance between them and your phone. With this information, your phone can calculate its&amp;nbsp;location.&lt;/p&gt;
&lt;p&gt;Okay, so what happens when you are in a tunnel or building and can’t get &lt;span class="caps"&gt;GPS&lt;/span&gt;? How are you still able to use Google Maps to navigate that new sprawl of a&amp;nbsp;mall?&lt;/p&gt;
&lt;h2&gt;Wifi Positioning System (&lt;span class="caps"&gt;WPS&lt;/span&gt;)&lt;/h2&gt;
&lt;p&gt;The principles of triangulation still work within a building, thank math 🙏 but now we need other landmarks to replace &lt;span class="caps"&gt;GPS&lt;/span&gt;&amp;nbsp;satellites.&lt;/p&gt;
&lt;p&gt;What is something with a known (and ideally fixed) location, is electrically powered to receive and respond to signals, and there are enough of them to provide a sufficient number of landmarks for triangulation? If you are in a building with wifi, the wifi access points scattered throughout the building can probably provide&amp;nbsp;this.&lt;/p&gt;
&lt;p&gt;No protocol is involved in &lt;a href="https://en.wikipedia.org/wiki/Wi-Fi_positioning_system"&gt;wifi positioning&lt;/a&gt;, largely because most routers do not carry a precise hardware clock and do not have any way to know their location precisely, and therefore cannot communicate this information meaningfully. Instead, wifi positioning is a collection of techniques for &lt;em&gt;guessing&lt;/em&gt; your location. Your smartphone uses these techniques (usually through its operating system) in conjunction with available wifi networks around you to determine its own&amp;nbsp;location.&lt;/p&gt;
&lt;h2&gt;Wifi positioning&amp;nbsp;techniques&lt;/h2&gt;
&lt;p&gt;One way to figure out your location to proximal wifi points is to use the signal strength as a weak analogue for your distance from them. You can do a very rough position estimate with&amp;nbsp;this.&lt;/p&gt;
&lt;p&gt;Another common technique is to look up the hardware address, or even &lt;span class="caps"&gt;IP&lt;/span&gt; address of the wifi point you are connected to, and just use it directly (with the assumption that wifi signals get too weak outside of a 10 m radius, so you have your location accurate to within ±10&amp;nbsp;m).&lt;/p&gt;
&lt;h2&gt;Wifi location&amp;nbsp;databases&lt;/h2&gt;
&lt;p&gt;One way to keep track of wifi access points and their locations is through a global, public database. &lt;a href="https://en.wikipedia.org/wiki/Wi-Fi_positioning_system#Public_Wi-Fi_location_databases"&gt;A number of these&lt;/a&gt; are available, such as the &lt;a href="https://location.services.mozilla.com/"&gt;Mozilla Location Service&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Cell tower&amp;nbsp;triangulation&lt;/h2&gt;
&lt;p&gt;What happens when you are outdoors, far from any wifi point? As long as you have mobile data enabled and are not in airplane mode, you are still going to be getting your cell signal from a cell tower &amp;#8230; which also meet the three basic criteria for device-based triangulation&amp;nbsp;😉&lt;/p&gt;
&lt;p&gt;Your smartphone can thus triangulate its location from cell towers that it is able to reach. Again, there is no protocol for this, since your smartphone does not communicate with the towers for the express purpose of obtaining location; it is a set of similar techniques, often implemented in the operating&amp;nbsp;system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Instead of &lt;span class="caps"&gt;GPS&lt;/span&gt; satellites, smartphones can also use wifi points and cell towers to determine their position (if enabled in the &lt;span class="caps"&gt;OS&lt;/span&gt;).&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 160: CDNs and content&amp;nbsp;distribution&lt;/p&gt;
&lt;p&gt;Coincidentally, starting with time turned out to be a good idea: time information is sort of like content. It has an origin, and it gets distributed to “consumers” who want that information. As with all distribution systems, you have cascades of product that flow outward from this&amp;nbsp;origin.&lt;/p&gt;
&lt;p&gt;We have covered time and space (I mean, location). Let’s move on to data: how does data get around the world from a few central&amp;nbsp;sources?&lt;/p&gt;
&lt;p&gt;Back in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue073.html"&gt;Issue 73&lt;/a&gt;), when I explained how online advertising works, I mentioned that advertising content is served from a content delivery network (&lt;span class="caps"&gt;CDN&lt;/span&gt;). What is this and how does it&amp;nbsp;work?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 13"></category></entry><entry><title>Issue 158: GPS</title><link href="https://ngjunsiang.github.io/laymansguide/issue158.html" rel="alternate"></link><published>2022-02-05T08:00:00+08:00</published><updated>2022-02-05T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-02-05:/laymansguide/issue158.html</id><summary type="html">&lt;p&gt;To get your location using &lt;span class="caps"&gt;GPS&lt;/span&gt;, your phone receives information from four overhead &lt;span class="caps"&gt;GPS&lt;/span&gt; satellites: their location, and the distance between them and your phone. With this information, your phone can calculate its&amp;nbsp;location.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; Time is synchronised from higher-precision sources through a protocol called Network Time Protocol (&lt;span class="caps"&gt;NTP&lt;/span&gt;). A public pool of time servers is available for synchronisation at&amp;nbsp;pool.ntp.org.&lt;/p&gt;
&lt;p&gt;Ah, &lt;span class="caps"&gt;GPS&lt;/span&gt;. The only topic that actually has almost nothing to do with computing &amp;#8230; and yet the mobile computers in our pocket rely on it so&amp;nbsp;much.&lt;/p&gt;
&lt;h2&gt;A short&amp;nbsp;history&lt;/h2&gt;
&lt;p&gt;The Global Positioning System (&lt;span class="caps"&gt;GPS&lt;/span&gt;) was born of the space age, in 1973, before computers even went mainstream. It was originally used for military applications, particularly for navigation. It was first widely used in a political conflict in the Gulf War (1990–1991). The public finally had access to it in 1996, after &lt;span class="caps"&gt;US&lt;/span&gt; President Bill Clinton issued a policy directive for it to be dual-use (used for both military and civilian&amp;nbsp;purposes).&lt;/p&gt;
&lt;h2&gt;Principles&lt;/h2&gt;
&lt;p&gt;The principle of triangulation far predates &lt;span class="caps"&gt;GPS&lt;/span&gt;. Triangles have been used to estimate distance since antiquity; there is evidence of such techniques being used from sources as far back as 6th century &lt;span class="caps"&gt;BC&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;In essence, if you know the location of two reference points, then with those two reference points and your own location as the third point, you can draw a triangle and solve a little geometry puzzle to figure out your own&amp;nbsp;location.&lt;/p&gt;
&lt;p&gt;If you were hiking or just taking a walk, you need to have at least two landmarks with locations marked on a map. As long as you stop somewhere with good visibility, you can get your bearings to those landmarks on the map, draw a line backward from each landmark following your bearing, and the intersection of the lines from each landmark will show your&amp;nbsp;location.&lt;/p&gt;
&lt;p&gt;But digital compasses are not ubiquitous in all devices yet; typically they are only included in high-end phones. A simpler way for devices to get their location is to estimate their distance to the two landmarks. This they can do using radio waves, which travel at (close to) the speed of light: 300 million metres per second. Provided the landmarks contain devices that can receive this signal and send it back, the time delay can be used to calculate the distance between the device and&amp;nbsp;landmark.&lt;/p&gt;
&lt;h2&gt;The &lt;span class="caps"&gt;GPS&lt;/span&gt;&amp;nbsp;network&lt;/h2&gt;
&lt;p&gt;For this to work globally, you are going to need such landmarks positioned all over the world, within receiving range of any device. These landmarks need to&amp;nbsp;be:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;electrically powered, so they can broadcast&amp;nbsp;signals&lt;/li&gt;
&lt;li&gt;tall, very tall, since radio waves do not follow Earth’s curvature. A short tower would not be able to receive signals for devices that are too far away: the signal would be blocked by the Earths curved&amp;nbsp;surface!&lt;/li&gt;
&lt;li&gt;aware of their own position, and synchronised at regular&amp;nbsp;intervals&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let’s solve problem 2 first: instead of building millions of towers worldwide (and how would we do that on the oceans?), we can just launch satellites into space to serve as landmarks for triangulating position. &lt;span class="caps"&gt;GPS&lt;/span&gt; satellites orbit at an altitude of 20,200 km, almost twice of Earth’s diameter, allowing any of them to be reached from almost half of the Earth’s&amp;nbsp;surface.&lt;/p&gt;
&lt;p&gt;Solving problem 3: if we launch enough satellites, they can continually synchronise their clocks with each other, and triangulate their own position relative to other&amp;nbsp;satellites.&lt;/p&gt;
&lt;p&gt;Solving problem 1: satellites all face this common problem of needing electrical power. They have largely resolved it with the use of solar&amp;nbsp;panels.&lt;/p&gt;
&lt;h2&gt;Getting your location using &lt;span class="caps"&gt;GPS&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;When your smartphone tries to triangulate its location using &lt;span class="caps"&gt;GPS&lt;/span&gt;, it gets its distance from four overhead satellites, along with their location (remember that there is an altitude component!). It then determines its position from this information using&amp;nbsp;triangulation.&lt;/p&gt;
&lt;p&gt;The triangulation calculation here is rather more complicated, given that the satellites are in constant motion and not geostationary (above the same spot on earth all the time). At an orbit altitude of 20,200 km, even radio waves, travelling at lightspeed, still take about 0.07 seconds to reach your phone from a &lt;span class="caps"&gt;GPS&lt;/span&gt; satellite. But it is possible, and your phone does it each time you get your location from &lt;span class="caps"&gt;GPS&lt;/span&gt;—to a precision of about&amp;nbsp;10m!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; To get your location using &lt;span class="caps"&gt;GPS&lt;/span&gt;, your phone receives information from four overhead &lt;span class="caps"&gt;GPS&lt;/span&gt; satellites: their location, and the distance between them and your phone. With this information, your phone can calculate its&amp;nbsp;location.&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 159: Wifi &lt;span class="amp"&gt;&amp;amp;&lt;/span&gt; cell tower location&amp;nbsp;tracking&lt;/p&gt;
&lt;p&gt;Receiving radio signals all the time requires the receiving unit to be on all the time; if you use &lt;span class="caps"&gt;GPS&lt;/span&gt; heavily you will find your battery draining&amp;nbsp;quickly!&lt;/p&gt;
&lt;p&gt;The reason our smartphones can maintain such good battery life is that they &lt;em&gt;don’t&lt;/em&gt; use &lt;span class="caps"&gt;GPS&lt;/span&gt; most of the time. After all, it is not possible to get &lt;span class="caps"&gt;GPS&lt;/span&gt; in a lot of places: in basements, tunnels, anywhere you can’t get a solid signal from four overhead satellites. There are less energy-costly ways to get your location these days, especially if high precision isn’t&amp;nbsp;necessary.&lt;/p&gt;
&lt;p&gt;Next issue, let’s look at how wifi and cell towers come&amp;nbsp;in!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;</content><category term="Season 13"></category></entry><entry><title>Issue 157: NTP and time-syncing</title><link href="https://ngjunsiang.github.io/laymansguide/issue157.html" rel="alternate"></link><published>2022-01-29T08:00:00+08:00</published><updated>2022-01-29T08:00:00+08:00</updated><author><name>J S Ng</name></author><id>tag:ngjunsiang.github.io,2022-01-29:/laymansguide/issue157.html</id><summary type="html">&lt;p&gt;Time is synchronised from higher-precision sources through a protocol called Network Time Protocol (&lt;span class="caps"&gt;NTP&lt;/span&gt;). A public pool of time servers is available for synchronisation at&amp;nbsp;pool.ntp.org.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Previously:&lt;/strong&gt; To speed up execution and avoid translation overhead, some systems employ ahead-of-time translation, storing the translated instructions to be executed in future. But many systems employ a mix of just-in-time (&lt;span class="caps"&gt;JIT&lt;/span&gt;) and ahead-of-time (&lt;span class="caps"&gt;AOT&lt;/span&gt;)&amp;nbsp;techniques.&lt;/p&gt;
&lt;p&gt;This season, I’ll attempt to plug the gaps in the layperson’s working knowledge of Internet-related services. Time, location, wifi and mobile data &amp;#8230; almost all will be covered this&amp;nbsp;season!&lt;/p&gt;
&lt;h2&gt;Global time&amp;nbsp;information&lt;/h2&gt;
&lt;p&gt;Frequent fliers would no doubt be familiar with the existence of timezones: geographical bands stretching from the North to South pole, within which all locations are assumed to be running on the same regional time. These timezones used to be manually synchronised, by phone or telegram, via operators all over the&amp;nbsp;globe.&lt;/p&gt;
&lt;p&gt;Today, &lt;a href="https://en.wikipedia.org/wiki/Tz_database"&gt;timezone information&lt;/a&gt; and other time information required for global coordination are maintained by the &lt;a href="https://en.wikipedia.org/wiki/ICANN"&gt;Internet Corporation for Assigned Names and Numbers&lt;/a&gt; (&lt;span class="caps"&gt;ICANN&lt;/span&gt;), which also maintains other lists of names and numbers owned by the &lt;a href="https://en.wikipedia.org/wiki/Internet_Assigned_Numbers_Authority"&gt;Internet Assigned Numbers Authority&lt;/a&gt;, which we first met back in &lt;a href="https://ngjunsiang.github.io/laymansguide/issue027.html"&gt;Issue 27&lt;/a&gt;). These lists are used by programmers worldwide when writing programs that require time&amp;nbsp;coordination.&lt;/p&gt;
&lt;h2&gt;Time&amp;nbsp;synchronisation&lt;/h2&gt;
&lt;p&gt;What about &lt;em&gt;syncing&lt;/em&gt; time? Intuitively this process involves communication &lt;em&gt;between&lt;/em&gt; computers, and anytime computers need to communicate, you can be sure a protocol is involved. We have seen a few protocols mentioned so&amp;nbsp;far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;HTTP&lt;/span&gt;, the Hypertext Transfer Protocol, for sending web documents (aka webpages) and&amp;nbsp;requests&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;DNS&lt;/span&gt;, the Domain Name Service protocol, to translate domain names (like google.com) to &lt;span class="caps"&gt;IP&lt;/span&gt; addresses (like&amp;nbsp;142.250.64.110)&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;DHCP&lt;/span&gt;, the Dynamic Host Configuration Protocol, used by routers to assign &lt;span class="caps"&gt;IP&lt;/span&gt; addresses to its client&amp;nbsp;devices&lt;/li&gt;
&lt;li&gt;&lt;span class="caps"&gt;USB&lt;/span&gt;, the Universal Serial Bus set of protocols, used for data transfer between a host computer and another&amp;nbsp;device&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;#8230; I hope that’s enough for an idea of where protocols are&amp;nbsp;involved.&lt;/p&gt;
&lt;p&gt;The protocol for time synchronisation is called the &lt;a href="https://en.wikipedia.org/wiki/Network_Time_Protocol"&gt;Network Time Protocol&lt;/a&gt; (&lt;span class="caps"&gt;NTP&lt;/span&gt;), in use since 1985—that makes it as old as&amp;nbsp;me!&lt;/p&gt;
&lt;h2&gt;Time&amp;nbsp;sources&lt;/h2&gt;
&lt;p&gt;In the past, people would look at a common time source—the town square clock tower, Big Ben, church bells, and so on—to get the time. When watches were invented, people who had one would synchronise their watches to these common time&amp;nbsp;sources.&lt;/p&gt;
&lt;p&gt;But watches, clock towers, and other sources of time can get out of sync: one second as measured by each device does not accurately match the scientific definition of a&amp;nbsp;second:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The second is defined as being equal to the time duration of 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the fundamental unperturbed ground-state of the caesium-133&amp;nbsp;atom.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That’s from &lt;a href="https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf/fcf090b2-04e6-88cc-1149-c3e029ad8232"&gt;The International System of Units&lt;/a&gt;&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;, which I am not inclined to argue with in a layman’s newsletter. Needless to say, synchronising to a universal standard is not something the average layperson does. Only select organisations have the need to keep such accurate time on their own, typically using such precise instruments as atomic&amp;nbsp;clocks.&lt;/p&gt;
&lt;h2&gt;Trickle-down&amp;nbsp;time&lt;/h2&gt;
&lt;p&gt;How does the rest of the world get its time from these high-precision devices? It doesn’t; most of the world has no need for the sixteen zeroes of precision provided by an atomic clock. Instead, another cluster of servers synchronise their time to within microseconds of precision of these devices. And &lt;em&gt;another&lt;/em&gt; cluster of servers synchronise their time to these microsecond-precision&amp;nbsp;servers.&lt;/p&gt;
&lt;p&gt;Each “layer of precision” is called a stratum in &lt;span class="caps"&gt;NTP&lt;/span&gt;. Time “trickles down” from higher-precision sources to lower-precision sources, down the stratum. As we descend the stratum, there are more and more devices providing time at that precision. If a time server synchronises to a stratum 1 server, it becomes a stratum 2 server; if it synchronises to a stratum 7 server, it becomes a stratum 8 server. The upper limit for stratum numbers is 15; a stratum 16 device is considered&amp;nbsp;unsynchronised.&lt;/p&gt;
&lt;p&gt;The stratum number is not an indication of quality or reliability, it only indicates distance from the reference time&amp;nbsp;source.&lt;/p&gt;
&lt;h2&gt;Operating a time&amp;nbsp;server&lt;/h2&gt;
&lt;p&gt;&lt;span class="caps"&gt;NTP&lt;/span&gt; is an open protocol, which means the protocol is &lt;a href="https://www.ntp.org/"&gt;readily available online&lt;/a&gt;, and anyone can run their own server implementing this protocol. If you don’t want to write your own software, you can also use the &lt;a href="https://github.com/ntp-project/ntp"&gt;open-source ntp distribution&lt;/a&gt;, and compile it to make your own time server. Some large companies do this for their own large network, to improve the response time from time servers—public time servers, you can imagine, are under pretty heavy&amp;nbsp;load!&lt;/p&gt;
&lt;h2&gt;So is this how our smartphones synchronise their&amp;nbsp;time?&lt;/h2&gt;
&lt;p&gt;More or less, yes. (They actually use a slightly simpler protocol, in the interest of preserving battery&amp;nbsp;life.)&lt;/p&gt;
&lt;p&gt;Hypothetically, if you are designing your own operating system and having to provide a “set time automatically” feature, you can let your user connect to a public pool of time servers, &lt;a href="https://www.pool.ntp.org/en/"&gt;pool.ntp.org&lt;/a&gt; (yes that is the actual name, and also the web address). This pool is further subdivided by continent and region, down to individual countries, since you will probably need specific time for your location. For instance, the specific time server pool for Singapore is&amp;nbsp;sg.pool.ntp.org.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue summary:&lt;/strong&gt; Time is synchronised from higher-precision sources through a protocol called Network Time Protocol (&lt;span class="caps"&gt;NTP&lt;/span&gt;). A public pool of time servers is available for synchronisation at&amp;nbsp;pool.ntp.org.&lt;/p&gt;
&lt;p&gt;I have been waiting ten seasons to write this, and it is finally out of my&amp;nbsp;system!&lt;/p&gt;
&lt;h2&gt;What I’ll be covering&amp;nbsp;next&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Next issue:&lt;/strong&gt; [&lt;span class="caps"&gt;LMG&lt;/span&gt; S13] Issue 158: &lt;span class="caps"&gt;GPS&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This issue is about time. Next issue is about location. With these two issues I would have explained time and space!&amp;nbsp;🤭&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sometime in the future:&lt;/strong&gt; What&amp;nbsp;is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;? [Issue&amp;nbsp;8]&lt;/li&gt;
&lt;li&gt;OpenType? And what are fonts anyway? [Issue&amp;nbsp;42]&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;If you need a term to google for more of this kind of geekery, it is called &lt;a href="https://en.wikipedia.org/wiki/Metrology"&gt;metrology&lt;/a&gt;, the scientific study of measurement.&amp;#160;&lt;a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><category term="Season 13"></category></entry></feed>