Which Linux version did you use for the io_uring tests? Unless I missed it I don't see it mentioned.
HN user
bluetech
`ctx.Value` is an `any -> any` kv store that does not come with any documentation, type checking for which key and value should be available
The docs https://pkg.go.dev/context#Context suggest a way to make it type-safe (use an unexported key type and provide getter/setter). Seems fine to me.
What if you just use a custom struct with all the fields you may need to be defined inside?
Can't seamlessly cross module boundaries.
That's not going to happen. Check out "induced demand".
Some discussion on zio in loom-dev mailing list recently: https://mail.openjdk.org/pipermail/loom-dev/2023-March/00535...
Object.freeze does make an object immutable
If you look at the Hardened Javascript example:
const makeCounter = () => {
let count = 0;
return harden({
incr: () => (count += 1),
decr: () => (count -= 1),
});
};
The "counter object" here is mutable. I think that's what they mean.What advantage does pg_repack have when you only rebuild an index? Or do you mean it has advantage when pg_repack is run on the entire table?
One possible solution currently considered is to ask Article 5 protections from NATO for the duration of the membership process.
The report discusses this, and mentions two reasons against doing that:
- What happens if you do it, and then the referendum votes against joining? You're screwed from both ends.
- Due to the previous reason, there will be extreme pressure to vote for joining in the referendum, making it not very democratic.
Basically, their answer is yes.
First, under this system, long-term speculation is not really viable, due to the high tax. So the buyer must have some reason for paying higher than the price you set, which you don't see, i.e. you under-utilize the asset. Google/Facebook ads work this way - every slot is always up for auction. Also similar dynamics in partnership agreement's "shotgun clauses", etc.
Second, you can always factor in your sentimentality into your price, then the buyer will buy your neighbor's house instead. But you have to pay for it in the form of a higher tax. This is like a penalty for obstructing economic efficiency.
Third, this system pretty much does away with the strict idea of private property, into what they call "partial common ownership". It's basically a way to have shared ownership (as in communism) without the central planning, i.e. in a way that might actually work. (In fact, it quite reduces the role of government.)
I'm not advocating for this system, but I think it's fun to think about.
The book Radical Markets proposes the following tax (to replace most other taxes), quote:
Every citizen and especially corporation would self-assess the value of assets they possess, pay a roughly 7% tax on these values and be required to sell the assets to anyone willing to purchase them at this self-assessed price.
Java actually doesn't need to add any features for it to support this, it needs to remove them. I recommend reading this excellect article: http://habitatchronicles.com/2017/05/what-are-capabilities/
The gist is:
Rule #1: All instance variables must be private
Rule #2: No mutable static state or statically accessible authority
Rule #3: No mutable state accessible across thread boundaries
This is so obviously what needs to happen, it's really surprising it's not a feature in all major languages by now. I bet in 10 years time, giving dependencies complete control would seem crazy.
Here is an interesting proposal on how to possibly get there in JS with import maps: https://guybedford.com/secure-modular-runtimes
Deno uses ambient permissions for the entire process and unfortunately missed the opportunity to do it right.
PSI is a perfect fit for htop. I sent a PR to add it some time ago (https://github.com/hishamhm/htop/pull/890) but it hasn't been merged yet.
We've been using it for some time as well, not even with a random value, just `X-Entity-Ref-ID: null` works too. Found it through some obscure StackOverflow answer.
React has a built-in useReducer hook now as well: https://reactjs.org/docs/hooks-reference.html#usereducer
I think object-capabilities are one way to have much safer code reuse. Suppose a dependency exports a class UsefulService. In current languages, such a class can do anything - access the filesystem, access the network, etc. Suppose however that the language enforces that such actions can only be done given a reference to e.g. NetworkService, RandomService, TimeService, FilesystemService (with more or less granularity). Therefore if UsefulService is declared with `constructor(RandomService, TimeService)`, I can be sure it doesn't access any files, or hijacks any data to the network - nor do any of its transitive dependencies.
The method of sandboxing using OS processes + namespaces and what not is too heavy and unusable at such granularity.
The method of per-dependency static permission manifests in some meta-language is also poor.
The method of a single IO monad is too coarse. Also using any sort of `unsafe` should not be allowed (or be its own super-capability).
Obviously there are many tricky considerations. [For example, it is anti-modular - if suddenly UsefulService does need filesystem access, it's a breaking change, since it now must take a FilesystemService. But that sounds good to me - it's the point after all.] But does any language try to do this?
One reason I still use git grep is this: I have some minified .js files in the repository, which I don't want to be included in grep results. So I mark the files as binary in gitattributes, then git grep just says "Binary file foo matches".
It is not as clear cut as you say, there appears to be some scientific discussion on this: https://en.wikipedia.org/wiki/Endurance_running_hypothesis
Have you heard of persistence hunting? Here's is a short documentary from the BBC: https://www.youtube.com/watch?v=826HMLoiE_o
It is believed to be one of the oldest hunting techniques, and so would indicate that humans are in fact meant to run long distances. According to Wikepedia, the runner runs for "about two to five hours over 25 to 35 km (16 to 22 mi)".
I think it would be neat if WebAssembly were embedded in other languages, like it is in JavaScript now. For example, suppose Python had a WebAssembly engine. I bet that could replace a lot of C extensions, and it would be as portable/universal as pure Python code, so no need for C compilers, OS-specific binary packages, etc.
I liked this bit, using the fastest compiler for each primitive:
./do tries a list of compilers in compilers/c, keeping the fastest working implementation of each primitive. Before running ./do you can edit compilers/c to adjust compiler options or to try additional compilers.
Well, surely you put the line somewhere? Would you depend on `leftpad`? How about `is-odd`?
Your view of dependencies is very idealistic. And if I'd venture to guess - apologies if I'm wrong - young, at least to programming. I'm saying this because you don't tend to hear such phrases once reality hits.
Everything you said can be flipped:
If I import this code in my codebase directly instead of using a library, it suddenly becomes my "responsibility" if it breaks.
I have full control & understanding of the code; I can adjust & trim so it fits as much as possible. If it breaks, I can fix it directly.
And when we're talking about a FOSS side-project, I don't have that kind of time.
Copying/hand rolling some trivial code is often faster than deciding among a dozen libraries which do the same thing, reading their docs, their issue pages and open PRs, adding and integrating to my project.
Third-party libraries means I get any improvements and bug-fixes for free.
I must keep the dependencies updated. I must read changelogs and hope nothing breaks.
And if it breaks, I get to talk with the original maintainer to figure it out
I must use inefficient communication with a more-often-than-not absent maintainer in order to resolve my problem instead of fixing it directly.
I suddenly will be alone trying to figure out what I did wrong
I am able to be self-reliant in fixing the problem, because I wrote the code and I understand it.
I do not have to trust the maintainer of the package or the maintainers of any of its transitive dependencies to be competent or non-evil.
---
For some things this is worth it. IMO for generating 16 random bytes it is not worth it.
Please see the comment I replied to.
A dependency for uuid4 is hardly needed:
crypto = require('crypto');
function uuid4() {
const bytes = crypto.randomBytes(16);
bytes[6] = (bytes[6] & 0x0f) | 0x40;
bytes[8] = (bytes[8] & 0x3f) | 0x80;
return bytes.toString('hex').match(/(.{8})(.{4})(.{4})(.{4})(.{12})/).slice(1).join('-');
}A buffered channel can be implemented with two unbuffered channels + a goroutine + an array.
It can be changed at runtime. From proc(5), system wide limits:
/proc/sys/kernel/pid_max
PID_MAX_LIMIT, approximately 4 million
/proc/sys/kernel/threads-max
FUTEX_TID_MASK (0x3fffffff), [approximately 1 billion]
For per-process limit, increase RLIMIT_NPROC.
On the other hand, from Linus Torvalds:
I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships.
systemd should have a "whitelist" mode, where everything is locked down by default. Or at least, some /usr/share/doc/systemd/locked-down-example.service file with all of the relevant options set to "secure mode". It can be hard to follow all of the new features :)
The line above has this:
// This is safe since we check the return value.
let sock = unsafe { libc::socket(libc::AF_INET, libc::SOCK_DGRAM, 0) };
if sock < 0 {
return Err(Error::CreateSocket(IoError::last_os_error()));
}
I think in this case it would be better to put the return value check within the unsafe block, this way the unsafety does not "leak out" of the block, so to speak, so it is easier to audit. Of course in such a trivial case it does not matter much.Django has an ALLOWED_HOSTS setting, which must be provided even in debug and test configurations. I'm surprised Wordpress doesn't have a similar setting; accepting any arbitrary Host can only cause trouble (at least for those uninformed sites which don't already prevent it at the web server level).
I'm happy to see this. nginx itself is excellent software, I'll be happy to use similar tech for the application server as well (instead of uwsgi).
There are a couple of options I'd like to see added to the Python configuration though before I could try it:
- Ability to point it at a virtualenv.
- Ability to set environment variables for the application.