Robocopy: Backup rights on Windows 7

December 26, 2009 Leave a comment

My Robocopy backup script has a few lines of:

robocopy D:\Source_Dir K:\Backup_Dir /MIR /B

This worked fine on Windows XP, but stopped working once I moved to Windows 7. Robocopy would give the following error:

ERROR : You do not have the Backup and Restore Files user rights.
*****  You need these to perform Backup copies (/B or /ZB).

Surprisingly, I would get this error even if I was logged onto an Administrator account!

The reason turned out to be that running in /B (Backup mode) requires permissions to open files without any security restrictions. With the UAC in Windows 7, even a normal invocation of cmd.exe by an Administrator account does not have these rights!

To run Robocopy in /B (Backup mode) one needs to start cmd explicitly with Administrator rights! To do this type cmd at the Start menu, right-click on cmd.exe and choose Run as Administrator. This works fine even from a non-Administrator account (assuming you know some Administrator credentials.)

ViM: View Environment Variables

December 7, 2009 Leave a comment

ViM has its own internal environment variables, like $VIM and $VIMRUNTIME. Use the echo command to view their values:

:echo $VIM
:echo $VIMRUNTIME

Firefox: Changing size of dialog boxes

December 5, 2009 Leave a comment

Since I changed the fonts of the Windows 7 theme, I cannot view all the options in some of the Firefox dialog boxes. These dialog boxes in Firefox do not come with the window resize option so cannot be resized using the mouse. To resize these dialogs, set their sizes in userChrome.css as explained in this helpful MozillaZine article: Dialog too small or too large.

For example, to increase the size of the Fonts dialog in Firefox, I added this to my userChrome.css file:

/* Increase width of Fonts dialog. */
#FontsDialog {width: 100ex !important;}

Note that:

  • userChrome.css is located in the C:\Users\Your-Username\AppData\Roaming\Mozilla\Firefox\Profiles\Random-String.default\chrome directory on Windows 7.
  • If userChrome.css does not exist, just create a text file named as such.
  • ex and em are measures of width and height respectively (in CSS) and are relative to the font used. If you need an absolute unit, use px (pixel).
  • Firefox needs to be restarted for the resizing to take effect.
Tags:

Firefox: Load diverted tabs in background

December 5, 2009 Leave a comment

This is especially useful for folks who want to open Google Reader items in the background when they click it (or use the keyboard shortcut: v).

Open about:config and set browser.tabs.loadDivertedInBackground to true.

Tags: ,

NVIDIA CUDA Environment Variables

December 1, 2009 Leave a comment

I wiped my Windows XP setup for a new install of Windows 7 today. In the spate of reinstallation of software that followed, I had to install NVIDIA CUDA SDK 2.3. I noticed that NVIDIA has changed the name, number and location of their CUDA SDK environment variables.
Here are the variables for my installation to C:\Program Files\NVIDIA Corporation\CUDA SDK directory:

CUDA_BIN_PATH=C:\Program Files\NVIDIA Corporation\CUDA Toolkit\bin
CUDA_INC_PATH=C:\Program Files\NVIDIA Corporation\CUDA Toolkit\include
CUDA_LIB_PATH=C:\Program Files\NVIDIA Corporation\CUDA Toolkit\lib
NVSDKCOMPUTE_ROOT=C:\Program Files\NVIDIA Corporation\CUDA SDK
NVSDKCUDA_ROOT=C:\Program Files\NVIDIA Corporation\CUDA SDK\C

LaTeX: Label naming conventions

November 10, 2009 Leave a comment

The common convention seems to be to use : as a separator between words in the label.

\label{foobar}
\label{sec:programming}        % Section on Programming.
\label{sec:programming:python} % A subsection on Python within the Programming section.
\label{fig:swineflu}           % A figure on swine flu statistics.
\label{tab:population}         % A table on population numbers.
Tags: ,

LaTeX: Reference a figure

November 10, 2009 Leave a comment

One of the cool features of LaTeX is that you could refer to figures by their number automatically. If the original figure number changes, it is automatically updates in all locations it is referred to. To do this:

Label the figure:

\begin{figure}[ht]
\centering
\includegraphics[scale=1.0]{www.png}
\caption{The world wide web.}
\label{sec:www}
\end{figure}

Refer to the label:

The world wide web (as shown in Fig \ref{sec:www}) is a series of tubes.

If the original figure was numbered by LaTeX as Fig 2.1, then the above text will appear as:

The world wide web (as shown in Fig 2.1) is a series of tubes.

MikTeX: Install/Uninstall packages

November 4, 2009 Leave a comment

To install a package into MikTeX:

  1. Close all open applications that use LaTeX/MikTeX.
  2. Open the MikTeX Package Manager in Admin mode. (Under the Start menu you will find it in MikTeX → Maintenance (Admin) → Package Manager (Admin) )
  3. Type the partial or full name of the package you want to install in the toolbar and click on Filter.
  4. In the search results, right-click on the package you want and choose Install.

Uninstalling a package is the same as above, just choose Uninstall in step 4.

Note: I use LEd as my primary LaTeX editor. Whenever I try to compile a .tex file which uses a package that is not installed in my MikTeX system, LEd tries to install it automatically from the web. However, LEd’s install dialog disappears while installing and neither shows the success/failure of the operation nor the progress. This is the reason I prefer to do installation/uninstallation manually using MikTeX.

Tags: , ,

Beamer: Custom themes

November 3, 2009 Leave a comment

Beamer comes installed with many themes and color themes. But, there are many custom themes out there you might be interested to use. A good list of such custom themes is maintained by Rogier Koppejan here.

To install a custom Beamer theme:

  1. Copy the .sty files of the theme to the various subdirectories under the $(MIKTEX_ROOT)\tex\latex\beamer\themes\ directory. Ex: beamerthemeTorino.sty goes into the theme subdirectory, beamercolorthemechameleon.sty goes into the color subdirectory and so on.
  2. Refresh the MikTeX file name database. (You may need to close all applications using LaTeX for this operation to complete successfully.)
Tags: ,

Visual Studio: Vertical split windows

November 3, 2009 Leave a comment

2009_11_03_visual_studio_vertical_split

I use a dual display at work and my primary display is a delicious Viewsonic VA2226w 22″ widescreeen display. The widescreen display is very useful while debugging. But, while editing code most of my source code lies within 100 columns, and the left half of the display is essential blank (and wasted). So, I find it useful to split the Visual Studio edit window into two vertically. I can edit a file and keep an extra file (say header file with class definitions) open on the left to refer to while editing.

Vertical splitting like this is very easy: Choose Windows → New Vertical Tab Group.

This feature also works in the free Express Editions of Visual Studio.

Also see: Stack Overflow: How do I get a code window to split vertically in Visual Studio 2008? (not HTML mode)