Created At: 2020.02.17
Updated At: 2020.02.20
This is the first in a series of posts where I’ll introduce an interview problem I’ve never solved before and attempt to solve it in an hour. I’ll show what was achieved in that hour, then proceed to implement a full solution to the problem if I failed to initially do so.
Counting Special Strings The problem Via HackerRank, this problem asks us to solve the following:
A string is said to be a special string if either of two conditions is met:
Created At: 2020.02.12
Updated At: 2020.02.16
tl;dr; Checking your invariants matters. It’s easy to write code that violates an invariant if you’ve forgotten to verify it. When in doubt, make the constraints and assumptions you are working within explicit rather than implicit. This will help future-you avoid all sorts of pain.
The Classic Missed Invariant Have you ever seen a test fail in CI or a function fail in production only to have a teammate (or yourself) declare “… but it works on my local!
Created At: 2020.02.05
Updated At: 2020.02.11
tl;dr; A brief story of an issue I created when writing some Rails tests. This got me considering how method calls in Ruby work, particularly the ancestor chain. But, the issue turned out to be unrelated to inheritance. The crux of the issue was that I’d made a mistake in understanding how a view in Ralis works, which led me down the wrong path while troubleshooting.
Mocking module methods with RSpec The other day at work I had my understanding of Ruby’s include tested.
Created At: 2020.01.18
Updated At: 2020.01.29
Today I want to talk about the least-exciting part of developing an application, configuration. All those pesky little details that change across environments, or might change. You’ve done the smart thing and factored them out into environment variables, or key-value-pairs in a configuration file, etc… And now your application’s code is clear and concise, and works great when you flip between production and development mode. However, there’s still one unanswered question - where do you actually store all of this configuration?
Created At: 2019.06.27
Updated At: 2020.01.24
Over the past month or two I’ve had several conversations with teammates where they’ve asked for my “reading list”. I read a lot, but there isn’t anything particularly special about the books I read. That being said, books are wonderful and always worth sharing, so here are the things I’ve read that have made a big impact on me. They’re mostly professional, but there are a few mind-expanding books thrown in for good measure.
Created At: 2019.06.10
Updated At: 2019.07.15
The problem at hand Welcome to “algorithm study”, a fancy name for my fiddling with solutions to classic problems in computer science. Many of these problems will be NP-Complete or NP-Hard, so while there may be no polynomial solution, its still often possible to create reasonably performant solutions for small values of n. The series will work through things like path finding, Sudoku solvers, N-Queens, and others in an iterative fashion.
Created At: 2019.04.29
Updated At: 2019.04.30
At work we’ve recently changed how we execute software projects in an effort to dramatically shorten the feedback between work & learnings gleaned from that work. However, as with any sort of transition, there’s a body of work that has recently been wrapping up. Amongst this work were a pair of quarter-long projects that had very different execution stories & completion states. I’ll be using these two projects (in the abstract) to explain Daniel Kahneman Et Al.
Created At: 2019.04.01
Updated At: 2019.04.01
I’ve been reading a lot lately about the early days of computers & hacker culture. Each of the books has highlighted how important having a deep understanding of the tools & hardware has been for programmers, regardless of generation. Personally, I’ve been fortunate enough to spend my entire career working with relatively high-level languages like Scala, Haskell, or even C#. Tools like those allow programmers to be extremely productive without ever really grasping the inner workings of their machine.
Created At: 2019.03.10
Updated At: 2019.03.11
What’s a Fixpoint? For some reason, functional programming seems to have developed a reputation for using confusing and/or complex names to describe various concepts. I recall this being more or less my impression as I transitioned from the “standard” OOP+imperative style into functional programming, so I’d like to start dispelling some of the confusion. This piece will talk through one of the basic, albeit more obscure, building blocks for functional programming that was a bit intimidating upon my first contact with it.
Created At: 2019.01.27
Updated At: 2019.01.28
The API Due to the way buckets are maintained in cuckoo filters its possible to perform the three basic set operations, insert, delete, and member. Those three operations comprise the api into Data.CuckooFilter in the cuckoo-filter library package. As you’d expect for a data strucure that answers set membership questions, the API behaves exactly like the api for a set, with one big exception. As discussed in part 1, cuckoo filters (and cuckoo hashing in general) store fingerprints in hash buckets.
Created At: 2019.01.20
Updated At: 2019.01.20
Approximate Set Membership Several years ago I was hard at work building a near-realtime database of events happening around the world. This was a classic crawling problem, where I’d need to make sure I’m not checking the same location for events twice, or looking for events hosted by the same person twice. Initially the team and I were able to get away with using a regular Set for this, but as we scaled up to handle millions of sources this approach broke down.
Created At: 2019.01.13
Updated At: 2020.02.16
I was recently started reading Thinking with Types and came upon a great explanation of variance and the role it plays in reasoning about functions. You’re probably familiar with Functor, which says that for some t a, if given a function f :: a -> b, you can transform the t a -> t b. Essentially, the essence of “functor-ness” is the ability to transform a result into another type. What about “anti-functorn-ness”, where you want to transform the input rather than the result of a function from a -> b?
Created At: 2018.11.10
Updated At: 2019.01.17
A few weeks ago I gave a talk at work about Lambda Calculus. I had intended to speak only about the Y-combinator (post about that is forthcoming), but ended up spending two-thirds of my time rushing through an explanation of the untyped Lambda Calculus. Afterwards a few teammates suggested that the material in that talk would be better served with a blog post, so here we are.
The untyped lambda calculus isn’t particularly useful for day-to-day programming unless you happen to work in language design, but its fascinating and well worth a trip down the rabbit hole.