Import Once in Julia

Background I’m reading Think Julia to repick the language again. To import a package/module, we using Foo. To run a script within the REPL, we include("foo.jl"). This is useful for user-defined functions, which are usually multi-line. Problem How to avoid importing a module/including a file twice? Solution Here’s a modified code from the book to give an example. polygon.jl depends on the module :ThinkJulia, and it defines a function which moves the object t along a polygon-shaped closed loop. [Read More]

First Experience with ASP.NET Core MVC & PostgreSQL

Goal To build an ASP.NET Core 5 MVC web app linked with a PostgreSQL. Motivation SQL Server is proprietary. SQLite used in Microsoft’s ASP.NET Core 5 MVC tutorial isn’t made for web apps. MySQL doesn’t perform well with concurrent read-writes. It’s dual-licensed like GitLab. Some users find PostgreSQL cost-effective. Useful tutorials MS’s tutorial in item 2 above. Wes Doyle’s YouTube video goes through the steps MS’s tutorial for Razor Pages with EF Core migrations Steps Create a superuser in the database. [Read More]

GIMP w'ont Start after Ubuntu Distro Upgrade

Problem After upgrading to Ubuntu 20.04 form 18.04, I wasn’t able to start GIMP 2.10. The message was in the same format as that in a related Ask Ubuntu question, except that the version numbers were greater. I attempted installing the package gegl, which was irrelavant to the problem. Analysis I found the answers mentioning the package libgegl helpful. $ dpkg -l | grep gegl ii gegl 0.4.22-3 amd64 Generic Graphics Library Test Program ii libgegl-0. [Read More]
Ubuntu  GIMP 

Recover Mysql Root Password

Just a little linklog to a relevant page on How to Forge. Root privileges are needed. Stop service: service mysql stop Start MySQL server w/o password: mysqld_safe --skip-grant-tables & Connect to CLI client as root: mysql -u root Reset root password. Here’s the syntax for ≥v.5.7.6. mysql> use mysql; mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD("newpass"); mysql> flush privileges; mysql> quit Repeat step 1, or killall mysqld if it doesn’t work. [Read More]

Pandoc Latex Mermaid on GitLab CI

Goal To provide an open-source alternative to the Docker image escalope/pandoc-mermaid-plantuml, whose Dockerfile isn’t available. The rationale behind these difficult setup is simple: construct informative Mermaid diagram with intuitive Markdown syntax in an open-source and economic way. This newly constructed Docker image is entirely on GitLab. No Docker Hub account is needed. For sample usage, consult .gitlab-ci.yml in my test project. Difficulties issues raghur/mermaid-filter#51 and #52 issue gitlab-org/gitlab-runner#4566 Useful code/articles time-machine-project/requests-for-comments@470b0c5 Dockerfile Reduce Docker Image Sizes Using Alpine Best practices for building docker images with GitLab CI with the accompanying gist The code block in the highlighted comment in item 2 of the above section pandoc installation for Docker Sample Dockerfile for Alpine Linux in the troubleshooting of Puppeteer sc250024/docker-mermaid-cli@3c9ddb5 src/puppeteerConfigFile. [Read More]

Network Interface Name Detection in Conky

Once-off Conky config for network graphs

When one changes connection type (say, from ethernet to Wi-Fi), the interface name changes (e.g. eth0 → wlan1). To avoid changing Conky config file all the time, here’s a little Lua function for finding the network interface name. function findInterface() local handle = io.popen('ip a | grep "state UP" | cut -d: -f2 | tr -d " "') local result = handle:read('*a'):gsub('\n$','') handle:close() return result end ip a gives everything about connection info. [Read More]
Conky  Lua 

CPU Temperature Display in Conky

Background I’m using Conky for monitoring the system. After a system upgrade, the CPU temperatures were gone. Conky’s standard error showed the following. Conky: can't open '/sys/class/hwmon/hwmon0/temp3_input': No such file or directory please check your device or remove this var from Conky... Source of message: An easy fix would be to adjust the following lines in .conkyrc according to the number N in /sys/class/hwmon/hwmonN containing the file temp3_input. (You may adjust the number 3 according to the number of CPU of your device. [Read More]
Conky  CPU  Linux 

Animated GIF Screenshots on Ubuntu

Background I’ve to take screenshots to demonstrate Conky’s visual output. 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. [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: avoid errors due to outdated version of $\TeX$Live supplied by the OS’s package manager easier to manage packages with tlmgr. 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. [Read More]

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. [Read More]
Julia  GLM