Set a static IP for WPA wireless network

1. Get the encrypted WPA wireless key
wpa_passphrase <network name> "<passphrase>"
e.g.
wpa_passphrase myNetwork "This is my passphrase"
You will get something like the following:
network={
ssid="myNetwork"
#psk="This is my passphrase"
psk=eca1d01a15186d5bea7548ba6b7fed6b032b3efd79791539ba8b8fffb1fdfa1c
}

Copy the text after psk=

2. Edit the interfaces configuration
sudo nano /etc/network/interfaces

(you can use any text editor you want)

Add the following to the file replacing
- <interface> with the proper interface, e.g. wlan0 or eth1,
- The IP addresses with the proper IP addresses for your network
- <network name> with the name of your network
- <encrypted psk key> with the key you got in the previous step
auto <interface>
iface <interface> inet static
address 192.168.1.99
gateway 192.168.1.1
dns-nameservers 192.168.1.1
netmask 255.255.255.0
wpa-driver wext
wpa-ssid blank
wpa-ap-scan 1
wpa-proto WPA
wpa-pairwise TKIP
wpa-group TKIP
wpa-key-mgmt WPA-PSK
wpa-psk <encrypted psk key>

3. Disable the Network manager.
From the main menu select "System | preferences | Sessions" and remove the check mark for the network manager

4. Reboot