<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>H3RALD - Articles</title>
        <link>https://h3rald.com/articles</link>
        <description>The latest articles published on H3RALD, Fabio Cevasco's web site</description>
        <atom:link href="https://h3rald.com/rss.xml" rel="self" type="application/rss+xml" />
        <item>
            <title>Discovering BSD</title>
            <link>https://h3rald.com/articles/discovering-bsd</link>
            <guid isPermaLink="true">https://h3rald.com/articles/discovering-bsd</guid>
            <pubDate>Sun, 20 Sep 2026 06:10:08 +02:00</pubDate>
            <description><![CDATA[<ul id='toc' class='panel'><li><a href='#heading___Net_BSD_is_the_new_Linux'>(Net)BSD is the new Linux</a></li>
<li><a href='#heading__OpenBSD__a_new_era_for_my_VPS'>OpenBSD: a new era for my VPS</a></li>
<li><a href='#heading__Down_the_rabbit_hole'>Down the rabbit hole</a></li>
<li><a href='#heading__Back_to_basics'>Back to basics</a></li>
<li><a href='#heading__Conclusion'>Conclusion</a></li></ul>
<p>I don&rsquo;t exactly know when it started. I always had this itch to learn more about the *BSD operating systems (at least one of the <em>big three</em>: FreeBSD, OpenBSD, and NetBSD), but it never actually materialized properly:</p>

<p><em>&ldquo;Linux is basically the same thing, and it works just fine&rdquo;</em></p>

<p><em>&ldquo;I have been using Ubuntu and Debian derivatives for years, no need to change&rdquo;</em></p>

<p><em>&ldquo;Then something won&rsquo;t work, and I will spend days trying to figure it out&rdquo;</em></p>

<p>Things like that.</p>

<p>Then <a href="https://lore.kernel.org/linux-media/CAHk-=wi4zC+Ze8e+p3tMv8TtG_80KzsZ1syL9anBtmEh5Z40vg@mail.gmail.com/">this</a> happened:</p>

<blockquote><p>I realize that some people really dislike AI, but this is an area where I&rsquo;m willing to absolutely put my foot down as the top-level maintainer.</p>

<p>Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it.</p>

<p>Or just walk away.</p>

<p>AI is a tool, just like other tools we use.  And it&rsquo;s clearly a useful one.</p></blockquote>

<p>Typical, textbook Linus. It&rsquo;s not the first time that he decided to <em>put his foot down</em>, and probably not the last. Still, openly allowing slop in the Linux kernel? That didn&rsquo;t feel right. That felt definitely worse than GCC&rsquo;s <a href="https://gcc.gnu.org/ai-policy.html">AI Policy</a> which declines <em>legally significant</em> AI contributions (but allows them for test cases, go figure).</p>

<p>Over the past few months, I have been thinking a lot about AI, what it means for mankind in general, and the IT world in particular. And well, long story short, I came to the conclusion that the world would probably be better without it.</p>

<p>Needless to say, I didn&rsquo;t feel comfortable using Linux anymore. And for the record, it does suck that I have to worry about the political implications of software, but I learnt from my fellow <a href="https://merveilles.town">Mervfolk</a> that sadly, there is no such thing as apolitical software: software, like everything else, has a political aspect to it, which must be taken into account.</p>

<p>I won&rsquo;t lie: I work for a big multinational company which &ndash; like almost all multinational companies &ndash;  ends up making questionable choices at times. But at least I felt that I could question what software and operating systems I use in my (very limited) free time: I recently purchased an EeePC that was manufactured in 2011, and I originally put AntiX Linux on it. Now, as far as Linux goes, that is probably the most anti-corporate, anti-fascist distros there is&hellip; but sadly, what&rsquo;s the good of that if it is built on top of <em>slopware</em>?</p>

<a class='heading-anchor' id='heading___Net_BSD_is_the_new_Linux'></a><h3>(Net)BSD is the new Linux <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I looked around, and I (re-)discovered that BSD-based operating systems (FreeBSD, NetBSD, and OpenBSD) are now one of the last true strongholds (at least operating system wise) of Free Software that is also taking an active stance against the rise of AI (NetBSD in particular).</p>

<p>So&hellip; well, long story short, I decided to install NetBSD on my old EeePC. I had used FreeBSD in the past (probably 20 years ago), but I felt it was more geared towards user-friendliness and Linux compatibility. I had never tried NetBSD or OpenBSD, so I decided to go for NetBSD for my EeePC.</p>

<p>The installation felt refreshingly low-tech (it&rsquo;s fully text-baseed), and in less than half an hour I had a fully-functional NetBSD system running on my EeePC.</p>

<p><em>Of course it runs NetBSD</em> &ndash; that&rsquo;s one of the slogan of this popular BSD variant, and what made me choose it for my old 2011 hardware.</p>

<p>Of course it didn&rsquo;t just work_™: WiFi didn&rsquo;t, for example, and I had to dig up how to get wpa_supplicant to work and get me on the Internet. I knew about it from when I experimented with more bare-bones Linux distros in the &lsquo;00s, so I got that working relatively quickly.</p>

<p>The one thing that struck me (in a good way) about NetBSD was how simple and bare-bones everything was: I had to manually edit the /etc/rc.conf file to configure services to run at startup, and I deliberately choose not to immediately switch to a graphical environment at boot: sometimes you just want to be productive with he command line, so I configured things so that I had to manually run <em>startx</em> if I wanted a graphical environment.</p>

<p>I also rediscovered the orderly pleasure of a <a href="https://man.openbsd.org/hier">very organized file system</a>: an <em>/etc</em> directory for all configuration files, <em>/usr</em> for user-installed programs, <em>/var</em> for (mostly-)temporary system data, and so on. OK, they are on Linux as well, but on BSD this structure definitely felt more mandated and consistent, with the result that you would always know where to look for something.</p>

<p>For the first time in a good while, I felt I had <em>full control</em> over my operating system: I had the power to decide how it behaved, which window manager to use, and which application to use to browse the filesystem or the Internet: I was experiencing true <em>personal compiting</em>.</p>

<p>In the end, I chose <a href="https://joewing.net/projects/jwm/">JWM</a> (Joe&rsquo;s Window Manager) because it felt like a good compromise between an absolute bare-bones environment (like <em>cwm</em>) and fancier stuff like XFCE or Gnome: I had full control over what to put in my menus, and which widget to use to display battery usage, and which icon theme to go for. It turns out that I really love early &lsquo;00s aesthetic (not surprising, being a Millennial myself), and the Tango icon set was enough for my needs.</p>

<p>In just a couple of days, I had a fully-functional, minimalist, utilitarian, NetBSD-powered desktop environment. And that only took a few hours of my precious free laptop time! And it was definitely time well-spent.</p>

<p>Back in the day, installing Slackware or Gentoo felt liberating. Now, I experienced exactly the same feeling installing NetBSD: in that way, I feel very much that <em>BSD is the new Linux</em>.</p>

<a class='heading-anchor' id='heading__OpenBSD__a_new_era_for_my_VPS'></a><h3>OpenBSD: a new era for my VPS <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>The other obvious Linux system I have been using for the last 10+ years was the Ubuntu LTS installed on my <a href="https://digitalocean.com">Digital Ocean</a> VPS.</p>

<p>Ten years ago, Digital Ocean was <em>the</em> VPS provider to choose: it was (relatively) small, had wonderful documentation to get started, a good web UI to manage things like DNS and backups, they were cheap enough, and they were the <em>hacker&rsquo;s choice</em> when it came to small VPSs.</p>

<p>Fast-forward to 2026, and the same company pivoted into becoming a mainstream cloud <em>and AI</em> provider. I always disliked <em>The Cloud</em> for my personal projects, nevermind <em>AI</em>! Still, I had been using the same <em>droplet</em> for over ten years, it was working well enough, and above all changing VPS would have meant spending a substantial amount of time migrating everything to a new host &ndash; not something I could have pulled it off now, with a full-time job, a wife, and two small children!</p>

<p>I tried not to log on too often from the now-redesigned, slopified, Digital Ocean home page, and carried on. Then&hellip; the final straw came when the same company I once trusted decided to <a href="https://omarchy.org/news/2026/09/digitalocean-joins-as-founding-corporate-patron/">pledge $3M to Omarchy</a>, DHH&rsquo;s latest questionable endeavor.</p>

<p>Quick recap: even though back in 2005 I admired David Heinemeier Hansson for creating <em>Ruby on Rails</em>, easily the most revolutionary web framework of the last thirthy years&hellip; it seems that he now suddenly turned fascist and expressed his own very questionable opinions on&hellip; ethnic cleansing in the UK. Like, for Heaven&rsquo;s sake, you cannot trust anyone these days, can you?</p>

<p>So&hellip; with my newfound political awareness, I decided that this was enough for me, and just over a week ago signed up for a new VM at <a href="https://openbsd.amsterdam">OpenBSD.Amsterdam</a>.</p>

<p>I had heard literally only good things about this small, niche, opinionated, European hosting provider from my fellow Mervfolks, and I was itching to try it out, even though I had never used OpenBSD before. So one night, just after my little nine-month-old decided to wake me up at around 2am, I decided to impulsively sign up and request a 50GB disk, 2GB RAM machine for&hellip; huh&hellip; 81€/year! That was much cheaper than the 25€/month I was currently paying for Digital Ocean anyway.</p>

<p>When I woke up in the morning, I was surprised to find an email by this Misha guy in my personal inbox saying that I could just ssh into my new OpenBSD VM at a specific IP address. I was like <em>oh f***!</em> and I didn&rsquo;t even pay for it yet!</p>

<p>So huh&hellip; well, I guess I did try to log on into the new machine using the SSH key I provided at sign up but&hellip; it didn&rsquo;t work. Darn. That was embarrassing: I had this petulant voice in my head going <em>I told you so, you can&rsquo;t even manage to log in, nevermind migrating 18 domains, subdomains, and apps!</em></p>

<p>Well, there was no way around it: I just couldn&rsquo;t log in with the key I provided, so I decided to reply to that automated response of that Misha guy providing the same public SSH key again, hoping to get some sort of assistance.</p>

<p>Sure enough, five minutes afterwards Misha <em>emails me back</em> saying that I originally had an extra space in the public key I provided, and that I could give it another try.</p>

<p>Well&hellip; what can I say? Surely a sleep-deprived father-of-two can make mistake and type the wrong key when copying and pasting from his phone in the middle of the night!</p>

<p>After the initial amazement derived from the fact that I had just received a mail from <em>an actual, helpful human being</em>, I managed to connect to the VM and started inspecting things: it seemed to be real!</p>

<p>Let&rsquo;s recap a second: it&rsquo;s 2026 and half the world is loosing their s***t (and money, and brains) for some sycophantic machines, and I get a mail from a real human being helping me, and giving me access to a real OpenBSD VM in Amsterdam, <em>even if I didn&rsquo;t even pay for it yet</em>? That was pure insanity. But good insanity.</p>

<p><em>&ldquo;Honey? Did they clone your card or are you really sending 80€ to some dude in Amsterdam?&rdquo;</em></p>

<p>&hellip;That was my wife reacting to an alert on her phone (shared bank account&hellip; a blessing and a course!)</p>

<p>Well, I did pay that dude in Amsterdam. That turned out to be 81€ well-spent.</p>

<a class='heading-anchor' id='heading__Down_the_rabbit_hole'></a><h3>Down the rabbit hole <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>That was it: I had just paid for my new VPS for a year. My wife was happy as I told her this would have ultimately saved us money, and now I had no choice but&hellip; migrating all my stuff to OpenBSD Amsterdam.</p>

<p>Coming from a few days on NetBSD, OpenBSD felt like something slightly more polished and optimized for networking. I quickly learnt the joy (well, kinda) of having a lot of network stuff chrooted for improved security, but, after the initial shock, I managed to get the hang of it pretty quickly.</p>

<p>I made the deliberate choice not to replicate my former Linux VPS, except maybe for using Nginx instead of httpd (I have quite a lot of weird reverse-proxied stuff), and chose to stick to the official base system and packages as much as possible. The first thing I decided was to actually use <em>vi</em> for all the text editing. Yes, you read it right: that&rsquo;s vi (actually nvi), not Vim, nit NeoVim: just <em>the</em> original editor from the 70s: no syntax highlighting, no visual mode, no huge .vimrc, and a backspace that works in the weirdest way (it turns out backspace in vi can only delete characters <em>that you have typed yourself</em>, not pre-existing characters) &ndash; but damn it felt nice: simple, but very powerful.</p>

<p>The next thing I tried was compiling some of my core <a href="https://code.h3rald.com">ecosystem projects</a>. Most of the stuff I use is built in Nim, and luckily, it runs just fine on OpenBSD: there&rsquo;s even a package for Nim itself (although an older version)! I only had to make a few minimal changes to my code here and there, but everything worked smoothly. I then learnt to appreciate the simplicity of <em>rcctl</em> &ndash; it felt much simpler to manage than systemd for managing daemons.</p>

<p>After a few hours hacking away with this new operating system, I genuinely felt I could actually pull it off: I made a checklist of each app or web site to migrate (eighteen of them!), and started going through&hellip; Some of them, like my statically-generated sites,  were straightforward enough, other things (like my NextCloud instance) were not, but in the end I managed fine: I was actually able to migrate everything, one vi-edited config file at a time, and most importantly I genuinely felt I was learning something new and useful in the process!</p>

<a class='heading-anchor' id='heading__Back_to_basics'></a><h3>Back to basics <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>The two things that also scared me were 1) managing and migrating all the DNS configuration I had in Digital Ocean, and 2) managing my own backups. Digital Ocean spoiled me with their easy-to-use UI for these things, so I was a bit lost initially.</p>

<p>The DNS part turned out to be easy enough: Following @alderwick&rsquo;s advice, I signed up for <a href="https://dns.he.net">Hurricane Electric DNS</a>, a free DNS provider, and slowly transcribed my entire DNS configuration, record by record. Soon I realized I could just change the DNS provider and point to the old DNS droplet, and <em>then</em> migrate a particular app or web site and change the DNS to point to the new VPS: zero downtime!</p>

<p>Backups took a little bit more of researching, but in the end I settled with Restic: it seems to be one of the easiest things to configure for this, and it works very well with the remote backup storage of 10GB that OpenBSD Amsterdam gives you with every VM.</p>

<a class='heading-anchor' id='heading__Conclusion'></a><h3>Conclusion <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>For the first time in a good while, I feel like <em>I am back in control</em>: I understand how my system works, I can tweak it and tailor it to my needs.</p>

<p>After just over a week, I was able to turn off my Digital Ocean droplet and enjoy all my personal projects running from a human-friendly, European, VPS provider! And I am happy to report things are running much more smoothly, using less RAM and CPU.</p>

<p>I really hope that OpenBSD Amsterdam carries on their stellar work&hellip; I am extremely happy about my choice, and my only regret is that I didn&rsquo;t do this sooner!</p>]]></description>
        </item>
        <item>
            <title>Convergence</title>
            <link>https://h3rald.com/articles/convergence</link>
            <guid isPermaLink="true">https://h3rald.com/articles/convergence</guid>
            <pubDate>Mon, 13 Jul 2026 00:06:37 +02:00</pubDate>
            <description><![CDATA[<ul id='toc' class='panel'><li><a href='#heading__Eee_hellip_'>Eee&hellip;</a></li>
<li><a href='#heading__Moving_away_from_GitHub'>Moving away from GitHub</a></li>
<li><a href='#heading__Convergent_Versioning'>Convergent Versioning</a></li>
<li><a href='#heading__SubWeb'>SubWeb</a></li>
<li><a href='#heading__Where_to_go_from_here'>Where to go from here</a></li></ul>
<p>Over the past few months I have been thinking about changing a few things related to this web site and my <a href="/projects">projects</a>. With the rise of AI slop and overwhelming bloat throughout the Internet, I have been longing for more simplicity and lightness in my digital life.</p>

<a class='heading-anchor' id='heading__Eee_hellip_'></a><h3>Eee&hellip; <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>So, for my last birthday, I bought myself a nice, fully functional, EeePC!  It&rsquo;s an 1001PXD model from 2011 with a nice 233GB SATA hard drive, a (32bit) Atom processor and (wow!) 2GB of RAM. That was for 40€ mind, including shipping. Not bad at all.</p>

<div class="float-right"><p><img src="/days/2026-05-02.jpeg" alt="My EeePC" /></p></div>

<p>I immediately installed <a href="https://antixlinux.com">AntiX</a>, which is an excellent Debian-based distro for older hardware. In retrospect, I could have installed something more adventurous like Arch or a BSD of some kind, but I wanted to keep things simple (at least for now), and went for something I knew I could setup and use with my eyes closed.</p>

<p>I setup the usual stuff like git and similar everyday software. I decided to go for <a href="https://vim-classic.org">Vim Classic</a>, a slop-free fork of Vim 8.x by <a href="https://drewdevault.com">Drew DeVault</a>, and then&hellip; well, I kinda needed a browser. Now, go find a good, lightweight browser that can access 2026&rsquo;s crappy version of the WWW <em>for a 32bit processor</em>. Most browsers simply don&rsquo;t offer 32bit compatibility anymore, but luckily <a href="https://www.basilisk-browser.org">Basilisk Browser</a> does! It&rsquo;s a really lightweight Firefox fork, and that&rsquo;s now my go-to browser for those web sites that require (ugh!) JavaScript.</p>

<p>For nice, <a href="https://smolweb.org">Smolweb</a>-friendly web-sites, <a href="https://dillo-browser.org">Dillo</a> is hands-down my favorite, but of course, web sites must be done in a certain way (more on that later on in this article).</p>

<p>BUT! There&rsquo;s always a BUT. Even though <em>technically</em> Basilisk can render it just fine, GitHub.com doesn&rsquo;t load. Or better, it probably does, eventually, if you close every other tab or program you may have open. That&rsquo;s just not cool. At that point, I realized that there was only one solution&hellip;</p>

<a class='heading-anchor' id='heading__Moving_away_from_GitHub'></a><h3>Moving away from GitHub <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>This has been bothering me for a while, actually. GitHub, once the stronghold of open source software and the only place you&rsquo;d ever need to be as a developer, is now, well, <a href="https://sfconservancy.org/GiveUpGitHub/">bad</a>.</p>

<p>The solution? Easy: <a href="https://sr.ht">Sourcehut</a>. I had been using it as a mirror for most of my projects for quite some time, but I was not ready to switch, mainly because of the possibility to create GitHub actions to cross-compile my programs so that I could distribute the binaries when I released a new version.</p>

<p>Actually, Sourcehut has an awesome <a href="https://builds.sr.ht">build</a> service targeting *nix systems, but it doesn&rsquo;t offer a way to build for macOS or Windows. And for sure I always wanted to ship the binaries for my software for those platforms as well, right? Well, meh&hellip;</p>

<p>Truth is, I now have two kids and a full time job, I am the main user of my ecosystem of highly-opinionated tools and keeping all those actions running smoothly had become a second (or third) job. So I was like, you know what? No more binaries distributed for any release of my software! Ah, that felt really good, and gave me the final push to make the move official.</p>

<p>And it turns out, releases are overhyped. I was recently discussing with <a href="https://wiki.xxiivv.com/site/devine_lu_linvega.html">Devine</a> about <a href="https://wiki.xxiivv.com/site/kelvin_versioning.html">Kelvin Versioning</a>, and while I like the idea of software aiming at becoming more stable, I just didn&rsquo;t like the whole decreasing temperature thing, and the way dependencies are managed.</p>

<p>But I like the concept of software <em>converging</em> to ultimate stability, maturity, and dependability. Oh yes I did&hellip;</p>

<a class='heading-anchor' id='heading__Convergent_Versioning'></a><h3>Convergent Versioning <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>What if I stopped stressing about preparing for a version 1.0 of a particular piece of software, and just focused on the level of <em>completeness</em> of that piece of software instead? That is the core philosophy behind <a href="/conver">Convergent Versioning</a>, my own alternative to Semantic Versioning and Kelvin Versioning. After years trying to be a good citizen and trying to follow semantic versioning for all my projects, I realized that it would be much simpler and useful to think about my projects in terms of <em>how complete they are</em> rather than <em>whether they break compatibility or not</em>.</p>

<p>I am not expecting tons of people to embrace Convergent Versioning, but even if I will be the only user of this new alternative versioning system, at least it will make sense <em>for me</em>.</p>

<p>After finalizing a reasonable stable draft specification for Convergent Versioning, I decided to use it for <em>all</em> my active <a href="/projects">projects</a>. Now when you look at any of my personal open source project, you will be able to tell the level of maturity and completeness of it. If you go through the changelog of each release, you will also be able to tell whether there have been breaking changes or not (and even derive the corresponding semantic version number for any given version!) &ndash; which I personally reasonably easy to reason about, in all its weirdness.</p>

<a class='heading-anchor' id='heading__SubWeb'></a><h3>SubWeb <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Alright. So within the last couple of months I managed to:</p>

<ul>
<li>Start using a 2011 EeePC laptop, and force myself to use simpler and more lightweight software</li>
<li>Move all my active projects to Sourcehut from GitHub, and enjoy the simplicity of this new platform</li>
<li>Adopt Convergent Versioning for all my active projects, and free myself from the pressure of releasing 1.0 or similar versions for my projects, to focus on what matters (dependability, stability, and maturity).</li>
</ul>


<p>However&hellip; I felt that my own web site was not simple enough. Don&rsquo;t get me wrong, I managed to simplify it considerably over the years, but it still relied on some fancy CSS for managing multiple themes, it used custom fonts, and linked to external resources in some cases.</p>

<p>I tried to imagine how the web (or at least the portion of the web comprised of traditional, personal <em>web site</em>, not apps) should be like. I had a look at the <a href="https://smolweb.org/specs/index.html">HTML subset</a> proposed for Smolweb and while it was definitely an improvement over traditional HTML5, it was still way too rich and complex for my liking.</p>

<p>When I think about a web site I want to visit, ideally I would like it to render perfectly with the extremely lightweight Dillo browser. I basically was looking for something a little bit more complex than the <a href="https://geminiprotocol.net">Gemini protocol</a>, something where you would still be able to build your very own, uniquely styles web site, but without all the complexity and multimedia support of HTML5.</p>

<p>That&rsquo;s how <a href="/subweb">SubWeb</a> was born: I decided to come up with my very own subset of HTML and CSS, which:</p>

<ul>
<li>Allows simple, HTML4-like tags (no SECTION, ASIDE, or other fancy semantic stuff introduced by HTML5 &ndash; no reason to bother when you can just use DIVs with an appropriate class).</li>
<li>No JavaScript.</li>
<li>No objects or external content, for the matter. No video, no audio, obviously no WASM.</li>
<li>Images are allowed (JPG, PNG, and GIF), but only if served from the same origin as the web site.</li>
</ul>


<p>Too strict? Perhaps. But now H3RALD.com is nearly SubWeb-compliant (I still have to fix some external images), and I still don&rsquo;t think I gave up that much! The branding and styling is still recognizable, but it is much more lightweight and considerably simpler. And of course, it renders in Dillo perfectly.</p>

<a class='heading-anchor' id='heading__Where_to_go_from_here'></a><h3>Where to go from here <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Well, I am happy I finally did all this. I feel that finally my personal projects and web site reached the level of simplicity that I was searching for a long time.</p>

<p>Next&hellip; well, maintenance releases, sure, maybe some small features, maybe some improvements to my ConVer and SubWeb proposals&hellip; maybe I will eventually manage to recreate my whole ecosystem of tools in a single, cohesive ecosystem implemented in plain C, a-la Uxn. But again, full time job and family commitments take precedence.</p>

<p>Still, one can dream (and plan)&hellip;</p>]]></description>
        </item>
        <item>
            <title>Introducing hex</title>
            <link>https://h3rald.com/articles/hex</link>
            <guid isPermaLink="true">https://h3rald.com/articles/hex</guid>
            <pubDate>Sat, 21 Dec 2024 15:37:14 +01:00</pubDate>
            <description><![CDATA[<ul id='toc' class='panel'><li><a href='#heading__Why_hex_'>Why hex?</a></li>
<li><a href='#heading__MVPL__Minimum_Viable_Programming_Language_'>MVPL (Minimum Viable Programming Language)</a></li>
<li><a href='#heading__Artificial_Inception'>Artificial Inception</a></li>
<li><a href='#heading___DecemberAdventure'>#DecemberAdventure</a></li>
<li><a href='#heading__Minimalism__distilled'>Minimalism, distilled</a></li></ul>
<p>I have a page on my personal wiki system (which is written in <a href="/min">min</a> with a <a href="/h3">h3</a> frontend, and <em>still</em> closed-source, unfortunately) titled <em>Use cases for a new programming language</em>. The first line I wrote is the following:</p>

<blockquote><p>A new programming language should only be created if it helps addressing a specific, practical use case</p></blockquote>

<p>Right. That was meant to dissuade me to embark in endless quests for creating yet another pointless little language that doesn&rsquo;t really solve any practical purpose. I have a bunch of those lying around or even half-designed in my personal wiki, and of course <a href="https://min-lang.org">min</a> has been my go-to personal project for many years. I still enjoy tinkering with it from time to time.</p>

<p>But&hellip;</p>

<p>I still wanted to create a new language. The problem with min is that by emphasizing practicality more and more, it became more of a single-file, batteries-included programming language that can be used to create web servers, make HTTPS requests, process XML files, &hellip;&ldquo;big&rdquo; things like that.</p>

<p>The syntax also evolved quite a bit to support complex data types, it has sigils, and other oddities (bang-postfixed auto-popping symbols, anyone?). It is also not that small anymore: well over 1MB on some platforms (it statically links OpenSSL for Heaven&rsquo;s sake).</p>

<p>And it is written in Nim. Because I forgot how to program in C after uni. Sometimes I wish I had invested the same amount of time in re-learning C rather than having picked a new, non-mainstream language to build my ecosystem with. But it&rsquo;s fine, everything helps shaping up the future, I suppose.</p>

<a class='heading-anchor' id='heading__Why_hex_'></a><h3>Why hex? <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I always wanted to create a programming language that:</p>

<ul>
<li>had a really minimalist syntax</li>
<li>was small in size</li>
<li>was cross-platform (compiling to WebAssembly and also <a href="https://justine.lol/ape.html">αcτµαlly pδrταblε εxεcµταblε</a>)</li>
<li>was implemented in C (that was more of a personal thing than anything else, but C ain&rsquo;t going anywhere, at least)</li>
<li>was concatenative (I am still fascinated by the concatenative programming paradigm)</li>
<li>was able to do basic operations on strings, numbers, I/O, files and delegate everything else to external programs</li>
<li>could be used to create shell scripts, used as glue code, etc.</li>
<li>had some quirks. Not many, but <em>some</em>, to make it interesting and fun to play with</li>
<li>was easy to understand and useful to learn more about concatenative programming even for non-programmers</li>
</ul>


<p>Then the name. It took me weeks to come up with a good name. I then finally went with <em>hex</em> because:</p>

<ul>
<li>It&rsquo;s short and memorable</li>
<li>It has not really been used for a popular programming language yet (go try find 1-3 letter words that are not already taken)</li>
<li>It has something magical about it (besides thinking about hexadecimal numbers, it also means <em>spell</em> or curse)</li>
</ul>


<a class='heading-anchor' id='heading__MVPL__Minimum_Viable_Programming_Language_'></a><h3>MVPL (Minimum Viable Programming Language) <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Another page of my personal wiki aims at defining what constitutes a <em>minimum viable programming language</em>.</p>

<p>Here&rsquo;s a list of things that I consider <em>mandatory</em>:</p>

<ul>
<li>integers</li>
<li>strings</li>
<li>arrays</li>
<li>execute external processes</li>
<li>variables</li>
<li>define functions</li>
<li>flow control with conditionals and loops</li>
<li>error handling</li>
<li>standard input and output</li>
<li>file input and output</li>
</ul>


<p>&hellip;and here&rsquo;s a list of things that I consider <em>nice to have</em>:</p>

<ul>
<li>floats</li>
<li>objects</li>
<li>booleans</li>
<li>lexical scoping</li>
<li>serialization/deserialization</li>
<li>regex</li>
<li>networking</li>
<li>xml</li>
<li>json</li>
</ul>


<p>I hope that <em>lexical scoping</em> in the <em>nice to have</em> made you chuckle. I know it would be bad, but <em>technically</em> you wouldn&rsquo;t really need lexical scoping, really, especially in case of a concatenative programming language where you don&rsquo;t necessarily need variables.</p>

<p>I decided to put this into practice when designing hex. And that&rsquo;s why, hex:</p>

<ul>
<li>supports only integers, strings, and lists (quotations). It doesn&rsquo;t have floats or dictionaries, even.</li>
<li>comes with 64 native symbol for basic stuff, and lets you define your own (global) symbols, to store data and also define the equivalent of functions.</li>
<li>uses symbols applied on the stack for <em>everything</em> and I mean, literally everything from flow control to error handling and I/O.</li>
</ul>


<p>And that&rsquo;s it. It doesn&rsquo;t implement <em>any</em> of the nice-to-haves (ok, maybe serialization/deserialization, but that comes for free in homoiconic languages). I am also planning of keeping the number of native symbols fixed to 64, and maybe implement a sort of standard library in hex itself.</p>

<a class='heading-anchor' id='heading__Artificial_Inception'></a><h3>Artificial Inception <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>But but but&hellip; last time I checked, I didn&rsquo;t know how to program in C anymore, right? It&rsquo;s not that I can magically start writing decent C code from a day to the next, certainly not enough to write a parser, and interpreter, and things like that.</p>

<p>Or, maybe&hellip;</p>

<p>OK, I cheated a little bit. Everyone is always talking about AI, how it is changing the world, how it can do X and how there won&rsquo;t be a need for Y anymore. There is definitely an element of hype in all that, but undeniably Large Language Models have been quite a breakthrough. Now, it&rsquo;s not that ChatGPT is really intelligent or 100% reliable, but I hadn&rsquo;t been using it for a few weeks and I was surprised to notice the improvements.</p>

<p>I started off innocently, expecting just some pointers and some pseudocode:</p>

<blockquote><p>Implement a simple parser for a really simple stack-based concatenative programming language an able to process integer numbers and common arithmetic operations, for example:
1 3 4 * + 2 -
Should result in 11 being pushed on the stack.</p></blockquote>

<p>It blurted out a Python implementation (no matter what, ChatGPT will <em>always</em> go to Python if you ask it to code something without specifying the language).</p>

<blockquote><p>Provide a C implementation</p></blockquote>

<p>And it did&hellip; I didn&rsquo;t try the code, but continued asking it to add support for strings. And kept asking for more extensions. I was surprised that it could <em>keep the context</em> for as long as it did. Then it started hallucinating more frequently, but at the end of the day, I was left with a good enough implementation of a basic interpreted concatenative programming language. Which <em>actually compiled</em> and worked, for the most part!</p>

<p>&rarr; <a href="https://chatgpt.com/share/6765d6b6-d2bc-8013-b91b-297f4d1c3b14">hex&rsquo;s artificial inception (ChatGPT chat)</a></p>

<p>I kept tinkering with it for a while, and then decided to create a new <a href="https://github.com/h3rald/hex">repo</a> for it.</p>

<p>After a few days, I found myself reading a lot of C code. Timidly, I started writing more and more myself&hellip; when I didn&rsquo;t remember something (memory allocation, pointer arithmetic), I decided to ask ChatGPT for explanations, summaries, cheat sheets&hellip; I was re-learning C!</p>

<p>Now, earlier I said that <em>I cheated a little bit</em>. Using AI to write code still feels a little bit like cheating, sure, but it is important to remember that, after all, <em>it is nothing more than a tool</em>.</p>

<p>There are plenty of issues with it, a lot of ethical ones as well, but at the end of the day, AI is here to stay, and we may as well get the most out of it.</p>

<p>I think getting my little project bootstrapped with AI was an interesting experience, and it was very useful for two things, mainly:</p>

<ul>
<li>Taking care of the boring, mechanical parts of the project</li>
<li>Acting as a personal tutor for learning more about C programming</li>
</ul>


<p>Again, not an infallible tutor, but still better than figuring stuff on my own or with just the Internet. And definitely faster and more efficient than skimming through a programming book or endless Stack Overflow questions.</p>

<p>Using AI for programming is not cheating, no more than using Stack Overflow or&hellip; Visual Studio Code is.</p>

<p>Anyhow, overall positive experience. The best thing I got out of it was a better knowledge of the C programming language: I am now more confident and I can actually program in C a bit, and understand it. Better than I did in a long time, anyway.</p>

<a class='heading-anchor' id='heading___DecemberAdventure'></a><h3>#DecemberAdventure <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>It took me about 15 days of sporadic ChatGPT interactions alternated with even more sporadic (and short) personal coding sessions to get the basics of the language implemented. At the beginning of December, I then decided to take part in <a href="https://eli.li/december-adventure">#DecemberAdventure</a> and work on hex of course! You can read more about it <a href="/articles/december-adventure-2024">here</a>.</p>

<p>The funny thing is that most of the design (and implementation) of the language was kinda there already, but I managed to create more of an ecosystem around it.</p>

<p>One thing I actually enjoy about creating new open source projects is that it is never only about the code: I love writing support material for my creations, creating web sites, things like that.</p>

<p>Today, hex:</p>

<ul>
<li>has its own web site at <a href="https://hex.2c.fyi">https://hex.2c.fyi</a>, with its own browser-based <a href="https://hex.2c.fyi/play">playground</a>, a <a href="https://hex.2c.fyi/learn">tutorial</a>, and even a <a href="https://hex.2c.fyi/spec">specification</a>.</li>
<li>runs on different platforms, and can be compiled to WebAssembly to an  <a href="https://justine.lol/ape.html">αcτµαlly pδrταblε εxεcµταblε</a></li>
<li>has a virtual machine, comprised of a simple but fully-functional bytecode compiler and interpreter</li>
</ul>


<p>The thing is&hellip; I have manage to achieve this levels of ecosystem completeness with min, never mind doing it in a really short time. But with hex I started (and remained) small, and that was the key.</p>

<a class='heading-anchor' id='heading__Minimalism__distilled'></a><h3>Minimalism, distilled <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Syntactically speaking, the language is very similar to min. I always quite liked min&rsquo;s distinctive lispy flavor without actually being a lisp, its simple way of doing things without many special forms.</p>

<p>Take this program for example:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Sure, it is a bit verbose, but if i tell you that:</p>

<ul>
<li>; is used to start line comments</li>
<li>Things are pushed on the stack from left to right</li>
<li>Things within parenthesis are quotations (lists) of other things</li>
<li>Strings are delimited by double quotes</li>
<li>Integers are prefixed with 0x</li>
<li>Everything else is a symbol, and unlike other things, when they are not inside a quotation they disappear from the stack and manipulate it in some way</li>
</ul>


<p>&hellip;you basically already know the language syntax and how it works.</p>

<p>You have literals that get pushed on the stack, or symbols that manipulate it, and that&rsquo;s pretty much it.</p>

<p>You may want to know that the <code>:</code> symbol is used to define other symbols and that the <code>#</code> symbol destroys them, and that the <code>cat</code> symbol pops two strings from the stack and pushes back a concatenation of the two&hellip; sure, you can learn all of hex <a href="https://hex.2c.fyi/spec#native-symbols">64 native symbols</a>, but as I mentioned earlier, there are no statements, or expressions, or special forms: everything is either a literal that gets pushed on the stack, or a symbol that manipulates it.</p>

<p>Well, there you have it. Yet another programming language that you&rsquo;ll never use. Everyone is creating programming language these days, and now with AI even people that normally wouldn&rsquo;t will be able to, imagine that.</p>

<p>Still, this has been, and it will continue to be, a very rewarding experience. And maybe, just maybe, this new little thing called hex can teach someone something new (concatenative programming) or even be used to write some very cryptic shell script.</p>]]></description>
        </item>
        <item>
            <title>December Adventure 2024</title>
            <link>https://h3rald.com/articles/december-adventure-2024</link>
            <guid isPermaLink="true">https://h3rald.com/articles/december-adventure-2024</guid>
            <pubDate>Wed, 04 Dec 2024 05:43:13 +01:00</pubDate>
            <description><![CDATA[<ul id='toc' class='panel'><li><a href='#heading__The_first_fortnight_hellip_'>The first fortnight&hellip;</a></li>
<li><a href='#heading__Day__1'>Day #1</a></li>
<li><a href='#heading__Day__2'>Day #2</a></li>
<li><a href='#heading__Day__3'>Day #3</a></li>
<li><a href='#heading__Day__4'>Day #4</a></li>
<li><a href='#heading__Day__5'>Day #5</a></li>
<li><a href='#heading__Day__6'>Day #6</a></li>
<li><a href='#heading__Day__7'>Day #7</a></li>
<li><a href='#heading__Day__8'>Day #8</a></li>
<li><a href='#heading__Day__9'>Day #9</a></li>
<li><a href='#heading__Day__10'>Day #10</a></li>
<li><a href='#heading__Day__11'>Day #11</a></li>
<li><a href='#heading__Day__12'>Day #12</a></li>
<li><a href='#heading__Day__13'>Day #13</a></li>
<li><a href='#heading__Day__14'>Day #14</a></li>
<li><a href='#heading__Day__15'>Day #15</a></li>
<li><a href='#heading__Day__16'>Day #16</a></li>
<li><a href='#heading__Day__17'>Day #17</a></li>
<li><a href='#heading__Day__18'>Day #18</a></li>
<li><a href='#heading__Day__19'>Day #19</a></li>
<li><a href='#heading__Day__20'>Day #20</a></li>
<li><a href='#heading__Day__21'>Day #21</a></li>
<li><a href='#heading__Day__22'>Day #22</a></li>
<li><a href='#heading__Day__23'>Day #23</a></li>
<li><a href='#heading__Day__24'>Day #24</a></li>
<li><a href='#heading__Day__25'>Day #25</a></li>
<li><a href='#heading__Day__26__rarr___31'>Day #26 &rarr; #31</a></li></ul>
<p>And so it begins! This year I learnt about this <a href="https://eli.li/december-adventure">#DecemberAdventure</a> thing and decided to give it a go. I believe it started off last year as a sort of low-key alternative to <a href="https://en.wikipedia.org/wiki/Advent_of_Code">Advent of Code</a>&hellip; but last year I probably didn&rsquo;t pay too much attention to it, or dismissed like yet another daily thing to do every day of the month in autumn, and I normally don&rsquo;t bother with those things (I seldom write here these days, let alone do something <em>every day</em>!).</p>

<p>This year, when more and more fellow Mervellians <a href="https://merveilles.town/tags/DecemberAdventure">started to post about it</a>, I thought I&rsquo;d give it a shot.</p>

<p>Truth is, this year I have a cool little project that just <em>begs</em> to be blogged about. I actually started working on it in mid-November, but the idea is to write a bit of code every day in December (which I have been doing), so that works too. The thing in question is <a href="https://hex.2c.fyi">hex</a>, a new concatenative programming language of mine (yes, <a href="https://min-lang.org">again</a>).</p>

<p>The thing with this thing, hex, is that&hellip; well, it&rsquo;s a little thing, you see. It&rsquo;s <em>low key</em>. It doesn&rsquo;t even get its own domain, just a subdomain, at most. And the site! A little site indeed. Call it minimalist, brutalist even. Very simple styling, simple colors (I am using CSS color names instead of RGB codes because most of it is being written by hand, and on my mobile phone!). It&rsquo;s just perfect. For me at least, which is what matters the most, right? ;)</p>

<p>Good! Now that we are done with all the introductions and pledges, let&rsquo;s get going already!</p>

<a class='heading-anchor' id='heading__The_first_fortnight_hellip_'></a><h3>The first fortnight&hellip; <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>As I mentioned earlier, this project actually started on November 15th, 2024. Yes, I should have waited and posted bits about it everyday in December maybe, that may have been more interesting&hellip; or not, in a way. The thing is, this new language right is now more or less implemented, from a pure coding point of view, but a ton of stuff is missing that makes a project <em>polished enough</em> to be released. I am referring to things like:</p>

<ul>
<li>More extensive testing</li>
<li>Comprehensive documentation</li>
<li>A web site</li>
<li>An online playground</li>
<li>Automated builds for different platforms</li>
<li>Blog posts about it</li>
<li>A project page here on H3RALD.com</li>
</ul>


<p>In the first fifteen days I concentrated on rough development, I implemented a way to process tokens, interpret them, I added all the necessary data structures to manage state&hellip; I did all this in C. C you say? But I somewhat recently (in June! That&rsquo;s recent for this site) <a href="https://h3rald.com/articles/home-cooked-apps-the-right-way/#heading__On_not_being_smart__and_knowing_your_limits">blurted about</a> the fact that I <em>didn&rsquo;t</em> actually know how to code C properly! So how the&hellip;</p>

<p>Well, AI.</p>

<p>WAIT! Before you metaphorically close this article and burn it, I didn&rsquo;t mean that AI wrote the whole thing. I started off innocently as asking ChatGPT if it could build an interpreter for a small programming language able to process integers and do simple arithmetic, gave it the parameters, kept refining it, asked to add string support, caught some problems and got it to address them. For a while (0.6745 seconds) I thought this thing was actually able to understand my thoughts and that all developers were going to be out of a job, then&hellip; well, then the poor thing just couldn&rsquo;t do it.</p>

<p>It did well, I gotta say. Let&rsquo;s say that if you keep your code down to, say, 500 lines it can &ldquo;remember it&rdquo; more or less as a fairly dumb junior developer who&rsquo;s really fast at stack-overflowing tasks&hellip; then it falls apart: forgets that we decided to change function names from camel case to snake case, forgets that freeing things in that way segfaulted, and then it started with names of functions that didn&rsquo;t exist. Damn. Repeat after me:</p>

<p><em>LLMs ain&rsquo;t smart, stop trusting them!</em></p>

<p>Before the hallucinations got out of hand, I did the right thing and took that code out of it and put it in a repo. It needed actual nourishment and care, it needed love. I took pity of that half-baked codebase, and tried to see if I could improve upon it.</p>

<p>One thing I realized was that by conversing with that&hellip; thing, and asking the right questions on how pointer work, and how memory is managed, I kinda brought my latent C programming skills from university back to life. I am no expert C programmer, but I believe this little digression helped me remember some of it, at least!</p>

<p>All satisfied with my newfound C wizardly skills, I kept iterating over the code till it got in semi-decent shape. I believe by the end of November most of the symbols I implemented worked properly, segmentation faults that plagued the thing are (mostly) gone, there are a bunch of tests as well and a couple of scripts written in hex, too. One for <a href="https://github.com/h3rald/hex/blob/master/test.hex">running the tests</a> and one for <a href="https://github.com/h3rald/hex/blob/master/web.hex">generating the web site</a>. Oh, and I almost learnt something about <a href="https://github.com/h3rald/hex/blob/master/Makefile">Makefiles</a>, too!</p>

<a class='heading-anchor' id='heading__Day__1'></a><h3>Day #1 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Today I made some improvements to reporting parsing errors (I had line and column counters already there, why on Earth shouldn&rsquo;t I use them for parsing errors?), and then focused on getting the <a href="https://hex.2c.fyi/play">playground</a> to work. I read about WASM and Emscripten, and managed to actually compile with minor modifications but&hellip; it turns out that if you want to have something other than browser prompts to handle standard import, is a (<a href="https://github.com/emscripten-core/emscripten/issues/10545">nearly</a>) impossible task.</p>

<a class='heading-anchor' id='heading__Day__2'></a><h3>Day #2 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I finally got STDIN to work properly, and you are now able to input into the hex REPL via a standard textbox that blends in with the rest of the pseudo-terminal I quickly hacked together.</p>

<p>Here&rsquo;s a picture for posterity, in case the design changes:</p>

<p><img src="/images/dec-adv-2024/hex-playground.png" alt="hex playground" /></p>

<p>How I did it, you ask? I basically had to implement an alternative <code>fgets</code> implementation using one of the (ugh!) Emscripten macros to actually call JavaScript code, and it works beautifully!</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Erhm. Alright. It feels kinda ugly to have JS code in your C file but if that&rsquo;s what it takes&hellip; this is the simplest option I found by far. Kudos to <a href="https://twdev.blog/2024/02/wasm_cpp_06/">Tomasz Wisniewski</a>.</p>

<p>Excited with this breakthrough (which happened at around 6am while still in bed, for the record), I tried to raise the stakes. Let&rsquo;s see if I can get an <a href="https://justine.lol/ape.html">αcτµαlly pδrταblε εxεcµταblε</a> for hex&hellip;</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>BOOOM! It worked. I mean, of course it did, hex is not exactly complexity incarnate, but still, good going. One thing I needed to change was adding some extra instruction to flush stdout more often (some implementation of libc differ on this&hellip; like <a href="https://www.musl-libc.org">musl libc</a> and <a href="https://justine.lol/cosmopolitan/">cosmopolitan libc</a>, some background <a href="https://www.reddit.com/r/C_Programming/comments/lbjhx4/when_to_fflush_stdout/">here</a>), but that was it.</p>

<a class='heading-anchor' id='heading__Day__3'></a><h3>Day #3 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Today I created a semi-decent <a href="https://hex.2c.fyi/about">about page</a> for hex, improved the static site generator to include different html <code>&lt;title&gt;</code> tags for each page, and started refactoring the Makefile a little bit. Not sure I am getting the task dependencies to work correctly, i.e. when compiling to WASM etc. though.</p>

<a class='heading-anchor' id='heading__Day__4'></a><h3>Day #4 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I actually wrote this page. Up to here, to be precise, to catch up. And made the conscious decision to actually say that this is a #DecemberAdventure thing. So that&rsquo;s quite a lot, and so very meta of me.</p>

<a class='heading-anchor' id='heading__Day__5'></a><h3>Day #5 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Implemented the <a href="https://github.com/h3rald/hex/blob/master/.github/workflows/release.yml">Github workflow</a> to be able to prebuild hex binaries for:</p>

<ul>
<li>Linux (x86_64)</li>
<li>MacOS (ARM64)</li>
<li>MacOS (x86_64)</li>
<li>Windows (x86_64)</li>
<li><a href="https://justine.lol/ape.html">αcτµαlly pδrταblε εxεcµταblε</a></li>
<li><a href="https://webassembly.org">WebAssembly</a></li>
</ul>


<p>I also created the <a href="https://hex.2c.fyi/get/">/get</a> page for the hex web site, which called for improving a little bit the bare-bones <a href="https://github.com/h3rald/hex/blob/master/web.hex">static site generator</a> script that I wrote in hex itself. Essentially, I added a general way to replace tags like <code>{{release}}</code> or <code>{{title}}</code> with some values.</p>

<p>First, a helper symbol that expects a strings on the stack, and wraps it in double curly brackets:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Then, another symbol to do all the replacements;
<code>
; Replace tag
(
    "pt_repl" store
    "pt_tag" store
    "pt_content" store
    (pt_content pt_tag tag i index 0x0 &gt;)
        (pt_content pt_tag tag i pt_repl replace "pt_content" store)
    while
    pt_content
) "process-tag" store
</code></p>

<p>&hellip;this is then used in the main loop to process contents:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Not bad, even though it feels a bit verbose. I am actually considering using <code>.</code> instead of <code>i</code> to dequote quotations and maybe even <code>:</code> instead of <code>store</code>, although it may become less readable. At present, non-alphanumeric symbols are only used for well-known mathematical operators like <code>&gt;</code> or <code>+</code>.</p>

<p>Oh, and I also fixed a buffer overflow issue in the <code>read</code> symbol.</p>

<a class='heading-anchor' id='heading__Day__6'></a><h3>Day #6 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I decided to give it a try, and changed a few commonly-used symbols to use a single non-alphanumeric character:</p>

<ul>
<li><code>store</code> &rarr; <code>:</code></li>
<li><code>free</code> &rarr; <code>#</code></li>
<li><code>i</code> &rarr; <code>.</code></li>
<li><code>eval</code> &rarr; <code>!</code></li>
<li><code>q</code> &rarr;  <code>'</code></li>
</ul>


<p>So yesterday&rsquo;s code snippet becomes this:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Out of all, I am particularly fond of <code>.</code>, <code>'</code>, and <code>:</code>. The last two come straight from <a href="http://min-lang.org">min</a>, while the dot I shamelessly &ldquo;borrowed&rdquo; from <a href="https://gts.quiltro.org/@lobo">Lobo</a>&rsquo;s <a href="https://git.quiltro.org/lobo/kojote">kojote</a> (thanks!).</p>

<a class='heading-anchor' id='heading__Day__7'></a><h3>Day #7 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Today I bashed my head against the wall trying to get hex to work <em>properly</em> when compiled to WASM and run via NodeJS.</p>

<p>The thing is, basically, because of NodeJS&rsquo;s asynchronous nature, people have been doing all sort of things trying to get something like <code>fgets</code> to work. In the end I ended up re-using the <code>em_fgets</code> function I wrote on Day #2, and then have some NodeJS glue code to actually capture the input via <a href="https://nodejs.org/api/readline.html">readline</a>&rsquo;s on event, like this:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>So&hellip; well that worked.  Still, I was wondering why I couldn&rsquo;t see my nice <code>&gt;</code> character in my REPL&rsquo;s prompt&hellip; Well, it turns out that <a href="https://github.com/emscripten-core/emscripten/issues/20622">it is basically impossible</a> to get stdout flushing to work in Emscripten. Also calling <code>process.stdout.write</code> on print doesn&rsquo;t work either so&hellip; Meh, there&rsquo;s a quick fix, can&rsquo;t be bothered anymore, for now:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Anyhow, for now I am going to mark the WASM build as <em>experimental</em>, and be done with it. In other news, I also added support for all platforms and for αcτµαlly pδrταblε εxεcµταblε in the <a href="https://github.com/h3rald/hex/blob/master/.github/workflows/ci.yml">CI workflow</a> that builds hex and runs the tests.</p>

<a class='heading-anchor' id='heading__Day__8'></a><h3>Day #8 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Today I decided to enhance the comparison operators to support quotations as well. Not the most useful feature in the world, but for completeness' sake, we should also lexicographic comparison of quotations, also because <code>==</code> and <code>!=</code> already supported quotations anyway.</p>

<p>Another thing I added was support for splitting a string by character by specifying a blank string as separator:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>This feature is standard in most programming languages and could be quote useful to work on strings.</p>

<p>Last but not least, I also did some tidying in the repo and organized things neatly in sub-folders.</p>

<a class='heading-anchor' id='heading__Day__9'></a><h3>Day #9 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Today I added more tests and got past 100 (yay!). Checking for error conditions, mostly. I ended up changing the behavior of some of the symbols, like instead of having errors thrown in case of mismatching types, like in the following test:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>I am now just returning <code>0x0</code> (false) and be done with it.</p>

<p>The other thing I did was updating the <code>web.hex</code> script to&hellip; generate the changelog based on files stored in a release folder. I am also generating a <a href="https://github.com/h3rald/hex/blob/master/CHANGELOG.md">CHAGELOG.md</a> file so that GitHub is happy and can preview it, even though it is, in fact, an HTML file&hellip;</p>

<a class='heading-anchor' id='heading__Day__10'></a><h3>Day #10 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>And so&hellip; Colors! Time for some proper syntax highlighting for hex! I feel like I am kinda cheating a little bit, because having already implemented Vim and VSCode syntax highlighting for <a href="https://min-lang.org">min</a>, doing the same for hex was a piece of cake.</p>

<p>Here&rsquo;s how hex syntax highlighting looks in Vim:</p>

<p><img src="/images/dec-adv-2024/hex-vim.png" alt="Vim hex highlighting" /></p>

<p>&hellip;and that&rsquo;s how it looks in Visual Studio Code:</p>

<p><img src="/images/dec-adv-2024/hex-vscode.png" alt="VSCode hex highlighting" /></p>

<p>Beyond that, I also quickly added support for:</p>

<ul>
<li>Scheme-style block comments delimited by <code>#|</code> and <code>#|</code> (like in min)</li>
<li>Support for handling hashbang if present on the first line</li>
</ul>


<a class='heading-anchor' id='heading__Day__11'></a><h3>Day #11 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>The <a href="https://hex.2c.fyi/spec">spec</a> is up! No, not quite: I just managed to add an outline and the signature of every native symbol. I also updated the <a href="https://github.com/h3rald/hex/blob/master/scripts/web.hex">web.hex</a> script (the mini static site generator for the hex site) to handle placeholders like <code>{{sym-puts}}</code> and substitute them with links to the corresponding <a href="https://hex.2c.fyi/spec#puts-symbol">definition</a> in the spec.</p>

<p>I also added more tests and fixed a problem with parsing escaped characters like backslashes and quotes in strings. Hopefully&hellip;</p>

<a class='heading-anchor' id='heading__Day__12'></a><h3>Day #12 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Today I decided to remove the <code>slice</code> and <code>insert</code> symbols (which are fairly complex and can be re-implemented with other symbols, if needed) and substituted them with <code>ord</code> and <code>chr</code>, to return the ASCII code or the character represented by an ASCII code respectively. I believe this functionality is totally missing from the language, and could potentially be used to implement advanced string matching (only of ASCII characters though, I&rsquo;d like to keep things <em>very</em> simple!).</p>

<p>I also started writing the <a href="https://hex.2c.fyi/spec">spec</a>! All the 64 native symbols are now documented (could do with some examples but it&rsquo;s better than nothing), and I also completed the syntax section.</p>

<a class='heading-anchor' id='heading__Day__13'></a><h3>Day #13 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>The official hex <a href="https://hex.2c.fyi/spec">specification</a> is complete. Or better, at least the first draft of it is anyway. I also spent some time tweaking the CSS of the hex web site a little bit to make it more readable.</p>

<p>The other thing I decided to implement for fun was&hellip; a poor man&rsquo;s syntax highlighting markup for hex syntax. Now, hex of course doesn&rsquo;t have things like regular expressions, and creating a parser for the hex language in itself would be overkill maybe (although perhaps it could be done) so&hellip; well, I decided to go for a really crude (but working) method based on replacing unusual sequences of characters like <code>$"</code>, or <code>$$</code>.</p>

<p>Here&rsquo;s the code for it, that is part of the <a href="https://github.com/h3rald/hex/blob/master/scripts/web.hex">web.hex</a> script (the irony is that the following code will <em>not</em> be highlighted on this site :P).</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Right&hellip; so the idea is to wrap <em>any</em> hex token except for parenthesis with some <code>$</code> signs, which will be replaced with the corresponding html <code>&lt;span&gt;</code> tags. So a simple example like the following:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>&hellip;would have to be written as:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Yikes. Crude. I did say that, didn&rsquo;t I? But it does save some keystrokes at least!</p>

<a class='heading-anchor' id='heading__Day__14'></a><h3>Day #14 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>It&rsquo;s out! I decided that it is finally time to release hex v0.1.0! You can go get it from the <a href="https://hex.2c.fyi/get">/get</a> page.</p>

<p>Oh of course I also managed to finish the whole site today, and published an <a href="https://hex.2c.fyi/learn">introductory tutorial</a> on the language, which should hopefully help more folks get closer to the concatenative programming paradigm.</p>

<a class='heading-anchor' id='heading__Day__15'></a><h3>Day #15 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Today I spent more time with my family and took it easy a little bit. I did manage to add a <a href="/hex">project page</a> for <em>hex</em> here on this side, and thought a little bit about the next steps:</p>

<ul>
<li>I will obviously write a proper blog post about thus new project of mine, and explain the reasoning behind it a little bit better.</li>
<li>I am thinking about reorganizing the source code into multiple .c files and generate an &ldquo;amalgamation&rdquo; file for compilation.</li>
<li>I wouldn&rsquo;t mind implementing a simple virtual machine and a bytecode format for hex. I always wanted to do it, and this could be my chance as this project is simple enough.</li>
</ul>


<a class='heading-anchor' id='heading__Day__16'></a><h3>Day #16 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I decided that I don&rsquo;t want to manage a single .c file anymore, so it is finally time to split it. But! I still really like the idea that someone may find itt easier to embed if it&rsquo;s a single file (I know I do for things like SQLite!), so I created my own simple amalgamation script in Bash to concatenate all the files and preserve the original filenames and line numbers. For simplicity&rsquo;s sake I am using a single header file though (no need for more modular builds right now). Here goes:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>This didn&rsquo;t take long&hellip; then I started working on a simple virtual machine, decided the opcodes and the bytecode format, and started the implementation. I didn&rsquo;t quite complete the generation part yet, but hopefully will be done soonish.</p>

<a class='heading-anchor' id='heading__Day__17'></a><h3>Day #17 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Perhaps I managed to implement a simple bytecode compiler for <em>hex</em>. It took a while, mostly due to my inexperience with C and pointers in particular, but I should have got the basics down.</p>

<p>Consider this example program that prints the numbers that can be divided by two:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>It is actually pretty comprehensive as far as syntax goes: you have integers, strings, quotations (even nested), native and user symbols.</p>

<p>The corresponding bytecode I am able to generate is this:</p>

<p><img src="/images/dec-adv-2024/hbx-example.png" alt="hbx example" /></p>

<p>Let&rsquo;s break it down:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Phew&hellip; that&rsquo;s the whole lot. Again, this is my very first attempt at something like this. It doesn&rsquo;t look too bad: I am able to encode all types of tokens, and manage nested quotations, but there&rsquo;s still room for improvements:</p>

<ul>
<li>Every time I need to declare a size, I am taking up the full four bytes of an uint32_t number. In most cases one would be enough&hellip; I should implement variable-length encoding of some sort, but can live with it for now.</li>
<li>Similarly, integers take up four bytes always, and the MSB is the first of the four (making it little-endian), which is a bit counter-intuitive maybe? Or perhaps it&rsquo;s fine.</li>
<li>I am essentially encoding user symbols as strings. In similar cases, I noticed that folks tend to add a <em>symbol table</em> after the header for lookups.</li>
</ul>


<p>Despite these little things, it feels promising. Of course the next step is going to be the interpreter&hellip; more fun to come!</p>

<a class='heading-anchor' id='heading__Day__18'></a><h3>Day #18 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I managed to refine the bytecode generation algorithm a little bit <em>and</em> implement an interpreter that seems to work as expected!</p>

<p>So, for now:</p>

<ul>
<li>I implemented variable-length code using the <a href="https://en.wikipedia.org/wiki/LEB128">LEB128</a> algorithm for sizes, and this makes storing sizes and integers more compact.</li>
<li>Because this algorithm uses little-endian, I have decided to store all integers as little-endians.</li>
</ul>


<p>The resulting bytecode for yesterday&rsquo;s example is now more compact:</p>

<p><img src="/images/dec-adv-2024/hbx-example-2.png" alt="hbx example" /></p>

<p>And here&rsquo;s the breakdown:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Not bad! Now I think I&rsquo;ll try to implement a symbol table next.</p>

<a class='heading-anchor' id='heading__Day__19'></a><h3>Day #19 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>And the symbol table is in! Now I think this can be documented as the first version of the hex bytecode. Essentially, I now introduced a way to map user-defined symbols to indexes in a &ldquo;table&rdquo; that gets saved right after the header and before the actual program.</p>

<p>The size of the table is encoded in the header itself, in two (little endian) bytes (allowing for a maximum of 65535 user-defined symbols, which is more than enough for anyone). Therefore, the length of the hbx (<strong>h</strong>ex <strong>b</strong>ytecode <strong>e</strong>xecutable) file needs to be eight bytes instead of six, which is nice, in a way:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Then, the values of the symbols are stored as sequences of one byte for the size, and then the specified number of bytes for the identifiers. Simple enough!</p>

<p>The lookup operation was using the following sequence before:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Now, it becomes the following:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Basically, all symbol lookups are going to <em>always</em> take up three bytes now, which would shave some bytes if you use (and reuse) many user-defined symbols.</p>

<p>Therefore, taking the simple program we&rsquo;ve been using for the last three days:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>&hellip;this compiles to the following:</p>

<p><img src="/images/dec-adv-2024/hbx-example-3.png" alt="hbx example" /></p>

<p>And here&rsquo;s the breakdown:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>The funny thing is that now the resulting bytecode is actually <em>two bytes longer</em>, but that&rsquo;s because I am only using one symbol twice, and it&rsquo;s only made up of two letters. <em>Normally</em>, there would be savings as far as bytecode size goes!</p>

<p>That was satisfying. I was so happy about all this byte-wrangling that I also implemented a seamless way to support reading and writing binary files using the existing <code>read</code>, <code>write</code>, and <code>append</code> symbols. Oh, and I extended the <code>!</code> symbol to also evaluate an array of integers representing hex bytecode!</p>

<a class='heading-anchor' id='heading__Day__20'></a><h3>Day #20 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Today is chore day! I decided to go over <em>all</em> the error messages and debug messages and reformatted them making sure that are all consistent, and provide adequate context. I also squashed a few nasty bugs:</p>

<ul>
<li>Incorrect bytecode generation for negative integers&hellip; Values like 0xffffffff (-1) were incorrectly stored in 1 byte (0xff).</li>
<li>Incorrect stack trace generation &mdash; now all symbols pushed on the stack get pushed on the stack trace as well.</li>
<li>Incorrect handling of comments inside quotations (they were incorrectly counted as quotation elements).</li>
<li>Warn the user that .hex source files must only contain ASCII characters to be converted to bytecode (not gonna bother handling encodings right now).</li>
</ul>


<p>I also added information about the Hex Bytecode eXecutable format (HBX) to the <a href="https://hex.2c.fyi/spec/#hbx">specification</a>.</p>

<p>At this point I thought it was actually a good time to <a href="https://hex.2c.fyi/changelog/#v0.1.0">release v0.2.0</a>!</p>

<a class='heading-anchor' id='heading__Day__21'></a><h3>Day #21 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Finally I got around to writing a <a href="/articles/hex">proper article</a> about hex. How it came about, why I bothered&hellip; things like that!</p>

<p>Next I will start thinking about&hellip; a standard library for hex, and also maybe improve the playground to support entering longer programs.</p>

<a class='heading-anchor' id='heading__Day__22'></a><h3>Day #22 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I improved the <a href="https://hex.2c.fyi/play">playground</a> a little bit. I added a button to &ldquo;upload a file&rdquo; by copying and pasting it into a textarea and evaluating it. I ended up increasing the STDIN buffer to 16kb and implement a way to strip hashbang, comments, and newlines before sending it through the REPL&hellip; kinda hacky, but it seems to work.</p>

<p>I have also been thinking about creating a new <code>::</code> symbol to create operators (to avoid using <code>.</code> on all user symbols all the time) and also some possible modules for a hypothetical standard library.</p>

<a class='heading-anchor' id='heading__Day__23'></a><h3>Day #23 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I started working on a <a href="https://github.com/h3rald/hex/tree/next">next</a> branch because I am introducing some breaking changes. Because I am determined to keep the number of symbols fixed to 64, every time I add something new, I have to remove something else. The choice typically falls upon those symbols that can be implemented in hex more easily using other symbols, so right now, in the next release I am going to remove the following:</p>

<ul>
<li>filter</li>
<li>clear</li>
<li>each</li>
</ul>


<p>And add the following:</p>

<ul>
<li><code>::</code> &mdash; Define a new <em>operator</em>, i.e. a symbol meant to modify the stack. This will be defined as an ordinary quotation, but that will be immediately dequoted when pushed on the stack, achieving an effect similar to native symbols.</li>
<li><code>symbols</code> &mdash; returns a quotation containing strings corresponding to all known symbols. Useful for introspection, memory management, etc.</li>
<li><code>throw</code> &mdash; Throw an error.</li>
</ul>


<p>All of these symbols require some internal wizardry that cannot be implemented in hex itself, so, they should be native symbols.</p>

<p>At the same time, I also started working on a (currently untested) <a href="https://github.com/h3rald/hex/blob/next/lib/utils.hex">utils.hex</a> defining a few utility symbols. The idea is to create a little <em>standard library</em> in hex itself.</p>

<a class='heading-anchor' id='heading__Day__24'></a><h3>Day #24 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Getting ready for the v0.3.0 release! I updated the <a href="https://hex.2c.fyi/spec">spec</a> to mention the new symbols and remove the old ones, I changed the example used for documenting the bytecode (a symbol to calculate the <em>factorial</em> of an integer), and also used the same one for the <a href="https://hex.2c.fyi/learn">tutorial</a>. The main driver for this change was to introduce the concept of operators and also to use an example that can be run on the <a href="https://hex.2c.fyi/play">playground</a>, so that you can follow the tutorial without downloading anything.</p>

<p>All the tests are running fine and I also updated the web script to leverage operators (and use while instead of each). The idea is to have a Christmas release tomorrow, obviously.</p>

<a class='heading-anchor' id='heading__Day__25'></a><h3>Day #25 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p><a href="https://hex.2c.fyi/changelog/#v0.3.0">hex v0.3.0 is out</a>, Merry Christmas!</p>

<a class='heading-anchor' id='heading__Day__26__rarr___31'></a><h3>Day #26 &rarr; #31 <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I had to stop my #DecemberAdventure rather abruptly as I got the flu, but I have continued working on hex on and off. Currently looking into:</p>

<ul>
<li>Refactoring to move storage to heap memory as much as possible</li>
<li>Implementing a more efficient memory management strategy</li>
<li>Reimplementing the registry as a hash table</li>
<li>Ensure items are deep copied as needed</li>
</ul>


<p>Overall, this has been a really positive experience! I really enjoyed working on hex a little bit every day, and build an ecosystem around it.</p>]]></description>
        </item>
        <item>
            <title>Home-cooked apps, the right way</title>
            <link>https://h3rald.com/articles/home-cooked-apps-the-right-way</link>
            <guid isPermaLink="true">https://h3rald.com/articles/home-cooked-apps-the-right-way</guid>
            <pubDate>Wed, 12 Jun 2024 02:29:07 +02:00</pubDate>
            <description><![CDATA[<ul id='toc' class='panel'><li><a href='#heading__Apps_as_home-cooked_meals__AI__and_barriers'>Apps as home-cooked meals, AI, and barriers</a></li>
<li><a href='#heading__On_not_being_smart__and_knowing_your_limits'>On not being smart, and knowing your limits</a></li>
<li><a href='#heading__The_right_way_to_prepare_a_home-cooked_meal'>The right way to prepare a home-cooked meal</a></li></ul>
<p><em>&ldquo;Two espressos?&rdquo;</em></p>

<p><em>&ldquo;Sure, thanks!</em></p>

<p>That was my cousin, the barman. He always gives us a little discount or offers us coffee at least every time my wife, daughter and I go to his bar for a cocktail and an <em>aperitivo</em>.</p>

<p>Except that now I am writing this at 2am at night. Coffee almost never works the way it was intended for me, but when it does, <em>it really does</em>.</p>

<a class='heading-anchor' id='heading__Apps_as_home-cooked_meals__AI__and_barriers'></a><h3>Apps as home-cooked meals, AI, and barriers <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Anyhow, while I was trying to sleep I came across <a href="https://maggieappleton.com/home-cooked-software">this article</a> on home-cooked software and barefoot developers, which was presented at this year&rsquo;s local-first conference in Berlin. It sparkled my interest because especially the first part focused on local-first software (which I agree on) and <a href="https://www.robinsloan.com/notes/home-cooked-app/">apps as home-cooked meals</a> (which I firmly believe in).</p>

<p>But then it went off advocating leveraging LLMs as a way to empower more people (<em>barefoot developers</em>) to create their home-cooked apps, which made me cringe a little bit.</p>

<p>But I don&rsquo;t want to talk about AI in this article, I want to focus on another passage from that article which talked about the <em>command-line wall</em> as the barrier that people who possess just-enough coding skills hit:</p>

<blockquote><p>[&hellip;] But they never make it over what I call the command line wall.</p>

<p>They never end up in the terminal, because that is a huge jump in complexity, usability, and frustration from using something like Airtable or Notion.</p></blockquote>

<p>I should write another post about this category of people&hellip; some of which (my boss included) I really admire, but that&rsquo;s also not the point I want to make now.</p>

<p>The point is the <em>command line wall</em>. I immediately smiled when I read that. <em>&ldquo;Hah! I am so much smarter, I love the command line and use it every day!&rdquo;</em></p>

<a class='heading-anchor' id='heading__On_not_being_smart__and_knowing_your_limits'></a><h3>On not being smart, and knowing your limits <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>But am I, really?</p>

<p>Everyone has barriers. Some people can&rsquo;t use  a computer, others can&rsquo;t use excel, indeed for some people the command line can be scary&hellip; but what are <em>my</em> barriers?</p>

<p>Let&rsquo;s see.</p>

<ul>
<li>I can code, and I still do, more or less daily and at least weekly, even though these days I am (supposed to be) a Technical Product Manager</li>
<li>I know a few programming languages like Nim and JavaScript</li>
<li>I have built quite a few tools that are listed in the <a href="/projects/">projects</a> section of this site</li>
<li>I maintain my own site on a VPS</li>
<li>I implemented quite a few web apps that my family and I use every day, even if the rest of the world doesn&rsquo;t know about them</li>
</ul>


<p>Well, that felt good didn&rsquo;t it? It did.</p>

<p>So no barriers? Not quite. Here&rsquo;s some things don&rsquo;t know or I cannot do:</p>

<ul>
<li>I can&rsquo;t code in C or low-level programming languages. I did study it at uni but never really used in the real world, and forgot most of it.</li>
<li>I am not able to do any manual memory management</li>
<li>I never learnt assembly</li>
<li>I can&rsquo;t do do any desktop UI programming</li>
<li>I was unable to learn <a href="https://100r.co/site/uxn.html">uxn</a> even if I really, really wanted to</li>
</ul>


<p>And you know what hurts? That because of various extremely important reasons like lack of time due to family and work, I will probably never be able to achieve any of the above. Well, I shouldn&rsquo;t say never, but at least not in the short or medium term.</p>

<p>And so where does that leave me? Even though I don&rsquo;t think, like the author of that article, that LLMs can come to the rescue, I would like a magic way to overcome my barriers. I can somewhat relate to the way the author feels.</p>

<p>I think everyone has barriers. And I guess the secret of happiness, or rather, of feeling happy about ourselves is to find the right compromise to overcome them.</p>

<p>This also somewhat feels selfish doesn&rsquo;t it? <em>&ldquo;Heh! He should shut up, he can code! Or even, he doesn&rsquo;t even need to code for a living&rdquo;</em> some people may say.</p>

<p>Still, the pain of not being able to do something is very real, at very different levels, for all of us probably.</p>

<h3>The <em>selfdogfooding</em> disease</h3>

<p>But there&rsquo;s more! A normal person would just pick a tool or programming language and move on. Like I know if I really wanted to learn Uxn I probably could, and I could built some interesting things with it.</p>

<p>That&rsquo;s not enough though, is it? That would be too easy. I suffer from a rare disease I call <em>extreme self-dogfooding</em>, i.e. I have to kinda&hellip; build my own ecosystem in order to be able to build my tools and apps. Like&hellip; I wanted to build my own web apps so I ended up building lower level programs to achieve that, like a <a href="/h3/">JavaScript microframework</a> for the frontend, a <a href="/litestore/">document store</a> for the backend, but also a <a href="/min/">programming language</a> in case I need more freedom, and then there&rsquo;s the ancillary tools like a <a href="/hastyscribe/">tech-doc oriented markdown compiler</a> (software needs documentation right?) which could then be used to power a <a href="/hastysite/">static-site generator</a>&hellip; and the list goes on.</p>

<p>The problem? <em>It&rsquo;s never enough</em></p>

<p>I have spent a lot of precious free <em>thinking</em> time to try to come up with a new programming language or virtual machine to go even more low level. Like&hellip; I did implemented my own programming language, but I did so in <a href="https://nim-lang.org">Nim</a>, which is kinda high-level and also ended up pulling in a lot of third-party libraries that made it quite big and probably very similar to plenty of other languages&hellip;</p>

<p>That&rsquo;s when I hit the barriers. I would like to be smart enough to, say, implement my own system like Uxn using as little code as possible and build an ecosystem on top of it. Why? Probably just to feel accomplished,  because objectively I have no practical reason to do so.</p>

<p>Until&hellip; until there&rsquo;s an itch to scratch. Like implementing a todo list app that works just the way I want maybe, but is that a real need or just an excuse to accomplish something or be creative?</p>

<a class='heading-anchor' id='heading__The_right_way_to_prepare_a_home-cooked_meal'></a><h3>The right way to prepare a home-cooked meal <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I feel we live in a world where if you think of a new piece of software, it probably already exists. Most of the time I end up figuring that out <em>before</em> I start a new project. Especially now that I can&rsquo;t afford and shouldn&rsquo;t really start new open source projects I know I cannot maintain.</p>

<p>Peer-pressure? Inferiority complex? Or just a need to be creative? Probably a bit of everything.</p>

<p>Is this constant need to overcome barriers healthy? Maybe not, but it is a very powerful force to unleash creativity, if properly (and carefully) channeled.</p>

<p>The point? I guess <strong>there is no &ldquo;right way&rdquo; to build your app-as-home-cooked-meal</strong>. You can use a high-level programming language, you can use a low-code tool, and (sigh) you can probably use LLMs <em>if that works for you, and if you can achieve your goal</em>.</p>

<p>Extra points if your goal is practical and useful to someone, like creating a budgeting app your spouse can use, or a video game your daughter can play someway, when she gets older.</p>]]></description>
        </item>
        <item>
            <title>This web site is 20 years old</title>
            <link>https://h3rald.com/articles/twenty-years</link>
            <guid isPermaLink="true">https://h3rald.com/articles/twenty-years</guid>
            <pubDate>Thu, 28 Mar 2024 08:00:00 +01:00</pubDate>
            <description><![CDATA[<ul id='toc' class='panel'><li><a href='#heading__The_early_years'>The early years</a></li>
<li><a href='#heading__A_look_back_at_early_2000s_technologies_and_services'>A look back at early 2000s technologies and services</a></li>
<li><a href='#heading__Browser_War_II'>Browser War II</a></li>
<li><a href='#heading__CakePHP'>CakePHP</a></li>
<li><a href='#heading__Ruby'>Ruby</a></li>
<li><a href='#heading__The_Personal_Stuff'>The Personal Stuff</a></li>
<li><a href='#heading__The_end_of_blogging_and_the_Nim_era'>The end of blogging and the Nim era</a></li>
<li><a href='#heading__Going_forward'>Going forward</a></li></ul>
<p>Exactly twenty years ago today, on March 28th, 2004, I decided to purchase my first Internet domain.</p>

<p>The .com bubble had already burst years earlier, and I remember wondering which domain name I should go for. After a few minutes I decided for <em>h3rald.com</em>, the Internet handle I was using on a few web sites.</p>

<p>The origin of the name H3RALD is nothing too glamorous really: when I moved my first steps on the Internet a few years earlier (my parents were kind of against computers and we had our first one in 1998, when I was in high school) I came across the <em>Hacker Manifesto</em>, which was signed <em>The Hobbit</em>. I remember dreaming about writing something as impactful as that someday, and signing it with an equally cool pseudonym. At the time, I used to purchase the <a href="https://en.m.wikipedia.org/wiki/International_Herald_Tribune">International Herald Tribune</a> every so often from the local newsagent, mainly because it was one of the few foreign newspapers I could get here in Italy at the time, to practice my English.</p>

<p>Obviously, a handle like <em>herald</em> was taken on most web sites, so I decided to add a sparkle of <em>1337 speak</em> to it, hence <em>h3rald</em>.</p>

<a class='heading-anchor' id='heading__The_early_years'></a><h3>The early years <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>One thing is buying a domain, another thing is actually using it for something useful.</p>

<p>For the first year or so, the purpose of <em>h3rald.com</em> remained uncertain: I started off with a very simple HTML page with some interactive content mainly in the form of Java applets (news tickers and other pointless things like that) with a sprinkle of JavaScript. I barely knew how to program back then, and even though I was studying IT Engineering at the university here in Genoa, that <a href="/articles/academic">doesn&rsquo;t mean it was actually useful</a>, for anything practical.</p>

<p>The first <a href="/h3rald/">few versions</a> of this web site were rather poor attempts at finding my niche. At one point I got so bold that I even tried to establish a web design studio (<em>H3RALD Labs</em>) with a very, <em>very</em> basic web site. I taught myself PHP, I started using early frameworks like <a href="https://www.pradoframework.net/">Prado</a>, and most importantly I kept learning new things.</p>

<p>I was doing all this on a 350MHz Pentium II machine that struggled to run Windows XP. When my parents first bought the thing back in &lsquo;98 it felt much, much faster&hellip; I couldn&rsquo;t believe that after only a few years it was becoming obsolete! But that didn&rsquo;t stop me from discovering Linux (distributions like Mandrake, Slackware and Debian) and configuring it in dual boot (my dad was also using the computer, and I couldn&rsquo;t really mess things up too much).</p>

<p>Now picture this, in 2004, at least in Italy:
- There was no Facebook
- MySpace was a thing, but geared at a younger audience
- There were no iPhones, no apps
- Mobile browsing meant largely accessing a bunch of crappy <a href="https://en.m.wikipedia.org/wiki/Wireless_Application_Protocol">WAP</a> sites
- Dial-up was still the most common way to connect to the Internet
- There was no StackOverflow. If you had questions about programming, you had to spend hours looking in specialized forums and communities</p>

<p>At the time, I was part of an online community called CyberArmy. The domain shifted a couple of times from <a href="https://www.cyberarmy.com">cyberarmy.com</a> (still up, but basically dead) to cyberarmy.net (long story&hellip;) and vice-versa, and no, it was nothing related to cyber terrorism, it was&hellip; well, just a bunch of people organized in groups (<em>brigades</em>) that aimed at learning more about the Internet and technology; a community of <em>hackers</em> in the original meaning of the word.</p>

<p>In the beginning, people in CyberArmy earned their rank by completing hacking challenges, and then the focus of the site shifted to contributing to brigades instead. At one time, I became the C/O of the group that was curating the community online magazine, zZine.org (domain is dead now). zZine was the first outlet for my articles, some of which I have re-published here.</p>

<p>Back then, I started writing about the things I was learning about, like <a href="/articles/server-packages">easy-to-install server packages</a>, or cutting-edge technologies like <a href="/articles/next-generation-dvds">BluRay vs HD-DVD</a>. Lightweight markup languages like markdown didn&rsquo;t exist at the time, so all I wrote all those early articles using <a href="https://en.m.wikipedia.org/wiki/BBCode">BBCode</a>, before <a href="/articles/18">switching to textile</a>.</p>

<a class='heading-anchor' id='heading__A_look_back_at_early_2000s_technologies_and_services'></a><h3>A look back at early 2000s technologies and services <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>It is funny to look back and read those early 2000s articles now. Do you remember when <a href="/articles/social-bookmarking-services">social bookmarking services</a> were a thing? Del.icio.us? Maybe. What about Spurl, Furl, Blinklist&hellip; ring a bell? No? It turns out I was very fond of <a href="/articles/magnolia">ma.gnolia</a> when it came out.</p>

<p>I reviewed a few <a href="https://en.m.wikipedia.org/wiki/Web_2.0">Web 2.0</a>-era services like <a href="/articles/39">NetVibes</a> and <a href="/articles/journotwit-review">JournoTwit</a>, tools like <a href="/articles/komodo-edit-review">Komodo Edit</a>, web frameworks like <a href="/articles/34/">Akelos</a> or <a href="/articles/getting-started-with-lithium">Lithium</a>. Even really cool things like <a href="/articles/wunderlist">Wunderlist</a> got acquired and eventually killed off.</p>

<p>But luckily some things were built to last:</p>

<ul>
<li><a href="/articles/what-is-ajax">AJAX</a> may not be called that anymore (and we may have most definitely dropped the XML part), but it laid the foundation of modern JavaScript.</li>
<li><a href="/articles/to-rest-or-not-to-rest">REST</a> is alive and well.</li>
<li><a href="/articles/git-for-the-locals">Git</a> is now the de-facto version control system.</li>
<li><a href="/articles/quick-overview-of-sqlite">SQLite</a> is very widely-used and respected.</li>
</ul>


<a class='heading-anchor' id='heading__Browser_War_II'></a><h3>Browser War II <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>This topic deserves its own section. Nowadays, even though some would say that the wars are now over and Google Chrome won, the reality is that for good and for bad Google&rsquo;s creation and all its Blink brothers have the lion share of the market. Sure, Firefox is alive and (mostly) well, but things are much easier for web developers and more pleasant for users now than they were in the early 2000s.</p>

<p>Trust me, I was there. I lived and fought what history now calls <a href="https://en.m.wikipedia.org/wiki/Browser_wars">the second browser war</a> and quite a few pages on this web site are a testament to those hard but glorious times when developing a web site meant trying it out in <em>at least</em> three or four different browsers (each with its own engine) to make sure it looked right.</p>

<p>Being a Windows XP user at the time, I took advantage of the beta period in which Microsoft let users test Internet Explorer 7. Yes, I did write a <a href="/articles/pre-review-of-ie7">pre-review of IE7</a> in 2005. That thing introduced support for cutting edge features like tabs, transparent PNGs, and even <em>partial</em> CSS2 support!</p>

<p>Crazy stuff. IE was very prevalent back then also because, as a web developer, you could not afford to ignore it: if your site had to support IE (and a lot of sites sadly only supported IE), you kinda had to use it as well. Nonetheless, I remember spending a considerable amount of time looking for <a href="articles/perfect-browser">the perfect browser</a>.</p>

<p>Firefox was Heaven though. I mean really, it was, compared to the competition. But most people didn&rsquo;t understand, so I ended up putting myself in their shoes and wrote <a href="/articles/ie-lovers-guide-to-firefox">an IE lover&rsquo;s guide to Firefox</a> to educate the masses (including my family) that there was a better, faster, and more pleasant way to browse the web.</p>

<p>I even reviewed preliminary versions like the one that was codenamed <a href="/articles/from-firefox-to-deer-park">Deer Park</a>, i.e. version 1.1 of the popular Mozilla browser.</p>

<p>Fast-forward three years later, and I found myself deeply involved in the Firefox 3 release. SitePoint published a very in-depth article of mine that was also realesed as a 30-page PDF ebook: <a href="/articles/firefox3-revealed">Firefox 3 revealed</a> (you can now download <a href="/files/ff3-revealed.pdf">right here</a> if you want).</p>

<p>To this day, although largely insignificant in the grand scheme of things, I consider that mini book a personal jewel of mine, and the closest thing I ever had to get a book published (more on that later).</p>

<p>After the Firefox years, my attention slowly shifted to <a href="/articles/thoughts-on-firefox3-and-opera95">Opera</a> (the real thing with its own browser engine, <em>Presto</em>, not the Chromium-based bad copy we have today) and I finally published <a href="/articles/firefox-lovers-guide-to-opera">a Firefox lover guide to Opera</a> to get more people to switch.</p>

<p>But in the end Google did it. When the big G released Google Chrome in September 2008, it really <em>felt</em> like things were over. Like with all the greatest products of our time (when Steve Jobs released the first iPhone I had the exact same feeling), a company took an old idea (a browser with tabs) and an &ldquo;old&rdquo; engine (WebKit) and turned into something new and much better than the competition. A multi-process browser, something never done before.</p>

<p>I <a href="articles/google-chrome">reported the birth of Chrome</a> from my humble web site that day, still not quite sure if that was going to be just a phase, just another meteor of a product that was doomed to be forgotten. It was not.</p>

<a class='heading-anchor' id='heading__CakePHP'></a><h3>CakePHP <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>But let&rsquo;s go back to 2006 a second &mdash; we may as well: most of my articles are from before 2010 anyway.</p>

<p>In those years I had just taught myself PHP but Ruby on Rails was all the rage: imagine a web framework that let you create a blog in 15 minutes, with powerful command line tools, scaffolding, and a truly awesome (and elegant) programming language to go with it!</p>

<p>Too bad I had spent months learning PHP. But it turns out there was at least one PHP framework that wanted to be <em>on Rails</em>, and that was CakePHP. So I learnt more and more about it, played with it in a few personal projects, and even re-did my web site using it.</p>

<p>In the blink of an eye, I became one of the most well-known CakePHP <em>bakers</em> of the time. I started blogging about it, I wrote an extensive <a href="/articles/cakephp">review</a>, I was contacted by a few PHP magazines to write articles about it, and of course I wrote one for <a href="/articles/cakephp-first-bite">SitePoint</a>, too.</p>

<p>I was then approached by not one but two different publishers to write a book! Eventually, I <a href="/articles/40">signed a book deal with Peachpit/New Riders/Pearson</a> for what would have become the first, official book about CakePHP. <em>Official</em> because it was supposed to be co-authored with Larry E. Masters and Garret J. Woodworth, the creators of the framework, who were supposed to provide all the code snippets to go in the book.</p>

<p>The book is still <em>currently not available</em> right now on <a href="https://www.amazon.it/Cakephp-Recipes-Fabio-Cevasco/dp/0321497732">Amazon Italy</a>, <a href="https://www.amazon.in/CakePHP-Recipes-Fabio-Cevasco/dp/0321497732">Amazon India</a>, and <a href="https://www.amazon.co.jp/CakePHP-Recipes-Fabio-Cevasco/dp/0321497732">Amazon Japan</a> but no point in waiting because (after 18 years) it will never be released. It has a cover, an ISBN number and all&hellip; but it never happened.</p>

<p>To this day, people who happen to google my name eventually end up on one of those pages and then ask me about that book that I never wrote. What happened? Well, the CakePHP Foundation never hold up their part of the deal and never provided the code examples for the book. To this day, I would really like to go back in time and slap my cocky 23-year-old self real hard and scream <em>write those damn code examples yourself and get it done, you idiot!</em></p>

<p>Talk about regrets. Having your name associated with a failed book is probably the worst thing that can happen to a wannabe published author. What&rsquo;s worse, is that when the book was <a href="/articles/42">canceled</a>, a lot of drama followed (I wrote not <a href="/articles/43">one</a>, but <a href="/articles/too-many-cooks-take-2">two</a> and then even <a href="/articles/too-many-cooks-take-3">three</a> posts about it).</p>

<p>If I try to rationalize what went down now, nearly twenty years later, I&rsquo;d say that both parties had other crap going on: I had just started my first permanent job at an important company, and Larry and Garret just had a brand new web framework to nurture, and one that was getting really popular really quickly.</p>

<p>One of the few good things that came out from that period was a <a href="/articles/rails-inspired-php-frameworks">popular article</a> on my web site that got <a href="/articles/25">featured on the Digg homepage</a>. What is Digg, you ask? Well, let&rsquo;s see&hellip; Digg was something similar to Hacker News today, but worse. Ah, the fun times&hellip;</p>

<p>Anyhow, that failed book really left a scar: I was truly pissed. So pissed that I decided it was time to move on and learn that cool programming language everyone was raving about&hellip;</p>

<a class='heading-anchor' id='heading__Ruby'></a><h3>Ruby <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Now talk about a healthier ecosystem with less drama! Kidding&hellip; but yes, I did enjoy my time with the Ruby community. I also felt I was learning a <em>proper</em> programming language, not something that was frowned upon like PHP.</p>

<p>With Ruby, I moved my very first steps in the world of open source software, by releasing a few (probably very mediocre) software projects into the wild. You can still find them in the <a href="/projects">projects</a> sections, by the way: I am talking about RedBook, Rawline, and Concatenative.</p>

<p>The Ruby ecosystem was full of living legends at the time. Names like the godlike DHH, creator of Rails, Zed Shaw the rockstar developer, Obie Fernandez, and of course _why the lucky stiff. Ruby made me discover the true joy of programming, of feeling like you are creating something useful that behaves exactly like you want it.</p>

<p>I miss those days, I think younger generations are not as lucky. There&rsquo;s too much pressure today, kids want to learn programming just to land a cool and hopefully high-paid job&hellip; back then it was all about the fun of creating and learning new things&hellip; or maybe I was just younger.</p>

<p>While I was developing little Ruby programs, I was also reading a lot of Ruby programming books. I reviewed a lot of them (most of them by Pearson Education, which at the time was the leading publisher for programming books on Ruby), such as:</p>

<ul>
<li><a href="/articles/hlrb-review">The Humble Little Ruby Book</a></li>
<li><a href="/articles/the-rails-way-review">The Rails Way</a></li>
<li><a href="/articles/the-rails3-way-review">The Rails 3 Way</a></li>
</ul>


<p>And also a few books on software development and agile practices.</p>

<a class='heading-anchor' id='heading__The_Personal_Stuff'></a><h3>The Personal Stuff <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>That&rsquo;s all very well but&hellip; I introduced H3RALD.com as my personal web site. And it is, although I have never really posted a lot of really <em>personal</em> stuff: I blogged about my life, but I tried to stick to themes like technology and programming. However, there were a few occasions that called for really personal blog posts.</p>

<p>Probably one of the most emotional articles I have ever written is the one about my <a href="/articles/20">grandfather</a>. I wrote it on the day after he passed away, in 2006, and I remember trying to put together my thoughts and try to remember all the stories that he told me about his life. Blogging wasn&rsquo;t really a thing in the 1940s and 1950s, and he was never much into writing anyway, but he was an amazing storyteller. When I was a little boy, every time we started talking, he always ended up telling me about the war (he was a WWII pilot), about his plane&hellip; no matter what the topic was, it was <em>always</em> related to some anecdote about that period in his life.
They say that old people live in the past, and it may be true, but the important thing is that when some old relative tells you a story, no matter how boring it sounds at the time, you should always listen to them. You should record them, if you can, in fact!</p>

<p>I tried to capture a few of the stories he used to tell me in that article&hellip; but there were so many more! I wish I could remember them all. If I could go back in time, I would like to tell my 20-something year old self to start a blog together with my grandfather. It would have been an amazing experience.</p>

<p>On a lighter note, another personal article that is not related to computing that I stumbled upon was my <a href="/articles/incomplete-guide-to-london">incomplete guide to London</a>. Kinda funny reading it now, but I am glad I wrote it.</p>

<p>And of course I did write about <a href="/articles/11-07-2009">the most wonderful day of my life</a>, when I got married to my wife in 2009, and about our unforgettable Irish wedding.</p>

<a class='heading-anchor' id='heading__The_end_of_blogging_and_the_Nim_era'></a><h3>The end of blogging and the Nim era <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Among the most popular articles I wrote, I must definitely mention my roundup of <a href="/articles/10-programming-languages">ten emerging programming languages</a> from 2008, and the <a href="/articles/10-more-programming-languages">follow-up article</a> I decided to write exactly ten years later, in 2018. And yes, I should probably write another one in four years time, although these days I am only learning new programming languages for fun, not to make a career out of it.</p>

<p>Another really interesting episode of my life I am extremely glad I recorded on my blog is about my <a href="/articles/randal-schwartz">pizza with Randal Schwartz</a>. At the time I was an avid <a href="https://twit.tv/shows/floss-weekly">FLOSS Weekly</a> listener and Randal was hosting that podcast. Podcasts are weird&hellip; I remember listening to FLOSS Weekly and <a href="https://twit.tv/shows/this-week-in-tech">This week in Tech</a> every week when driving down to my in-laws, and after a while I felt like I knew these people really well, I knew what they were up to, and meeting Randal in person when he came to Genoa because of one of his Geek Cruises felt weird but not, at the same time. He probably forgot about that evening, but for me it was like meeting a celebrity, and I was over the moon.</p>

<p>Then&hellip; well, there&rsquo;s no other way to say it, I progressively stopped blogging and writing articles. I tried to rationalize it and even <a href="/articles/10-reasons-why-i-didnt-update-my-blog">wrote about it</a>, but the reasons boil down to realizing that:</p>

<ul>
<li>probably nobody really gives a crap about my blog</li>
<li>I was having a hard time finding something to write about that was not already on someone else&rsquo;s blog</li>
<li>there are entire companies that make money out of writing blogs, you can&rsquo;t compete with them</li>
<li>I didn&rsquo;t have time</li>
</ul>


<p>You may find counter-arguments for each of the above, but the fact remains that I haven&rsquo;t really spent much time writing in the last ten years.</p>

<p>I also remember realizing at the time that maybe I needed to create some cool pieces of software <em>so that I could write about it on my site</em>. And I did. I got progressively into command line applications and utilities (while progressively shifting to frontend development at work, that&rsquo;s kinda funny), and I moved away from Ruby for mainly two reasons:</p>

<ul>
<li>You needed Ruby to run it, so your programs were only going to be used by people who had it installed on their machine</li>
<li>It was slow for certain things</li>
</ul>


<p>I obviously spent some time looking into different programming languages, and finally settled with <a href="https://nim-lang.org">Nim</a>, or Nimrod, as it was called originally.</p>

<p>One of the first things I did was creating a <a href="/articles/hastyscribe">documentation tool</a> that I could use to write the technical docs for my software. Then I decided that I needed a sort of <a href="/articles/litestore">document store</a> with full text search because I wanted to implement a search functionality for H3RALD.com (afterwards, I decided not to bother).</p>

<p>What I really wanted to create though, was a new programming language, and that&rsquo;s how <a href="/min">min</a> came to life. Then, I figured I had all the building blocks to create a new <a href="/articles/hastysite">static site generator</a> that currently still powers this site&hellip;</p>

<p>See a pattern there? I was scratching my own itches. And that&rsquo;s how great software gets made. That&rsquo;s just a statement by the way, I am not implying that <em>I</em> am writing great software in an absolute sense, only that I am writing great (and useful!) software <em>for me</em>, and my specific use cases.</p>

<p>I also wrote a <a href="/articles/h3">JavaScript micro framework</a> which probably no one uses besides me, but it made it really simple to create the (closed source for now) personal wiki engine that powers <a href="https://nifty.tools">nifty.tools</a> (the backend is written in min) and <a href="https://2c.fyi">2c.fyi</a> (the backend is powered by LiteStore).</p>

<p>Talk about <em>selfdogfooding</em>, huh?</p>

<a class='heading-anchor' id='heading__Going_forward'></a><h3>Going forward <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>To the two or three people that made it this far (or that skipped right to this section), here are some key takeaways after twenty years of running a personal web site.</p>

<p><strong>When in doubt, just write</strong>. Don&rsquo;t over-think it. Don&rsquo;t ask yourself if others already wrote something on the subject, don&rsquo;t ask yourself if writing about something is worthwhile. It is always worthwhile. I wrote reviews about programs and services that have been dead for years, and it was still worthwhile. I was worthwhile because it made me laugh about it ten or twenty years later, it was worthwhile because I learnt something new while writing it, or just because it brought me joy.</p>

<p><strong>A personal web site is mainly for you</strong>, not others. You have it because it makes <em>you</em> happy, because it&rsquo;s an excuse to try out new technology and learn new things, because <em>you</em> need to write 10,000 words on a digital page just rambling about random stuff, because <em>you can</em>.</p>

<p><strong>My web site is worth more than Facebook</strong>. Because <em>I own it</em>. I don&rsquo;t own Facebook, or X, or Instagram, or TikTok, or Wikipedia. I own H3RALD.com, and that&rsquo;s where <em>my</em> content goes.
Since I moved my first steps on the Internet, I have never understood why the majority of people deliberately choose to donate their content to walled gardens, it just doesn&rsquo;t make sense in my mind, and that&rsquo;s why I have never really been into social networks. Sure, I may snoop (or ask my wife to) on friends and relatives through Facebook, put a like on LinkedIn when our head of product management posts something about our product, but if I have something to say, from <em>me</em>, it goes on my web site.</p>

<p><strong>There is still hope for the World Wide Web</strong>. While the Internet may be lost to apps, video streaming services, and corporations that want your content for free to make them rich, the WWW as sir Tim intended is alive and well. It&rsquo;s called <a href="https://benhoyt.com/writings/the-small-web-is-beautiful/%5D">smol web</a> now, and it&rsquo;s where people who care about artisan computing and apps as a <a href="https://www.robinsloan.com/notes/home-cooked-app/">home cooked meal</a> live, it&rsquo;s a few little towns in the Fediverse like <a href="https://merveilles.town/">Merveilles</a> where some <a href="https://wiki.xxiivv.com/site/home.html">truly smart</a> and <a href="https://kokorobot.ca/site/home.html">really creative</a> folks hang out.</p>

<p>Woah, this was long. But I needed it&hellip;</p>

<p>Here&rsquo;s to another twenty years of pointless, but liberating writing and programming. Happy birthday H3RALD.com!</p>]]></description>
        </item>
        <item>
            <title>Introducing the H3 microframework</title>
            <link>https://h3rald.com/articles/h3</link>
            <guid isPermaLink="true">https://h3rald.com/articles/h3</guid>
            <pubDate>Wed, 22 Apr 2020 12:11:44 +02:00</pubDate>
            <description><![CDATA[<p>A few months ago, I started looking for a new job within JavaScript ecosystem, and I started interviewing with many different companies. Most of them were conducting remote interviews and they often asked me to complete many different kinds of programming assignments.</p>

<p>One of such assignment consisted in developing (surprise, surprise) a simple Todo List single-page application <em>but</em> without using any third-party library. Besides providing basic functionalities like adding/removing/completing todo items etc., you would get bonus points for things like support for data pagination, simple data persistence, and support for filtering todo items.</p>

<p>I found this quite a refreshing challenge, but I soon realized how tedious it was to operate on the DOM &ldquo;in the old way&rdquo; and how messy things could get really quickly.</p>

<p>I really, really wanted to use even something minimal like <a href="https://mithril.js.org">Mithril</a> to carry out the assignment! And started wondering how hard it would be to implement a quick-and-dirty Virtual DOM to manage changes more efficiently and also a simple <a href="https://github.com/hyperhype/hyperscript">HyperScript</a> implementation to speed-up the creation of HTML elements&hellip;</p>

<hr />


<p>After a few minutes, I found myself deep in creating a reasonably efficient (virtual) DOM diffing and rendering algorithm and soon enough I was able to use my little microframework to create my Todo List. It was very basic and had quite a few bugs in it, but it did the job alright, and I quickly completed the assignement and sent it back to the company for review.</p>

<p>The reviewer seemed very happy about it but also started to point out that things weren&rsquo;t quite right. He wanted me to improve the efficiency of the DOM diffing algorithm, he pointed out a few little bugs here and there&hellip; and told me to improve things. We kept doing back and forth with my code until he was (reasonably) satisfied with the result.</p>

<p>I then continued the interview process (one of the toughest but by far the most rewarding I&rsquo;ve ever been through) and I got offered the job. Sadly I ended up not taking it for a few reasons that are well beyond the scope of this article, but the point is that I was left with the code of that assignment sitting in an abandoned repository&hellip;</p>

<p>&hellip;until a few weeks ago, when I decided to do something with it.</p>

<p>I remember using <code>h3()</code> as the HyperScript construtor as a sort of pun on the fact that typically you&rsquo;d use <code>h()</code> but I wanted to be more <em>personal</em> to me so I decided to use the first two letters of the name of web site for it&hellip; Therefore, because what I lack in creativity I have in ego, I decided to create a new microframework based on it, and call it <a href="/h3">H3</a>.</p>

<p>Why oh why another microframework you ask? For the same reason why I developed a <a href="/nimhttpd">web server</a>, a <a href="/litestore">NoSQL store</a>, a <a href="/hastyscribe">Markdown processor</a>, a <a href="/hastysite">static site generator</a>, and even a <a href="/min">programming language</a>: BECAUSE I CAN.</p>

<p>I also wanted to be able to fully understand every single line of the UI framework I was using, and also be able to fully control it &mdash; something few people can honestly say about mainstream frameworks.</p>

<p>Most likely, I am gonna get a huge amount of very constructive critiques on Hacker News which I will treasure greatly, and hopefully some help on how to make my little creation actually useful to someone besides myself.</p>

<p>Well, here you have it, my very own microframework. It&rsquo;s just <strong>seven methods and two read-only properties</strong>, go try it out if you are brave enough:</p>

<div style="text-align:center;"> <strong><a href="https://h3.js.org">https://h3.js.org</a></strong></div>

<p>Oddly enough, the actual JavaScript source code (<a href="https://github.com/h3rald/h3/blob/master/docs/js/app.js">app.js</a> file) of the site above (without H3 or the two third-party libraries I used for markdown processing and syntax highlighting) is under 100 lines, and it should give you a taste of how it feels like to create a SPA with H3:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Simple enough. Note that it&rsquo;s all ES6, and no, there are no plans to provide neither a transpiled version to ES5 nor compatibility with (yuck!) IE11.</p>

<p>If you are a big corporation with customers that insists on using IE11 even though it&rsquo;s 2020 and <a href="https://support.microsoft.com/en-us/help/4501095/download-the-new-microsoft-edge-based-on-chromium">even Microsoft moved on</a> then this is not for you, I am really sorry.</p>

<p>If you decide to try H3 out, consider using it as it is meant to be used &ndash; with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules">ES6 module script tag</a> loading the entry point of your SPA:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Yes, you can do that. And no, you don&rsquo;t need WebPack either. Let your JavaScript live <em>free</em>, <em>untranspiled</em> and <em>unminified</em> even! Yes OK you can minify it if you really really want to, but I won&rsquo;t do it for you (plus you&rsquo;d probably want to do it yourself within your toolchain anyway).</p>

<p>Sure, H3 will never become the next React and will never have legions of caffeine-driven developers pouring code into it&hellip; but just creating it taught me a lot about SPAs and frameworks, and perhaps you can learn something from it too!</p>

<p>At any rate, feel free to open issues and suggest (or even make) changes to <a href="https://github.com/h3rald/h3">the source</a> if you want to.</p>]]></description>
        </item>
        <item>
            <title>10 more programming languages worth checking out</title>
            <link>https://h3rald.com/articles/10-more-programming-languages</link>
            <guid isPermaLink="true">https://h3rald.com/articles/10-more-programming-languages</guid>
            <pubDate>Fri, 21 Dec 2018 03:21:28 +01:00</pubDate>
            <description><![CDATA[<ul id='toc' class='panel'><li><a href='#heading__Crystal'>Crystal</a></li>
<li><a href='#heading__Elixir'>Elixir</a></li>
<li><a href='#heading__Elm'>Elm</a></li>
<li><a href='#heading__Go'>Go</a></li>
<li><a href='#heading__Julia'>Julia</a></li>
<li><a href='#heading__Kotlin'>Kotlin</a></li>
<li><a href='#heading__Nim'>Nim</a></li>
<li><a href='#heading__Rust'>Rust</a></li>
<li><a href='#heading__Swift'>Swift</a></li>
<li><a href='#heading__Zig'>Zig</a></li>
<li><a href='#heading__Epilogue'>Epilogue</a></li></ul>
<p>It has been exactly 10 years today since I published my <a href="/articles/10-programming-languages">10 programming languages worth checking out</a> article on this web site.</p>

<p>Over the last 10 years I thought about writing another non-mainstream programming language roundup, but I never got around to it, until I looked at the date of the original article a few months ago, and I thought about publishing its sequel exactly 10 yearns afterwards.</p>

<p>The following 10 sections are devoted to 10 different programming languages. They are not numbered and they are presented in alphabetical order, because there&rsquo;s no winner in this list. Also, the number of people actively using these languages varies quite a lot, but none of these can be considered, at the time of writing, a <em>mainstream</em> programming language like JavaScript, C, C++, Python or Ruby.</p>

<p>For each language, I included a brief overview, an example implementation of the <em>FizzBuzz</em> problem (in most cases adapted from <a href="https://rosettacode.org/wiki/FizzBuzz">RosettaCode</a>), and a collection of links to get started.</p>

<hr />


<a class='heading-anchor' id='heading__Crystal'></a><h3>Crystal <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p><em>Fast as C, slick as Ruby</em> &mdash; it pretty much sums it up. Crystal was first released in 2014, it is a Ruby-like programming that compiles to native code using <a href="https://llvm.org/">LLVM</a>, so it is faster than its popular, more-colorful ancestor.</p>

<p>If you already know Ruby and love its syntax, then you&rsquo;ll fall in love with Crystal and its metaprogramming capabilities, but you&rsquo;ll also like its dedicated syntax to integrate with native C code and the possibility to create standalone executable files just by running <code>crystal build myprogram.cr</code></p>

<p>While no 1.0 version has been released yet, the language is quite popular. It comes with a <a href="https://amberframework.org/">web framework</a>, it has been used to create <a href="https://medium.com/@alanwillms/you-should-write-your-next-game-with-crystal-f27306b63e3d">games</a>, and someone even calls it <a href="https://medium.com/@DuroSoft/why-crystal-is-the-most-promising-programming-language-of-2018-aad669d8344f">the most promising programming language of 2018</a>. It is not backed by a big companies like some of the languages on this list, but this could be a good thing, after all.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://crystal-lang.org/">Official Web Site</a></li>
<li><a href="https://forum.crystal-lang.org/">Official Forum</a></li>
<li><a href="https://en.wikipedia.org/wiki/Crystal_(programming_language)">Wikipedia Page</a></li>
<li><a href="https://github.com/veelenga/awesome-crystal">Awesome Crystal</a></li>
<li><a href="https://crystalshards.xyz/">Crystal Shards - a collection of awesome Crystal libraries</a></li>
</ul>


<a class='heading-anchor' id='heading__Elixir'></a><h3>Elixir <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Elixir came about in 2011 as an effort to bring more extensibility, metaprogramming and a more <a href="https://www.ruby-lang.org/en/">Ruby</a>-esque syntax to the <a href="https://www.erlang.org/">Erlang</a> world. If you are already in love Ruby, but you&rsquo;d like a little bit more oomph, you&rsquo;ll love Elixir: it runs on top of the Erlang virtual machine but it looks and feels like Ruby.</p>

<p>Over the years Elixir steadily grew in popularity, reached a version 1.0, and it now provides really comprehensive documentation, a friendly community and a rich ecosystem of packages. Also, if you are looking for a Rails/Django/Express equivalent, the <a href="https://phoenixframework.org/">Phoenix</a> framework has been used successfully in <a href="https://medium.com/aviabird/10-amazing-open-source-elixir-phoenix-apps-e2c52ee25053">many projects</a>.</p>

<p>Elixir is also considered a first-class citizen within the Erlang community: if you visit <a href="https://hex.pm/">hex.pm</a>, the title says <em>the package manager for the Erlang ecosystem</em> and it tells you right away how to specify dependencies with Elixir and Erlang.</p>

<p>If you always wanted to try out Erlang but never did because its syntax scared you, then Elixir can definitely help.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://elixir-lang.org/">Official Web Site</a></li>
<li><a href="https://elixirforum.com/">Official Forum</a></li>
<li><a href="https://en.wikipedia.org/wiki/Elixir_(programming_language)">Wikipedia Page</a></li>
<li><a href="https://github.com/h4cc/awesome-elixir">Awesome Elixir</a></li>
<li><a href="https://hex.pm/">The hex package manager</a></li>
</ul>


<a class='heading-anchor' id='heading__Elm'></a><h3>Elm <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Elm was the last language I picked last for this list. I wasn&rsquo;t going to include it because it&rsquo;s not as general purpose as the other languages, as it is focused solely on web development and it transpiles to JavaScript, and there are <a href="https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS">an awful lot of languages that do this</a> nowadays.</p>

<p>The reason why I picked Elm in the end is because, unlike most of the languages that transpile to JavaScript (hey, I said <em>most</em>!), Elm has its own very distinct flavor and ecosystem. Also, it is very much a <em>batteries-included</em> solution to develop web applications: there&rsquo;s no need for a JavaScript framework if you are using Elm, and if you embrace its philosophy and take full advantage of its extensive tooling, you won&rsquo;t suffer from <a href="https://medium.com/@ericclemmons/javascript-fatigue-48d4011b6fc4">JavaScript Fatigue</a> anymore.</p>

<p>Elm offers static typing, <a href="https://guide.elm-lang.org/types/">type inference</a>, <a href="https://guide.elm-lang.org/types/pattern_matching.html">pattern matching</a>, <a href="https://medium.com/@l.mugnaini/functors-applicatives-and-monads-in-pictures-784c2b5786f7">functors, applicative and monads</a>. It kinda feels a bit like Haskell, but perhaps less daunting and more to-the-point: you are going to use it to build web applications after all.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://elm-lang.org/">Official Web Site</a></li>
<li><a href="https://discourse.elm-lang.org/">Official Forum</a></li>
<li><a href="https://en.wikipedia.org/wiki/Elm_(programming_language)">Wikipedia Page</a></li>
<li><a href="https://github.com/isRuslan/awesome-elm">Awesome Elm</a></li>
<li><a href="https://package.elm-lang.org/">Elm packages</a></li>
</ul>


<a class='heading-anchor' id='heading__Go'></a><h3>Go <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>One of the most significant trends in the last 10 years is big companies creating and sponsoring their own programming languages. In 2009, Google created Go as a more modern substitute to C and C++. It provides <a href="https://en.wikipedia.org/wiki/Structural_type_system">structural typing</a>, memory safety, support for different programming paradigms, high performance and concurrency, and of course a friendlier syntax than C or C++.</p>

<p>One example of a successful application written in Go? <a href="https://www.docker.com/">Docker</a> of course. Over the years Go has been used successfully to build almost anything, from web frameworks like <a href="http://revel.github.io/">Revel</a>, data stores like <a href="https://github.com/influxdata/influxdb">InfluxDb</a> and very popular static site generators like <a href="https://gohugo.io/">Hugo</a>.</p>

<p>If you want a fairly stable and well-rounded programming language for your next project, Go is a safe and powerful choice.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://golang.org/">Official Web Site</a></li>
<li><a href="https://forum.golangbridge.org/">Official Forum</a></li>
<li><a href="https://en.wikipedia.org/wiki/Go_(programming_language)">Wikipedia Page</a></li>
<li><a href="https://awesome-go.com/">Awesome Go</a></li>
<li><a href="https://golang.github.io/dep/">dep - Dependency Management for Go</a></li>
</ul>


<a class='heading-anchor' id='heading__Julia'></a><h3>Julia <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Julia started out in 2009 and reached its 1.0 release just a few months ago. It is written mainly in C except for its parser that is written in <a href="https://github.com/JeffBezanson/femtolisp">FemtoLisp</a>, a Scheme implementation developed by Julia&rsquo;s creator, Jeff Bezanson.</p>

<p>Perhaps among the most specialized programming languages in this list, Julia excels in scientific computing, data analysis and machine learning although it can still be used for more ordinary things like web development (thanks to its <a href="http://genieframework.com/">Genie</a> framework). The first thing that comes to mind when people approach this language is why would you use it when <a href="https://www.python.org/">Python</a> and <a href="https://www.r-project.org/">R</a> already exist and are more mainstream (in the world of scientific computing). The answer seems to be predominantly performance, when compared to its direct competitors in the same space.</p>

<p>Sure, it&rsquo;s less mature and tooling probably is not quite on-par with Python, but over the years it is slowly gaining some momentum, especially after its recent 1.0 release. Also, the fact that it has FFIs to C, Fortran, Python, R and Java could probably tempt more scientists into a more step-by-step adoption.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://julialang.org/">Official Web Site</a></li>
<li><a href="https://discourse.julialang.org/">Official Forum</a></li>
<li><a href="https://en.wikipedia.org/wiki/Julia_(programming_language)">Wikipedia Page</a></li>
<li><a href="https://github.com/greister/Awesome-Julia">Awesome Julia</a></li>
<li><a href="https://pkg.julialang.org/">Pkg - Julia Package Manager</a></li>
</ul>


<a class='heading-anchor' id='heading__Kotlin'></a><h3>Kotlin <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Born in 2011, Kotlin was originally JetBrains' attempt to create a language with cool features like functional programming support, extension methods, etc. but still compile very quickly compared to other JVM languages like Scala. As a bonus, Kotlin can also be compiled to JavaScript code.</p>

<p>Quite a few high-profile Android apps <a href="https://appinventiv.com/blog/apps-migrated-from-java-to-kotlin">have been migrated to Kotlin</a> over the years, reporting various benefits ranging from being much more concise, safer and overall leading to more maintainable code than Java. Besides JetBrains, a few startups and companies are reportedly using Kotlin in production, such as Basecamp, Square, and Pinterest.</p>

<p>Although I have never been a big fan of the JVM, Kotlin is definitely one of the most innovative and trending languages running on it nowadays, and perhaps more well-known than its comparable contenders, like <a href="https://ceylon-lang.org/">Ceylon</a> and <a href="https://www.eclipse.org/xtend/">Xtend</a> &mdash; the so-called <em>second generation</em> JVM languages.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://kotlinlang.org/">Official Web Site</a></li>
<li><a href="https://discuss.kotlinlang.org/">Official Forum</a></li>
<li><a href="https://en.wikipedia.org/wiki/Kotlin_(programming_language)">Wikipedia Page</a></li>
<li><a href="https://github.com/KotlinBy/awesome-kotlin">Awesome Kotlin</a></li>
</ul>


<a class='heading-anchor' id='heading__Nim'></a><h3>Nim <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Nim is the oldest language on this list, as it was born in 2008, so exactly 10 years ago, under the name of <em>Nimrod</em>. The intent of the author, Andreas Rumpf, was to name it after a <a href="https://en.wikipedia.org/wiki/Nimrod">biblical king</a>, little did he know that in the US the word is also a synonym for <em>idiot</em> or similar, so the language was later renamed to <em>Nim</em>.</p>

<p>Anyhow, after 10 years, the Nim programming language hasn&rsquo;t reached version 1.0 yet, but according to the core team we are apparently <em>very close</em>.</p>

<p>Currently at version 0.19.0, Nim is quite stable and can be used in production as quite an efficient system programming language that compiles to C, but it looks and feels like Python. You may want to watch out for deprecations between one release and the other, but I&rsquo;ve been using it for the last&hellip; <em>10 years</em> and it has been a remarkable experience. I use Nim in my spare time in quite a few pet <a href="/projects/">projects</a>, including the <a href="https://hastysite.h3rald.com/">static site generator</a> that currently powers this web site.</p>

<p>Want to know something else really cool written in Nim? The open source <a href="https://github.com/nim-lang/nimforum">Nim forum engine</a> which is based on the <a href="https://github.com/pragmagic/karax">Karax</a> SPA framework and the <a href="https://github.com/dom96/jester">Jester</a> web server, both also written in Nim.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://nim-lang.org">Official Web Site</a></li>
<li><a href="https://forum.nim-lang.org/">Official Forum</a></li>
<li><a href="https://en.wikipedia.org/wiki/Nim_(programming_language)">Wikipedia Page</a></li>
<li><a href="https://github.com/VPashkov/awesome-nim">Awesome Nim</a></li>
<li><a href="https://nimble.directory/">Nim Package Directory</a></li>
</ul>


<a class='heading-anchor' id='heading__Rust'></a><h3>Rust <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Mozilla unveiled Rust in 2010, as an effort to create a high-performance system programming language comparable to C and C++ for performance, but easier to use and with more modern features common to high-level programming language.</p>

<p>After 8 years, portions of Firefox, Dropbox and Cloudflare are written in Rust, the <a href="https://www.piston.rs/">Piston</a> open source game engine is written in Rust, and of course Mozilla&rsquo;s <a href="https://servo.org/">Servo</a>, a new browser engine that will probably make its way into Firefox in the near future.</p>

<p>There are quite a few articles online comparing Rust to Nim and Go. These three language are somewhat in the same space, being all born as system programming languages and addressing similar concerns. If you read these articles you&rsquo;ll see an almost equal percentage of wins and losses&hellip; there are pros and cons as in everything: Nim has the smallest community, Go probably the biggest; Nim syntax is practically Python, Go&rsquo;s is pretty easy as well, while Rust seems syntactically the closes to C/C++, and also arguably the most complex. But again, your mileage may vary.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://www.rust-lang.org/">Official Web Site</a></li>
<li><a href="https://users.rust-lang.org/">Official Forum</a></li>
<li><a href="https://en.wikipedia.org/wiki/Rust_(programming_language">Wikipedia Page</a>)</li>
<li><a href="https://github.com/rust-unofficial/awesome-rust">Awesome Rust</a></li>
<li><a href="https://crates.io/">Crates - Rust Package Registry</a></li>
</ul>


<a class='heading-anchor' id='heading__Swift'></a><h3>Swift <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Swift is Apple&rsquo;s answer to the prayers of many iOS app developers complaining that Objective-C was too hard to program with. It was first released in 2014 and it became very popular especially among iOS developers&hellip; in fact I don&rsquo;t believe it&rsquo;s used for anything else really.</p>

<p>Similarly, it doesn&rsquo;t run on Windows but only on Unixes (Darwin/Linux/FreeBSD), but typically 90% of its users are going to program in Swift using XCode on their macOS machine anyway.</p>

<p>While definitely a step up from Objective-C from a syntax and high-level features point of view, unlike most of the other languages on this list its niche is pretty much mobile apps, or better, <em>iOS</em> apps. If I were to develop an iOS app today, I&rsquo;d probably pick Swift as well.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://swift.org/">Official Web Site</a></li>
<li><a href="https://forums.swift.org/">Official Forum</a></li>
<li><a href="https://en.wikipedia.org/wiki/Swift_(programming_language)">Wikipedia Page</a></li>
<li><a href="https://github.com/matteocrippa/awesome-swift">Awesome Swift</a></li>
</ul>


<a class='heading-anchor' id='heading__Zig'></a><h3>Zig <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Zig was born in 2016 and it hit its 0.3.0 release just a few months ago. The language positions itself in the already-crowded space of the next generation system programming languages, but there&rsquo;s a <a href="https://github.com/ziglang/zig/wiki/Why-Zig-When-There-is-Already-CPP,-D,-and-Rust%3F">rationale</a> for it.</p>

<p>It is essentially a much smaller, more minimalist alternative to Rust, C++, and D. Its syntax doesn&rsquo;t look as user-friendly as other languages on this list, but Zig seems to have a particular focus on being <em>safer</em> than its competitors. It provides easy interoperability with C (<em>[&hellip;] Compatible with C libraries with no wrapper necessary. Directly include C .h files and get access to the functions and symbols therein.</em>) and aims at targeting as many platforms as possible.</p>

<p>Could this be the holy grail, the true replacement of C? Only time will tell. It&rsquo;s way too soon to judge, but this new kid on the block is the last on this list, but one of the most promising.</p>

<h4>Example FizzBuzz Implementation</h4>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p><em>(updated based on <a href="https://www.reddit.com/r/programming/comments/a8cbm6/comment/ecapcf5?st=JPZF7J15&amp;sh=1ae81c06">this Reddit comment</a>)</em></p>

<h4>To get you started&hellip;</h4>

<ul>
<li><a href="https://ziglang.org/">Official Web Site</a></li>
</ul>


<a class='heading-anchor' id='heading__Epilogue'></a><h3>Epilogue <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>&hellip;And that&rsquo;s all, folks! Sorry if I missed your favorite language, I really am. But this is not really a competition, it&rsquo;s just a very opinionated article.</p>

<p>The one thing to take away from this article, along with a bunch of hopefully useful links, is that <em>none of these languages existed</em> when I wrote <a href="/articles/10-programming-languages">the original article</a> 10 years ago (except for Nim of course that already existed as <em>Nimrod</em>). This is remarkable. 10 years ago people were already going crazy on the then-just-launched Hacker News and Reddit every time a new programming language popped up.</p>

<p><em>Why bother?</em> &mdash;They said. <em>Why did you create X when Y and Z already do the same thing?</em></p>

<p>The answer is that creating a new programming language is sometimes the best strategy to solve a problem. Apple had a problem with Objective-C and created Swift, Mozilla needed something better than C++ to create their next generation browser, some people really loved Ruby but hated its inherent slowness and created Crystal and Elixir. All these extraordinary people and companies were bold enough to bet on something <em>completely new</em> and be (relatively) successful.</p>

<p>We are living a new Golden Age of programming language design, and we should be grateful for this diversity, not pissed off. Learning a new programming language may feel pointless sometimes, but it is always rewarding to some level&hellip; so pick one of these and try it out, you won&rsquo;t be disappointed!</p>]]></description>
        </item>
        <item>
            <title>Building yet another static site generator</title>
            <link>https://h3rald.com/articles/hastysite</link>
            <guid isPermaLink="true">https://h3rald.com/articles/hastysite</guid>
            <pubDate>Wed, 27 Dec 2017 10:04:15 +01:00</pubDate>
            <description><![CDATA[<ul id='toc' class='panel'><li><a href='#heading__TL_DR'>TL;DR</a></li>
<li><a href='#heading__Choosing_a_technology_stack'>Choosing a technology stack</a></li>
<li><a href='#heading__Functionality'>Functionality</a></li>
<li><a href='#heading__Mustache_Template_Engine'>Mustache Template Engine</a></li>
<li><a href='#heading__Conclusion'>Conclusion</a></li></ul>
<p>It has been <em>over TWO years</em> since my <a href="/articles/litestore/">last article</a> on this site. I have been pretty busy with work and all and well&hellip; same old, same old.</p>

<p>It&rsquo;s not that I didn&rsquo;t have time to write articles, it&rsquo;s a mixture of different things:</p>

<ul>
<li>I&rsquo;ve been neglecting this site, in favor of other projects.</li>
<li>this site was running an old version of the <a href="https://nanoc.ws/">Nanoc</a> static site generator.</li>
<li>&hellip;that in turn was running on an old version of Ruby.</li>
<li>&hellip;and I am not really using Ruby anymore nowadays.</li>
</ul>


<p>I&rsquo;ve always been fascinated by the <a href="https://indieweb.org/">IndieWeb</a> as a bold response to being subjugated by the proprietary web of Facebook, Google, Twitter et al. I am not a social user and I&rsquo;ve never been one: I just can&rsquo;t wrap my head around the concept of essentially giving <em>my own creations</em> (content, in this case) to a corporation for free, without proper credit.</p>

<p>I&rsquo;ve owned my own web site since 2004, and I am a proud believer of essentially all the <a href="https://indieweb.org/Principles">IndieWeb Principles</a>. They make logical sense to me; in particular the one concerning <a href="https://indieweb.org/selfdogfooding">selfdogfooding</a> &mdash;a horrible term for a very noble cause.</p>

<p>So I decided to ditch Nanoc. There&rsquo;s nothing inherently wrong with it, and it is also an open source project, but I really wanted to build my own tool to publish content on the web.</p>

<hr />


<a class='heading-anchor' id='heading__TL_DR'></a><h3>TL;DR <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I ended up creating <a href="https://hastysite.h3rald.com">HastySite</a>, a self-contained static site generator written in <a href="https://nim-lang.org">Nim</a> that leverages on <a href="/hastyscribe">HastyScribe</a> for markdown processing, on <a href="https://github.com/fenekku/moustachu">Moustachu</a> for mustache templates, and on the <a href="https://min-lang.org">min</a> programming language for pretty much everything else.</p>

<a class='heading-anchor' id='heading__Choosing_a_technology_stack'></a><h3>Choosing a technology stack <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>I started programming with Turbo Pascal, then C, C++, Java, then I learnt PHP, then moved on to Ruby in the golden years of Ruby on Rails, meanwhile got briefly acquainted with Lisp, Scheme, Haskell, a bunch of esoteric programming languages like Io (see <a href="/articles/10-programming-languages/">this article</a> for more).</p>

<p>More recently, I started using Javascript (the <em>new</em> Javascript reborn in the 2010s, and more specifically its <a href="http://shop.oreilly.com/product/9780596517748.do">good parts</a>) both in the browser and on the server, even at work.</p>

<p>I believe that Javascript is a very powerful and expressive language, but it has its shortcomings &mdash;both in terms of the language itself and its ecosystem. More specifically, I cannot believe we now consider <em>normal</em> juggling thousands of third-party NPM packages to build almost anything using today&rsquo;s Javascript. People are <a href="http://www.haneycodes.net/npm-left-pad-have-we-forgotten-how-to-program/">getting more and more pissed off</a> about this, and maybe someday the whole NPM ecosystem will implode in itself&hellip; But this is another story.</p>

<p>Let&rsquo;s just say that I discarded Javascript for this endeavor, not because unsuitable for the task (there are dozens of pretty decent static site generators written in Javascript already), but because I wanted to build something simpler to manage, in terms of dependencies and&hellip; number of files.</p>

<p>That&rsquo;s why I chose <a href="https://nim-lang.org">Nim</a>. I have been using Nim on-and-off in my pet projects for years now: it is a very productive language, and it produces small, fast-as-C, self-contained executable files for many different platforms.</p>

<a class='heading-anchor' id='heading__Functionality'></a><h3>Functionality <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>So what are the key features a static site generator must have?</p>

<p>At the very least, the following:</p>

<ul>
<li>Generate HTML files from a lightweight markup language.</li>
<li>Provide a way to manage content templates (and partial templates) for things like headers, footers, and so on.</li>
<li>Provide a way to store page metadata, and ideally to build custom logic based on it.</li>
<li>Providing an efficient way to manage assets, i.e. typically just copy them to the output folder.</li>
<li>Provide ways to customize paths and content/asset routing.</li>
</ul>


<p>This is the bare minimum. Then you may also want support for CSS preprocessors, themes, JavaScript minification, content reuse and more.</p>

<h4>Markdown Processing</h4>

<p>When it comes to picking a lightweight markup language, Markdown is a solid choice. It is readable and it comes in many flavors that provide just about anything you need to write an article or blog post.</p>

<p>A while back I created <a href="/hastyscribe">HastyScribe</a>, a fast Markdown processor based on <a href="http://www.pell.portland.or.us/~orc/Code/discount/">Discount</a>. It may not be the most standard flavor of Markdown, but it is one of the most feature-rich. Besides standard Markdown features and what is already supported by Discount, HastyScribe also provides support for:</p>

<ul>
<li>Content snippets</li>
<li>Transclusion of other Markdown files</li>
<li>Simple substitution macros</li>
<li>Custom fields</li>
</ul>


<p>Those features provide a very high degree of content reuse; not everyone needs them, but they are very useful for certain types of web sites and when authoring technical reference documentation.</p>

<p>HastyScribe is also written in Nim, which makes it ideal for this project.</p>

<a class='heading-anchor' id='heading__Mustache_Template_Engine'></a><h3>Mustache Template Engine <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Like with lightweight markup languages, there are tons of different template engines out there. <a href="http://mustache.github.io">Mustache</a> is one of the oldest logic-less template engines, often emulated and improved upon. There are several implementations of Mustache in different languages, and luckily there&rsquo;s also one for Nim: <a href="https://github.com/fenekku/moustachu">Moustachu</a>.</p>

<p>Moustachu supports the following key basic features that are essential for the management of static web sites:</p>

<ul>
<li><a href="http://mustache.github.io/mustache.5.html#Variables">Variables</a> &ndash; Essentially placeholders for text, wrapped in double curly braces.</li>
<li><a href="http://mustache.github.io/mustache.5.html#Sections">Sections</a> &ndash; Used for managing blocks of conditional text as well as lists of items.</li>
<li><a href="http://mustache.github.io/mustache.5.html#Partials">Partials</a> &ndash; Used to render a mustache template within another mustache template (and inheriting its context). This is essential to support proper layout management with reusable portions of code such as headers, footers, and so on.</li>
</ul>


<h4>Rules and Custom Scripts</h4>

<p>Although logic-less templates are great for keeping things simple and making you focus on content and layout, they are not enough to create a whole site. You&rsquo;d always need something to drive the generation flow, collect and expose (meta)data, copy and process files.</p>

<p>I briefly considered the possibility of providing a big fat YAML or JSON file to configure every single aspect of a site and its generation process, from its name to the way content is processed, and routing. Luckily, I soon realized that this approach would not be enough if this new static site generator were meant to become <em>extensible</em> rather than just configurable, so I started looking into DSLs and small scripting languages to embed in the main Nim program &ndash; Nim, being a compiled language, cannot be used for this purpose.</p>

<p>I could have picked something like <a href="http://duktape.org">duktape</a> and be done with it, but in the interests of <em>selfdogfooding</em> I decided to use my own. While working on this project, I was also implementing a new, minimalist <a href="https://en.wikipedia.org/wiki/Concatenative_programming_language">concatenative</a> programming language called <a href="httos://min-lang.org">min</a>.</p>

<p>Now, min is written in Nim (pun intended), and provides the bare minimum to qualify as a systems programming language: work with files, environment variables, execute external processes etc. Being concatenative and also functional, it seemed a good candidate to be used as the backbone for the building pipeline of a static site generator, while also providing a high-level way to extend the program.</p>

<h3>Introducing <em>HastySite</em></h3>

<p>After a few months of experimenting and tinkering with the above-mentioned technologies, I released <a href="https://hastysite.h3rald.com">HastySite</a>, a fully-functional static site generator built around the HastyScribe markdown processor.</p>

<p>HastySite is a single, self-contained executable file available for all major platforms that allows you create a brand new static site or blog in a matter of <em>seconds</em> &ndash; if you choose to stick with the defaults and not customize anything, that is. Otherwise&hellip; you can go through the documentation on the site (also available as a standalone, printable <a href="/hastysite/HastySite_UserGuide.htm">HTML file</a>), learn how everything works, and customize/extend whatever you want, from the CSS styles to use to the way you are copying files to the output folder (which can of course be something different than <em>output</em>).</p>

<p>If you just want to play with it, just download the executable and run <strong>hastysite init</strong>. This is actually the only command provided by HastySite that <em>cannot</em> be customized (where customized in this case means <em>rewritten from scratch</em>), simply because it creates the default web site structure.</p>

<p>This command will also dump some CSS files and fonts in your asset folder, just enough to create a web site as ugly as HastySite&rsquo;s &mdash;the idea is of course that you remove those and place your own there. Similarly, you will also have some default templates and some commands you can use to create content and build the site &mdash;you&rsquo;ll probably want to keep those, or maybe just change them just a little bit at least until you become comfortable with the min language.</p>

<p>So, to sum up, with HastySite you get:</p>

<ul>
<li>Enhanced Markdown support for all your content, powered by <a href="/hastyscribe">HastyScribe</a>.</li>
<li>Mustache templates support.</li>
<li>A bare-bones but fully-functional responsive site theme based on HastyScribe&rsquo;s stylesheet.</li>
<li>Default scripts to build and clean your site, as well as creating pages and blog posts.</li>
<li>Support for arbitrary metadata processing in content files, so that you can implement your own custom logic to process content.</li>
<li>Support for <a href="https://hastysite.h3rald.com/customization/">customizing and extending</a> the way the program works almost in any way, using the <a href="https://min-lang.org">min</a> programming language.</li>
<li>Very fast and optimized (write a file in output only if it is new or modified) content processing.</li>
</ul>


<p>&hellip;and of course it&rsquo;s 100% open source, MIT-licensed software.</p>

<a class='heading-anchor' id='heading__Conclusion'></a><h3>Conclusion <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>There are an awful lot <a href="https://www.staticgen.com">static site generators</a> out there, implemented in almost any programming language and offering varying degrees of customizability. I decided to build my own because over the years I never found any that was both <em>minimal</em> (as in simple, self-contained, and without a ton of dependencies) and <em>highly extensible</em>. Plus, I really wanted to reuse what I already implemented in HastyScribe: a powerful markdown processor with support for content-reuse features like snippets and macros.</p>

<p>HastySite may never become as popular as <a href="https://jekyllrb.com">Jekyll</a> or <a href="https://nanoc.ws">Nanoc</a>, but at least it is something that fits my needs <em>perfectly</em>, which is what matters the most right now. At present, I use HastyScribe to power the following web sites:</p>

<ul>
<li><a href="https://h3rald.com">https://h3rald.com</a></li>
<li><a href="https://hastysite.h3rald.com">https://hastysite.h3rald.com</a></li>
<li><a href="https://min-lang.org">https://min-lang.org</a></li>
</ul>


<p>If you want to build something similar, or if you &mdash;like me&mdash; didn&rsquo;t find a static site generator that fitted your needs, you should definitely give HastySite a try!</p>]]></description>
        </item>
        <item>
            <title>Introducing LiteStore</title>
            <link>https://h3rald.com/articles/litestore</link>
            <guid isPermaLink="true">https://h3rald.com/articles/litestore</guid>
            <pubDate>Sun, 20 Sep 2015 22:01:45 +02:00</pubDate>
            <description><![CDATA[<ul id='toc' class='panel'><li><a href='#heading__Downloading_LiteStore'>Downloading LiteStore</a></li>
<li><a href='#heading__Running_LiteStore'>Running LiteStore</a></li>
<li><a href='#heading__Digging_Deeper_hellip_'>Digging Deeper&hellip;</a></li>
<li><a href='#heading__The_LiteStore_Administration_App'>The LiteStore Administration App</a></li>
<li><a href='#heading__Under_the_Hood'>Under the Hood</a></li>
<li><a href='#heading__The_HTTP_REST_API'>The HTTP REST API</a></li>
<li><a href='#heading__Conclusion'>Conclusion</a></li>
<li><a href='#heading__Credits'>Credits</a></li></ul>
<p>Lately I have become more and more interested in client-side single-page applications. Nowadays you can write your web apps in Javascript using your favorite framework, without any server-side logic, but you obviously still need:</p>

<ul>
<li> some web service to retrieve and persist your application data.</li>
<li> a web server to serve the source code and the static assets of your web application.</li>
</ul>


<p>NodeJS is probably one of the easiest backend to setup for prototyping SPAs. It is very easy to create a simple web server in Node and to implement a simple REST API using Express or a similar framework, but you still need to install node and write some code to wire up your backend.</p>

<p>I wanted something even more lazy then that. I wanted a fully <em>self-contained</em> program able to:</p>

<ul>
<li>Serve static files</li>
<li>Act as a simple JSON document store</li>
<li>Provide a simple REST API to work with</li>
<li>(bonus!) provide a way to pack web apps for easy distribution</li>
</ul>


<p>&hellip;and that&rsquo;s how I ended up developing <em>LiteStore</em>.</p>

<hr class="sep" />


<p><a href="/litestore">LiteStore</a> is a lightweight, self-contained, RESTful, searchable, multi-format, NoSQL document store and web server. That sounds pretentious, but it is essentially an accurate description of what LiteStore is and does.</p>

<p>It is built using the <a href="http://nim-lang.org/">Nim</a> programming language and its Administration App (see below) is built using <a href="https://lhorie.github.io/mithril/">Mithril</a>, two relatively less-known projects, both of which I highly recommend if you want to take a break from more mainstream programming languages like C# or Java and Javascript frameworks like AngularJS or React.</p>

<a class='heading-anchor' id='heading__Downloading_LiteStore'></a><h3>Downloading LiteStore <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>The easiest way to understand what LiteStore does, is to try it out. Simply download a release package from the <a href="https://github.com/h3rald/litestore">GitHub repo</a> (or from <a href="/litestore">here</a> for your convenience) that is suitable for your operating system and architecture.</p>

<p>The release package contains the following files:</p>

<ul>
<li><strong>litestore</strong> / <strong>litestore.exe</strong> &mdash; The LiteStore executable.</li>
<li><strong>LiteStore_UserGuide.html</strong> &mdash; The official user guide describing the program, its usage, architecture, API, etc.</li>
<li><strong>data.db</strong> &mdash; The default data store file, containing the LiteStore Administration App.</li>
</ul>


<p>That&rsquo;s all. No libraries to download, no installers, just an executable file. I love self-contained programs.</p>

<a class='heading-anchor' id='heading__Running_LiteStore'></a><h3>Running LiteStore <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>To start a LiteStore server with the default settings:</p>

<ol>
<li>Open a command prompt in the directory containing the LiteStore executable and the data.db data store file.</li>
<li>Enter <strong>litestore</strong> in the command prompt.</li>
</ol>


<p><em>or</em> (on Windows):</p>

<ol>
<li>Double-click <strong>litestore.exe</strong></li>
</ol>


<p>You should get a message similar to the following:</p>

<p><samp>2015-09-20 @ 05:03:36    INFO: LiteStore v1.0.0 started on 127.0.0.1:9500.</samp></p>

<p>&hellip;meaning that LiteStore is running on the specified address.</p>

<p>If you open a browser and type <a href="http://localhost:9500">http://localhost:9500</a> you should get the following JSON response:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>Congrats, LiteStore is up and running!</p>

<a class='heading-anchor' id='heading__Digging_Deeper_hellip_'></a><h3>Digging Deeper&hellip; <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>LiteStore is, first and foremost, a RESTful document store. Think CouchDb or MongoDb, but smaller, much smaller. Here&rsquo;s basically what happens when you run the <strong>litestore</strong> command:</p>

<ol>
<li>LiteStore checks for a file named <strong>data.db</strong> within the current directory and creates one if it doesn&rsquo;t exists.</li>
<li>LiteStore assumes that such file is a properly-formatted LiteStore data store file and tries to connect to it.</li>
<li>If all goes well, LiteStore starts a simple HTTP server on port 9500, ready to receive HTTP requests.</li>
</ol>


<p>(The path of the data store file, the port, etc. are all configurable settings &mdash; run <span class="cmd">litestore -h</span> for more details)</p>

<p>Now, if you access <a href="http://localhost:9500">http://localhost:9500</a> while LiteStore is running, you&rsquo;ll get JSON response listing some stats about the currently-loaded data store file, and some information on stored documents and tags, if any. The <strong>data.db</strong> file that ships with LiteStore already contains some documents. Well, actually it contains <em>a web application to administer LiteStore itself</em>.</p>

<a class='heading-anchor' id='heading__The_LiteStore_Administration_App'></a><h3>The LiteStore Administration App <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Now try accessing the following URL:</p>

<p><a href="http://localhost:9500/docs/admin/index.html">http://localhost:9500/docs/admin/index.html</a></p>

<p>If all goes well, you should see the following page:</p>

<p><img src="/images/litestore/litestore_info.png" alt="Info" /></p>

<p>You are now viewing the LiteStore Administration App, a simple single-page application implemented on top of the <a href="https://lhorie.github.io/mithril/">Mithril</a> Javascript framework. The cool part is that this application is stored within the <strong>data.db</strong> file and is being served by LiteStore itself.</p>

<p>The LiteStore Administration App is an example of single-page application developed for LiteStore: it uses pretty much all LiteStore functionalities that are exposes by the LiteStore REST API.</p>

<p>On the home page you can see the same stats displayed on LiteStore root URL (<a href="http://localhost:9500">http://localhost:9500</a>), but you can also click any of the tag links to view documents by tag:</p>

<p><img src="/images/litestore/litestore_tag.png" alt="Tag" /></p>

<p>&hellip;and clicking a document title will display the document content and tags:</p>

<p><img src="/images/litestore/litestore_doc.png" alt="Document" /></p>

<p>Note that it is also possible to create, upload, edit or delete documents and manage tags:</p>

<p><img src="/images/litestore/litestore_doc_ops.png" alt="Document Operations" /></p>

<p>But perhaps the best feature of this web app (and of LiteStore itself) is the full-text search capability:</p>

<p><img src="/images/litestore/litestore_search.png" alt="Document Search" /></p>

<p>By leveraging LiteStore search API (which in turn leverages SQLite exceptional <a href="https://www.sqlite.org/fts3.html">FTS4 extension</a>), it is pretty easy to build fast search-oriented web applications.</p>

<a class='heading-anchor' id='heading__Under_the_Hood'></a><h3>Under the Hood <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>By now you are probably wonder how this whole thing can work. This is best explained with a simple exercise: let&rsquo;s export and re-import the Administration App!</p>

<p>First of all, stop the LiteStore instance by pressing <kbd>CTRL+C</kbd> within the prompt window.</p>

<p>Now execute the following command, from the same directory where you started LiteStore:</p>

<div class="terminal"><p>litestore -d:admin export</p></div>

<p>LiteStore will create a directory called <span class="dir">admin</span>. If you browse its contents, you will find the full source code and assets of the LiteStore Administration App (also available in the LiteStore <a href="https://github.com/h3rald/litestore/">Github repo</a>).</p>

<p>Now delete the <span class="file">data.db</span> file. Don&rsquo;t worry, you can always get a new one from a release package, at worst.</p>

<p>Run LiteStore again, with no parameters:</p>

<div class="terminal"><p>litestore</p></div>

<p>If you access <a href="http://localhost:9500">http://localhost:9500</a> in your browser, you&rsquo;ll get the following response:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>This is basically saying that the datastore file is empty. And indeed LiteStore just created a new data.db file. If you try accessing the URL of the Administration App (<a href="http://localhost:9500/docs/admin/index.html">http://localhost:9500/docs/admin/index.html</a>) you won&rsquo;t go very far:</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>As expected, because the datastore file is empty.</p>

<p>Now stop LiteStore and execute the following command:</p>

<div class="terminal"><p>litestore -d:admin import</p></div>

<p>This command will import the contents of the <span class="dir">admin</span> folder into the datastore file, creating documents and tags automatically.</p>

<p>If you run LiteStore again, you&rsquo;ll see that everything is back in order, and you can access the Administration App again.</p>

<a class='heading-anchor' id='heading__The_HTTP_REST_API'></a><h3>The HTTP REST API <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>The HTTP REST API exposed by LiteStore allows you to retrieve documents in their original content type, so for example:</p>

<ul>
<li><a href="http://localhost:9500/docs/admin/index.html">http://localhost:9500/docs/admin/index.html</a> retrieves the contents of the <span class="kwd">admin/index.html</span> document in HTML format.</li>
<li><a href="http://localhost:9500/docs/admin/index.html?raw=true">http://localhost:9500/docs/admin/index.html?raw=true</a> retrieves the <span class="kwd">admin/index.html</span> document in raw (JSON) format.</li>
</ul>


<p>This is why when you access the first URL you are able to see the app.</p>

<p>Queries that return a list of documents, on the other hand, always return a JSON response. For example, <a href="http://localhost:9500/docs?tags=$subtype:css&amp;contents=false">http://localhost:9500/docs?tags=$subtype:css&amp;contents=false</a> returns all the documents whose subtype is set to <span class="kwd">css</span> (without displaying their contents in this case):</p>

<pre class="chroma"><code>/bin/sh: chroma: not found</code></pre>


<p>For all the details on the HTTP REST API, see <a href="/litestore/LiteStore_UserGuide.htm#HTTP.API.Reference">the guide</a>.</p>

<a class='heading-anchor' id='heading__Conclusion'></a><h3>Conclusion <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>LiteStore does not aim to be the <em>next big thing</em> in the NoSQL document store landscape, but it shines when used as a simple and smart way to prototype single-page applications, or implement personal apps like a local Wiki.</p>

<p>Personally, I use it whenever I have to prepare a quick demo for a proof-of-concept SPA, and I don&rsquo;t want to have to worry about the backend. The Administration App is a great starting point to see how to use the LiteStore API to build an application. Even if you don&rsquo;t have any experience with the Mithril framework (neither did I until I built this!), you can have a look at the <a href="https://github.com/h3rald/litestore/blob/master/admin/js/models.js">models.js</a> file to see how to access pretty much every functionality exposed by the API. I also managed to wire up a quick and dirty AngularJS service to do something similar, and it wasn&rsquo;t too hard.</p>

<p>I hope some of you will find LiteStore useful and will give it a shot. If you want to contribute, feel free to fork the <a href="https://github.com/h3rald/litestore/">repo</a> and send me a pull request. It would be great to have some <a href="https://lhorie.github.io/mithril/">Mithril</a> or <a href="http://nim-lang.org/">Nim</a> expert to have a look at this and improve it!</p>

<a class='heading-anchor' id='heading__Credits'></a><h3>Credits <a class='go2top' href='#top' title='Go to the top'>⇈</a></h3>

<p>Special thanks to the following individuals, communities and organizations that made LiteStore possible:</p>

<ul>
<li>Dwayne Richard Hipp and all the contributors to <a href="http://www.sqlite.org/">SQLite</a>, the true gem that powers LiteStore.</li>
<li>Andreas Rumpf and all the contributors to the <a href="http://nim-lang.org/">Nim Programming Language</a>, used to develop LiteStore.</li>
<li>Leo Horie, for creating the <a href="https://lhorie.github.io/mithril/">Mithril Javascript Framework</a>, used to develop the LiteStore Administration App.</li>
<li>The creators and contributors to the <a href="http://getbootstrap.com/">Bootstrap</a> CSS and Javascript framework, used by the LiteStore Administration App.</li>
<li>The creators and contributors to the <a href="http://ace.c9.io/">Ace Editor</a>, used by the LiteStore Administration App.</li>
<li>Cristopher Jeffrey and all the contributors to the <a href="https://github.com/chjj/marked">Marked Javascript Library</a> used by the LiteStore Administration App.</li>
</ul>
]]></description>
        </item>
    </channel>
</rss>
