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