HNHacker News
TopNewBestAskShowJobs

cstrahan

1,132 karma · joined January 10, 2012

Charles Strahan cstrahan.com

Software Developer in Washington, DC

[ my public key: https://keybase.io/cstrahan; my proof: https://keybase.io/cstrahan/sigs/yV0wzDolQldJ9GSMuflLE9_PIggrsCf9jzIQPUHqzKE ]

submissionscomments
cstrahan··on Precision Clock Mk IV
I’m guessing you’ve already realized this, but in case it helps clarify things for someone else:

The signals rates mentioned in the article are with respect to how frequently the segments are updated, not the brightness. (With the one exception being the colons being PWM controlled, IIRC).

PWM means Pulse Width Modulation. Controlling a (perceived) light intensity of an LED via PWM means (if we pretend for the sake of simplification that the voltage rise and fall is instantaneous, etc) quickly turning the LED fully on and fully off, varying the duty cycle to achieve the desired perceived brightness. This project avoids the flickering inherent with PWM by not using PWM: the voltage itself is set to some fixed value for a given target brightness.

(If one then wonders why this wouldn’t be the default approach for such things: microcontrollers often provide a built in means for PWM output, but it’s less common to have built in true, non-PWM analog outputs, requiring additional parts (thus more cost, more complexity) to implement variable voltage control).

cstrahan··on Fui: C library for interacting with the framebuffer in a TTY context
The sibling comments are great; to add to those, I highly recommend giving “The TTY Demystified” a read:

https://www.linusakesson.net/programming/tty/

It’s a long read, but necessarily so: there is considerable complexity (and unfortunate overloading of terms) as a consequence of the transition from physical terminals as a separate hardware component to the emulated (warts and all) counterparts we have in modern OSes.

cstrahan··on Sandy Bridge-era motherboard gets M.2 SSD boot support 12 years after launch
The article received a ton of edits since it was first posted.

See this comment: https://news.ycombinator.com/item?id=43915500

And see my comment with examples of edits below that.

cstrahan··on Sandy Bridge-era motherboard gets M.2 SSD boot support 12 years after launch
Figured I'd provide the old version of those examples from above in the thread.

Here are the NEW sentences again, for convenience:

"Notably, Gigabyte has seemingly updated the 13-year-old B75M-D3H motherboard to support booting from NVMe SSDs, like M.2 SSDs, a previously unavailable functionality."

"An analysis of the F16f firmware using UEFITool reveals the inclusion of the NVMe DXE trifecta (Nvme, NvmeSmm, NVMEINT13), which is essential for booting from NVMe drives, like M.2."

"The motherboard features one SATA III and five SATA II connectors for storage, explaining its initial lack of support for booting from NVMe drives. Nonetheless, users can employ M.2 to PCIe adapters, allowing M.2 drives to connect with the motherboard via its expansion ports."

And here are the OLD:

"Notably, Gigabyte has seemingly updated the 13-year-old B75M-D3H motherboard to support booting from M.2 NVMe SSDs, a previously unavailable functionality."

"An analysis of the F16f firmware using UEFITool reveals the inclusion of the NVMe DXE trifecta (Nvme, NvmeSmm, NVMEINT13), which is essential for booting from M.2 drives."

"The motherboard features one SATA III and five SATA II connectors for storage, explaining its initial lack of support for booting from M.2 drives."

cstrahan··on My dream thermostat (2024)
I just want a thermostat that gives me the option to specify that I want it to maintain a target temperature, and have it automatically switch between cooling and heating.

The one I have in the apartment I’m renting only gives Cool vs Heat. With Texas being as finicky as it is this time of year, the temperature swings from frigidly cold to swelteringly hot day to day, and with my ADHD and lack of connection to my body, I find myself wondering why I’m feeling run down and mentally foggy, and then I realize it’s because I had to switch to Heat yesterday (because the house dropped down to 60F) and today the apartment is now at 85F, and I’ve been progressively overheating for the past 5 hours or so.

cstrahan··on Packed Data Support in Haskell
No, one example of why being variable sized integers.

See https://protobuf.dev/programming-guides/encoding/

cstrahan··on Sapphire: Rust based package manager for macOS
People share negative sentiments for a number of reasons. Sometimes it’s emotionally motivated (like venting), sometimes it’s because you want to see less hype and more realistic discourse are about the deficiencies in our industry. There simply isn’t enough time to fix all the things that are problematic or completely broken, so naturally some things are only going to be talked about, rather than worked on.

And, I’ll point out the irony in your directive: you take issue with people expressing criticism without taking action to completely resolve the respective issue, and then you come along to express criticism by tell people to not complain but instead offer up free labor, when you could go and solve the problem that resulted in the original complaint.

cstrahan··on A Visual Journey Through Async Rust
Right at the top of the docs for worker_threads:

> The node:worker_threads module enables the use of threads that execute JavaScript in parallel.

Now that it doesn’t say “concurrent”, it says “parallel”. This implies that multiple threads are involved.

cstrahan··on Microsoft subtracts C/C++ extension from VS Code forks
I would bet they meant the editor “Zed”.
cstrahan··on Sapphire: Rust based package manager for macOS (Homebrew replacement)
> It’s also open source, did they not accept your pull requests for these “improvements”?

I don’t think you are being fair. This question presupposes that the supposed problems can be solved by iterative changes, rather than being inherent in the chosen design/architecture of the software, which usually requires complete replacement thereof (as well as the leadership thereof, as people who choose poor solutions to problems often can’t appreciate arguments for superior solutions).

(Not that I’m trying to suggest that I agree that homebrew in particular is bad — just speaking generally.)

cstrahan··on First hormone-free male birth control pill enters human trials
Well, to be clear, I didn’t actually count the sperm, as I was more interested in a rough, qualitative (rather than rigorous, quantitative) observation.

That said, yeah, the relative amount of sperm didn’t drop off noticeably at the offset. And I think that kind of makes sense: as someone with a relatively short refractory period, let’s suppose I ejaculate two or three times in 5 minutes: I doubt (though I could be wrong) that my body actually evacuated all of the seminal fluid (and fully replaced it) each time. I would bet there’s simply a bunch “left in the tank”. Would be interesting to hear from a urologist (or someone with similar expertise).

cstrahan··on First hormone-free male birth control pill enters human trials
While I disagree with your claim that steroids are a viable form of birth control, I do agree a bit with this, though not for the stated reason.

What many people don’t realize (probably in large part because they see testosterone and estrogen as diametrically opposed things) is that testosterone levels impacts estrogen levels. Why? Because the body produces estrogen through the aromitization of testosterone. Increasing testosterone will increase estrogen.

A common struggle for those on TRT (both those at true replacement levels, as well as those taking supraphysiological doses) is elevated estrogen. I know that when my estrogen levels have gone too high, I become more neurotic than I usually am.

If you couple increased neuroticism with an elevated sense of dominance (especially at bodybuilding doses), and top that off with a general lack of poor management of one’s emotions (which I suspect is common amongst bodybuilders), what you likely get is a very volatile person. Not because of testosterone, but because of the elevated estrogen and their existing psychological issues.

cstrahan··on First hormone-free male birth control pill enters human trials
Woah, now. You are dangerously mistaken here.

As I wrote over in: https://news.ycombinator.com/item?id=43746406

I’m on TRT, without hCG. I went and had a vasectomy a year ago. Because I’m weird and infinitely curious, two or three days after the procedure, I took three samples per day, and looked at each under the microscope. What I saw put to shame just about any video I could find online of a “good” sperm sample. Straight laser beams, zipping from one side of the slide to the other. If you were to scale Micheal Phelps down to these swimmers, he’d stand no chance. And the concentration was ridiculous, too. And this all 2-5 day old (at least) sperm!

TRT is not a reliable form of birth control.

cstrahan··on First hormone-free male birth control pill enters human trials
> You're right that it doesn't stop sperm production, just emission. As for "the drip"; that's pre-ejaculate, which doesn't contain sperm inherently, but can pick up residual sperm in the urethra from a prior ejaculation.

I’d like to stress that point a bit.

I had a vasectomy about a year ago, and being the weirdo that I am, I figured I’d see how much sperm remained in my ejaculate (and for how long) after the procedure.

I waited maybe two or three days after the procedure, and then for the next three days, I’d collect three samples per day and take a look under my microscope. In the first four or five samples, the swimmers were swimming hard. Told my brother (who had been trying for a kid for a couple years, and had observed his own samples trying correlate diet and other factors to improved motility) about the straight laser beams I was seeing in the scope — he nearly had a fit when I described how long it took them to go from one side of the slide to the other under the given magnification.

It was the ninth sample when there were very few observable sperm, and what remained looked kinda drunk and unmotivated.

All of that to say: if you’re going to get a vasectomy, when your doctor tells you to abstain from condom-less/birthcontrol-less sex until you come back for a sperm count, take that seriously. It’s amazing how motile they are even when kinda old, and also amazing how many hang around downstream of the vas deferens after many ejaculations. And, while rare, sometimes the vas deferens do manage to reconnect.

And a bonus tip along these lines: testosterone replacement, even without hCG, is not a reliable form of birth control. I’m on (and was on) TRT, without hCG, and the concentration of sperm under the scope looked higher than any YouTube video I could find at the same magnification (meanwhile my bro is taking silly amounts of hCG and struggling). I hear a lot of people joke about TRT having the beneficial side effect of infertility, but that’s far from a certainty.

cstrahan··on PEP 750 – Template Strings
> You therefore get code that locally looks good, even if it has security mistakes. Instead of one source of error - the developer interpolated - you now have three.

Could you give examples of this?

> The developer forgot to interpolate

What would this look like? The only way to get dynamic/user input into a template is either through interpolation or concatenation.

Before:

f"..html_str..." + user_provided_str # oops! should have: html_str + sanitize(user_provided_str)

After:

t"...html_template..." + user_provided_str # oops! should have: t"...html_template...{user_provided_str}"

Does this really leave us worse off?

Unless you're referring to something like this:

Before:

html = "love > war" # oops! should have been: html = "love > war"

After:

html = "love > war" # oops! should have been: html = t"love > war"

But then the two scenarios are nearly identical.

> the developer chose the wrong interpolation

What kind of interpolation would be the "wrong interpolation"?

> or the interpolation itself got it wrong.

Isn't that analogous to sanitize(user_provided_str) having a bug?

cstrahan··on PEP 750 – Template Strings
> It seems like before with an f string we had instant evaluation, now with a t string we control the evaluation

You don't completely control the evaluation.

From the PEP:

> Template strings are evaluated eagerly from left to right, just like f-strings. This means that interpolations are evaluated immediately when the template string is processed, not deferred or wrapped in lambdas.

If one of the things you are interpolating is, as a silly example, an invocation of a slow recursive fibonacci function, the template string expression itself (resulting in a Template object) will take a long while to evaluate.

cstrahan··on Demystifying the (Shebang): Kernel Adventures
Are you sure that what is being printed is the contents of a file? And which shell are you using?

If your which command is a shell builtin, and nvm is a function, then you’re likely seeing the content of that function.

cstrahan··on Ask HN: Why is uptalk intonation so prevalent in ChatGPT voices?
George Carlin once gave a masterclass on how to talk like politician at the National Press Club: https://www.youtube.com/watch?v=jG9rkiMe2nA
cstrahan··on Windows 11 is closing a loophole that let you skip making a Microsoft account
I have a personal “Windows install / configuration playbook” so I don’t fall into these types of pitfalls for the Nth time (including the very example you give).

Some fun ones: windows defaults to storing the hardware clock time as a time-zone local offset, so whenever it syncs time with network servers, it messes up your time in other OSes (in multi-boot setups). You have to set the RealTimeIsUniversal registry key to make Windows behave.

What made me figure this out? Another pair of issues: the XBox/gaming app/overlay would give nonspecific errors, or at best not let my party hear me, when I’d try to join my brother’s party when playing games. Eventually connected the dots: I would reboot into Windows after working in Linux, the time would be messed up, and the Windows gaming overlay’s party stuff would be broken, suggesting the local time is used in some way for the chat/voice protocol, but of course they don’t tell you that. I initially scoured pages, and pages of Google search results, leading to countless MS forums and Reddit posts, none of which pointed out the importance of the system time. This wouldn’t be as much of an issue if Windows would more regularly sync the system time, or at least do so upon booting, but of course there isn’t a first-party way to do that, either — the best I could do without installing crap was go into the time settings and unset then set the option for syncing time automatically, coercing it into updating the time right then and there — at least, until I sorted out why the time was all messed up when rebooting after running Linux.

Now with the ads and forced online account creation, it’s only becoming more of a dumpster fire than it already was.

cstrahan··on I genuinely don't understand why some people are still bullish about LLMs
I think you are discounting the fact that you can weed out people who make a habit of that, but you can't do that with LLMs if they are all doing that.
cstrahan··on I-cant-believe-its-not-webusb: Hacking around lack of WebUSB support in Firefox
Changing the layout of key map layers for convenience, and macros, back when I assembled my first QMK keyboard. Haven’t touched it in years now, though.
cstrahan··on I-cant-believe-its-not-webusb: Hacking around lack of WebUSB support in Firefox
I doubt you have this same sentiment about continuous integration in the context of work. Same concept. Eventually you get every thing dialed in and you keep it there.
cstrahan··on Minding the gaps: A new way to draw separators in CSS
The designers behind practically every newspaper (including the New York Times) would disagree with you:

https://store.nytimes.com/cdn/shop/products/new-york-times-f...

If you’re against established, commonly accepted best practices for design, then I can’t argue with you — everyone is entitled to their own opinions, as unpopular as they may be.

cstrahan··on Minding the gaps: A new way to draw separators in CSS
If I understand what you’re referring to, then I suspect you’re mistaken about the names you’re referring to.

I presume you’re talking about a feature like this: https://tagboard.com/product/guides-and-remote-refresh-capab...

In page layout software, the thin UI elements bordering the left side and top side of the page, with the little tick marks, is called a ruler. The tick marks on the ruler are called rules (just like the rules on a physical ruler used for measuring things). When you click/drag on the ruler elements, you create guides (or guidelines).

I’ve never seen “ruler guides” verbatim, but I would take that to be shorthand for “guides one could create using the ruler” (which would be a mouthful) to disambiguate the word “guide” when there isn’t sufficient context for the reader to likely understand what was meant.

The guides themselves are not rulers.

cstrahan··on What makes code hard to read: Visual patterns of complexity (2023)
> In other words, people shouldn't make claims that one pattern is objectively more readable than another. Ever.

Maybe you haven't seen the sort of code I've seen.

Consider this specimen, for example:

  // Call a function.
  // Function call syntax isn't very visible (only a couple parens tacked onto an identifier);
  // this is a major win for readability.
  function callFunction(func, ...args) {
    return func(...args);
  }
  
  // Perform math.
  // Math symbols are arcane and confusing, so this makes it much more clear.
  // I'm trying to program here, not transmute lead into gold!
  function doMath(left, op, right) {
    const OPS = {
      "less than or equal to": (l, r) => l <= r,
      "minus": (l, r) => l - r,
    };
    // TODO: add support for other operators.
  
    return callFunction(OPS[op], left, right));
  }
  
  const MEMO_TABLE = {}
  
  function fibonacci(n) {
    if (callFunction(doMath, n, "less than or equal to", 1)) {
      const result = n;
      // Memoization makes this fibonacci implementation go brrrrrrrrr!
      MEMO_TABLE[n] = result;
      return result;
    } else {
      const result = callFunction(fibonacci, callFunction(doMath, n, "minus", 1)) + callFunction(fibonacci, callFunction(doMath, n, "minus", 2));
      // Memoization makes this fibonacci implementation go brrrrrrrrr!
      MEMO_TABLE[n] = result;
      return result;
    }
  }
Yes, it was an intentional choice to never actually make use of MEMO_TABLE -- this (reproduced from memory) is a submission from an applicant many, many years ago (the actual code was much worse, it was somehow 3 to 4 times as many lines of code).

Compared to:

  function fibonacci(n) {
    if (n <= 1) {
      return n;
    } else {
      return fibonacci(n - 1) + fibonacci(n - 2);
    }
  }
> In other words, people shouldn't make claims that one pattern is objectively more readable than another. Ever.

Taken literally, I can't argue with this. But if you amend that to "people shouldn't make claims that one pattern is objectively more readable than another to competent individuals" (which I suspect is intended to be implied by the original quote), then I'd have to disagree. The choice between functional vs procedural may mostly be subjective, but a convoluted pattern is objectively worse than a non-convoluted one (when the reader is competent).

cstrahan··on I-cant-believe-its-not-webusb: Hacking around lack of WebUSB support in Firefox
Flashing every day isn’t too uncommon if you’re often changing the key map, macros, and other configuration. I probably flashed my QMK keyboard an average of 10 times per day for the first week, and then that tapered off to once or twice a day for a while.
cstrahan··on Cheap blood test detects pancreatic cancer before it spreads
And if you aren’t a fan of being sedated (I’ve never been, and I’d prefer to keep it that way), you can opt to do it without sedation. Had a colonoscopy and an upper endoscopy the same day, no sedation. A little uncomfy, but not painful. If you can push yourself through hard weight training sets, or run a 50k, or anything else that entails a bit of discomfort, a colonoscopy is no biggy.
cstrahan··on Science of Microwave Ovens (2016)
My (limited) understanding is that the shape is a large factor. Something about sharp edges or points concentrating the electric field induced by the microwaves, leading to a high voltage buildup. So forks are a bad idea, while spoons will likely not result in any sparks.
cstrahan··on Ask HN: Is onboard audio still good enough compared to dedicated Sound Cards?
> Do dedicated sound cards offer tangible audio quality improvements over modern onboard solutions like Realtek?

Depends on motherboard, but: I had a top of the line, very well reviewed gaming mobo, and I’d hear a buzzing noise over the speakers depending on what the computer was doing. Moving the mouse? Distinct buzz as a function of speed. Compiling the Linux kernel? Distinct buzzing. Etc. this happened under both Windows and Linux, so I don’t think it was a software issue.

Having an external DAC allows you to keep the audio signal very, very far away from the rest of the electronics, which completely solved the problem for me. I went with a Focusrite Scarlett 2i2 for about $200, connected to my two JBL 305 speakers — it’s been great. It wasn’t in my initial plans, but I later took advantage of the XLR microphone input to set up a Shure SM7B microphone (wasn’t quite enough gain, so I added a TritonAudio FetHead preamplifier and a DBX 286s for de-essing/eq/etc — very happy with the setup now).

So, FWIW, I’m a big fan of external USB DACs.

cstrahan··on The FizzBuzz that did not get me the job
> the interviewers hinted that the direction was not what they were looking for

No, they said they couldn’t see the utility in what he was doing, which is very different than being told that his solution is unsatisfactory.

I have had countless interviews where I’ve been told that they don’t see where I’m going with something, and when I’m finished they admit (after some time processing) that they are impressed that I came up with such an elegant, simple solution. When asked what they had in mind, it turns out they (initially) thought the optimal solution was some contrived, overly complicated thing. If I let everyone’s interjections derail me, I’d never get through most interviews.

Think: have you ever seen a candidate give a crazy, overly complicated solution in an interview? Yes? Well, such interviewees (the ones that write 100+ line Fibonacci functions that look like they might be doing some memoization, but if you squint it turns out they aren’t even using the memo table they constructed) go on to be become interviewers — it shouldn’t be a surprise that many interviewers unintentionally throw candidates curveballs by expressing incredulity in the face of a non-shitty solution. If something is truly a hard “no”, then a “no” must be said — expecting the candidate to guess what’s going through the interviewers head is ridiculous.

← PreviousPage 3 of 17Next →