The Constant Innovator


Changing IP address and DNS settings programmatically in Windows Vista
May 26, 2009, 2:22 pm
Filed under: Uncategorized

(long post title, but it describes it perfectly)

Background: I’ve run into the situation where I have multiple IP/DNS “profiles” that I want to switch between on my laptop, and find it an enormous pain to go into Network Settings again and again. One of my colleagues had a bigger problem when his office IP settings did not work at all between his home and office.

Solution: This is a Batch file (.bat) meant for Windows Vista that allows you to select from different profiles and set IP and DNS settings accordingly. You will have to click on the User Account Control prompt and select Continue.

Setup

  1. Copy the code below into a file: “IP-DNS-switch.bat”
  2. Change the contents to fit your requirements. Do NOT blindly copy paste this and expect it to work. It will NOT!
  3. Move the bat file into C:\Windows (not required to be there in particular, but it would be the safest location from accidental deletion)
  4. Create a shortcut to this file on your Desktop
  5. Edit the Properties of this shortcut and in Advanced, set “Run as administrator”

Notes

  1. This is meant for Windows Vista. It won’t work anywhere else.
  2. The settings are for your default wireless connection, you’ll need to modify the file appropriately if its anything else.
  3. Again, the IP and DNS settings are meant for MY connection ONLY, you MUST modify these. Don’t even THINK of using them as it is.
  4. To understand more about netsh, open up a Command Prompt in Windows Vista and type the following:
netsh int ipv4 set address /?
netsh int ipv4 set dnsserver /?
netsh int ipv4 add dnsserver /?

References

  1. http://en.kioskea.net/forum/affich-13513-how-to-change-ip-address-from-command-prompt
  2. Various sites on how to use the CHOICE and NETSH command
  3. Windows Vista command prompt with the /? operator

The main code

@echo off
REM IP-DNS-switch.bat
REM Copyright(c) 2009 Siddhant Bhansali
REM VBScript to automatically switch between Home and Work IP and DNS configurations.
REM Pre-configuration:
REM 1. Change the IP and DNS settings to whatever is appropriate to your networks
REM 2. Copy this file to C:\windows so that it is not accidentally deleted
REM 3. Create a shortcut to it on the Desktop
REM 4. Right click and select properties of the shortcut
REM 5. In Advanced, set "Run as administrator"
REM 6. Save these settings and you're done!
REM --------------------------------------
echo.
echo Switch to which configuration?
echo.
echo [H]-Home (All IP and DNS settings set to Automatic)
echo [W]-Work (IP and DNS settings set to Work settings)
echo [E]-Exit (No change)
echo.
CHOICE /C:HWE

IF ERRORLEVEL 3 GOTO END

IF ERRORLEVEL 2 GOTO WORK

netsh int ipv4 set address "Wireless Network Connection" source=dhcp
netsh int ipv4 set dnsserver "Wireless Network Connection" source=dhcp
pause
goto END
:WORK
netsh int ipv4 set address "Wireless Network Connection" static 192.168.1.XX 255.255.255.0 192.168.1.1 1
netsh int ipv4 set dnsserver "Wireless Network Connection" static 203.94.243.70 primary
netsh int ipv4 add dnsserver "Wireless Network Connection" 203.94.227.70
pause
:END


Fixing a Panasonic SDR-H21 with a shake
May 28, 2008, 5:37 am
Filed under: Uncategorized | Tags: , , , , , , , , ,

Had borrowed a family friend’s digital camcorder, a Panasonic SDR-H21 and it recorded fine once or twice and then had a weird error wherein the lens / focus / zoom was completely unresponsive.

It was recording photos and videos, but the picture was at a fixed focus, and moving the thumb-tab to zoom in and out was completely unresponsive.

Tried a lot of things. Discharging the battery, reseting the camcorder, but nothing worked. The Panasonic website was collosally unhelpful (no support section, apparently nobody has any problems with this product, moreover the H21 model is not listed on their site). I talked to the family friend and we ran through the checklist again, but to no avail. Then, just as a joking aside, he suggested that I shake the camera. I did just that – shaking it from one end to another. Unexpectedly, the camcorder powered itself off.

I had to disconnect the battery to reset it, but when it did come back on, it was working fine!

Detailed notes:

  • After the first test run, when it worked fine, the battery was removed and left on the charger. After the green light went off, I plugged it back in and switched on the camera. The lens cover was not taken off and I tried moving the dials through the modes, but it didn’t switch from the video display mode. When it came onto the photo record mode, it still displayed the video display mode.
  • The camcorder was complaining a lot that it needed to reset itself when I was switching modes – which I did, but that didn’t help.


Tambola calling out names for numbers
May 11, 2008, 11:22 am
Filed under: Uncategorized | Tags: , , , , , ,

My sister recently organized a Tambola game (known as Bingo in other countries) for a large gathering of people. We looked online for a collection of names to call out for each number, but weren’t able to find any. So, she talked to one of our family friends and noted the names down in a document.

Link to Word Doc