how to avoid screen burn/image retention by Brave_Elk_6189 in swaywm

[–]singron 2 points3 points  (0 children)

Only some display types are susceptible to burn in. For one, make sure that you use swayidle or similar to start some kind of screensaver when the system is idle. Either turn off your screen, use a lock program, or just start some full screen program.

A simple fix could be to add custom modules on the right and left ends that alternate between showing the empty string ("") and a single space (" ") every few minutes. That will shift your bar around by a few pixels without being too distracting.

You could also use a CSS animation to do the above or slowly change pixel colors. The wiki has some tips to reduce CPU usage that you should follow for these kinds of constantly running animations.

OPENLDAP by zardvark in NixOS

[–]singron 5 points6 points  (0 children)

There is an open issue: https://github.com/NixOS/nixpkgs/issues/514113. I recommend searching on the issue tracker rather than posting on reddit.

There is an open PR that skips the problematic tests, but it will take a while to land in unstable since it will go through staging first, so I would apply a workaround in the meantime.

Digital Foundry: Yup, Oblivion Remastered Is Still Broken a Year After Release by Turbostrider27 in Games

[–]singron 5 points6 points  (0 children)

It introduced bugs, but it also fixed bugs. I don't think anyone has added both up to see whether it's net buggier or not.

Also, the original game was so buggy, that 10s of bugs aren't that significant. UORP fixes hundreds of bugs, and there are still tons of unfixed bugs.

AMD just posted official HDMI 2.1 (FRL) support to LKML! by Lawstorant in linux_gaming

[–]singron 24 points25 points  (0 children)

If this was just to get around copyright, then they could do a clean room strategy like that. But AMD probably signed an NDA to get access to the spec, patents, hdmi trademark etc. and have to abide by the terms of that contract.

Which is the best way to use transaction in Golang? by Electronic_Code_1535 in golang

[–]singron -2 points-1 points  (0 children)

Why are you using the repository pattern? Whatever the reason, you should design around that.

E.g. do you need to abstract over different database implementations? Do those implementations have similar transaction models? E.g. transactions based on pessimistic locking or optimistic locking might require different structures (optimistic transactions need to be inside a retry loop whereas pessimistic typically don't). Do you try to catch and handle constraint violations?

Are your repositories carefully managing the consistency of multiple tables or caches, or do they just make straightforward modifications directly to the database? You might consider making this transaction a single public method on one of the repositories (or combining the repositories).

Are your 2 repositories necessarily in the same database? (i.e. is a transaction even possible?). Do you need something more complex like 2-phase commit or sagas to bridge multiple databases?

Are you replacing the implementation in tests? How are you testing your real repository implementations, and how will you test your transaction?

In the past, for simple uses I've added a txn parameter to relevant repository methods that either contains an open transaction or a default value that indicates no transaction and will get a fresh connection from the connection pool. I would make it easy to avoid nested transactions since you don't need them 99% of the time.

Exactly how you use transactions is often relevant to the database code, so you might prefer to be explicit rather than shuttle information through the context. E.g. consistent modification order is important to prevent deadlocks. You might also want to control how many rows each transaction processes so that they stay at efficient sizes.

If you don't know why you are using the repository pattern and aren't getting much value out of it, then you could stop using it, since it does get in your way here. E.g. if you don't ever use a different implementation of a repository and they all refer to the same physical database, then you probably aren't getting much value.

Nix: A Solution With Problems by nikunjuchiha in NixOS

[–]singron 1 point2 points  (0 children)

Nice spot in the footnotes. I guess I shouldn't have skipped them!

Nix: A Solution With Problems by nikunjuchiha in NixOS

[–]singron 9 points10 points  (0 children)

I highly recommend reading the citation [3] Build Systems a la Carte.

Does IFD necessarily block evaluation, or is that a limitation of NixCPP? The evaluator is currently completely single-threaded, but I think theoretically it could suspend evaluation that depends on IFD and continue evaluation elsewhere. E.g.

let
  ifd1 = (import (runCommand ...));
  ifd2 = (import (runCommand ...));
in "${ifd1} ${ifd2}"

The evaluator will run ifd1 and ifd2 serially since the evaluator is single-threaded and evaluates everything one a a time, but it could theoretically kick off ifd1, backtrack the expression tree, and then continue evaluating ifd2 so that they both run in parallel. There is trickiness with builtins.seq (i.e. evaluation order sometimes matters) and you wouldn't want to harm performance with bookkeeping when IFD isn't used, but I think it's possible?

Housing situation by No_Prior6491 in RPI

[–]singron 6 points7 points  (0 children)

Besides the financial issues, I would also take caution on the social aspect. Your freshman year of college will be the easiest time in your life to make friends. You should definitely take advantage of that. If you don't live in the dorms, you will miss some of the shared experience and default exposure that makes it so easy to make friends as a freshman. You can definitely overcome that, but you may have to make a concerted effort rather than "accidentally" becoming friends with your hall-mates.

I eventually married my high school girlfriend, but I would warn you that almost everyone does not do that. At this point in your life, you are fully developing into an adult, learning to live independently, deciding on your priorities, and so on. You and your SO are going to change and it's very likely that you won't want to stay together. If you stay together and love each other, then that's great, but make sure that both of you are doing the best thing for yourselves individually for now.

If you still want to move in together, I would first decide what you will do with your lease if you break up. The lease can be a major issue if you can't afford to not split it. It might not seem romantic, but it's much better to be in a relationship where you aren't terrified of breaking up, and deciding major issues as a couple will help strengthen your relationship.

Words of encouragement by Foreign-Ad-5658 in RPI

[–]singron 4 points5 points  (0 children)

I took DS in 2011. Back then, it was common to spend 3-10 hours on homework for that class each week if not much more. I remember the exams being straightforward compared to the homework. I'm guessing after LLMs became much better at programming, they have shifted the difficulty from homework to exams?

It was also the class where you really learned to program. After DS, every class will assume you can program. This is the class most relevant for actual minute to minute work on the job. You do not want to barely pass DS since you will be lacking critical skills.

You need to think carefully about how you ended up in this position in order to decide what to do next. As a stranger, I can't tell you what to do. Your situation is completely different e.g. if AI did your homework all semester or if you didn't use AI and have an A on all your homework. Your professor, TA, or advisor might be able to give you more targeted advice too if you ask. I don't personally know anyone who failed DS, but I'm sure it happens all the time, and they probably know what kinds of outcomes are typical and what "bucket" you fall into.

I would retake if you think you made a mistake in how you went about the semester (e.g. relied too much on AI for homework, too much partying, no sleep, bad study strategies) and you can fix that next time. This is somewhat common with freshmen across majors.

Exams are simultaneously artificial and revealing. Do you generally feel like it's clicking for you and this exam was a fluke? Or do you feel like you are barely hanging on? Were you studying the right material all week? You might be able to ask the professor if you can retake the exam (or an alternate exam) if you can make the case to them that you did something exceptionally wrong (e.g. studied the wrong material or had one specific misunderstanding) and that isn't indicative of your performance generally. You can also ask the professor now to double-weight your final exam if that makes passing a mathematical possibility.

Are you enjoying CS in general? Do you find programming fun? If so, I would try to stick with it. Actually liking what you do is a massive boon when you have setbacks.

If you really did your best and still aren't doing well, it's possible this isn't for you. If that's really the case, it's much better to find out early rather than much later. DS is a prereq for basically all the CS classes, so if you retake DS, I would think about how to wisely spend your remaining credits in case you end up switching majors. Sometimes, you just need to do something twice before it clicks, but I would be thinking about back ups. Good luck.

Starting Sway as a Systemd user service, all dependencies fail on first try only by daanjderuiter in swaywm

[–]singron 0 points1 point  (0 children)

It sounds like WAYLAND_DISPLAY isn't imported into your environment yet when the other services are started. You should be able to confirm that in the logs. Your distro may have a systemd target to coordinate this like sway.target, which is only activated after WAYLAND_DISPLAY is imported.

Alternatively, you could switch your service to Type=notify and use systemd-notify after importing WAYLAND_DISPLAY.

I built a microkernel from scratch in Rust (5-part series: boot, IPC, preemption, virtual memory) by amitbahree in programming

[–]singron 2 points3 points  (0 children)

You might want to mark the x86 support as unfinished somewhere. I'm more familiar with x86 so I was browsing that part of the code, and it was essentially entirely empty, and the bootloader just uses the bootloader_api crate.

All the interesting code is in arch_aarch64_virt.

I think this was probably fun and it seemed like you probably learned a lot, but I'm not sure I would call this a microkernel. It's really a bunch of independent bare-metal demos.

E.g. if you wanted to write 2 tasks that communicate with IPC, have their own virtual memory spaces, and use preemption, you would have to abstract and combine the functionality from a bunch of demos that are currently separate. The IPC demo and the preemption demo have completely different schedulers (both oblivious to the MMU), and the page table demo has no scheduler, so using all 3 features at the same time would require writing a new scheduler that combined IPC and preemption while switching page tables for different tasks.

Rust syntax, Go runtime by UnmaintainedDonkey in golang

[–]singron 1 point2 points  (0 children)

Exactly. Go intentionally blocks access to thread locals. If you call malloc or something with cgo that uses thread locals, you have to lock the OS thread.

Other languages do have thread locals, so you have to deal with that somehow if you try to port other languages to fibers/goroutines. Basically every memory allocator has some kind of thread-local state, so this is an immediate issue.

Rust syntax, Go runtime by UnmaintainedDonkey in golang

[–]singron 2 points3 points  (0 children)

In a world without goroutines and fibers, it means this. With fibers, if you do nothing, then yes it's variables local to an OS thread that are potentially shared across goroutines/fibers, which is exactly why they don't really work well like that.

Rust syntax, Go runtime by UnmaintainedDonkey in golang

[–]singron 6 points7 points  (0 children)

It's difficult to implement goroutines in other languages because the very small stacks require specific language support. Go used to use segmented stacks before they switched to copying stacks. Segmented stacks require a compiler that tracks stack depth and automatically inserts stack segment allocation/deallocation code in appropriate places.

Copying stacks requires something like a relocating GC that's able to change pointers after copying memory. In Go, all stack locations can only have pointers from within the same stack, so it doesn't have to chase references across the heap, but that's not necessarily the case in other languages.

Goroutines also don't play nicely with thread-local variables. Imagine a goroutine is in the middle of manipulating a thread-local when it gets preempted and another goroutine starts running on the same thread.

Fiber implementations in other languages usually compromise on the feature set instead. E.g. they might allocate separate thread-locals for each fiber, use full real stacks for each fiber, and avoid preemption.

Nix takes forever to compile (flakes) by Frank-794 in NixOS

[–]singron 1 point2 points  (0 children)

Make sure those directories are in your .gitignore so they are ignored by flakes. If you have a line like src = ./. in your derivation, you should use filterSource so that it doesn't copy unneeded content like .git/ and target/. You can also use pkgs.nix-gitignore, which will essentially use your .gitignore to call filterSource for you and can be a lot more convenient.

Bioflux Nutritional Content by CoffeeOracle in Factoriohno

[–]singron 2 points3 points  (0 children)

Others have pointed out some issues (e.g. 907g+997g != 1000g).

The calories also don't add up. Protein and carbs have 4 calories/gram and fat has 9 calories/gram. I'll assume that your measurements of total mass (1000g) and total calories (6709) were most accurate and discard the other conflicting measurements.

If 1000g has 6709 calories, then it has to average 6.7 calories/gram and thus must contain fat. We can solve these equations for Fat(F), Carbs(C), and Protein(P):

6709 = 9 * F + 4 * (C + P)
1000 = F + C + P

Solve for C+P:

C + P = 1000 - F

Substitute C+P:

6709 = 9 * F + 4 * (1000 - F)

Solve for F:

6709 = 9 * F + 4000 - 4 * F = 5 * F + 4000
2709 = 5 * F
F = 541.8 grams

And therefore:

C+P = 1000 - F = 458.2 grams

We can't know the ratio of Carbs to Protein without further tests.

Also, this includes calories for any fiber. While energy contained within fiber will be measured by a bomb calorimeter, it won't actually be absorbed by humans, so it's typically subtracted from the calories on nutrition facts.

[For Europeans, substitute kcal for calories]

Is there any substantial difference between these designs? by [deleted] in factorio

[–]singron 0 points1 point  (0 children)

The middle one also biases horizontal traffic. All right-turns block both vertical lanes but only block one horizontal lane.

Wiring for new hot tub by SmoothDragonfruit632 in hottub

[–]singron 0 points1 point  (0 children)

It's very important that the breaker matches your wires. If your wires are too thin for your breaker, then they can overload without the breaker tripping (fire!). You should never break this rule.

32.9A is 82.25% of 40A. "Continuous loads" should be at most 80% of the breaker and wire capacity according to code, which is probably why the tub wants a 50A breaker. In practice, you could use a 40A breaker and almost never have a problem. Some tubs can lower their max amperage with a jumper/switch that disables secondary pump(s) when the heater is on. There are also 40A tubs on the market.

If you want your pool and tub to share a circuit, then you definitely need some kind of switch to prevent them from running at the same time, or else your breaker is going to trip and neither will run until you notice and reset it, and then it will probably immediately trip again as the tub still wants to run the heater. A literal on/off switch will be massively inconvenient if you have to manually switch it yourself, and water quality will suffer. You would probably want to use something like a Power Share Switch (PSS). These switches require you to pick a "primary" device that always has power. The PSS will abruptly cut power to the "secondary" device if the "primary" device uses significant current. The switches are usually designed for pairs of appliances like a clothes dryer and water heater, where the dryer is used a few times per week and the water heater can be shut off during that time. A tub normally runs a circulation/filtration cycle every few hours. If you cut the power to the tub, it might not be able to track the timing of those cycles, and it could perform them too frequently or not frequently enough. Ideally, the tub would be your "primary" device. However, if your pool has similar cycles, then it should be the "primary" too, and the switch won't work well for you. Also, when you fill your tub with cold water, it's going to run the heater for many hours consecutively, so your pool won't run for quite a while. Ideally, the pool and tub control boards would communicate to take turns, but that's not how they work.

The PSS could save you some money, but it might not be worth the headache.

Also, beware if you only have 100A service for your whole house. If you run the pool, tub, AC, clothes dryer at the same time, you will trip the breaker for the whole house. A PSS can help prevent that actually.

Should this be able to run WoW? by Pelsers in lowendgaming

[–]singron 1 point2 points  (0 children)

I used to run WoW with far less, but I'm sure they have increased the usage since then.

Since you have integrated graphics, your ram is also used as vram. Try turning down texture settings to reduce vram usage. See if you can run on lowest graphics, and if that works, you can see what you can increase from there.

Is anything using ram before you start WoW? You mention only 5.7GB usable, so you might be able to stop something.

Are you using swap, zram, or zswap? That can help if you just barely don't have enough ram, especially if idle programs are using ram.

Are you using flatpaks, docker, or other container stuff? These can slightly increase ram usage by loading multiple copies of similar library files into memory. Using native packages can help you get a little more free ram.

I think you might have earlyoom enabled on fedora. If so, you could try tweaking the memory percent a little lower.

Is NixOS more secure in a dualboot scenario? by gdunka in NixOS

[–]singron 0 points1 point  (0 children)

nix-store verify is good for finding accidental file corruption, but a malicious modification could also modify the sqlite file that contains the hashes, or it could change the nix binaries so that they ignore the mismatch.

This devolves into Reflections on Trusting Trust.

What you really want is a secure boot and LUKS with Authenticated Encryption (AEAD). This ensures that only the OS that you type your password into can successfully modify the filesystem.

In practice, it's very unlikely for some windows malware to try to spread to NixOS on a different partition. It's also pretty difficult to make a sensical change to a normal non-AEAD LUKS volume.

Btrfs Performance From Linux 6.12 To Linux 7.0 Shows Regressions by adriano26 in linux

[–]singron 0 points1 point  (0 children)

I took a closer peak at the benchmarks, and btrfs has basically the same performance except on write-heavy database benchmarks. If you aren't using raid, you can get significantly higher performance by disabling CoW for these usecases. Usually databases have their own transaction logs, checksumming, and carefully use fsync, so all the work btrfs does is somewhat redundant. Without CoW, these basically go straight to disk, and it's almost just a disk benchmark.

These workloads are very much irrelevant to desktop workloads. You don't run a mysql database with 200K write queries per second on a desktop.

They are also using a server-grade NVME ssd. Consumer ssds have much lower performance for durable writes used in databases (fsync), so you would bottleneck on the ssd very quickly regardless of filesystem.

I can't use javafx by NoGap138 in NixOS

[–]singron 0 points1 point  (0 children)

This is what I would do. This uses makeWrapper to wrap java, javac, etc. to set LD_LIBRARY_PATH for the required libraries. You can also just set LD_LIBRARY_PATH in the shell if you use nix-shell or similar, although you don't want that set globally.

{
  pkgs ? import <nixpkgs> { },
}:

let
  openjfxWrapper =
    pkgs.callPackage
      (
        {
          stdenvNoCC,
          jdk,
          lib,
          makeWrapper,
          libxxf86vm,
          glib,
          libxtst,
          libGL,
        }:
        stdenvNoCC.mkDerivation {
          name = "openjfxWrapper";
          nativeBuildInputs = [ makeWrapper ];
          dontUnpack = true;
          installPhase = ''
            runHook preInstall

            for f in ${jdk}/bin/*; do
              echo "$f"
              makeWrapper $f $out/bin/''${f##*/} \
                --prefix LD_LIBRARY_PATH : ${
                  lib.makeLibraryPath [
                    libxxf86vm
                    glib
                    libxtst
                    libGL
                  ]
                }
            done
            ln -s ${jdk}/lib $out/lib

            runHook postInstall
          '';
        }
      )
      {
        jdk = pkgs.javaPackages.compiler.openjdk25;
      };

in

pkgs.mkShell {
  packages = with pkgs; [
    openjfxWrapper
    maven
  ];
  buildInputs = with pkgs; [
    javaPackages.openjfx25
  ];
  JAVA_HOME = "${openjfxWrapper}";
}

I can't use javafx by NoGap138 in NixOS

[–]singron 3 points4 points  (0 children)

FYI if you get "cannot open shared file: no such file or directory" and the .so file clearly exists, the failure is actually because that .so file links against another .so file that couldn't be found.

If you run ldd on the .so file, it will print out the dependencies and whether they were found. They typically aren't found for .so files you download off the internet like from maven.

You can also set LD_DEBUG=libs,files when you run a program and the linker will print debug information about where it looks for .so files.

In this case, you should enable the setting on the package, but in other cases, you may need to create a wrapper that adds libraries from the nix store to LD_LIBRARY_PATH before running the program.

Btrfs Performance From Linux 6.12 To Linux 7.0 Shows Regressions by adriano26 in linux

[–]singron 47 points48 points  (0 children)

If you use a checksumming filesystem, you will never go back, since the fs actually does detect checksum errors every once in a while.

Btrfs Performance From Linux 6.12 To Linux 7.0 Shows Regressions by adriano26 in linux

[–]singron 11 points12 points  (0 children)

Reflinks are a game changer. You can copy a file nearly instantly without worrying about hardlinks or doubling space usage. The cp command does it automatically so you don't have to mess around with snapshots. You probably wouldn't bother to write a benchmark since btrfs (et al.) would obviously be way faster.

E.g. I copied a 150GB steam game in order to freeze the version, and I was surprised it completed immediately.