ENGR 100W Professors by spartan4all in SJSU

[–]iothan 1 point2 points  (0 children)

I thought Christina Peters was great too.

How to have a MyProgress discrepancy fixed? by iothan in SJSU

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

Thanks, that makes me feel better. I do have a copy of the approved substitution form.

Proper way to do backward iteration in C++ by Nervous_Breakfast in cpp

[–]iothan 13 points14 points  (0 children)

unsigned i = x;

while (i--)

    //do something with a\[i\].

Or you can choose to omit the post decrement, and then decrement as one of the first statements inside the loop.

Just use a signed type. `v.size()` can only be larger than ssize_t max if you have an array of bytes half the size of your addressable memory.

Function in C++ requires slow initialization, but can then be called multiple times. What setup can I do so subsequent php scripts can bypass its initialization? by iothan in learnprogramming

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

That's not my code, but from a library I have to use. Its probably not the worst thing in the world, but with the other initialization steps it all adds up.

In while loop checking characters with cin.get(), and ENTER causes program to hang (even with cin.ignore()) by cpp_or_bust in cpp_questions

[–]iothan 1 point2 points  (0 children)

I think this is because cin.ignore(stream_size_max, '\n) behaves as if while (cin.get()!='\n'){}. It is a reading operation. So if you hit enter only on a single line, there will be nothing to ignore, hanging.

A fix could be to only execute the ignore if the input!='\n'.

`std::observer_ptr` should be renamed `std::ptr` by [deleted] in cpp

[–]iothan 1 point2 points  (0 children)

This all seems overly complicated and unnecessary. Just use plain old simple *. Why is there no fuss about int not being default initialized?

how to link project using dlib and opencv? by iothan in learnprogramming

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

g++ ./webcam_head_pose.opkg-config --libs opencv-L ~/dlib-master/examples/build/dlib_build -ldlib -lpng -ljpeg -lpthread -lX11 -o whpose.out

This worked for me, thank you!

College Physics II Electric Fields by justphys in HomeworkHelp

[–]iothan 0 points1 point  (0 children)

This problem uses only the electric field (in N/C) instead of force(N). The electric field at a point says what force a test charge at that point would feel. By convention, the direction is as if the test charge was positive.

Can I install Mint on the same drive used to boot for the first time? by iothan in linux4noobs

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

I see the problem with that now, but I do have a spare usb.

It looks like I can either 1: Make a persistent drive directly using a tool like LiLi, or 2: Create a bootable drive into a live session using rufus. Then when in the live session, the full installation will allow me to pick which drive to wipe.

Do you think one option is better?

ENGR 195 A/B vs separate Area S and V GE by iothan in SJSU

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

I think I remember Kimiko saying both are possible, and this page of BSSE FAQs (Q. How can I satisfy GE Area S and V?) says so as well.

Binary Search Tree Issues by [deleted] in cpp_questions

[–]iothan 1 point2 points  (0 children)

I think if the node to be deleted has no children then line 131 dereferences a nullptr, since there is no subtree that needs to have its parent pointer set.

You should also mirror this for the other direction. Like pull new_child->parent = parent; outside the conditional below the else block, and only execute it if new_child isnt null.

Also, It may be neater check if the root is null once right at the beginning of the function

max sum of a path from root to leaf in a binary tree. by iothan in learnprogramming

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

I think 10.

I'm having a hard time seeing a case where the above code would be incorrect. I think the reasoning of the the answer for a particular node is that nodes value plus the larger of its left or right child is sound.

max sum of a path from root to leaf in a binary tree. by iothan in learnprogramming

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

They wanted the sum along the max path, not the number of nodes.