mobile phone as modem

Sunday, October 26, 2008

There are a number of posts around the place on getting gprs or 3g cellphone connections working on linux. I wasn't interested in bluetooth as I have limited batteries and a usb cable. And you don't always know what your locla settings should be.

Here's all I did on Xubuntu Hardy:

  1. Plug the phone into the computer using the usb cable.
  2. In a terminal, type "sudo wvdialconf". (This sets up available baud rates, etc)
  3. In a terminal, type "sudo vi /etc/wvdial.conf".
  4. Edit this file with:
  5. phone = [for my nokia on Vodafone New Zealand, the number is "*99#". I phoned them to find out.]
  6. name = [the login name, if your mobile company requires it. Vfone NZ doesn't, but wvdial needed something here. I used "name"].
  7. password = [as with name. I used "password"].
  8. Save and close the file.
  9. Connect to the internet via your mobile by typing "wvdial" in a terminal window.
  10. When done, press ctrl-c in that window.
So easy and so great!

java modulus for floating point numbers

Thursday, October 09, 2008

The java modulus (or remainder) operator (%) truncates instead of rounds with floating point numbers (ie float, double), so the solution is to use Math.IEEEremainder instead. It's fine to use % for ints.