Don't live in East Palo Alto unless you want to be stabbed.
Mountain View is doable, you could go up Middlefield Road or something like that to get to Stanford. The areas around Palo Alto, such as Menlo Park or Atherton, are very expensive to live in. So I would recommend that you live in Mountain View, if not Palo Alto itself. Mountain View is also quite a hub for the local VTA bus system, and there is also light rail there as well.
You could live in San Jose, near downtown, and catch Caltrain out of Diridon station. Be aware that Caltrain has to turn away bikers all the time during rush hour because the racks fill up very quickly. So if you want to take your bike on the train, Caltrain is not reliable.
Also, it is Stanford, not StanDford.