1. 1

    Does Python have anything built in to construct and resolve the dependency graph and order compilation accordingly? Since that’s the primary job of a build tool.

    1. 1

      The battery protection circuit is supposed to keep cells from discharging below 3 V/cell or so. I suspect this cell has been permanently damaged by its excursion down to 0.8 V and back.

      It’s probably not worth replacing the cell with a new one when the protection circuitry has already proven defective.

      1. 6

        Should you need to do this in real life, notice that Python sets have an isdisjoint() method.

        1. 5

          The important thing about SPI is that it is literally the simplest synchronous serial interface that could exist.

          If you sit down and invent a synchronous serial interface, you will independently invent SPI. This is especially true because SPI doesn’t even specify a single clock polarity or clocking edge, so whatever you invent will be a legit flavor of SPI.

          In any case, it is usually easier to just look at the timing diagrams in the datasheet, rather than thinking about it as a protocol to be implemented. In this way it differs from I2C.

          1. 4
            • Standards are such a Good Thing, everybody wants their own one. Yup, SPI is simple…. but as he notes there are a bunch of subtle differences in implementation from device to device. And only a very close reading of the data sheet will tell you what you’re dealing with. Sigh.
            • And that’s only half the story, with multiple devices on multiple busses… you have to closely read the schematic as well to see which devices are on which bus and how the chip selects work (eg. are they demuxed). And then you have to closely read the data sheet on the demux chip and/or CPU as to how to drive the gpio lines / chip selects.
            • And some devices are slow, some are fast and you quite likely will be trying to drive them all simultaneously , but only one device on a bus at a time….
            • As I say, “Hardware Engineering is exactly like Software Engineering… except all the basic primitives were invented by Satan.” Imagine creating a database API where you had to know in advance how many bits to clock in and out, and you had to read AND write exactly the same number of bits to the database ever time you wanted to talk to it. You can make it work, but all your users would hate you.

            That’s SPI for you. Simplest thing possible, sort of almost nearly standardised in a very loose sense, and everybody who tries to use it, hates it.

            Except the hardware guys, who shrug and say we can fix it in software….

            1. 2

              This article doesn’t discuss, perhaps assuming as background knowledge, the reason that defined file formats are useful: They allow multiple different independent programs to operate on the same data.

              For this reason, storing and associating the creator program (as MacOS does) has always seemed regressive to me. A file of well-defined type should have meaning independently of any particular program.

              1. 9

                That’s exactly what separating the creator from the type was meant to allow…

                The creator specified the icon and the default application that would open if you didn’t specify another one. But applications chose to accept files based on the type, not the creator, so you didn’t have to have a one to one mapping of types to applications.

                1. 1

                  There was a talk about this at a recent WWDC, talking about how this works in current macOS:

                  https://developer.apple.com/videos/play/tech-talks/10696

                2. 2

                  I find the “pixel art vs photo editing” argument kind of compelling that even an extension/magic-based system has limitations.

                1. 2

                  How does this compare with “Interactive Html BOM” (demo)?

                  I guess IHBOM is for documenting designs generally, but this is more oriented toward hobbyist documentation?

                  1. 2

                    IHBOM’s primary use is for people soldering their circuits. You get an order of 10s-100s of little bags from DigiKey or Mouser or whomever each with some small qty of components, and then have the challenge of trying to remember where on this pcb a 5n6 0402 inductor was meant to go - IHBOM makes that an absolute breeze and I use it all the time.

                    Pinion is more for documenting the physical/electrical interface of your PCB for others. API rather than build instructions, if you like.

                    1. 2

                      I think the target audience is different. Interactive BOM is designed for people who build the boards, while this is designed for people using the boards.

                    1. 4

                      I’m waiting for M1 Linux support to become boring, reliable technology. Then I will be replacing my work computers.

                      1. 15

                        OK, kidding aside… this would actually be an interesting legal theory to test. What if an algorithm could, given an input file, recreate most of the song by finding slices of public license music and creating a list of every single slice used? Better yet, use other copyrighted songs, creating it a nightmare for anyone trying to sue?

                        I’m sure it’s a solved problem - after all media producing companies have been some of the most aggressive pushers of copyright lawfare - but I wonder what the standing on a case like that would look like.

                        1. 5

                          Since in the USA case law is that sampling a single note is infringement, I doubt the legal theory would be as grey as with software.

                          1. 2

                            Wow, is that true? I’m completely ignorant on the laws around music copyright infringement.

                            1. 1

                              What about sampling a single sample? There are 65536 possible levels for each audio sample at CD quality there are more than 65536 songs out there. So any audio could be represented as a series of these samples with no change except attribution

                            2. 4

                              BTW, music these days is mostly made out of fragments of other songs. Check out Amen Break or sample breakdowns like this: https://youtu.be/5AqHSvR9bqs https://youtu.be/AXXUodk-pVo

                              1. 14

                                Dunno about “mostly”. There was a golden age of sampling in the late ‘80s (viz. “Paul’s Boutique” and most early Public Enemy / Bomb Squad stuff) but it was quashed when US copyright law started requiring licensing of any recognizable samples. Plus of course the origins of hip-hop lie in literally looping bits of records, but they could only get away it’s that in live performances.

                                The Amen break (and Funky Drummer, Apache, etc) got sliced up in the early 90s into individual drum hits, and then re-sequenced — that’s where jungle and other breakbeat styles came out of. At that point you can’t really say it’s fragments of songs, so much as a sample library like a piano plugin where the individual notes are samples but the composition is original.

                                1. 4

                                  It makes an interesting parallel to Copilot. It is essentially sampling code and re-sequencing it, and sometimes uses bigger, recognizable fragments.

                            1. 1

                              Although titled “all about”, this overview left me with some questions:

                              • How can I run the code samples?
                              • How can I see outputs of the simulation? How can I get the promised answers from the simulation?
                              • How are nonlinear systems modelled?
                              • What are the weaknesses of Modelica? When are other simulation approaches more appropriate? The article has a relentlessly promotional tone. How does it compare to other systems that I have used like Spice or VisSim or MathCAD?
                              • In the RC example, suppose I want to add another resistor in parallel with the existing one. It is not at all obvious how this would be accomplished in the example code. Would this require at additional model for an electrical junction that encodes KCL? Or is there some magic in the unexplained flow keyword?
                              1. 2

                                bah, floats. when I worked in embedded systems we didn’t have such luxuries! fractional values were represented by scaling integers and shifting left/right to save time. yer all so spoiled! ;P

                                1. 2

                                  Recently switched from a processor without a multiply instruction to ARM Cortex with a 32-bit floating point processor.

                                  One cycle multiplies! We’re all living in the future!

                                  Now I have to unlearn all the bitshifting and scaling tricks that I used for so long. They are actually slower.

                                  1. 1

                                    Now I have to unlearn all the bitshifting and scaling tricks that I used for so long. They are actually slower.

                                    I’m curious that you were still using them now. Compilers have been able to do more clever tricks than I can remember to apply uniformly for ages (this kind of local peephole replacement is one of the easiest things to automate) and generally has a better cost model for my CPU than I can keep in my head. What compiler were you using that couldn’t do these transforms and for what target?

                                    1. 3

                                      Compiler? Just msp430-gcc.

                                      Here are some examples.

                                      • Scaling. Without floating point, it is advantageous to scale to arbitrary units so that full scale is full scale of the processor’s register size. E.g., brads instead of degrees. https://en.wikipedia.org/wiki/Binary_scaling

                                      • Filtering. I wrote a script to choose FIR coefficients that have a maximum of one shift and one addition or subtraction. I had to implement the shifts and arithmetic manually; the compiler wanted to insert calls to its soft-multiply algorithms.

                                      • Trig. I wrote my own implementation of atan2() using bit shifts and addition. (standard CORDIC algorithm, https://github.com/markrages/cordic_polar.)

                                      There are other “Hacker’s Delight” tricks you can do. These are the ones I have used in earnest. All obviated by single cycle floating-point multiplies.

                                      1. 2

                                        Can’t speak for mark, but I wasn’t using a compiler, I was writing assembly (this was in the late 1990s) for disk drive controllers that needed to compute their control output in the order of microseconds. We’d need to do ridiculous low-level stuff like optimize away pipeline stalls. It was for a fairly boutique microprocessor so there wasn’t a ton of compiler support.

                                        I think they rewrote the servo controls in C shortly after I left because the cost/benefit of hand-rolling our own assembly code had finally shifted in the compiler’s favor.

                                        1. 1

                                          What compiler were you using that couldn’t do these transforms and for what target?

                                          I think he’s referring to implementing fixed-point arithmetic; shifting and scaling are required after some operations. Here’s a SO example with a brief introduction.

                                          1. 2

                                            Yeah exactly. So to represent, e.g., one-third, you could approximate it as 11/32. So to divide by 3 (i.e. multiply by one third), you’d actually multiply by 11, and do a right shift by 5 bits (dividing by 2^5). If you want rounding, you’d add 16 before shifting. Note here that the denominator needs to be a 2^n number for the shift to work.

                                            Why 11/32 and not something even more precise like 341/1024? Because the more precise you get, the bigger the numerator gets, and the more you are in danger of saturating your accumulator by making the result too big. So it’s a careful dance of maximizing the precision but taking care to not let the result get “too big” first.

                                            And AFAIK compilers can’t really optimize for that.

                                    1. 10

                                      Interesting that the discussion around this all sort of seems to assume that the maintainers are choosing not to fix bugs and therefore must be bad at running their projects.

                                      That’s probably true pretty often. But I think it’s also often true that open-source projects have a small, more-or-less-fixed time budget for maintenance that does not expand at the same rate as the growth of the user base, whereas the volume of bug reports does expand along with the user base. Over the years I’ve frequently been surprised to learn that some piece of software I use constantly was the product of one person working solo and it wasn’t even their day job.

                                      If I publish something I wrote in my spare time to scratch an itch, and it happens to get popular enough to generate more bug reports than I can handle in the few hours a week I’m able to spend on the thing, what are my options, other than quitting my job and working full-time on bug fixing? Do I delete the popular repo that people are finding useful enough to file lots of bug reports about, in the name of reducing the number of unhealthy projects in the world? Do I just let the bug list expand to infinity knowing I’ll never have time to clear the backlog? Do I spend my project time reviewing historical bug reports rather than working on the code?

                                      In theory, of course, a project that gets bug reports should have lots of people volunteering to fix the bugs. But the quantity and quality of community contributions seems to vary dramatically from one project to the next.

                                      1. 23

                                        It’s not about not fixing bugs. That’s expected, normal, fine. Maintainer does not owe me labour. Closing issues that aren’t fixed is just an FU to the users, though. Let the issue stay until someone fixes it, hopefully someone being affected by it.

                                        1. 7

                                          Exactly this. I was raised in a world where SFTW or RTFM was an acceptable response, and so put effort into providing good issues. Having a bot drive by and close/lock my still open issue is a slap in the face with a wet fish.

                                          1. 1

                                            SFTW

                                            I’ve never seen this acronym before? What does it mean?

                                            1. 1

                                              It was meant to be STFW, but I can’t type.

                                              1. 2

                                                Search The Fucking Web

                                                (I had still never seen this one and had to look it up … by searching the web)

                                                1. 3

                                                  Ironically this becomes more difficult as the GitHub bug pages show up first and are locked/closed due to being old.

                                        2. 8

                                          What’s the downside of letting the open bug list expand?

                                          1. 14

                                            Eh. Caveats first:

                                            1. I’m not a fan of simple auto-closing stale bots (roughly: I think the incentives are misaligned, and ~stale is a not-quite-right proxy of a few real problems, and it is trying to work around some limitations of using the GH issue system for triage)

                                            2. but I am a big fan of having a way to punt unactionable issues back to the reporter, and let automation close the issue if the reporter never responds or return it to the triage queue if they do

                                            That out of the way: in a busy long-term project, a stack of open bug reports comes with ongoing logistical overhead. GH’s UI/X exacerbates this, but some of it just comes with the territory.

                                            • This cost is an aggregate of: maintainer time spent managing the requests, the opportunity-cost of that time, the motivation it saps from the maintainers as they spend more time doing paperwork and less time making electrons dance, and the despair that comes from feeling obliged to play Sisyphus on an ever-growing mountain of reports (or the guilt that comes with having to ignore the reports).
                                            • Each person helping with bug triage will be paying a pretty similar cost unless you have tools/processes for de-duplicating logistical effort (unlikely for most volunteer efforts).
                                            • This cost is somewhat proportional to the amount of time each triager is able to invest. If you have 100 contributors doing 1 hour of triage a week, there’s going to be a lot more duplicate effort in the reports they read than if you have 2 people doing 50 hours of triage a week.
                                            • As the pile grows, efficiently pairing people with reports that are the best use of their time will get both harder and more important to your success.
                                            • At scale, the high-leverage maintainers most-likely to have the authority (whether literally the permission, or just the reputational capital) to go around closing reports manually will usually have more critical things to invest their time in. Those the task actually falls to aren’t as likely to be empowered to weed the garden.
                                            • Unless you’re willing to declare bug-bankruptcy or use automation (i.e., ideally #2 above–though obviously also a stale-bot), weeding out old dead-weight reports with the same care/consideration you’d usually run triage with can be (ironically?) a massive ongoing timesink in its own right.

                                            Reports don’t have to be bad or obsolete to contribute to this cost. 10 or 20 brilliant suggestions may be an asset if you can find time to implement 1 a year for the next 5 years. 1000 brilliant suggestions may be an albatross if the extra logistical overhead fritters away the time and motivation you need to implement one.

                                            It doesn’t, of course, apply to all reports equally. It’s better to have a single long-lived “darkmode pls” issue with gobs of comments and reactions than to deal with someone opening a new one every few days.

                                            1. 7

                                              Similar to not cleaning up your house. Increased cognitive load and ugliness.

                                              1. 8

                                                This. I am constantly surprised how many people dismiss the paralyzing effect of 2.4k open issues, even if they all make sense in some way. Resources are limited.

                                                1. 8

                                                  Wouldn’t auto-closing issues be like just hiding everything under the bed in this analogy?

                                                  This all looks like the consequence of bad tooling to me.

                                                  1. 1

                                                    Yes. The issue trackers we have need the following features.

                                                    1. accept issues
                                                    2. comments on issues
                                                    3. occasional attachments to issues (need? Maybe not)
                                                    4. assigning people to issues
                                                    5. lifecycles as makes sense for your team and organization (open, closed, or on the other extreme: open, ready, in work, in testing, merged, in production, closed)
                                                    6. tags on issues for classifications
                                                    7. filtering on reporter, tag, assignee, and status, including default filtering.

                                                    You do that, you fit 99% of people’s needs.

                                                    Imagine if github had a tag “maintainers will not address” and the automatic filter (currently set to only show issues where their lifecycle is at “open”) only showed “open & not(tag:will-not-address-but-might-merge)”

                                                    People would be happier to tune that automatic filter for their own needs, and this would allow a tag to banish the issue from a maintainer’s headspace.

                                                2. 5

                                                  Mostly that there will be a certain number of old bugs that get fixed or rendered irrelevant as a side effect of some other change, and searching through the bug database will become less useful if a sizable portion of the bug reports reflect an obsolete reality.

                                                  I’ve occasionally run into this on existing projects, in fact: I will search for some error message I’m seeing, find a bug report with some discussion that includes workarounds people used, and only after wasting time trying those workarounds and digging into why they’re not working for me do I discover that the bug they were talking about is in a part of the code that no longer even exists.

                                                  Of course, in those kinds of cases, issues being auto-closed by a stale bot wouldn’t have helped much; I’d have still found them and probably still tried the obsolete workarounds. I don’t have a perfect answer for this either!

                                                  1. 8

                                                    I haven’t heard a good case for a stale-bot. In the article it says “to reduce the number of open tickets”, but it doesn’t explain why that is a good thing – the number could be reduced to zero by not having a bug tracker at all!

                                                    Perhaps it is a UI thing, and Github should display the number of “active” open tickets, for some activity metric.

                                                    1. 4

                                                      I turned a stale bot on for a popular project because I thought it would be a more honest communication of the likely fate of old GitHub reports - “this is stale and we aren’t planning to triage or address it further”. Few others perceived it that way and, after a few months, the bot was removed.

                                                      The triage work is substantial - we spend easily 120 hours a week on community question/support/defect/feature-request triage. I’d love to do more but of course there are fixed dollars and hours to allocate across many priorities.

                                                      Anyway, that was my reasoning, which turned out to be incorrect.

                                              1. 19

                                                Automatically closing stale issues is a useful signal that the project follows the CADT development model. https://www.jwz.org/doc/cadt.html

                                                1. 12

                                                  That seems a bit harsh. People posting random non-issues can be a genuine issue for larger projects. People posting on long-since solved issues is also an issue, which tends to be >95% generic support or outright nonsense, and <5% useful.

                                                  I don’t care much for auto-close bots, but I understand why people use them. Managing all of this requires a significant amount of time.

                                                  I bet Angular had this exact problem; JavaScript tends to attract a lot of beginners and you’re forever cluttering the bug list with non-bugs unless you’re really diligent about maintaining this, and I can’t blame the maintainers on wanting to focus on actually maintaining the Angular project instead of guiding the endless stream of new users unfamiliar with Angular, JavaScript, etiquette, etc. It’s essentially the “Eternal September” problem.

                                                  1. 4

                                                    Can’t both of those issues be solved, well, closing the issues manually?

                                                    I’d assume long-since solved issues should be closed because solved. For “junk” issues, generic support and whatnot, is it really better to just let them sit open for a week or two (or however long the bot takes) rather than just manually marking them as “offtopic/support/wtfisgoingonhere” and closing them?

                                                    1. 11

                                                      I’d assume long-since solved issues should be closed because solved.

                                                      Yeah but people will comment on them. With this I meant the “lock bots” that lock issues after being closed for n days which prevents adding new comments.

                                                      As for manual closing/locking, sure, but that’s not “free” time-wise, and it can be emotionally draining. I don’t really want to tell people to ask their question somewhere else or that they’re making zero sense, but I also don’t necessarily want to provide mentoring to random newcomers as I got a life to lead and stuff to do. People can also get angry or even abusive about, no matter how nicely and gentle you phrase it (I’ve had that even with random strangers emailing me out of the blue because they saw me on Lobsters, Stack Overflow, GitHub, or wherever). It’s not super-common, but it sucks when it happens.

                                                      A bot just makes all of this easier and avoids the emotional drain. Is it the “chicken way out”? I suppose it is, like I said I don’t use it myself and generally just manually lock old issues and such if they attract a lot of comments, but I also never maintained a project the size of Angular, and I can see the reasons why people would use it.

                                                      I think the “emotional cost” of maintaining larger open source projects is often underestimated. Everyone is different and some people struggle with this more than others, but personally I find it hard. I want to be helpful, but that’s just not feasible or realistic beyond a certain scale so there’s some amount of (internal) tension there. It also leads to situations where you feel obligated to do things that you don’t really want to do, and this is how maintainers burn out.

                                                      In Bristol there are many homeless people asking you for money; walking to the city centre or Tesco’s (~2km) can easily mean you’ll be asked 3 or 4 times. Sitting out on the harbourside for dinner or a drink will net you about one homeless person every 30 mins or so on average. Before I lived there I never hesitated to give some change if I had any, because these kind of things are a fairly rare event in Eindhoven. But if you’re asked multiple times every day it just becomes unrealistic. I found it difficult, because I don’t want to say “no”, but I also can’t say “yes” all the time. One of the many reasons I was happy to leave that place.

                                                  2. 2

                                                    I’m curious, which projects do you maintain?

                                                    1. 1

                                                      I see this is the ops world too. Not just devs.

                                                    1. 7

                                                      Suggest only the plt tag, since tags are filtered via intersection and not union. :)

                                                      1. 12

                                                        Tags should be partially ordered in a lattice, with “sub-tags” being substitutable for any “super-tags” higher up in the lattice.

                                                        1. 4

                                                          If we’re brainstorming, I’d suggest not ordering them initially and instead allowing people to use a blang to query them.

                                                          1. 2

                                                            I see what you did there.

                                                          1. 7

                                                            Julia Evans https://jvns.ca has a cheerful and curious tone that is always fun to read.

                                                            1. 3

                                                              Are ARM-based MacBooks not little-endian?

                                                              1. 2

                                                                You should have no expectations that the maintainer will use your patch as-is. If they are taking maintainership seriously, they will do any adjustments they find necessary to integrate your patch into the project’s coding style and conventions.

                                                                I will confess I have sometimes submitted “Cunningham’s Law” patches, which solve my issue in an obviously ugly and hacky way, It gets my issue taken care of faster than just a bare bug report, and I don’t have to learn all the conventions and interactions of the project.

                                                                1. 9

                                                                  Backwards consistency with a broken model.

                                                                  I encountered similar in 2003: https://lists.mysql.com/mysql/141961

                                                                  I stopped using MySQL shortly thereafter. I suppose everyone who cares about integrity has done the same.

                                                                  1. 10

                                                                    I truly enjoyed this. And would recommend bookmarking the author’s https://verylegit.link/ for your next april fools CSO trolling.

                                                                    1. 1

                                                                      Wow, I love this.

                                                                        1. 1

                                                                          Your link actually leads to a 404 but if I copy/paste it on desktop it works.

                                                                          1. 1

                                                                            Maybe I’ve screwed my markdown, will try to fix, thanks.

                                                                      1. 1

                                                                        http://www.shadyurl.com/ is shadier because the links use a shadier domain name.