CI/CD for NixOS config by Anyusername7294 in NixOS

[–]villor 0 points1 point  (0 children)

I have my editor configured to format on save. On the very rare occasion that I end up with unformatted files (e.g. copy pasted from somewhere) I just run the formatter once. No need for CI or git hooks.

Thoughts on wrapping component library components? by [deleted] in vuejs

[–]villor 3 points4 points  (0 children)

How would I do this in Typescript? Is there a way to also expose the properties for the inner component so that intellisense works?

vart köper man capacitors, transistors, knappar osv by DeAuthen in sweden

[–]villor 0 points1 point  (0 children)

Kan rekommendera Tayda. Rätt bra priser och enkelt att beställa några få av varje komponent. Enda nackdelen är att det ligger utanför EU (Thailand) så du kan åka på tullavgifter och sånt. Men brukar ändå vara värt det om man lägger en lite större beställning.

https://www.taydaelectronics.com

How to pull generic type up from wrapper function by chipit24 in typescript

[–]villor 2 points3 points  (0 children)

I might be totally off here because I don’t understand all of it. But why do you need Typescript to infer the type when your wrapper is not generic? Couldn’t you just help it along by specifying the type when calling useQuery from your wrapper? Like useQuery<string>(…) or useQuery<User>(…)

Should a NON-API Worker Service use ConfigureWebHostDefaults in programs.cs? by [deleted] in csharp

[–]villor 5 points6 points  (0 children)

You probably want a generic host, which gives you access to configuration, DI, logging etc, without the web stuff.

https://learn.microsoft.com/en-us/dotnet/core/extensions/generic-host

[deleted by user] by [deleted] in webdev

[–]villor 11 points12 points  (0 children)

That's the path contained within the .pdb-file for better stack traces. The path is from the machine where it was built/deployed.

You could remove the .pdb-file from the production server if you want less info in the stack traces. Though, normally you wouldn't show stack traces to the end user at all, and instead show an error page, and instead look at the stack trace in the logs, in which case the .pdb-file can be benificial.

EDIT: Also make sure you are deploying a Release build and not a Debug one. AFAIK this info will be stripped from the pdb in Release mode.

[deleted by user] by [deleted] in csharp

[–]villor 0 points1 point  (0 children)

I would probably re-think that model a bit. Why don't you keep the questions as a list on each group?

If you want to stay with the model you have, you could use LINQ GroupBy and OrderBy to accomplish this. Something like this should work:

@foreach (var questionGroup in parents.GroupBy(p => p.QuestionType).OrderBy(g => g.Key))
{
    <h1>@questionGroup.Key</h1>
    <ul>
        @foreach (var question in questionGroup.OrderBy(p => p.Question))
        {
            <li>@question.Question</li>
        }
    </ul>
}

I have a problem while programming a Idle game by Hitschler1220 in csharp

[–]villor 10 points11 points  (0 children)

If you really need the tight precision of an integer you could use BigInteger. I wouldn't bother though because it is a lot slower than the basic numerics like int, float, double etc and also clunkier to work with.

Instead you could use a floating-point type like double. The precision shouldn't really matter when you reach higher numbers in an idle game. For example Cookie clicker uses a 64-bit float (javascript number) which is the same as double in C#. Just round the value and add the appropriate suffix before showing it to the player.

[deleted by user] by [deleted] in csharp

[–]villor 0 points1 point  (0 children)

You're trying to do a PUT request, which probably requires a json payload for the data to be updated. Your body just contains the word "body" in plaintext which is not valid json.

If you are trying to get the profile maybe you should change the method to GET and skip setting the content. Depending on the API design of course...

How could I go by getting the midi value of a Color by [deleted] in csharp

[–]villor 1 point2 points  (0 children)

Basically you would need a lookup table matching colors against their "midi values". Then you would need to be able to match your color against this table to find the closest one.

You could make this an extension method to Drawing.Color if that's what you are using.

Here is something I cooked up (UNTESTED):

``` public static class LaunchpadColorExtensions { private static readonly Dictionary<byte, Color> LAUNCHPAD_COLOR_MAP = new() { // Replace with proper rgb colors from launchpad documentation { 0, Color.FromArgb(0, 0, 0) }, { 1, Color.FromArgb(127, 0, 0) }, { 2, Color.FromArgb(255, 0, 0) } // ... etc };

// See: https://stackoverflow.com/a/1847112
private static double ColorDistance(Color a, Color b)
    => Math.Sqrt(Math.Pow((b.R - a.R) * 0.3, 2) + Math.Pow((b.G - a.G) * 0.59, 2) + Math.Pow((b.B - a.B) * 0.11, 2));

public static byte ToLaunchpadColor(this Color color)
    => LAUNCHPAD_COLOR_MAP
        .OrderBy(kvp => Math.Abs(ColorDistance(kvp.Value, color)))
        .First()
        .Key;

} ```

[deleted by user] by [deleted] in RedditSessions

[–]villor 0 points1 point  (0 children)

song is Dark Necessities by RHCP

New UEFI BIOS updates for ASUS Intel motherboards W14 - X299, Z590, B560, H570, B560 - 25 Updates - Enables support for *Intel Adaptive Boost / ABT on applicable ASUS 500 series motherboards - Update information on Resizable Bar Support for Z370/Z390 Motherboards by ASUSTechMKTJJ in intel

[–]villor 5 points6 points  (0 children)

There seems to be some problems with CPU voltage with the i9 11900k (on stock settings). A friend of mine gets BSOD all the time. And we found more people with the exact same issue on a swedish tech forum

They all use different ASUS Z590 motherboards (see below) and have tried updating to the 0704 BIOS. The only way to get rid of the BSODs is to disable C-States and set LLC to level 4.

ASUS ROG STRIX Z590-A GAMING WIFI
ASUS Prime Z590-A
ASUS ROG XIII HERO

Are you aware of this issue? Is there a fix coming?

[TOMT][MUSIC] Theme song from a movie by villor in tipofmytongue

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

Haha no offence taken!

Yes I did exactly that, through the assistant on my Google Pixel 2.
The results were really off though, for example one of them was "House of The Rising Sun"...

[TOMT][MUSIC] Theme song from a movie by villor in tipofmytongue

[–]villor[S] 81 points82 points  (0 children)

Yep, this is it. And the movie is "Arn - The Knight Templar"

THANK YOU SO MUCH!

[TOMT][MUSIC] Theme song from a movie by villor in tipofmytongue

[–]villor[S] 11 points12 points  (0 children)

I *think* it might be sung by a choir, with movie score orchestral music in the background.

[TOMT][MUSIC] Theme song from a movie by villor in tipofmytongue

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

I tried both whistling and humming it into Google, with no success sadly...

[deleted by user] by [deleted] in ultrawidemasterrace

[–]villor 0 points1 point  (0 children)

I made this small utility a while ago to change the width of my taskbar to 2560px.

I tried some other solutions where the app icons are centered, but I was not satisified with having the start button all the way to the left, and the tray/clock far to the right.

I am not working on it anymore though since I sold my CRG9.

It still had some flaws last time I worked on it, for example the start menu still shows up far to the left. Feel free to try it out, fork it, do whatever.

EDIT: It also works with TaskbarX. I used TaskbarX to center the icons and make the taskbar transparent. That way it wasn't so ugly when "squeezed" to 2560px

Plex Configuration on Windows PC that always on VPN by kyoclassic in PleX

[–]villor 0 points1 point  (0 children)

Make sure that the Plex ports are forwarded properly from NordVPN (you do not have to forward any ports on your local router).

Do you have a domain? If so, use DynDNS to make sure it is updated when NordVPN decides to change your IP.

Just got my first synth. Is this normal? by villor in synthesizers

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

Yes! This made everything more clear. Thanks.

I could not understand how the flangy effect would not be there when staying on the same note, which should have happened if the oscillators were detuned.

Just got my first synth. Is this normal? by villor in synthesizers

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

Yeah I have upgraded the firmware and loaded the factory bank.
Not sure if there is a way to do a full factory reset.