Plurrrr

a tumblelog
home

Iteration without for, foreach or while

Iteration is part of the bread and butter of any programming language, and this is the case in functional programming just as much as in imperative programming, but how is it possible to iterate without for, foreach or while?

Source: Iteration without for, foreach or while, an article by Simen Endsjø.

Do Butterflies Challenge the Meaning of Species?

What is a species? It’s a question that has agonized scientists since well before Darwin. With some exceptions, the thinking has landed on an evidently firm reproductive barrier: Members of different species don’t mate. If they do, their offspring are sterile and can’t contribute to future generations. The reproductive barrier has thus created a useful demarcation of “what is a species”—until a deep dive into butterflies showed otherwise.

Source: Do Butterflies Challenge the Meaning of Species?, an article by Mary Ellen Hannibal.

Simple Go Mocks

Go‘s interfaces and “duck typing” makes it very easy to create simple mock or stub implementations of a dependency for testing. This has not dissuaded a number of people from writing generalized mocking libraries such as gomock and testify/mock, among others.

Here I want to describe a simple alternative pattern I frequently use when writing tests for an interface, that I think is generally applicable to many use cases.

Source: Simple Go Mocks, an article by Jonathan Hall.

Set up tab completion for ssh and scp

Tab completion is a ubiqutious time-saver, and I use it everywhere I can. Here’s how I set it up to autocomplete hostnames when I use the ssh or scp commands.

Source: Set up tab completion for ssh and scp, an article by Andy Lester.

Why is Learning Functional Programming So Damned Hard?

My Functional Programming journey was filled with dead ends, false starts, failed attempts and frustration. And I suspect that I’m not alone in this struggle. So why is this a common problem and what can be done about it? And how can you avoid the these same pitfalls?

Source: Why is Learning Functional Programming So Damned Hard?, an article by Charles Scalfani.

There Is No "Right" Way: Git Rebase vs Merge

In honor of my new license plate, I decided I wanted to do a quick, little post on rebase vs merge, how each one works, and how I choose to use each one. Let's first look at how each one works.

Source: There Is No "Right" Way: Git Rebase vs Merge, an article by Molly Struve.

Building DSLs in Swift

A DSL, short for Domain Specific Language, can be explained as a special kind of API that focuses on providing a simple syntax that's tailored to working within a specific domain. Rather than being complete stand-alone languages - like Swift is - DSLs are often hosted in other languages, and as such, need to use a grammar that's also perfectly valid in their host language.

Source: Building DSLs in Swift, an article by John Sundell.

Principal Components Analysis (PCA) – Better Explained

Principal Components Analysis (PCA) is an algorithm to transform the columns of a dataset into a new set of features called Principal Components. By doing this, a large chunk of the information across the full dataset is effectively compressed in fewer feature columns. This enables dimensionality reduction and ability to visualize the separation of classes or clusters if any.

In this tutorial, I will first implement PCA with scikit-learn, then, I will discuss the step-by-step implementation with code and the complete concept behind the PCA algorithm in an easy to understand manner.

Source: Principal Components Analysis (PCA) - Better Explained. A recommended read.

2019-12-02 What is Functional Programming? and Property Wrappers in Swift 5

What is Functional Programming?

Functional Programming is, like Object Oriented Programming (OOP), a programming paradigm. There isn't a formal agreed-upon definition of what FP entails, but there are two core concepts most people would agree are central to the paradigm:

  1. Avoiding mutating state and side-effects
  2. Using functions as the central building block of programs

Lets discuss each of these in turn.

Source: What is Functional Programming?, an article written by Kjetil Valle.

The Complete Guide to Property Wrappers in Swift 5

Property wrapper is the Swift language feature that allows us to define a custom type, that implements behavior from get and set methods, and reuse it everywhere.

Source: The Complete Guide to Property Wrappers in Swift 5, an article by Vadim Bulavin.

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

Making Swift code extensible through plugins

This week, let’s continue exploring the topic of configurable types that was covered earlier this year — by taking a look at how setting up a plugin-based architecture can help us keep a library or piece of functionality as narrow and as small as possible, while still enabling it to be extended and tailored for more specific use cases.

Source: Making Swift code extensible through plugins, an article by John Sundell.

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.

Discovering less-known PostgreSQL v12 features

Version 12 of PostgreSQL is not exactly fresh out of the oven, as the first minor release was already announced. However, I think it’s fair to say that this version can be still considered fresh for most users, and surely only a small percentage of users has upgraded. So I think it makes sense to go over some new features.

Source: Discovering less-known PostgreSQL 12 features, an article by Kaarel Moppel.

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

The War Within

After midnight I started in The War Within, the second book in The Great God's War, by Stephen R. Donaldson.

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.

Salvation Lost: Excellent

After midnight I finished Salvation Lost, The Salvation Sequence Book 2 by Peter F. Hamilton. In my opinion this book is as good as the first one in the sequence: Salvation. Recommended.

Stop using Bootstrap

In this article, I’m going to walk you through the creation of a Bootstrap-style, responsive, 12 column grid template for component-based UIs — using just CSS Grid, simple semantic HTML and SASS. In the end, we’ll put our template to the test by recreating the reactjs.org front page with it!

Source: Stop using Bootstrap — create a practical CSS Grid template for your component based UI, an article by Alex Tsirozidis.

A quick primer on dig

Dig is a DNS lookup utility developed by BIND which helps a lot while troubleshooting DNS issues (which are more common than you probably think #hugops). I use dig fairly often and thought to write an introductory guide on how you can use dig with some practical examples that’ll help you dig through DNS issues faster (sorry for the lame pun, couldn’t resist.)

Source: A quick primer on dig, an article by Karan Sharma.

What makes a programming exercise good?

I’ve been thinking about programming exercises lately, because I want to move into teaching people skills. But what makes a good programming exercise?

Source: What makes a programming exercise good?, an article by Julia Evans.