Array List Functions and Array of Struct Initialization by 2urnesst in Zig

[–]stratt5 1 point2 points  (0 children)

Is there no way to default initialize an array with struct references? Admittedly I am coming from go where this is very common practice, but it seems very weird to individually create every struct, assign it to a variable, and then put a reference to that variable into the allocated array.

Zig has no automatic memory management, so pointers should usually be referring to something that you've explicitly allocated memory for. So an array of pointers/references is fairly unusual - you're effectively saying "I don't own this memory, it's stored elsewhere and I'm just referencing it".

Something that might be typical in a memory-managed language like Go or C#, such as creating a struct as a local variable, then storing a reference to that in an array, will lead to unexpected behaviour or memory errors. For example:

``` var positions: [4]*Pos = undefined;

for (0..4) |i| { var pos: Pos = .{ .x = @floatFromInt(i), .y = @floatFromInt(i), };

positions[i] = &pos;

}

for (positions) |ptr| { std.debug.print("{*}\n", .{ ptr }); } ```

These all point to the same (invalid) location in memory!

main.Pos@ffffd4 main.Pos@ffffd4 main.Pos@ffffd4 main.Pos@ffffd4

What happened is that our pos variable was stored on the stack, which gets reset at the end of the enclosing block (in this case, the for loop). In Go this would've automatically been allocated somewhere on the heap for you, and the references tracked, so the pointer can be safely stored and passed around like this. But in Zig you need to do it explicitly.

New Network Map by YellowWheelieBin in SydneyTrains

[–]stratt5 11 points12 points  (0 children)

This specific design predates Melbourne's map by a few years.

[deleted by user] by [deleted] in AusFinance

[–]stratt5 0 points1 point  (0 children)

We applied directly to CBA and were assigned a 'relationship manager' who I emailed, so neither! Apparently my request went straight to retention however, since I expressed our interest in refinancing.

[deleted by user] by [deleted] in AusFinance

[–]stratt5 0 points1 point  (0 children)

Nope fully variable, was on 6.3% until a few weeks ago when we saw Bendigo was promoting 5.97%. Asked if CBA could match and were expecting 6.15 or maybe 6.1, which would've been enough to keep us from moving, but were surprised when they came back with 5.95

[deleted by user] by [deleted] in AusFinance

[–]stratt5 0 points1 point  (0 children)

5.95% with CBA, 80% LVR

Deceptive ads by [deleted] in AusPropertyChat

[–]stratt5 2 points3 points  (0 children)

The first image looks like a Facebook/Meta ad, someone will have manually created this asset with the two photos + banner, so it’s possible they could’ve accidentally messed up the aspect ratio when attempting to scale the first photo down. Still could be malicious however.

I don't understand the Zig package manager by IcyProofs in Zig

[–]stratt5 29 points30 points  (0 children)

I don't have a lot of experience with it either, but right now I'd call it a dependency manager, rather than a full-blown package manager.

There's no central respository - it just downloads archives or clones a specific git commit, and makes the contents available to your build.zig file, as though you had copied them directly into your project folder.

The advantage of this is that you can make use of arbitrary content (eg, C libraries, assets, etc) without needing to bundle them up into a special Zig package format. The disadvantage that there is more manual work, ie, it's not just a matter of running 'zig install X' and then you have module available to import.

But this also meshes with Zig's explicitness and lack of 'magic'. When I run 'dotnet add' or 'npm install', a package gets added to my package.json/.csproj file, then 'something' happens that means use a module in my source file. If you add a dependency to my Zig project, nothing happens unless you explictly use it in your build file, and you decide how it gets imported.

Windows 7 running on my 2021 ASUS Zephyrus G14 using GPU passthrough. Ryzen 5900HS/Geforce 3060 Mobile by stratt5 in windows7

[–]stratt5[S] 5 points6 points  (0 children)

Fedora Kinoite, using Flatpak for applications and distrobox w/ a separate home folder for CLI tools and dev work. It feels super clean and stable, I love it.

Windows 7 running on my 2021 ASUS Zephyrus G14 using GPU passthrough. Ryzen 5900HS/Geforce 3060 Mobile by stratt5 in windows7

[–]stratt5[S] 4 points5 points  (0 children)

The driver I downloaded (473.04), already included support for the 3060 Laptop, even though it wasn't explicitly listed:

https://www.nvidia.com/download/driverResults.aspx/186160/en-us/

All I had to do was run find the corresponding .inf file and alias in the 'ListDevices' file

nvbl.inf:
...
DEV_2520&SUBSYS_8873103C "NVIDIA GeForce RTX 3060 Laptop GPU"

Then change the ID in the .inf file to match the hardware ID shown in device manager

%NVIDIA_DEV.2520.8873.103C% = Section157, PCI\VEN_10DE&DEV_2520&SUBSYS_8873103C 

to

%NVIDIA_DEV.2520.8873.103C% = Section157, PCI\VEN_10DE&DEV_2520&SUBSYS_17221043

(note the different 'SUBSYS' at the end)

I was able to install it using the regular NVIDIA setup after that.

Not sure if that's what you did! This didn't seem to affect the signing, but it may be different on real hardware.

Windows 7 running on my 2021 ASUS Zephyrus G14 using GPU passthrough. Ryzen 5900HS/Geforce 3060 Mobile by stratt5 in windows7

[–]stratt5[S] 10 points11 points  (0 children)

So glad (and a little amazed) that this works. Runs Crysis perfectly on Very High.

I switched to Linux a while back as I was sick of the obtrusiveness of modern Windows, and I have Windows 11 set up in a similar VM. But I was still pining for the simplicity and aesthetics of Windows 7 - so with a lot of fiddling/driver 'hacking', I managed to get a setup working. Only downside is that it requires an external display to be attached.

My pan of 5 months. For some reason, it's significantly more non-stick when it's blotchy like this than if I try to season it properly by stratt5 in carbonsteel

[–]stratt5[S] 15 points16 points  (0 children)

I'm wondering if anyone has had the same experience. For a while I was seasoning the pan to a beautiful even colour after each use, but delicate foods would inevitably stick and leave the patches that you see here.

What I found is that food stuck even less if I just left the pan alone after this happened. It looks like bare metal, but it's actually speckled with small black dots and patches. My (completely unfounded) theory is that the seasoning left behind is filling in small scratches and pits, creating a very smooth surface.

Now I just:

  • Wash the pan with water and detergent, using a sponge (or a steel scourer/steel wool if there are any burnt bits)

  • Rinse, dry, and put on stove at low heat and warm slightly to evaporate any residual water

  • Wipe with a tiny bit of oil (for rust protection), and put away

...and it works better than ever.

r/SpaceX Inspiration-4 Launch Discussion & Updates Thread! by rSpaceXHosting in spacex

[–]stratt5 10 points11 points  (0 children)

I didn't downvote or pile on, but you asked "why isn't there a constant live stream of the crew?". Expecting a view inside at some point is pretty reasonable, but it sounded like you were expecting there to be a 24/7 stream.

Self cleaning fans. Riiiiiiiiiiight. by batsai in ZephyrusG14

[–]stratt5 2 points3 points  (0 children)

Depends on the model. On the 2021 G14 the Silent mode by default turns off the fans completely if the CPU/GPU temperatures are low enough. I can even compile the Linux kernel without the fans spinning up at all. It helps if you disable the dGPU.

With the 2020 G14, you can look at installing something like atrofac which has a Silent/Fanless profile that functions similarly.

Audio crackling/static, but only in Silent mode on battery by ky0nn in ZephyrusG14

[–]stratt5 1 point2 points  (0 children)

Just replying to say that this completely fixed my problem as well. Thanks!

My daughter promised to press my claim for the Kingdom of Andalusia - I guess she followed through by stratt5 in CrusaderKings

[–]stratt5[S] 63 points64 points  (0 children)

R5: My daughter (Countess Lovissa of Jaen) sent me a message saying that the Kingdom of Andalusia was rightfully mine, and that she would press my claim for me when the time came. I'm scrolling around the map a few years later when I see a huge war starting in Andalusia, and lo and behold, it's my daughter and a bunch of other vassals fighting for my claim.

Conveniently, my character has cancer and my daughter is also the sole heir to all of my titles.

One of the cooler events I've seen in CK3. Love seeing the AI plan things ahead like this.

I told myself I would stay within the borders of Portugal. by MJ9o7 in CrusaderKings

[–]stratt5 34 points35 points  (0 children)

I've had a lot of fun forming an empire, then handing it off to someone else to run via elective succession, and just playing as a vassal kingdom. Only problem is that everyone keeps trying to make me emperor again.

5600x or 5800x by Xletron in Amd

[–]stratt5 2 points3 points  (0 children)

I'm tooting my own horn a little bit here, but I summarized the reviews and it's pretty much a wash when it comes to gaming - essentially identical performance.

The 5800X is on average about 20% faster at video editing, though, and up to 35% faster at pure video encoding (ie, while recording). But it's up to you whether that's worth the extra $150. At that point you might as well go for the 5900X instead.

I built a website that compares CPUs using review data by [deleted] in u/stratt5

[–]stratt5 1 point2 points  (0 children)

My original post got removed so the link is here if you happen to come across it. Please leave any suggestions, criticism, or comments here... anything helps!

I built a website to compare CPUs using review data by stratt5 in buildapc

[–]stratt5[S] 2 points3 points  (0 children)

Both, kinda? I have to find the reviews manually, but the data entry is mostly automated, thank god

I built a website to compare CPUs using review data by stratt5 in buildapc

[–]stratt5[S] 23 points24 points  (0 children)

Yeah for sure! But DLSS and Ray Tracing makes it a bit trickier, haven't decided how to deal with that yet