Windows Explorer: Why the Refresh?

Bharat was wondering why Windows Explorer needed a Refresh option. Certainly, a modern file viewer is aware of the changes to the files it is displaying without requiring a manual poke?! After all, Apple is so confident of the auto-refresh of Finder on OS X that it does not have the Refresh option! 🙂

Not being able to figure out the reason, I asked Raymond Chen. Raymond, with his fantastic The Old New Thing blog has become the wise man on top of the Windows history mountain. Raymond replied pretty quickly:

Probably for similar reasons to the ones that cause people to write OSX extensions, eg. http://lifehacker.com/252956/download-of-the-day-refresh-finder-mac.

Not all network drives broadcast updates — I imagine that would be a performance nightmare in some cases — so you sometimes might need to refresh manually.

Windows (at least since Vista — it’s been too long since I used XP to remember) does do auto-refresh, which works most of the time and about as well as the one introduced in (IIRC) OSX 10.4 in my experience.

Advertisements

Windows: ClearType on RDP

ClearType is not turned on by default over Remote Desktop Protocol (RDP). Thus, if you connect to a computer using Remote Desktop Connection (RDC) you will notice aliased fonts, quite ugly in my opinion without ClearType enabled.

If you are connecting to a Vista or Windows 7 computer, enable Experience → Font smoothing in the RDC dialog.

If you are connecting to a Windows XP computer, a bit more work is needed. Apply the following Registry entries on that computer:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations]
"AllowFontAntiAlias"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]
"AllowFontAntiAlias"=dword:00000001

Or just place these lines in a file named CleartypeOnRDP.reg file and execute it.

Windows 7: Registration Entries (.reg) File

If a normal (or Standard) User tries to execute a Registration Entries (.reg) file on Windows 7, he is not elevated to an Administrator login.

Instead, the Registry Editor throws up this error:

The error is misleading because actually the operation is not denied because the keys are open by the system. Rather, it just needs Administrator privileges.

To execute the .reg file, open a command prompt with Administrator privileges and use the regedit command to execute the file:

C:\> regedit MyRegEntries.reg

Python: Dictionary Iteration

The default iteration through a dictionary, returns the keys:

adict = {10:"Ten", 7:"Seven", 12:"Twelve"}

for i in adict:
    print(i)

Output:

10
12
7

(Note that the order of the keys is different from the order in the initialization. This is normal behaviour for a dictionary, where order of the elements should not matter or be relied upon.)

Explicit iteration of the dictionary keys, values and (key, value) pairs can also be done:

# Iterate keys
for k in adict.keys():
    print(k)

# Iterate values
for v in adict.values():
    print(v)

# Iterate (key, value) pairs
for (k, v) in adict.items():
    print(k, ":", v)

Output:

10
12
7
Ten
Twelve
Seven
10 : Ten
12 : Twelve
7 : Seven

Windows: Installing Fonts as Standard User

A Standard User cannot possibly have the permissions to install fonts for the entire Windows system. So, what I mean is how can a Standard User elevate himself to an Administrator to install fonts?

The Run As trick does not work for Fonts. If you Shift + right-click on the Fonts shortcut, you do not see any option to execute it as Administrator or any other user. Neither is Fonts a Control Panel (.cpl) file, so cannot be launched by the runas.exe command-line program.

The Fonts dialog is actually just the C:\Windows\Fonts directory being presented in a special way by Windows Explorer. That gives us a way to install fonts as a Standard User.

Launch Windows Explorer with Administrator privileges. Type in C:\Windows\Fonts in the Address bar. You can now install fonts.

How to write a letter using LaTeX

Occasionally, I need to write formal letters. For one such recent letter I decided to try LaTeX instead of Microsoft Word. I was surprised how easy it was to produce simple and elegant letters using LaTeX! 🙂

Here is a sample letter in PDF produced from a LaTeX file:

The above letter was produced from latex-letter.tex. Grab it and edit its contents to create your own letters.

Here is a dissection of the LaTeX commands to create a letter:

  1. Use the letter documentclass. It provides commands and formatting that are meant for letter writing.
    \documentclass[a4paper, 10pt]{letter}
  2. Provide the name, signature and address of the sender.
    \name{Joe Fox}
    \signature{Joe Fox}
    \address
    {
        Fox Books,\\
        Times Square, NYC.
    }
  3. Begin the letter, provide the name and address of the receiver.
    \begin{document}
    \begin{letter}
    {
        Kathleen Kelly,\\
        The Shop Around The Corner,\\
        Small Corner, NYC.
    }
  4. Provide an opening statement, the letter body and the closing statement.
    \opening{Dear Kathleen,}
    I am aware that you are pretty miffed at me and so on.
    \closing{Yours truly,}
  5. End the letter. The name for the signature is automatically added.
    \end{letter}
    \end{document}

For more information, see the Wikibook on LaTeX Letters.

Windows 7: hiberfil.sys

Hibernation is turned on by default in Windows 7 and C:\hiberfil.sys is the system file which Windows has always used for hibernation. But, hibernation may not really be needed on workstations which are never turned off. It might be a good idea to turn off hibernation and recover the disk space from hiberfil.sys. The disk space involved can be substantial, for example on my Windows 7 system with 2GB of RAM, C:\hiberfil.sys is 1.5GB.

In Windows XP, hibernation could be turned off from the System dialog. In Windows 7, you need to use powercfg.exe at the command prompt (with Administrator privileges of course):

$ powercfg -h off

No reboot is necessary, the hiberfil.sys file is removed as soon as hibernation is turned off.

If you change your mind later, you can turn it back on:

$ powercfg -h on

For more information, see How to disable and re-enable hibernation on a computer that is running Windows.

Motorola ROKR E6: Contacts Backup

The Motorola Phone Tools is an useful application that can be used to backup the contacts on the Motorola ROKR E6 cellphone. This application is present on the CD that ships with the E6. Phone Tools can connect to the E6 over a USB cable, Bluetooth or Infrared. The easiest to use is the USB cable. Before you connect the E6, remember to change the cellphone USB Mode to Modem (Open SetupUSB Mode and choose Modem).

Once connected, the E6 should be detected by Phone Tools and an emulator-like rendition of the E6 appears. The E6 can be completely controlled from Phone Tools, including making or receiving calls and SMS.

Contacts, both on the cellphone and the SIM card, can be backed up using Phone Tools. Choose SynchronizationBackup and provide a name for the archive. After the backup is complete, you can find the backed up contacts list as a CSV (.csv) file in %LOCALAPPDATA%\BVRP Software\Motorola Phone Tools\Backup.

Motorola ROKR E6: Video Conversion

Using SUPER to convert to .3gp video files is a generic method to get video onto most cellphones. If you have a Motorola ROKR E6, you could also use the Motorola EzX Video Producer. This converter is present on the CD that ships with the cellphone. It uses RealProducer (producer.exe) to convert almost any video to a Real Media (.rm) file that is playable on the E6. The video resolution of 320×240, the video bitrate (12 fps, 256 kbps) and audio bitrate (44 kbps) are all better than a conversion to .3gp using SUPER.

The Video Producer converts almost any kind of video except FLV, which is what you get when you download YouTube videos.