week 25, 2020

5 Quick Tips for Pipenv

I used to love Pipenv, but these days with some uncertainty around the direction and upkeep of the project my feelings are a little less clear. Nonetheless, I still use Pipenv daily for a variety of production-ready services and libraries. All of the tips in this list can be found if you dig deep into the documentation, but with the regularity that they come up, it can be handy to have a cheat sheet.

Source: 5 Quick Tips for Pipenv, an article by Andrew Scott.

Views on Error Handling

In this post, I summarize some accomplished engineer’s views on error handling. There is a distinction between errors that are caused by programmer neglecting bugs and those that represent true error conditions. The granularity of error checking is also up for debate: Per function? Per module? Jump to dialog handler in the main message loop? Kill the process and restart?

Source: Views on Error Handling, an article by Daniel Näslund.

You don't need virtualenv in Go

Programmers that come to Go from Python often wonder "do I need something like virtualenv here?"

The short answer is NO; this post will provide some additional details.

While virtualenv in Python is useful in many situations, I think it'd be fair to divide them into two broad scenarios: for execution and for development. Let's see what Go offers for each of these scenarios.

Source: You don't need virtualenv in Go, an article by Eli Bendersky.

Handling an Aphonopelma seemanni

In the early evening I noticed that the Aphonopelma seemanni I keep was entirely out of its burrow. I used a large pair of tweezers to block the tarantula from bolting backwards into its burrow. Next, I guided it carefully on my hand.

Aphonopelma seemanni on my hand
Aphonopelma seemanni on my hand.

It was quite restless and got off my hand on the desk. Adam got down to get my iPhone so I could take a photo while I kept an eye on the large tarantula sitting on my desk.

Aphonopelma seemanni on my hand
Aphonopelma seemanni on my hand. Photo by Esme, taken the 7th of March 2020.

It took a few attempts to get the tarantula back on my hand so I could take a photo of it. Several times it made a short but very audible run on my desk. After I had taken two photos of the large spider I returned it back to its terrarium.

Note that I rarely handle the tarantulas I keep. The previous time for this specimen was when I had just bought it the 7th of March 2020. Based on the above photos it has grown quite a bit.

An Intro to Compilers

A compiler is just a program that translates other programs. Traditional compilers translate source code into executable machine code that your computer understands. (Some compilers translate source code into another programming language. These compilers are called source-to-source translators or transpilers.) LLVM is a widely used compiler project, consisting of many modular compiler tools.

Source: An Intro to Compilers, an article by Nicole Orchard.

Write a letter with pandoc

I recently had to write a letter to a government agency. With no office suite installed, I took a look to my installed packages and found pandoc . With pandoc you can transform documents, with a variety of input and output formats.

Source: letter, an article by Jan Frederik Hake.

Aphonopelma seemanni in its terrarium

Later in the evening I took a photo of the Aphonopelma seemanni I keep in its terrarium as it was still in the open after I had returned it.

Aphonopelma seemanni in its terrarium
Aphonopelma seemanni in its terrarium.

In the above photo its sitting on top of the cork tube underneath it has dug its burrow. For more information on this terrarium see the post I wrote earlier this month.

Chromatopelma cyaneopubescens molted

After midnight I noticed that the Chromatopelma cyaneopubescens sling I keep was nearly upside down in its webbing; a sign it's about to molt. When I got up, just over 8 hours later, I took a photo of the freshly molted tarantula.

Chromatopelma cyaneopubescens freshly molted
Chromatopelma cyaneopubescens freshly molted.

The previous and first time this spider molted in my care was the 27th of April, 2020.

Now I have to wait about a week before I can feed the little spider; it first has to harden out its fangs.

Linear types are merged in GHC

There will be linear types in GHC 8.12. But don’t expect a finished product. This is our very first iteration, an MVP as it were. This is as minimal a set of features we think can be useful for anybody. But it’s still very much aimed at early adopters and eager tinkerers.

Source: Linear types are merged in GHC, an article by Arnaud Spiwack.

Using Template Haskell to generate static data

Template Haskell (TH) is a powerful tool for specializing programs and allows shifting some work from runtime to compile time. It can be a bit intimidating to use for beginners. So I thought I would write up how to use TH to turn certain kind runtime computations into compile time computations.

In particular we will turn the initialization of a fully static data structure into a compile time operation. This pattern works for many data structures but we will look at IntSet in particular.

Source: Using Template Haskell to generate static data, an article by Andreas Klebinger.

A little bit of plain Javascript can do a lot

I’ve never worked as a professional frontend developer, so even though I’ve been writing HTML/CSS/JS for 15 years for little side projects, all of the projects have been pretty small, sometimes I don’t write any Javascript for years in between, and I often don’t quite feel like I know what I’m doing.

Partly because of that, I’ve leaned on libraries a lot! Ten years ago I used to use jQuery, and since maybe 2017 I’ve been using a lot of vue.js for my little Javascript projects (you can see a little whack-a-mole game I made here as an intro to Vue).

But last week, for the first time in a while, I wrote some plain Javascript without a library and it was fun so I wanted to talk about it a bit!

Source: A little bit of plain Javascript can do a lot, an article by Julia Evans.

Hapalopus sp. with prey

In the early evening I fed the Hapalopus sp. Colombia "large" sling I keep a mealworm, Tenebrio molitor. Even though the mealworm was quite large the small tarantula had no problem to subdue it.

Close-up of Hapalopus sp. Colombia "large" with prey
Close-up of Hapalopus sp. Colombia "large" with prey.

I took the above photo using the macro lens and LED ring light I bought yesterday.

The 18th of May I also fed this specimen a mealworm.

Psalmopoeus cambridgei molted

In the early afternoon while checking the tarantulas I keep I noticed that the Psalmopoeus cambridgei had molted, probably the previous evening.

Exuviae of a Psalmopoeus cambridgei
Exuviae of a Psalmopoeus cambridgei.

I took the above photo using the macro lens and LED ring light I bought yesterday.

I have been keeping this specimen since the first of May 2020 and this is the first time it molted in my care.

A Conspiracy of Bones

It’s sweltering in Charlotte, North Carolina, and Temperance Brennan, still recovering from neurosurgery following an aneurysm, is battling nightmares, migraines, and what she thinks might be hallucinations when she receives a series of mysterious text messages, each containing a new picture of a corpse that is missing its face and hands. Immediately, she’s anxious to know who the dead man is, and why the images were sent to her.

In the evening I started in A Conspiracy of Bones, A Temperance Brennan Novel Book 19, by Kathy Reichs. I've read all the previous novels and enjoyed those a lot so I look really forward to this one.

Multi lens set for smartphone

In the morning I bought a multi lens set for smartphones at the Action store in Naaldwijk for €3.89. The set comes with a 10× macro lens, which doubles as a 0.65× wide angle lens, a 185° fish eye, 2 lens covers, 2 clips, a pouch, and an adjustable LED ring light with USB charger cable.

Close-up of Hapalopus sp. Colombia "large"
Close-up of Hapalopus sp. Colombia "large".

In the early afternoon I took a few photos. In the above photo you can see the smallest tarantula sling I keep, a Hapalopus sp. Colombia "large". Also visible in the photo is the silk lining of its burrow.

Close-up of 2nd instar Chaerilus sp. "Java".
Close-up of 2nd instar Chaerilus sp. "Java".

I currently keep just one scorpion, a Chaerilus sp. "Java". It's currently second instar, meaning it has molted once since it was born. It also means it's very tiny, just a few mm.

Multi lens set for smartphone
Multi lens set for smartphone.

It's unclear to me how much the macro lens actually magnifies but it allows me to get closer to the subject while my phone, an iPhone 5, is still able to focus.

The adjustable LED ring light works great; it has 3 brightness settings.

Adam petting a cat

On the way back from a short visit to my mother Adam and I encountered a longhaired cat. We both stopped our bikes and petted the cat. I have blogged about this cat the 1st of June, 2019 when I spotted it resting in the shadows.

Adam petting a longhaired cat
Adam petting a longhaired cat.

10 insanely useful git commands for common git tasks

Git commands aren’t always intuitive. If they were, we would have these 10 commands at our disposal. They would be super useful for accomplishing common tasks like creating or renaming a git branch, removing files, and undoing changes.

For each git command in our wishlist, we’ll show you the commands that actually exist and you can use to accomplish the same tasks. If you’re still learning Git, this list reads like a tutorial and is worth keeping as a cheatsheet.

Source: 10 insanely useful Git commands for common Git tasks, an article by Eyar Zilberman.

Debugging out-of-memory crashes in Python

You run your program, and it crashes—it’s out of memory:

  • If you’re lucky, you get a MemoryError exception.
  • If you’re less lucky, you get a coredump.
  • If you’re having a bad day, your computer locks up and you need to restart it.

How do you figure out what is using up all your Python program’s memory?

Source: Debugging out-of-memory crashes in Python, an article by Itamar Turner-Trauring.

Make Your Old Documents Searchable with Bash, OCR, and pdfgrep

I've been interested in the world of economic zones for about 10 years. In that time, I've accumulated an enormous amount of research.

Unfortunately, these documents are a mess. Many are old .doc files or image scan PDFs of pamphlets from the 80's.

It's difficult to search these individually and especially difficult to query across the entire library.

Here's the workflow I used to make this library searchable.

Source: Make Your Old Documents Searchable with Bash, OCR, and PDFGrep, an article by Zach Caceres.