Documenting software-things I learn almost everyday. Inspired by jbranchaud/til.
Start simple–one README.md
(this one) for all entries.
There will be no categorization yet
because I am just getting started
and want to mitigate the friction and frills.
So, I'll start by simply keying each entry
by time, fully knowing that as the entry list
grows (hopefully)–I'll eventually index them differently.
I was browsing the Scala 2.13.0 release notes and came across the change "Partial unification on by default". djspiewak's gist explained the motivation nicely–I've actually read it multiple times but today's pass-through led me to internalize the take away:
...if your type constructor takes multiple parameters, you should order them such that the parameters you expect users to vary (i.e. write a map function over, change frequently between functions, etc) should be right-most, while the parameters you expect to be consistent (i.e. the same at multiple unrelated places in the code) should be left-most.
Doing so will allow the compiler to help you in the
edge cases. To me, this also rhymes with Either[Error, A]
.
Timestamp timezone handling with Scala/Java and PostgreSQL can get tricky. There are layers of conversions and data types between application, driver, and the database itself. Today I was reminded of these nuances for both read and writes. UTC for storage is preferred, of course, but when rubber meets the road here are some nice resources I came across today to color this in practice:
- PostgreSQL, All timezone-aware dates and times are stored internally in UTC.
- Using a joda-time/JDBC app layer, avoid a
LocalDateTime
hop and jump tojava.sql.Timestamp
from jodaDateTime
(with timezone) viagetMillis
. - Great Stack Overflow answer that outlines the above and when one may want to deviate as well.
Protobuf
design for embedded platforms has considerations
that can affect the design of the message.
For nanopb in particular,
variable-length types (e.g. string
) within a oneof
either needs a custom option specification for max size
(with the implied memory overhead) or wrapped in it's
own message. More details, reasoning and examples solutions
here.
Contents piped to pbcopy
ends up in the clipboard.
openssl rand -base64 200 | pbcopy
Excel VLOOKUP
function can fail if target string with which
the lookup refers to is greater than 255 characters. It will
fail the match even if the lookup exists–and you will not
be able to distinguish this from a true match failure unless
you double check the work!
See this article for more details and a workaround. This bit me hard today.
The existence of the book WebRTC for the Curious. Exactly what I wanted to learn–well written, free and fell into my lap! Plus an interesting article detailing the story of Zoom, when they used WebSockets, and then WebRTC.