Sekai ๐ŸŒ ๐Ÿ—บ

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

Polar Rose in Julia

Background

I’m doing exercise 4.9 of Think Julia, which asks for a function for a polar rose using Luxor’s turtle graphics.

Difficulties

  1. Work out the geometric structure of the family of polar roses. The key is to construct some auxiliary isoceles triangles and work out the angles between them. One sees that they are parametrized by two varaibles n and k.
    • n: number of petals
    • k: petal increment
    • constraint: k โ‰  n รท 2
  2. Handle the case when gcd(n, k) > 1, i.e. more than one closed loop.
  3. The positive x direction goes to the right; the positive y direction goes down.

Attempt

  1. Use ThinkJulia.Reposition(t::Turtle, x, y) to reposition the turtle.
  2. Use turn(t::Turtle, ฮธ) to turn t
  3. Use ThinkJulia.Orientation(t::Turtle, ฮธ) to restore the turtle’s orientation after the move.

Code

I spend three days writing and testing this function.

[Read More]

Deploy Hugo Theme exampleSite With Github Actions

Motivation

To test PRs on the upstream of a Hugo theme by setting up a testing branch.

Goal

To deploy a forked GitHub repo for a Hugo theme with exampleSite to GitHub Pages using GitHub Actions.

The whole article is based on my fork of Hugo Future Imperfect Slim.

References

  1. GitHub Actions for Hugo
  2. A Stack Overflow question showing pwd in GitHub Actions
  3. A Hugo Discourse post about testing exampleSite

Difficulties

I had failed for about ten times before I got the job done.

[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

  1. SQL Server is proprietary.
  2. SQLite used in Microsoft’s ASP.NET Core 5 MVC tutorial isn’t made for web apps.
  3. MySQL doesn’t perform well with concurrent read-writes. It’s dual-licensed like GitLab.
  4. Some users find PostgreSQL cost-effective.

Useful tutorials

  1. MS’s tutorial in item 2 above.
  2. Wes Doyle’s YouTube video goes through the steps
  3. MS’s tutorial for Razor Pages with EF Core migrations

Steps

  1. Create a superuser in the database.

    [Read More]

Deleted Question on Semi-Simple and Projective but not Injective Module

A backup of a deleted PSQ : https://math.stackexchange.com/q/3955443/290189

OP : irfanmat

It has a detailed answer by Atticus Stonestrom. It’s pity that his post got deleted. As there’s no reason for undeletion, I’m posting it here so as to preserve the contents.

Question body

Is there a semi-simple and projective but not injective module? I will be glad if you help.

Response(s)

In the non-commutative case, the answer is yes. Consider $R$ the ring of upper triangular $2\times 2$ matrices over a field $F$, and denote by $e_{ij}$ the element of $R$ with the $ij$-th entry equal to $1$ and all other entries equal to $0$. We can decompose $R$ as a direct sum of left ideals $$Re_{11}\oplus (Re_{12}+Re_{22})=Re_{11}\oplus Re_{22},$$ so let $M=Re_{11}$. Then $M$ is clearly simple, and โ€“ as a direct summand of the free module $R$ โ€“ is also projective. However, $M$ is not injective; consider the map $f:Re_{11}\oplus Re_{12}\to M$ taking $e_{11}$ and $e_{12}$ to $e_{11}$. $Re_{11}\oplus Re_{12}$ is a left ideal of $R$, but there is no way to extend $f$ to a map $R\rightarrow M$, so this gives the desired example.

[Read More]

Another Math.SE Double Integral Using Polar Coordinate

I wanted to post the following answer to a question on double integral on Math.SE, but someone had submitted his work before I finished typing. As a result, I’m posting this on my personal blog.

Let $r = \sqrt{x^2+4y^2}$ and $t = \begin{cases} \tan^{-1}(2y/x) &\text{ if } x > 0 \\ \pi/2 &\text{ if } x = 0. \end{cases}$ Then $\begin{cases} x &= r \cos t \\ y &= (r \sin t)/2 \end{cases}$ and $D = { (r,t) \mid r \ge 0, t \in [\pi/4, \pi/2] }$. Calculate the Jacobian

[Read More]

Ways to Draw Diagrams Displayed on Math.SE

I wanted to start a meta question, but I don’t see a point of that after viewing some related posts listed at the end of the next subsection.

Intended question

You may vote on your preferred way.

Ways Advantages Disadvantages
AMScd supported on Math.SE for a long time
  • no diagonal arrows
  • syntax less well-known
  • Two-way arrows $\rightleftarrows$ look odd
array
  • supported on Math.SE for a long time
  • easier syntax
  • write basic diagonal arrows like $\nearrow$
  • fine tuning spacing is hard
  • diagonal arrows only work for neighboring nodes
ASCIIFlow WYSIWYG interface lines are rendered as slashes in code
TikZ
  • well known syntax
  • can draw pretty diagrams
not supported on SE, need to import as picture
others?

Related questions:

[Read More]

Combat Procrastination

My notes for a YouTube video about procrastination on one hearing only.

Why?

  1. Boring tasks.

    It’s necessary?

    • Yes: Make it fun.
      • Get a study partner.
      • Find a more energetic time.
    • No: Get rid of it.
  2. Surrounding environment.

    • Identify someone who procrastinates in your circle of influence.
    • Distance yourself from them, or
    • Be aware of what their behavior.
  3. Perfectionism

    • Know about yourself.
    • Reality: nothing can be perfect.

Five strategies against procrastination:

  1. Decompose a huge task into smaller parts.

    [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.4-0:amd64                        1:0.4.18+om-0ubu18.04.18~ppa     
     amd64        Generic Graphics Library
ii  libgegl-common                             1:0.4.18+om-0ubu18.04.18~ppa     
     all          Generic Graphics Library - common files

Despite deletion of ppa:otto-kesselgulasch/gimp by ppa-purge, that leaves a trace in /etc/apt/sources.list.d.

[Read More]
Ubuntu  GIMP 

Recover Mysql Root Password

Just a little linklog to a relevant page on How to Forge. Root privileges are needed.

  1. Stop service: service mysql stop

  2. Start MySQL server w/o password: mysqld_safe --skip-grant-tables &

  3. Connect to CLI client as root: mysql -u root

  4. 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
    
  5. Repeat step 1, or killall mysqld if it doesn’t work. Output can be different on different Linux distro.

    [Read More]
MySQL 

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

  1. issues raghur/mermaid-filter#51 and #52
  2. issue gitlab-org/gitlab-runner#4566

Useful code/articles

  1. time-machine-project/requests-for-comments@470b0c5 Dockerfile
  2. Reduce Docker Image Sizes Using Alpine
  3. Best practices for building docker images with GitLab CI with the accompanying gist
  4. The code block in the highlighted comment in item 2 of the above section
  5. pandoc installation for Docker
  6. Sample Dockerfile for Alpine Linux in the troubleshooting of Puppeteer
  7. sc250024/docker-mermaid-cli@3c9ddb5 src/puppeteerConfigFile.json
  8. raghur/mermaid-filter project README’s section about Puppeteer config file