“You can hold yourself back from the sufferings of the world, that is something you are free to do and it accords with your nature, but perhaps this very holding back is the one suffering you could avoid.” - Franz Kafka
This is from C++23, right? I wonder how available this is within compilers and how many shops plan on moving to this version of the standard and how long that will take.
I imagine targeting C++17 or 20 for 'modern' would be practical enough considering thats what you are most likely to run into in a professional setting.
In my understanding, with this specific feature, if you want a polyfill for older compilers, or to use some more cutting-edge features that haven't been standardized yet, https://github.com/fmtlib/fmt is available to you.
gcc 14 has not yet been released; going by past years, 14.1 should come out around the start of May (2024). clang 17 was released September (2023); note that you need to use libc++ (stlib=libc++), not libstdc++. VS 2022 17.7 has been out since August.
So iostreams were a mistake, they shouldn’t have happened in the first place. And given that they happened, std::format should have been added 20 years ago, or at least in C++11.
The problem is that many professional shops never used iostreams, and instead hand rolled their own format library. Now, they don’t really care about std::format, and probably will never use it, because it would involve migrating off of their hand rolled solution which is working great.
On the other hand, for small shops and hobbyists that don’t have the resources to reimplement std, this is a huge quality of life improvement. Meanwhile, more modern languages like Rust are encroaching.
And this is all just about how to print “Hello World!”. This situation is really emblematic of the challenges faced by the C++ committee. It is really impossible to please everyone, or even a majority, since the community is so fractured.
This is not about printing hello world but about all formatted I/O which is a significant chunk of the library. To be fair formatted I/O is pretty broken in C as well but for completely different reasons.
For git aliases you should definitely checkout alises[1] you can define in your global git config, ~/.gitconfig, and the fact git will let you define custom subcommand if you create a `git-foo` executable in your PATH, for example, create a executable shell file called, `git-foo` somewhere in your PATH and you can run it like `git foo`.
The Linux kernel received a new scheduler not too long ago (https://lwn.net/Articles/925371/), so I'm not sure how relevant the critiques about CFS are.
Interesting! I've used Linux Mint for the last 5+ years (and am using the Xanmod kernel, which is on 6.6), but have always been Pop OS curious. This increases my curiosity, I may have to give it a go on my laptop.
I could be wrong but I don't believe Renaissance Technologies makes their money picking individual stocks. My understanding is that they mostly make money with (statistical) arbitrage, market making, etc.
> A dumb phone - small and minimal functionality, easy to forget about
This requires more diligence, but can't you create the experience you want on a smart phone (no social media, disable all notifications, etc.) without giving up utilities that provide actual value, such as GPS / navigation?
> Exercise - no headphones, a gym provides background music and enough human contact to keep boredom at bay
Interesting. I feel like I am more distracted and unfocused when I listen to the gym's music (sometimes their music just doesn't match the intensity of the workout) or when I socialize between workouts.
GPS can be in not so malicious environment, I'm talking about separate GPS device instead of addictionful phone with no buttons, so-called smart but maybe not for end user's brain and free time.
To point 1, this almost feels like catch-22. While sleep may be a way to recover from stress, stress is probably the single thing that impacts my sleep the most (aside from alcohol consumption, which is much easier to control).
I had a year-long stretch averaging 4 hours of sleep daily that was extremely difficult.
Tried all of the regular remedies: diet, exercise, reading, prayer, habit changes. My doctor prescribed a medicine to help me calm down at night. That was the first thing that actually helped.
That kept going until I left a very stressful job and landed in a healthy environment with a different employer. I was able to stop the medicine after a couple of months.
All that to say, there are many methods that work for different people and situations. Don't discount speaking with a doctor or therapist, and don't continue through life with bad sleep. It's a really rough way to go.
If you can identify the thing(s) keeping you up at night, and if they're things in your control, consider making changes. Living without good sleep sucks. Do whatever it takes to get good sleep, even if it means big changes.
I was going to suggest that sleeping pills are a good way to re-establish good sleeping patterns. Set a strict sleep schedule, and then take the pills for a few days to a week in that schedule. Once you manage to sleep on this strict schedule for a few days your body's rhythms typically realign so you get sleepy on that schedule. Don't use the pills for extended periods though.
tl;dr - no, there are no solutions. If you cannot fix the source of stress then you’re fucked.
I also agree with the sentiment. Anytime my stress levels rise - my sleep goes back to shit. Is there a solution? Nope!
If you cannot fix the source of stress then you need to learn to embrace the madness. Learn to just accept you’re not getting more than 5 hours of sleep a night and you’ll be better off for it - instead of sitting in bed for 8-10 hours everyday and majority of it wishing you were asleep. Embrace the 2am fall asleep crash and the 6am wake up hustle.
Truly is a nightmare to live through but that’s life.
I've found with time that the easiest way to fall asleep is to try to meditate. Sit there or lay there in a quiet room and just watch your breath going in and out, not chastising yourself or getting frustrated when your mind inevitably wanders. Simply acknowledge that you've gone off track and come back to your breath. Normally in meditation, the goal isn't to fall asleep, but it is definitely something that you can let happen if you want to.
Yes. when you go to sleep don't put any pressure on yourself that you need to sleep X number of hrs or whatever. Just go to bed on regular schedule and be thankful for the amount of sleep you get, actual amount is irrelevant.
What helps me: write down a list of all the things going on, preferably pen on paper.. Allow yourself to do turn on the lights again and write additional stuff on it... Repeat until there's nothing more to write down.
You need to make a conscious effort to become better at managing your stress. When you notice your stress is peaking, try different techniques to relax yourself. Find out what works then you can make that a daily habit to reduce overall stress. Also need to train your mind to flip off the stress switch when it’s time to go to sleep.
It is actually something you can teach yourself to do.
It requires some practice, but the gist of it is to train awareness around your thoughts, and then to dispassionately label your thoughts when you find yourself stuck in a loop about something. Don't engage with them or try to fight them, just say "that's worrying" or or maybe if your source of stress is you're constantly try to solve all the world's problems, you say "I'm problem-solving".
It's important not to make it a struggle. Just label them over and over again. Two hundred times in an hour if that's what it takes.
If you do that over and over again, not only will it become easier each time to the point where it's almost like flipping a switch and your mind flushes all that crap like an airplane toilet and in the absence impressions of the world come rushing in, it becomes very clear how stuck in a bubble you were. Not only that, which is arguably a benefit in itself, you'll also find yourself stuck in those thought patterns less over time.
It depends on what is your main problem. Falling asleep? staying asleep? For the former using melatonin might help (I never use more than 0.5mg a night). I also find that podcasts help me fall asleep once I focus on listening. There are also specific meds that can help with stress which you can take when things are bad (e.g., lorazepam). Just having them by your side can help with your sleep since you know it's there in case you need it. Then of course, sport and meditation are great tools have better quality of life, not just better sleep.
What has helped me a lot: get plenty of sunlight; especially in the morning (very important to our biological clock), started taking probiotics once a day before a meal, I try to eat complex carbohydrates in the morning (fruits, vegetables, beans, seeds); which promotes good gut bacteria and more stable blood glucose levels, exercise every day, no caffeine 8 hours before bed, nothing but water 2-3 hours before bed and I take 10mg of Melatonin most nights before bed (sometimes 20mg).
That is likely way too much melatonin than is needed or helpful. Try taking 1 mg or even 0.5 mg a few hours before you want to fall asleep. Lots of easy to find evidence that common dosages are way too high. Typical person produces anywhere between 0.1 mg and 0.9 mg per day (varies strongly with age). Remember, absolutely none of the supplements in stores are regulated for safety, efficacy, or appropriate dosage levels.
If you do hard physical exercise (weight lifting, forget running), until you are dead tired, and stop drinking stimulants (coffee et al) then you will have good sleep. So simple.
The best way to have a good sleep is to stop being anxious and depressed, forget bad things, stay happy, be relaxed at evening, have a good hormonal profile, eat healthy, have a strict circadian discipline, a loving partner and live a nice live in general.
It was like that for me, until it wasn't. I am still weight lifting but my sleep is much worse if I push too much. Sleep issues are simple only until you have them.
Exercise and make it easy to do. I got a peloton bike and just made it a habit in the morning. I then eased into yoga at night.
When Covid hit, 4 kids home/remote job/divorce all hit at once. I have to do something hard enough that my brain can shut off worrying about the thing. Lizard brain has to be active enough to think threat is gone and shut off.
The hardest days for me are intentional rest days/weeks where I have to be mindful of not having that same release.
I find melatonin really useful, if that's something available where you live (its regulation varies radically between the US and Europe). I find it's best about 30 minutes before bed.
Almost everyone takes too much of it when they do. The actual recommended dose is very low. Efficacy rapidly declines with habitual usage, and effective utilization requires that you go to bed very soon after taking it (lights out, no screens, etc). This said, it can be a good short term solution for sleep issues.
Yes, I've heard that, but in my personal experience I find high doses (relative to the 0.3mg or whatever prescription quantity) effective, with no negative side effects, and I have suffered no loss of efficacy with habitual usage (years). YMMV, but it's certainly worth trying vs continuing to only sleep for four hours every night.
Doesn’t work on everyone. Tried it a couple of times, felt like stoned for six hours laying in darkness rethinking life choices. Probably circadic issue, idk, body scan works much better.
Benadryl (diphenhydramine)? It probably shouldn't be used for prolonged periods of time (associated with cognitive decline and dementia among the elderly).
Yeah the anticholinergic action has some association with dementia. Lots of medications have some kind of "Anticholinergic burden", drugs that cause low-level cognitive impairment, there's a list.
But I'm almost sure Benadryl isn't good for stress management on the simple basis that functioning cholinergic signaling is the inhibitory agent of the sympathetic nervous system. On any degree of anticholinergic effect you're more of in a flight-or-flight humor. This is apparent on acute effect (overdose,) the anticholinergic toxidrome symptomatology mnemonic goes like this: red as a beet, blind as a bat, mad as hatter, hot as a hare, dry as a bone - all something you could get with amphetamine (a dominant sympathetic nervous system). Do you reckon amphetamine relaxing?
Associated with cognitive decline could just indicate that the people using it are more sickly or have more trouble sleeping, both of which are more strongly correlated with cognitive decline.