Programming Leftovers
-
Roman Kashitsyn ☛ Square joy: trapped rainwater
Computing the highest bar to the left and to the right for each index is not efficient: we would need to make O(N2) steps. Luckily, we can eliminate a lot of duplication in this computation. Instead of running the search from each position in the array, we can precompute the left and right maxima for all positions in two sweeps.
The algorithm to compute the running left maximum is called prefix scan. We can compute the right maximum by running the same scan from right to left (i.e., performing a suffix scan). Taking the minimum of precomputed left and right maxima gives us the water level at each point. The difference between the water level and the bar height gives us the volume of water trapped at this position. Summing up all volumes gives us the answer.
-
Marcel Kolaja ☛ The Builder's Guide to Better Mousetraps
I tend to be biased towards innovation. Towards building. I think most advice for technical leaders over-emphasizes the short-term risks of innovating too much, and under-emphasizes the long-term risks of innovating too little. However, both sides have good points, and we owe it to ourselves and our businesses to think carefully about the decision. Because of my bias, I force myself to deeply question my motivations when making decisions like this.
Its worth mentioning that this thinking is related to, but distinct from, the classic build vs buy decision. The thing you want, the thing you really need, doesn’t seem available to buy.
-
Z to Z ☛ How User Groups Made Software Reuse a Reality
Before the widespread existence of software repositories like CPAN, NPM, and PyPI, developers seeking to reuse an existing algorithm or library of routines would either check books or journals for code, or, they just might post a classified ad: [...]
Request posted in Decuscope 1965, Vol 4/Iss 2
User groups provided catalogues of software, from mathematical algorithms to system utilities to games and demos. Leveraging the user group’s periodicals, developers could post requests for specific examples of code. Or, more frequently, developers would review catalogs for existing solutions. They would contribute by sending their own creations to the group for others to use.
In this article, we will examine how these user groups coordinated development and shared code, how they promoted discoverability of software, and how they attempted to maintain a high bar of quality.
-
Chen HuiJing ☛ The value of live web design
Over the years, I’ve regularly seen blog posts or articles talking about “should designers code?” (less of “should developers learn design?” 🤷). I even chimed in with a tangential opinion piece back in the day. Tangential because I never said designers should code. Haha.
What I found is that after 9 years, my experiences have not changed my opinion back then. Namely:
"An ideal web design process involves close collaboration between the users, designers and developers."
-
[Repeat] Rlang ☛ A Beginner’s Guide to Renaming Data Frame Columns in R
Renaming columns in a data frame is essential for clarity and consistency in data analysis and visualization. It allows us to assign more meaningful names to columns, making our code easier to understand and interpret. Additionally, renaming columns may be necessary when merging or joining data frames with different column names.