week 48, 2019

Beware of shell globs

Shell globs allow one to specify set of filenames with wildcard characters. This is really useful, but they have some rather unintuitive functions that could surprise you, and even cause big problems if you're unlucky enough.

Source: Beware of shell globs

We are Programmers

Building websites is programming. Writing HTML and CSS is programming. I am a programmer, and if you're here, reading CSS-Tricks, chances are you're a programmer, too.

The thing is, the details in programming layout with CSS are different, for example, than the details in programming API endpoints with Ruby. Or machine learning with Python. Or programming a browser engine with C++.

But those differences are details! A lot of details, but still... details. It's all programming.

Source: We are Programmers, an article by Lara Schenck.

Improving CLIs with isatty

One thing I like to do to improve the command-line programs I maintain is to make them aware of whether they’re being run interactively. In this post I’ll show off an easy trick to make programs running interactively more usable.

Source: Improving CLIs with isatty, an article by Jake Zimmerman.

The Matrix Calculus You Need For Deep Learning

This paper is an attempt to explain all the matrix calculus you need in order to understand the training of deep neural networks. We assume no math knowledge beyond what you learned in calculus 1, and provide links to help you refresh the necessary math where needed. Note that you do not need to understand this material before you start learning to train and use deep learning in practice; rather, this material is for those who are already familiar with the basics of neural networks, and wish to deepen their understanding of the underlying math.

Source: The matrix calculus you need for deep learning, an article by Terence Parr and Jeremy Howard.

That which we call an identity

This post is inspired by something that I see crop up now and again in discussions with other Maths teachers. It usually manifests itself as a rallying cry to use ≡ in place of = in identities and reserve = for equations. My standard response is to mutter something about identities being equations and leave it at that. But in the latest round, Jemma Sherwood challenged me, in the nicest possible way, to explain a bit further. This is that explanation.

Source: That which we call an identity, an article by Andrew Stacey.

Python 3: Modules and Packages

Modules are nothing but files containing Python code. As your program gets bigger, it becomes hard to maintain if you keep it in a single file. Modules in Python are a way to re-factor your code into multiples files and referring those files in your main program.

A Package in Python refers to a collection of modules categorized under one logical grouping.

Lets see these definitions in action.

Modules and Packages.

Python dataclasses and typing

I'm going to preach the wonders of Python dataclasses, but for reasons of interested to those who have already gone down the delightful rabbit-hole of typed Python. So let me start with a quick plug for mypy if you haven't heard about it.

Source: Python dataclasses and typing, an article by Russ Allbery.

5 Things to unlearn when learning Go

Learning Go has been a fun journey, and when you’re used to writing a mainstream language such as Java or C# the learning curve isn’t that steep. But there are some things I had to actively unlearn when learning Go. Most of the things here are not harmful to your code at all, and the code functions pretty much as intended anyway. The compiler will not come shouting at you, so perhaps the worst that could happen would be a nitpick comment on a code review. 😃

Source: 5 Things to unlearn when learning Go, an article by Dylan Meeus.

Lightweight API design in Swift

One of the most powerful aspects of Swift is just how much flexibility it gives us when it comes to how APIs can be designed. Not only does that flexibility enable us to define functions and types that are easier to understand and use — it also lets us create APIs that give a very lightweight first impression, while still progressively disclosing more power and complexity if needed.

Source: Lightweight API design in Swift, an article by John Sundell.

Benchmark on Python Microframeworks

In the complex world of web development, as the popularity of frontend framework such as React and Vue increase, Python is left to exist to be the language of a backend framework such as Flask and Django. Django is a fullstack web framework with built in ORM, user management, template renderer and tons of plug and use plugins. While Flask, Sanic are micro framework which are designed to stay lean and fast. So what are the key point developers should consider when choosing their next project’s backend framework?

Source: Benchmark on Python Microframeworks

Modern Networking in Swift 5

Swift 5 system frameworks already provide us with all the tools that we need to write concise networking layer. In this article we’ll implement a promise-based networking agent by using vanilla Swift 5 APIs: Codable, URLSession and the Combine framework. To battle-test our networking layer, we’ll practice with several real-world examples that query Github REST API and synchronize the HTTP requests in chain and in parallel.

Source: Modern Networking in Swift 5 with URLSession, Combine and Codable, an article by Vadim Bulavin.

Configurable types in Swift

When starting to write a new class, struct, or other type, we most often have a very specific goal or use case in mind. We might need a new model to represent some data that we’re working with, or we might want to encapsulate a piece of logic that’s tailored for a new feature that we’re building.

However, over time, we quite often find ourselves wanting to use a highly similar version of that same type or logic, but for something entirely different. We might want to reuse an existing model, but handle it in a slightly different way — or we could be looking to accomplish a task that’s very similar to something we’ve already solved, but with a different type of result.

The question then becomes — how to take our existing code, and refactor it to make it more generic and reusable — without ending up with something messy or unfocused. This week, let’s take a look at a technique for doing just that — that involves making certain types increasingly configurable.

Source: Configurable types in Swift, an article by John Sundell.