a tumblelog

Quickly seeing the age of your branches

Have you ever asked yourself 'how old are all my branches?'. I have not, and it's not a common question. But recently someone did ask me how to find this out. You can of course dig through history manually, but where's the fun in that? I prefer to use our good friends: the plumbing commands.

Source: Quickly seeing the age of your branches, an article by Dennis Kaarsemaker.

Type Witnesses in Haskell

If you read articles that describe some advanced type-level stuff in Haskell or other languages with a similar type system, chances are that you have come across this thing called ‘type witness’ or ‘runtime evidence’. In this post, we will be trying to gain an understanding of what the heck it is.

Source: Type Witnesses in Haskell, an article by Sandeep Chandrika.

Flask RCE Debug Mode

Flask is a very popular Python library for creating websites and APIs. I personally use it a lot in my projects and I see it deployed in production environments as well. When software engineers are developing applications they often enable debug mode for testing purposes. If this mode is enabled on production servers it can lead to remote code execution (RCE).

Source: Flask RCE Debug Mode, an article by Alex Thomas.

The Noise Within

On the brink of perfecting the long sought-after human/AI interface, Philip Kaufman finds his world thrown into turmoil as a scandal from the past returns to haunt him and dangerous information falls into his hands. Pursued by assassins and attacked in his own home, he flees. Leyton, a government black-ops specialist, is diverted from his usual duties to hunt down the elusive pirate vessel The Noise Within, wondering all the while why this particular freebooter is considered so important. Two lives collide in this stunning space-opera from debut novelist Ian Whates!

In the afternoon I started in The Noise within by Ian Whates. The book was given to me by my friend Simon as part of a birthday present two days ago.

Cover of The Noise Within by Ian Whates
Cover of The Noise Within by Ian Whates.

Why you shouldn't use func main in Go

A simple abstraction for your Go programs can make your code more readable, and much more testable.

Source: Why you shouldn't use func main in Go, an article by Mat Ryer.

On Sigils

One thing that distinguishes Perl from other languages is its use of sigils; the funny looking symbols placed in front of variable names. As experienced Perl programmers, we assume sigils are an essential part of Perl, but when I dream about my ideal version of Perl, I go back-and-forth as to how sigils would work, and even whether they’re required at all.

Source: On Sigils, an article by David Farrell.

Null in Python: Understanding Python's NoneType Object

Python uses the keyword None to define null objects and variables. While None does serve some of the same purposes as null in other languages, it’s another beast entirely. As the null in Python, None is not defined to be 0 or any other value. In Python, None is an object and a first-class citizen!

Source: Null in Python: Understanding Python's NoneType Object

7 Principles of Icon Design

Creating a high-quality icon family requires a thoughtful approach, a trained eye, a bit of iteration, and a lot of practice. Below, I’ll illustrate the hallmarks of quality through 7 principles and plenty of real-world examples. The goal is to tune you to the key attributes of great icon design.

Source: 7 Principles of Icon Design, an article by Helena Zhang.

Getting the most out of Python collections

One of Python's best features is that it has awesome capabilities for creating and handling collections. Building a good understanding of these will help you write clean Pythonic code.

Source: Getting the most out of Python collections, an article by Nick Thapen.

How to Reverse a Binary Tree in Python

By learning how to Reverse a Binary Tree in Python, you are working towards fundamental data structure algorithms commonly found in Computer Science degrees and across the industry.

Source: How to Reverse a Binary Tree in Python, an article by Andrew Odendaal.

A Birthday Present: Books

In the evening I had a dinner with my friend Simon. Since my birthday was last Saturday he had brought a present: books.

The books Simon gave me for my birthday
The books Simon gave me for my birthday

I had already read Old Man's War by John Scalzi, but many years ago. So I probably will reread it soon as I liked the book a lot back then.

I am going to start reading The Noise within tomorrow.

My Personal Website 2020 Tech Stack

Roughly every six years or so, I set out on the seemingly meaningless expedition of re-building my personal website. This post outlines decisions and thoughts on the new architecture, as well as a reflection over what's changed since last time.

Source: My Personal Website 2020 Tech Stack, an article by Daniel Stocks.

The Museum of Desire: good

In the evening I finished reading the 35th book in the Alex Delaware series by Jonathan Kellerman: The Museum of Desire.

While I liked the book the previous one, The Wedding Guest, is much better.

Graph Neural Networks: An overview

Graph Neural Networks were introduced back in 2005 (like all the other good ideas) but they started to gain popularity in the last 5 years. The GNNs are able to model the relationship between the nodes in a graph and produce a numeric representation of it. The importance of GNNs is quite significant because there are so many real-world data that can be represented as a graph. Social networks, chemical compounds, maps, transportation systems to name a few. So let’s find out the basic principles behind GNNs and why they work.

Source: Graph Neural Networks - An overview, an article by Sergios Karagiannakos.

Tips on reading and debugging other programmers' code

Most IT firms where I worked as programmer were IT services industry, there was very little greenfield work and most of the time we had to maintain/fix code written by other engineers who couldn't even be found in some cases!

As a result, reading and debugging existing code was something we had to adapt ourselves to. Based on my experience, this is a brief overview of how the process generally works and some tricks to make your life easier:

Source: Tips on reading and debugging other programmers' code, an article by Prahlad Yeri.

Exploring simple Linux containers with lxc

If you learn about lxc, you can integrate generic Linux containers into your own system design to solve whatever problem you think a container can solve.

Source: Exploring simple Linux containers with lxc, an article by Seth Kenlon.

Go interfaces: small and composable

Interfaces in Go are a topic that tend to trip up people coming from a variety of languages like Java or C#. The oddest thing about them is probably that interfaces are implicit rather than explicit . So whereas in most languages there is some type of syntax or a keyword to say you’re implementing an interface, there’s no such thing in Go.

Another difference is that good interfaces in Go should be small — they should contain only a few methods. I know how tempting it is to just add one more method to an interface, and have them grow organically like that. This does create some downsides in terms of having others use your interface and refactor work if you change them later.

Source: Go interfaces: small and composable, an article by Dylan Meeus.

Library Evolution in Swift

Swift 5.1 shipped with two new features related to binary stability that enables binary frameworks that can be distributed and shared with others:

  • Module stability allows Swift modules built with different compiler versions to be used together in one app.

  • Library evolution support allows developers of binary frameworks to make additive changes to the API of their framework while remaining binary compatible with previous versions.

Source: Library Evolution in Swift, an article by Slava Pestov.

Reducing Colors In An Image ⇢ Dithering

What if you did not have millions of colors at your disposal? Think about older devices, printers (both 2D and 3D), or printing presses making giant posters of your favorite movie. You may also want to reduce your color palette to reduce the memory usage.

What you need is some sort of mapping, that maps the pixel with 16 million possible colors, to say 8 possible colors. Intuitively, the best approach would be to figure out which of the 8 colors is most similar to the pixel's color and use this similarity for mapping.

Source: Reducing Colors In An Image ⇢ Dithering, an article by Preet Shihn.

Tour of Python Itertools

Let’s explore two great Python libraries — itertools and more_itertools and see how to leverage them for data processing…

Source: Tour of Python Itertools, an article by Martin Heinz.

An introduction to GDB scripting in Python

Sometimes it's not humanly possible to inspect or modify data structures manually in a debugger because they are too large or complex to navigate. Think of a linked list with hundreds of elements, one of which you need to locate. Finding the needle in the haystack is only possible by scripting the debugger to automate repetitive steps.

Source: An introduction to GDB scripting in Python, an article by Stefan Hajnoczi.

Why do so many developers get DRY wrong?

Dan Abramov’s excellent Goodbye, Clean Code post (wherein he learned it was wise to walk back an overzealous refactoring) reminded me of something Dave Thomas said when we interviewed him and Andy Hunt about the Pragmatic Programmer’s 20th edition:

We’ve also looked at the reaction to various parts of the book, and discovered that we weren’t really communicating as well as we thought we were some of the ideas that we had. A classic one is DRY. DRY has come to mean “Don’t cut and paste”, but the original “Don’t repeat yourself” was nothing to do with code, it was to do with knowledge. So we’ve had to go through and update that… [🎧]

Source: Why do so many developers get DRY wrong?, an article by Jerod Santo.

How to tell if a Samba share is in use

Samba includes the necessary tools to find out what users are accessing shares and their associated IP addresses. Learn how to do this with a single command.

Source: How to tell if a Samba share is in use, an article by Jack Wallen.

Dark Age: Disappointing

In the late afternoon I finished Dark Age, the fifth book in the Red Rising series by Pierce Brown. I was disappointed by this book; especially because book four in this series, Iron Gold, was excellent.

The book got better about half way; good enough to look forward to the next one in the series, which I hope will be more like Iron Gold or Red Rising. But overall; barely an OK.

The Museum of Desire

LAPD Lieutenant Milo Sturgis has solved a lot of murder cases. On many of them—the ones he calls “different”—he taps the brain of brilliant psychologist Dr. Alex Delaware. But neither Alex nor Milo are prepared for what they find on an early morning call to a deserted mansion in Bel Air. This one’s beyond different. This is predation, premeditation, and cruelty on a whole new level.

In the late afternoon I started in the 35th book in the Alex Delaware series by Jonathan Kellerman: The Museum of Desire.

Create a macOS Menu Bar App with Python

On my Mac, I use the menu bar countless times per day. In this post we will go through the process of creating a custom macOS menu bar app using Python. As an example, we will create a 🍅 pomodoro app, which you can use to boost your productivity and manage your time from the convenience of your menu bar.

Source: Create a macOS Menu Bar App with Python (Pomodoro Timer), an article by Camillo Visini.

Unexpected Places You Can And Can’t Use Null Bytes

The traditional way of representing strings in C is using null-terminated character arrays. Common C library methods like strcpy, printf, etc. detect how long strings are by sequentially scanning memory until a null byte is found. This complicates situations where the string data itself should contain literal null bytes. Generally this doesn’t mean that it’s impossible to use strings with embedded null characters, just that you have to be more careful when doing so. Typically this is done by using methods that explicitly specify the length of strings.

Source: Unexpected Places You Can And Can’t Use Null Bytes, an article by Evan Klitzke.

The economics of clean code

There seem to be many opinions surrounding clean code. Some people have an entire architecture of how code should look. Others stick to the actual layout of the code, or length of a class while even others vaguely point towards Robert C. Martin’s books.

One thing is clear; it’s something that’s really on a lot of developers mind. Clean code makes projects more comfortable to work with and improves shelf life. It’s the antagonist of vile legacy codebases that are unmaintainable.

Then why does business always treat it as a secondary objective? Do they just don’t get it?

Source: The economics of clean code, an article by Frederick Vanbrabant.

Tools in My Toolbox

One of the most important skills I believe programmers need is to understand when to use certain tools. My typical process for solving a problem is to go through each tool in my toolbox and see which one would solve the problem the best. Over the past few years, I’ve worked on systems that process 100s of billions of data points. In doing so, I’ve added a number of tools to my personal toolbox.

Source: Tools in My Toolbox, an article by Michael Malis.

Merge Sort - Divide and Conquer

When you are faced with a huge task, what do you usually do? Well, if you’re a little bit like me, then you split it into smaller chunks, complete them individually and later combine into a bigger one. This exact approach is used by Merge Sort. Following article will cover its implementation with detailed explanation, including a study of dreadful (not really) recursion. Ready?

Source: Merge Sort - Divide and Conquer, an article by Mateusz Dziubek.

Bot detection 101: How to detect web bots?

We can distinguish two main families of detection techniques:

  • Behavioral detection: this family of approaches leverages the user’s behavior, such as mouse movements or browsing speed, to predict whether a user is human or not.
  • Fingerprinting-based detection: this second family of approaches leverages information about the device and the browser, such as the browser version, the Operating System (OS) or the number of CPU cores.

Source: Bot detection 101: How to detect web bots?, an article by Antoine Vastel.

How to Create Printer-friendly Pages with CSS

Converting responsive, continuous media to paged paper of any size and orientation can be challenging. However, CSS print control has been possible for many years, and a basic style sheet can be completed within hours.

Source: How to Create Printer-friendly Pages with CSS, an article by Craig Buckler.

Demystifying Browsers

I’m increasingly often asked “Where do I learn about browsers?” and I haven’t had a ready answer for that question.

This post aims to answer it.

Source: Demystifying Browsers, an article by Eric Lawrence.