Sekai 🌐 πŸ—Ί

Sekai (δΈ–η•Œ) is the kanji for “the world”. That’s a great word because of the scale that it designates.

Huginn Theme With Staticman

Goal

To provide Staticman support to the Hugo theme Huginn.

Motivation

A Framagit user tried using the public GitLab instance but failed. Finally, he removed Staticman from his site and his Hugo theme.

If I had been notified, I would have explained that that was due to the constraint of gitlabBaseUrl, which could only take one GitLab instance.

In response to demand for Staticman from Framagit users, I set up another GitLab instance of Staticman API and forked some Hugo/Jekyll repo under the project page Staticman et GitLab Pages.

[Read More]

Right PATH to Linux

Roles of various config files

Background

Updated $\LaTeX$ version

From this $\TeX$-SE question about tlmgr, we see some advantages of installing $\TeX$Live directly from the official site:

  1. avoid errors due to outdated version of $\TeX$Live supplied by the OS’s package manager
  2. easier to manage packages with tlmgr.
  3. enjoy the newer version of $\TeX$Live not yet available in your current GNU/Linux version.

The installation took about 30 minutes and 5G in the disk. I’ve chosen a local installation as this didn’t require sudo privileges. The whole process went smooth and the system displayed a message about setting

[Read More]
Linux 

Package Versioning for Julia Projects

Resolved GLM installation error

Update: Thanks to JuliaRegistries/General#647, the version cap of the package Distributions has now been removed, so that one can directly install the package GLM along with Distributions v0.19.2.

Background

I’m reading the book Statistics with Julia, which makes use of GLM.

Problem

I encountered the following error, which I posted in the issue GLM.jl#311.

(v1.1) pkg> add GLM
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package GLM [38e38edf]:
 GLM [38e38edf] log:
 β”œβ”€possible versions are: [0.2.0-0.2.5, 0.3.0-0.3.2, 0.4.0-0.4.8, 0.5.0-0.5.6, 0
.6.0-0.6.1, 0.7.0, 0.8.0-0.8.1, 0.9.0, 0.10.0-0.10.1, 0.11.0, 1.0.0-1.0.2, 1.1.0
-1.1.1] or uninstalled
 β”œβ”€restricted to versions * by an explicit requirement, leaving only versions [0
.2.0-0.2.5, 0.3.0-0.3.2, 0.4.0-0.4.8, 0.5.0-0.5.6, 0.6.0-0.6.1, 0.7.0, 0.8.0-0.8
.1, 0.9.0, 0.10.0-0.10.1, 0.11.0, 1.0.0-1.0.2, 1.1.0-1.1.1]
 β”œβ”€restricted by compatibility requirements with DataFrames [a93c6f00] to versio
ns: [0.4.0-0.4.8, 0.5.0-0.5.6, 0.6.0-0.6.1, 0.7.0, 0.8.0-0.8.1, 0.9.0, 0.10.0-0.
10.1, 0.11.0, 1.0.0-1.0.2, 1.1.0-1.1.1] or uninstalled, leaving only versions: [
0.4.0-0.4.8, 0.5.0-0.5.6, 0.6.0-0.6.1, 0.7.0, 0.8.0-0.8.1, 0.9.0, 0.10.0-0.10.1,
 0.11.0, 1.0.0-1.0.2, 1.1.0-1.1.1]
 β”‚ └─DataFrames [a93c6f00] log:
 β”‚   β”œβ”€possible versions are: [0.1.0, 0.2.0-0.2.5, 0.3.0-0.3.16, 0.4.0-0.4.3, 0.
5.0-0.5.12, 0.6.0-0.6.11, 0.7.0-0.7.8, 0.8.0-0.8.5, 0.9.0-0.9.1, 0.10.0-0.10.1, 
0.11.0-0.11.7, 0.12.0, 0.13.0-0.13.1, 0.14.0-0.14.1, 0.15.0-0.15.2, 0.16.0, 0.17
.0-0.17.1, 0.18.0-0.18.2] or uninstalled
 β”‚   └─restricted to versions 0.18.2 by an explicit requirement, leaving only ve
rsions 0.18.2
 β”œβ”€restricted by compatibility requirements with StatsBase [2913bbd2] to version
s: [0.11.0, 1.0.0-1.0.2, 1.1.0-1.1.1] or uninstalled, leaving only versions: [0.
11.0, 1.0.0-1.0.2, 1.1.0-1.1.1]
 β”‚ └─StatsBase [2913bbd2] log:
 β”‚   β”œβ”€possible versions are: [0.1.0, 0.2.0-0.2.1, 0.2.3-0.2.10, 0.3.0-0.3.13, 0
.4.0-0.4.4, 0.5.0-0.5.3, 0.6.0-0.6.16, 0.7.0-0.7.4, 0.8.0-0.8.3, 0.9.0, 0.10.0, 
0.11.0-0.11.1, 0.12.0, 0.13.0-0.13.1, 0.14.0-0.14.1, 0.15.0, 0.16.0-0.16.1, 0.17
.0, 0.18.0, 0.19.0-0.19.5, 0.20.0-0.20.1, 0.22.0, 0.23.0-0.23.1, 0.24.0, 0.25.0,
 0.26.0, 0.27.0, 0.28.0-0.28.1, 0.29.0, 0.30.0] or uninstalled
 β”‚   └─restricted to versions 0.30.0 by an explicit requirement, leaving only ve
rsions 0.30.0
 └─restricted by compatibility requirements with Distributions [31c24e10] to ver
sions: uninstalled β€” no versions left
   └─Distributions [31c24e10] log:
     β”œβ”€possible versions are: [0.1.0-0.1.4, 0.2.0-0.2.13, 0.3.0, 0.6.4-0.6.7, 0.
7.0-0.7.6, 0.8.0-0.8.10, 0.9.0, 0.10.0-0.10.2, 0.11.0-0.11.1, 0.12.0-0.12.5, 0.1
3.0, 0.14.0-0.14.2, 0.15.0, 0.16.0-0.16.4, 0.17.0, 0.18.0, 0.19.1-0.19.2] or uni
nstalled
     └─restricted to versions 0.19.2 by an explicit requirement, leaving only ve
rsions 0.19.2

Discussion

Although the packages StatsBase and DataFrames appear in the above error message, the cause of this problem was actually the package Distributions.

[Read More]
Julia  GLM 

Insensitive Laptop Touchpad

Log of my Ubuntu Tweak config

Problem

The touchpad on my new Ubuntu 18.04 LTS laptop was frozen. Toogling πŸ–± with <Fn>-<F4> didn’t worked.

Attempt

  1. Logout: didn’t work at all
  2. Reboot: worked most of the time

Partial solution

After changing the Mouse Click Emulation in Keyboard & Mouse in Ubuntu Tweak from the default “Fingers” (2 fingers for right click; 3 fingers for middle click) to “Area” (Right/middle click determined by clicked area), one might have to wait for next reboot.

[Read More]

Juno Installation 2019

Log of system-wide config

Goal

To install Juno for convenient development in Julia.

Problem

After Juno installation, I received the following error.

Juno error

Analysis

From the error message, the system had tried to find an executable file julia, which would then be executed by the shell /bin/sh. Nonetheless, it’s absent from the system’s environment $PATH, so Juno couldn’t find it.

I’ve only changed my $PATH in ZSHRC, which is user-specific.

Solution

This Stack Overflow question about $PATH setting on *nix has provided various solution. As I was in a hurry to get Julia run on Juno, I’ve taken the advice from the best answer. I prefer creating a separate shortcut under /usr/bin, rather than editing system-wide config files.

[Read More]
Juno  Atom  Julia 

Conditional Batch File Editing

Adopted Mmark for Math Posts

Problem

During the adoption of Mmark for math posts on this blog, I had to insert markup: mmark at the last line of front matter of the source file of each math post.

Seek help

I separated this into two SO questions

  1. Sed conditional match and execute command with offset, and
  2. A question about AWK multiple line recognition.

Solution

From #1., I learnt the use of variables in AWK scripts. From #2, some users explained how these variables can be used for multi-line regex search.

[Read More]
awk  sed  Mmark 

My Intended Trigo Answer

The Math.SE question $2\cos(2x) - 2\sin(x) = 0$ has attracted several answers from high-rep users.

I am expanding @rhombic’s comment into an answer.

$$ \begin{aligned} 2\cos(2x)-2\sin(x)&=0 \\ 2 - 4\sin^2(x)-2\sin(x)&=0 \\ 2\sin^2(x)+\sin(x) - 1&=0 \\ (2 \sin(x) - 1)(\sin(x) +1) &= 0 \\ \sin(x) = \frac12 \text{ or } \sin(x) &= -1 \\ x = \frac{\pi}{6}, \frac{5\pi}{6} \text{ (rejected) or } & \frac{3\pi}{2} \text{ (rejected)} \end{aligned} $$

Improved Integration of Hugo and $\KaTeX$

Problem

There’s no custom $\KaTeX$ macro in local preview since I’ve merged some recent commits from the upstream of this blog’s theme, in particular, Beautiful Hugo’s pull requests #246 and #255, which allowed self-hosting the theme’s static JS, CSS and font files. This self-hosted option is particularly useful in case of slow response from Cloudflare’s CDN.

hugo local preview no KaTeX macro

public Hugo blog KaTeX auto-renderer error

Even they do appear on the public GitLab site, the final rendered Markdown + $\TeX$ code would be succumb to syntax errors due to their absence in the preview process.

[Read More]
KaTeX  Mmark  Hugo 

JavaScript Copy Button

Goal

To create a copy button for my Math.SE comment template in order to save the trouble of copying and pasting.

My first attempt

I put the boilerplate inside a Markdown codeblock to prevent them from getting interpreted by Hugo’s Markdown parser. Under each codeblock, I placed the copy button.

Comment boilerplate goes here ...

Another comment boilerplate goes here ...

My page’s original layout

$(document).ready(function() {
  $('.copyBtn').click(function() {
    copy($(this).prev().children())
j  });
});

function copy(selector) {
  var screenTop = $(document).scrollTop();
  var $temp = $("<div>");
  $("body").append($temp);
  $temp.attr("contenteditable", true)
       .html($(selector).html()).select()
       .on("focus", function() { document.execCommand('selectAll',false,null) })
       .focus();
  document.execCommand("copy");
  $temp.remove();
  $('html, body').scrollTop(screenTop);
}

static/js/copyBtn.js at Git tag copyBtn0

[Read More]

My Dual Answer

Update: The question has been reopened.

I intended to answer κΉ€μ’…ν˜„’s problem on Math.SE. However, the programs in the question body aren’t typeset in MathJax. As a result, I downvoted and closed this question because found it unclear. From the proposed dual, it seems that I shouldn’t interpret the primal as a linear program. Anyways, without further clarifications from OP, I found no reason to look at this further. Here’s my intended answer:

[Read More]