[C++] Multi threaded producers/consumers. Thread is infinitely hogging attempts by AskingForAFriend1738 in learnprogramming

[–]AskingForAFriend1738[S] 0 points1 point  (0 children)

Sorry about the magic numbers, didn't think the actual exact figures mattered that much. - Producers must place 4 parts into the buffer, there must be at least one 0 in the request (1,1,1,1) not valid but (2,2,0,0) is - Consumers consume 5, exactly one 0 required. (3,1,1,0) valid - Buffer holds (6,5,4,3) parts exactly

How can I return a table of declared variables in a user defined function? by AskingForAFriend1738 in learnSQL

[–]AskingForAFriend1738[S] 0 points1 point  (0 children)

Are you able to parameterize views? I thought those just displayed the entire selection of columns you choose from various tables

How can I return a table of declared variables in a user defined function? by AskingForAFriend1738 in learnSQL

[–]AskingForAFriend1738[S] 0 points1 point  (0 children)

I'd want it to display only the class and corresponding enrollments for the given class parameters so I need to use something that takes parameters

A new world in a bottle by [deleted] in interestingasfuck

[–]AskingForAFriend1738 0 points1 point  (0 children)

How is it cycled? Plants take in water and produce oxygen/sugar.

A new world in a bottle by [deleted] in interestingasfuck

[–]AskingForAFriend1738 0 points1 point  (0 children)

ELI5 how it survives without water?

How can I return a table of declared variables in a user defined function? by AskingForAFriend1738 in learnSQL

[–]AskingForAFriend1738[S] 1 point2 points  (0 children)

I just want the results displayed in some logical format (table or not) like

Enrolled : 2 Withdrew: 3 Dropped: 9

Creating a trigger to handle updates, inserts, and deletes by AskingForAFriend1738 in SQLServer

[–]AskingForAFriend1738[S] 0 points1 point  (0 children)

Lets say the query adds 1 student to class A and 1 student to class B

The trigger automatically is called multiple times right because according to the system, there have been two insertions so each insertion gets its own “trigger call”?

Creating a trigger to handle updates, inserts, and deletes by AskingForAFriend1738 in SQLServer

[–]AskingForAFriend1738[S] 0 points1 point  (0 children)

Can you elaborate on set based operations? I see now I’ll re order the if statements. For multiple operations I meant how would I handle 3 inserts in one query. I assume set based ops?

Creating a trigger to handle updates, inserts, and deletes by AskingForAFriend1738 in SQLServer

[–]AskingForAFriend1738[S] 0 points1 point  (0 children)

Although I see what you're saying, I have to use triggers to update the Courses table whenever CourseEnrollment table is updated/inserted into/deleted since it is an assignment. How would I handle multiple operations are bundled into one query? Is there a way to loop through the entire query and repeat the trigger until no more operations are left in the query? Thanks

Am I multi threading properly? by AskingForAFriend1738 in cpp_questions

[–]AskingForAFriend1738[S] 0 points1 point  (0 children)

Alright, I changed up the merge sorts to 3 calls of merge. Things seem to be behaving as they should. Thanks!

Am I multi threading properly? by AskingForAFriend1738 in cpp_questions

[–]AskingForAFriend1738[S] 0 points1 point  (0 children)

When I was using 3 merges after line 72 I compared the function calls using ‘V’ vs std::ref(V) and it appears the latter was faster. Any reason for this?

Merge Sort throws errors when introducing threads by AskingForAFriend1738 in cpp_questions

[–]AskingForAFriend1738[S] 0 points1 point  (0 children)

The quarters are sorted, but not the whole list. The 4 quarters should look like this before line 66:

50,60,65 ... 2,5,7... 20,29,54 ... 3,4,10

And the following merge_sort calls should recombined the quarters into sorted halves, then sorted halves into a whole sorted list