a tumblelog
week 39, 2019

The Last Astronaut: fantastic

In the evening I read finished The Last Astronaut by David Wellington. What a fantastic read; captivating until the very end. Highly recommended.

If you read The Last Astronaut and liked it, you might like Rendezvous with Rama and its sequels by Arthur C. Clarke, and Heart of the Comet by David Brin and Gregory Benford.

Introduction to Principal Component Analysis (PCA)

In Machine Learning, we need features for the algorithm to figure out patterns that help differentiate classes of data. More the number of features, more the variance (variation in data) and hence model finds it easy to make ‘splits’ or ‘boundaries’. But not all features provide useful information. They can have noise too. If our model starts fitting to this random noise, it would lose its robustness. So here’s the deal — We want to compose m features from the available feature space that give us maximum variance. Note that we want to compose and not just select m features as it is.

Source: Introduction to Principal Component Analysis (PCA) — with Python code, an article by Dhruvil Karani.

Finding the version of lxml installed

In the evening, when working on RSS support for the Python version of tumblelog, I wanted to know which version of lxml I had installed via apt-get earlier on. It turned out that the easiest way was to use dpkg -l python-lxml which reported version 4.3.3-1.

Learn Git Branching

Interested in learning Git? Well you've come to the right place! "Learn Git Branching" is the most visual and interactive way to learn Git on the web; you'll be challenged with exciting levels, given step-by-step demonstrations of powerful features, and maybe even have a bit of fun along the way.

In the evening I checked out Learn Git Branching. It looks very well made.

The Watchmaker's Daughter: a slow read

Just after midnight I finished The Watchmaker's Daughter, Glass and Steele Book 1 by C.J. Archer. It has been quite a slow read. I was hoping on a similar entertaining story as The Daemoniac, but my expectations were not met. I will read the sequel later this year, because I am curious how the quest for the watchmaker ends.

Serving JSON

Today, after working on improving the JSON feed for this blog I tried to validate it using the JSON Feed Validator expecting no errors. Instead I got:

Error: Content-Type was application/octet-stream. It should be application/json.

JSON Feed Validator showing Content-Type issue
JSON Feed Validator showing the Content-Type issue.

Since I use NGINX to host this site on a virtual private server (VPS) I SSHed into the VPS and added the following line to mime.types:

    application/json       json;
JSON Feed Validator success
JSON Feed Validator successfully validated the JSON feed.

After restarting the web server the feed could be validated without any issues.

The Last Astronaut

Sally Jansen was NASA's leading astronaut, until a mission to Mars ended in disaster. Haunted by her failure, she lives in quiet anonymity, convinced her days in space are over.

She's wrong.

In the evening I started in The Last Astronaut by David Wellington.

Tmux Tutorial

In this short tutorial, I am going through some of the basic concepts and commands for Tmux, and how to use a Tmux plugin, which is called Tmux Resurrect, to restore Tmux environment after reboot or Tmux server restart.

Source: Tmux Tutorial, by Lei Mao.

See also Hacker News for a discussion of this short tutorial and additional tips.

How to use the journalctl Linux command

If you've used any modern Linux distribution, chances are good you have become familiar with systemd. You might have also happened upon a systemd issue when an app or service refuses to start. When that's the case, you might have found yourself in a situation where you're not quite sure how to begin troubleshooting.

Fortunately for every Linux admin, there's a built-in tool to help you with that. Said tool is journalctl. Journalctl is the utility used for querying the systemd logging utility, journald. With the help of journald and journalctl, you can begin the process of troubleshooting why a service is refusing to start. Journald also tracks logs to a specific boot. With this mechanism, you can compare system boots to see when a service was working properly versus when it wasn't.

Source: How to use the journalctl Linux command, an article by Jack Wallen.

An advanced look at Python interfaces using zope.interface

In order to make those things explicit, you need a way to express expected interfaces. One of the first big systems written in Python was the Zope web framework, and it needed those things desperately to make it obvious what rendering code, for example, expected from a "user-like object."

Enter zope.interface, which is developed by Zope but published as a separate Python package. Zope.interface helps declare what interfaces exist, which objects provide them, and how to query for that information.

An advanced look at Python interfaces using zope.interface, an article by Moshe Zadka.

Building Wx under Strawberry Perl (32 bit)

In the evening I tried to build the Wx module under Strawberry Perl inside a virtual machine running Windows 10. After a very long build time the process failed with: 'my_perl' was not declared in this scope.

After a quick Google I found a solution by Kai-Uwe: patching cpp\wxapi.h. Thanks!

Better Box Shadows

Box shadow on HTML elements has been widely supported across most browsers for a while now, but I find the default options don’t allow for much visual manipulation of the shadows in general.

Source: Better Box Shadows

Better HTML5

In the evening I improved the HTML5 generated by tumblelog, the static microblog generator I wrote and use for this site. Read all about it in Nav Element with no Heading.

I bumped the version to 2.1.0 and added a to the repository.

Get version 2.1.0.

What’s Faster? COUNT(*) or COUNT(1)?

One of the biggest and undead myths in SQL is that COUNT(*) is faster than COUNT(1). Or was it that COUNT(1) is faster than COUNT(*)? Impossible to remember, because there’s really no reason at all why one should be faster than the other. But is the myth justified?

Let’s measure!

Source: What’s Faster? COUNT(*) or COUNT(1)?.

Learn CSS by Playing Games

In the evening I played 3 games to practice my CSS:

Have fun!