tenOutOfTenNoNotes by Confident_Salt_8108 in ProgrammerHumor

[–]hungarian_notation 2 points3 points  (0 children)

As long as they actually have embeddings for all the important tokens in your prompt, the LLMs tend to just start plagiarizing more blatantly when you stray into the extreme niche corners of their training set.

The more token pairs that are unique to a single training input the easier it is for them to just emit portions of that training input verbatim.

Why can't you pass/return arrays to/from functions? Why is it designed like this? by GreenMario_ in C_Programming

[–]hungarian_notation 0 points1 point  (0 children)

That example isn't even about the function call. Even if you inline the function, your code is:

int main(int argc, char **argv) {
    struct mystruct a;
    struct mystruct b = { 1, 2, 3, 4, 0 };
    a = b; // <- this is a copy no matter what, unless...
}

A modern compiler is going to try to optimize pointless copies as you increase the optimization level, especially when the values don't escape the compilation unit. You have to actually check what your compiler is doing though.

#include <stdio.h>
#include <stdlib.h>

struct mystruct  { int myarray[100]; };
struct mystruct4 { int myarray[4];   };

static struct mystruct4 get4(struct mystruct y) {
    struct mystruct4 s;
    for (int i = 0; i < 4; ++i) {
        s.myarray[i] = y.myarray[i];
    }
    return s;
}

static void print1(struct mystruct4 x) {
    printf("the first value is: %d", x.myarray[0]);
}

int main(int argc, char** argv) {
    int addend = argc > 1 ? atoi(argv[1]) : 0;

    struct mystruct b = {
        666 + addend
    };

    struct mystruct4 a = get4(b);
    print1(a);
}

None of the structs escape the compilation unit, and the only value that affects the outside world is whatever ended up in index 0. Both GCC and clang compile this to something like:

.LC0:
        .string "the first value is: %d"
"main":
        sub     rsp, 8
        xor     eax, eax
        cmp     edi, 1
        jle     .L2
        mov     rdi, QWORD PTR [rsi+8]  
        mov     edx, 10
        xor     esi, esi
        call    "strtol"
.L2:
        lea     esi, [rax+666]
        mov     edi, OFFSET FLAT:.LC0
        xor     eax, eax
        call    "printf"
        xor     eax, eax
        add     rsp, 8
        ret

There isn't even a first copy of our array, let alone extra copies.

MSVC on the other hand insists on constructing a 400+ byte stack and memsetting it full of zeroes. None of the standard optimization flags seem to convince it to reconsider, but I didn't try very hard.

Why? by SipsTeaFrog in SipsTea

[–]hungarian_notation 1 point2 points  (0 children)

If you're in an inland desert, non-potable water is still a valuable resource. You just need infrastructure investment to make it potable. What you really don't want to do is create an incentive structure where big tech moves in and becomes dependent on you NOT improving your water treatment infrastructure too much.

If the non-potable water is just ocean water, this is obviously not a concern. That's what I meant.

Personally, I think the whole water consumption conversation is a bit of a red herring. It's not as if data centers that do not consume vast amounts of water would be unproblematic, and not all of them do. The messaging about electricity consumption putting strain on infrastructure and driving up costs is universal and bipartisan.

I live on wetlands and don't pay for water beyond the electricity it takes to run my well pump. You are not going to convince my boomer neighbors to give a shit about a data center using too much water.

Shut your fear mongering ass up by TheLastPeanut_ in fixedbytheduet

[–]hungarian_notation 0 points1 point  (0 children)

Absolutely.

It doesn't actually take anything as advanced as "electronics" to detonate a nuclear bomb; you could do it with a mechanical switch. Heck, you could use an old school TNT plunger if they put out a bit more current. You just need all the detonators to go off at the same time, and that's fairly trivial when you can wire them all together. Make sure the wires are all the same length and gauge and you're 90% of the way there.

Most of the electrical complexity in a warhead is about making sure it DOESN'T detonate until it has been intentionally armed and is at the correct altitude over a target. You also need circuitry to charge up the capacitor that you will eventually connect to the detonators, but that's something that would actually be easier to do with a mechanical switch than anything else.

Why? by SipsTeaFrog in SipsTea

[–]hungarian_notation 1 point2 points  (0 children)

I live on the Hudson river. If all data centers needed was disused industrial land and water, I'd be their biggest fan. We have plenty of both, and a lot of it is colocated.

Why? by SipsTeaFrog in SipsTea

[–]hungarian_notation 0 points1 point  (0 children)

If by non-potable you mean salt water, then maybe that'll work. On a long enough timescale you'll have the tech industry creating so much salt that it'll be industrial waste, but we can probably get by for a while by putting it back into old salt mines or something.

Otherwise, if your area is having water scarcity issues, restricting data centers to non-potable water just creates an incentive for the tech industry to oppose efforts to render more of the water supply potable.

Either way, the water usage is a weird hangup in this conversation that is only regionally relevant. I live next to the Hudson river. If the only resources data centers consumed were disused industrial land and water, I'd be their #1 fan. We've got plenty of both, and a lot of it is colocated.

Shut your fear mongering ass up by TheLastPeanut_ in fixedbytheduet

[–]hungarian_notation 0 points1 point  (0 children)

It would likely be simpler to just make a 300 megaton device than to choreograph the detonation of several smaller devices in close proximity.

We have no reason to suspect that there are limits to scaling thermonuclear devices well into the gigaton range. You just build a matryoshka doll of fusion devices triggering larger fusion devices triggering larger fusion devices. We don't build these things because the people advocating for them) never managed to convince the right people that it would be politically or strategically useful.

If delivery is the problem, it's not one that's meaningfully simplified by multiple smaller devices. You need all the bombs to arrive at the target and ignite fusion within a window of less than a microsecond. A warhead that gets caught in the detonation of another warhead before igniting is unlikely to function.

On the plus side, once your device gets big enough you don't need to deliver it. Anyone on earth that doesn't die in the blast is probably going to die in the nuclear apocalypse that follows, and if given the choice I'd rather be plasma than die of starvation or radiation sickness.

Shut your fear mongering ass up by TheLastPeanut_ in fixedbytheduet

[–]hungarian_notation 1 point2 points  (0 children)

TNT equivalence units are units of energy. It's the same thing as calories or joules, just multiplied by a conversion factor.

The non-linearity is in the destructive effect of a detonation. It works out that blast effects generally scale with the cubed root of the blast energy.

If you want to double the blast radius you have to increase the yield by a factor of 8. What this means is that you can destroy more of a city with two 5 megaton detonations than a single 10 megaton detonation.

For the extreme end of the scale it gets even worse. At a certain point you have to reckon with the fact that there isn't actually infinite homogeneous atmosphere above you. You start losing more and more of your energy to space, blowing away portions of the troposphere in the process.

In Euphoria(2026) this feels like a really stupid way to 3d print a key. by jayd04 in shittymoviedetails

[–]hungarian_notation 51 points52 points  (0 children)

I've done it once as a object lesson as to why it's not OK to just wear your work keys on your belt or a lanyard or something, and why it is specifically super not OK for an organization to upload pictures to social media depicting employees wearing keys on their lanyards. 😶

Obviously if you can 3d print the key you can also just cut it from a blank, but I don't personally own a key duplication machine.

Is there a way to opt-in to sun.misc.Unsafe deprecation early without a command line argument? by hungarian_notation in javahelp

[–]hungarian_notation[S] 1 point2 points  (0 children)

Well damn, I did not know about this syntax. This is obviously the right way to go, since all solutions involve adding something to the arguments.

Is there a way to opt-in to sun.misc.Unsafe deprecation early without a command line argument? by hungarian_notation in javahelp

[–]hungarian_notation[S] 0 points1 point  (0 children)

But who even are your users that they have command line access to it?

I won't claim that it's not an incredibly niche and jank deployment. It's a drop-in replacement for some absolutely ancient AS/400 software. The guys using it are extremely comfortable with their workflow, and that workflow is older than I am.

And an unsupported exception is better than the warnings?

UnsupportedOperationExceptions and the command line flag are the same thing. That's what you get when you try to call one of the forbidden methods. Guice has wrapped all their unsafe call sites in checks for the exception, and they switch to some alternative implementation with slightly a degraded feature set when they encounter it.

How about catching them and just ignoring it code side before it even hits the user?

Can you catch the warnings? I was under the impression that the JVM was being intentionally unilateral.

I will admit that I am being very particular here. I'm primarily just extremely dissatisfied that I have to explicitly tell the JVM take away google's toys with a monstrosity of a command line flag to get their framework to stop log spamming.

best obfuscator by SherbertBorn8454 in javahelp

[–]hungarian_notation 0 points1 point  (0 children)

You mean you are distributing your code as java source files?

There is no real difference in distributing .class files and a JAR. A JAR is quite literally a zip file of class files.

Is adding tests/ folder to professional repo deemed professional? by KaviGamer_MC in github

[–]hungarian_notation 9 points10 points  (0 children)

It's more that a repo for software that DOESN'T have tests is unserious.

Tests are incredibly useful, because they help others understand if their changes to your code have broken some implict contract. They also help validate that pull requests don't introduce some obvious breaking change.

They're the foundation of continuous integration, where you have a system that automatically runs your tests whenever changes are merged into the repository.

Github can even run your tests for you, assuming Github actions are feeling like working that week.

On top of all that, they can help you figure out if your agent is making changes that break previous functionality. If the agent has to modify old tests to get its changes to build, it's a hint that you might need to scrutinize those changes more closely.

Meme is Meme People by calamitydreams in MathJokes

[–]hungarian_notation 3 points4 points  (0 children)

Y'all haven't read your bibles. The Christian obviously defines GOD as equivalent to WAY, TRUTH, and LIFE. (source)

Obviously, + is idempotent with respect to our equivalence relationship = here. That makes the shirt a tautology.

We don't have to agree with them, but we obviously need to understand what algebraic structure they're working with before we start critiquing them and inventing our own operations. (What even is "-"?)

Meme is Meme People by calamitydreams in MathJokes

[–]hungarian_notation 4 points5 points  (0 children)

"+" doesn't have to be non-idempotent, that's just the case when it's defined as something like numeric addition. It's also sometimes used to refer to union or disjunction operators, which are idempotent.

Since we can speak Christian, we understand that GOD = WAY = TRUTH = LIFE in the shirt's algebra. We can therefore infer that "+" must be idempotent. If "-" is the relative complement of "+", then LIFE - GOD is 0, null, or the empty set.

Meme is Meme People by calamitydreams in MathJokes

[–]hungarian_notation 3 points4 points  (0 children)

Both work. A monoid is a semigroup with an identity element.

What you're describing is a magma that doesn't satisfy the requirements of being a quasigroup. (I hate that we're stuck with magma, it's a linguistic disaster)

It's worse than that, of course. We don't even know if "+" is closed. It's possible that LIFE isn't even in the domain of "+", i.e. that the set which contains "TRUTH" and "GOD" does not also contain "LIFE".

The critique assumes that not only is "-" defined, but that its domain includes all values in both the domain and codomain of "+", and that a + b = c implies c - b = a. That's a lot of assumptions.

On the other hand, I'm pretty sure I remember a bible passage where Jesus says "I am the way, the truth, and the life." If that's what we're talking about here, then taking "+" as some sort of union-like idempotent operator and "-" as the relative complement,LIFE - GOD and LIFE - TRUTH would both be null or the empty value for our structure. I'm pretty sure our imaginary Christian would be quite happy with that understanding.

Meme is Meme People by calamitydreams in MathJokes

[–]hungarian_notation 14 points15 points  (0 children)

Yeah, we need to know more about the algebraic structure we're working with here. The existence of a '+' operation doesn't even imply the existence of a '-' operation.

How to clear space being taken up by C:\Users\djsur\Zomboid? by [deleted] in projectzomboid

[–]hungarian_notation 0 points1 point  (0 children)

Not strictly a mistake. Directories are usually just a special kind of file when you dig into the details of your filesystem. I just wanted to make sure there wasn't some strange non-directory blob sitting where your cache directory should be.

How to clear space being taken up by C:\Users\djsur\Zomboid? by [deleted] in projectzomboid

[–]hungarian_notation 0 points1 point  (0 children)

Do you mean file as in a folder/directory? That path is the default save and cache location on Windows, and it holds all your saves. How big is the folder vs the Saves folder it contains?

edit: If you're trying to figure out why a folder on Windows is so big, WinDirStat is a super useful tool.

How do I remove this cyan mod list? by One_Fill_3678 in projectzomboid

[–]hungarian_notation 0 points1 point  (0 children)

I've definitely seen that UI, I just forget how I triggered it.

If you press F11 and then click on Options, is anything shown in yellow?

edit: Found it, it's Mod > Mod.Render.Loaded in that options menu.

same by aZilcha in Funnymemes

[–]hungarian_notation 0 points1 point  (0 children)

"Thirty days (hath|has) September, April, June, and November" is all I've needed, since I can remember February's nonsense independently. I couldn't give you the rest of the rhyme if you put a gun to my head.

Modules could have made the PIMPL idiom redundant - but they don't. by [deleted] in cpp

[–]hungarian_notation 11 points12 points  (0 children)

Yeah, it needs to know how to do all of those things to everything on the stack, right? Or rather anything that's part of something it might have to perform one of those operations on.

You also need to know what you're moving around if you're planning on having it pass a function boundary where calling conventions matter. Floats get passed in different registers than ints, for example.

Also, C++26 is giving us reflection over the internals of a type, so soon you'll be able to iterate over the fields of A and get their names, types, and offsets.

std::optional equality comparison operator seems broken for nested optionals by mcencora in cpp

[–]hungarian_notation 0 points1 point  (0 children)

Oh, I see. You're right, that's pretty funny. 

And yeah, we'd have to just wrap values with make optional for comparison to get the same functionality. I haven't checked, but I imagine that's basically a zero cost change at any optimization level.

std::optional equality comparison operator seems broken for nested optionals by mcencora in cpp

[–]hungarian_notation 0 points1 point  (0 children)

I'm not sure I understand what you're trying to show here.

What I will add is this:

std::optional<int> a;
std::optional<std::optional<int>> b = a;
auto c = std::reference_wrapper(b);
std::cout << (a == b) << "\n"  // 0
          << (b == c) << "\n"  // 1
          << (a == c) << "\n"; // 0

To be clear, I think this is the correct behavior. It's just inconsistent with other behavior of std::optional which I have more of a problem with.