urllib2 HTTP Error 400: Bad Request

The reason that “the dog” returns a 400 Error is because you aren’t escaping the string for a URL. If you do this: It will work. However I highly suggest you use requests instead of using urllib/urllib2/httplib. It’s much much easier and it’ll handle all of this for you. This is the same code with … Read more

Bash script: bad interpreter

The first line, #!/bin/bash, tells Linux where to find the interpreter. The script should also be executable with chmod +x script.sh, which it appears you did. It is highly likely that you created this file with a windows editor, which will place a <cr><lf> at the end of each line. This is the standard under … Read more

java.lang.ArithmeticException: / by zero

The % operator returns the remainder after dividing the first number by the second number. If the second number (in your example size) is zero, then you will get a divide by zero ArithmeticException. The key is to check if size is zero before performing this loop, and take the appropriate action.

java.lang.ArithmeticException: / by zero

The % operator returns the remainder after dividing the first number by the second number. If the second number (in your example size) is zero, then you will get a divide by zero ArithmeticException. The key is to check if size is zero before performing this loop, and take the appropriate action.