Posts
German Tank Problem
War and Engineering
Historical Context
Understanding the Problem
React Initializing …
Required Reading
This article will cover the relationships you might run into
First and foremost, please go read the lovely series that TKDodo created on common pitfalls. This article specifically covers the props and useState relationship he covers in putting props to useState.
What I’ll be …
React Tldr
Mandatory Reading
- https://www.developerway.com/posts/react-re-renders-guide#part2.5
- https://www.joshwcomeau.com/react/why-react-re-renders/
When a component changes why does react re-render it’s children/desendants?
Take a look at the visual showing this in Josh Comeau’s post. So now …
Changing Api With No …
Problem
You are trying to change an existing API and you don’t want to have downtime.
System
React Frontend + Python Backend + Postgres DB
{
"name": "John Doe",
"telephone": "123456789",
"address": {
"firstLine": "123 Fake …
Data Attributes
Framework/Library or Native? Convention or Specification?
In the development world there is so many frameworks and libraries that build on abstractions on top of other abstractions it gets hard to understand is this thing that I’m doing specific to the framework or library that I am using or …
Zero Downtime New Non …
Todo How do you ensure a zero downtime deployment when the new version adds a new non-nullable column to the model
https://www.youtube.com/watch?v=Wbg2HoYjLHU https://blog.martinhujer.cz/how-to-add-non-nullable-column-without-downtime/
address -> addresses
Addresses object changed to add a new …
Database Physical Medium
1. HDD
- Watch a video of what a spinning HDD looks like. https://www.youtube.com/watch?v=ojGvHDjHPb4
- Watch a nice deep dive but still at a high level of the science and engineering at play. https://www.youtube.com/watch?v=wteUW2sL7bc
- Watch a really thourough deep dive on HDD. It’s similar to …
Technical Interview …
Database
- How does a database physically store and read data?
- How to have zero downtime when adding a new non nullable column to a table?
Partial Update Cast Assoc
message_template_with_preloads = Repo.preload(message_template, preloads)
attrs_with_merged_metadata =
if Map.has_key?(attrs, "template_metadata") do
current_metadata = message_template_with_preloads.template_metadata || %{}
new_metadata = attrs[ …
Global Modal
In your layout define <%= live_render(@socket, LiveBeatsWeb.PlayerLive, id: “player”, session: %{}, sticky: true) %>
Sticky means :sticky - an optional flag to maintain the LiveView across live redirects, even if it is nested within another LiveView. Note that this only works for …
Client State vs Server …
Things I wish I knew
I think fundamentally this is such a key element in any frontend application regardless on the framework(s)/language(s) you are using but it’s one that is rarely explicitly stated.
- Making data from server available everywhere
- Becareful when connecting your API calls to …
Elixir Clause Anti …
defp generate_instances(
_user,
%{recurrence_rule: [%RecurrenceRule{frequency: :daily, interval: interval, start_date: start_date}]} =
template_todo,
_current_datetime
)
when start_date != nil do
now = DateTime.utc_now()
due_dates = …
Websockets and Phoenix …
There’s Websockets, and there’s Phoenix
In a recent deep dive of websockets, I kept on finding myself thinking “Well how does this work in Phoenix/LiveView”? With Elixir being so embedded in the distributed world it does feel like we get a lot of stuff “for free”. …
Sliding Window Template
General Resources
Motivation
My motivation for this post is not to breakdown what the sliding window is, but to help give more structure to the concept when actually implementing it. I’ve found many times that many …
Selection Sort and Alice …
Selection sort and tennis matches
In reviewing some of the basic sorts I always find myself forgetting which one is which for the most part. Bubble sort is easier to visualize, and insertion makes me think of poker but the rest not so much. In an attempt to properly remember selection sort I wanted …
Co Occurances
All things pairs
The goal of the problem was to create a function that given two words would return the co-occurence of those words. Where the definition of co-occurence is the number of lines in which two words appear together
I think I got mixed up on a few things with the wording of the problem, …
Iterating through all …
All things pairs
I recently had an interview an interview where the solution required me to iterate through all the pairs of words in a sentence.
I was a little rusty and created the nested loops in the wrong way. I was relying on memory rather than understanding. I wanted to strengthen my intuition …
Two Sum Two Pointer
Motivation
This posts takes the (Leetcode 1) classical two sum problem and solves it using two pointers. However post takes the excellent formal and informal solution from this stackoverflow post and elaborates on the nuances and interesting observations.
Seeing as though there are other problems …
Flavors of Controlled and …
Conventions of Controlled and Uncontrolled Components
Let’s quickly talk about some conventions that you might notice in frontend component libraries like Radix.
If you need a little more details you can take a look at My Old Post . Also a shout out to Hari’s post which helped things …
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 …