HNHacker News
TopNewBestAskShowJobs

hermitdev

3,614 karma · joined June 13, 2016

submissionscomments
hermitdev··on Kentucky man becomes the first humanist granted religious exemption from AI
In most (all?) US states, you need a license to be a _Professional_ Engineer. This is a legal distinction that carries weight _and_ legal liability. It doesn't mean that you cannot "engineer" without a license. There's legal distinctions on what work a licensed engineer can and cannot do, and what work must be done by or under the supervision of a licensed engineer. e.g. a junior's work has to be signed off by a supervising PE. To become a PE, a licensed Engineering Intern must have first passed a preliminary exam issued by the state and worked under a PE for a minimum amount of time with satisfactory performance (think apprenticeship).

It's the legal liability that SWEs don't want. e.g. You wouldn't be able to just slap "This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." on your software and walk away from it when lives are at stake. A so-called Profession Software Engineer would have to accept liability for their work product, and those of the juniors working under them.

I started down the road to becoming a Professional Engineer while I was in college as I studied Electrical Engineering and was more interested in hardware/power engineering. I took, and passed, the Engineering Intern Test in my state (which is the preliminary exam you take before you can start your journey to become a PE). Then life happened and job/career opportunities took me in a different direction/industry, and I've been doing software instead. So, I never became a licensed Professional Engineer. I'm still a licensed engineering intern, though. I'm still bound by the legal and ethical standards that it entails and could lose my license for violations.

hermitdev··on Python's experimental JIT to be removed
> Python is harder to JIT because of the way __dict__ works.

Heh, how about how `__class__` works? Not that I recommend actually doing this, but you can literally change the type of an already instantiated object by reassigning `__class__`:

    >>> class Dog:
    ...     def hi(self):
    ...             print("woof")
    ...
    >>> class Cat:
    ...     def hi(self):
    ...             print("meow")
    ...
    >>> dog = Dog()
    >>> dog.hi()
    woof
    >>> dog.__class__ = Cat
    >>> dog.hi()
    meow
    >>> isinstance(dog, Dog)
    False
    >>> isinstance(dog, Cat)
    True
    >>>
hermitdev··on Steam Users Beg for "No AI" Filter as Vibecoders Flood Next Fest
Does Steam, itself, disclose its use of AI in a prominent manner? It's built on top of Linux, which allows AI assisted contributions.
hermitdev··on Type-safe HTML templating in Zig
I interned at a Fortune 500 starting in 2000.

Most of my work was on an intranet page used for tracking internal servers, apps and databases. One of cool (at the time) features I implemented was a server-rendered ping of the servers shown on the dashboard. We're talking usually a few hundred at a time. The site ran on IIS & NT 4, written in VBS & ASP. (I think my first server was actually a dual Alpha chip, wasn't even x86, sure as hell was way before x64).

To implement the ping functionality (yes, we're talking just a straight ICMP ping), I ended up doing a COM server, written in C++, called into it from the VBS side. Eventually, .Net came out, and once .Net Framework 1.1 was released, I was able to convince my boss to let me rewrite the whole site in ASP.Net. I ditched the C++ COM object and was able to do it in C# with raw sockets (and appropriate permissions, which was a bit of a pain to get right at the time, before google and stackoverflow were around to help). Getting the C++ COM object working was actually easier because at least the MSDN library (the entire stack of CDs & DVDs it was on) had extensive documentation. The .Net side was good initially, but it just did not have the same depth as the C++ side already had at that point.

hermitdev··on Research Firm Calls Anthropic's IPO 'Unprecedented Test of Investor Gullibity'
> Track record is extremely relevant when the "argument" is mostly about judgement and subjective opinions.

Ironic given this article is from CNBC, employer of Cramer, host of "Mad Money", who has been so inconsistently wrong that his picks have literally sparked an ETF. Just search using your engine of choice "Inverse Cramer ETF".

I work in finance. Past performance is not a guarantee of future returns, but is a damn good indicator, which is why everyone always wants to see your past performance anyways.

hermitdev··on I asked Meta’s Muse for its filesystem and it sent me 6.8GB
> It's not engineering if you're just guessing as to what is degrading the performance and what might improve it.

Engineering is literally the art of making educated guesses and then testing/proving/disproving/improving upon them. Nothing is exact. Everything is approximate. Iterate until the result is good enough.

hermitdev··on Small programming tricks
> The latter example, sounds like something trivially done by the compiler.

Taken by itself? Absolutely. In the middle of 50-deep templatized call stack? Maybe not. Compilers have their limitations (memory, runtime, other cost budgeting algorithms), and the more complex the code, the hard the optimizer has to work. But, yeah. Most of the gains from branchless code is going to come from this like numerical tools, vectorization and loop unrolling, things of that nature. It was an admittedly contrived example.

hermitdev··on Small programming tricks
What people refer to when they say "branchless code" is something very particular, and it refers to not triggering the CPU's branch prediction. That is, don't make the CPU have to guess which fork in the code you're going to take. This is usually accomplished in one of two ways: either bit twiddling hacks or specialized instructions that do not affect the CPU's branch prediction, such as the 'cmov' family in x86. If you search for `examples of branchless code using conditional moves` using your search engine of choice, you'll find numerous examples.

A trivial example is actually written with a branch in C/C++, but relies on compiler optimizations to kick in. If you compile a ternary operator in C/C++ (and probably rust, C# and other languages) such as in:

   int min_branchless(int a, int b) {
        return a < b ? a : b; // Often emits cmov with -O2
   }
With gcc/clang a -O2, one would expect the compiler to emit the following assembly:

    cmp edi, esi
    cmovle eax, edi   ; select a if a <= b
    ret
There's numerical tricks for other operations/comparisons, and compilers know a lot of them. But, I just suggest compiling your code and configuring your compiler to emit the generated assembly with references to the code it was generated from (you should be able to get it to emit source line references in the assembly). You'll likely be surprised at the optimizations applied at -02, and utterly confused by what you find at -03.

edit: Also, it doesn't mean to never branch, but to minimize branching, especially in tight loops. Branch outside loops, not inside, for instance.

e.g. don't do:

    for (...) {
        if (condition independent of loop variable) { 
          ...
        } else {
          ...
        }
    }
do:

    if (condition independent of loop variable) { 
        for (...) {
          ...
        }
    } else {
        for (...) {
          ...
        }
    }
hermitdev··on LG TVs caught spying even when offline or on standby
I don't mean to be dismissive, but isn't this old news? Hasn't it been the case that _all_ "smart" TVs have been spying on users since they came out? I've personally operated as if they are: my TV is not connected to the internet. At least, not through my internet connection. It's not on my wifi, nor is it connected to my LAN.
hermitdev··on Vietnam bans unskippable ads
Every time see Mr Beast (I don't watch any of his stuff, just accidentally see promos on Prime sometimes), he reminds me of Homer Simpson's forced smile in the Simpsons' espiode "Re-Nedufication" [0].

[0]: https://i.pinimg.com/originals/c8/84/8e/c8848e81afa88a42bd4d...

hermitdev··on Pingfs: Stores your data in ICMP ping packets (2020)
> to 4 GB packets

Heh. Anyone remember the ping of death[0]? A lot (most?) of computers on the early internet didn't properly handle large packets, _especially_ from ICMP pings. Once upon a time, you could send a single ping w/ a packet size of 65536 and crash the remote.

[0] https://en.wikipedia.org/wiki/Ping_of_death

hermitdev··on John Carmack on mutable variables
While your example of `sum` is a nice, pure function, it'll unfortunately blow up in python on even moderately sized inputs (we're talking thousands of elements, not millions) due to lack of tail calls in Python (currently) and the restrictions on recursion depth. The CPython interpreter as of 3.14 [0] is now capable of using tail calls in the interpreter itself, but it's not yet in Python, proper.

[0]: https://docs.python.org/3/whatsnew/3.14.html#a-new-type-of-i...

hermitdev··on Texas law gives grid operator power to disconnect data centers during crisis
> This is a terrible idea.

No, it isn't. Any decent datacenter will have on-site generation in event of power grid failure, anyway. When I was an intern, the company I worked for would routinely go off grid during the summer at a call from the electric company. The electric company actually gave us significant incentives to do so, because us running on our own 12MW generator was effectively like the grid operator farming out a 12MW peaker unit.

hermitdev··on Graham: Synchronizing Clocks by Leveraging Local Clock Properties (2022) [pdf]
> that EU regulation requires their timestamps to be within 100 microseconds of UTC,

It's the same in the US. It's covered under CAT NMS (Consolidated Audit Trail, National Market System). Probably too much information at: https://www.catnmsplan.com/

hermitdev··on Run a C# file directly using dotnet run app.cs
I started using C# towards the end of the 1.0 beta or maybe just after RTM...I embarrassingly called it "C pound" for quite a while. Because, even as someone born and raised in the US, pretty much my only exposure to the symbol was in the context of phones. "Call me at blah, pound one-two-three" as in the extension is "#123".

Remember, it was originally release +20 years ago (goddamn, I feel old now); recorded video or even audio over the internet were much, much, MUCH rarer then, when "high-speed" speed internet for a lot of people meant a 56K modem.

Back then, most developer's first exposure to C# then was likely in either print form (books or maybe MSDN magazine).

hermitdev··on GCC 15.1
This is a vast, _vast_ over-simplification: The primary "feature" of HFT is providing liquidity to market.

HFT firms are (almost) always willing to buy or sell at or near the current market price. HFT firms basically race each other for trade volume from "retail" traders (and sometimes each other). HFTs make money off the spread - the difference between the bid & offer - typically only a cent. You don't make a lot of money on any individual trade (and some trades are losers), but you make money on doing a lot of volume. If done properly, it doesn't matter which direction the market moves for an HFT, they'll make money either way as long as there's sufficient trading volume to be had.

But honestly, if you want to learn about HFT, best do some actual research on it - I'm not a great source as I'm just the guy that keeps the stuff up and running; I'm not too involved in the business side of things. There's a lot of negative press about HFTs, some positive.

hermitdev··on GCC 15.1
> We can use UB to refer to both. :)

You can, but in the context of the standard, you'd be wrong to do so. Undefined behavior and unspecified behavior have specific, different, meanings in context of the C and C++ standards.

Conflate them at your own peril.

hermitdev··on GCC 15.1
> Would you rather have a HFT trade go correctly and a few nanoseconds slower or a few nanoseconds faster but with some edge case bugs related to variable initialisation ?

As someone who works in the HFT space: it depends. How frequently and how bad are the bad-trade cases? Some slop happens. We make trade decisions with hardware _without even seeing an entire packet coming in on the network_. Mistakes/bad trades happen. Sometimes it results in trades that don't go our way or missed opportunities.

Just as important as "can we do better?" is "should we do better?". Queue priority at the exchange matters. Shaving nanoseconds is how you get a competitive edge.

> I would posit is it things like network latency that would dominate.

Everything matters. Everything is measured.

edit to add: I'm not saying we write software that either has or relies upon unitialized values. I'm just saying in such a hypothetical, it's not a cut and dry "do the right thing (correct according to the language spec)" decision.

hermitdev··on I wrote to the address in the GPLv2 license notice (2022)
> I realize this all probably sounds very silly to someone born before 1980

I was born after 1980 and I think you're beating a dead horse, here. You're conflating accessibility with convenience. Not just with this comment, but others you've made in this thread.

> those goddamn BIC pens all go bad (ink dries up or something), before I use even 5% of one of them.

Grab the pen by the end opposite the nib, give it a good shake for a few seconds, lick the nib, scribble on a scrap piece of paper until it starts writing again. Problem solved. You can't resurrect a dead laptop or computer by licking and shaking it (at least I've never succeeded in doing so).

hermitdev··on How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2
Editting simcity saves was my introduction to hex editing...
hermitdev··on Detecting if an expression is constant in C
The problem is: it's infectious into the generated code, as well. Is that 3rd party or not? Yes, it was generated by a 3rd party tool, but from, ostensibly, _your_ protobuf file.

edit to add: and yes `-isystem` is absolutely a useful tool. If memory serves, though, it doesn't protect from macro or template expansions, though.

hermitdev··on Detecting if an expression is constant in C
> And I'd rather keep the library warning free instead of telling the users to switch warnings off.

Thank you! Separately, but related: fuck you, Google! (every time I have to deal with protobuf in C++, I curse Google and their "we don't give a shit about signed vs unsigned comparisons").

hermitdev··on Python’s new t-strings
Hey, at least Python is nowhere near Perl in terms of language creep. I don't need a Period Table of Operators [0] to keep Python straight in my head.

[0] https://www.ozonehouse.com/mark/periodic/

hermitdev··on Python’s new t-strings
> The reason it works is because Python functionally has no bool type. True and False are just integers with names.

This has not been true since around 2.4 or 2.5. The oldest Python I have available to me currently is 2.7, and this holds then, as it does now in 3.13:

    >>> type(True)
    <class 'bool'>
    >>> type(1)
    <class 'int'>
Prior to having a bool type, Python didn't even have True/False keywords.

The reason something silly like `4 + True` works is because the bool type implements `tp_as_number` [0]. The reason it works this way is intentional because it would been a Python 3 str-style debacle if ints and bools were not interchangeable.

[0] https://github.com/python/cpython/blob/main/Objects/boolobje...

hermitdev··on How much do you think it costs to make a pair of Nike shoes in Asia?
> Meanwhile there is another reason why the number of government workers has gone down:

Uh...excluding the very recent cuts this year under Trump; the number of civilians in the US Federal work force has gone up fairly steadily. [0]

We had 23.592 million civilian employees in Jan 2025. 21.779M in Jan 2021, after being largely stagnant overall the previous 10 years. That's a net change in excess of 1.8M employees under Biden.

I do find it interesting that it appears that employee count was flat, or even down under Obama, but until COVID, there was a steady increase under Trump v1.

[0] https://fred.stlouisfed.org/series/USGOVT

hermitdev··on Electron band structure in germanium, my ass (2001)
> because the simulator had a bug

I had something similar happen when I was taking microcomputers (a HW/SW codesign class at my school). We had hand-built (as in everything was wire wrapped) 68k computers we were using and could only download our code over a 1200-baud serial line. Needless to say, it was slow as hell, even for the day (early 2000s). So, we used a 68k emulator to do most of our development work and testing.

Late one night (it was seriously like 1 or 2 am), our prof happened by the lab as we were working and asked to see how it was going. I was project lead and had been keeping him apprised and was confident we were almost complete. After waiting the 20 minutes to download our code (it was seriously only a couple dozen kb of code), it immediately failed, yet we could show it worked on the simulator. We single-stepped through the code (the only "debugger" we had available was a toggle switch for the clock and an LED hex readout of the 16-bit data bus). I had spent enough time staring at the bus over the course of the semester that I'd gotten quite good at decoding the instructions in my head. I immediately saw that we were doing a word-compare (16-bit) instead of a long-compare (32-bit) on an address. The simulator treated all address compares are 32-bit, regardless of the actual instruction. The real hardware, of course, did not. It was a simple fix. Literally one-bit. Did it in-memory on the computer instead of going through the 20-minute download again. Everything magically worked. Professor was impressed, too.

hermitdev··on The features of Python's help() function
> Which is redundant for most functions as they only have positional parameters.

Huh? This is not true.

    def foo(a, b, c): ...
This can be invoked as either `foo(1, 2, 3)` or `foo(c=3, b=2, a=1)`:

    >>> def foo(a, b, c):
    ...     print(f"{a=}")
    ...     print(f"{b=}")
    ...     print(f"{c=}")
    ...
    >>> foo(1, 2, 3)
    a=1
    b=2
    c=3
    >>> foo(c=3, b=2, a=1)
    a=1
    b=2
    c=3
    >>>
hermitdev··on More thoughts on the 1670 modem's weird noises
A thought: maybe the pulse could be some sort of link status probing? e.g. "is this thing plugged in?"
hermitdev··on Show HN: Kreuzberg – Modern async Python library for document text extraction
Caveat: I have not looked at the neither the API nor the implementation of Kreuzberg, this is purely from personal work.

Even with CPU bound code in Python, there are valid reasons to be using async code. Recognizing that the code is CPU bound, it is possible to use thread and/or process pools to achieve a certain level of parallelism in Python. Threading won't buy you much in Python, until 3.13t, due to the GIL. Even with 3.12+ (with the GIL enabled), it's possible (but not trivial) to use threading with sub interpreters (that have their own, separate GIL). See PEP 734 [0].

I'm currently investigating the use of sub interpreters on a project at work where I'm now CPU bound. I already use multiprocessing & async elsewhere, but I am curious if PEP 734 is easier/faster/slower or even feasible for me. I haven't gotten as far as to actually run any code to compare (I need to refactor my code a bit with the idea of splitting the work up a bit differently to account for being CPU instead of just IO bound).

[0] https://peps.python.org/pep-0734/

hermitdev··on Fun facts about SQLite
It's not that they don't understand; it's that it causes more work for the lawyers, because someone has to review the license if it's not one of the standard boilerplate acceptable licenses.

I once had to go to lawyers to get a license approved on a lib that went something along the lines of "this work is in the public domain; do whatever the fuck you want with it, just don't come crawling to me for help". I'm paraphrasing from ~20-year-old memories here, but I do distinctly remember the profanity. It elicited a chuckle from the lawyer and something along the lines of "I wish all of these were this simple".

Page 1 of 34Next →