Where and how to drill joists for electrical cables or plumbing runs depends on what type of floor framing you have. Keep the hole at least 2 in. from the top and the bottom if it's a dimensional lumber joist. The hole cannot be larger than one-third the depth of the joist, so the maximum hole size for a 2x12 joist (actual size 1-1/2 x 11-1/4 in.) is 3-3/4 in. diameter—plenty big enough for running cable! You can drill the holes anywhere along the length of the joist (first photo).
If you have manufactured I-joists, you can drill holes up to 1-1/2 in. diameter almost anywhere in the web area (the area between the flanges). Just stay 6 in. away from any end or load-bearing wall (second photo). Holes up to 4 in. can be drilled in the middle of the I-joist, away from the ends and load-bearing wall. Keep the distance between adjacent holes at least twice the diameter of the largest hole. For holes larger than 4 in., consult the lumber supplier.