TwilightKiddy

joined 1 year ago
[–] TwilightKiddy 5 points 4 months ago* (last edited 4 months ago) (2 children)

I don't believe the first code sample is a valid C# code. Switch-case statements expect constants for case conditions and runtime types are not constants, obviously. What you can do is something like this:

void MyMethod(object arg)
{
    if (arg.GetType() == typeof(int))
        MyTypedMethod((int)arg);
    else if (arg.GetType() == typeof(int?))
        MyTypedMethod((int?)arg);
    else if (arg.GetType() == typeof(long))
        MyTypedMethod((long)arg);
}

This will work, but the problem here is that inheritance will fuck you up. All the types we check in this example are sealed and we don't really have to worry about it in this case, but generally this code is... just bad.

And yes, the correct way of implementing something like this is by using generic types. Starting from C# 7.0 we have this cool structure:

void MyMethod<T>(T arg)
{
    switch (arg)
    {
        case null:
            // Do something with null
            break;
        case int intArg:
            // Do something with intArg
            break;
        case long longArg:
            // Do something with longArg
            break;
    }
}

You'll have to check for null separately, as you can't use Nullable<> there, but overall, it looks much cleaner and handles inheritance properly for you.

This is called pattern matching, you can read more about it here: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/patterns

[–] TwilightKiddy 2 points 4 months ago (1 children)

You can use any redirecting extension, if it does not support FreeTube directly, just make it open freetube://<youtube link>.

[–] TwilightKiddy 3 points 5 months ago

I think it's around 9:04 of 7th episode.

[–] TwilightKiddy 76 points 5 months ago (2 children)

It's just a domain name, it has nothing to do with sites being safe. Just as any other site, they may be malicious, may be not, depends on who runs the site.

[–] TwilightKiddy 1 points 5 months ago (1 children)

Well, it's easy enough if you only use precompiled packages. Beyond that you should probably have a better understanding of what you are doing.

[–] TwilightKiddy 7 points 5 months ago (1 children)

Arch with extra steps, AKA CachyOS.

[–] TwilightKiddy 3 points 5 months ago (1 children)

I like to be a bit more explicit than necessary.

[–] TwilightKiddy 1 points 5 months ago (11 children)

paru -Syu, you don't want to forget your AUR packages, right?

[–] TwilightKiddy 5 points 5 months ago

Pay with Monero, set up a VPN, buy a phone specifically for the service. I doubt you can get any more anonymous than that. Cellular networks are by default monitored by governments, there is nothing a provider can do about it. But encrypting the traffic and getting a new phone should make that type of monitoring relatively useless. And if you never give your identity to the provider, they simply can't know who you are.

[–] TwilightKiddy 1 points 5 months ago (1 children)

I guess I'll just add you guys to the "overzealous Witcher fans" and consider my point valid.

[–] TwilightKiddy 2 points 5 months ago* (last edited 5 months ago) (4 children)

Yea, Croatia is the only place it got widely used. Is it some kind of historical elective course in Croatian schools? Been a coupe of times in Croatia, never seen Glagolitic in the wild, though. Maybe wasn't looking good enough.

[–] TwilightKiddy 4 points 5 months ago

There is no single person responsible for Cyrillic script. It is mostly believed to be created by mixing and changing Greek and Glagolic scripts by the scholars of Preslav Literary School, which was indeed in Bulgaria. After a while, Peter the Great changed it a lot. And then Stalin stomped out almost all the deviations in the usage of the script.

The last part is mostly why it is considered Russian. A lot of languages suffered because of Moscow just forcing them to use the version of Cyrillic that Russians were using.

view more: ‹ prev next ›