“npm install” in particular is getting me.
- 2 Posts
- 90 Comments
JakenVeina@lemm.eeto Linux Gaming@lemmy.world•Chilled factory-builder shapez 2 gets a massive upgradeEnglish6·1 month agoI played it for about 70 hours like 8 months ago, and quite enjoyed it. Will definitely go back, at some point, to see what’s been improved. There’s a REALLY solid foundation there, I think. I like to say it’s the factorio/automation genre, but distilled down to nothing but the gameplay, in its purest, most-concentrated form. My wife and son picked it back up immediately today, when they realized the big update dropped.
One thing they’ve talked about doing is improving the high-level progression. Specifically, they said their concept for better progression will be that milestone products will feed into future milestones, rather than having them just get thrown away, just like you describe. Not sure if that’s made it into the game yet, or not.
For $25 in Early Access, I think it’s a deal. If you’re really worried about there being enough gameplay/progression to keep you interested, wishlist it, and keep an eye on what the updates are adding.
C, C++, C#, to name the main ones. And quite a lot of languages are compiled similarly to these.
To be clear, there’s a lot of caveats to the statement, and it depends on architecture as well, but at the end of the day, it’s rare for a
byte
orbool
to be mapped directly to a single byte in memory.Say, for example, you have this function…
public void Foo() { bool someFlag = false; int counter = 0; ... }
The
someFlag
andcounter
variables are getting allocated on the stack, and (depending on architecture) that probably means each one is aligned to a 32-bit or 64-bit word boundary, since many CPUs require that for whole-word load and store instructions, or only support a stack pointer that increments in whole words. If the function were to have multiplebyte
orbool
variables allocated, it might be able to pack them together, if the CPU supports single-byte load and store instructions, but the nextint
variable that follows might still need some padding space in front of it, so that it aligns on a word boundary.A very similar concept applies to most struct and object implementations. A single
byte
orbool
field within a struct or object will likely result in a whole word being allocated, so that other variables and be word-aligned, or so that the whole object meets some optimal word-aligned size. But if you have multiple less-than-a-word fields, they can be packed together. C# does this, for sure, and has some mechanisms by which you can customize field packing.
JakenVeina@lemm.eeto Selfhosted@lemmy.world•Self-hosting is having a moment. Ethan Sholly knows why.English1·2 months agoI’ll take another look, but I didn’t see any such setting when I was trying to diagnose. And I haven’t changed any Plex settings since the last time we had an internet outage and it worked properly, just a month or two ago.
JakenVeina@lemm.eeto Selfhosted@lemmy.world•Self-hosting is having a moment. Ethan Sholly knows why.English362·2 months agoI recently discovered that Plex no longer works over local network, if you lose internet service. A) you can’t login without internet access. B) even if you’re already logged in, apps do not find and recognize your local server without internet access. So, yeah, Plex is already there.
JakenVeina@lemm.eeto Linux Gaming@lemmy.world•Denuvo will lock you out of games on Linux, SteamOS, Steam Deck if you keep changing Proton versionsEnglish1·2 months agoThe Steam release of Persona 5 Royal, unfortunately. Which is kind of insane, it’s a single-player game.
There’s some others that I can’t personally attest to, but that sure look good from what I’ve seen. Monster Hunter: Wilds, for example. And the new Doom from a few days ago, if you’re into that sorta thing. Metaphor Re-Fantasio. The new Prince of Persia from last year. Hi-Fi Rush. Rocksmith, of all things.
JakenVeina@lemm.eeto Linux Gaming@lemmy.world•Denuvo will lock you out of games on Linux, SteamOS, Steam Deck if you keep changing Proton versionsEnglish38·2 months agoAs of a few months ago (IIRC the timeline) Steam shows this directly on the game’s store page. You’ve got to scroll down for it a little bit, but it’s right under where it lists features of the game, E.G. single-player, controller support, etc.
That’s a good analogy.
It’s far more often stored in a word, so 32-64 bytes, depending on the target architecture. At least in most languages.
JakenVeina@lemm.eeto Programmer Humor@programming.dev•AI will replace programmersEnglish261·2 months agoYou know what we, in the industry, call a detailed specification fo requirements detailed enough to produce software? Code.
The REAL problem is that the industry collectively uses JS almost exclusively for shit it was never meant to do. Like you say, it’s intended for it to not throw errors and kill your whole web page, because it was only ever intended to be used for minor scripts inside mostly-static HTML and CSS web pages. Then we all turned it into the most-popular language in the world for building GUI applications.
JakenVeina@lemm.eeto Programming@programming.dev•Courses for SIMPLE, website-orientated, javascript developmentEnglish1·2 months agoHonestly, if you’re having trouble finding stuff for vanilla JS, I’d recommend looking at jQuery. Not that you should USE jQuery, necessarily, but the library is basically a giant wrapper around all the native JS APIs, so the approach to building stuff is essentially the same: it all focuses on tracking and manipulation of DOM elements.
I do vanilla JS (actually TypeScript) dev at work, daily, and that was my big takeaway from spearheding our team’s migration from jQuery to vanilla TypeScript: I honestly don’t know what benefit jQuery provides, over vanilla, because all the most-common jQuery APIs that we were using have a 1:1 native equivalent.
We do also use 2 third-party libraries alongside vanilla, so I’l mention those: require.js and rx.js. Require you probably don’t need, with modern JS having bundling and module support built-in but we still use it for legacy reasons. But rx.js is a huge recommend, for me. Reactive programming is the IDEAL way to build GUIs, in my opinion.
JakenVeina@lemm.eeto Selfhosted@lemmy.world•GitHub - outerbase/studio: A lightweight Database GUI in your browser. It supports connecting to Postgres, MySQL, and SQLite.English1·3 months agoSick. I’ve tried a few times in the past to find a frontend for postgres that I liked, and was never able to. Will have to give this a try.
JakenVeina@lemm.eeto Selfhosted@lemmy.world•How do I use HTTPS on a private LAN without self-signed certs?English81·3 months agoThe most straightforward thing to do, on a private LAN, is to make all your own certs, from a custom root cert, and then manually install that cert as “trusted” on each machine. If none of the machines on this network need to accessed from outside the LAN, then you’re golden.
JakenVeina@lemm.eeto Programmer Humor@programming.dev•Git, invented in 2005. Programmers on 2004:English3·4 months agoThank god, we STILL use TFS at work, and its core version control model is reeeeeally fucking awful.
I’ve seen forms of this joke quite a lot in the last few years, and it never fails to make me laugh.
JakenVeina@lemm.eeto Programming@programming.dev•[Noob here] Can someone explain to me the advantage of mutable objects?English421·5 months agoI’m gonna hazard a guess, just cause I’m curious, that you’re coming from JavaScript.
Regardless, the answer’s basically the same across all similar languages where this question makes sense. That is, languages that are largely, if not completely, object-oriented, where memory is managed for you.
Bottom line, object allocation is VERY expensive. Generally, objects are allocated on a heap, so the allocation process itself, in its most basic form, involves walking some portion of a linked list to find an available heap block, updating a header or other info block to track that the block is now in use, maybe sub-dividing the block to avoid wasting space, any making any updates that might be necessary to nodes of the linked list that we traversed.
THEN, we have to run similar operations later for de-allocation. And if we’re talking about a memory-managed language, well, that means running a garbage collector algorithm, periodically, that needs to somehow inspect blocks that are in use to see if they’re still in use, or can be automatically de-allocated. The most common garbage-collector I know of involves tagging all references within other objects, so that the GC can start at the “root” objects and walk the entire tree of references within references, in order to find any that are orphaned, and identify them as collectable.
My bread and butter is C#, so let’s look at an actual example.
public class MyMutableObject { public required ulong Id { get; set; } public required string Name { get; set; } } public record MyImmutableObject { public required ulong Id { get; init; } public required string Name { get; init; } }
_immutableInstance = new() { Id = 1, Name = "First" }; _mutableInstance = new() { Id = 1, Name = "First" };
[Benchmark(Baseline = true)] public MyMutableObject MutableEdit() { _mutableInstance.Name = "Second"; return _mutableInstance; } [Benchmark] public MyImmutableObject ImmutableEdit() => _immutableInstance with { Name = "Second" };
Method Mean Error StdDev Ratio RatioSD Gen0 Allocated Alloc Ratio MutableEdit 1.080 ns 0.0876 ns 0.1439 ns 1.02 0.19 - - NA ImmutableEdit 8.282 ns 0.2287 ns 0.3353 ns 7.79 1.03 0.0076 32 B NA Even for the most basic edit operation, immutable copying is slower by more than 7 times, and (obviously) allocates more memory, which translates to more cost to be spent on garbage collection later.
Let’s scale it up to a slightly-more realistic immutable data structure.
public class MyMutableParentObject { public required ulong Id { get; set; } public required string Name { get; set; } public required MyMutableChildObject Child { get; set; } } public class MyMutableChildObject { public required ulong Id { get; set; } public required string Name { get; set; } public required MyMutableGrandchildObject FirstGrandchild { get; set; } public required MyMutableGrandchildObject SecondGrandchild { get; set; } public required MyMutableGrandchildObject ThirdGrandchild { get; set; } } public class MyMutableGrandchildObject { public required ulong Id { get; set; } public required string Name { get; set; } } public record MyImmutableParentObject { public required ulong Id { get; set; } public required string Name { get; set; } public required MyImmutableChildObject Child { get; set; } } public record MyImmutableChildObject { public required ulong Id { get; set; } public required string Name { get; set; } public required MyImmutableGrandchildObject FirstGrandchild { get; set; } public required MyImmutableGrandchildObject SecondGrandchild { get; set; } public required MyImmutableGrandchildObject ThirdGrandchild { get; set; } } public record MyImmutableGrandchildObject { public required ulong Id { get; set; } public required string Name { get; set; } }
_immutableTree = new() { Id = 1, Name = "Parent", Child = new() { Id = 2, Name = "Child", FirstGrandchild = new() { Id = 3, Name = "First Grandchild" }, SecondGrandchild = new() { Id = 4, Name = "Second Grandchild" }, ThirdGrandchild = new() { Id = 5, Name = "Third Grandchild" }, } }; _mutableTree = new() { Id = 1, Name = "Parent", Child = new() { Id = 2, Name = "Child", FirstGrandchild = new() { Id = 3, Name = "First Grandchild" }, SecondGrandchild = new() { Id = 4, Name = "Second Grandchild" }, ThirdGrandchild = new() { Id = 5, Name = "Third Grandchild" }, } };
[Benchmark(Baseline = true)] public MyMutableParentObject MutableEdit() { _mutableTree.Child.SecondGrandchild.Name = "Second Grandchild Edited"; return _mutableTree; } [Benchmark] public MyImmutableParentObject ImmutableEdit() => _immutableTree with { Child = _immutableTree.Child with { SecondGrandchild = _immutableTree.Child.SecondGrandchild with { Name = "Second Grandchild Edited" } } };
Method Mean Error StdDev Ratio RatioSD Gen0 Allocated Alloc Ratio MutableEdit 1.129 ns 0.0840 ns 0.0825 ns 1.00 0.10 - - NA ImmutableEdit 32.685 ns 0.8503 ns 2.4534 ns 29.09 2.95 0.0306 128 B NA Not only is performance worse, but it drops off exponentially, as you scale out the size of your immutable structures.
Now, all this being said, I myself use the immutable object pattern FREQUENTLY, in both C# and JavaScript. There’s a lot of problems you encounter in business logic that it solves really well, and it’s basically the ideal type of data structure for use in reactive programming, which is extremely effective for building GUIs. In other words, I use immutable objects a ton when I’m building out the business layer of a UI, where data is king. If I were writing code within any of the frameworks I use to BUILD those UIs (.NET, WPF, ReactiveExtensions) you can bet I’d be using immutable objects way more sparingly.
JakenVeina@lemm.eeto Programming@programming.dev•Why do libraries define their own true and false?English4·6 months agoA function call of “MyFunction(parameter: GLFW_TRUE)” is more readable than “MyFunction(parameter: 1)”. Not by much, mind you, but if given the choice between these two, one is clearly better. It requires no assumptions about what the reader may or may not already know about the system.It communicates intent without any ambiguity.
What are you considering as “paint[ing] UI-elements” in this context? I don’t see anything I would describe as “painting” in the code snippets ay those links.
Alternative image for C: Mr. Incredible: “A PARAMETER IS A PARAMETER!”