C++ motivational thread

I did pick up stuff yesterday (according to i-mask protocol https://covid19criticalcare.com/covid-19-protocols/i-mask-plus-protocol/), but this morning symptoms feel so much less than yesterday that I’m not going to bother. Call me crazy, but I prefer not to take anything that I don’t absolutely have to.

No headache for me. I did feel a little pressure in my head yesterday, approaching what could have turned into a very mild headache. But it never really got there fully.

Also, around sites where I have had muscle aches I have had very mild and very short-lived sharp pains which have felt to be in my muscles or veins. Maybe one will come up every few hours and stay around for a minute or so. But there has been enough of them that I took notice of it, just because it is unusual.

The last I read around 20% of people get fever + gastro symptoms with no headache, sore throat or cough. That the flava we all got back in Mar/Apr 2020 or whenever it was, didn’t think it was the 'vid at the time but haven’t had it since. A tiny dot of evidence to the O.G. brand giving immunity to all descendants including the 2nd lab attempt, Omicron.

Me three. My father as a boy in a large family slept on an open verandah with slightly sub zero C° winter temperatures and neither he nor his several brothers ever got colds or flu. They grew most of their own food, almost entirely self sufficient in organic produce, no chemicals. He had a flu shot when a bad flu was going around decades ago but claimed it gave him the flu. Of course it might have been that the shot simply wasn’t effective against the flu he would have gotten anyway but it’s a circumstantial evidence thing that though they were relatively poor they had very few health issues at all and a cold was extremely rare among them.

I was reading and watching about keeping sheep recently, and the wisdom seemed to be that when sheltering them they are much more prone to disease than when not sheltering them, even for breeds which are highly resistant to typical diseases among sheep. And that seemed to be the same sentiment for livestock in general. Don’t keep them in one place for too long, or coming back to the same place on a regular basis. And don’t keep them sheltered. I would say that there is likely something in spending plenty of time outdoors. I haven’t been doing that at home lately because of 95F temperatures and 50-60% humidity due to heavy rains recently.

That would be close to a climate lockdown if you were in France!

Summers are almost always blazing here. Next month will be the hottest. At the old place there was a covered patio on a slab that stayed shaded through the day. And I was good spending most time at home out there, even in 95F weather. The slab tended to say relatively cool and I was always barefoot out there + shaded all day.

I don’t know how I’d be in that climate, I’m more of a 25 celsius kind of guy. It’s one thing going on holiday to a hot place, but dunno about living there. But then again, a lot of places with hot summers have really cold winters, which is nice. Not enough variation from winter to summer here.

A book exercise to make a square function with repeated addition. Pretty slow moving today. I feel a bit foggy. Supposedly this was the first function ever (sub-routine squaring numbers by repeated addition) by David Wheeler, who invented the computer function (sub-routine) before there was hardware with multiplication facilities.

double sq(double x)
{
	double orig = x;  // Original value of x
	for(int i = x; i > 1; i-=1)
		x+=orig;

	return x;
}

Winters are usually pretty mild here. Sometimes we get down to the teens (F) for some weeks in January and Febuary, but not always.

On to vectors. Seems like a useful bit to remember.

// Input loop
double temp;
while(cin >> temp)
	temps.push_back(temp)

// For loop allows for limiting scope of 'temp' variable
for(double temp; cin >> temp;) // Note trailing semi-colon
	temps.push_back(temp)

// Probably bad practice using 'temp and 'temps' here

When I eventually arrive at that point, something that I really want to make is a free-form notepad. Free-form pages (you define where each page ends) with available text boxes, vector drawing boxes, media boxes, calculations/graphing boxes, where each box is saved as a separate file and type, and the main file describes the layout. Something like a mashup between a word doc and html page underneath I suppose, but more configurable and driven by shortcut keys and mouse. Collaboration and automatic document versions would be nice too. It’s a long way from here though.

Got the PCR result back. Negative. Any thoughts on that? Same symptoms (except headache) as someone who was in my contact chain, who tested positive.

Vectors are pretty much the go to container in C++ land… it’s all profit and chicks from this point in the book onward. :smiley:

Weird about the 'vid, maybe the other one had a false positive, you had a false negative or just had another bug.

Yea, who the hell really knows at this point. At least my heart isn’t fucked up from a vaccine.

There must be a lot of looming mental health issues too, associated with the vaxxed and the sudden Sudden Adult Death Syndrome.

There’s been at least one other US star athlete besides Swanigan who very recently and inexplicably died age 26. This guy, Jaylon Ferguson, found dead in his apartment, “natural causes”.

Sorry, didn’t mean to divert from this grouse [very good] tech thread, I’ll leave it at this and post in the relevant threads from now on, cheers.

https://www.google.com/search?ie=UTF-8&client=ms-android-samsung-rvo1&source=android-browser&q=Ferguson+dead

https://www.google.com/search?ie=UTF-8&client=ms-android-samsung-rvo1&source=android-browser&q=swanigan

https://www.techarp.com/science/caleb-swanigan-die-covid-vaccine/

Yea, the higher possibility of death is not a good tradeoff to me to get vaccinated.

Found out that my girlfriend’s brother and his girlfriend also have same symptoms + vomiting. They were also in the contact with her kid sister and mom.

Book example:

#include "std_lib_facilities.h"

int main()
{

	// Reads words from input
	vector<string>words;
	for(string temp; cin >> temp)
		words.push_back(temp);
	cout << "Number of words: " << words.size() << '\n';

	// Sorts words in vector 'words'
	sort(words);
		
	// Prints words
	for(int i = 0; i < words.size(); ++i)
		if (i == 0 || words[i-1]!=words[i]) // A little hairy; checks that word is new
			cout << words[i] << "\n";

	return 0;	
}

That ‘if’ line looked hairy at first. i == 0 takes care of the first word being printed, because of the next part of the line. And words[i-1]!=words[i] checks that the previous word isn’t the same as the first next. If it is, that part causes the ‘if’ to skip printing the current word (unless the first word is in element 0). Just typing out loud here to maybe glue it in my brain.

That’s for loop is a classic problem of iterating over something of an unknown size and having to check the previous (or next) things.

The indexes go from 0 to sizeofcontainer - 1. So in that loop we check for word != lastword, where the index of the last word would be an invalid -1 if we didn’t skip past the index 0.

In this example we could start counting from 1: for (int i = 1; etcetc) and then omit the i == 0 check which would work in every case except where the size of the container itself happens to be zero (because the starting 1 is then an invalid index). So we’d have to check for that first, but only once before we start looping which is better if we imagined it’s 100,000,000 or whatever words being checked.

These are small problems you encounter over and over!

I’m adding these sorts of things to my notes in case I forget. I have definitely forgotten a lot in a few years! But regularly using this stuff seems to be what makes it stick most, which I obviously haven’t done. At the end of the chapter now, up to the drills, review, and exercises. After doing that stuff, it feels like time to do some rewriting of notes and writing some more small programs to help consolidate things up to this point.

Comparing vectors. Lost my shoes in the mud for a while this morning on this one. It looks so simple now, after the fact. And it looked so simple before beginning it.

#include "std_lib_facilities.h"
// Cancel unapproved words

int main()
{
	vector<string>submissions;
	vector<string>unapproved = {"covid","woman","think","rebel"};

	// Get words from input and store in vector 'submissions'
	cout << "Submit some words to the thought police for approval (Ctrl+D to end input):\n";
	for(string word; cin >> word;)
		submissions.push_back(word);

	// Iterate through 'submissions'
	cout << "\nHere are your approved words, citizen:\n";
	for(int i = 0; i < submissions.size(); ++i){
		string current = submissions[i];

		//Check current 'submission' against all of 'unapproved' (iterate through 'unapproved')
		for(int j = 0; j < unapproved.size(); ++j){
			if(current != unapproved[j]){
			}
			else if(current == unapproved[j])
				submissions[i] = "CANCELLED";
		}

		cout << submissions[i] << '\n';
	}

	return 0;	
}
1 Like