Plurrrr

week 07, 2021

My Logging Best Practices

If you are a backend developer like me, logging is the window to your application. Unlike in the frontend, there’s not much to see except from some logging messages. Here are some of my personal guidelines I use when I write logs.

Source: My Logging Best Practices, an article by Thomas Uhrig.

What's a DKIM Record?

A DomainKeys Identified Mail (DKIM) record is a piece of text that you can add to your Domain Name System (DNS). The record is a special key that gives email providers (such as Gmail or Outlook) a way to verify if an email was created by the owner of a domain. Email providers can check each email received against this record to see if it is likely to be spam or forged.

Setting up DKIM will help reduce the chances of your emails being categorized as spam, and help others build confidence that the contents of your emails have come from you, without being tampered with.

Source: What's a DKIM Record?

Level your productivity up with your shell’s history and aliases

Days ago I came across a blog post teaching about using your shell’s history more intensively to boost productivity. I wanted to reflect on my own usage, and share some of my tips and tricks.

Over the time, I created a lot of aliases useful to me, and I also reused some from the community. In the end I accumulate so much aliases that I can’t remember them all 🙂

Source: Level your productivity up with your shell’s history and aliases, an article by Morgan Wattiez.

Seize the day: Training your brain to get stuff done

You stare at a pile of notes and your list of to-dos continues to increase every day. The number of impending deadlines is overwhelming so you attempt to sit down and work. However, your brain would rather inspect that random mark on your wall than be productive. You get a notification, open it, and suddenly you are riding the procrastination train again. Sounds familiar? You are not alone.

Source: Seize the day: Training your brain to get stuff done, an article by L. Leal.

A Super-Post on Python Inheritance

Inheritance is an object oriented feature which allows us to reuse logic by defining parent classes that pass on certain behavior to subclasses.

In this article, we’ll cover some examples of inheritance with Python, the use of the super() function, and some practical examples of inheritance through the use of mixins. The focus will be more on understanding the complexities of multiple inheritance.

Source: A Super-Post on Python Inheritance, an article by Sangeeta Jadoonanan.

What security does a default OpenBSD installation offer?

In this text I will explain what makes OpenBSD secure by default when you install it. Do not take this for a security analysis, but more like a guide to help you understand what is done by OpenBSD to have a secure environment. The purpose of this text is not to compare OpenBSD to others OS but to say what you can honestly expects from OpenBSD.

There are no security without a threat model, I always consider the following cases: computer stolen at home by a thief, remote attacks trying to exploit running services, exploit of user network clients.

Source: What security does a default OpenBSD installation offer?, an article by Solène Rapenne.

Zsh Tricks to Blow your Mind

In UNIX-based programming, we often talk about shells, terminals, and the command line interfaces. Bash is probably the most well-known, but there are other widely-used options as well, such as Zsh or the Z shell. Read on to learn more about Zsh and some tips and tricks to optimize your development.

Source: Zsh Tricks to Blow your Mind, an article by Lizzie Siegle.

Efficiently Cleaning Text with Pandas

It’s no secret that data cleaning is a large portion of the data analysis process. When using pandas, there are multiple techniques for cleaning text fields to prepare for further analysis. As data sets grow large, it is important to find efficient methods that perform in a reasonable time and are maintainable since the text cleaning process evolves over time.

This article will show examples of cleaning text fields in a large data file and illustrates tips for how to efficiently clean unstructured text fields using Python and pandas.

Source: Efficiently Cleaning Text with Pandas, an article by Chris Moffitt.

Nahual bokmai

In the morning I was pleasantly surprised by Rodrigo on Facebook. In a comment he let me know that a species of short-tailed whipscorpion had been named after me back in 2019!

Parts of the Nahual bokmai article
Parts of the Nahual bokmai article.

Etymology: The specific name is a patronym, honoring John Bokma, a naturalist and amateur arachnologist, who has discovered many new species of arachnids in the surroundings of Xalapa, and guided the authors to the type locality of this species.

😊

Xalapa bridge
Xalapa bridge.

The bridge mentioned is the Xalapa bridge which has a single pier that drops almost 90 meters to the floor of a deep canyon. It is there where this species of short-tailed whipscorpion can be found.

Canyon habitat, close to the type location
Canyon habitat, close to the type location.

In a similar habitat, also a canyon, close to the town of Palmarejo; Veracruz, which is also a short distance from Xalapa, I have found short-tailed whipscorpions walking on the underside of large rocks after rolling those over.

Female short-tailed whipscorpion Nahual cf. bokmai
Female short-tailed whipscorpion Nahual cf. bokmai.

Since this specimen was photographed in a very similar habitat I guess it's Nahual bokmai. Most likely it's impossible to tell this from the photo alone, which was made with a Canon A640 in macro mode.

Habitat of short-tailed whipscorpions near Palmarejo
Habitat of short-tailed whipscorpions near Palmarejo.

Short-tailed whip scorpions are very tiny, just a few mm, and look to the untrained naked eye like ants; except they move in a different way.

Canyon near Palmarejo, Veracruz
Canyon near Palmarejo, Veracruz.

Reference: Systematics of the short-tailed whipscorpion genus Stenochrus Chamberlin, 1922 (Schizomida, Hubbardiidae), with descriptions of six new genera and five new species. (Bulletin of the American Museum of Natural History, no. 435) Monjaraz-Ruedas, Rodrigo.; Prendini, Lorenzo.; Francke, Oscar F..

Many Small Queries Are Efficient In SQLite

The Appropriate Uses For SQLite page says that dynamic pages on the SQLite website typically do about 200 SQL statements each. This has provoked criticism from readers. Examples:

  • "200 SQL statements is a ridiculously high number for a single page"
  • "For most sites, 200 queries is way, way, way too much."
  • "[This is] bad design"

Such criticism would be well-founded for a traditional client/server database engine, such as MySQL, PostgreSQL, or SQL Server. In a client/server database, each SQL statement requires a message round-trip from the application to the database server and back to the application. Doing over 200 round-trip messages, sequentially, can be a serious performance drag. This is sometimes called the "N+1 Query Problem" or the "N+1 Select Problem" and it is an anti-pattern.

Source: Many Small Queries Are Efficient In SQLite.

Don't Mess with Backprop

Biologically Plausible Deep Learning (BPDL) is an active research field at the intersection of Neuroscience and Machine Learning, studying how we can train deep neural networks with a "learning rule" that could conceivably be implemented in the brain.

The line of reasoning that typically motivates BPDL is as follows:

  1. A Deep Neural Network (DNN) can learn to perform perception tasks that biological brains are capable of (such as detecting and recognizing objects).
  2. If activation units and their weights are to DNNs as what neurons and synapses are to biological brains, then what is backprop (the primary method for training deep neural nets) analogous to?
  3. If learning rules in brains are not implemented using backprop, then how are they implemented? How can we achieve similar performance to backprop-based update rules while still respecting biological constraints?

A nice overview of the ways in which backprop is not biologically plausible can be found here, along with various algorithms that propose fixes.

Source: Don't Mess with Backprop: Doubts about Biologically Plausible Deep Learning, an article by Eric Jang.

Faster JavaScript calls

JavaScript allows calling a function with a different number of arguments than the expected number of parameters, i.e., one can pass fewer or more arguments than the declared formal parameters. The former case is called under-application and the latter is called over-application.

In the under-application case, the remaining parameters get assigned the undefined value. In the over-application case, the remaining arguments can be accessed by using the rest parameter and the arguments property, or they are simply superfluous and they can be ignored. Many Web/NodeJS frameworks nowadays use this JS feature to accept optional parameters and create a more flexible API.

Until recently, V8 had a special machinery to deal with arguments size mismatch: the arguments adaptor frame. Unfortunately, argument adaption comes at a performance cost, but is commonly needed in modern front-end and middleware frameworks. It turns out that, with a clever trick, we can remove this extra frame, simplify the V8 codebase and get rid of almost the entire overhead.

Source: Faster JavaScript calls an article by Victor Gomes.