<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2025-05-05T10:29:35+00:00</updated><id>/feed.xml</id><title type="html">Inter Alia</title><subtitle>Peter Gao&apos;s musings, among other things... Relax, you are among friends.
</subtitle><author><name>Peter Gao</name></author><entry><title type="html">VIM on Ubuntu 22.04 with clipboard support using Linux Brew</title><link href="/2023/11/24/vim-on-ubuntu-22-04-with-clipboard.html" rel="alternate" type="text/html" title="VIM on Ubuntu 22.04 with clipboard support using Linux Brew" /><published>2023-11-24T23:03:55+00:00</published><updated>2023-11-24T23:03:55+00:00</updated><id>/2023/11/24/vim-on-ubuntu-22-04-with-clipboard</id><content type="html" xml:base="/2023/11/24/vim-on-ubuntu-22-04-with-clipboard.html"><![CDATA[<p>The prodigal son returns to Linux after years of developing on macOS (and Windows with WSL), it’s a longer post to talk about the reasons for the switch to Linux (WSL wasn’t the greatest of experience for me, and you know what they say about once bitten twice shy; ergo no WSL2 for me). macOS in comparison to Windows was quite a breeze, and using <code class="language-plaintext highlighter-rouge">brew install vim</code> works like a charm with clipboard support.</p>

<p>But let’s set the stage: you install VIM on Ubuntu 22.04, open up a file and try to yank to the clipboard with <code class="language-plaintext highlighter-rouge">"+y</code> or <code class="language-plaintext highlighter-rouge">"*y</code>, and when you hit <code class="language-plaintext highlighter-rouge">Ctrl+V</code> in a different app, nothing appears.</p>

<p>You then go back to the terminal and look for VIM’s <code class="language-plaintext highlighter-rouge">+clipboard</code> support, but sadly when you run <code class="language-plaintext highlighter-rouge">vim --version</code>, it shows <code class="language-plaintext highlighter-rouge">-clipboard</code>.</p>

<h2 id="time-to-fix-vim-with-clipboard">Time to fix VIM with <code class="language-plaintext highlighter-rouge">+clipboard</code></h2>
<ol>
  <li>Modify the brew formula, but we need to make a copy first: <code class="language-plaintext highlighter-rouge">cp /home/linuxbrew/.linuxbrew/opt/vim/.brew/vim.rb ./vim.rb</code></li>
  <li>Modify the file: <code class="language-plaintext highlighter-rouge">vim ./vim.rb</code>. Replace <code class="language-plaintext highlighter-rouge">"--without-x"</code> with <code class="language-plaintext highlighter-rouge">"--with-x"</code>.</li>
  <li>Uninstall the currently installed VIM version: <code class="language-plaintext highlighter-rouge">brew uninstall vim</code></li>
  <li>Install Ubuntu dependencies: <code class="language-plaintext highlighter-rouge">sudo apt-get install libncurses5-dev libgtk2.0-dev libatk1.0-dev libx11-dev libxt-dev</code></li>
  <li>Install VIM from the local formula: <code class="language-plaintext highlighter-rouge">brew install --build-from-source ./vim.rb</code></li>
</ol>

<p>Take a look after it’s compiled and installed: <code class="language-plaintext highlighter-rouge">vim --version</code>.</p>

<p>Voila, now we got our <code class="language-plaintext highlighter-rouge">+clipboard</code>!</p>]]></content><author><name>Peter Gao</name></author><category term="VIM" /><category term="Linux Brew" /><category term="Ubuntu" /><category term="Clipboard" /><summary type="html"><![CDATA[The prodigal son returns to Linux after years of developing on macOS (and Windows with WSL), it’s a longer post to talk about the reasons for the switch to Linux (WSL wasn’t the greatest of experience for me, and you know what they say about once bitten twice shy; ergo no WSL2 for me). macOS in comparison to Windows was quite a breeze, and using brew install vim works like a charm with clipboard support.]]></summary></entry><entry><title type="html">Fix for ‘Output Device’ being stuck on ‘Dummy Output’ on Ubuntu 22.04</title><link href="/2023/11/24/pulse-audio-ubuntu-22-04-dummy-output.html" rel="alternate" type="text/html" title="Fix for ‘Output Device’ being stuck on ‘Dummy Output’ on Ubuntu 22.04" /><published>2023-11-24T23:03:55+00:00</published><updated>2023-11-24T23:03:55+00:00</updated><id>/2023/11/24/pulse-audio-ubuntu-22-04-dummy-output</id><content type="html" xml:base="/2023/11/24/pulse-audio-ubuntu-22-04-dummy-output.html"><![CDATA[<p>Another day, another Ubuntu bug. This time it has to do with the (pulse) audio not working after unplugging and replugging the audio cable.</p>

<p>I have a YouTube video playing in Firefox, and a colleague asks me a question. I turn around on my swanky swivel chair and roll over to their
desk. *boink* the 3.5mm audio cable unplugs from my machine. No biggie, I’ll just plug it back in after I’m done conversing with my colleague.</p>

<p>5 minutes later, I return to my machine and plug the audio cable back into the machine. No sound. Nani?! I go into “Settings” -&gt; “Sound” and
I see that “Dummy Output” is selected for “Output Devices”. No biggie, I click on the dropdown and proceed to select “Line Out - Builtin Audio”.</p>

<p>And… nothing. Silence is golden, I suppose. I should say, if you’re having issues with Ubuntu 22.04 (or later) <em>not even showing</em> your audio
devices, you have a different problem.</p>

<p>For me, I could select my other audio devices (yes, plural, including the S/PDIF and HDMI Audio out) but when I navigate away from the “Sound”
page, it reverts to Dummy Output. I can only assume it’s not letting me change, but the UI doesn’t reflect that fact.</p>

<h2 id="time-to-fix-dummy-output">Time to fix “Dummy Output”!</h2>

<p>For the savvy reader, you’ll have noticed <code class="language-plaintext highlighter-rouge">(pulse) audio</code> within the first paragraph. This is indeed the culprit. For some reason, if the audio
is playing and the device gets disconnected, there is a bug wherein pulseaudio gets stuck on “Dummy Output”.</p>

<p>The fix is quite simple with two options:</p>
<ol>
  <li>Reboot your machine (ahaha, who does this anymore? This is 2023, and we’re going for 20 years of uptime baby!)</li>
  <li>Restart <code class="language-plaintext highlighter-rouge">pulseaudio</code> service.</li>
</ol>

<p>Let’s go with option 2:
<code class="language-plaintext highlighter-rouge">pulseaudio --kill &amp;&amp; pulseaudio --start</code></p>

<p>… and we’re back 🎉🎧!</p>]]></content><author><name>Peter Gao</name></author><category term="Ubuntu" /><category term="Pulse Audio" /><category term="Dummy Output" /><summary type="html"><![CDATA[Another day, another Ubuntu bug. This time it has to do with the (pulse) audio not working after unplugging and replugging the audio cable.]]></summary></entry><entry><title type="html">Headache free setup of Elm 0.18 with Phoenix 1.3 using Brunch 2</title><link href="/2018/07/18/using-elm-with-elixir-phoenix-brunch.html" rel="alternate" type="text/html" title="Headache free setup of Elm 0.18 with Phoenix 1.3 using Brunch 2" /><published>2018-07-18T08:43:00+00:00</published><updated>2018-07-18T08:43:00+00:00</updated><id>/2018/07/18/using-elm-with-elixir-phoenix-brunch</id><content type="html" xml:base="/2018/07/18/using-elm-with-elixir-phoenix-brunch.html"><![CDATA[<p>This is an end-to-end tutorial for getting setup with the <strong>latest</strong> <a href="http://elm-lang.org">Elm</a> (0.18.x), <a href="https://elixir-lang.org/">Elixir</a> (1.6.x), <a href="http://phoenixframework.org/">Phoenix</a> (1.3.x) and <a href="https://brunch.io/">Brunch</a> (2.10.x) with <em>minimum</em> headaches.</p>

<p>There are plenty of great tutorials for past versions of Elm, Elixir and Phoenix, of course. Some of those lessons are largely still applicable, but with Phoenix 1.3, the directory structure for things have shifted around a little bit, so here’s a fresh introduction to getting all of these moving targets to play nicely together.</p>

<p>Oh, and we don’t have to monkey around with Webpack, as we’ll be doing everything purely the Phoenix-way: with Brunch! No unwieldy configs and monkeying around with cryptic Webpack config parameters.</p>

<p>Let’s jump in!</p>

<p><br />
<a name="installing-elixir"></a></p>
<h3 id="installing-or-updating-elixir-to-16x">Installing (or updating) Elixir to 1.6.x</h3>

<p><em>Skip to the <a href="#phoenix-install">next step</a> if latest Elixir (1.6.x) is already installed.</em></p>

<p>Before we get <em>anything</em> off the ground, we need to install Elixir. I highly recommend installing Elixir using the version manager <a href="://github.com/asdf-vm/asdf">asdf</a>, which can manage both the Erlang runtime (necessary to compile and run Elixir) and Elixir platform under one unified tool. More details on installing <code class="language-plaintext highlighter-rouge">asdf</code> are available on their <a href="://github.com/asdf-vm/asdf">Github page</a>.</p>

<p>From a clean slate with <code class="language-plaintext highlighter-rouge">asdf</code>, installing both Erlang and Elixir itself should quite simple:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="c"># We may need to install dependencies for Erlang runtime</span>
<span class="nv">$ </span><span class="c"># for our system prior to installing Erlang itself.</span>
<span class="nv">$ </span><span class="c"># See: https://www.tiot.jp/riak-docs/riak/kv/2.2.3/setup/installing/source/erlang/</span>

<span class="nv">$ </span>asdf plugin-add erlang
<span class="nv">$ </span>asdf plugin-add elixir
<span class="nv">$ </span>asdf <span class="nb">install </span>erlang 21.0.3 <span class="c"># Latest version as of this writing, but double check newest version with `asdf list-all erlang`!</span>
<span class="nv">$ </span>asdf <span class="nb">install </span>elixir 1.6.6 <span class="c"># Same notice as above ^. Check `asdf list-all elixir`</span>
</code></pre></div></div>

<p>If we have an older version of Erlang or Elixir, we will want to update them both. Updating Erlang and Elixir versions with <code class="language-plaintext highlighter-rouge">asdf</code> is trivial and operates exactly the same as above, except we will not have to perform the two <code class="language-plaintext highlighter-rouge">plugin-add</code> steps:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>asdf <span class="nb">install </span>erlang 21.0.3 <span class="c"># Latest version as of this writing, but double check newest version with `asdf list-all erlang`!</span>
<span class="nv">$ </span>asdf <span class="nb">install </span>elixir 1.6.6 <span class="c"># Same notice as above ^. Check `asdf list-all elixir`</span>
</code></pre></div></div>

<p><br />
<a name="phoenix-install"></a></p>
<h3 id="installing-or-updating-phoenix-to-13x">Installing (or updating) Phoenix to 1.3.x</h3>

<p><em>Skip to the <a href="#installing-elm">next step</a> if latest Phoenix (1.3.x) is already installed.</em></p>

<p>Before installing Phoenix, we should go through the <a href="https://hexdocs.pm/phoenix/installation.html">Phoenix pre-install guide</a> (<strong>tl;dr</strong> we’ll need Hex [an Elixir package manager], <a href="https://www.postgresql.org/download/">PostgreSQL</a> and Node.js–If we don’t have Node.js yet, we can install it with <code class="language-plaintext highlighter-rouge">asdf</code> as well!).</p>

<p>Once we have the pre-requisites installed, installing Phoenix itself is one command away:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
</code></pre></div></div>

<p>If we’re on an older MINOR release of Phoenix (i.e. 1.2.x or below), we’ll have update our local Phoenix package:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>mix local.phoenix
</code></pre></div></div>

<p>If we’re already on 1.3.x, but not the absolute latest version of 1.3.x, we can use:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>mix local.phx
</code></pre></div></div>

<p><strong>Note:</strong> Phoenix changed its <code class="language-plaintext highlighter-rouge">mix</code> task name between 1.2 and 1.3 from <code class="language-plaintext highlighter-rouge">phoenix</code> to <code class="language-plaintext highlighter-rouge">phx</code>.</p>

<p><br />
<a name="installing-elm"></a></p>
<h3 id="installing-or-updating-elm-to-018x">Installing (or updating) Elm to 0.18.x</h3>

<p><em>Skip to the <a href="#new-project">next step</a> if latest Elm (0.18.0) is already installed.</em></p>

<p>Installing Elm once we have npm installed is a piece of cake.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>npm <span class="nb">install</span> <span class="nt">-g</span> elm
</code></pre></div></div>

<p>Updating is similarily easy, you just have to run:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>npm update <span class="nt">-g</span> elm
</code></pre></div></div>

<p>Yep, that’s all we have to do! Easiest step of this whole process, by far. Thanks, Elm!</p>

<p><br />
<a name="new-project"></a></p>
<h3 id="creating-a-new-phoenix-project">Creating a new Phoenix project</h3>

<p>With all our dependencies installed, we can create a new Phoenix project like so:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>mix phx.new phoenixWithElm
</code></pre></div></div>

<p>This will create a new folder named <code class="language-plaintext highlighter-rouge">phoenixWithElm</code> at the current working directory, and prompt us to install the default Node.js dependencies for Phoenix (the Brunch build tool, for one).</p>

<p>Unless we have reasons to defer installing the dependencies (which we will need, eventually), we should respond with <code class="language-plaintext highlighter-rouge">[Y]es</code> now.</p>

<p><br />
<a name="configuring-elm-brunch"></a></p>
<h3 id="installing-and-configuring-elm-brunch">Installing and Configuring “elm-brunch”</h3>

<p>We need a third party node package called <a href="https://github.com/madsflensted/elm-brunch"><code class="language-plaintext highlighter-rouge">elm-brunch</code></a>, which is a plugin for Brunch and performs the Elm compilation for us whenever we save a <code class="language-plaintext highlighter-rouge">.elm</code> file in the assets directory.</p>

<p><strong>From now on, all actions should be performed from within the <code class="language-plaintext highlighter-rouge">assets/</code> directory of our project. Filepaths and Directories will be given relative to <code class="language-plaintext highlighter-rouge">assets/</code>.</strong></p>

<p>To start, add the <code class="language-plaintext highlighter-rouge">"elm-brunch"</code> line to our <code class="language-plaintext highlighter-rouge">package.json</code> file:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span>
  <span class="c1">// ...</span>
  <span class="c1">// Other sections</span>
  <span class="c1">// ...</span>
    <span class="dl">"</span><span class="s2">devDependencies</span><span class="dl">"</span><span class="p">:</span> <span class="p">{</span>
        <span class="dl">"</span><span class="s2">elm-brunch</span><span class="dl">"</span><span class="p">:</span> <span class="dl">"</span><span class="s2">^0.11.1</span><span class="dl">"</span><span class="p">,</span>
          <span class="c1">// ...</span>
          <span class="c1">// Other dependencies</span>
          <span class="c1">// ...</span>
    <span class="p">}</span>
<span class="p">}</span>
</code></pre></div></div>

<p>After we’ve added <a href="https://github.com/madsflensted/elm-brunch"><code class="language-plaintext highlighter-rouge">elm-brunch</code></a> to our <code class="language-plaintext highlighter-rouge">package.json</code> file, we need to install it:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>npm <span class="nb">install</span>
</code></pre></div></div>

<p>If everything has gone well so far, we just need to put the final touches on our elm-brunch configuration and we should be off to the races!</p>

<p>We should still be inside of the <strong><code class="language-plaintext highlighter-rouge">assets/</code></strong> directory. Time to edit <code class="language-plaintext highlighter-rouge">brunch-config.js</code>. Under <code class="language-plaintext highlighter-rouge">plugins</code> section, we should see <code class="language-plaintext highlighter-rouge">babel</code> as the sole default plugin:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span>
  <span class="c1">// ...</span>
  <span class="c1">// Other sections</span>
  <span class="c1">// ...</span>
  <span class="nl">plugins</span><span class="p">:</span> <span class="p">{</span>
    <span class="na">babel</span><span class="p">:</span> <span class="p">{</span>
      <span class="c1">// Do not use ES6 compiler in vendor code</span>
      <span class="na">ignore</span><span class="p">:</span> <span class="p">[</span><span class="sr">/vendor/</span><span class="p">]</span>
    <span class="p">}</span>
  <span class="p">}</span>
<span class="p">}</span>
</code></pre></div></div>

<p>We want to extend this section to include our <code class="language-plaintext highlighter-rouge">elm-brunch</code> plugin configs:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span>
  <span class="c1">// ...</span>
  <span class="c1">// Other sections</span>
  <span class="c1">// ...</span>
  <span class="nl">plugins</span><span class="p">:</span> <span class="p">{</span>
    <span class="na">babel</span><span class="p">:</span> <span class="p">{</span>
      <span class="c1">// Do not use ES6 compiler in vendor code</span>
      <span class="na">ignore</span><span class="p">:</span> <span class="p">[</span><span class="sr">/vendor/</span><span class="p">]</span>
    <span class="p">},</span>
    <span class="na">elmBrunch</span><span class="p">:</span> <span class="p">{</span>
      <span class="c1">// (required) Set to the elm file(s) containing our "main" function `elm make`</span>
      <span class="c1">//            handles all elm dependencies relative to `elmFolder`</span>
      <span class="na">mainModules</span><span class="p">:</span> <span class="p">[</span><span class="dl">'</span><span class="s1">elm/Main.elm</span><span class="dl">'</span><span class="p">],</span>

      <span class="c1">// (optional) If specified, all mainModules will be compiled to a single file</span>
      <span class="c1">//            This is merged with outputFolder.</span>
      <span class="na">outputFile</span><span class="p">:</span> <span class="dl">'</span><span class="s1">elm.js</span><span class="dl">'</span><span class="p">,</span>

      <span class="c1">// (optional) add some parameters that are passed to elm-make</span>
      <span class="na">makeParameters</span><span class="p">:</span> <span class="p">[</span><span class="dl">'</span><span class="s1">--warn</span><span class="dl">'</span><span class="p">]</span>
    <span class="p">}</span>
  <span class="p">}</span>
<span class="p">}</span>
</code></pre></div></div>

<p>These are the bare minimum configs necessary to compile our Elm app, and more config flags are available and documented in the <a href="https://github.com/madsflensted/elm-brunch"><code class="language-plaintext highlighter-rouge">elm-brunch</code></a> repository.</p>

<p>We want to make an additional change to the <code class="language-plaintext highlighter-rouge">paths</code> section, which is to add <code class="language-plaintext highlighter-rouge">"elm"</code> to the list of watched paths:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span>
  <span class="nl">paths</span><span class="p">:</span> <span class="p">{</span>
    <span class="c1">// Dependencies and current project directories to watch</span>
    <span class="na">watched</span><span class="p">:</span> <span class="p">[</span><span class="dl">"</span><span class="s2">static</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">css</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">js</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">elm</span><span class="dl">"</span><span class="p">,</span> <span class="dl">"</span><span class="s2">vendor</span><span class="dl">"</span><span class="p">],</span>
    <span class="c1">// Other configurations</span>
  <span class="p">},</span>
<span class="p">}</span>
</code></pre></div></div>

<p><br />
<a name="creating-elm-app"></a></p>
<h3 id="creating-our-hello-world-elm-app">Creating our Hello World Elm app!</h3>

<p>With all of the config all setup, we just have one last thing to do: Create an <code class="language-plaintext highlighter-rouge">elm/</code> directory under <code class="language-plaintext highlighter-rouge">assets/</code> and make an Elm file within it!</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">mkdir </span>elm
<span class="nv">$ </span><span class="nb">cd </span>elm
</code></pre></div></div>

<p>Then using our favourite text editor, create and save <code class="language-plaintext highlighter-rouge">Main.elm</code> with the bare minimum content:</p>
<div class="language-haskell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kr">module</span> <span class="nn">Main</span> <span class="n">exposing</span> <span class="p">(</span><span class="o">..</span><span class="p">)</span>
<span class="kr">import</span> <span class="nn">Html</span> <span class="n">exposing</span> <span class="p">(</span><span class="o">..</span><span class="p">)</span>

<span class="n">main</span> <span class="o">=</span>
    <span class="n">p</span> <span class="kt">[]</span> <span class="p">[</span> <span class="n">text</span> <span class="s">"Hello world"</span> <span class="p">]</span>
</code></pre></div></div>

<p>Let’s boot up the Phoenix server (which will in turn start up a Brunch watch job) and have it compile our <code class="language-plaintext highlighter-rouge">Main.elm</code> file:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">cd</span> ../.. <span class="c"># If we are still inside of `assets/elm/`, back out to project root</span>
<span class="nv">$ </span>mix phx.server
</code></pre></div></div>

<p>Compiled Elm files can be found in <code class="language-plaintext highlighter-rouge">&lt;project_root&gt;/priv/static/js/elm.js</code> by default. We can change both the location and the name of the compiled file in the <code class="language-plaintext highlighter-rouge">brunch-config.js</code> file if we so wished.</p>

<p>One last thing we need to do before we can check out our Hello World elm code, add it to our layout file so that it gets loaded on page load.</p>

<p>Add this line to <code class="language-plaintext highlighter-rouge">lib/property_speculation_web/templates/layout/app.html.eex</code>:</p>
<div class="language-erb highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;script </span><span class="na">src=</span><span class="s">"</span><span class="cp">&lt;%=</span> <span class="n">static_path</span><span class="p">(</span><span class="vi">@conn</span><span class="p">,</span> <span class="s2">"/js/elm.js"</span><span class="p">)</span> <span class="cp">%&gt;</span><span class="s">"</span><span class="nt">&gt;&lt;/script&gt;</span>
</code></pre></div></div>

<p>It should go right below the existing <code class="language-plaintext highlighter-rouge">&lt;script&gt;</code> that’s pointing to <code class="language-plaintext highlighter-rouge">/js/app.js</code>.</p>

<p>Everything is in place and we should be able to hit up <code class="language-plaintext highlighter-rouge">localhost:4000</code> in a browser and see the Phoenix App’s greeting screen.</p>

<p>To make sure that our Elm app is actually loaded, open up the inspector and plunk down this line of JS:</p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">Elm</span><span class="p">.</span><span class="nx">Main</span><span class="p">.</span><span class="nx">embed</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByClassName</span><span class="p">(</span><span class="dl">'</span><span class="s1">logo</span><span class="dl">'</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
</code></pre></div></div>

<p>Immediately we should see the words “Hello world” overlap the Phoenix logo banner. Huzzah! This proves that our Elm app is being loaded onto the page, and can be successfully mounted!</p>

<p><strong>Troubleshooting tip:</strong> If you’re running into issues, make sure that the <code class="language-plaintext highlighter-rouge">elm/</code> directory is created under <code class="language-plaintext highlighter-rouge">&lt;project_root&gt;/assets/</code>!</p>

<p><br />
<a name="wrapping-up"></a></p>
<h3 id="wrapping-up">Wrapping Up</h3>

<p>Congratulations! At this point the Brunch is setup to compile changes made to our Elm code in real time, so long as the Brunch watcher is running (and it will be autorun whenever the Phoenix server is started). The app template is updated to load our <code class="language-plaintext highlighter-rouge">elm.js</code> file.</p>

<p>I have noticed that the Brunch watcher self-exits and does not restart when <code class="language-plaintext highlighter-rouge">brunch-config.js</code> is modified while Phoenix is running, necessitating an entire server reboot. If you know a way around this, I’d love to hear from you! My contact info is in the footer, please reach out!</p>

<p>Let’s review our finalized directory structure under <code class="language-plaintext highlighter-rouge">assets/</code> and <code class="language-plaintext highlighter-rouge">priv/</code>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>.
├── assets
│   ├── css
│   ├── elm # This is where we should put our *.elm source
│   ├── elm-stuff # This is where Elm packages and dependencies go
│   ├── js
│   ├── node_modules
│   ├── static
│   └── vendor
└── priv
    ├── gettext
    ├── repo
    └── static
        ├── css
        ├── images
        └── js # This is where our compiled Elm gets output as "elm.js"
</code></pre></div></div>
<ul>
  <li>This list focuses on the two main directories and filters out all the other directories.</li>
</ul>]]></content><author><name>Peter Gao</name></author><category term="Elm" /><category term="Phoenix" /><category term="Elixir" /><summary type="html"><![CDATA[This is an end-to-end tutorial for getting setup with the latest Elm (0.18.x), Elixir (1.6.x), Phoenix (1.3.x) and Brunch (2.10.x) with minimum headaches.]]></summary></entry><entry><title type="html">Technology does not progress. People do.</title><link href="/2017/01/05/technology-does-not-progress-people-do.html" rel="alternate" type="text/html" title="Technology does not progress. People do." /><published>2017-01-05T22:13:46+00:00</published><updated>2017-01-05T22:13:46+00:00</updated><id>/2017/01/05/technology-does-not-progress-people-do</id><content type="html" xml:base="/2017/01/05/technology-does-not-progress-people-do.html"><![CDATA[<p>As someone who lives and works in what is ostensibly called “Silicon Valley”, I find the perspective the valley holds on “progress” rather… narrow. Progress here lacks unity, and I don’t mean it in a “big vision thematic” sense of the word, but cultural unity: the ability to bring disparate groups of people together.</p>

<p>Here (and elsewhere in the world), there’s an illusion of progress created by overemphasising certain properties over others. Sleekness, smallness and pocketability of technological artifacts. Yes, we now can fit in our pockets a computer that’s hundreds of thousands of times<a href="#footnote-1">[1]</a><a name="inline-footnote-1"></a> faster than the 486 I first used as a 5 year old. Or obtain the play-by-play on gossip among friends. Let’s not forget the most important progress of them all: I can immortalize (or not: Snapchat) this moment, selfie style!</p>

<p>To discredit this as <em>not</em> progress would be disingenuous. Yes, they are indeed facets of progress, but of such a limited use that I want to refer us to a different kind of progress: People progress.</p>

<p>The collective psyche of the people we associate with–often referred to as “culture”–progress at a very different pace. No, not “slower” (or “faster”). Different.</p>

<p>Progress among people happen through direct and indirect contact, but contact nonetheless. Direct contact is the the face-to-face, phone-to-phone, and text-to-text type. The speed of cultural progress happens in that general order. Indirect contact happens largely through mass media and other types of impersonal associations. Loosely understood as the zeitgeist of a time: it’s the “air” about a populace, there is this osmosis-like diffusion of thoughts and conduct that permeates society organically and allows the acceptance of certain thoughts and actions while rebuking others.</p>

<p>When an idea becomes popular, we say it has hit “critical mass”. Direct contact among a large enough sample size of the populace has embraced this new idea. This can be exciting and rewarding–sometimes financially so for its progenitors.</p>

<p>Critical mass, however, does not necessarily imply unification of culture. But if the critical mass is limited to a particular demographic, be it geographic, age, race, religion, etc. then fragmentation is inevitable.</p>

<p>You would be correct to remark, “But progress is not uniform!”. The kind of progress needed to forge long lasting unity and avoid fragmentation does not exist. Not in the real world, anyways. We need to increase the bandwith of contact, direct contact, between ourselves and others unlike us. Only openness and vulnerability between the various groups that comprise our culture allows for unification and reconciliation. There is no silver bullet.</p>

<p>Let’s be excited when a startup that we happen to be part of makes it into the big leagues of the unicorns, when the new iPhone/iWatch/iThing comes out, or when self driving cars finally makes it to the commercial realm. These things are all worth celebrating.</p>

<p>But don’t forget that progress in the cultural sphere changes at its own pace, buffeted by our ability to be open and inclusive. The kind of progress that will matter twenty years later will be the kind we make happen today, as people, one contact at a time.</p>

<p><a name="footnote-1" href="#inline-footnote-1">[1]</a> I was way off with this remark. I looked up performance benchmarks of the 80486 DX2 and it can performs about 2MFLOP/s, whereas an iPhone 7’s CPU is in the ballpark of 2-3GFLOP/s (that’s a 1000x difference, not “hundreds of thousands”).</p>

<hr />

<p>Thanks to Jimmy He, Nancy Ku, Nolan Ku and Eric Tsai for reading earlier drafts of this post and offering feedback.</p>]]></content><author><name>Peter Gao</name></author><category term="Culture" /><category term="Technology" /><category term="Musings" /><summary type="html"><![CDATA[As someone who lives and works in what is ostensibly called “Silicon Valley”, I find the perspective the valley holds on “progress” rather… narrow. Progress here lacks unity, and I don’t mean it in a “big vision thematic” sense of the word, but cultural unity: the ability to bring disparate groups of people together.]]></summary></entry></feed>