## Monday, July 6, 2009

### Centre text within other text in LaTeX

LaTeX function which centres the second argument within the first argument and leaves the correct amount of space at the end.

\newcommand{\centretext}[2]{%
\newlength{\widthA}%
\settowidth{\widthA}{#1}%
%
\newlength{\widthB}%
\settowidth{\widthB}{#2}%
%
\newlength{\moveL}%
\setlength{\moveL}{\widthA}%
\setlength{\moveL}{-0.5\moveL}%
%
\newlength{\moveR}%
\setlength{\moveR}{\moveL}%
\setlength{\moveR}{-1\moveR}%
%
#1\hspace{\moveL}#2\hspace{\moveR}%
}

Usage Example:

$\bigcirc$ bb

\centretext{$\bigcirc$}{{\scriptsize ai}} bb

Note that the text 'ai' is centred within the circle and the text 'bb' at the end of the two lines are aligned with each other.

### Measure Width of Text in LaTeX

\newlength{\textwidth}
\settowidth{\textwidth}{hello}

Example:
hello\hspace{\textwidth}hell\_

Similarly:
\settodepth

References:
http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/ltx-90.html
http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/ltx-312.html

## Thursday, July 2, 2009

### Always show the Go button in Firefox 3

In Firefox 3, the Go button only shows up when you’re typing in the Location bar. You can show the Go button permanently by following these instructions.
1. Open the folder that contains your Firefox profile (if you don’t know where that is you can read this page in the Mozillazine Knowledge Base).
2. Look for a directory named chrome and open it. If the directory does not exist, create it.
3. Open the file called userChrome.css. If the file does not exist, create a blank text file and call it userChrome.css.
4. Make sure that the following is the first line of the file (taken from the file \chrome\userChrome-example.css):
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
5. At the end of the file, add the following line:
#urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button { visibility: visible !important;} /* Show the Go button permanently in the location bar */
6. Restart Firefox.

### Disable Extension Compatibility Checking in Firefox 3

• Type about:config into Firefox's address bar and click the "I'll be careful, I promise!" button.
• Right-click anywhere. Choose New>Boolean. Name the new config value extensions.checkCompatibility and set it to false.
• Right-click anywhere and choose New>Boolean again. Name this new boolean pair extensions.checkUpdateSecurity and set the value to false.
• Right-click anywhere. Choose New>Boolean. Name the new config value extensions.checkCompatibility.VERSION and set it to false
• e.g. extensions.checkCompatibility.3.6
• Note the capital C in checkCompatibility - it's important.
• VERSION is the version number of firefox, e.g. 3.6
• If using an Alpha version, the version number would be VERSIONa, e.g. 3.6a
• If using a Beta version, the version number would be VERSIONb, e.g. 3.6b
• Restart Firefox.

### How to uninstall Microsoft .NET Framework Assistant from Firefox

1. Open the Registry Editor (Start > Run: regedit)
2. Navigate to the key
HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Firefox\extensions
(or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Firefox\extensions for 64-bit versions of Windows)
3. Delete the value with name
{20a82645-c095-46ed-80e3-08825760534b}
4. Restart Firefox.

## Saturday, April 18, 2009

### 'microsoft' folder appearing in Shared Documents

A folder called 'microsoft' appears in Shared Documents (Public Documents on Vista).
The whole folder tree which is created is: \microsoft\IdentityCRL\production
These folders keep appearing even after they are deleted.

To get rid of these folders, uninstall Windows Live Sign-in Assistant and then delete the folders.

## Saturday, March 21, 2009

### How To Restore the MBR of a Windows XP Installation

If your computer's MBR (Master Boot Record) gets corrupted, the computer will not your OS. To restore the MBR of a Windows XP installation:

1. Boot with the Windows CD.
2. Enter the Recovery Console.
3. Type fixmbr
4. Reboot

### Prevent Windows Messenger From Starting Automatically

If your new computer is running Windows XP Home or Pro edition, you can use the steps below. If you have SP1 installed, Windows added a new feature to the Add or Remove Programs tool in the Control Panel called Set program access and defaults. You can use this feature to remove Windows Messenger from the Start menu, the desktop, and other locations.
However, if you don't have Service Pack 1 installed (this method is suggested even if you do have SP1 installed), follow all steps below:

Windows XP Pro

1. Click Start > Run and type: gpedit.msc
2. Expand the following items: Local Computer Policy > Computer Configuration > Administrative Templates > Windows Components > Windows Messenger
3. Double-click Do not allow Windows Messenger to run and click Enable
4. Click OK and close the Group Policy snap-in

Windows XP Home

1. Start Windows Messenger.
2. Click Tools and select Options.
3. Click the Preferences tab, clear the Run this program when Windows starts check box, and click OK.

Windows XP Home / Pro

To install/uninstall Windows Messenger (and add or remove access to Windows Messenger from the Start Menu:

1. Click Start > Run and type: appwiz.cpl
2. Click on Add/Remove Windows Components and scroll down to Windows Messenger.
3. Check/Uncheck the check box to add/remove Windows Messenger.
4. Click Next, then Finish. The Windows Messenger icon will not be present in the Start Menu.

### Change The Location of the Windows XP I386 Folder in the Registry

Windows XP

When installing new Windows components (from Control Panel > Add or Remove Programs > Add/Remove Windows Components), Windows will try to locate these files from the path from where Windows was originally installed, usually the CD/DVD drive. You can modify the path in which Windows looks for these files as follows:

1. Copy the I386 folder the Windows XP CD to the new location (eg. C:\)
2. Open the Registry Editor (Start > Run: regedit)
3. Navigate to the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup
4. Replace the data of the following values with the path where I386 was copied (eg. C:\):
• SourcePath
• ServicePackSourcePath
• Installation Sources

### Get Rid of the Logon Screen (Windows XP/2000)

Windows XP

If you have one user account and no password configured, Windows XP will log you in automatically. Otherwise, you'll have to do the following:

Solution 1:
1. Click Start > Run and type:
2. Turn off the option Users must enter a user name and password to use this computer and click OK.

Solution 2:
1. Download and install TweakUI for Windows XP.
2. Open TweakUI (Start > All Programs > Powertoys for Windows XP), expand the Logon branch and click Autologon.
3. Turn on the option Log on automatically at system startup, type your username and password, and click OK.
If you need to suppress AutoLogon, press the Shift key while Windows is starting.

Windows 2000

Solution 1:
1. Double-click the Users icon in Control Panel and choose the Users tab.
2. Turn off the option Users must enter a user name and password to use this computer.

Solution 2:
1. Double-click the System icon in Control Panel and choose the Network Identification tab.
2. Click Network ID and follow the instructions on screen.

### Change The Default Logon Wallpaper and/or Screen Saver

1. Open the Registry Editor (Start > Run: regedit)
2. Navigate to the key HKEY_USERS\.DEFAULT\Control Panel\Desktop
3. Replace the data of the values Wallpaper and SCRNSAVE.EXE with the path of the new wallpaper and screensaver files

Notes:
The wallpaper file must be a .bmp image file (24-bit bitmap).

### How To Copy A Directory Structure

To copy a directory structure without copying and of the files which are in the directory structure:

Click Start > Run.
Type:

xcopy /T /E /I

Example:
xcopy "C:\Documents and Settings\User Name\My Documents" "D:\My Documents Backup" /T /E /I

Notes:
The meaning of the switches for xcopy are the following:
• /T : Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories.
• /E : Copies directories and subdirectories, including empty ones. May be used to modify /T.
• /I : If destination does not exist and copying more than one file, assumes that destination must be a directory.

### How To Backup the Registry

1. Open the Registry Editor (Start > Run: regedit).
2. From the File menu, select Export.
3. From the Export Range group box, select All.
4. Save the file to a convenient location.

### How To Disable/Remove Startup Items

1. Through MSConfig

Open MSConfig (Start > Run: msconfig), go to the Startup tab and disable items you do not want to run when Windows starts.

2. Through the Registry

Open the Registry Editor (Start > Run: regedit) and go to the paths listed below. As always, it's advisable to backup the registry key before deleting anything.

Items that are enabled in the Startup tab of MSConfig are listed in the registry in one of the following locations:
• HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
• HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

Items that are disabled in the Startup tab of MSConfig are listed in the registry in one of the following locations:
• HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\MSConfig\startupreg
• HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SharedTools\MSConfig\startupfolder

Find the key, find the specific listing for the item you want to delete, and delete it. The next time you load MSConfig, those items won't be there.

Notes:
You might also have to delete items in the Start Menu Startup folders:
• C:\Documents and Settings\User Name\Start Menu\Programs\Startup
• C:\Documents and Settings\All Users\Start Menu\Programs\Startup

### Restore The Default Windows Power Schemes

Click Start > Run and type:

powercfg /RestoreDefaultPolicies

http://support.microsoft.com/kb/913622
http://www.kellys-korner-xp.com/regs_edits/powercfgrestore.reg

### Windows Commands

Click Start > Run and type one of the following commands:

 Command Description regedit Registry Editor msconfig Edit Startup Items gpedit.msc Group Policy services.msc Windows Services appwiz.cpl Add or Remove Programs powercfg.cpl Power Options control keymgr.dll Stored User Names and Passwords control userpasswords Windows XP User Accounts Manager control userpasswords2 Windows User Accounts and Passwords winmsd Display System Info dxdiag DirectX Diagnostics

### How To Restore the Address Bar in the Taskbar After Installing Windows XP SP3

The Address Bar is not available in Windows XP SP3. However, it can be restored as follows:

1. Create a new bar on the taskbar (Links for example)
2. Drag it to desktop to undock it (it will change to a panel, you have to undock it as it won't work otherwise)
3. Now you can add the address bar (rightcklick on the undocked panel)
4. Drag the newly created address bar to taskbar

You can also install the MuvEnum Address Bar.

### How To Reset Internet Protocol (TCP/IP) in Windows XP

Open a command prompt and type:

netsh int ip reset c:\resetlog.txt

Reboot the computer.

Notes:
1. "c:\resetlog.txt" is the name of the log file which will be created by the process. This can be changed.

2. Resetting the Internet Protocol might be necessary if the routing table gets corrupted and won't automatically remove or add dynamic routes. The routing table can be accessed by typing route print in a command prompt.