Better HN
topnewbestaskshowjobs
Log inSign up

devit

4,235 karma · joined Sep 10, 2015 (11y ago) · 1,525 submissions

Submissions

comment 5y ago · link · parent

Why would you not cut off buses and taxis?

They are professional drivers, so you can rely on them being better than the average drivers in difficult situations like having to brake suddenly, so I think you should cut them off preferentially.

comment 5y ago · link · parent

Because this is the most general signature possible (in general syscalls can have up to 6 arguments because the kernel supports x86-32 which has only 8 general purpose registers of which one stores the syscall number, one the stack pointer which cannot be reused due to signals in case of no sigaltstack, and the remaining 6 are available).

Depending on option, the args can be pointers to structure.

comment 5y ago · link · parent

If users using weak/reused passwords is your problem, just don't let users choose a password (generate it for them), or don't use passwords at all (send link by e-mail that adds a cookie), or use oauth login.

comment 5y ago · link · parent

Well, you can have the competitors play naked in a physically isolated and sound/vibration/light/radiation insulated faraday cage, with a metal detector and whole-body MRI scan applied upon entrance, competing through a computer system with fixed clock time for each action that only reveals the action once the clock expires.

I think that would make it pretty much impossible to cheat assuming the tournament organizers don't collude with players.

While the described setup is expensive, just playing naked with a metal detector check in a physically isolated place through the described computer system is probably enough and reasonably cheap.

comment 5y ago · link · parent

The first link has this text: "Today, we’re sharing the latest activity we’ve observed from the Russian nation-state actor Nobelium. This is the same actor behind the cyberattacks targeting SolarWinds customers in 2020 and which the U.S. government and others have identified as being part of Russia’s foreign intelligence service known as the SVR."

comment 5y ago · link · parent

Generally there is no need to actually run the program frequently, so you just code for an hour or more and then run the result.

Since Rust has an actual type system, decent programmers usually produce code that works correctly the first time it successfully compiles, so running and testing it is not so important.

If you still need to run many code snippets frequently, create a command line tool with an option parser (e.g. clap in Rust), and create a subcommand for each "code snippet" and you can then invoke them from the command line along with whatever options you need.

You can also use debuggers or add eprintln! calls in existing codebases.

If you are just learning the language and want to test simple examples you can also use online playgrounds like https://play.rust-lang.org

comment 5y ago · link · parent

Does that proposal allow to express anything that can be expressed in Rust?

That seems quite unlikely given the lack of syntax for lifetimes. It's still in theory possible to infer them, but that would result in API instability and hard to decipher error messages.

Can you for instance have a function that given a reference to an hash table and a reference to a key returns a reference to the value corresponding to a key equal to the given one? (this requires the return value lifetime to be the same as the hash table lifetime, while the search key lifetime is unrelated)

Can you refactor code that takes multiple parameters by reference to taking by value a single structure including those parameters as fields with independent lifetimes?

comment 5y ago · link · parent

It seems to be a syntax mismash between Rust, which uses `let` and `let mut`, and JavaScript, which uses `const` and `var`, giving WGSL's `let` and `var`, probably chosen because they are the shortest.

comment 5y ago · link · parent

There are systems like the PS3 SPEs and DSPs where you only have normal access to local on-chip memory and have to explicitly initiate DMA to access external memory.

But that's just bad for running general purpose software that can require more memory than available locally since it means you have to do memory cache management in software which is going to be much slower than letting the hardware do it.

comment 5y ago · link · parent

No, Ada has no lifetimes and borrow checking and thus cannot possibly offer the same expressiveness as Rust while supporting safe memory deallocation without garbage collection.

comment 5y ago · link · parent

These languages, when used without garbage collection and with dynamic memory allocation, are not memory safe.

Gaining memory safety at no cost is the whole point of rewriting in Rust, since it dramatically changes the behavior of the resulting program (it no longer has memory-related bugs and vulnerabilities).

The other languages might have slight benefits over C, but they either also have drawbacks (with makes them unsuitable) or the benefits are not worth a rewrite.

comment 5y ago · link · parent

It's because humans have developed into something similar to the eusocial organism seen in other species like ants.

This makes the societal superorganism very effective at exploiting the planet's resources by conditioning human beings to serve it; that conditioning is also the root cause of all human suffering, which is an invitation to consider whether one wants to identify with society.

comment 5y ago · link · parent

That's probably because they have been used to being wealthy since birth and have always being around other wealthy people, so it doesn't register as a special thing as much as someone who transition from non-wealthy with non-wealthy friends to wealthy.

comment 5y ago · link · parent

Reexecuting it all is the simplest strategy if you don't need to undo often or the performance is acceptable anyway.

But in general, every command would generate an "undo record" with information to undo it.

In case of the brightness/contrast change you can do that by undoing in the naive way and then storing the difference between the "naively undone" image and the origignal version, compressed, in the undo record.

In general the undo record will only be large if you lose a lot of information, and then there won't be as much information left to lose and thus the next undo records won't be able to be so large, so overall the total size of the compressed current image and undo record will amortize and be in the range of the size of the original image plus the command description.

For example, once you turn the image fully grey, then all per-pixel transformations will be either be reversible or the undo record will compress to the effect on one pixel since it's the same for all the image.

This doesn't hold however if you also have operations that create information (e.g. something that draws a pseudorandom image with you then adjust contrast on, resulting in a pseudorandom undo record that you can't compress with standard techniques): in that case I think reexecuting the command history is the only space-efficient solution that doesn't require coding for the specific application.

comment 5y ago · link · parent

This only works if the commands update only a few bytes.

This would not work, for instance, in an image editor with an "adjust brightness/contrast" command since that changes the whole image.

It's also inefficient since you need to examine the whole state to generate the diffs, so in general it's not a great solution.

comment 5y ago · link · parent

At around 4 GHz and 2 IPC, it's about 1000 CPU instructions per I/O.

Assuming you have an hardware DMA ring buffer for I/O that is directly mapped in userspace, the only thing that is really needed is to write the operation type, size, disk position and memory position to the ring buffer, update the buffer position and check for flush, doable in around 8 CISC instructions (plus the slowpath), so around 100x inefficient.

Without the direct mapped ring buffer and with a filesystem, you need a kernel to translate from uring to the hardware ring buffer, and here it still seems around 10x inefficient as around 100 instructions should be enough to do the translation (assuming pages already mapped in the IOMMU, that you have the file block map in cache, and that the whole system is architected to maximize the efficiency of this operation).

comment 5y ago · link · parent

Well, Rust is currently the best programming language so it's the other languages that need to come up with a "X vs Rust".

comment 5y ago · link · parent

https://esbuild.github.io/faq/#benchmark-details has Parcel 2 benchmarks.

The summary is that you should use esbuild (or swc/spack when ready) for new projects and probably switch existing ones as well if feasible.

It's possible that the Parcel 2 version they used is not the released one, so maybe it improved.

comment 5y ago · link · parent

Why do that for general customer support instead of hiring in different time zones?

comment 5y ago · link · parent

Not sure what "scaffolding" you are talking about.

Rust has no headers or forward declarations, and compiles the whole project ("crate") as a single unit.

comment 5y ago · link · parent

Why not use Rust? It can do what you want.

comment 5y ago · link · parent

Well, if you do "meditation" (or "do nothing") in a way that results in shutting down all thoughts except the depressive ones, then it's going to make things worse.

In that case, you might be (temporarily) better off adding some very powerful and addictive thoughts or feelings to cover up the depressive ones; I think this might be in fact one of the main uses of social media and videogames.

comment 5y ago · link · parent

I think the addicted people still use it like you are describing (as well as looking at the feed).

comment 5y ago · link · parent

I'd really love anything more effective than foam earplugs for sleeping (esp. something that can block or cancel bass and thumps propagating through the walls/floor/ceiling) while still being portable.

I tried the QuietOn Sleep, but they didn't seem any better than foam earplugs (and possibly a scam - i.e. lacking any ANC at all).

Anyone knows about any such things?

comment 5y ago · link · parent

Any comparison with the other solutions? (e.g. the ones from https://blog.flant.com/comparing-kubernetes-operators-for-po...)

comment 5y ago · link · parent

Whatsapp contacts are phone numbers, so you can just call or text them with the phone network instead if it's essential.
1
141516
51