Better HN
topnewbestaskshowjobs
Log inSign up

codebje

1,356 karma · joined Jun 19, 2017 (9y ago) · 591 submissions

Submissions

comment 6y ago · link · parent

Unless it's a dead project, failing to perform maintenance will add to the cost of change, ultimately quite sharply.

comment 6y ago · link · parent

There's a good series of articles on the restoration and maintenance of a pinball machine, which has many of the same characteristics as video games, plus a few more mechanical issues.

https://blondihacks.com/johnny/

comment 6y ago · link · parent

Phytoplankton are also responsible for 50-80% of atmospheric oxygen, so in the parent poster's scenario I think the loss of a breathable atmosphere is the most likely nail in our species' coffin.

Probably won't happen, probably not a great idea to push things to see how far we can let things go before it's catastrophic, though.

comment 6y ago · link · parent

It does if you want research done so compilers can implement results in this space and optimise away unnecessary copies without introducing errors.

comment 6y ago · link · parent

The second notion, where it's clear that the memory space can safely be used, is why there's interest in linear and affine type systems. These systems describe types whose value can only be read one time, and for linear types, which must be read one time.

On the surface that can seem a bit stupid, but the practical outcome is that compilers can determine when an array's contents can be mutated in place rather than overwritten.

A variable you read over and over can be thought of theoretically as one you duplicate, then read one copy of. Since the act of reading the copy destroys it, a compiler implements this by merely reading the value directly.

Passing an array into a subroutine however means the compiler either copies it, or forbids further access after passing it in. If it's the latter, the memory space is available for re-use inside the subroutine.

Rust uses affine type theory for its borrow system to provide memory safety. Function language research is looking at linear and affine types for a variety of applications including performance.

comment 6y ago · link · parent

Get an STM32 "pill" board, platform.io in VSCode or any way you like to write C using CubeMX to generate a project structure, then Make to build and flash.

STM HAL isn't exactly great either, but Arduino is best placed IMO as entry level novice stuff, or blasting out something working in five minutes.

comment 6y ago · link · parent

I picked this up for Switch out of nostalgia. Plays well on that platform. Well, the game does, I'm still terrible at it.

comment 6y ago · link · parent

It happened long ago. We had a decentralised Internet, with end-to-end communications the norm. Money is more easily made with centralised control of users, though, so money is more readily spent on centralisation of services.

Ultimately, Discord/Slack/Whatnot succeeded over Jabber because far more money was put into services that can be commercialised than was put into something that's very hard to make a buck out of.

The run-out of IPv4 has massively exacerbated the problem, because with carrier grade NATs now the norm, protocols have to work via a central server to connect two end users. There won't _be_ a new decentralised killer app.

Well, if social unrest gets really bad across the globe we might see something like mesh networking with a mesh social media system spring up, I suppose.

comment 6y ago · link · parent

The buffer you're thinking of is a packet-level queue to allow mismatches between physical transmission rates and processing rates, and is separate from the protocol.

The buffer the original comment is talking about is likely the TCP receive buffer, which is used both to allow the application layer to process bytes at its leisure rather than as they arrive, and to allow out-of-order data to be reassembled correctly rather than retransmitted in-order every time.

The receive buffer is documented at the protocol level. Well, honestly I don't recall if the buffer is ever documented in the spec or just common implementation practice. There is a documented "receive window" though, which is how many bytes the receiver is comfortable having "in flight" - sent but not acknowledged. The existence of this window implies the existence of a buffer at least as large as that window on the receiver.

comment 6y ago · link · parent

Your event log should IMO be nominally immutable rather than actually immutable.

You should feel free to take actions such as expunging private or sensitive data as appropriate. Keep the events, but rewrite them to contain only the desired data. Trivial to implement, and simple.

I'd only worry about stuff like crypto-erasure if you physically cannot alter the past, such as if you have a requirement for non-repudiation or some such. Doing it just for technical purity isn't worth the cost :-)

comment 6y ago · link · parent

That's a distributed systems problem, rather than an event sourcing one. I'm sure we've all done something like comment on a site like HN and not seen our comment appear when we reload. The more distributed the system, the more likely it is we're hitting a stale cache somewhere.

Even the most absurdly reduced system running on a single machine, taking an HTTP request in and processing it fully to completion in all aspects before returning any response, is a distributed system - the browser is at the other end, running asynchronously. The user may tell the browser to reload before the single server has finished processing. When do both the user and the server agree that the account has been created?

To "fix" the problem with event sourcing, just don't add distributed components if you don't need them. Synchronise your "on event" action handlers with your event creation, and don't return success to the command until the handlers have completed.

You can even choose to wrap it all in a transaction so the event doesn't write unless the handlers all succeed, side-stepping the problem of desynchronised views due to handler bugs.

You still keep the (IMO) main benefit of event sourcing: you can define new views you didn't have to foresee and build them from the complete history of the system as if you'd known about them from the start.

comment 6y ago · link · parent

When using FreeRTOS tasks, any use of printf() requires a substantially larger stack allocation per task. But I don't recall now any massive blow-out in binary size.

comment 6y ago · link · parent

There's a pretty vast difference between an N64 being less widely useful because it's hard to source an RCA display (hint: you can buy an RCA to HDMI adaptor cheaply) and N64s including a remote "kill switch" that one day gets flipped, destroying all N64s immediately.

Disney has sabotaged people's property by using (allowing a third party to use) a kill switch, and that shouldn't be acceptable.

If a washing machine called home and checked that it's okay to run each time it was connected to power anew, and one day all of a particular model of washing machine was remotely told to stop working, I'm sure that would make the news.

comment 7y ago · link · parent

MCTS is a random algorithm, and AlphaGo is no exception.

The AI selects a move. What state is the board in now? It doesn't know, because the opponent also selected a move.

MCTS models this with a probability distribution of the states, and samples from this distribution repeatedly to build an estimate of the effectiveness of each move it could make.

But what's the probability of each move made by the opponent? And after the simulation has looked as many moves ahead as it can in the time constraints, how good a position is it in?

These are the same question, really - what's the chance of winning from this board state. In Chess you can use a heuristic algorithm to figure it out. In Go, you can't. But you can use a neural network to learn an approximation that improves as it sees more games complete.

AlphaGo does this. MCTS is a random sampling technique, and the neural net informs its probability distributions, but doesn't make it deterministic.

comment 7y ago · link · parent

NAT is an acronym for "Network Address Translation" so that's the right term to use.

NAT approaches to bridge IPv6 and IPv4 exist and work as well as IPv4-to-IPv4 NATs, that is to say pretty poorly: but we've long since adjusted the architecture of Internet-enabled software to cope with the flaws, so practically speaking they work just fine.

We've been down a road for a while now of funnelling all of the Internet's services into something-over-HTTP, so running a server might need a public IPv4 address, but as the supplies already assigned to LIRs by the RIPE NCC (and other RIRs) start to dwindle I expect we'll see more services offered whereby you can share an HTTP front end with a bunch of other people, proxied to an IPv6 (or private space) server you run.

comment 7y ago · link · parent

> I don't know. The level of complexity this introduces seems to be way higher than anything in the original article.

HTTP isn't synchronous, we just often pretend it is. You can pretend messages are synchronous using exactly the same semantics and get exactly the same terrible failure modes when requests or responses are lost or delayed.

comment 7y ago · link · parent

Much of software design is about composition, which is where category theory shines, just at the most shallow levels.

If I dream up a way to tackle a problem, have I made a category? If I have two modules, can I compose them into one, is there an initial or final module, is composition associative? If there's some underlying structure, what's the free module based on it?

Those questions can help make more durable designs.

comment 7y ago · link · parent

You don't even need an email account to sign up, but I certainly understand a reflexive rejection of unnecessary sign-ups.

comment 7y ago · link · parent

Check out Lean Prover's online editor: https://leanprover.github.io/live/latest/

They borrow syntax from LaTeX math-mode to allow symbol entry, such that you can type "\ne" and as soon as you hit the space after the "e", you get ≠ instead.

The language plugin for Visual Studio Code does the same thing.

Lean Prover's not exactly a programming language, but :

    def foo (a b : ℕ) : ℕ → ℕ → ℕ :=
        λ a b, a + b
Still looks decent.

I think it has to be all or nothing though, since if it's optional the odds of getting decent editor support for it is low.

comment 7y ago · link · parent

GHC is fairly slow for a compiler, and Haskell has no separation of interface and implementation, so small changes can have big consequences.

Template Haskell is the worst for it, but I did have a code generator produce code that took about 25G of memory to compile recently, which was very, very slow on a 16Gb machine ;)

comment 7y ago · link · parent

Haskell's type system works best for me in allowing fearless changes, even significant ones to the core of a code base. The compiler won't let me overlook something.

A comprehensive test suite would achieve the same thing, but I'm rarely confident that my test suites are truly comprehensive.

comment 7y ago · link · parent

Whois++ largely failed. Custodians of resources weren't great at keeping their services operational. Hence Whois remains the primary access protocol today.

RDAP has more legs to replace Whois than Whois++ did, but it solves a different set of problems: redirection, internationalisation, parseability, and consistency.

(I am an author of an RDAP draft, so probably biased.)

comment 7y ago · link · parent

You can't naively store 2^63 indices, else you'll get exponential run time to insert or lookup.

Using a random access memory structure like a binary tree gives you logarithmic run time, but for a 64-bit index and 64-bit pointers will cost you 3x the space, so now your index is larger than your source data.

And since you probably don't have random access memory, but instead have random block access, you'll need to use something like a b-tree to avoid getting destroyed by seek times, and this has a further space overhead - you're now more like 6-8 times larger than the source data.

You may as well merge sort the 64-bit source data (indices) at O(nlogn) time and constant space costs.

comment 7y ago · link · parent

I found the article a bit obtuse, but I take it to mean we are drawing a uniform sample from a very large set. This means we don't need a shuffled sample, we just need one with a uniform chance of each source element being in the sample.

Duplication in the context of the article appears to refer to tweet identity rather than content, so taking a stream of all existing tweets and selecting a uniformly sampled subset of them is certainly possible without storing the list of sampled tweets.

The algorithm referred to has an additional constrain of sequential access only. If you have random access there are simpler approaches to take. If you have an unbounded input stream you just filter using a prng for a uniformly distributed sample.

The article only applies to enormous and sequentially accessed data sources, which is why the algorithm died with tape drives: it's not actually a common problem any more.

comment 7y ago · link · parent

The beautiful part of IoT is how there's billions of devices out in the wild with no upgrade plan.

The ESP chips are OTA capable with example code provided, but that still means vendors have to incorporate the function, provide a way for the device to check for updates, care enough to produce updates, and secure the upgrade mechanism enough that it's not a worse vulnerability than an unpatched device.

comment 7y ago · link · parent

Looks like it was a question about where to report it, followed by a handful of suggestions and _then_ the close. I don't see any reason for bad blood from that, especially since there was a bit of follow-on discussion and by the look of it, a fix was released a couple of weeks back.

comment 7y ago · link · parent

L1 cache lines are typically 64 bytes long, and you're only reading 16 bytes of it per level of the tree. And a random pointer tree traversal is the worst case for CPU branch prediction, too.

There are methods for optimising the use of various tiers of cache, trying to pack multiple nodes into one 64 byte line, arranging nodes such that left and right children are usually adjacent in memory so prediction losses are minimised, and other tricks.

comment 7y ago · link · parent

A bare atmega328p-pu is 10x the price. LEDs are about 15x. Resistors and caps are, as another poster said, huge, but you're possibly getting factory seconds from an already mediocre brand. I buy decoupling ceramics and 5% resistors from China for peanuts but stick to RS online for caps where I depend on characteristics or reliability.

China sells a lot of older stock via AliX, so newer chips are hard to find and might be near the same price, but older clonable classics like a 2n7k are dirt cheap and just as good.

1
1617181920