Since you are having problems replacing the code with a new one, I suggest you to use a Console Serial Cable and to delete manually the sketch.elf with the command rm –rf sketch.elf. In case you don’t have a serial console cable you can also try with a fresh new install of the SD image. Now regarding the issue with Static IP, you may find this post helpful. You can also include in your Arduino code the line below to see in the Arduino IDE serial console the current configuration of the Wireless and Ethernet connection.
system(“ifconfig > /dev/ttyGS0”);
I hope these suggestions help.