Plurrrr

a tumblelog
home

Guido van Rossum aiming to make CPython 2x faster in 3.11

Python creator Guido van Rossum this week told attendees at the Language Summit that he hopes to double performance in version 3.11.

Source: Guido van Rossum aiming to make CPython 2x faster in 3.11, an article by Tim Anderson.

Manual UIKit Layout

Whenever I mention that I don't use Interface Builder, Storyboards or Auto Layout, developers, especially newer developers, ask me how it's even possible to write UIKit apps like that. So many iOS tutorials dump you straight into Interface Builder and constraint-building, and while that does have benefits at the mid-to-high-end, like with localization and right-to-left languages, it's still a fairly sharp learning curve and mental overhead that leaves many beginners not really understanding what is going on under the hood. It's no wonder that SwiftUI seems so refreshing and easy to use, in comparison.

Source: Manual UIKit Layout, an article by Steve Troughton-Smith.

Aiming for idiomatic Rust

Recently I was exploring ways to work with pattern matching in Rust - using a small relatable example that many people may have come across during technical interviews or in online code challenges.

The problem is as follows: given a string input, determine if parenthesis, brackets and braces are 'balanced'.

Source: Aiming for idiomatic Rust, an article by Shane Osbourne.

Baby's First Garbage Collector

Garbage collection is considered one of the more shark-infested waters of programming, but in this post, I’ll give you a nice kiddie pool to paddle around in. (There may still be sharks in it, but at least it will be shallower.)

Source: Baby's First Garbage Collector, an article by Bob Nystrom.

Half a million lines of Go

When we started Goliath, no one on the team knew Go beyond the experiments we ran to validate that Go would be a better choice for us than our other options. Today, all of our backend and full-stack engineers write Go, and our incremental delivery of Goliath has vaulted us over a big milestone: More than 500,000 lines of Go now running in production. This seemed like a good point to reflect on Go itself.

Source: Half a million lines of Go, an article by Kevin Dangoor.

Managing Kubernetes Resources for Containers

Managing resources for containers in a Kubernetes cluster is very important.

The thing is, it can be a very tedious job, as every service might have different requirements.

Source: Managing Kubernetes Resources for Containers, an article by Shimon Tolts.

Python Static Analysis Tools

Development teams are under pressure. Releases must be delivered on time. Coding and quality standards must be met. And errors are not an option. That's why development teams use static analysis.

Source: Python Static Analysis Tools.

Top Ten Git Tips & Tricks

Let's face facts. Git is not fun. Git is not friendly. No. It's just infuriatingly useful, so we're stuck with it. But what if you could make git more friendly? More convenient? Would that make your day a little less stressful?

Source: Top Ten Git Tips & Tricks, an article by Julie Kent.

Basics of ZFS Snapshot Management

OpenZFS stands out in its snapshot design, providing powerful and easy-to-use tools for managing snapshots. Snapshots complement a backup strategy, as they are instantaneous and don’t require a backup window. Since snapshots are atomic, they are not affected by other processes and you don’t have to stop any running applications before taking a snapshot.

Source: Basics of ZFS Snapshot Management.

Smart constructors

This is an introduction to a programming idiom for placing extra constraints on the construction of values by using smart constructors.

Source: Smart constructors.

Fluent in Django: Get to know Django models better

Django is an MTV framework. Instead of MVC (Model, Views, Controller), it uses Model, Template, and View. The View is a Python function that takes a Web request and returns a Web response (in MVC, this would be a Controller). But the heart of your application is the Model.

Source: Get to know Django models better.

Interfaces and Nil in Go, or, Don't Lie to Computers

In fact the root problem here isn't about Go specifically. This is a general problem that you can encounter in any language, and in fact, even beyond. When you lie to your code, there will be consequences.

Source: Interfaces and Nil in Go, or, Don't Lie to Computers, an article by Jeremy Bowers.

pprof++: A Go Profiler with Hardware Performance Monitoring

Golang is the lifeblood of thousands of Uber’s back-end services, running on millions of CPU cores. Understanding our CPU bottlenecks is critical, both for reducing service latencies and also for making our compute fleet efficient. The scale at which Uber operates demands in-depth insights into codes and microarchitectural implications.

Source: pprof++: A Go Profiler with Hardware Performance Monitoring, an article by Milind Chabbi.

Swift Actors: A practical example, part 1

Actors offer data isolation within a type in such way that the code you write cannot create data races. In other words, thread-safety is built into the type system. Similarly to how mutability is - you simply cannot compile code that mutates immutable data.

Source: Swift Actors: A practical example, part 1, an article by Marin Todorov.

The Plan for the Rust 2021 Edition

We are happy to announce that the third edition of the Rust language, Rust 2021, is scheduled for release in October. Rust 2021 contains a number of small changes that are nonetheless expected to make a significant improvement to how Rust feels in practice.

Source: The Plan for the Rust 2021 Edition, an article by Mara Bos.

Using PostgreSQL as a Data Warehouse

With some tweaking Postgres can be a great data warehouse. Here's how to configure it.

Source: Using PostgreSQL as a Data Warehouse, an article by Cedric Dussud.

Praise for Alpine Linux

In terms of simplicity, Alpine Linux is unpeered. Alpine is the only Linux distribution that fits in my head. The pieces from which it is built from are simple, easily understood, and few in number, and I can usually predict how it will behave in production. The software choices, such as musl libc, are highly appreciated in this respect as well, lending a greater degree of simplicity to the system as a whole.

Source: Praise for Alpine Linux, an article by Drew DeVault.

What is legacy code and how to avoid it?

Have you heard “legacy code” as the reason when something went wrong in a software project? Understanding legacy code is crucial because it occurs in every project sooner or later. We use the term loosely to describe old code that we don’t like but what is legacy code really and even more importantly how can we avoid it?

Source: What is legacy code and how to avoid it?, an article by Andre Schweighofer.

Debugging HTTP services with mitmproxy

I spend a lot of my time at work writing Go services that talk to other Go services over HTTP. Much of the time, everything works as expected, but every now and then a situation arises where I’m struggling to understand why my program is receiving a specific value. Is my request not being built correctly? Am I not properly deserializing the response? Logging can be helpful, but sometimes I really just want to look at the HTTP traffic between services.

Source: Debugging HTTP services with mitmproxy, an article by Ben Burwell.

Green Threads Explained in 200 Lines of Rust

Green threads, userland threads, goroutines or fibers, they have many names but for simplicity's sake I'll refer to them all as green threads from now on.

In this article I want to explore how they work by implementing a very simple example where we create our own green threads in 200 lines of Rust code. We'll be explaining everything along the way so our main focus here is to understand them and learn how they work by using simple, but working example.

Source: Green Threads Explained in 200 Lines of Rust.

How to setup secure file servers (SSH/SFTP)

Sharing files is one of the oldest but also most delicate tasks on servers. If you would like to share your files in a simple but also pretty secure way, here is how to do it with SSH / SFTP.

Source: How to setup secure file servers (SSH/SFTP), an article by Andreas Fuhrich.

Tox: standardise testing in Python

tox is a generic virtualenv management and test command line tool you can use for:

  • checking that your package installs correctly with different Python versions and interpreters
  • running your tests in each of the environments, configuring your test tool of choice
  • acting as a frontend to Continuous Integration servers, greatly reducing boilerplate and merging CI and shell-based testing.

Source: Welcome to the tox automation project.

What I Learned by Relearning HTML

I’ve worked on websites for several years, both professionally and for side projects. One day, I reflected on the fact that all of my web development education had come from actually making websites. In most cases, I’d have a specific problem, Google how to solve it, and learn something new in the process.

I wondered what I was missing by never learning HTML in a comprehensive way. Forget CSS and JavaScript. I’m just talking about raw HTML. It might seem silly to go back to such a basic aspect of web development after a decent amount of experience, but it’s easy to become overconfident with a skill just because you know enough to do a few useful things.

So I decided to relearn HTML and discover my unknown unknowns.

Source: What I Learned by Relearning HTML, an article by Danny Guo.

SQLite Pragma Cheatsheet for Performance and Consistency

SQL pragma are statements (like SELECT … or CREATE TABLE …) that change the database behaviors or call a special functions. This post is a short list of SQLite pragma I use in my projects built on SQLite, to get better performance and more consistency.

Source: SQLite Pragma Cheatsheet for Performance and Consistency, an article by Clément Joly.

Styling Ordered Lists with CSS Counters

Here's a scenario I find myself in now and then: I want an ordered list, and I want it to be pretty.

Source: How to style "ol" tags with CSS, an article by Joshua Comeau.

How to optimize ORDER BY RANDOM()

Tom Witowsky (@devgummibeer) shared on Twitter a scaling issue with his service opendor.me, which helps any developer share and highlight their open source work. As the service grows, more and more data is stored in the database and needs to be browsed. One particularly slow query that he needed help optimizing is fetching random users, organizations, and repositories that are already part of the service.

Source: How to optimize ORDER BY RANDOM(), an article by Tobias Petry.

Cryptographic shuffle

What if I needed to shuffle a list but couldn't hold the whole thing in memory? Or what if I didn't want to shuffle a list, but just traverse it in a shuffled manner? (That is, visit each element once and only once, in a randomized way.) What if I wanted to traverse it, but didn't want to precompute or store the traversal for some reason?

This would allow me to publish items from a list in an order that was unpredictable from the outside, but in fact deterministic and based on a secret key, and without precomputing anything (or worrying about collisions). Or I could use it to assign small non-sequential IDs that would eventually saturate the space of n-character strings in a pseudorandom order, obscuring the true size of the set for anyone who could just view some subset of the assigned IDs. They wouldn't even be able to tell if there were gaps in the list of IDs they could observe.

Source: Cryptographic shuffle, an article by Tim McCormack.

The Rustonomicon

The Rustonomicon digs into all the awful details that you need to understand when writing Unsafe Rust programs.

Should you wish a long and happy career of writing Rust programs, you should turn back now and forget you ever saw this book. It is not necessary. However if you intend to write unsafe code — or just want to dig into the guts of the language — this book contains lots of useful information.

Source: The Rustonomicon.

The quest for faster Python

Facebook has released Cinder, used internally in Instagram to improve Python performance, while another faster Python, called Pyston, has released version 2.2 and made the project open source (again).

Python is the world's second most popular programming language (after JavaScript) according to some surveys; but it is by no means the fastest. A glance at benchmarks tells us that Python 3 computation is often many times slower than compiled languages like C and Go, or JIT (Just-in-Time) compiled languages like Java and JavaScript.

One reason is that the official implementation of Python, called CPython, is an interpreted, dynamic language, and its creator Guido Van Rossum has resisted optimising it for performance, saying in 2014 that "Python is about having the simplest, dumbest compiler imaginable, and the official runtime semantics actively discourage cleverness in the compiler like parallelizing loops or turning recursion into loops."

Source: The quest for faster Python: Pyston returns to open source, Facebook releases Cinder, or should devs just use PyPy?, an article by Tim Anderson.

Making the Internet more secure one signed container at a time

With over 16 million pulls per month, Google’s distroless base images are widely used and depended on by large projects like Kubernetes and Istio. These minimal images don’t include common tools like shells or package managers, making their attack surface (and download size!) smaller than traditional base images such as ubuntu or alpine. Even with this additional protection, users could still fall prey to typosquatting attacks, or receive a malicious image if the distroless build process was compromised – making users vulnerable to accidentally using a malicious image instead of the actual distroless image. This problem isn’t unique to distroless images – until now, there just hasn’t been an easy way to verify that images are what they claim to be.

Source: Making the Internet more secure one signed container at a time, an article by Priya Wadhwa and Jake Sanders.

Ecdysis of Acanthoscurria geniculata

In the afternoon I noticed that Adam's Acanthoscurria geniculata was upside down. It was about to molt soon. It had webbed a mat on top of its burrow and a plastic leaf the previous night.

Acanthoscurria geniculata upside down on its silk mat
Acanthoscurria geniculata upside down on its silk mat.

The spider had been lethargic for weeks, a possible sign of an upcoming molt (ecdysis).

Acanthoscurria geniculata, right, and its exuviae, left
Acanthoscurria geniculata, right, and its exuviae, left.

When I checked again on the tarantula, slightly over 4 hours later, it was resting upside down next to its molt (exuviae). It's best to leave the spider in peace as much as possible during this delicate process.

Acanthoscurria geniculata freshly molted
Acanthoscurria geniculata freshly molted.

In the evening I carefully removed the exuviae. This can be used to determine the sex of the tarantula. The tarantula was bought as a female and now I could confirm this by examining the inside of the abdomen between the first pair of book lungs.

Spermathecae of a juvenile Acanthoscurria geniculata
Spermathecae of a juvenile Acanthoscurria geniculata.

In the above photo, taken with an iPhone 6S and macro lens the spermathecae are barely visible. But good enough to confirm that this is indeed a female.

Now the spider has to harden out before it can get its first meal. Best is to wait about 2 weeks.

awk is the coolest tool you don't know

awk, named for its authors Aho, Weinberger, and Kernighan, is a very cool little tool that you know exists and is installed on your system, but you have never bothered to learn how to use. I’m here to tell you that you really ought to!

If I stop for a moment to ponder the question, “what is the coolest tool in Unix?”, the immediate answer is awk. If I insist on pondering it for longer, giving each tool a moment for fair evaluation, the answer is still awk. There are few tools as perfectly suited to their problem as awk is.

Source: awk is the coolest tool you don't know, an article by Drew DeVault.

Server-sent events in Flask without extra dependencies

Server-sent events (SSE) is a mechanism for sending updates from a server to a client. The fundamental difference with WebSockets is that the communication only goes in one direction. In other words, the client cannot send information to the server. For many usecases this is all you might need. Indeed, if you just want to receive notifications/updates/messages, then using a WebSocket is overkill. Once you’ve implemented the SSE functionality on your server, then all you need on a JavaScript client is an EventSource. Trust me, it’s very straightforward.

Source: Server-sent events in Flask without extra dependencies, an article by Max Halford.

The Simple Tricks to Make Your Website Blazing Fast

Web application load speed is the most basic part of UX. Neglecting performance (load time) of your website can drive away users, because most people tend to leave the page after about 3 seconds if it doesn't load, therefore it's very important to make sure that your application loads as fast as possible. But how can you achieve that? There are many tricks and techniques for speeding up load time of an application and most of them don't involve any actual code change. In some cases, just a single line of config can give you a huge performance improvement. So, in this article we will explore the simplest and most effective tricks that will help you make your web application load as fast as possibly can!

Source: The Simple Tricks to Make Your Website Blazing Fast, an article by Martin Heinz.

My Favorite One Liners

In this post, I will be sharing my favorite commandline one liners that have made my workflow productive and more efficient. As a regular Linux user, I have been using commandline extensively to perform daily tasks such as creating files, navigating through directories , moving files and editing files using vim.

Source: My Favorite One Liners, an article by Muhammad Raza.

The art of solving problems with Monte Carlo simulations

This article will explore some examples and applications of Monte Carlo simulations using the Go programming language. To keep this article fun and interactive, after each Go code provided, you will find a link to the Go Playground, where you can run it without installing Go on your machine.

Source: The art of solving problems with Monte Carlo simulations, an article by Gabriel Carvalho.

CSS Generators

You can use CSS generators to avoid some time-consuming tasks. I made a collection of the best CSS generators for you.

Source: CSS Generators, an article by Marko Denic.

Principal Component Analysis

Principal component analysis (PCA) is a technique used to emphasize variation and bring out strong patterns in a dataset. It's often used to make data easy to explore and visualize.

Source: Principal Component Analysis explained visually, an article by Victor Powell with text by Lewis Lehe.

Why model calibration matters and how to achieve it

Calibrated models make probabilistic predictions that match real world probabilities. This post explains why calibration matters, and how to achieve it. It discusses practical issues that calibrated predictions solve and presents a flexible framework to calibrate any classifier. Calibration applies in many applications, and hence the practicing data scientist must understand this useful tool.

Source: Why model calibration matters and how to achieve it, an article by Lee Richardson & Taylor Pospisil

Patterns of Functional Programming

One of the ideas of functional programming is having pure functions, functions that have no side effects. But writing programs made exclusively from functions without side effects can't be useful in the real world, because programs have to affect the real world somehow. Inevitably, this means some parts of our programs must be effectful for the program to be useful.

Source: Patterns of Functional Programming: Functional Core - Imperative Shell, an article by Javier Casas.

The Humble <img> Element And Core Web Vitals

Images have also been a key part of the web. They communicate ideas instantly, but they are also a lot heavier than text to load. This means that it’s essential to get loading and displaying them right, if you want to give your users a fantastic first impression.

Source: The Humble <img> Element And Core Web Vitals, an article by Addy Osmani.

A Web Server in Bash

This is a bit of a dumb project, there's all sorts of bugs and they're the horrifying kind. Shell scripts have access directly to the computer and so you can do all sorts of strange and harmful things. But this all makes me smile that it all even works.

Source: A Web Server in Bash.

Limits of Deep Learning

Present-day Deep Learning models are scaling their computational requirements much faster than the growth rate of computing resources. They rely on huge sets of parameters that make them much greater tools compared to older methods. To beat this challenge, we may need to have new perspectives on our architectures, possibly on a fundamental level, to make them smaller scale but still high performance. On the other hand, we may develop new types of hardware that will be able to keep up with the requirements of DL architectures.

Source: Limits of Deep Learning, an article by Yiğit Şimşek.