Sunday, December 20, 2009

Grinder Examples

Hello World
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test

# A shorter alias for the grinder.logger.output() method.
log = grinder.logger.output

# Create a Test with a test number and a description. The test will be
# automatically registered with The Grinder console if you are using
# it.
test1 = Test(1, "Log method")

# Wrap the log() method with our Test and call the result logWrapper.
# Calls to logWrapper() will be recorded and forwarded on to the real
# log() method.
logWrapper = test1.wrap(log)

# A TestRunner instance is created for each thread. It can be used to
# store thread-specific data.
class TestRunner:

    # This method is called for every run.
    def __call__(self):
        logWrapper("Hello World")

Friday, December 18, 2009

Log on to Windows 7 Automatically

It used to be a pretty complicated task to configure auto-logon in Windows XP.  It takes some tinkling to the Windows Registry data (see here.)  However, Windows 7 has changed that.  Now you can set up a default user to log into Windows automatically through some dialog boxes.  And the password is not stored as plain text in the registry anymore.  Two ways to bring up the User Accounts dialog box:
  • Type "netplwiz" in the Start menu search box (Run window) and hit Enter.
  • Type "control userpassword2" in the Start menu search box (Run window) and hit Enter.
For detail instructions on how to do this, check out this article on www.howtogeek.com.

Unfortunately, you can't access this dialog box through the Control Panel; I think Microsoft intentionally omitted it.  But you can add it back into the Control Panel by modifying the following Registry keys:
[HKEY_CLASSES_ROOT\CLSID\{98641F47-8C25-4936-BEE4-C2CE1298969D}] 
@="Advanced User Accounts" "InfoTip"="Starts the \"Control Userpasswords2\" Admin Screen" "System.ControlPanel.Category"="9" 

[HKEY_CLASSES_ROOT\CLSID\{98641F47-8C25-4936-BEE4-C2CE1298969D}\DefaultIcon] 
@="%SystemRoot%\\System32\\netplwiz.exe" 

[HKEY_CLASSES_ROOT\CLSID\{98641F47-8C25-4936-BEE4-C2CE1298969D}\Shell] 

[HKEY_CLASSES_ROOT\CLSID\{98641F47-8C25-4936-BEE4-C2CE1298969D}\Shell\Open] 

[HKEY_CLASSES_ROOT\CLSID\{98641F47-8C25-4936-BEE4-C2CE1298969D}\Shell\Open\command] 
@="Control Userpasswords2" 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{98641F47-8C25-4936-BEE4-C2CE1298969D}] 
@="Add Advanced User Accounts to Control Panel" 

Tuesday, December 1, 2009

How to Remove GPT Protective Partition from a Drive in Windows

Warning: This procedure will erase all data on the disk. Please backup your data before proceed.

In Windows, you can use a program called DISKPART, which is a command line program, to remove a GPT Protective Partition from a disk. Here's how:
  1. Bring up your Command Prompt program
  2. Type DISKPART at the prompt
  3. Then type list disk in DISKPART's prompt to show all disks on the machine.
  4. Type select to set the specific partition: select disk 1
  5. Then type clean will remove the GPT Partition from the selected disk
Now, you can go to Disk Management Console and start formatting the 'unallocated' partition on this drive. Have fun!