1,356 karma · joined Jun 19, 2017 (9y ago) · 591 submissions
comment 3y ago · link · parent
Plus the powerful elite tapped into the discontent that they'd created in order to further their own power, then crushed the useful idiots who rebelled against the oppression and doubled down with more oppression.
comment 3y ago · link · parent
A capacitor resists change in voltage. Where a switch's change on the oscilloscope usually looks like a steep cliff, adding a capacitor will introduce a curve as the voltage drops. The size of the curve depends on both the capacitance _and_ the resistance between ground and the capacitor: simply adding a capacitor won't give you much of a curve because there'll be very little resistance. You also need to add a resistor to make an RC network.
To handle the worst of switches you want an RC value somewhere around 10ms. What you choose for R and C depends on any other constraints you might have, like power consumption or capacitor size.
Because the RC network slows the transition time a lot you need a Schmitt trigger to convert the slowly curving voltage change into a nice sharp input signal change without allowing noise to ruin everything.
There are other ways to deal with bounces in hardware, too: you can convert the switch's on/off signal into a pulse using a monostable circuit (eg, a 555), you can use a dedicated debounce IC, you can use a flip flop with a SPDT switch, you could blow $50 on a Hall effect switch and use an ADC.
Or you can deal with it in software, which is popular because it's typically easier to find space in a ROM than it is to find space for discrete components on a PCB.
comment 3y ago · link · parent
It's been a very long time since computers were anything other than binary, and unless quantum computing takes a, haha, quantum leap forward it will be a very long time yet until they're doing anything else.
But they can handle converting to and from this numeral system for the few humans who find it more natural to work with just fine.
comment 3y ago · link · parent
Jabber was born in 1998, in a world where there was a handful of centralised desktop instant messaging apps that didn't interoperate at all - ICQ and AIM dominated, but there were plenty of others around too. Most of us ran multiple apps at once, or tried to get clients that could connect to multiple services, but this was complicated by proprietary and frequently changing protocols.
A decentralised, federated, and open protocol that let users connect to all other users was a great idea… for users. But it didn't do anything for the behemoths rapidly gaining users in their proprietary centralised systems, and it didn't do anything for ISPs who'd just have to run, and support, another service. Early clients and servers weren't as straightforward as downloading a desktop program from Tucows and running it, and in the space of technically savvy people running a system built on open standards there was already a well established (and heavily fractured!) IRC.
XMPP's standardisation in the IETF didn't really help it. While the IETF isn't quite as slow as more traditional standards bodies it's definitely nowhere near as fast as centralised companies with only one client implementation to care about. As the war for eyeballs heated up, instant messaging apps rapidly added features like sharing images (crazy! over _dial-up_?) or emojis (before they were called emojis!) and XMPP simply did not keep up.
Nevertheless, XMPP was the basis of iChat (or at least, some versions of it) until iChat was killed in 2011, and the basis of Google Talk until that was killed in 2013. It wasn't too uncommon for corporate internal chat platforms to be using XMPP in one form or another - Cisco still have a product today called Cisco Jabber. But the main thing all of these systems had in common was they absolutely sucked at federating with each other. Theoretically Google Talk supported it, but your corporate system probably didn't. iChat notionally might've but as far as I recall it had so many proprietary extensions and missing standard features that it just wasn't feasible to federate. XMPP did pretty well for a stretch being the underlying protocol for a bunch of proprietary, centralised, and siloed chat systems.
In the end mobile phones killed instant messaging platforms. In the 90s most of us didn't have phones, but at the start of the century that rapidly changed and suddenly we all had the same instant messaging platform right in our hands: SMS. Sure, it was never built for heavy use, and mobile companies often charged per message (50c per text in Australia in the early 2000s), but it was _there_ and everyone was on it, and in just a few years desktop instant messaging died off. XMPP never had a chance.
Smartphones, of course, re-introduced the hot mess of a dozen competing instant messaging platforms with different parts of your social network on different ones, all centralised, all proprietary.
comment 3y ago · link · parent
It's dead in the current call stack, but over time programs change and that is how errors creep in. If it's a precondition that _baz_ is in a particular range for the function to behave, why not check that in an assert and save yourself or a future programmer a ton of stress trying to work out why some unrelated part of the code blew up when they made what seemed like a simple change nine layers up the call stack?
There's no runtime cost to an assert in production code, but it makes your intent clear to both the compiler and other humans.
comment 3y ago · link · parent
If "???" is just "foo = INT_MIN;" clang will optimise it all down to a single addition (see https://godbolt.org/z/K1ee8h3TM). If it's always "foo = INT_MIN;" across all of your code you can just use "-fwrapv" to override the C standard and define signed addition as two's complement wrapping.
GCC will ignore the possibility of overflow in signed addition if you don't do anything special (e.g. https://godbolt.org/z/Pc76c5E9z).
You can use "-ftrapv" (or "-fsanitize-undefined-trap-on-error -fsanitize=signed-integer-overflow") to make bigger, slower, safer code that fails fast on unexpected overflows across the board.
You can do the rather unergonomic "__builtin_add_overflow(bar, 1, &foo);" to tell the (GCC or clang, at least) compiler "???" is two's complement wrapping. You can do the cheeky, non-portable, but predictable on the same compiler and platform "int foo = bar + 1L;" to do the same thing. Combine these with "-ftrapv" and you'll get code that short-circuit blows up for unchecked unsigned overflow with the opportunity to produce faster code where you either are damn sure it can't overflow or where you want two's complement wrapping on overflow.
If it's not in a tight inner loop avoiding a check is premature optimisation - if you're consuming I/O and doing lightweight processing on it, an overflow flag test on signed additions will not make a measurable performance difference, nor will it blow out your binary size unreasonably.
IMO it's not a red herring to have signed integer overflow flagged as a potential error. The error is the failure to have an answer for "???".
comment 3y ago · link · parent
I have noticed the same thing when trying to use junior devs to generate some code, usually correlating with how old the most popular Stack Overflow question on the subject is.
comment 3y ago · link · parent
A Z80 routine can call outside of its 16-bit address space with 'CALL.IL'. This pushes the 16-bit return address onto the 16-bit stack, switches to 24-bit mode, and pushes the magic 'return to 16-bit mode' number to the 24-bit stack. However, it's not clear from the manuals or datasheets what happens if you use the prefixed 'CALL.IL' opcode sequence when the 'MADL' bit is reset.
I asked ChatGPT, because this is something that Google searching hasn't yielded answers for. It had this to say:
"The MADL bit (short for Memory Access During Interrupts Low) is a flag in the Interrupt Control Register that determines whether or not interrupt service routines (ISRs) can access low memory (addresses 0000h-3FFFh) during interrupts."
Plus some more stuff building on that, on CALL.IL being about ISRs, and about low memory. All of it is completely, fundamentally wrong. I did a handful of rounds of trying to steer it to a more correct answer but it continued to get additional basic facts wrong and would lean back to earlier incorrect facts as others conflicted with its answers.
I asked it another question I have, this time about the UART on the CPU. There is a Receive Buffer Register (UARTx_RBR) that contains the head of the receive FIFO. The documentation does not make it clear what is in the RBR if the FIFO is empty, so I asked ChatGPT. It told me a very plausible answer, the one I suspect myself, which is that it'll keep returning the same value until new data is available. But then it went on to tell me this is called receiver overrun, and described how an overrun occurs, including noting that it happens when the FIFO is full. And we went round in circles on this for a little while.
ChatGPT is a major step forwards in our post-truth existence: its answers are an amalgam of the most frequently repeated views on a topic, not those with stronger reasoning or more effective evidence to support. If there is little or no source data on a topic (as would be the case with my very specific questions on a rarely used processor) LLMs are (presently?) unable to detect that they are responding to a topic with limited contextual information and tailor their responses accordingly, and instead confidently provide utter nonsense.
I trust ChatGPT to do things that LLMs are good at, though: if I give it some bullet points and some style guidance it can give me written paragraphs. If I ask it to rephrase a well known song in the style of some modern artist I'll get something back that's pretty plausible. It can give me some starting points for learning more about some well known topic, even.
I would definitely not trust it _at all_ to give me something factual like part numbers of uncommon ICs, because LLMs cannot distinguish between fact and fiction, not in what they ingest, and not in what they produce.
comment 3y ago · link · parent
The same set of languages definitely will not have survived for 60,000 years. Tribes come and go, merge and split. Outside influences bring in new words and grammatical structures. Oral tradition is a low fidelity carrier of language and culture, and easily accommodates change in language.
comment 3y ago · link · parent
You wouldn't want to waste characters on commenting code: machines of that era would have only a few KB of RAM, as low as 1K. For the same reason you don't want to waste characters on long, meaningful variable names or on well spaced code. Multiple statements per line isn't to save print space, it's to save RAM.
Meanwhile, the program's pretty well structured for such a short bit of BASIC: subroutines start at multiples of 100, for example, and each subroutine starts and ends clearly, no shenanigans like jumping from the middle of one sub to another, no multiple exit points for subs, all as linear as it can be. The use of IF is limited to skipping forward a short way to conditionally execute a line or two only. GOTO only exists in those IF statements.
I'd have been happy to have written code like this, back then.
I am pretty sure that my uncle ran this exact program on his computer and printed out biorhythms on listing paper, in the mid 80s.
comment 3y ago · link · parent
- It's not an event sourced system, it's a relational system with an absolutely terrible audit log. - The audit log is (was?) serialised and blocking for every transaction, okay for low volume and low latency transactions. - 30 minute transactions!? That is NOT low latency. That needs engineering to manage contention. - The last updated event information is updated in a transaction and definitionally is always the most recent event… what's it actually for? - The solution is exactly equivalent to a boolean "is_applied" column on the event table… and is still always set "true" inside a transaction.
> That sounds like a recipe for disaster when your replay code and update code are not actually in sync?
It reads like their replay code is their update code, but they have absolutely no confidence that their event history is complete and consistent ("A lot of things can go wrong with a large history, foreign keys, exceptions, serialization mismatches, events out of order etc.") so it's unlikely they'll ever risk replaying events.
The bit that I think has the most interest to consider, though, is the granularity of events. The article refers to database transactions as a monoid, which is to be expected since the application's architecture is built around database transactions and not events, but events can also be treated as a monoid. Making events extremely low level (eg, https://vvvvalvalval.github.io/posts/2018-11-12-datomic-even...) provides a ton of flexibility but absolutely needs the higher level semantic information to be explicitly written as well, else a significant portion of the value of event sourcing is lost. Simply recording a transaction ID (as the github account linked to the article does) won't help much as business requirements change over time, exact dates of changes become fuzzy and forgotten, and inferred meanings drift. Event sourcing works best when it's complete and explicit.
comment 3y ago · link · parent
Effectively, however, python2 and python3 are different languages. Since they're interpreted, there's now a problem with '#!/usr/bin/env python' in your script: which python version is being invoked? Which language version are modules targeting? It's a mess.
But the poster child for screwing up a language version upgrade is still Perl.
comment 3y ago · link · parent
It's not practical to do that sort of thing alone, as there's a lot of tedious nonsense involved. Maybe it will be more practical with an AI assistant.
Whether current AIs are more or less somewhat close to the basics of how humans might be approaching code writing is more of a philosophical point, but a "translation room" view of the human mind might on occasion make me feel like I'm just working off patterns from my data sets. :-)
comment 3y ago · link · parent
But I agree with your sentiment: to get AI to write the code you want, you will need an engineer to work with it.
I do expect that future AI code generation models will learn more about a specific code base over time, partially overcoming domain specific knowledge gaps.
comment 3y ago · link · parent
comment 3y ago · link · parent
But more on point, this article's context is static ram on-die for a microcontroller or similar. One possible replacement for SRAM is magneto-resistive RAM (MRAM) - it's not quite as fast as SRAM but close enough for many applications, it's higher density than SRAM, so it'll take up less die space, and it's non-volatile so µCs can ditch the NOR flash often used for code storage.
One great thing about MRAM is that it has no write wearing: it has an effectively unlimited lifespan, without all the downsides of magnetic tape. I look forward to seeing it (or similar technologies) in microcontrollers in the future.
comment 3y ago · link · parent
... which perhaps just shifts the question to "why do you need multiple independent teams and not just use a monolithic development team?"
comment 4y ago · link · parent
As for whether Copilot's morally wrong or not - I don't think copyright as a concept makes any sense at the level of the trivial, where Copilot _should_ be acting. If Copilot regularly reproduces sizeable portions of code from a single origin _without_ careful and deliberate guidance, I'd agree that there's a problem here. As I understand it though, that's not happening.
By its very nature of being published, code from OSS is funnelled into proprietary codebases by humans performing a similar task to Copilot - reading available code and using that to evolve an understanding of how to produce software. I like to think we do it at a deeper level than Copilot, but the general effect is the same: the code I write, like the words I write, are heavily influenced by all the code I've read over the years.
If I wind up using a few words from your comment, down the line, because some turn of phrase you used struck me as a good way to say something, do you think I've morally wronged you?
comment 4y ago · link · parent
Why do you want to release code on GitHub with an oppressive license? What's the motivation for you, and what's the benefit for anyone else in it being released?
The size of code fragments being generated with these AI tools is, as far as I can tell, extremely small. Do you think you could even notice if your own implementation of sqrt, comments and all, wound up in Excel?
comment 4y ago · link · parent
comment 4y ago · link · parent
It'd be a pretty huge waste of processor design space to do that, though: if an HLL wants to support n-based arrays for n != 0 it can just store the base pointer with the initial index offset already applied.
Early 8-bit processors had a pretty poor set of addressing modes: you couldn't even expect [R1 + R2] let alone [R1 + R2 * scale + displacement], so random access into an array would be a multi-instruction task. By the time of the 80386 base scaled index addressing with displacement was in the CPU core, but it's not _free_ - there's an additional byte in the instruction encoding for the displacement, so even if the CPU computes the displacement with no additional clock cycles you'll have a latency cost for fetching the byte.
comment 4y ago · link · parent
Using something like ADRs[0] can help provide the structure the team can look for when it comes to "why" documentation. I recommend a standardised README across projects. If it's "what" comments look for language tooling that will execute documented examples as test cases. If it's "how" then make sure there's value in it - do you have disaster recovery exercises, does your incident response team use your "how" documentation to triage issues, do stakeholders outside your development team get consulted on contextual changes in your application, etc.
[0]: https://brunoscheufler.com/blog/2020-07-04-documenting-desig...