Q:

Reset Wi-Fi dongle

I too ran into problems with USB Wi-Fi dongle on RPi.  After being on for roughly a day RPi loses Wi-Fi link.  If I run ping to the gateway command fails with "Destination host not reachable" message.  People seem to solve problem by issuing ifdown wlan0 followed by ifup wlan0.  Unfortunately it doesn't work for me.  Only way I can get connection back is to physically unplug USB dongle and plug it again.  How can I imitate physical reset with console commands as close as possible? 

A:

Sounds like a power management setting for your wireless needs to be updated.  Run iwconfig and look for a line like this:
Power Management:off
If you see "on" instead of "off" you will need to update doing the following:
Type at the command line: sudo nano /etc/network/interfaces
Insert this text anywhere: wireless-power off
Save the doc, close, and then at the command line type: /etc/init.d/networking restart
Check iwconfig output again to make sure the power management setting took.