• 0 Posts
  • 93 Comments
Joined 2 years ago
cake
Cake day: June 26th, 2023

help-circle







  • You’re largely correct, “decriminalized” doesn’t mean it’s legal, but I just wanted to point out that it doesn’t necessarily mean unenforced. Just that it’s no longer a criminal charge. Something can be decriminalized and still be in violation of the law and enforced with fines or other deterrents, e.g. traffic violations. You’re not a criminal for speeding, it’s still illegal and enforced.








  • C# .NET using reflection, integer underflow, and a touch of LINQ. Should work for all integer types. (edit: also works with char values)

    // this increments i
    private static T Increment<T>(T i)
    {
        var valType = typeof(T);
        var maxField = valType.GetField("MaxValue");
        var minField = valType.GetField("MinValue");
        if (maxField != null)
        {
            T maxValue = (T)maxField.GetValue(i);
            T minValue = (T)minField.GetValue(i);
    
            var methods = valType.GetTypeInfo().DeclaredMethods;
            var subMethod = methods.Where(m => m.Name.EndsWith("op_Subtraction")).First();
                   
            T interim = (T)subMethod.Invoke(
                null,
                [i, maxValue]);
    
            return (T)subMethod.Invoke(
                null, 
                [interim, minValue]);
        }
        throw new ArgumentException("Not incrementable.");
    }
    

  • vithigar@lemmy.catoScience Memes@mander.xyzWater
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    3 months ago

    “Observable universe” isn’t how much we can see, rather how much it is theoretically possible to observe by any physical means.

    I also don’t think that water drop fact is correct. The estimated number of stars in the observable universe is 10^24, which is about an order of magnitude more than 1 mol, and 1 mol of water is about 18g, which is quite a bit more than 10 drops.


  • I’m the primary developer for a third party tool for Elite Dangerous and this is basically my entire thought process when I want to work on it.

    I could work on Observatory…

    Or I could play some Elite…

    Or I could just stare at my screen ineffectually for several hours.

    Staring at the screen wins frighteningly often.