Scripts to alter DNS settings

My NetGear router has been acting more and more weird the last months. I don’t really know why, but sometimes the DNS resolver inside just locks up and misbehaves something wicked. It would be a lot easier if it could just forward the DNS settings through DHCP, but it doesn’t do that, it just always sets itself as the dns resolver. Maybe it started appearing when I installed Vista, dunno.

So I made some scripts to change this. Just sharing it with the world in case someone else has a problem.

SetTeliaDNS.cmd:

@echo off

set IF="Wireless Network Connection"

netsh interface ipv4 set dns %IF% static none
netsh interface ipv4 add dns %IF% 195.67.199.24
netsh interface ipv4 add dns %IF% 195.67.199.25

netsh interface ipv4 show config %IF%

SetDchpDNS.cmd:

@echo off

set IF="Wireless Network Connection"

netsh interface ipv4 set dns %IF% dhcp
netsh interface ipv4 show config %IF%

Using the first, I switch my wireless network over to predefined DNS through my ISP, Telia. Using the second, I switch back to whatever I got through DHCP – when I use another wireless network, for instance.

And then, just a quick link to these two in the TrueLaunchBar menus, and… good to go.

Code folding in Netbeans PHP

I recently found out a tip that C#-style #region and #endregion-style declarations work in NetBeans for PHP too, although with a slightly different syntax.

The trick was making it work in HTML, since I use it mostly for defining different sections of my .phtml templates, which can get pretty long:

<? // <editor-fold defaultstate="collapsed" desc="JavaScript code"> ?>
...
<? // </editor-fold> ?>

Realized you had to escape to PHP for it to work. A little extra syntax, but look at my beautiful, beautiful HTML code: