Animated GIF Screenshots on Ubuntu

Background

I’ve to take screenshots to demonstrate Conky’s visual output.

animated GIF screenshot taken by Byzanz

I’ve chosen Byzanz after reading this answer on Ask Ubuntu.

Peek is more user-friendly, but I prefer CLI’s precision. That’s feasible thanks to a comment mentioning xwininfo.

After typing xwininfo, click on the target window. Switching to adjacent workplace is possible.

$ xwininfo
xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x1c0000a "Desktop"

  Absolute upper-left X:  0
  Absolute upper-left Y:  0
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 1920
  Height: 1080
  Depth: 32
  Visual: 0x1a7
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x1c00009 (not installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +0+0  -0+0  -0-0  +0-0
  -geometry 1920x1080+0+0

The --x and --y parameters below correspond to the absolute upper-left position of the window.

[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 

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]

Julia Rcall Installation

Rcall.jl build failure due to missing dependencies

Problem

During the installation of RCall.jl, the package wasn’t successfully built due to a missing variable $R_HOME.

$ julia -q
julia> Pkg.add("RCall")
 Resolving package versions...
 Installed WinReg ─ v0.3.1
 Installed RCall ── v0.13.2
  Updating `~/.julia/environments/v1.0/Project.toml`
  [6f49c342] + RCall v0.13.2
  Updating `~/.julia/environments/v1.0/Manifest.toml`
  [6f49c342] + RCall v0.13.2
  [1b915085] + WinReg v0.3.1
  Building RCall → `~/.julia/packages/RCall/ffM0W/deps/build.log`
┌ Error: Error building `RCall`:
│ ERROR: LoadError: R_HOME is not a directory.
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] top-level scope at logging.jl:322
│  [3] top-level scope at /home/vin100/.julia/packages/RCall/ffM0W/deps/build.jl
:19
│  [4] include at ./boot.jl:317 [inlined]
│  [5] include_relative(::Module, ::String) at ./loading.jl:1041
│  [6] include(::Module, ::String) at ./sysimg.jl:29
│  [7] include(::String) at ./client.jl:388
│  [8] top-level scope at none:0
│ in expression starting at /home/vin100/.julia/packages/RCall/ffM0W/deps/build.
jl:10
└ @ Pkg.Operations /buildworkjr/worker/package_linux64/build/usr/share/julia/std
lib/v1.0/pkg/src/operations.jl:1069

Discussion

It took me a few minutes to realise that the cause of this error is the absence of R. I referred to CRAN’s installation instructions for Ubuntu and added

[Read More]
Julia  RCall  R 

Xubuntu Screen Enlargement

Tonight, the screen of Xubuntu suddenly enlarged and blurred. Typing “xubuntu screen display enlarged” on Google, I’ve learnt that the <Alt> key and the mouse scroll wheel can enlarge/minify screen display from Ubuntu Forums.

Linux