- The Little Elixir & OTP Guidebook by Benjamin Tan Wei Hao: an
introduction to the Elixir programming language and the OTP
framework that comes with it. It focusses on Elixir’s concurrency
features and shows you what OTP can do(the book mostly focusses on
Supervisors) without spending too much time on the language itself– the idea being to get someone already familiar with functional programming excited about the features that set Elixir apart.
The book is slightly outdated and has a couple of typos but I
found it a worthwhile read– it’s relatively quick to work through
and the book tries to build up a good mental model of what OTP
behaviours offer and when to use them. Of note is the chapter
showing how you might implement a
Supervisor using a
Atomic Habits by James Clear: on how to cultivate good habits and cull out bad ones. And why you should focus on building up good habits in the first place. I don’t know how valuable for me this was personally. The book was easy enough to read, and it says sensible things. The problem is that I never find myself actively applying things I learn from books like these.
Exhalation by Ted Chiang: collection of short sci-fi stories. I liked it just as much as the author’s first book Stories of Your Life and Others. I don’t know if there is a name for the flavor of science fiction that Chiang writes, but he really nails it. I especially liked that the book included Chiang’s notes on what he was going for when he was constructing each story.
Orca by Steven Brust: book 7 of the Vlad Taltos series. The series seemingly seems to get better with every book. This book in the series is still fantasy and not financial thriller, but at times it tries to be. Also loved that big parts of the book are from the perspective of Kiera, Vlad’s friend and renowned thief.
[spoiler] Vlad agrees to help a woman with her land getting foreclosed in exchange for her help healing Savn. This leads to the investigation of the death of Fyres, a shady Orca businessman. Vlad soon realizes that the situation involves a much larger scam and big banks covering up a murder for fear of going under if truth comes to light. [/spoiler]
Dragon by Steven Brust: the next book in the Vlad Taltos series. I found some stretches of the book a bit of a chore to read, even though this is still a short book. Although that might have been because I took a longish break when reading the book.
[spoiler] Vlad enlists in Morrolan’s army for war against Fornia, a Dragon who’s stolen something from Morrolan. [/spoiler]
Peak by Anders Ericsson and Robert Pool: a book on deliberate practice by one of the researchers who originally coined the term. This book lays out a framework for how to achieve expertise. Briefly, this goes as follows: identify what skills and mental representations an expert possesses, design a step-by-step program where you build up that skill, get feedback on what you’re doing wrong, focus on your weaknesses as you practice. The book emphasizes mental representations as essential to expertise– as chess players study games for many, many hours they see not just individual pieces but learn to identify larger patterns in any configuration. Deliberate practice is about building similar mental representations in any skill you want to master.
Overall, I think this book is a worthwhile read. You’ve probably encountered the idea of deliberate practice elsewhere by now, and the authors lay down exactly what that entails. The book can be a bit dry at times– it tries to stay firmly grounded on facts, and that means citing one study after another. But I did find the description of how Benjamin Franklin designed a program to practice his writing skills to be really cool.
Backstabbing for Beginners by Michael Soussan: an insider’s account of the United Nations operation overlooking sanctions imposed on Saddamn Hussein’s Iraq. The book is very open about the many failings(including incompetence, naivete and downright corruption) of the Oil-for-Food program and the people involved. And how Saddam Hussein benefitted massively, to the detriment of the people of Iraq, by exploiting these failings.
I found the book really well-written, and highly recommend it.
Phoenix by Steven Brust: This is book 5 of the Vlad Taltos series. I’ve reviewed the earlier ones, and I can definitely stick to my recommendation for this series– these books are short and entertaining. I’m reading them in order of publication date; in terms of chronological order, this book follows book 3(Teckla).
Athyra by Steven Brust: Book 6 of the Vlad Taltos series. This one’s written in a different voice and centers around a different character, although the protagonist of the series– Vlad– still plays a significant role. Still really fun.
Messy by Tim Harford: how pursuing tidy systems is harming us and why we should embrace messy systems that better reflect the unpredictableness of the real world. The systems in question can be anything from how you organize your inbox to how cities are laid out. Although it struck me while reading this book how similar most non-fiction books tend to be, I did enjoy the book and found the arguments quite compelling.
Learning to Climb Indoors by Eric Horst: a guide to learning and improving for the beginning climber. The author seems like a knowledgeable person and the book covers everything from how to approach different kinds of handholds to managing mental roadblocks like fear to optimum training schedules.
I also found this to be a really well-written book, and it goes beyond just the technical and talks about how to stay motivated in the long run and even how climbing holds many life-lessons.
Jhereg by Steven Brust: It had been a while since I’d read any fantasy and this was just a great book to come back to the genre with. This is part of a series called Vlad Taltos, named after the main character who is an assassin.
Unlike most other fantasy books I’ve read(not that many), the book doesn’t take itself too seriously. I thoroughly enjoyed the book, and I plan on picking up other books in the series soon.
[spoiler] Someone has stolen from the Jhereg organization, and Vlad is hired to assassinate him. The thief is taking refuge in Morrolan’s castle, where he knows Jhereg dare not attack. [/spoiler]
Show Your Work! by Austin Kleon: tries to make the case that creativity is a social process and how you should share your work online to get an audience. I got excited about this book after reading Derek Sivers’s review of it, but I didn’t find the book as insightful as I was hoping.
Yendi by Steven Brust: Second book in the Vlad Taltos series, from above. I enjoyed this book as well, although the structure of the plot felt a bit similar to first book.
[spoiler] Vlad goes into a turf war, gets killed by Cawti, gets revivified, then falls in love with Cawti. The turf war turns out to be part of a plan to instate Norathor as Dragon heir, displacing Aliera. [/spoiler]
A Mind For Numbers by Barbara Oakley: strategies to learn better. The book also goes has ample explanations, based on research on the human mind, on why the techniques described work. Many of the ideas in the book, I’d already encountered in Make it Stick (eg. practicing recall through mini-tests, spacing repetition), but it was still useful to remind myself that I don’t have any excuses to not put these techniques to use.
Teckla by Steven Brust: next book in the Vlad Taltos series. I felt like this book hinted at a much deeper big-picture narrative than the first two books did. I continue to be excited about this series.
[spoiler] Vlad’s wife Cawti has joined a revolution against the Dragaeran oppression of Easterners and Teckla. [/spoiler]
The Defining Decade by Meg Jay: targeted towards twenty-somethings. The book tries to push readers into taking ownership of transitioning into adulthood, and being more intentional with life.
Taltos by Steven Brust: book 4 of the Vlad Taltos series. I really enjoyed this one.
[spoiler] Vlad and Morrolan travel to the Paths of the Dead to revive Aliera [/spoiler]
Alone on the Wall by Alex Honnold and David Roberts
This is a memoir of sorts by a rock climber most famous for his free solo ascents(free soloing = rock climbing without a rope). The reason I picked up this book is because I’ve been doing some climbing myself and while the type of climbing I’ve done– mostly bouldering, mostly indoors– is very different from what Honnold does, it’s still very interesting to read about the perspective and experiences of someone who performs at such a high level.
Especially interesting was his perspective on risk versus consequences. Climbing a big wall without a rope has obviously very grave consequences if he falls, but he figures that most of the time the risk of his actually falling is pretty low.
The Push by Tommy Caldwell
Another rock climbing book. A big theme in this book is getting over adversity and pushing past perceived limits. Caldwell has had quite an interesting life and there are bits of biographical details in the book alongside his rock climbing exploits. The biographical bits are actually quite interesting and they tie in with what fed his sense of purpose while doing some of his climbs.
Can’t Hurt Me by David Goggins
This one is not about rock-climbing! Instead, it’s by a former Navy SEAL turned endurance athlete– Goggins has participated in several ultra-marathons. This is somewhat thematically similar to “The Push” in that it is also about pushing past your perceived limits, although unlike “The Push”, this one is a bit prescriptive and borders on the “self-help” genre at times.
Still, I think the core message of the book– that you should constantly be pushing past your comfort zone– is a valuable message.
I have lately been studying how databases work under the hood. There are many problems that a database has to solve. At the moment, I’ve been having fun exploring how data is stored on disk. Previously, I wrote about how a hashtable is stored on disk. This post is somewhat similar– I talk about how data stored on disk can be sorted.
Databases frequently have to sort data of massive sizes, sizes big enough that they don’t fit in memory at once. Sorting algorithms that can sort data residing in disk are called external sorting algorithms. External merge-sort is one such algorithm.
Just like merge-sort, external merge-sort is a divide-and-conquer algorithm– it recursively sorts smaller subarrays, and then merges those subarrays. Because disk I/O happens in blocks, however, the smallest subarray is the size of a disk page. So for a file with n pages, the algorithm proceeds as follows.
First, all pages are sorted internally. To achieve this, we bring in however many pages can fit into the program’s buffers(remember, the entire data doesn’t fit in memory), sort each page and write them back. This step is usually referred to as pass 0.
Next, in pass 1, we sort runs of length 1. A run is a collection of sorted pages, so that means that we take pairs of pages and merge them to get $n/2$ runs of length 2. Now, the contents of pages 0 and 1 are sorted; as are 2 and 3, and so on. In pass 2, we do the same thing, but with runs of length 2. And so on, until finally we have two subarrays(runs of length $n/2$ pages). Merging those gives us the final sorted result. We start with $n$ runs and halve at each pass, so there will be $log_2(n)$ passes.
All this may seem very familiar to you if you’re already acquainted with merge-sort. The difference here is that is some extra work to be done when merging. Take, for example, the last pass where we do the final merge between two runs of $n/2$ pages. Our original constraint was that n pages don’t fit in memory, so 2 runs of $n/2$ pages certainly won’t either. To solve this, the pages in the two input runs are streamed in.
First we bring in the first pages from each of the runs. As with “regular” merge-sort, we iterate through both, picking off whichever has the smaller item. Eventually, one will run out. At that point, bring in another page from that run into the buffer, and continue. Our output is also a file, so we need to do the same on the output side– once the output buffer is filled, write it to the output file, and start with an empty buffer.
You can check out my Rust implementation of this algorithm on Github.
What I’ve described above is called two-way merging since at any given step we merge two runs. However, it can be advantageous to merge $k$ runs at once. This would result in $log_k(n)$ number of passes. Since we write out to disk in each pass, the efficiency gain this reduction in the number of passes gives us can be significant.
You can read more about the ways to do k-way merging on Wikipedia.