• 0 Posts
  • 113 Comments
Joined 2 years ago
cake
Cake day: August 2nd, 2023

help-circle



  • And memory bugs are only a subset of bugs that can be exploited in a program. Pretending Rust means no more exploitation is stupid.

    This is facile.

    According to Microsoft, about 70% of security bugs they see are memory safety issues.

    Yes: if you introduce memory safety, there’s still those 30% of security bugs left. But, well, I’d rather worry about 30% of issues than 100%…

    Similarly, I use libraries that eliminate SQL injections unless you really go out of your way.



  • Pipoca@lemmy.worldtoCool Guides@lemmy.caThe lethal doses of 55 substances
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    1 year ago

    More than 1200 mg of pure THC, or 1200mg of cannabis leaves?

    Those aren’t even remotely the same thing, in the same way that 12oz of beer and 12oz of everclear are very different, or 1g of pure nicotine is very different than 1g of tobacco leaves.

    Not to mention, LD50 is about a single dose. There’s a big difference between taking one shot an hour for 16 hours straight, and chugging 16 shots in one go.


  • 16.5 mg is 16500 μg. So a 70kg person would need over 1 million μg.

    According to https://www.trippingly.net/lsd/the-lsd-dosage-guide, 25 μg is where visual effects start.

    700 to 1000 μg. Full out-of-body experiences. Synesthesia more likely. Religious imagery often strong. Entire loss of rationality, lack of ability to walk or interact in any meaningful way.

    1500 μgs+ Experiences may be similar to DMT but extended. Basic body functions are challenging. Vision is consumed by hallucinations. No sense of self remains. Audio hallucinations may be strong. Standard reality no longer applies. Merging with objects likely. No type of rational thought left.

    A deadly dose is around 800x higher than that. You wouldn’t be as high as a kite. You’d be as high as Voyager one.


  • Also: notice the LD50 for vitamin D is 37mg/kg.

    Based on https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8709011/, a therapeutic regime for very low vitamin D levels is taking 6k IU per day for 3 months, or 50k IU once a week for 2 months.

    1 IU is 0.025 μg, or 0.000025 mg. 50k IU is 1.25 mg.

    I buy bottles of 5k IU vitamin D pills. Each bottle has 90 pills. That’s 11.25 mg of vitamin D per bottle. I’d need to take well over 200 bottles of these pills to have a 50% chance of dying.

    Yes, an objectively small amount of purified vitamin D will kill you. But it’s quite safe in practice because the environment only has objectively tiny amounts of the stuff. Even high dose pills contain a tiny amount of the stuff.


  • Pipoca@lemmy.worldtoCool Guides@lemmy.caThe lethal doses of 55 substances
    link
    fedilink
    English
    arrow-up
    20
    arrow-down
    1
    ·
    1 year ago

    Keep in mind: a single extra strength Tylenol is 500mg. A standard dose for a headache is 2 pills, or 1000mg.

    Weed gummies come in doses of 1mg to 100mg. 1mg is a microdose people might take for mild pain or stress, while 50+mg is a dose for cancer patients often take. A standard dose for occasional recreational highs is 5mg; they recommend first timers start at 2.5mg.

    LD50 compares things by weight, rather than dose. By weight, THC is slightly more toxic than acetaminophen. But in terms of the number of therapeutic doses it takes to kill you, it’s way, way safer.


  • LD50 is usually determined using rodent studies. How much Vitamin D causes an overdose in half of a population of mice?

    The dose makes the poison.

    And with drug safety, in practice LD50 is less important than how close a therapeutic dose is to a lethal one. If a drug takes 2g/kg to kill you but you need 1g/kg to work, that’s way more dangerous than one that takes .02g/kg to kill you but only needs .0002g/kg to work.





  • Symbols display with friendly string-y names in a number of languages. Clojure, for example, has a symbol type.

    And a number of languages display friendly strings for enumy things - Scala, Haskell, and Rust spring to mind.

    The problem with strings over enums with a nice debugging display is that the string type is too wide. Strings don’t tell you what values are valid, strings don’t catch typos at compile time, and they’re murder when refactoring.

    Clojure symbols are good at differentiation between symbolly things and strings, though they don’t catch typos.

    The other problem the article mentions is strings over a proper struct/adt/class hierarchy is that strings don’t really have any structure to them. Concatenating strings is brittle compared to building up an AST then rendering it at the end.

    Edit: autocorrect messed a few things up I didn’t catch.





  • Javascript is generally considered OOP, but classes weren’t widely available till 2017.

    Inheritance isn’t fundamental to OOP, and neither are interfaces. You can have a duck- typed OOP language without inheritance, although I don’t know of any off the top of my head.

    Honestly, the more fundamental thing about OOP is that it’s a programming style built around objects. Sometimes OO languages are class based, or duck typing based, etc. But you’ll always have your data carrying around it’s behavior at runtime.


  • If you’d like to look up more about the origins of PIE, look up the Kurgan Hypothesis, which suggests that Proto-Indoeuropean originated on the steppes.

    Basically everything we know about PIE, we know from looking at its descendants. If a word appears in multiple unrelated branches, it’s probably from the common ancestor. Particularly if there’s consistent sound changes on one or more branches.

    For example, it seems that a lot of PIE words with a p morphed into f in germanic languages. So, given the English father, Dutch Vader, Old Saxon fadar, Latin pater, Sanskrit pitar, Old Persian pita, etc. we can figure out that father goes back to some original PIE word which was probably something like pəter.

    Similarly, we see similar words for salmon both in Germanic and Slavic. And in the extinct Tocharian language, the word for fish in general was laks. Lox originating only 1500 years ago means that the Slavic and Tocharian would be a pretty strange coincidence.


  • keeping state (data) and behavior (functions) that operate on that state, together

    Importantly, that’s “together at runtime”, not in terms of code organization. One of the important things about an object is that it has dynamic dispatch. Your object is a pointer both to the data itself and to the implementation that works on that data.

    There’s a similar idea that’s a bit different that you see in Haskell, Scala, and Rust - what Haskell calls type classes. Rust gives it a veneer of OO syntax, but the semantics themselves are interestingly different.

    In particular, the key of type classes is keeping data and behavior separate. The language itself is responsible for automagically passing in the behavior.

    So in Scala, you could do something like

    def sum[A](values: List[A])(implicit numDict: Num[A]) = values.fold(numDict.+)(numDict.zero)
    

    Or

    def sum[A: Num](values: List[A]) = values.fold(_ + _)(zero)
    

    Given a Num typeclass that encapsulates numeric operations. There’s a few important differences:

    1. All of the items of that list have to be the same type of number - they’re all Ints or all Doubles or something

    2. It’s a list of primitive numbers and the implementation is kept separate - no need for boxing and unboxing.

    3. Even if that list is empty, you still have access to the implementation, so you can return a type-appropriate zero value

    4. Generic types can conditionally implement a typeclass. For example, you can make an Eq instance for List[A] if A has an Eq instance. So you can compare List[Int] for equality, but not List[Int => Int].