I used to get charlie horses in my calves when I would wake up in the morning about once or twice a week. This was my own stupid fault by not drinking enough water before bed. After a few months of this I wisened up, quit drinking so much alcohol and made sure I stayed hydrated. I still get charlie horses every once in a while, but not near as often.
However, despite staying hydrated, foam rolling, and stretching my calves I still will get spasms and brief cramps intermittently through the day.
I never had cramps in my hamstrings until I started using the Glute-Ham raise. I would get cramps guaranteed. And while after a few weeks of using it the cramps subsided, I now get the same spasms and little cramps like I do in my calves.
What else can I do besides stay hydrated, foam roll and stretch? I get plenty of sodium in my diet as well.