<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Salar Rahmanian</title><link>https://www.softinio.com/</link><description>Software Engineer based in San Francisco Bay Area</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 27 Sep 2026 13:36:49 -0700</lastBuildDate><atom:link href="https://www.softinio.com/index.xml" rel="self" type="application/rss+xml"/><item><title>Checking Relevance With Verdict4s</title><link>https://www.softinio.com/post/checking-relevance-with-verdict4s/</link><pubDate>Sun, 27 Sep 2026 13:36:49 -0700</pubDate><guid>https://www.softinio.com/post/checking-relevance-with-verdict4s/</guid><description>&lt;p&gt;
 &lt;img src="https://www.softinio.com/post/checking-relevance-with-verdict4s/verdict4s-scala.svg"
 alt="Checking Relevance with Verdict4s"
 loading="eager" fetchpriority="high" /&gt;
&lt;/p&gt;
&lt;p&gt;A few years ago I set up a site that curates Scala-related articles (see &lt;a href="https://www.scalanews.net"&gt;Scala News&lt;/a&gt;) from the blogs of well-known Scala developers using RSS. This involves fetching all new articles from a list of bloggers&amp;rsquo; RSS feeds. One problem with this was that even though these bloggers mostly write about Scala, occasionally they don&amp;rsquo;t. Some of the posts were also sales pitches or recruitment-focused.&lt;/p&gt;
&lt;p&gt;I wanted to filter out irrelevant articles, and my attempt to solve this was quite simplistic. Let&amp;rsquo;s take a look at a code snippet of it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;isAboutScala&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;SyndEntry&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Boolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;hasRelevantCategory&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getCategories&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;_&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;asScala&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;toList&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getOrElse&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exists&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getName&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;toLowerCase&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;scala&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;sbt&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;})&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;hasRelevantTitle&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getTitle&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;_&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;toLowerCase&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getOrElse&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;scala&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getTitle&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;_&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;toLowerCase&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="n"&gt;getOrElse&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="n"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;sbt&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;hasRelevantDescription&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getDescription&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;_&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getValue&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;toLowerCase&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getOrElse&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;scala&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Option&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getDescription&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;_&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getValue&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;toLowerCase&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getOrElse&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;sbt&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;hasRelevantCategory&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;hasRelevantTitle&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;hasRelevantDescription&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can clearly see the shortcomings of this. As a result, I had to vet the articles manually myself, which was inefficient and kind of defeated the whole point of automatically fetching the latest articles using RSS.&lt;/p&gt;
&lt;h3 id="discovering-decision-making-models"&gt;Discovering Decision Making Models&lt;a class="heading-anchor" href="#discovering-decision-making-models" aria-label="Copy link to section: Discovering Decision Making Models" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Back when I started with Scala, a long time ago, there was a company called Typesafe, as I am sure many will remember. It later changed its name to Lightbend, and more recently to Akka.&lt;/p&gt;
&lt;p&gt;A couple of weeks ago I noticed a lot of conversation on social media and AI-related forums about TypeSafe AI. My immediate reaction was nostalgia, thinking it was the same company going back to its original name for the AI era 😁&lt;/p&gt;
&lt;p&gt;That wasn&amp;rsquo;t the case. It was a new company with a new model called Jev, a new type of model that is optimised for making decisions, as opposed to current large language models that generate text and that you have a conversation with.&lt;/p&gt;
&lt;p&gt;In practice, that means you don&amp;rsquo;t chat with Jev at all. You give it some information along with a question that has a fixed set of possible answers, like &amp;ldquo;Is this email spam, yes or no?&amp;rdquo; or &amp;ldquo;Which team should handle this support request?&amp;rdquo; Jev picks one of those answers and tells you how confident it is. It&amp;rsquo;s a bit like the difference between asking an advisor to write you an essay and asking them to tick a box. Because Jev can only choose from the options you give it, it can&amp;rsquo;t wander off or make things up, and it answers in a fraction of a second at a small fraction of the cost. That makes it well suited to the quick, repetitive judgment calls software has to make thousands of times a day.&lt;/p&gt;
&lt;p&gt;Well, deciding whether an article or blog post is relevant is a decision made by answering a question, which makes Jev a perfect fit for the problem I am trying to solve.&lt;/p&gt;
&lt;h3 id="introducing-verdict4s"&gt;Introducing Verdict4s&lt;a class="heading-anchor" href="#introducing-verdict4s" aria-label="Copy link to section: Introducing Verdict4s" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This got me excited about using Jev, the decision-making model, to improve how I filter out irrelevant articles. So I did what all good Scala developers do: I created a new library you can use to bring decision models into your Scala applications.&lt;/p&gt;
&lt;p&gt;Verdict4s is a Scala 3 client for typed decision models. It supports Jev and OpenAI Decisions, and it runs on both the JVM and Scala.js. You ask typed questions and get typed answers back: choices, scores and probabilities, never free text you&amp;rsquo;d have to parse. If a choice question uses your own enum, the answer comes back as that enum. You don&amp;rsquo;t need casts or lookups by string key.&lt;/p&gt;
&lt;p&gt;It uses &lt;a href="https://github.com/Iltotore/iron"&gt;Iron&lt;/a&gt; refined types to carry the services&amp;rsquo; limits. A probability must be between 0 and 1, and a choice can have at most 255 options. Some invalid values won&amp;rsquo;t compile at all, for example &lt;code&gt;Probability(1.5)&lt;/code&gt;. The rest are caught before any request is sent.&lt;/p&gt;
&lt;p&gt;It comes as three modules, so you only take what you need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;verdict4s&lt;/code&gt;&lt;/strong&gt;: a working client in one line, with its own HTTP transport. It runs in any cats-effect &lt;code&gt;Async&lt;/code&gt; effect, so &lt;code&gt;IO&lt;/code&gt; works, and so does ZIO through its cats interop.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;verdict4s-client&lt;/code&gt;&lt;/strong&gt;: bring your own http4s &lt;code&gt;Client[F]&lt;/code&gt; if you want to choose the backend.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;verdict4s-core&lt;/code&gt;&lt;/strong&gt;: only the types and codecs, with no effect system, so you can use it with &lt;code&gt;Future&lt;/code&gt; or plain Java HTTP.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So whatever effect system you use, or none, there&amp;rsquo;s a way in. The details are in the &lt;a href="https://verdict4s.softinio.dev"&gt;docs&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="how-i-use-it-to-decide-whether-articles-are-relevant"&gt;How I use it to decide whether articles are relevant&lt;a class="heading-anchor" href="#how-i-use-it-to-decide-whether-articles-are-relevant" aria-label="Copy link to section: How I use it to decide whether articles are relevant" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I use &lt;code&gt;Jev&lt;/code&gt; to ask three questions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// All three questions go to jev in a single request.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;private&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;scalanews&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;relevanceQuestions&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Ask&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Question&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;noul&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;Is this article about the Scala programming language or its ecosystem?&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;It is mainly about Scala itself or Scala libraries, frameworks, tools or build tools (such as sbt, Mill or Scala CLI).&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;It is mainly about something else, and mentions Scala only in passing or not at all.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Question&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;noul&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;Is this article just an announcement of a new version of a Scala library or application?&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;It only announces a release: a version number, a list of changes or release notes, with little else.&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;It has substance beyond announcing a release, such as explanation, tutorial, design discussion or opinion.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Question&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;noul&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;Is this article mainly sales or recruitment content?&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;It mainly promotes a paid product, service, training or consultancy, or advertises jobs or hiring, rather than sharing knowledge.&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;It mainly shares knowledge, experience or opinion, even if the author works for a company or mentions its products in passing.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As part of Jev&amp;rsquo;s response you get a probability between 0 and 1 for each question: how likely it is that the answer is yes (the decision!).&lt;/p&gt;
&lt;p&gt;These are the thresholds I have set for each question. An article is kept when &amp;ldquo;about Scala&amp;rdquo; is at least 0.3, and dropped if either of the other two reaches 0.7:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// jev answers each question with P(yes). Excluding a real Scala post loses it
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// silently while including an off-topic one only costs a reader a skip, so
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// both thresholds lean towards keeping articles. Calibrated on real feeds:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// off-topic posts scored at most 0.12 for &amp;#34;about Scala&amp;#34; while Scala
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// community news (e.g. Typelevel governance posts) scored 0.41-0.66; release
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// announcements scored 0.84-0.94 for &amp;#34;just an announcement&amp;#34; and substantive
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// posts at most 0.31. The sales/recruitment threshold isn&amp;#39;t calibrated yet;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// like the announcement one it only drops articles jev is fairly sure of.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;private&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;scalanews&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;aboutScalaThreshold&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;private&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;scalanews&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;announcementThreshold&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;private&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;scalanews&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;promotionalThreshold&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And this self-explanatory snippet shows how the response and thresholds are used to decide whether to include the article or not:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cm"&gt;/** Relevant when jev judged it about Scala, not just a release announcement
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cm"&gt; * and not sales or recruitment content. Decided from stored probabilities,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cm"&gt; * so retuning the thresholds needs no new jev calls.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cm"&gt; */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;private&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;scalanews&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;relevant&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;aboutScala&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Probability&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;announcement&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Probability&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;promotional&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Probability&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Boolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;aboutScala&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Double&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;aboutScalaThreshold&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;announcement&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Double&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;announcementThreshold&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;promotional&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Double&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;promotionalThreshold&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can see the full code here: &lt;a href="https://github.com/softinio/scalanews/blob/main/scalanews/src/Relevance.scala"&gt;Relevance.scala&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="how-has-it-worked-out"&gt;How has it worked out?&lt;a class="heading-anchor" href="#how-has-it-worked-out" aria-label="Copy link to section: How has it worked out?" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I ran it over the 83 articles Scala News collected from 16 blogs between January and August 2026. Jev kept 43 of them and filtered out the other 40:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;30 release announcements&lt;/strong&gt;, such as &amp;ldquo;Scala 3.8.4 is now available!&amp;rdquo; and &amp;ldquo;sbt 2.0.0&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;9 off-topic posts&lt;/strong&gt;, including four chapters of a Rust Book series and a resume page. Every one of these mentions Scala somewhere, so my old keyword check would have happily let them all through.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;1 promotional post&lt;/strong&gt;: &amp;ldquo;Announcing Scala Days 2026&amp;rdquo;. This one is debatable, as it&amp;rsquo;s a community conference rather than a sales pitch.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;rsquo;s 40 articles I no longer have to spot and remove by hand, which is exactly what I was hoping for.&lt;/p&gt;
&lt;h3 id="whats-next"&gt;What&amp;rsquo;s next&lt;a class="heading-anchor" href="#whats-next" aria-label="Copy link to section: What’s next" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Because I store Jev&amp;rsquo;s probabilities rather than just a yes or no, I can retune the thresholds at any time without asking Jev again. That&amp;rsquo;s handy, as I&amp;rsquo;m not done tuning yet. The sales and recruitment threshold is still a guess, and the Scala Days post shows it needs calibrating against real feeds, the same way I did for the other two.&lt;/p&gt;
&lt;h3 id="try-it-yourself"&gt;Try it yourself&lt;a class="heading-anchor" href="#try-it-yourself" aria-label="Copy link to section: Try it yourself" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If your code makes the same kind of decision over and over, such as routing, triage, moderation or filtering, give verdict4s a try:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Mill
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;mvnDeps&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Seq&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mvn&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;com.softinio::verdict4s::0.2.0&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// sbt
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;libraryDependencies&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;com.softinio&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;%%%&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;verdict4s&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;0.2.0&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;a href="https://verdict4s.softinio.dev"&gt;docs&lt;/a&gt; will get you started, and the code is on &lt;a href="https://github.com/softinio/verdict4s"&gt;GitHub&lt;/a&gt;. I would love to hear what you use it for, and pull requests are always welcome.&lt;/p&gt;</description></item><item><title>Using Stable And Unstable Nix/NixOS Channels Together</title><link>https://www.softinio.com/til/using-stable-and-unstable-nix-channels-together/</link><pubDate>Sat, 03 May 2025 00:00:00 +0000</pubDate><guid>https://www.softinio.com/til/using-stable-and-unstable-nix-channels-together/</guid><description>&lt;p&gt;For one of my servers that is running NixOS I have been using the stable channel for all packages. However I wanted for one package to use the version of the package that the unstable channel had and had to learn how to do it.&lt;/p&gt;
&lt;p&gt;I am using flakes and this is what I originally had as my input:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nix" data-lang="nix"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;inputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;nixpkgs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;github:NixOS/nixpkgs/nixos-24.11&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I added the unstable channel as an input:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nix" data-lang="nix"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;inputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;nixpkgs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;github:NixOS/nixpkgs/nixos-24.11&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;nixpkgs-unstable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;-- added this !&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;github:NixOS/nixpkgs/nixos-unstable&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I changed my output to make sure my system is configured with both channels as follows (see comments in code snippet for what I added):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nix" data-lang="nix"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;outputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;nixpkgs&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;nixpkgs-unstable&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;--- added this&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;let&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;system&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;x86_64-linux&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Define the pkgs from both stable and unstable channels&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;pkgs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;nixpkgs&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;inherit&lt;/span&gt; &lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;unstablePkgs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;nixpkgs-unstable&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;inherit&lt;/span&gt; &lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;in&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;nixosConfigurations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;myserver&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nixpkgs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nixosSystem&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;inherit&lt;/span&gt; &lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;modules&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="sr"&gt;./configuration.nix&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;];&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;specialArgs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;inherit&lt;/span&gt; &lt;span class="n"&gt;pkgs&lt;/span&gt; &lt;span class="n"&gt;unstablePkgs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;--- inheriting both!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now where ever I define a nix function I include both &lt;code&gt;pkgs&lt;/code&gt; and &lt;code&gt;unstablePkgs&lt;/code&gt; as arguments and am able to chose what package from which channel to use.&lt;/p&gt;
&lt;p&gt;For example when choosing what system packages I want to install:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nix" data-lang="nix"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;systemPackages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;pkgs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;eza&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;unstablePkgs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ripgrep&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Happy Days!&lt;/p&gt;</description></item><item><title>The Data Surrender Trap: How Enterprises Are Losing Control in the AI Gold Rush—and the Simple Fix</title><link>https://www.softinio.com/post/the-data-surrender-trap/</link><pubDate>Sat, 26 Apr 2025 18:07:52 -0800</pubDate><guid>https://www.softinio.com/post/the-data-surrender-trap/</guid><description>&lt;p&gt;
 &lt;img src="https://www.softinio.com/post/the-data-surrender-trap/TheDataSurrenderTrap.svg"
 alt="The Data Surrender Trap"
 loading="eager" fetchpriority="high" /&gt;
&lt;/p&gt;
&lt;p&gt;Generative AI has lit a fire under every product road-map. Faced with “ship it yesterday” pressure, many teams reach for a turnkey vendor: upload data, call an API, launch the feature. It works—until the bill comes due.&lt;/p&gt;
&lt;p&gt;Handing raw customer data to a third party introduces two long-term headaches:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Governance and compliance risk - once data leaves your perimeter, you lose direct control over how long it&amp;rsquo;s stored, where it resides, and who can see it. A single mis-configuration or model-training clause could violate GDPR, HIPAA, or internal policy.&lt;/li&gt;
&lt;li&gt;Technical debt - the day you need to swap providers, migrate regions, or delete a customer record, you discover tight coupling in schemas, pipelines, and security controls that were never designed for portability.&lt;/li&gt;
&lt;li&gt;Technical debt - having to synchronize data between multiple vendors and your own systems, which can lead to data inconsistencies and increased complexity.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="best-practices-bring-the-ai-to-the-data-not-the-data-to-the-ai"&gt;Best practices: bring the AI to the data, not the data to the AI&lt;a class="heading-anchor" href="#best-practices-bring-the-ai-to-the-data-not-the-data-to-the-ai" aria-label="Copy link to section: Best practices: bring the AI to the data, not the data to the AI" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Enterprise architects have converged on four guard-rails for safe, future-proof AI:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Guard-rail&lt;/th&gt;
 &lt;th&gt;Why it matters&lt;/th&gt;
 &lt;th&gt;Practical test&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Open, in-place storage&lt;/td&gt;
 &lt;td&gt;Avoid proprietary traps; support multi-cloud or on-prem moves&lt;/td&gt;
 &lt;td&gt;“If the vendor disappeared tomorrow, could I still read my data in Parquet/Delta/Iceberg?”&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Unified governance layer&lt;/td&gt;
 &lt;td&gt;Single set of fine-grained permissions, lineage, and audit logs&lt;/td&gt;
 &lt;td&gt;“Can I give a partner read-only access to one column and see every query they run?”&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Zero-copy sharing&lt;/td&gt;
 &lt;td&gt;Eliminate fragile CSV exports; revoke access instantly&lt;/td&gt;
 &lt;td&gt;“When a collaboration ends, can I cut off data without chasing down replicas?”&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Integrated model lifecycle&lt;/td&gt;
 &lt;td&gt;Training, registry, and serving inside the governed perimeter&lt;/td&gt;
 &lt;td&gt;“Can I trace every prediction back to its training dataset and code commit?”&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Platforms that deliver all four let you innovate quickly and satisfy CISOs and regulators.&lt;/p&gt;
&lt;h2 id="open-standards--give-ai-strict-access-without-handing-over-the-keys"&gt;Open Standards — Give AI Strict Access Without Handing Over the keys&lt;a class="heading-anchor" href="#open-standards--give-ai-strict-access-without-handing-over-the-keys" aria-label="Copy link to section: Open Standards — Give AI Strict Access Without Handing Over the keys" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before we look at any vendor implementation, it helps to know the building-block standards that let you:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;keep data right where it is&lt;/li&gt;
&lt;li&gt;yet expose just enough for analytics or AI&lt;/li&gt;
&lt;/ul&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Layer&lt;/th&gt;
 &lt;th&gt;Open standard&lt;/th&gt;
 &lt;th&gt;Why it matters&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Table formats&lt;/td&gt;
 &lt;td&gt;Apache Iceberg, Delta Lake, Apache Hudi, Parquet&lt;/td&gt;
 &lt;td&gt;Column-oriented, ACID-capable tables that sit in ordinary cloud storage and are readable by engines like Spark, Trino, Flink, etc. Iceberg&amp;rsquo;s spec is fully open, so any vendor can implement it—preventing lock-in and enabling multi-cloud lakes.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Governance / access control&lt;/td&gt;
 &lt;td&gt;Apache Ranger, Open Policy Agent, Unity Catalog, Lakekeeper&lt;/td&gt;
 &lt;td&gt;Centralize table/row/column policies, data masking, and audit logs across dozens of engines and clouds—without embedding rules in every service. Ranger policies even support dynamic row-level filters.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Data lineage&lt;/td&gt;
 &lt;td&gt;OpenLineage&lt;/td&gt;
 &lt;td&gt;A vendor-neutral API for emitting and collecting lineage events from Spark, Airflow, dbt, BigQuery, and more. Lets you trace every model back to the exact inputs that produced it.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Zero-copy data sharing&lt;/td&gt;
 &lt;td&gt;Delta Sharing (REST), Iceberg REST Catalog, Arrow Flight SQL&lt;/td&gt;
 &lt;td&gt;Instead of emailing CSVs, expose live tables through open protocols. Recipients query directly—Spark, Pandas, BI tools—while you keep full revocation and audit control. Delta Sharing is the first open REST protocol for this purpose; Iceberg&amp;rsquo;s REST catalog spec and Arrow Flight do the same for metadata and high-speed transport.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;What this unlocks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bring compute to data&lt;/strong&gt;. Spin up Spark, DuckDB, or an LLM fine-tuning job inside the VPC that owns the storage, using the open format directly. No data export required.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Share surgically&lt;/strong&gt;. Grant a vendor or partner a token that exposes only the columns or partitions they need, over an open protocol you can turn off instantly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stay future-proof.&lt;/strong&gt; Because storage and governance are defined by community specs, you can mix-and-match clouds or engines without rewriting pipelines.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With these open standards in place, any platform that respects them can satisfy the four guard-rails—open storage, unified governance, zero-copy sharing, in-platform ML.&lt;/p&gt;
&lt;h2 id="databricks-the-platform-that-delivers-all-four-guard-rails"&gt;Databricks: the platform that delivers all four guard-rails&lt;a class="heading-anchor" href="#databricks-the-platform-that-delivers-all-four-guard-rails" aria-label="Copy link to section: Databricks: the platform that delivers all four guard-rails" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Databricks&amp;rsquo; Lakehouse architecture assembles the pieces in one stack:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Delta Lake&lt;/strong&gt; - Open-source ACID tables on cloud object storage. You keep data in your S3/ADLS/GCS buckets; Databricks adds versioning, upserts, and time-travel without changing file formats.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unity Catalog&lt;/strong&gt; - A multicloud metastore that applies table/row/column permissions, tags, and audit logs across SQL, Python, BI dashboards, and ML pipelines. Governance once, enforced everywhere.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Delta Sharing&lt;/strong&gt; - The first open protocol for zero-copy sharing. Providers grant token-based access to live tables; recipients query in Spark, Pandas, Power BI, or even Snowflake without relocating data. Access is revocable in seconds.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MosaicML + Databricks Model Serving&lt;/strong&gt; - High-efficiency training and hosting of LLMs inside the Lakehouse. You fine-tune open-source or foundation models on proprietary data that never leaves your cloud account, then expose a governed HTTPS endpoint. All lineage (data → model → endpoint) is captured in Unity Catalog.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because compute clusters run inside your VPC, and storage stays in your buckets, data residency and encryption standards remain under your control. The Lakehouse “brings compute to data,” satisfying the four guard-rails by design.&lt;/p&gt;
&lt;p&gt;If you are already using Databricks for your data engineering needs, you are in safe hands, leverage these features for the greater good of your data strategy.&lt;/p&gt;
&lt;h2 id="how-the-other-majors-compareneutral-and-concise"&gt;How the other majors compare—neutral and concise&lt;a class="heading-anchor" href="#how-the-other-majors-compareneutral-and-concise" aria-label="Copy link to section: How the other majors compare—neutral and concise" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Area&lt;/th&gt;
 &lt;th&gt;Databricks&lt;/th&gt;
 &lt;th&gt;AWS&lt;/th&gt;
 &lt;th&gt;Google Cloud&lt;/th&gt;
 &lt;th&gt;Microsoft Azure&lt;/th&gt;
 &lt;th&gt;Snowflake&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Open table format&lt;/td&gt;
 &lt;td&gt;Delta Lake (native)&lt;/td&gt;
 &lt;td&gt;Iceberg &amp;amp; Hudi support via Glue&lt;/td&gt;
 &lt;td&gt;BigLake now queries Delta &amp;amp; Iceberg&lt;/td&gt;
 &lt;td&gt;Delta via Synapse Spark&lt;/td&gt;
 &lt;td&gt;Native storage is proprietary; external tables support Iceberg/Delta&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Central governance&lt;/td&gt;
 &lt;td&gt;Unity Catalog&lt;/td&gt;
 &lt;td&gt;Lake Formation + Glue Catalog&lt;/td&gt;
 &lt;td&gt;Dataplex + BigLake&lt;/td&gt;
 &lt;td&gt;Purview&lt;/td&gt;
 &lt;td&gt;Object tagging, masking policies&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Zero-copy sharing&lt;/td&gt;
 &lt;td&gt;Open Delta Sharing (any tool)&lt;/td&gt;
 &lt;td&gt;Cross-account Lake Formation permissions; Data Exchange&lt;/td&gt;
 &lt;td&gt;BigQuery authorized views; BigLake metadata&lt;/td&gt;
 &lt;td&gt;Azure Data Share (Azure-only)&lt;/td&gt;
 &lt;td&gt;Snowflake Secure Data Sharing (Snowflake-only)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;In-platform ML&lt;/td&gt;
 &lt;td&gt;Spark ML + MosaicML + Serving&lt;/td&gt;
 &lt;td&gt;SageMaker (integrated with Lake Formation)&lt;/td&gt;
 &lt;td&gt;Vertex AI (ties to BigQuery/BigLake)&lt;/td&gt;
 &lt;td&gt;Azure ML (ties to Synapse/ADLS)&lt;/td&gt;
 &lt;td&gt;Snowpark ML + Model Registry&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Control plane&lt;/td&gt;
 &lt;td&gt;Runs in vendor account; data plane in your VPC&lt;/td&gt;
 &lt;td&gt;All in AWS&lt;/td&gt;
 &lt;td&gt;All in Google Cloud&lt;/td&gt;
 &lt;td&gt;All in Azure&lt;/td&gt;
 &lt;td&gt;Managed by Snowflake (still in your cloud region)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Key take-aways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Every provider now markets a “lakehouse” story; the difference is openness and ecosystem lock-in.&lt;/li&gt;
&lt;li&gt;AWS, Google, and Azure each solve the problem well inside their cloud. Multi-cloud or future migration can be harder.&lt;/li&gt;
&lt;li&gt;Snowflake excels at instant sharing inside its service but requires you to load data into Snowflake storage (or at least pay Snowflake to query external tables).&lt;/li&gt;
&lt;li&gt;Databricks&amp;rsquo; bet is that open formats + open sharing + multi-cloud governance reduce long-term friction.&lt;/li&gt;
&lt;li&gt;Google Cloud&amp;rsquo;s BigLake provides external connection to Delta Lake and Iceberg&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="architecture-snapshot-for-engineers-and-data-scientists"&gt;Architecture snapshot for engineers and data scientists&lt;a class="heading-anchor" href="#architecture-snapshot-for-engineers-and-data-scientists" aria-label="Copy link to section: Architecture snapshot for engineers and data scientists" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/the-data-surrender-trap/the_data_surrender_trap_architecture_hu_ded7af8dfcddc93e.webp 780w, https://www.softinio.com/post/the-data-surrender-trap/the_data_surrender_trap_architecture_hu_99a521080e7128b4.webp 1164w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/the-data-surrender-trap/the_data_surrender_trap_architecture_hu_e5c81d56c0b067f6.png"
 alt="architecture diagram"
 width="780" height="733"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;External AI vendors have two strictly-controlled entry points&lt;/li&gt;
&lt;li&gt;Model-Serving API - They can request predictions from your governed endpoint—no direct data access required.&lt;/li&gt;
&lt;li&gt;Delta Sharing - If a vendor truly needs training or feature data, you grant a scoped, revocable token that exposes only the tables/columns you approve.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All other layers—compute, governance, storage—live inside your VPC / cloud account, so raw data never leaves your perimeter unless you explicitly share it through the Delta Sharing gateway.&lt;/p&gt;
&lt;h2 id="putting-it-into-practice---an-up-to-date-migration--safe-sharing-playbook"&gt;Putting It into Practice - an Up-to-Date Migration &amp;amp; Safe-Sharing Playbook&lt;a class="heading-anchor" href="#putting-it-into-practice---an-up-to-date-migration--safe-sharing-playbook" aria-label="Copy link to section: Putting It into Practice - an Up-to-Date Migration &amp;amp; Safe-Sharing Playbook" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Each step below tightens control, reduces copies, and shows how to give an external AI vendor only the data they truly need—without falling into the data-surrender trap.&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Step&lt;/th&gt;
 &lt;th&gt;Action&lt;/th&gt;
 &lt;th&gt;Why / Tips&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Inventory &amp;amp; classify&lt;/td&gt;
 &lt;td&gt;&lt;ul&gt;&lt;li&gt;Tag PII, payment data, trade secrets, regulated logs.&lt;/li&gt;&lt;li&gt;Record legal basis (GDPR, HIPAA, SOC-2 scope, etc.).&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
 &lt;td&gt;You can&amp;rsquo;t apply least-privilege sharing if you don&amp;rsquo;t know what&amp;rsquo;s sensitive.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Land everything in open, governed tables&lt;/td&gt;
 &lt;td&gt;&lt;ul&gt;&lt;li&gt;Convert CSV/Parquet to Delta / Iceberg with schema enforcement &amp;amp; time-travel.&lt;/li&gt;&lt;li&gt;Store in your S3 buckets / Google Cloud Storage; enable server-side encryption and object-lock.&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
 &lt;td&gt;Open formats + immutable history make later audits and deletions possible.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Switch on a unified catalog&lt;/td&gt;
 &lt;td&gt;&lt;ul&gt;&lt;li&gt;Unity Catalog / Lake Formation / Purview / Dataplex / Lakekeeper.&lt;/li&gt;&lt;li&gt;Import IAM groups, apply column masks, row filters, dynamic data tags (“pii = true”).&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
 &lt;td&gt;One policy engine ≫ dozens of per-tool ACLs.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Harden the perimeter&lt;/td&gt;
 &lt;td&gt;&lt;ul&gt;&lt;li&gt;Private subnets, VPC peering, and storage firewall rules so only approved compute can touch raw data.&lt;/li&gt;&lt;li&gt;Disable public buckets &amp;amp; open egress unless justified.&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
 &lt;td&gt;Keeps “shadow ETL” from copying data out the side door.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Safely share with an external AI vendor (zero-copy)&lt;/td&gt;
 &lt;td&gt;&lt;ol&gt;&lt;li&gt;Minimise first - aggregate, pseudonymise, or drop columns the vendor doesn&amp;rsquo;t need.&lt;/li&gt;&lt;li&gt;Create a Share (Delta Sharing / Iceberg REST / Arrow Flight):&lt;ul&gt;&lt;li&gt;Grant only the filtered table or view.&lt;/li&gt;&lt;li&gt;Attach row-level filters &amp;amp; column masks.&lt;/li&gt;&lt;li&gt;Issue a time-boxed bearer token (7-, 30-, or 90-day TTL) and pin it to the vendor&amp;rsquo;s IP range. Databricks DocumentationDatabricks&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Contract &amp;amp; controls - DPA, usage policy, no onward sharing.&lt;/li&gt;&lt;li&gt;Monitor - streaming audit of every query; set alerts for unusually large scans.&lt;/li&gt;&lt;li&gt;Revoke or rotate the token the moment the engagement ends (one CLI/API call).&lt;/li&gt;&lt;/ol&gt;&lt;/td&gt;
 &lt;td&gt;Zero-copy protocols let the vendor query live tables without replicating them. Instant revocation closes the door the second you&amp;rsquo;re done.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Move internal ML pipelines onto the platform&lt;/td&gt;
 &lt;td&gt;&lt;ul&gt;&lt;li&gt;Use Spark + MosaicML (or SageMaker/Vertex/Azure ML) inside the governed workspace.&lt;/li&gt;&lt;li&gt;Log models to a central registry; tag each with source-data lineage.&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
 &lt;td&gt;No more exporting giant CSVs to Jupyter on someone&amp;rsquo;s laptop.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Expose governed model endpoints&lt;/td&gt;
 &lt;td&gt;&lt;ul&gt;&lt;li&gt;Deploy behind Model Serving (or cloud equivalent).&lt;/li&gt;&lt;li&gt;Protect with catalog-level ACLs, network policies, and request logging.&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
 &lt;td&gt;External apps can call for predictions without direct data access.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Automate audits &amp;amp; drift detection&lt;/td&gt;
 &lt;td&gt;&lt;ul&gt;&lt;li&gt;Scheduled jobs that flag: - Tables without tags / owners - Shares approaching token expiry - Models trained on untagged data&lt;/li&gt;&lt;li&gt;Pipe findings to Slack / JIRA for triage.&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
 &lt;td&gt;Governance-as-code keeps guard-rails from eroding over time.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;: engineers still use the notebooks, SQL editors, and BI dashboards they love—but every byte of sensitive data stays in your buckets, under traceable, revocable control. External AI vendors get exactly the slice you permit, for exactly as long as you permit, with a full audit trail to keep everyone honest.&lt;/p&gt;
&lt;h2 id="conclusion---bring-ai-to-your-data-and-future-proof-the-business"&gt;Conclusion - Bring AI to Your Data and Future-Proof the Business&lt;a class="heading-anchor" href="#conclusion---bring-ai-to-your-data-and-future-proof-the-business" aria-label="Copy link to section: Conclusion - Bring AI to Your Data and Future-Proof the Business" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The AI race rewards the companies that can move fast without surrendering their crown-jewel data. The way to do that is simple—but non-negotiable:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Keep data where it lives&lt;/strong&gt; in your own cloud buckets or data centers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Wrap it in open standards&lt;/strong&gt;—Delta, Iceberg, Parquet, Ranger, OpenLineage, zero-copy sharing protocols—so any engine or vendor can work with it, and you can walk away at any time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Follow a disciplined playbook:&lt;/strong&gt; classify → convert → govern → harden → share surgically → train in-place → serve under guard → audit continuously.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Do those three things and you flip the script: instead of pushing raw tables out to a black-box vendor, you invite algorithms, fine-tuning jobs, and BI tools into a tightly controlled environment. The result is faster experimentation (no week-long data exports), fewer compliance nightmares (every read is logged and revocable), and zero re-platform tax when the next cloud, model, or regulation arrives.&lt;/p&gt;
&lt;p&gt;In short, &lt;strong&gt;bringing AI to your data—under open, governed standards—isn&amp;rsquo;t just best practice; it&amp;rsquo;s the only sustainable data strategy for the decade ahead.&lt;/strong&gt; Adopt it now, and each new AI breakthrough becomes an easy plugin rather than a risky migration. Your teams keep innovating, your security team keeps sleeping, and your customers keep trusting you with their data.&lt;/p&gt;</description></item><item><title>PostgreSQL: collation version mismatch</title><link>https://www.softinio.com/til/postgresql-collation-version-mismatch/</link><pubDate>Sun, 28 Jul 2024 00:00:00 +0000</pubDate><guid>https://www.softinio.com/til/postgresql-collation-version-mismatch/</guid><description>&lt;p&gt;I run my own instance of PeerTube which uses PostgreSQL as its database. When I tried to record my latest video, I got an error message that said:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[3397851] WARNING: database &amp;#34;peertube&amp;#34; has a collation version mismatch
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I had never seen this error before, so I did some research to figure out what was going on. It turns out that this error occurs when the collation version of the database does not match the collation version of the server. In my case, the collation version of the database was 2.38, while the collation version of the server was 2.39.&lt;/p&gt;
&lt;p&gt;I run NixOS, so this probably occured after I updated the system.&lt;/p&gt;
&lt;p&gt;To resolve this issue, I logged into my NixOS server and did the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Logged into the PostgreSQL database using the &lt;code&gt;psql&lt;/code&gt; command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;psql -h localhost -d postgres -U postgres
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;connected to my &lt;code&gt;peertube&lt;/code&gt; database:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;\c&lt;/span&gt; peertube
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Ran the following command:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;REINDEX&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;DATABASE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;peertube&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;DATABASE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;peertube&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;REFRESH&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;COLLATION&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;VERSION&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Logged out of psql:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;\q&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Restarted the peertube service:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;systemctl restart peertube
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note: use &lt;code&gt;sudo&lt;/code&gt; if you are not logged in as the &lt;code&gt;root&lt;/code&gt; user.&lt;/p&gt;</description></item><item><title>Migrating my markdown notes from Obsidian to Apple Notes</title><link>https://www.softinio.com/til/migrating-my-markdown-notes-from-obsidian-to-apple-notes/</link><pubDate>Sun, 03 Mar 2024 00:00:00 +0000</pubDate><guid>https://www.softinio.com/til/migrating-my-markdown-notes-from-obsidian-to-apple-notes/</guid><description>&lt;p&gt;So I wanted to migrate my markdown notes from Obsidian to Apple Notes. Apple Notes did not support import from markdown. I also wanted to maintain the folder structure.&lt;/p&gt;
&lt;p&gt;For every file I also wanted to maintain the title of the note. I wanted to prepend the title to the HTML file so that when I import the HTML file to Apple Notes, the title is correctly set. I did this by adding the file name (without the extension) as an &lt;code&gt;h1&lt;/code&gt; tag to the HTML file.&lt;/p&gt;
&lt;p&gt;I did this using &lt;a href="https://pandoc.org"&gt;pandoc&lt;/a&gt; and a bash script. Here is how I did it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;SRC_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;/obsidian_notes&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DEST_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;/notes_migrated_to_html&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;find &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$SRC_DIR&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; -type f -name &lt;span class="s2"&gt;&amp;#34;*.md&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="nv"&gt;IFS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; -r file&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Compute the subdirectory path&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;sub_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;dirname &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;file&lt;/span&gt;&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="nv"&gt;$SRC_DIR&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Compute the destination path&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;dest_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$DEST_DIR&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;$sub_dir&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Print the source and destination paths for logging purposes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;processing: [&lt;/span&gt;&lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="s2"&gt;] to [&lt;/span&gt;&lt;span class="nv"&gt;$dest_path&lt;/span&gt;&lt;span class="s2"&gt;]&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Create the destination directory structure&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; mkdir -p &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$dest_path&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Define the output HTML file path&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;output_html&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;dest_path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;basename &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;file&lt;/span&gt;&lt;span class="p"&gt;%.md&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.html&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Convert the Markdown file to HTML&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; pandoc &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; -o &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$output_html&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Extract the base filename without the extension for the title&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;base_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;basename &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; .md&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Prepend the title to the HTML file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;lt;h1&amp;gt;&lt;/span&gt;&lt;span class="nv"&gt;$base_name&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;cat &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$output_html&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &amp;gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$output_html&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I put the above script in a file called &lt;code&gt;convert_md_to_html.sh&lt;/code&gt; and made it executable using &lt;code&gt;chmod +x convert_md_to_html.sh&lt;/code&gt;. Then I ran the script using &lt;code&gt;./convert_md_to_html.sh&lt;/code&gt;. This script will convert all the markdown files in the &lt;code&gt;SRC_DIR&lt;/code&gt; to HTML files and put them in the &lt;code&gt;DEST_DIR&lt;/code&gt; while maintaining the folder structure. Then I imported the HTML files to Apple Notes using the &lt;code&gt;File -&amp;gt; Import to Notes&lt;/code&gt; option. This worked like a charm. I was able to maintain the folder structure and the notes were imported with the correct titles.&lt;/p&gt;</description></item><item><title>Converting HTML to Markdown using Markdownify</title><link>https://www.softinio.com/til/converting-html-to-markdown-using-markdownify/</link><pubDate>Tue, 26 Dec 2023 00:00:00 +0000</pubDate><guid>https://www.softinio.com/til/converting-html-to-markdown-using-markdownify/</guid><description>&lt;p&gt;I had some HTML content that I wanted to convert to markdown.&lt;/p&gt;
&lt;p&gt;The simplest tool I found to do this effectively was a python utility called &lt;a href="https://pypi.org/project/markdownify/"&gt;Markdownify&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I used Nix Shell to install it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nix-shell -p python311Packages.markdownify
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And to do the conversion I just did:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;markdownify myfile.html &amp;gt; myfile.md
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;where &lt;code&gt;myfile.html&lt;/code&gt; is the name of the file I wanted to convert and &lt;code&gt;myfile.md&lt;/code&gt; in the name of the markdown file it got converted to.&lt;/p&gt;</description></item><item><title>Configuring Github Pages With a Custom Domain</title><link>https://www.softinio.com/til/configuring-github-pages-with-a-custom-domain/</link><pubDate>Sat, 14 Jan 2023 16:45:33 -0800</pubDate><guid>https://www.softinio.com/til/configuring-github-pages-with-a-custom-domain/</guid><description>&lt;p&gt;To setup my custom domain I went through the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;Verify Domain:&lt;/em&gt; I followed &lt;a href="https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/verifying-your-custom-domain-for-github-pages"&gt;these steps&lt;/a&gt; to verify. Note that this was done using my GitHub accounts settings and not the repositories settings.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Configuring my subdomain:&lt;/em&gt; Next I configured my subdomain to be used as my custom domain with GitHub pages by following &lt;a href="https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site#configuring-a-subdomain"&gt;these steps&lt;/a&gt; which involved adding a CNAME record to my DNS settings with my domain registrar. Note that as I was using a subdomain adding a CNAME record was all that was needed (however if I was to use an apex domain, I would have needed to add A and AAAA records too pointing to GitHub&amp;rsquo;s ip addresses).&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Add CNAME file:&lt;/em&gt; You need to add a file called &lt;code&gt;CNAME&lt;/code&gt; to the root of your generated static site that contains your host name only (i.e. for this site &lt;code&gt;til.softinio&lt;/code&gt;). As I use Hugo, I put this in the &lt;code&gt;static&lt;/code&gt; directory as when the site is created it will be put in the root. Here is an &lt;a href="https://github.com/softinio/til/blob/main/static/CNAME"&gt;example&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Configuring GitHub Pages:&lt;/em&gt; Go to your repositories settings and select pages. Enter your domain name, save it and click check. Tick the box to enforce &lt;code&gt;https&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="notes"&gt;Notes&lt;a class="heading-anchor" href="#notes" aria-label="Copy link to section: Notes" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;This TIL does not cover setting up GitHub actions to build and deploy your code. Here is a &lt;a href="https://github.com/softinio/til/tree/main/.github/workflows"&gt;sample&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You need to have your site deployed at least once so that the &lt;code&gt;gh-pages&lt;/code&gt; branch is created so that you can set the site source branch in your repositories pages settings.&lt;/li&gt;
&lt;li&gt;To make sure your GitHub actions is able to create the &lt;code&gt;gh-pages&lt;/code&gt; branch, go to your repositories settings, then click &lt;code&gt;Actions&lt;/code&gt; then &lt;code&gt;General&lt;/code&gt; and under the &lt;code&gt;workflow permissions&lt;/code&gt; section make sure the &lt;code&gt;read and write permissions&lt;/code&gt; is selected and saved.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="references"&gt;References&lt;a class="heading-anchor" href="#references" aria-label="Copy link to section: References" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gohugo.io/hosting-and-deployment/hosting-on-github/"&gt;Hugo Documentation for hosting on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Announcing My New Site for Great Technical Video Content</title><link>https://www.softinio.com/post/announcing-my-new-site-for-great-technical-video-content/</link><pubDate>Mon, 22 Nov 2021 18:07:52 -0800</pubDate><guid>https://www.softinio.com/post/announcing-my-new-site-for-great-technical-video-content/</guid><description>&lt;h2 id="announcing-watchsoftiniocom"&gt;Announcing &lt;a href="https://watch.softinio.com"&gt;watch.softinio.com&lt;/a&gt;&lt;a class="heading-anchor" href="#announcing-watchsoftiniocom" aria-label="Copy link to section: Announcing watch.softinio.com" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I am thrilled to announce my new video website &lt;a href="https://watch.softinio.com"&gt;watch.softinio.com&lt;/a&gt;, a place for great technical talk content ad free and free from commercial sponsorship.&lt;/p&gt;
&lt;p&gt;As many of you know I used to organize meetup/technical talks in the bay area (and later virtually online since the start of the pandemic) in the past. To get the ball rolling with some content, you can now watch a selection of the technical talks that were done at meetups I had arranged. This collection includes some of the greatest speakers from the Scala, Nix, Elasticsearch and Functional Programming world whom I had the honor of hosting.&lt;/p&gt;
&lt;p&gt;You can find this collection here: &lt;a href="https://watch.softinio.com/c/softinio/videos"&gt;https://watch.softinio.com/c/softinio/videos&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I have always been interested in doing talks, attending talks and hosting talks. Here I just want to have a space for great technical content with no commerical strings attached. Think of it as a group of friends getting together for a book club and sharing their learnings and recordings of it.&lt;/p&gt;
&lt;p&gt;This site is powered by &lt;a href="https://joinpeertube.org/"&gt;PeerTube&lt;/a&gt; a decentralized alternative to YouTube. It allows me to federate my instance with other like minded PeerTube instances sharing content. For example you will find excellent content on OCaml and Debian Linux distribution on my site thanks to the federations I have setup with more to come.&lt;/p&gt;
&lt;p&gt;I will be producing a lot of new content of my own here, including doing some live streams. Some of this of course, will also be made available on my &lt;a href="https://softin.io/youtube"&gt;YouTube channel&lt;/a&gt;.&lt;/p&gt;
&lt;div class="peertube"&gt;
&lt;iframe sandbox="allow-same-origin allow-scripts allow-popups" loading="lazy"
 src="https://watch.softinio.com/videos/embed/e7548279-6a4c-46ae-80ed-5d434bb86f53?title=0&amp;warningTitle=0&amp;peertubeLink=0" title="PeerTube video" allowfullscreen&gt;
&lt;/iframe&gt;
&lt;/div&gt;
&lt;p class="video-fallback"&gt;&lt;a href="https://watch.softinio.com/w/e7548279-6a4c-46ae-80ed-5d434bb86f53" target="_blank" rel="noopener"&gt;▶ Watch on PeerTube&lt;/a&gt;&lt;/p&gt;

&lt;h2 id="can-i-post-my-content-on-your-site"&gt;Can I post my content on your site?&lt;a class="heading-anchor" href="#can-i-post-my-content-on-your-site" aria-label="Copy link to section: Can I post my content on your site?" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I would love to have more content from friends that share the same interests. Get in touch with me to discuss. Of course creating your own PeerTube instance and federating with my instance is always welcome if we share the same interests too.&lt;/p&gt;
&lt;h2 id="how-do-i-register-for-your-site-or-subscribe-to-channels-or-comment-on-videos"&gt;How do I register for your site or subscribe to channels or comment on videos?&lt;a class="heading-anchor" href="#how-do-i-register-for-your-site-or-subscribe-to-channels-or-comment-on-videos" aria-label="Copy link to section: How do I register for your site or subscribe to channels or comment on videos?" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Peertube is powered using &lt;a href="https://w3c.github.io/activitypub/"&gt;Activitypub&lt;/a&gt;, which means you can use your activitypub account from any other service that supports this protocol to comment on a video or subscribe to a channel.&lt;/p&gt;
&lt;p&gt;If you need an account, I highly recommend joining &lt;a href="https://fosstodon.org/about"&gt;fosstodon&lt;/a&gt;. If you do join, you can &lt;a href="https://fosstodon.org/@softinio"&gt;follow me&lt;/a&gt; there too.&lt;/p&gt;
&lt;h2 id="but-i-love-youtube"&gt;But I love YouTube&lt;a class="heading-anchor" href="#but-i-love-youtube" aria-label="Copy link to section: But I love YouTube" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Then subscribe to my &lt;a href="https://softin.io/youtube"&gt;YouTube channel&lt;/a&gt; for my content and yes all the meetup content are still on YouTube too where they were originally posted after the event (mostly on &lt;a href="http://functional.tv"&gt;functional.tv&lt;/a&gt; and &lt;a href="https://www.youtube.com/channel/UCx317LNd-AlbTcE_0FkdJcg"&gt;SFBayAreaTechies&lt;/a&gt;).&lt;/p&gt;</description></item><item><title>Unicomp New Model M Keyboard</title><link>https://www.softinio.com/post/unicomp-new-model-m-keyboard/</link><pubDate>Fri, 18 Dec 2020 20:08:42 -0800</pubDate><guid>https://www.softinio.com/post/unicomp-new-model-m-keyboard/</guid><description>&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_new_model_m_hu_177077c8c6af1952.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_new_model_m_hu_4fa4414529114682.png"
 alt="Unicomp Model M"
 width="640" height="480"
 loading="eager" fetchpriority="high" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;Unicomp new Model M keyboard is the latest version of the classic and fabulous IBM Model M keyboard that came out earlier this year. This blog post is my unboxing and review of this timeless keyboard.&lt;/p&gt;
&lt;p&gt;My favorite keyboard of all time was the &lt;a href="https://en.wikipedia.org/wiki/Model_M_keyboard"&gt;IBM Model M keyboard&lt;/a&gt;. Through out the 1980s and the 1990s I would exclusively use this keyboard. In fact as I type this blog post I can confirm I still have 3 of them in my garage back in London, England.&lt;/p&gt;
&lt;p&gt;Ever since I moved to the USA, both at work and at home I have been using various keyboards by Apple. Though I have nothing bad to say about the Apple keyboards, after all they are cosmetically pleasing, of high build quality and work really well with all things Apple, I started really missing my IBM Model M. This is when I found out Unicomp have released a new Model M and I decided to buy one.&lt;/p&gt;
&lt;h2 id="who-are-unicomp"&gt;Who are Unicomp?&lt;a class="heading-anchor" href="#who-are-unicomp" aria-label="Copy link to section: Who are Unicomp?" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When IBM decided to stop manufacturing keyboards, a company called Lexmark bought their equipment and all rights to their keyboards and continued making them. In turn Lexmark stopped manufacturing keyboards too and at that point some ex-IBM and ex-Lexmark staff got together, purchased all the manufacturing equipment and rights to continue manufacturing the keyboards (but of course without the IBM and Lexmark branding) and setup a new company called &lt;code&gt;Unicomp&lt;/code&gt;. &lt;a href="https://www.pckeyboard.com/"&gt;Unicomp&lt;/a&gt; has since continued producing these keyboards for like the last 25 years.&lt;/p&gt;
&lt;h2 id="unboxing"&gt;Unboxing&lt;a class="heading-anchor" href="#unboxing" aria-label="Copy link to section: Unboxing" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This is how it was delivered:&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_model_m_box_hu_ef609866a71f0c62.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_model_m_box_hu_db66bb4ddae678c5.jpg"
 alt="Unicomp New Model M box"
 width="640" height="480"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;When the package arrived I could feel the keyboard moving inside the box, but when I opened the box I saw how well it was packed:&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_model_m_open_box_hu_751a4afae578deb0.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_model_m_open_box_hu_b8de42c348d6af4a.jpg"
 alt="Unicomp New Model M opened box"
 width="640" height="480"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;I took it out of its box and removed all packaging material it was wrapped in:&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_model_m_out_of_box_hu_d0aba184b57589ec.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_model_m_out_of_box_hu_f93fbad82672df8c.jpg"
 alt="Unicomp New Model M Keyboard"
 width="640" height="480"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;h2 id="review"&gt;Review&lt;a class="heading-anchor" href="#review" aria-label="Copy link to section: Review" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As I looked at the keyboard, before taking it out of the box, I could immediately tell it was a Model M and its evolution. Super excited and impatient I took it out of the box. My first observation was that it comes with a USB (standard not USB-C) cable that is not removable. It felt lighter in weight than the original IBM Model M I had. Next I looked at its build quality and was overall impressed. The original IBM Model M does feel more robust but I could not fault this new Model M. All this was to be expected though, as I didn&amp;rsquo;t have my expectation set to receiving a keyboard that is made by 100% the same materials as the original Model M I had.&lt;/p&gt;
&lt;p&gt;Having one of the newer macbooks with only USB-C ports, I set my new keyboard on my desk and plugged it in via a USB adapter and off I went looking for excuses to type so I can use my new keyboard.&lt;/p&gt;
&lt;p&gt;I am thoroughly enjoying using this keyboard. Its typing feel and size are on par with the original Model M I had. I had forgotten how much more comfortable it is to type on Model M than an Apple keyboard. Comparing now, I can see that my hands are too big for the Apple keyboards so I would try to type in a cramped space to fit my hands in, as opposed to this Model M which is perfect for my hand size. This alone has resulted in me being able type faster, be more comfortable and make virtually no typing mistakes. As always I find the higher actuation point feel and the audible feedback the sound provided by the buckling springs with each keystroke incredibly pleasing. Comparing the sound of the buckling springs with the original IBM Model M, I would say the new Unicomp Model M is slightly quieter.&lt;/p&gt;
&lt;h3 id="how-well-does-it-work-with-macos"&gt;How well does it work with macOS&lt;a class="heading-anchor" href="#how-well-does-it-work-with-macos" aria-label="Copy link to section: How well does it work with macOS" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When I went to place my order on Unicomp website they only had a windows version of the new Model M listed. Whilst that will work fine with macOS, it does have some features missing compared to a keyboard that has dedicated support for macOS, such as volume control, music play/stop/previous track /next track keys. Good news is I called Unicomp and spoke to Troy about this and he was kind enought to tell me I can place an order and request a custom configuration at a small fee to have the extra macOS features added. I did that and my keyboard has all the extra macOS keys functioning as expected. It even has the window key replaced with the macOS command key.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_model_m_mac_keys_hu_549db1a20752fc7b.webp 780w, https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_model_m_mac_keys_hu_99643aff857f383c.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/unicomp-new-model-m-keyboard/unicomp_model_m_mac_keys_hu_927d82e1686f2884.jpg"
 alt="Unicomp New Model M with macOS layout"
 width="780" height="585"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;h3 id="unicomp-quality-of-service"&gt;Unicomp quality of service&lt;a class="heading-anchor" href="#unicomp-quality-of-service" aria-label="Copy link to section: Unicomp quality of service" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When you first visit Unicomp website, you get the sense that you just visited a website from 20 years ago with not the best user experience browsing or ordering. When you research Unicomp on the internet you won&amp;rsquo;t find much activity on social media or any form of marketing.&lt;/p&gt;
&lt;p&gt;Please do not be put off by this and don&amp;rsquo;t judge them because of their dated look. The quality of service I received is one of the best I have ever received. When I called to find out more about the New Model M not only was the help I received exemplarity, but once I placed my order, even though it had the custom configuration of macOS support added was shipped within 24 hours of placing the order and the item received is fantastic in every possible way.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;a class="heading-anchor" href="#conclusion" aria-label="Copy link to section: Conclusion" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I am back again reunited with my old friend a Model M. I am enjoying using it so much after a gap of not having one that I am looking for excuses to use it more and more. So expect more &lt;a href="https://www.softinio.com"&gt;blogs&lt;/a&gt; and &lt;a href="https://notes.softinio.com"&gt;newsletters&lt;/a&gt; from me going forward, as this keyboard is a joy to use.&lt;/p&gt;
&lt;h2 id="references"&gt;References&lt;a class="heading-anchor" href="#references" aria-label="Copy link to section: References" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.pckeyboard.com/page/product/NEW_M"&gt;Link to Unicomp Model M that I ordered&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Introduction to Zio Actors</title><link>https://www.softinio.com/post/introduction-to-zio-actors/</link><pubDate>Sun, 01 Nov 2020 14:14:21 -0800</pubDate><guid>https://www.softinio.com/post/introduction-to-zio-actors/</guid><description>&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/introduction-to-zio-actors/ZIO_hu_5e7abc2694463537.webp 780w, https://www.softinio.com/post/introduction-to-zio-actors/ZIO_hu_1e40d5b6867f0de5.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/introduction-to-zio-actors/ZIO_hu_7fb8c61bcaacc43c.png"
 alt="ZIO"
 width="780" height="318"
 loading="eager" fetchpriority="high" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;In this post I am going to do a quick introduction to using the &lt;a href="https://zio.github.io/zio-actors/"&gt;ZIO Actors&lt;/a&gt;, a library that implements the Actor model using Scala and ZIO a library for asynchroneous and concurrent programming.&lt;/p&gt;
&lt;p&gt;Before reading this post it is recommended that you read my two earlier posts &lt;a href="https://www.softinio.com/post/introduction-to-the-actor-model/"&gt;Introduction to the Actor Model&lt;/a&gt; and &lt;a href="https://www.softinio.com/post/introduction-to-akka-typed-using-scala/"&gt;Introduction to Akka Typed Using Scala&lt;/a&gt; as I have assumed the reader will be familiar with the concepts discussed in those posts. Some basic knowledge of &lt;a href="https://zio.dev"&gt;ZIO&lt;/a&gt; is assumed.&lt;/p&gt;
&lt;p&gt;I will be going through the same example as I covered in my Introduction to Akka post, only this time I am using ZIO Actors instead of Akka.&lt;/p&gt;
&lt;h2 id="problem-to-solve"&gt;Problem to solve&lt;a class="heading-anchor" href="#problem-to-solve" aria-label="Copy link to section: Problem to solve" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To get start we are going to build a simple mailing list application where a persons name and email address are added to a datastore and we are able to retrieve their details and remove them from the datastore. As the scope of this example is to show how we can use zio actors to build an application, our data store will be a pretend one.&lt;/p&gt;
&lt;p&gt;The diagram below illustrates the actors that we will need and the message flow between each actor.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/introduction-to-zio-actors/zio_actor_system_design_hu_d839fa525bb9d414.webp 780w, https://www.softinio.com/post/introduction-to-zio-actors/zio_actor_system_design_hu_829bd22791c858e3.webp 1248w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/introduction-to-zio-actors/zio_actor_system_design_hu_fa7c2e88d644d280.png"
 alt="ZIO Actor System Design Example"
 width="780" height="781"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ZIO Actor System&lt;/code&gt;: Creates the actor system and spawns all the actors.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Validate Email Address Actor&lt;/code&gt;: Validates if the new message received has a valid email address&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Datastore Actor&lt;/code&gt;: Decides which datastore &lt;code&gt;Command&lt;/code&gt; (i.e. &lt;code&gt;Add&lt;/code&gt;, &lt;code&gt;Get&lt;/code&gt; or &lt;code&gt;Remove&lt;/code&gt;) we are actioning and calls the relevant actor with the message.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Add Action Actor&lt;/code&gt;: Uses the message received to add the received subscriber to the database.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Get Subscriber Actor&lt;/code&gt;: Retrieves a subscriber from the database.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Remove Subscriber Actor&lt;/code&gt;: Removes a subscriber from the database.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="messages-and-types"&gt;Messages and Types&lt;a class="heading-anchor" href="#messages-and-types" aria-label="Copy link to section: Messages and Types" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Lets start by defining the types of the messages our actors are going to be passing.&lt;/p&gt;
&lt;p&gt;First our actors are going to be sending on of three types of commands to either add, remove or get a subscriber from the datastore:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;sealed&lt;/span&gt; &lt;span class="k"&gt;trait&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;Add&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;Remove&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;Get&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The message type to add a subscriber:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;sealed&lt;/span&gt; &lt;span class="k"&gt;trait&lt;/span&gt; &lt;span class="nc"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;+A&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nc"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Message&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Command&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;ActorRef&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;replyTo&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;ActorRef&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Unit&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;isValid&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;UIO&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Boolean&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;UIO&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;EmailValidator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getInstance&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="n"&gt;isValid&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The message type for sending a reply to the requester:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SubscribedMessage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subscriberId&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Long&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;ActorRef&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Unit&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The exception type if an invalid message is sent to an actor:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;InvalidEmailException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Throwable&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The message type of message retrieved from the datastore when a &lt;code&gt;Get&lt;/code&gt; command is received:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Customer&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Unit&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="validate-email-address-actor"&gt;Validate Email Address Actor&lt;a class="heading-anchor" href="#validate-email-address-actor" aria-label="Copy link to section: Validate Email Address Actor" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;subscriber&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Stateful&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Console&lt;/span&gt;, &lt;span class="kt"&gt;Unit&lt;/span&gt;, &lt;span class="kt"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;receive&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;A&lt;/span&gt;&lt;span class="o"&gt;](&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Unit&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;protocol&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;A&lt;/span&gt;&lt;span class="o"&gt;],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Context&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;RIO&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Console&lt;/span&gt;, &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Unit&lt;/span&gt;, &lt;span class="kt"&gt;A&lt;/span&gt;&lt;span class="o"&gt;)]&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;protocol&lt;/span&gt; &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Message&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;putStrLn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;s&amp;#34;Validating &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; with email &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;!&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;valid&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isValid&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;self&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;replyTo&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nc"&gt;SubscribedMessage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1L&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;valid&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;valid&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="o"&gt;((),&lt;/span&gt; &lt;span class="o"&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;IO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fail&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;InvalidEmailException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Failed&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When creating actors we need to define how the actor reacts to messages and how they are processed. Looking at the above code you will see that we are creating a &lt;code&gt;Stateful&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="what-is-stateful"&gt;What is Stateful&lt;a class="heading-anchor" href="#what-is-stateful" aria-label="Copy link to section: What is Stateful" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Stateful is the data type we use to describe a behavior with zio-actors:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nc"&gt;Stateful&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;R&lt;/span&gt;, &lt;span class="kt"&gt;S&lt;/span&gt;, &lt;span class="kt"&gt;-F&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;+&lt;/span&gt;&lt;span class="k"&gt;_&lt;/span&gt;&lt;span class="o"&gt;]]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What do the type parameters represents:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;R&lt;/code&gt; represents the environment type (similar to &lt;code&gt;R&lt;/code&gt; in &lt;code&gt;ZIO[R, E, A]&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;S&lt;/code&gt; represents the state of the actor that gets updated after every message.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;F&lt;/code&gt; represents the message the actor will receive to process.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="how-validate-email-address-actor-work"&gt;How Validate Email Address Actor Work&lt;a class="heading-anchor" href="#how-validate-email-address-actor-work" aria-label="Copy link to section: How Validate Email Address Actor Work" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Looking at the code snippet above you will see a new &lt;code&gt;Stateful&lt;/code&gt; is created, for the &lt;code&gt;R&lt;/code&gt; (environment type) we are passing Console which is an Environment provided by ZIO which allows you to log messages to the console. The state of this actor does not change after each message is processed and hence it &lt;code&gt;S&lt;/code&gt; type which represents state is set to &lt;code&gt;Unit&lt;/code&gt;. &lt;code&gt;Protocol&lt;/code&gt; is the types of messages our actor can process. We went through definition of this type &lt;a href="https://www.softinio.com/post/introduction-to-zio-actors/#messages-and-types-"&gt;earlier in the post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By creating a new &lt;code&gt;Stateful&lt;/code&gt; we override its &lt;code&gt;receive&lt;/code&gt; method (similar to &lt;code&gt;akka&lt;/code&gt;) that implements the actual behavior. Here we pattern match on the message received to make sure it is of type &lt;code&gt;Message&lt;/code&gt; and if so we use a for comprehension to go through a few steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Call the message&amp;rsquo;s &lt;code&gt;isValid&lt;/code&gt; method to verify it contains a valid email address. Only continue if valid.&lt;/li&gt;
&lt;li&gt;Get the &lt;code&gt;ActorRef&lt;/code&gt; for &lt;code&gt;self&lt;/code&gt;, i.e. the current actor.&lt;/li&gt;
&lt;li&gt;The message received contains an &lt;code&gt;ActorRef&lt;/code&gt; to reply to. Send a message &lt;code&gt;SubscribedMessage&lt;/code&gt; to this actor (this includes the &lt;code&gt;ActorRef&lt;/code&gt; of self that was obtained in the last step).&lt;/li&gt;
&lt;li&gt;send the message received onto the datastore actor&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From the pattern matching you can see that if you do not receive a message of type &lt;code&gt;Message&lt;/code&gt;, &lt;code&gt;IO.fail&lt;/code&gt; which is provided by &lt;code&gt;ZIO&lt;/code&gt; is used to surface the failure.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;receive&lt;/code&gt; method returns &lt;code&gt;RIO[Console, (Unit, A)]&lt;/code&gt; which is an alias for &lt;code&gt;ZIO[Console, Throwable, (Unit, A)]&lt;/code&gt; which highlights that a tuple is returned for a success.&lt;/p&gt;
&lt;h2 id="datastore-actor"&gt;Datastore Actor&lt;a class="heading-anchor" href="#datastore-actor" aria-label="Copy link to section: Datastore Actor" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This actor is responsible for adding, removing and fetching a &lt;code&gt;Customer&lt;/code&gt; from the datastore.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;datastore&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Stateful&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Console&lt;/span&gt;, &lt;span class="kt"&gt;Unit&lt;/span&gt;, &lt;span class="kt"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;receive&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;A&lt;/span&gt;&lt;span class="o"&gt;](&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Unit&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;protocol&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Protocol&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;A&lt;/span&gt;&lt;span class="o"&gt;],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Context&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;RIO&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Console&lt;/span&gt;, &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Unit&lt;/span&gt;, &lt;span class="kt"&gt;A&lt;/span&gt;&lt;span class="o"&gt;)]&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;protocol&lt;/span&gt; &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Message&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;putStrLn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;s&amp;#34;Processing Command&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Add&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;putStrLn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;s&amp;#34;Adding message with email: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Remove&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;putStrLn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;s&amp;#34;Removing message with email: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Get&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;putStrLn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;s&amp;#34;Getting message with email: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="o"&gt;((),&lt;/span&gt; &lt;span class="o"&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;IO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fail&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;InvalidEmailException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Failed&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Similar to the &lt;a href="https://www.softinio.com/post/introduction-to-zio-actors/#how-validate-email-address-actor-work-"&gt;Validate Email Address Actor&lt;/a&gt;, this actor creates a new stateful with same type parameters. Overrides &lt;code&gt;receive&lt;/code&gt; to implement behavior. Pattern match the received message to make sure it is of type &lt;code&gt;Message&lt;/code&gt; and if not does &lt;code&gt;IO.fail&lt;/code&gt;. If correct message it does the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;pattern match on the command field of the message to determine which command we have received.&lt;/li&gt;
&lt;li&gt;For each command take the appropriate action. As this is a contrived example we just log what we are doing instead of an actual interaction with a database by calling another actor.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="creating-the-actor-system"&gt;Creating the Actor System&lt;a class="heading-anchor" href="#creating-the-actor-system" aria-label="Copy link to section: Creating the Actor System" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;program&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;actorSystemRoot&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="nc"&gt;ActorSystem&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;salarTestActorSystem&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;subscriberActor&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;actorSystemRoot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;subscriberActor&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Supervisor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;none&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;subscriber&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;datastoreActor&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;actorSystemRoot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;datastoreActor&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Supervisor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;none&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;datastore&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;replyActor&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;actorSystemRoot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;replyActor&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Supervisor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;none&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;reply&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;subscriberActor&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nc"&gt;Message&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;Salar&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,.&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;Rahmanian&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s"&gt;&amp;#34;code@softinio.com&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;datastoreActor&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;replyActor&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;_&lt;/span&gt; &lt;span class="k"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;zio&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;clock&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Duration&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Infinity&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="o"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With ZIO Actors as everything is a ZIO effect we can use a for comprehension to create our system. Looking at the above code snippet you can see we start by creating an &lt;code&gt;ActorSystem&lt;/code&gt;. We then use the &lt;code&gt;.make&lt;/code&gt; property of our &lt;code&gt;ActorSystem&lt;/code&gt; to create all the actors. Now we are ready to create our &lt;code&gt;Message&lt;/code&gt; and start sending to the message to the &lt;code&gt;subscriberActor&lt;/code&gt; we created. As you can see the &lt;code&gt;ActorRef&lt;/code&gt; of the &lt;code&gt;dataStoreActor&lt;/code&gt; and &lt;code&gt;replyActor&lt;/code&gt; are included in the message so that the correct actor is used to store the message and the correct actor is used to send the reply.&lt;/p&gt;
&lt;h2 id="summary"&gt;Summary&lt;a class="heading-anchor" href="#summary" aria-label="Copy link to section: Summary" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this post I have just tried to give you a feel for what its like to use zio-actors, how to think about your application in terms of Actors and message passing and to get started. As you can see zio-actors leverages ZIO as a library and functional programmming to the max leading to a very composable and readable solution.&lt;/p&gt;
&lt;p&gt;zio-actors has many other features and patterns of use which I will be blogging in more details about in the future so follow my post as I try to share my learnings with everyone.&lt;/p&gt;
&lt;h2 id="useful-resources"&gt;Useful Resources&lt;a class="heading-anchor" href="#useful-resources" aria-label="Copy link to section: Useful Resources" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/softinio/pat"&gt;My Sample Application used in this post&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://zio.github.io/zio-actors/"&gt;ZIO Actors Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://zio.dev"&gt;ZIO Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Introduction to Akka Typed Using Scala</title><link>https://www.softinio.com/post/introduction-to-akka-typed-using-scala/</link><pubDate>Sat, 24 Oct 2020 20:32:41 -0700</pubDate><guid>https://www.softinio.com/post/introduction-to-akka-typed-using-scala/</guid><description>&lt;p&gt;
 &lt;img src="https://www.softinio.com/post/introduction-to-akka-typed-using-scala/akka_logo.svg"
 alt="akka"
 loading="eager" fetchpriority="high" /&gt;
&lt;/p&gt;
&lt;p&gt;In this post I am going to do a quick introduction to using the Akka Typed toolkit that implements the Actor model using Scala. As part of this post I will be developing a simple application using Akka. My goal is to highlight what its like to develop applications using Akka and how to get started with it. I will be following up this post with more posts diving into Akka in more details and exploring more of its features and patterns you can use to solve concurrent and distributed applications.&lt;/p&gt;
&lt;p&gt;Before reading this post it is recommended that you read my earlier post &lt;a href="https://www.softinio.com/post/introduction-to-the-actor-model/"&gt;Introduction to the Actor Model&lt;/a&gt; as I have assumed the reader will be familiar with the concepts discussed in that post.&lt;/p&gt;
&lt;h2 id="problem-to-solve"&gt;Problem to solve&lt;a class="heading-anchor" href="#problem-to-solve" aria-label="Copy link to section: Problem to solve" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To get start we are going to build a simple mailing list application where a persons name and email address are added to a datastore and we are able to retrieve their details and remove them from the datastore. As the scope of this example is to show how we can use Akka to build applications our data store will be a pretend one.&lt;/p&gt;
&lt;p&gt;The diagram below illustrates the actors that we will need and the message flow between each actor.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/introduction-to-akka-typed-using-scala/akka_actor_system_design_hu_9c0de37b6d5cb179.webp 780w, https://www.softinio.com/post/introduction-to-akka-typed-using-scala/akka_actor_system_design_hu_5e1af8074bdbee03.webp 1248w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/introduction-to-akka-typed-using-scala/akka_actor_system_design_hu_bbe45466621bf517.png"
 alt="Akka Actor System Design Example"
 width="780" height="781"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Root Actor&lt;/code&gt;: Creates the actor system and spawns all the actors.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Validate Email Address Actor&lt;/code&gt;: Validates if the new message received has a valid email address&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Datastore Actor&lt;/code&gt;: Decides which datastore &lt;code&gt;Command&lt;/code&gt; (i.e. &lt;code&gt;Add&lt;/code&gt;, &lt;code&gt;Get&lt;/code&gt; or &lt;code&gt;Remove&lt;/code&gt;) we are actioning and calls the relevant actor with the message.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Add Action Actor&lt;/code&gt;: Uses the message received to add the received subscriber to the database.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Get Subscriber Actor&lt;/code&gt;: Retrieves a subscriber from the database.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Remove Subscriber Actor&lt;/code&gt;: Removes a subscriber from the database.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="messages-and-types"&gt;Messages and Types&lt;a class="heading-anchor" href="#messages-and-types" aria-label="Copy link to section: Messages and Types" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Lets start by defining the types of the messages our actors are going to be passing.&lt;/p&gt;
&lt;p&gt;First our actors are going to be sending on of three types of commands to either add, remove or get a subscriber from the datastore:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;sealed&lt;/span&gt; &lt;span class="k"&gt;trait&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;Add&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;Remove&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;Get&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Command&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The message type to add a subscriber:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Customer&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The message type to add a subscriber by the root actor:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Message&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Command&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;ActorRef&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Message&lt;/span&gt;&lt;span class="o"&gt;],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;replyTo&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;ActorRef&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;SubscribedMessage&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;isValid&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Boolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;EmailValidator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getInstance&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="n"&gt;isValid&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This type is identical to the &lt;code&gt;Customer&lt;/code&gt; type except we are including &lt;code&gt;ActorRef&lt;/code&gt; for the actors to use to save the subscriber and the actor to use to reply to the caller. The &lt;code&gt;Message&lt;/code&gt; type also has a property that checks to make sure the received message has a valid email address.&lt;/p&gt;
&lt;h2 id="validate-email-address-actor"&gt;Validate Email Address Actor&lt;a class="heading-anchor" href="#validate-email-address-actor" aria-label="Copy link to section: Validate Email Address Actor" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;Subscriber&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;apply&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Behavior&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Message&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Behaviors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;receive&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;info&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;s&amp;#34;Validating &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; with email &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;!&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isValid&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;replyTo&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nc"&gt;SubscribedMessage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1L&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;info&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;s&amp;#34;Received an invalid message &lt;/span&gt;&lt;span class="si"&gt;$message&lt;/span&gt;&lt;span class="s"&gt;.emailAddress&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Behaviors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;same&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When creating actors we need to define how the actor reacts to messages and how they are processed. Looking at the above code you will see that we are creating a &lt;code&gt;Behavior&lt;/code&gt; which takes a &lt;code&gt;Message&lt;/code&gt; type. &lt;code&gt;Behaviors.receive&lt;/code&gt; provides a &lt;code&gt;context&lt;/code&gt; and the &lt;code&gt;message&lt;/code&gt; received (which is of type &lt;code&gt;Message&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;This actors behavior is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It uses &lt;code&gt;context&lt;/code&gt; to log messages&lt;/li&gt;
&lt;li&gt;The Received &lt;code&gt;message&lt;/code&gt;&amp;rsquo;s &lt;code&gt;isValid&lt;/code&gt; property is used to check if the message contains a valid email and if it does then the actors job is done and it sends a message to two other actors, a reply actor confirming the message has been accepted and a message to the storage actor which saves the message in our datastore. Note that the references to the actors it is going to send a message to is included in the message received. If the message is invalid, an appropriate message is logged and no further action is taken.&lt;/li&gt;
&lt;li&gt;Lastly, &lt;code&gt;Behaviors.same&lt;/code&gt; is called to indicate to the system to reuse the previous actor behavior for the next message. For more information about the different behaviors you can return visit &lt;a href="https://doc.akka.io/api/akka/current/akka/actor/typed/scaladsl/Behaviors$.html"&gt;Behaviors API Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="datastore-actor"&gt;Datastore Actor&lt;a class="heading-anchor" href="#datastore-actor" aria-label="Copy link to section: Datastore Actor" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This actor is responsible for adding, removing and fetching a &lt;code&gt;Customer&lt;/code&gt; from the datastore.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;Datastore&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;apply&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Behavior&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Message&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Behaviors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;receive&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;info&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;s&amp;#34;Adding &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; with email &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;!&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Add&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;s&amp;#34;Adding message with email: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Send message to Add Action Actor
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Remove&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;s&amp;#34;Removing message with email: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Send message to Remove Subscriber Actor
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Get&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;s&amp;#34;Getting message with email: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Send message to Get Subscriber Actor
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Behaviors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;same&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;Message&lt;/code&gt; received contains a &lt;code&gt;Command&lt;/code&gt;, the behavior defined for this actor is to use pattern matching to determine and &lt;code&gt;Add&lt;/code&gt; to the datastore, &lt;code&gt;Remove&lt;/code&gt; from the datastore or to &lt;code&gt;Get&lt;/code&gt; from the datastore. The appropriate message is sent to the actor that will carry out the action as illustrated in my diagram and code snippet above.&lt;/p&gt;
&lt;p&gt;The resulting behavior for this actor is also &lt;code&gt;Behaviors.same&lt;/code&gt; as it is not changing in any way and its behavior will be the same all the time.&lt;/p&gt;
&lt;h2 id="creating-the-actor-system"&gt;Creating the Actor System&lt;a class="heading-anchor" href="#creating-the-actor-system" aria-label="Copy link to section: Creating the Actor System" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;ActorsMain&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;apply&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Behavior&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Customer&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Behaviors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setup&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;subscriber&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;spawn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Subscriber&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;subscriber&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;spawn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Datastore&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;db&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Behaviors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;receiveMessage&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 	&lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;replyTo&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;spawn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Reply&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;reply&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;subscriber&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nc"&gt;Message&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAddress&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="n"&gt;replyTo&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nc"&gt;Behaviors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;same&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;object&lt;/span&gt; &lt;span class="nc"&gt;Pat&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;actorsMain&lt;/span&gt;&lt;span class="k"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;ActorSystem&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;Customer&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ActorSystem&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ActorsMain&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;PatSystem&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;actorsMain&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nc"&gt;Customer&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Salar&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;Rahmanian&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;code@softinio.com&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The root actor spawns all the new actors and as a result has the &lt;code&gt;ActorRef&lt;/code&gt; for all the actors.&lt;/p&gt;
&lt;p&gt;Looking at the above code snippet you can see that we are creating a &lt;code&gt;Behavior&lt;/code&gt; of type &lt;code&gt;Customer&lt;/code&gt;, which is the type of the message we are going to receive. As this is the outer most actor in our actor hierachy, &lt;code&gt;Behaviors.setup&lt;/code&gt; is used to spawn all the actors we have. When a new message is received, a message is sent to the subscriber actor (which is our validate email address actor).&lt;/p&gt;
&lt;p&gt;In the applications &lt;code&gt;main&lt;/code&gt; (i.e. &lt;code&gt;Pat&lt;/code&gt; object), we create the &lt;code&gt;ActorSystem&lt;/code&gt; and start sending &lt;code&gt;Customer&lt;/code&gt; messages.&lt;/p&gt;
&lt;h2 id="summary"&gt;Summary&lt;a class="heading-anchor" href="#summary" aria-label="Copy link to section: Summary" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this post I have just tried to give you a feel for what its like to use akka, how to think about your application in terms of Actors and message passing and to get started. Akka offers a lot of awesome features so stay tuned and follow my blog as we explore and learn about akka. You can look at the application we discussed in this post &lt;a href="https://github.com/softinio/pat"&gt;here on GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="useful-resources"&gt;Useful Resources&lt;a class="heading-anchor" href="#useful-resources" aria-label="Copy link to section: Useful Resources" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/softinio/pat"&gt;My Sample Application used in this post&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://akka.io/docs/"&gt;Akka Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=Qb9Cnii-34c"&gt;Conference talk introducing Akka Typed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://lampwww.epfl.ch/~hmiller/scala2014/proceedings/p23-he.pdf"&gt;Typecasting Actors: from Akka to TAkka&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Introduction to the Actor Model</title><link>https://www.softinio.com/post/introduction-to-the-actor-model/</link><pubDate>Sun, 04 Oct 2020 11:23:12 -0700</pubDate><guid>https://www.softinio.com/post/introduction-to-the-actor-model/</guid><description>&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/introduction-to-the-actor-model/introduction_to_the_actor_model_hu_3f2a6cdb3fe6388a.webp 780w, https://www.softinio.com/post/introduction-to-the-actor-model/introduction_to_the_actor_model_hu_e2cc36d763762c74.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/introduction-to-the-actor-model/introduction_to_the_actor_model_hu_a7c00ebb03e831b3.png"
 alt="Actors"
 width="780" height="378"
 loading="eager" fetchpriority="high" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;My first proper computer was an IBM PC clone with an Intel 486 processor. It had a button on it called &lt;code&gt;turbo&lt;/code&gt; that when you pushed it would run the processor at double the speed. I say proper as before that I had started my computer journey with a Sinclair ZX Spectrum (48k Ram) and a Commodore 64 (64k Ram) hence didn&amp;rsquo;t consider them as serious contenders for this post. It has been a really exciting ride watching hardware and software evolve together. The interesting observation has been that as faster more powerful hardware has come out, software has been quick to grab all the extra speed and resources the new hardware provides.&lt;/p&gt;
&lt;p&gt;Watching how CPU&amp;rsquo;s have evolved, in the early days it was all about clock speed and cache as the main optimizations to improve performance. However in the later years multicore and hyperthreading has been the driving factor to improve performance. This means that in current times to reap the maximum performance benefits that are offered by todays processors we need to write our software leveraging concurrency.&lt;/p&gt;
&lt;p&gt;There are many methods and patterns of concurrency. In this post I am going to focus on the actor model.&lt;/p&gt;
&lt;h2 id="what-is-an-actor-"&gt;What is an Actor ?&lt;a class="heading-anchor" href="#what-is-an-actor-" aria-label="Copy link to section: What is an Actor ?" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;An actor is an entity that receives a message and does some processing on the received message as a self contained concurrent operation.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/introduction-to-the-actor-model/actor_hu_db1b0999bdd45110.webp 780w, https://www.softinio.com/post/introduction-to-the-actor-model/actor_hu_6ba9a9e8d692520d.webp 1500w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/introduction-to-the-actor-model/actor_hu_67d7ebf32ab48f25.png"
 alt="Actor"
 width="780" height="217"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;An Actor consists of an isolated internal state, an address, a mailbox and a behavior.&lt;/p&gt;
&lt;p&gt;The address is a unique reference used to locate the actor so that you can send a message to it. It will include all the information you need, such as the protocol used to communicate with the actor.&lt;/p&gt;
&lt;p&gt;Once an actor receives a message, it adds the message to its mailbox. You can think of the mailbox as queue where the actor picks up the next message it needs to process. Actors process one message at a time. The actor patterns specification does say that the order of messages received is not guaranteed, but different implementations of the actor pattern do offer choices on mailbox type which do offer options on how messages received are prioritized for processing.&lt;/p&gt;
&lt;p&gt;The behavior determines what the actor needs to do with the message it receives. It will involve some processing of the message with some business logic which may include a side effect. Plus it will need to decide what to do next after processing.&lt;/p&gt;
&lt;p&gt;Once it has finished processing the message, the actor will do one of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Does nothing, only needed to run the behavior on the received message&lt;/li&gt;
&lt;li&gt;Sends messages to other existing actors&lt;/li&gt;
&lt;li&gt;Creates a new actor and sends a message to it&lt;/li&gt;
&lt;li&gt;Respond to the sender zero or more times&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="characteristics-of-an-actor"&gt;Characteristics of an Actor&lt;a class="heading-anchor" href="#characteristics-of-an-actor" aria-label="Copy link to section: Characteristics of an Actor" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One of the differentiating characteristics of an actor is that it persists and has an isolated internal state.&lt;/p&gt;
&lt;p&gt;What this means is that once an actor is started it will keep running, processing messages from its inbox and won&amp;rsquo;t stop unless you stop it. It will maintain its state through out and only the actor has access to this state. This is unlike your traditional asynchronous programming, such as using Future in Scala or promises in javascript where once the call has finished its state between calls is not maintained and the call has finished.&lt;/p&gt;
&lt;p&gt;This ability gives actors super powers when building concurrent applications.&lt;/p&gt;
&lt;h2 id="handling-failure-with-actors"&gt;Handling Failure with Actors&lt;a class="heading-anchor" href="#handling-failure-with-actors" aria-label="Copy link to section: Handling Failure with Actors" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In an actor system every actor has a supervisor who is responsible for handling failures. Supervisors are actors themselves but with the sole responsability of continuity for the actor it is supervising and handling any failures that occur. In the case of the supervisor actor its behavior is what you want it to do in case of such failure. Most implementations of the actor model will provide you with several types of supervisors, each using a different strategy for handling failures but you will have the option of creating your own custom supervisors too. Supervisors make it possible for actor&amp;rsquo;s to self heal and continue.&lt;/p&gt;
&lt;h2 id="comparing-actors-with-traditional-object-oriented-programming"&gt;Comparing Actors with traditional object oriented programming&lt;a class="heading-anchor" href="#comparing-actors-with-traditional-object-oriented-programming" aria-label="Copy link to section: Comparing Actors with traditional object oriented programming" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Lets go through a contrived simple example, lets say you are a store that sells oranges. You have 10 oranges in stock. You have two customers who try to buy 7 oranges each. As you don&amp;rsquo;t have enough oranges you cannot serve both customers requests for oranges.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/introduction-to-the-actor-model/oop_oranges_example_hu_8aa9c869426b1110.webp 780w, https://www.softinio.com/post/introduction-to-the-actor-model/oop_oranges_example_hu_8180fcb946734d3a.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/introduction-to-the-actor-model/oop_oranges_example_hu_45c12f6ecda36419.png"
 alt="Object Oriented Programming Flow Example"
 width="780" height="396"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;In a normal object oriented (multi-threadeed) program a customer would send a request to a service requesting the oranges they want. They expect a reply right away and wait for the response. When the request is received a check is made against the database to make sure there are enough oranges to fulfill the request (i.e. number of oranges &amp;gt;= 7) and if so, a success will be returned to the customer and 7 oranges will be deducted from the total orange count, python like pseudo code:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_oranges&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number_of_oranges&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;oranges_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db_call_to_get_oranges&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;oranges_list_len&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;oranges_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;oranges_list_len&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;number_of_oranges&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;update_oranges&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;oranges&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;number_of_oranges&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;oranges_list&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="n"&gt;number_of_oranges&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the second customer places their order at the same time, as our application is multi-threaded, there is a chance the check to get the current list of oranges will return the full list before the first customers purchase of 7 oranges has been deducted from the number of oranges available which will result in us returning a success by mistake even though we don&amp;rsquo;t have enough oranges available. To avoid this race condition extra work needs to be done to prevent it, such as using locks or other appropriate mechanisms.&lt;/p&gt;
&lt;p&gt;Using the Actor model this kind of race condition is avoided.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/introduction-to-the-actor-model/actor_oranges_example_hu_cfa63599a2aa777.webp 780w, https://www.softinio.com/post/introduction-to-the-actor-model/actor_oranges_example_hu_4a2ac6184b4b3ed0.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/introduction-to-the-actor-model/actor_oranges_example_hu_81915eef15d4cde5.png"
 alt="Actor Programming Flow Example"
 width="780" height="262"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;When each of the two requests are received, they will placed in the actor&amp;rsquo;s inbox. The actor processes one request at a time from the inbox. The actors state are the oranges and updates to it are done whilst processing a single request which completes before the next request is fetched and processed from the inbox, thereby avoiding any potention race condition.&lt;/p&gt;
&lt;h2 id="notable-implementations-of-the-actor-model"&gt;Notable Implementations of the Actor Model&lt;a class="heading-anchor" href="#notable-implementations-of-the-actor-model" aria-label="Copy link to section: Notable Implementations of the Actor Model" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Language/Framework&lt;/th&gt;
 &lt;th&gt;Link&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;akka (Java, Scala)&lt;/td&gt;
 &lt;td&gt;&lt;a href="https://akka.io"&gt;akka&lt;/a&gt;&lt;/td&gt;
 &lt;td&gt;Framework implementing the actor model on the JVM&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;akka.net (C#)&lt;/td&gt;
 &lt;td&gt;&lt;a href="https://getakka.net/index.html"&gt;akka.net&lt;/a&gt;&lt;/td&gt;
 &lt;td&gt;Framework implementing the actor model for C# and .net&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Erlang&lt;/td&gt;
 &lt;td&gt;&lt;a href="https://www.erlang.org"&gt;Erlang OTP&lt;/a&gt;&lt;/td&gt;
 &lt;td&gt;A Programming language and VM that implements the actor model&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Elixir&lt;/td&gt;
 &lt;td&gt;&lt;a href="https://elixir-lang.org"&gt;Elixir&lt;/a&gt;&lt;/td&gt;
 &lt;td&gt;A Programming language that compiles down to Erlang bytecode&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Orleans (C#)&lt;/td&gt;
 &lt;td&gt;&lt;a href="https://dotnet.github.io/orleans/"&gt;orleans&lt;/a&gt;&lt;/td&gt;
 &lt;td&gt;Framework implementing the actor model for C# and .net&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;zio-actors (Scala)&lt;/td&gt;
 &lt;td&gt;&lt;a href="https://zio.github.io/zio-actors/"&gt;zio-actors&lt;/a&gt;&lt;/td&gt;
 &lt;td&gt;A high-performance, purely-functional library for building, composing, and supervising typed actors based on ZIO using Scala&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="next"&gt;Next&lt;a class="heading-anchor" href="#next" aria-label="Copy link to section: Next" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This was a rather short introduction to the actor model. Follow my blog for my follow-up posts on the actor model and my experience using it. In the meanwhile, it would be wonderful if my readers who are currently using this model could share using the comments below what problems they are solving with it and which implementation (language and/or framework) of the actor model they are using.&lt;/p&gt;</description></item><item><title>Scale By The Bay 2018 San Francisco</title><link>https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/</link><pubDate>Thu, 02 May 2019 18:30:40 -0700</pubDate><guid>https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/</guid><description>&lt;p&gt;One of the highlights of 2018 was attending and being part of the Scale By the bay 2018 conference in San Francisco. This by far was the best conference I have ever attended.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scalebythebay_2018_header_hu_b4b04f551cbc10e4.webp 780w, https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scalebythebay_2018_header_hu_da6b6e3180bd09a9.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scalebythebay_2018_header_hu_9fbdd044649d1466.jpg"
 alt="Scale By the Bay 2018"
 width="780" height="780"
 loading="eager" fetchpriority="high" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;from left: &lt;a href="https://twitter.com/dickwall"&gt;Dick Wall&lt;/a&gt;, &lt;a href="https://twitter.com/SalarRahmanian"&gt;Salar Rahmanian&lt;/a&gt;, &lt;a href="https://twitter.com/odersky"&gt;Martin Odersky (Creator of Scala)&lt;/a&gt;, &lt;a href="https://twitter.com/ChiefScientist"&gt;Alexy Khrabrov&lt;/a&gt;, &lt;a href="https://twitter.com/jodersky"&gt;Jakob Odersky &lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The conference had 3 tracks covering the functional programming, reactive programming and data science topics. All the talks were of high quality made even better by highly intelligent audience made up of the most talented stars of our industry.&lt;/p&gt;
&lt;h2 id="keynotes"&gt;Keynotes&lt;a class="heading-anchor" href="#keynotes" aria-label="Copy link to section: Keynotes" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scalebythebay_2018_keynotes_hu_ad4acf751aae30e8.webp 780w, https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scalebythebay_2018_keynotes_hu_9214ca5d3c094667.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scalebythebay_2018_keynotes_hu_67bd4bbd7619787f.jpg"
 alt="Scale By the Bay 2018 Keynotes"
 width="780" height="780"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;h3 id="new-functional-constructs-in-scala-3-by-martin-odersky-creator-of-scala"&gt;New Functional Constructs in Scala 3 by Martin Odersky (Creator of Scala)&lt;a class="heading-anchor" href="#new-functional-constructs-in-scala-3-by-martin-odersky-creator-of-scala" aria-label="Copy link to section: New Functional Constructs in Scala 3 by Martin Odersky (Creator of Scala)" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The first keynote was by the creator of Scala Programming language. He took us through some of the new constructs we are likely to see in the upcoming major release of Scala3. Overall the audience was very excited about the new constructs and what is coming up. There were a few people I had talked to at the conference who had concerns that we are heading for another python2 -&amp;gt; python3 situation causing a split in the community and some hesitation in desire to upgrade as there will be some breaking changes.&lt;/p&gt;
&lt;p&gt;I personally am excited about the new features coming out and am optimistic about the success of the new version. In addition there will be new tooling the scala center is working on that will help with migrating to the new version. Let&amp;rsquo;s not forget Scala is strongly typed which will help a lot with the migration unlike languages like Python.&lt;/p&gt;
&lt;div class="yv"&gt;
 &lt;button type="button" class="yv-play" data-id="6P06YHc8faw" data-title="YouTube video" aria-label="Play video: YouTube video"&gt;
 &lt;img src="https://i.ytimg.com/vi/6P06YHc8faw/sddefault.jpg"
 srcset="https://i.ytimg.com/vi/6P06YHc8faw/hqdefault.jpg 480w, https://i.ytimg.com/vi/6P06YHc8faw/sddefault.jpg 640w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 alt="" width="640" height="480" loading="lazy" /&gt;
 &lt;svg viewBox="0 0 68 48" aria-hidden="true"&gt;&lt;path d="M66.5 7.7a8.5 8.5 0 0 0-6-6C55.3.3 34 .3 34 .3s-21.3 0-26.5 1.4a8.5 8.5 0 0 0-6 6C.1 13 .1 24 .1 24s0 11 1.4 16.3a8.5 8.5 0 0 0 6 6C12.7 47.7 34 47.7 34 47.7s21.3 0 26.5-1.4a8.5 8.5 0 0 0 6-6C67.9 35 67.9 24 67.9 24s0-11-1.4-16.3z" fill="#f00"/&gt;&lt;path d="M45 24 27 14v20z" fill="#fff"/&gt;&lt;/svg&gt;
 &lt;/button&gt;
&lt;/div&gt;
&lt;p class="video-fallback"&gt;&lt;a href="https://www.youtube.com/watch?v=6P06YHc8faw" target="_blank" rel="noopener"&gt;▶ Watch on YouTube&lt;/a&gt;&lt;/p&gt;

&lt;h3 id="kafka-and-the-rise-of-the-event-driven-microservices-by-neha-narkhede-co-creator-of-apache-kafka"&gt;Kafka and the Rise of the event driven Microservices by Neha Narkhede (Co-creator of Apache Kafka)&lt;a class="heading-anchor" href="#kafka-and-the-rise-of-the-event-driven-microservices-by-neha-narkhede-co-creator-of-apache-kafka" aria-label="Copy link to section: Kafka and the Rise of the event driven Microservices by Neha Narkhede (Co-creator of Apache Kafka)" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This keynote started off by asking the audience who uses Kafka in Production today. It was fascinating to see that 95% of the audience were which is a huge endorsement of Kafka.&lt;/p&gt;
&lt;p&gt;One of the initial and primary use cases for using Kafka has been to build data pipelines, this keynote focused on the next evolution of Kafka where it is used to build event driven applications and microservices. The standard mindset has been to design and implement your apps based around static data, Kafka helps us design apps based around continuely streaming data.&lt;/p&gt;
&lt;p&gt;This new paradigm will allow us to take data from your applications and data from your data systems like databases and do stream processing on them to produce.&lt;/p&gt;
&lt;div class="yv"&gt;
 &lt;button type="button" class="yv-play" data-id="DOoJzaXOGxs" data-title="YouTube video" aria-label="Play video: YouTube video"&gt;
 &lt;img src="https://i.ytimg.com/vi/DOoJzaXOGxs/sddefault.jpg"
 srcset="https://i.ytimg.com/vi/DOoJzaXOGxs/hqdefault.jpg 480w, https://i.ytimg.com/vi/DOoJzaXOGxs/sddefault.jpg 640w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 alt="" width="640" height="480" loading="lazy" /&gt;
 &lt;svg viewBox="0 0 68 48" aria-hidden="true"&gt;&lt;path d="M66.5 7.7a8.5 8.5 0 0 0-6-6C55.3.3 34 .3 34 .3s-21.3 0-26.5 1.4a8.5 8.5 0 0 0-6 6C.1 13 .1 24 .1 24s0 11 1.4 16.3a8.5 8.5 0 0 0 6 6C12.7 47.7 34 47.7 34 47.7s21.3 0 26.5-1.4a8.5 8.5 0 0 0 6-6C67.9 35 67.9 24 67.9 24s0-11-1.4-16.3z" fill="#f00"/&gt;&lt;path d="M45 24 27 14v20z" fill="#fff"/&gt;&lt;/svg&gt;
 &lt;/button&gt;
&lt;/div&gt;
&lt;p class="video-fallback"&gt;&lt;a href="https://www.youtube.com/watch?v=DOoJzaXOGxs" target="_blank" rel="noopener"&gt;▶ Watch on YouTube&lt;/a&gt;&lt;/p&gt;

&lt;h2 id="concurrency-and-more-concurrency"&gt;Concurrency and more concurrency&lt;a class="heading-anchor" href="#concurrency-and-more-concurrency" aria-label="Copy link to section: Concurrency and more concurrency" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There was a common theme at this years conference, multiple talks about libraries and patterns to make concurrency and parallel processing easier and over coming the pain points associated with it.&lt;/p&gt;
&lt;p&gt;Jakob Odesky talk summarized the concurrency options available to you within Scala Language and the JVM such as threads, Futures and Promises. He then went on to talk about Scala Center &amp;rsquo;s &lt;a href="https://github.com/scala/scala-async"&gt;scala-async&lt;/a&gt; library which has lead him to his new open source project &lt;a href="https://github.com/jodersky/escale"&gt;escale&lt;/a&gt; which is built on top of scala-async. This new library, escale, introduces the same concept as channels and green threads that was introduced by the go programming language for scala. I look forward to seeing how this evolves.&lt;/p&gt;
&lt;div class="yv"&gt;
 &lt;button type="button" class="yv-play" data-id="EuNEZW8ljeY" data-title="YouTube video" aria-label="Play video: YouTube video"&gt;
 &lt;img src="https://i.ytimg.com/vi/EuNEZW8ljeY/sddefault.jpg"
 srcset="https://i.ytimg.com/vi/EuNEZW8ljeY/hqdefault.jpg 480w, https://i.ytimg.com/vi/EuNEZW8ljeY/sddefault.jpg 640w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 alt="" width="640" height="480" loading="lazy" /&gt;
 &lt;svg viewBox="0 0 68 48" aria-hidden="true"&gt;&lt;path d="M66.5 7.7a8.5 8.5 0 0 0-6-6C55.3.3 34 .3 34 .3s-21.3 0-26.5 1.4a8.5 8.5 0 0 0-6 6C.1 13 .1 24 .1 24s0 11 1.4 16.3a8.5 8.5 0 0 0 6 6C12.7 47.7 34 47.7 34 47.7s21.3 0 26.5-1.4a8.5 8.5 0 0 0 6-6C67.9 35 67.9 24 67.9 24s0-11-1.4-16.3z" fill="#f00"/&gt;&lt;path d="M45 24 27 14v20z" fill="#fff"/&gt;&lt;/svg&gt;
 &lt;/button&gt;
&lt;/div&gt;
&lt;p class="video-fallback"&gt;&lt;a href="https://www.youtube.com/watch?v=EuNEZW8ljeY" target="_blank" rel="noopener"&gt;▶ Watch on YouTube&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Michael Pilquist gave us a nice update on &lt;code&gt;cats-effect&lt;/code&gt; took us through an overview of some of the features it has to solve concurrency problems. There was lot of content in his talk for me to summarize in this post so I urge you to watch the video of his talk.&lt;/p&gt;
&lt;div class="yv"&gt;
 &lt;button type="button" class="yv-play" data-id="Gig-f_HXvLI" data-title="YouTube video" aria-label="Play video: YouTube video"&gt;
 &lt;img src="https://i.ytimg.com/vi/Gig-f_HXvLI/sddefault.jpg"
 srcset="https://i.ytimg.com/vi/Gig-f_HXvLI/hqdefault.jpg 480w, https://i.ytimg.com/vi/Gig-f_HXvLI/sddefault.jpg 640w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 alt="" width="640" height="480" loading="lazy" /&gt;
 &lt;svg viewBox="0 0 68 48" aria-hidden="true"&gt;&lt;path d="M66.5 7.7a8.5 8.5 0 0 0-6-6C55.3.3 34 .3 34 .3s-21.3 0-26.5 1.4a8.5 8.5 0 0 0-6 6C.1 13 .1 24 .1 24s0 11 1.4 16.3a8.5 8.5 0 0 0 6 6C12.7 47.7 34 47.7 34 47.7s21.3 0 26.5-1.4a8.5 8.5 0 0 0 6-6C67.9 35 67.9 24 67.9 24s0-11-1.4-16.3z" fill="#f00"/&gt;&lt;path d="M45 24 27 14v20z" fill="#fff"/&gt;&lt;/svg&gt;
 &lt;/button&gt;
&lt;/div&gt;
&lt;p class="video-fallback"&gt;&lt;a href="https://www.youtube.com/watch?v=Gig-f_HXvLI" target="_blank" rel="noopener"&gt;▶ Watch on YouTube&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My favorite talk of the conference was a talk by Sergei Winitzki on Declarative distributed concurrency in Scala where he talk about his open source project &lt;a href="https://github.com/Chymyst/chymyst-core"&gt;Chymyst&lt;/a&gt; which implements the chemical machine (based on joint calculus). The philosophy and end goal of the chemical machine is to be able to process what ever problem you are trying to solve in 15 lines or less of code. Containers holding values are known as &lt;code&gt;molecules&lt;/code&gt;. Molecules float around the site until they combine to form a chemical reaction the output of which can be used again. In his implementation partial functions where used to implement the reactions. I loved the analogy to chemistry and Sergei&amp;rsquo;s presentation really explained the concept well to spark my interest in this. Since his talk I have researched the topic of chemical machines and I could only find research papers on the topic and none of them do as good a job in explaining what it is as the talk did so I urge you to watch the video.&lt;/p&gt;
&lt;div class="yv"&gt;
 &lt;button type="button" class="yv-play" data-id="23O32DMm69E" data-title="YouTube video" aria-label="Play video: YouTube video"&gt;
 &lt;img src="https://i.ytimg.com/vi/23O32DMm69E/sddefault.jpg"
 srcset="https://i.ytimg.com/vi/23O32DMm69E/hqdefault.jpg 480w, https://i.ytimg.com/vi/23O32DMm69E/sddefault.jpg 640w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 alt="" width="640" height="480" loading="lazy" /&gt;
 &lt;svg viewBox="0 0 68 48" aria-hidden="true"&gt;&lt;path d="M66.5 7.7a8.5 8.5 0 0 0-6-6C55.3.3 34 .3 34 .3s-21.3 0-26.5 1.4a8.5 8.5 0 0 0-6 6C.1 13 .1 24 .1 24s0 11 1.4 16.3a8.5 8.5 0 0 0 6 6C12.7 47.7 34 47.7 34 47.7s21.3 0 26.5-1.4a8.5 8.5 0 0 0 6-6C67.9 35 67.9 24 67.9 24s0-11-1.4-16.3z" fill="#f00"/&gt;&lt;path d="M45 24 27 14v20z" fill="#fff"/&gt;&lt;/svg&gt;
 &lt;/button&gt;
&lt;/div&gt;
&lt;p class="video-fallback"&gt;&lt;a href="https://www.youtube.com/watch?v=23O32DMm69E" target="_blank" rel="noopener"&gt;▶ Watch on YouTube&lt;/a&gt;&lt;/p&gt;

&lt;h2 id="heros-welcome"&gt;Hero’s welcome&lt;a class="heading-anchor" href="#heros-welcome" aria-label="Copy link to section: Hero’s welcome" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Over the years in my career I have followed many of the people I met at this years conference. Their work and teachings have helped me progress my knowledge and ability and have motivated me and others to be part of a great community.&lt;/p&gt;
&lt;p&gt;Here are some pictures of the tech heroes I got to meet at this conference:&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_1_hu_c5b29359b3c3f5c3.webp 780w, https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_1_hu_e09c787a412ad388.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_1_hu_cd749446525abbdf.JPG"
 alt="Scale By the Bay 2018 "
 width="780" height="780"
 loading="lazy" /&gt;
 &lt;/picture&gt;

Top left: &lt;a href="https://twitter.com/tpolecat"&gt;Rob Norris (creator of Doobie)&lt;/a&gt;, Top right: &lt;a href="https://twitter.com/rossabaker"&gt;Ross Baker (creator of http4s)&lt;/a&gt;,
Bottom left: &lt;a href="https://twitter.com/mpilquist"&gt;Michael Pilquist (Creator of FS2)&lt;/a&gt;, Bottom right: &lt;a href="https://twitter.com/propensive/"&gt;Jon Pretty (Scala Center Advisory board chair)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_2_hu_731c04d2a134d121.webp 780w, https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_2_hu_c0d4be1f2aac2983.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_2_hu_73b9e455b2651fbc.JPG"
 alt="Scale By the Bay 2018"
 width="780" height="780"
 loading="lazy" /&gt;
 &lt;/picture&gt;

&lt;a href="https://twitter.com/runarorama"&gt;Runar Bjarnason &lt;/a&gt; &amp;amp; &lt;a href="https://twitter.com/pchiusano"&gt;Paul Chiusano&lt;/a&gt; authors of the book &lt;a href="https://www.manning.com/books/functional-programming-in-scala"&gt;Functional Programming in Scala&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_4_hu_f935b7af9f6244c8.webp 780w, https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_4_hu_1288d9bcdc26effe.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_4_hu_751591636c2e5602.JPG"
 alt="Scale By the Bay 2018"
 width="780" height="780"
 loading="lazy" /&gt;
 &lt;/picture&gt;

Top left: &lt;a href="https://twitter.com/eed3si9n"&gt;Eugene Yokota (Scala/SBT Team)&lt;/a&gt; , Top right: &lt;a href="https://twitter.com/ebenwert"&gt;Justin Kaeser (Jetbrains)&lt;/a&gt;,
Bottom left: &lt;a href="https://twitter.com/cliff_click"&gt;Cliff Click&lt;/a&gt;, Bottom right: &lt;a href="https://twitter.com/J_"&gt;Julien Le Dem (Apache Parquet &amp;amp; Arrow)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_3_hu_d59354f1dd2704f5.webp 780w, https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_3_hu_37facfe3d9479c01.webp 1560w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/scale-by-the-bay-2018-san-francisco/scale_by_the_bay_2018_3_hu_b4acc38122c80201.JPG"
 alt="Scale By the Bay 2018"
 width="780" height="780"
 loading="lazy" /&gt;
 &lt;/picture&gt;

Top: &lt;a href="https://twitter.com/jdegoes"&gt;John De Goes (Creator of ZIO) &lt;/a&gt; &amp;amp; &lt;a href="https://twitter.com/itrvd"&gt;Itamar Ravid (Core contributor to ZIO)&lt;/a&gt;,
Bottom: &lt;a href="https://twitter.com/propensive/"&gt;Jon Pretty (Scala Center Advisory board chair)&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="thank-you"&gt;Thank you&lt;a class="heading-anchor" href="#thank-you" aria-label="Copy link to section: Thank you" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I am humbled that I got a chance to meet so many great people at this conference, for the first time in person, and hope to keep in touch going forward.&lt;/p&gt;
&lt;p&gt;I want to thank all speakers and attendees at this event, especially I want to thank &lt;a href="https://twitter.com/ChiefScientist"&gt;Alexy Khrabrov&lt;/a&gt; for putting together such a great event, welcoming me to the bay area and helping me be part of the great community we have in the bay area and this conference.&lt;/p&gt;
&lt;div class="yv"&gt;
 &lt;button type="button" class="yv-play" data-id="iTeh-wnvweQ" data-title="YouTube video" aria-label="Play video: YouTube video"&gt;
 &lt;img src="https://i.ytimg.com/vi/iTeh-wnvweQ/sddefault.jpg"
 srcset="https://i.ytimg.com/vi/iTeh-wnvweQ/hqdefault.jpg 480w, https://i.ytimg.com/vi/iTeh-wnvweQ/sddefault.jpg 640w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 alt="" width="640" height="480" loading="lazy" /&gt;
 &lt;svg viewBox="0 0 68 48" aria-hidden="true"&gt;&lt;path d="M66.5 7.7a8.5 8.5 0 0 0-6-6C55.3.3 34 .3 34 .3s-21.3 0-26.5 1.4a8.5 8.5 0 0 0-6 6C.1 13 .1 24 .1 24s0 11 1.4 16.3a8.5 8.5 0 0 0 6 6C12.7 47.7 34 47.7 34 47.7s21.3 0 26.5-1.4a8.5 8.5 0 0 0 6-6C67.9 35 67.9 24 67.9 24s0-11-1.4-16.3z" fill="#f00"/&gt;&lt;path d="M45 24 27 14v20z" fill="#fff"/&gt;&lt;/svg&gt;
 &lt;/button&gt;
&lt;/div&gt;
&lt;p class="video-fallback"&gt;&lt;a href="https://www.youtube.com/watch?v=iTeh-wnvweQ" target="_blank" rel="noopener"&gt;▶ Watch on YouTube&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Moving from Homebrew to Nix Package Manager</title><link>https://www.softinio.com/post/moving-from-homebrew-to-nix-package-manager/</link><pubDate>Sat, 16 Feb 2019 18:30:40 -0700</pubDate><guid>https://www.softinio.com/post/moving-from-homebrew-to-nix-package-manager/</guid><description>&lt;p&gt;As all my friends, colleagues and followers know I am very big on functional programming, so when I heard about nixOS and the nix package manager (A Purely Functional package manager) I really wanted to find out more about it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Quote from&lt;/strong&gt; &lt;a href="https://nixos.org/nix/"&gt;Nix&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Nix is a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible. It provides atomic upgrades and rollbacks, side-by-side installation of multiple versions of a package, multi-user package management and easy setup of build environments.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Finally this weekend I got the chance to dig in, find out more about it and try my hand at it by moving from using &lt;a href="https://brew.sh/"&gt;Homebrew&lt;/a&gt; as my preferred choice for package management to Nix.&lt;/p&gt;
&lt;p&gt;Note that this not a detailed tutorial on Nix as I will leave that to the Nix documentation (see: &lt;a href="https://www.softinio.com/post/moving-from-homebrew-to-nix-package-manager/#references-and-recommended-resources"&gt;References and Recommended Resources&lt;/a&gt;), this is more of an account of how to get started with Nix fast to be productive quickly whilst you learn all about Nix.&lt;/p&gt;
&lt;h2 id="getting-started-with-nix"&gt;Getting started with Nix&lt;a class="heading-anchor" href="#getting-started-with-nix" aria-label="Copy link to section: Getting started with Nix" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The documentation for Nix is pretty detailed and extensive. Though I plan to read all of it, I wanted a quick overview of what I am getting myself into. To achieve that in timely fashion I read this fantastic overview &lt;a href="https://adelbertc.github.io/posts/2017-04-03-nix-journey.html"&gt;Adelblog - My journey into Nix&lt;/a&gt; by &lt;a href="https://twitter.com/adelbertchang"&gt;Adelbert Chang&lt;/a&gt;. This blog left me super excited to carry on.&lt;/p&gt;
&lt;h3 id="lets-install-nix"&gt;Lets Install Nix&lt;a class="heading-anchor" href="#lets-install-nix" aria-label="Copy link to section: Lets Install Nix" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Nix gives you two installation options: single user or multi-user. Even though I am the only user of my macbook I decided to go with the multiuser option so that Nix will be the defacto source of truth for everything on the whole laptop. Even if I never create another user for my laptop my software developer OCD is better satisfied by the way everything will be organized, setup and used on my laptop.&lt;/p&gt;
&lt;p&gt;To install open your terminal and run:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sh &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;curl https://nixos.org/nix/install&lt;span class="o"&gt;)&lt;/span&gt; --daemon
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Follow the on screen instructions and you will have Nix Package manager installed on your macbook.&lt;/p&gt;
&lt;h3 id="installing-nix-darwin"&gt;Installing Nix Darwin&lt;a class="heading-anchor" href="#installing-nix-darwin" aria-label="Copy link to section: Installing Nix Darwin" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Nix Package manager is part of NixOS which is its own Linux based OS. With NixOS you can even configure your hardware and OS options using Nix . I was thinking to myself I wish I could do the same above just package management with MacOS. Luckily I found the Nix Darwin project &lt;a href="https://github.com/LnL7/nix-darwin"&gt;nix-darwin&lt;/a&gt;which is trying to achieve that for macbooks and macOS. So after a successful installation of Nix Package manager I set off installing Nix Darwin:&lt;/p&gt;
&lt;h4 id="backup-a-few-files-first"&gt;Backup a few files first&lt;a class="heading-anchor" href="#backup-a-few-files-first" aria-label="Copy link to section: Backup a few files first" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mv /etc/zprofile /etc/zprofile.orig
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.orig
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mv /etc/zshrc /etc/zshrc.orig
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="install-nix-darwin"&gt;Install Nix Darwin&lt;a class="heading-anchor" href="#install-nix-darwin" aria-label="Copy link to section: Install Nix Darwin" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./result/bin/darwin-installer
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="moving-the-packages-i-have-with-homebrew-to-nix"&gt;Moving the packages I have with homebrew to Nix&lt;a class="heading-anchor" href="#moving-the-packages-i-have-with-homebrew-to-nix" aria-label="Copy link to section: Moving the packages I have with homebrew to Nix" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Once Nix and Nix-Darwin are installed you will have new configuration file here: &lt;code&gt;~/.nixpkgs/darwin-configuration.nix&lt;/code&gt;
I followed the following steps to move my packages across:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;run &lt;code&gt;brew list&lt;/code&gt; to get a list of what packages I have that was installed using homebrew&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;tip:&lt;/strong&gt; If you want to see what each package you have with homebrew depends on run this:&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;brew list -1 &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; cask&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; -ne &lt;span class="s2"&gt;&amp;#34;\x1B[1;34m &lt;/span&gt;&lt;span class="nv"&gt;$cask&lt;/span&gt;&lt;span class="s2"&gt; \x1B[0m&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; brew uses &lt;span class="nv"&gt;$cask&lt;/span&gt; --installed &lt;span class="p"&gt;|&lt;/span&gt; awk &lt;span class="s1"&gt;&amp;#39;{printf(&amp;#34; %s &amp;#34;, $0)}&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Check if package you want to move across exists in Nix:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nix-env -qaP &lt;span class="p"&gt;|&lt;/span&gt; grep -i &amp;lt;packagename&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;alternatively you can visit: &lt;a href="https://nixos.org/nixos/packages.html#"&gt;Search NixOS packages&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add your package to &lt;code&gt;~/.nixpkgs/darwin-configuration.nix&lt;/code&gt; to the &lt;code&gt;environment.systemPackages&lt;/code&gt; list (its space separated list).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the nix packages you added to your config file by running:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;darwin-rebuild switch
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Remove the packages you successfully moved by running:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;brew uninstall &amp;lt;packagename&amp;gt; --force
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I started off by moving the packages one at a time , then in groups to completion. Last I run &lt;code&gt;brew cleanup&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You can take a look at my configuration here: &lt;a href="https://github.com/softinio/dotfiles/blob/master/nix/darwin-configuration.nix"&gt;Salar Rahmanian&amp;rsquo;s darwin-configuration.nix&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="useful-aliases-in-my-zsh-profile"&gt;Useful Aliases in my zsh profile&lt;a class="heading-anchor" href="#useful-aliases-in-my-zsh-profile" aria-label="Copy link to section: Useful Aliases in my zsh profile" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I added the following to my &lt;code&gt;.zshrc&lt;/code&gt; profile to make it easier for me to use
nix:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;alias nixre=&amp;#34;darwin-rebuild switch&amp;#34;
alias nixgc=&amp;#34;nix-collect-garbage -d&amp;#34;
alias nixq=&amp;#34;nix-env -qaP&amp;#34;
alias nixupgrade=&amp;#34;sudo -i sh -c &amp;#39;nix-channel --update &amp;amp;&amp;amp; nix-env -iA nixpkgs.nix &amp;amp;&amp;amp; launchctl remove org.nixos.nix-daemon &amp;amp;&amp;amp; launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist&amp;#39;&amp;#34;
alias nixup=&amp;#34;nix-env -u&amp;#34;
alias nixcfg=&amp;#34;nvim ~/.nixpkgs/darwin-configuration.nix&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="what-am-i-doing-next"&gt;What am I doing next?&lt;a class="heading-anchor" href="#what-am-i-doing-next" aria-label="Copy link to section: What am I doing next?" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This certainly has got me started with Nix and have me excited to use it more as much as possible so next I am looking at:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Moving my neovim/vim configuration to using Nix.&lt;/li&gt;
&lt;li&gt;Learn and move my development workflow to using Nix shell. I currently develop using Scala, Haskell and Python I would love to hear from everyone on what tools you are using and what your workflow is&lt;/li&gt;
&lt;li&gt;Create some nix packages for anything I notice missing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Of course I will share all my learnings here on my blog so keep an eye on my blog or follow me on Twitter.&lt;/p&gt;
&lt;h2 id="references-and-recommended-resources"&gt;References and Recommended Resources&lt;a class="heading-anchor" href="#references-and-recommended-resources" aria-label="Copy link to section: References and Recommended Resources" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nixos.org/nix/manual/"&gt;Nix package manager manual&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/LnL7/nix-darwin"&gt;nix-darwin: nix modules for darwin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nixos.org/nixos/packages.html#"&gt;Search NixOS packages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://howoldis.herokuapp.com/"&gt;How up to date are NixOS channels?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://adelbertc.github.io/posts/2017-04-03-nix-journey.html"&gt;Adelblog - My journey into Nix&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nixos.org/nixos/nix-pills/"&gt;Nix Pills&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/softinio/dotfiles"&gt;Salar Rahmanian dotfiles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://brew.sh/"&gt;Homebrew&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>PyBay 2018 San Francisco</title><link>https://www.softinio.com/post/pybay-2018-san-francisco/</link><pubDate>Thu, 25 Oct 2018 18:30:40 -0700</pubDate><guid>https://www.softinio.com/post/pybay-2018-san-francisco/</guid><description>&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/pybay-2018-san-francisco/PyBay_2018_Start_hu_1fa1a84a8b66346f.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/pybay-2018-san-francisco/PyBay_2018_Start_hu_1b053ba37347574c.png"
 alt="PyBay 2018"
 width="450" height="338"
 loading="eager" fetchpriority="high" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;As you read in my &lt;a href="https://www.softinio.com/post/life-changes-and-announcing-sfbayareatech/"&gt;last blog&lt;/a&gt;
I was lucky enough to finally move to the bay area. If you know me you will
know that I am passionate about Scala and Python. To me being a master of these
two language and functional programming I can rule the world. So it goes
without saying that as soon as I arrived one of the first things I did was to
become an active member of the San Francisco Python community and attended my very
first PyBay 2018.&lt;/p&gt;
&lt;h1 id="day-one-of-pybay-2018"&gt;Day one of PyBay 2018&lt;/h1&gt;
&lt;p&gt;PyBay 2018 was held at the &lt;a href="http://www.acc-missionbayconferencecenter.com/"&gt;Mission Bay Conference Center at the UCSF&lt;/a&gt; I arrived after work in time for the opening keynote by &lt;a href="https://www.linkedin.com/in/rachel-thomas-942a7923/"&gt;Rachel Thomas&lt;/a&gt; of &lt;a href="http://course.fast.ai/index.html"&gt;fast.ai&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="some-healthy-principles-about-ethics--bias-in-ai-rachel-thomas"&gt;Some healthy principles about ethics &amp;amp; bias in AI (Rachel Thomas)&lt;a class="heading-anchor" href="#some-healthy-principles-about-ethics--bias-in-ai-rachel-thomas" aria-label="Copy link to section: Some healthy principles about ethics &amp;amp; bias in AI (Rachel Thomas)" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Rachel Thomas is the co-founder of fast.ai and a Professor of Data Science at
UCSF. Working on an AI product myself I really enjoyed this keynote as it got
me to think beyond just meeting the MVP of the product I am helping design and
build. My biggest take aways from her talk were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;What happens when an algorithm makes a decision for someone that impacts
their life in a very negative way. For example what if an Algorithm decides
whether you get health insurance or not with no empathy taken into account.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;AI and algorithms can be used to increase bureaucracy by shifting
responsability and blame. Imagine working for a large health insurance
company and turning down your friends mother for coverage and when asked why
you say sorry our algorithm made the decision not my fault. Having empathy
and emotion and taking into account the consequence of your decision does
matter so designing algorithms powering your AI you need to always remember
that and take into account.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Machines can be used to predict the future and can be biased&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Software is used to make &lt;em&gt;Life changing&lt;/em&gt; decisions&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;We have a responsability to think about our whole system and how it impacts peoples lives&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="some-misconceptions"&gt;Some Misconceptions&lt;a class="heading-anchor" href="#some-misconceptions" aria-label="Copy link to section: Some Misconceptions" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Us engineers are only responsible for our code and not our software does and how it impacts people&lt;/li&gt;
&lt;li&gt;Algorithms and humans are the same so no appeals process needed&lt;/li&gt;
&lt;li&gt;Regulating the tech industry is hard&lt;/li&gt;
&lt;li&gt;Our job in tech is to optimize metrics and respond to consumer demand&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="principles-we-should-have-when-working-in-the-ai-space"&gt;Principles we should have when working in the AI space&lt;a class="heading-anchor" href="#principles-we-should-have-when-working-in-the-ai-space" aria-label="Copy link to section: Principles we should have when working in the AI space" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Be responsible for the whole system and how it impacts people&lt;/li&gt;
&lt;li&gt;Work with domain experts&lt;/li&gt;
&lt;li&gt;Leverage strengths of humans and computers&lt;/li&gt;
&lt;li&gt;Regulation is possible and should be looked upon in a positive light&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="useful-resources-to-help-you-make-the-right-decisions"&gt;Useful resources to help you make the right decisions&lt;a class="heading-anchor" href="#useful-resources-to-help-you-make-the-right-decisions" aria-label="Copy link to section: Useful resources to help you make the right decisions" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.amazon.com/Weapons-Math-Destruction-Increases-Inequality/dp/0553418831"&gt;Weapons of Math Destruction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/1803.09010"&gt;Datasheets for datasets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/pybay-2018-san-francisco/Rachel_Thomas_PyBay_2018_hu_5f7981068bd4ff55.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/pybay-2018-san-francisco/Rachel_Thomas_PyBay_2018_hu_df133f56b7df425.png"
 alt="Salar Rahmanian meets Rachel Thomas after keynote at PyBay 2018"
 width="400" height="533"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;h1 id="day-two-of-pybay-2018"&gt;Day two of PyBay 2018&lt;/h1&gt;
&lt;p&gt;Day got on the way with a keynote by &lt;a href="https://twitter.com/raymondh"&gt;Raymond Hettinger&lt;/a&gt; a Python Core developer based here in the bay area.&lt;/p&gt;
&lt;h2 id="testing-and-debugging-on-a-time-budget-raymond-hettinger"&gt;Testing and Debugging on a time budget (Raymond Hettinger)&lt;a class="heading-anchor" href="#testing-and-debugging-on-a-time-budget-raymond-hettinger" aria-label="Copy link to section: Testing and Debugging on a time budget (Raymond Hettinger)" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In his keynote we were given an overview of all the different testing tools available to us as Python developers that we can use to produce quality code and debug our work. He talked positively about my two favorite testing tools in the Python world which are &lt;a href="https://docs.pytest.org/en/latest/"&gt;Pytest&lt;/a&gt; and &lt;a href="https://hypothesis.readthedocs.io/en/latest/"&gt;Hypothesis&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/pybay-2018-san-francisco/Raymond_Hettinger_PyBay_2018_hu_24eeba019b5a4751.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/pybay-2018-san-francisco/Raymond_Hettinger_PyBay_2018_hu_86ced7b90c14fa6f.jpg"
 alt="Raymond Hettinger at PyBay 2018"
 width="600" height="600"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;h2 id="asyncio-whats-next-yuri-selivanov"&gt;Asyncio: What&amp;rsquo;s next (Yuri Selivanov)&lt;a class="heading-anchor" href="#asyncio-whats-next-yuri-selivanov" aria-label="Copy link to section: Asyncio: What’s next (Yuri Selivanov)" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The next talk on day 2 that stood out for me was &lt;a href="https://www.linkedin.com/in/yselivanov/"&gt;Yuri Selivanov&lt;/a&gt; the Python core developer behind asyncio and the uvloop library which enables us to develop high performance Python applications. I enjoyed listening to his update on where we are with asyncio and whats coming next. Yuri also drew comparisons to the new &lt;a href="https://github.com/python-trio/trio"&gt;Trio Async Libray&lt;/a&gt; by our very own &lt;a href="https://vorpus.org/"&gt;Nathaniel J Smith&lt;/a&gt;. I am super excited about the direction and options we have here and look forward to using them in my projects.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/pybay-2018-san-francisco/Yuri_Selivanov_PyBay_2018_hu_4aab93a71fd6447c.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/pybay-2018-san-francisco/Yuri_Selivanov_PyBay_2018_hu_e1ae770f92c1db36.jpg"
 alt="Yuri Selivanov at PyBay 2018"
 width="600" height="600"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;h1 id="day-three-of-pybay-2018"&gt;Day three of PyBay 2018&lt;/h1&gt;
&lt;p&gt;The final day of PyBay 2018 kicked off with a Keynote by the one and only &lt;a href="https://www.linkedin.com/in/teoliphant/"&gt;Travis Olaphant&lt;/a&gt; the founder/creator of &lt;a href="https://www.anaconda.com/"&gt;Anaconda&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="state-of-ai--ml-in-python-travis-olaphant"&gt;State of AI / ML in Python (Travis Olaphant)&lt;a class="heading-anchor" href="#state-of-ai--ml-in-python-travis-olaphant" aria-label="Copy link to section: State of AI / ML in Python (Travis Olaphant)" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this keynote we were taken through the journey of what has made Python such a great eco system for Data Science. Funny enough most of the tools that we use Travis Oliphant has had a hand in making it available to us all such as NumPy and SciPy. It was a real pleasure meeting him in person.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/pybay-2018-san-francisco/Travis_Olaphant_PyBay_2018_hu_74eed271923b03cc.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/pybay-2018-san-francisco/Travis_Olaphant_PyBay_2018_hu_52c645cf319fc5a5.jpg"
 alt="Salar Rahmanian meeting Travis Olaphant at PyBay 2018"
 width="600" height="799"
 loading="lazy" /&gt;
 &lt;/picture&gt;



 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/pybay-2018-san-francisco/Travis_Olaphant_Keynote_PyBay2018_hu_e6addf1d883a868b.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/pybay-2018-san-francisco/Travis_Olaphant_Keynote_PyBay2018_hu_9761e8561c845935.JPG"
 alt="Final Day Keynote by Travis Olaphant at PyBay 2018"
 width="600" height="600"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;h1 id="lightening-talks-at-pybay-2018"&gt;Lightening talks at PyBay 2018&lt;/h1&gt;
&lt;p&gt;One of the more fun aspects of PyBay was the lightening talks. Everyday of the conference there was a slot for doing a 5 minute lightening talk. One of the speakers that was planned for the third day of the conference dropped out so the organizers turned that hour into an extra lightening talk hour. They were looking for volunteers to do a lightening talk unplanned on short notice and for better or worse I volunteered and did a super fast lightening talk on using &lt;a href="https://www.softinio.com/post/using-pyenv-for-python-projects/"&gt;pyenv&lt;/a&gt; fast forward to 5:22 to see my lightening talk:&lt;/p&gt;
&lt;div class="yv"&gt;
 &lt;button type="button" class="yv-play" data-id="KqqMSB0eyhk" data-title="YouTube video" aria-label="Play video: YouTube video"&gt;
 &lt;img src="https://i.ytimg.com/vi/KqqMSB0eyhk/sddefault.jpg"
 srcset="https://i.ytimg.com/vi/KqqMSB0eyhk/hqdefault.jpg 480w, https://i.ytimg.com/vi/KqqMSB0eyhk/sddefault.jpg 640w"
 sizes="(max-width: 768px) calc(100vw - 2rem), (max-width: 830px) calc(100vw - 3rem), 780px"
 alt="" width="640" height="480" loading="lazy" /&gt;
 &lt;svg viewBox="0 0 68 48" aria-hidden="true"&gt;&lt;path d="M66.5 7.7a8.5 8.5 0 0 0-6-6C55.3.3 34 .3 34 .3s-21.3 0-26.5 1.4a8.5 8.5 0 0 0-6 6C.1 13 .1 24 .1 24s0 11 1.4 16.3a8.5 8.5 0 0 0 6 6C12.7 47.7 34 47.7 34 47.7s21.3 0 26.5-1.4a8.5 8.5 0 0 0 6-6C67.9 35 67.9 24 67.9 24s0-11-1.4-16.3z" fill="#f00"/&gt;&lt;path d="M45 24 27 14v20z" fill="#fff"/&gt;&lt;/svg&gt;
 &lt;/button&gt;
&lt;/div&gt;
&lt;p class="video-fallback"&gt;&lt;a href="https://www.youtube.com/watch?v=KqqMSB0eyhk" target="_blank" rel="noopener"&gt;▶ Watch on YouTube&lt;/a&gt;&lt;/p&gt;

&lt;h1 id="thank-you-pybay-2018"&gt;Thank you PyBay 2018&lt;/h1&gt;
&lt;p&gt;What made the event even more fun for me was that &lt;a href="https://hiremya.com/"&gt;Mya&lt;/a&gt; was one of the sponsors so got the chance to enjoy the conference with my esteemed colleagues and found it incredibly fun to talk to everyone at the conference on the problems we are solving at Mya using Python.&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/pybay-2018-san-francisco/Mya_team_PyBay_2018_hu_590a73112d2eed1b.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/pybay-2018-san-francisco/Mya_team_PyBay_2018_hu_7bf6417c595e40a1.jpg"
 alt="Mya team at PyBay 2018"
 width="600" height="450"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;
&lt;p&gt;A Huge thank you to the organizers of PyBay 2018 for putting such a great event together. Lets not forget that PyBay is organized by a group of volunteers so their effort to put such a great event together was outstanding. Especially I would like to thank &lt;a href="https://www.linkedin.com/in/gracelaw1972/"&gt;Grace Law&lt;/a&gt;, &lt;a href="https://www.linkedin.com/in/simeonfranklin/"&gt;Simeon Franklin&lt;/a&gt;, &lt;a href="https://www.linkedin.com/in/danielpyrathon/"&gt;Daniel Pyrathon&lt;/a&gt;, &lt;a href="https://www.linkedin.com/in/paul-starrett-esq-ll-m-cfe-ence-251325/"&gt;Paul Starrett&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/nickdirienzo/"&gt;Nick DiRienzo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;

 &lt;picture&gt;
 &lt;source srcset="https://www.softinio.com/post/pybay-2018-san-francisco/PyBay2018Crew_hu_20216f11dc0f3ab5.webp" type="image/webp" /&gt;
 &lt;img src="https://www.softinio.com/post/pybay-2018-san-francisco/PyBay2018Crew_hu_67a31546f975137b.jpeg"
 alt="PyBay 2018 Crew"
 width="600" height="450"
 loading="lazy" /&gt;
 &lt;/picture&gt;
&lt;/p&gt;</description></item><item><title>Using pyenv for Python projects</title><link>https://www.softinio.com/post/using-pyenv-for-python-projects/</link><pubDate>Mon, 13 Apr 2015 09:06:03 -0500</pubDate><guid>https://www.softinio.com/post/using-pyenv-for-python-projects/</guid><description>&lt;p&gt;Using &lt;a href="https://github.com/yyuu/pyenv"&gt;pyenv&lt;/a&gt; to manage your virtual environments makes working on multiple projects, each using a different version of python a breeze.&lt;/p&gt;
&lt;p&gt;I do all my development on an Apple Macbook running Yosemite and my production environment is a VPS from &lt;a href="https://www.linode.com"&gt;Linode&lt;/a&gt; running &lt;a href="https://www.centos.org"&gt;CentOS 7&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here some simple notes on how I setup and use &lt;a href="https://github.com/yyuu/pyenv"&gt;pyenv&lt;/a&gt; :&lt;/p&gt;
&lt;h2 id="installing-on-mac-os-x"&gt;Installing on Mac OS X&lt;a class="heading-anchor" href="#installing-on-mac-os-x" aria-label="Copy link to section: Installing on Mac OS X" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Install using &lt;a href="http://brew.sh"&gt;homebrew&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;brew install pyenv pyenv-virtualenv
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Update your shell profile (.bashrc or .zshrc) adding the following to it (and restart your terminal)&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; which pyenv &amp;gt; /dev/null&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;pyenv init -&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; which pyenv-virtualenv-init &amp;gt; /dev/null&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;pyenv virtualenv-init -&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="installing-on-linux-centos-7"&gt;Installing on Linux CentOS 7&lt;a class="heading-anchor" href="#installing-on-linux-centos-7" aria-label="Copy link to section: Installing on Linux CentOS 7" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Checkout from github&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone https://github.com/yyuu/pyenv.git ~/.pyenv
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Update your shell profile (.bashrc or .zshrc) adding the following to it (and restart your terminal)&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;export PYENV_ROOT=&amp;#34;$HOME/.pyenv&amp;#34;&amp;#39;&lt;/span&gt; &amp;gt;&amp;gt; ~/.bash_profile
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;export PATH=&amp;#34;$PYENV_ROOT/bin:$PATH&amp;#34;&amp;#39;&lt;/span&gt; &amp;gt;&amp;gt; ~/.bash_profile
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;eval &amp;#34;$(pyenv init -)&amp;#34;&amp;#39;&lt;/span&gt; &amp;gt;&amp;gt; ~/.bash_profile
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;eval &amp;#34;$(pyenv virtualenv-init -)&amp;#34;&amp;#39;&lt;/span&gt; &amp;gt;&amp;gt; ~/.bash_profile
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="using-pyenv"&gt;Using pyenv&lt;a class="heading-anchor" href="#using-pyenv" aria-label="Copy link to section: Using pyenv" title="Copy link to this section"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;To install a new version of &lt;a href="https://www.python.org"&gt;Python&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pyenv install &amp;lt;version&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pyenv rehash
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;To get a list of &lt;a href="https://www.python.org"&gt;Python&lt;/a&gt; versions available&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pyenv install -l
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;To create a new virtual environment&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pyenv virtualenv &lt;span class="o"&gt;[&lt;/span&gt;pyenv-version&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;virtualenv-name&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;To use your new virtual environment within your project&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Change to your projects root directory&lt;/li&gt;
&lt;li&gt;Run:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pyenv &lt;span class="nb"&gt;local&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;virtualenv-name&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that this is done only the first time you go to your project directory. The wonderful thing about &lt;a href="https://github.com/yyuu/pyenv"&gt;pyenv&lt;/a&gt; is in future when you change directory to your project directory, it will be automatically activated your virtualenv for you.&lt;/p&gt;</description></item></channel></rss>