Posts

Uncontrolled/Controlled …

Note to the Reader

This post is not really meant for people discovering this concept for the first time. It’s really meant for people who have heard about it already but it still hasn’t clicked. Maybe they’ve tried to implement this concept themselves but it didn’t feel …

Why your Debounce isn't …

Motivation

Hopefully the debounce article helps explain the ins and outs of debounce. You’re excited to use it in your React app but it’s not working. Wait what? It’s not working?! The concept is simple enough so what’s the issue!

I swear your almost there. There’s one …

Detail on Debounce

Use Case

The most common use case for needing debounce is there is a series of “events” that come in rapid succession but it doesn’t make sense to get a result for each event.

Some common examples in the web world for this are

  • A user is typing into a search bar, we would want to …

Inherent Limitation of …

Introduction

While reading (well it was an audiobook, but saying reading makes it sound smarter) a book on system design they made an interesting point on why they stated that for their book a visual pdf was a requirement. This made me think about how with complex systems using just words will …

Elixir Ecosystem Tour …

Introduction

After almost a year with Elixir I wanted to take some time to document some of the things I learned and mistakes I made. There are a few things that trip you up so I wanted to write down what that was for me so I have a place to come back and hopefully help people learn from these. All …

Ecto Gotachas Structs on …

Highlighting the Problem

While builing out my side project, I wanted to really leverage and learn more about Ecto. One of the things I was working with was managing a list using Changesets. The struct in question is a simple one called Interval which logically just represents a start and end …

First Open Source …

Small Wins

In celebration of a new version of ExDocs, I wanted to write about my first open source contribution.

What it takes

Open source contributions are important for many reasons. A selfish one is weirdly based off status.

  • The change was extremely small (8 total lines)
  • It was a change I wanted …

Testing the Right Thing

Recently something has been bugging me. Let’s say that we’re building some API endpoint in Elixir it could look something like this.

What should the controller test? Should it test the variations that the nested functions could receive? Well it’s easier to test the nested functions …

Ecto Associations on …

Introduction

This posts focuses on Ecto’s on_replace option that is relevant when working with associations. We’ll break down when it becomes relevant and explore the options that show up. We can think of this option as defining a strategy to take when associations are severed. …

Ecto Associations II: …

Introduction

In the previous post, we focused on a common use case when working with associations. Inserting new elements to an existing parent field. This covered concepts like why we need to preload the associated data in these operations. In this post, we’ll cover another example although …

Ecto Associations I: …

Motivation

One thing that might not be intuitive at first is that associations work on the whole collection of data. You’ll see this mentioned in a few ways in the docs. They’ll usually say that methods like cast_assoc and put_assoc work with the full data or the work with the …

Why Keyword List

Intro

As an Elixir beginner Keyword Lists are one of the weird features of the language. Coming from other languages, you’d almost always think of map-like structure first. So there’s a gnawing feeling, why keyword list? We’ll start with the unique characteristics of keyword list …

Pattern Match Keyword …

Introduction

Pattern matching with Elixir is used constantly. Keyword lists are also a really common data structure. Therefore it’s pretty natural to think you can pattern match keyword lists but as the Elixir docs point out, “In a nutshell, do not pattern match on keyword lists.” …

Constraints and Upserts …

Motivation

Going through the Constraints and Upserts guide helped me learn a ton of great details however there were a few gaps in my understanding and a few points where they stated something that I did not fully understand. Therefore, this article goes through the same guide but will go slightly …

Grokking Sql Joins

Introduction

Joins are a fundamental part of SQL yet it always felt like something didn’t click for me. When writing complex SQL queries it usually felt more like following a formula that you don’t truly understand rather. While working on more complex problems it requires more complex …

Directional Dependence

Intro

While going over the Flatland Space Station problem it made me stumble to a pattern I have noticed before and wanted to talk more about it. In this problem you run into a situation where the decision you want to make is dependent on two choices. Intuitively these decisions are not hard but …

Power Set

Introduction

In this case we want to try all possible variations of the given array. To be more specific we want to try all possible combinations of all possible lengths. What we’re describing here is the power set.

There’s a great article that elaborates even further on this however I …

Non Divisible Subset I

Introduction

Hackkerank medium problems continue to be a challenge for me. In this problem that we’ll take a look at it was challenging due to the fact that the brute force method seemed fairly involved and the inability to make connections to solve this problem in a faster way. In this post …

Abandoning Faulty Logic

How do you abandon faulty logic?

When trying to solve a problem there are many times where your initial line of reasoning is not the correct way. In this problem I chose to focus on counting the bribers, this approach worked for some of the test cases but not all of them. There was no extension I …

Forming a Magic Square

Introduction

This problem follows a trend I have noticed in hackkerank problems. The problem is very challenging if you attempt to solve it a more straightforward way. The observations you need to make are fairly involved and obscure! Even more so in this problem since many of the solutions I have …