How to find my external IP address


Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in D:\InetPub\vhosts\kwu-1639.package\kennywu.info\wwwroot\wp-content\plugins\wp-syntax\wp-syntax.php on line 380

If you computers are sitting behind a router/firewall, then running Ipconfig would not give you the external IP address. One can use http://www.whatsmyip.org/ for ad-hoc queries, but if you want to automate the checks you might want something simpler and easier to parse. The followings are the options I found.

The c# code to find out your external IP:

public string GetPublicIP() {
    String direction = "";
    WebRequest request = WebRequest.Create("http://checkip.dyndns.org/");
    using (WebResponse response = request.GetResponse())
    using (StreamReader stream = new StreamReader(response.GetResponseStream())) {
        direction = stream.ReadToEnd();
    }
 
    //Search for the ip in the html
    int first = direction.IndexOf("Address: ") + 9;
    int last = direction.LastIndexOf("</body>");
    direction = direction.Substring(first, last - first);
 
    return direction;
}

How to delete library in Windows Media Player 12

Today I noticed that my media player open very slow. Since I removed a hard drive the entire library in Windows Media Player 12 (operating in Windows 7) needs to be rebuild. The player can start again with a new database. With previous versions of WMP this was straightforward – I would get to the Media Player folder within Local Settings and delete all the files (leaving the folders). Now when I try to do this I get the message ‘This action cannot be completed because the file is open in Windows Media Player Network Sharing Service. Close the file and try again.” Here is how I solved that problem.

  1. Close the Windows media player.
  2. Go to Control Panel\System and Security\Administrative Tools\Services. Stop the “Windows Media Player Network Sharing Service”.
  3. Navigate to: C:\Users\kwu\AppData\Local\Microsoft\MediaPlayer
  4. Rename or delete all files with .wmdb extension.
  5. Restart WMP and ensure you have the desired library locations and WMP should automatically repopulate itself.