former inmate explains that anytime he was locked up he was only allowed a stubby little golf pencil to write with except when he stole a couple of ballpoint pens from a dentist. Another user reports being allowed very short pencils and up to two ballpoint pen inserts, but having to use a roll of paper with rubber bands to make the rest of the pen. A former prison guard says federal law (presumably in #USA) requires a minimum of a pencil. Another posts a picture of a transparent “flex pen” and says typewriters were available. #crime
in the #UK “All prisoners are allowed to own pens, pencils, sketch pads and scrapbooks, playing cards and jigsaws.” #crime
gangbanger who improvised a lot of weapons in prison reports that pencils are better than ballpoint pens for that purpose. The ballpoint pen inserts are more popular than pencils because they don’t need sharpening. #crime
#UK prisons also allow you to keep your wedding ring. #crime
how to make your custom container work with #ranges in #C++
Smart pointers in #C++ come from <memory>. #Tutorial shows examples with std::unique_ptr, which it recommends as the default choice for “POCO”. Never create them in a parameter list because it isn’t exception-safe. std::shared_ptr adds a reference count, and std::weak_ptr provides weak access to a shared_ptr object. #documentation
More detailed #tutorial #documentation about #C++ std::unique_ptr, for which it recommends using auto p1 = make_unique<Class>(ctor args); and auto p2 = std::move(p1);. Oh also apparently there's Java-like iteration syntax in C++ now: for (const auto& song : songs) {...}.
std::make_unique is the easiest way to make a unique_ptr in #C++. Also one of the examples says the boring constructor for an example struct is “no longer needed since C++20”. #documentation
C-style aggregate initialization in #C++ is allowed for certain class types, but the rules have changed over time and got significantly (mostly) looser in C++14, C++17, and C++20, base classes, and default member initializers, but still no user-declared or inherited constructors, virtual member functions (!), virtual base classes, private or protected direct base classes, or private or protected direct non-static data members. Apparently non-constructor non-virtual member functions have always been allowed. Public direct base classes are treated like members. Also C-style designated initializers were added in C++20. And the = is optional since C++11.
complaint that #C++ aggregate initialization is not allowed if you have constructors, but you can use the static “named constructor” idiom, or you can create an implicit type-conversion constructor from another type that is a mere aggregate and use double curly braces. Apparently C++ is smart enough to interpret your {{.y=1}} as the type that there’s a type-conversion constructor for.
more discussion of the #C++ aggregateness rules.
11-page #PDF #paper proposing a #C++ aggregate initialization change in C++20
apparently #EU people can buy #USA ETFs via options on IB despite the PRIIPs regulations #finance
apparently if you’re returning a pointer to an object you continue to manage the lifetime of, you should just return a raw pointer in #C++ rather than a smart pointer
#Nighthawk #video about DIY salt-based thermal phase-change #energy-storage. He’s using food-grade sodium sulfate in what looks like a fertilizer bag but is probably actually being sold as a phase-change material by Duda Energy, then mixing it with sodium chloride to approach the eutectic of the ternary system with water; he says 1.2ℓ water, 240mℓ of (presumably hydrated) sodium sulfate, and 60mℓ of sodium chloride melts at 18°. He says actually it has “multiple melting points” so it probably melts incongruently, giving rise to phase separation through repeated freezing; he suggests that gelling it with carboxymethylcellulose or xanthan gum (his choice) will solve that problem. He suggests sealing it in reusable silicone sandwich bags for use, which you can fit into the pockets of an ice vest. He seems to have measured it supercooling to 9°, then heating back up to 18° when it suddenly freezes, and then a second phase transition at -8°. He made a PCM blanket by soaking a towel in the gel and rolling it up inside a garbage bag, which seems like it would be a good approach to preventing leaks. He heat-sealed the edge of the garbage bag with a butane hand torch. #energy
#tutorial #video #toread on #Godot dedicated server executables (I guess ones that don’t require a GUI) but it’s a #BatteryAcidDev video so it's probably half talking head footage
#CodingAdventure #video #toread #tutorial on raymarching #graphics
Russian propaganda (?) #video #toread to scare people away from fighting in #Ukraine
#video #toread about raytracing #graphics from two-minute papers
Russian propaganda (?) #video #toread about #Houthis sinking a Red Sea ship full of drone #weaponry
#video about #C++ constexpr and #performance by #Daves-Garage (Dave Plummer) using a sieve of Eratosthenes example
#video #toread from the Sun about NATO tank #weaponry in #Ukraine
aha, #C++ since C++11 now has the Java-like for (auto flust : flusts) { ... } syntax. It uses the preincrement operator to increment the iterator, != to test for termination, and flusts.begin() and flusts.end() for the bounds, or if those aren’t found, begin(flusts) and end(flusts) (plus there’s a special case to let flusts be a bare array). The flusts expression lives until the end of the loop, but temporaries within it don’t (except in C++23). But until C++17 you couldn’t iterate over a nul-terminated string with this syntax without defining a special iterator for it. #documentation
Microsoft's #tutorial #documentation for #C++’s new (as of 13 years ago) range-based for statement. Recommends for (const auto& y : x) or, when necessary, the non-const version.
#video channel on things like microwave oven transformers, rocket fuel, microinverters, ammonia cars, iron powder fuel, etc. #toread
is maybe the best introductory #tutorial link for #Hypothesis #documentation #PBT
maybe this is the best introductory #tutorial link for #Hypothesis #documentation #PBT
famous #paper on evidence-based #medicine #research: “Parachute use to prevent death and major trauma related to gravitational challenge: systematic review of randomised controlled trials”
apparently #GCC 14.1 includes a #Rust frontend from the #gccrs project
in #C++ you can use HUGE_VAL from <cmath> for double-floating-point infinity.
list of “modern” #C++ features: smart pointers, STL containers and algorithms, <string> (and string_view), type inference (“deduction”), range-based for, constexpr, initializer lists for vectors, move semantics, lambda expressions, exceptions, std::atomic, and something called std::variant
Leonardo de Moura’s #tutorial #documentation #introduction to #Z3 in Python. It starts out focusing on things like integers, real numbers, and arbitrary precision, but then moves on to bitvectors, bit-twiddling hacks, sudoku, N-queens, and package management. #SAT #SMT
#Z3 #tutorial #documentation that covers things like validating numerical approximation algorithms and training neural networks with it #SAT #SMT
the main #documentation on how to use #Z3, including for #optimization #SAT #SMT
#PDF #ebook “#SAT/#SMT by Example” by Dennis Yurichev, 671 pp. “The author of these lines is no expert in SAT/SMT, by any means. This is not a book, rather a student’s notes.” A very extensive set of examples; the English isn’t perfect but generally is comprehensible. #toread