It's hard to represent a long division in this font so I'll spell it out.

We'll do the second one. Names: b+7, what you're dividing by, is thedivisor. b^3 + 4b^2 -3b + 126, what you're dividing into, is thedividend. Use lined, or even squared, paper.

Write b+7 ) b^3 + 4b^2 -3b + 126 with a line over the dividend. (If there had been any 'missing' powers in the divident write them in with a coefficient of zero.)

Look at the power of b which you need to match the leading term of the divisor (b) with the leading term of the dividend (b^3). b^3/b is b^2 so write a b^2 above the line, over the 4b^2 term below the line. Now multiply divisor by b^2 to get b^3+7b^2 and write it under the corresponding terms b^3+4b^2 of the dividend. Draw a line under that and subtract corresponding terms: you get no b^3 (that should always happen) and -3b^2. Write that under the line you just drew. Now 'bring down', ie copy from the dividend, the next term (you alrady dealt with b^3 and b^2 term, so bring down the b term): that's -3b. Write this next to the -3b^2 so that you see -3b^2 -3b together. Now take leading term of this (-3b^2) and divide it by leading term of divisor (b) to give -3b. Write this above the top line, over the b term of the dividend. You now have b^2-3b above the top line. Multiply the divisor by -3b, to give -3b^2 - 21b, and write this under the -3b^2-3b at the bottom of the working and draw another line under that. Subtract. Again the b^2 term cancels and you get 18b below the lowest line. 'Bring down' the 126 vertically down and copy it next to the 18b. You now see 18b+126. Again take the leading term of this (18b) and divide by the leading term of the divisor (b). You get 18, so write that above the top line over the 126: the top line now read b^2-3b+18. Multiply the divisor by 18 to get 18b+126. Subtract this to get zero! You now have the quotient b^2-3b+18 above the top line, and remainder (zero) below the bottom line.

Done.