JoT
Digest
living

July 2020 Living

Huidong Yang

A lot of things need to be done. They have nothing to do with your career, not urgent, but they do take effort if you want to do a decent job. You keep pushing them behind, they're "errandy". But when the backlog piles up, you start to feel the back-pressure. Coding never ends, but errands are mostly one-off tasks. Plus, it's good to have some context switches, to get back to the societal living, so to speak. And I had good fun in the past (Summer 2018) when I took time off and put my mind into projects of daily living.

Here are the errandy things that I've been wanting to kill for a long time:

  • Replace old & broken roller blinds.
  • Apply silicone sealant in the kitchen to eliminate mold accumulation and fix existing cracked sealant.
  • Get MFA device removal done, i.e. notarization!

So July and August are dedicated to all the miscellaneous things that however need their eventual closure. Nothing lasts forever, you know?

Roller Blinds Installation

It's mostly about learning to drill holes in the concrete walls, but some parts were brick. Four roller blinds I got from IKEA (Tupplur, which I was told had been discontinued), meant 16 holes to drill. It turned out that just one out of the 16 locations had a rebar behind. The rotary hammer I got was not powerful enough to break into it, but fortunately, when the bit hit the rebar, it was already at a sufficient depth for the screw to get through.

Before this I did practice drilling one hole for hanging a picture, with the included dust collector. But later I realized that drilling a single hole was the easy part, because high precision wasn't required. When you need to drill two pairs of holes for the two brackets, each pair being two vertically aligned holes, managing to attack at the exact point is not trivial, especially with the dusk collector hindering the sight and adding uneven resistance. I learned the lesson with the very first installation, where I realized that the two holes I just created no longer aligned with those in the bracket (my first reaction was to blame the paper template IKEA provided, turned out the template was very accurate, typical amateur behavior). I freaked out, because there wasn't much of any tolerance allowed when it came to where the brackets should be placed. Under pressure I came up with the fix to drill on each side an extra hole on top of the upper hole, turning the original upper hole into the lower hole, effectively moving the installation level upward, which was OK as the abandoned lower holes would be covered by the blinds. But I had to ditch the dust collector to strive for better accuracy, so I made a mess, and drilled two holes that were well positioned.

And I thought I nailed precision drilling for good. In your dreams. In the final (4th) installation, I ran into the same problem, but with more experience I learned that screws had wiggle room in holes with wall plugs. In the case where one hole is off (to a limited extent), if you finish tightening one screw before the other, the second will definitely not fit, because the metal bracket is rigid; however, if you insert both screws into their holes through the bracket and drive them in concurrently, at some funny angles, eventually both can get fully through, because the wall plugs are flexible. That was what I did and it saved me from drilling two extra holes. Experience advanced.

Drilling holes on ceramic tiles was said to be tricky, and I watched a few YouTube videos showing how it could be done. I did not buy special bits but instead followed the simple technique: masking tape the spot, and lightly tap on a masonry bit with a hammer to crack the surface at the spot (I added some hand-drilling with the bit to get a smooth, tiny pocket), this technique essentially creates a stable and secure point to start drilling, preventing slipping or cracking. It turned out that you could drill very nice holes on tiles just using regular multi-purpose bits.

Some extra things I noticed from the process:

  • Using the spirit level, I saw that most of the window frames, plus the bathroom ceiling, were not level.
  • The bathroom wall with the window had a hollow space after about 5 cm, luckily 5 cm was the screw length.

JoT in Zola

Actually I started learning Zola, especially its templating language, Tera, at the end of June, but, as expected, designing and refining the stylesheets is the real time sink. But hey, I know you enjoy it. Again, the point of this, besides my interest in Zola, is that I believe the cost of creating a static site from scratch is well within what I'm comfortable to pay. Partly I think it's because of the inspiring stories of the creation of libraries that have long been thought of as not viable or wasteful (the old "Don't reinvent the wheel" dogma). But people start to realize that just using existing things bear other sorts of cost as well, most notably, the cost of a massive dependency tree, which can not only make your code bulkier, but more fragile and insecure.

When I was writing Projection, I decided to use Bulma because I then wouldn't have to worry about styling that many GUI components (and I couldn't do a better job). But a blog-like static site I realize does not require that daunting number of visual components. With SASS, which I learned while using Bulma, gives me all the power of abstraction and organization I needed to create a maintainable set of stylesheets for a simple site. Previously I made a static site using a CSS framework, which itself takes 75 KB minified, plus 4 KB of custom CSS un-minified. This time, the entire SASS files weighed under 6 KB, while the output CSS (inlined) was under 4 KB. And everything is under control. No guilty dread of not keeping a framework up-to-date.

CSS is not meant to be dismissed as a toy of course. Solid frameworks like Bulma still have their values, e.g. in rapid prototyping in webapp development. But CSS at the same time can be simple and straightforward, and with the expressive power of SASS, can be dry and neat. Heck, I want to try elm-ui one day for Arrow or Projection, I think an "industrial-strength" GUI library is wonderful, but keeping things simple and picking the right tool is a virtue as well. A static site should be simple. Yet it is something I will be using in the long run. So the solution is obvious: take some time to build one from scratch, focusing on simplicity, with no styling dependency. All it depends on is Zola/Tera.

Zola Bug Fix

While writing the site templates, I noticed an inconsistency in the format of current_path, a global variable in Zola. I opened an issue and thought the author would take care of it, given time. At the time I just used a macro to get this value by stripping the base URL from the full URL. After some exchange of reasoning, including my suggestion to have current_path always start with a slash, the author, Vincent Prouillet, agreed, and asked me if I was interested in working on the fix. I did not expect that. But at the same time, I felt a strong sense of community that I never felt before. We're all part of it, you don't expect to just report bugs and leave, this is how open source works mostly. So I responded with a yes, but asking for whatever guidance he was willing to give as I was a clueless newbie. Vincent replied:

No schedule right now, don't worry about it. Git will probably be more problematic than Rust/Zola :)

To start with, make sure you work on the next branch in git.

What I like to do with a clear defined issue like that is update the docs first and look for any tests that needs to be modified if there are some obvious ones or just do the changes and see what fails after cargo test --all.

In this case, current_path comes from:

  1. {page, section}.path: those are generated in components/library/src/content/page.rs and components/library/src/content/section.rs. Changing the path generation for those 2 should get you 90% there.
  2. The last 10% are taxonomies, paginated content and maybe colocated assets which I don't know if there is good test coverage on (probably not since you ran into the issue). Adding more tests should help there

There are some integration tests in components/site/tests where you can just add current_path in all the templates and add a check for it in each test.

Let me know if you need more details on some stuff or if you are overwhelmed!

All I needed to get started, I was pumped. Nervous, sure, first timer, but I loved the process. First PR and all. The task itself wasn't hard, but did require care for details and neatness, I did my best to not leave out any relevant instance, and have a decent test coverage. After getting what I thought was most of the work done, the remaining polishing and refinement weren't clearly defined, so I needed some "early feedback", especially on tests, because the tough truth we all know is you can always do better in that regard, and it mostly depends on what your standard is. I was as careful as I could be, and I took time to make sure of that.

While I was waiting for his feedback, I was having a bad day, and I don't recall exactly why. Then his response arrived:

this is my first PR ever, I hope I can get some early feedback from @Keats so that effort can be better directed :)

Sweating as I have no comments, this looks great! Thanks a lot

A great relief, and I remembered all the downness vanished in that instant. I felt that I was part of something greater than all the daily pettiness.

I know it's just a one-off thing, I am not a regular contributor to open-source, yet. But a step is a step. A lovely step all the same. Thanks, Vincent.