Videos: From web to cellphone

I do not have an iPhone or an Android cellphone, but still there is a lot one can do with cellphones available today. I use my 2-year old Motorola ROKR E6 not just for listening to podcasts, but also to catch up on technical videos (like Google Tech Talks) which are interesting, but too long (~1 hour) to watch them at my desk.

The technical specifications of most cellphones are minimal, but enough:

  • The display resolution is not high. The E6 display is 240 x 320 pixels. It is pretty crappy for watching movies, but is enough to watch technical videos.
  • Supports playback of 3GP video format. The E6 supports 3GP video and uses RealPlayer to play .3gp video files. There is no restriction on the length of the videos, which is great! By tapping on the E6 RealPlayer while it is playing a video, the display switches from horizontal to vertical, which is good for videos since it is wider.
  • Videos cannot be watched off the Internet. The E6 web browser is pretty rudimentary and I doubt it will play any video content on the Internet. I do not care in any case since I do not even have a data plan! 🙂
  • There is support for some kind of storage device. The E6 has a SD card slot, and I currently use a 2GB SD card in it. I can copy over 3GP video files to the E6 over USB. The SD card appears as a simple USB Mass Storage device (thus, no drivers required, works like a charm everywhere).

Working with these minimal specifications, one can still enjoy any video off the Internet on the cellphone.

Download online videos

Get the Video Download Helper Firefox addon. This addon puts a button in the Firefox toolbar. When you are on a webpage which has embedded video content (like YouTube), just click on the button to download the video to a file (typically a FLV file). If you are looking at websites that offer videos in MP4, WMV, MKV or AVI formats, you can just download them directly. None of these formats or their high resolutions can be played on the cellphone, they need to be converted.

Convert videos to 3GP

Videos downloaded from the Internet are unlikely to be in the 3GP format. There are very few programs that can convert any video format you can throw at it into a 3GP file. SUPER is the best I have found for this jpb. The only output container choice which worked consistently on the E6 for me was the 3GP (Nokia/NEC/Siemens) option (see above screenshot).

Once converted to 3GP by SUPER, transfer the file to your cellphone and enjoy it on your commute! 🙂


Inkscape: Wacom Bamboo Fun

I bought my Wacom Bamboo Fun tablet more than a year ago. And from that time until now, it has never worked with Windows applications built with GTK+ like Inkscape and GIMP. The mouse cursor would freeze up the moment it entered the application window!

There seems to be some fixes in GTK+ now to ameliorate this situation. To fix this problem for Inkscape:

  1. Update Inkscape to the latest version.
  2. Download GTK+ 2.18 or later for Windows. Unzip the setup file.
  3. Replace libgdk-win32-2.0-0.dll in C:\Program Files\Inkscape with the same file from GTK+.

The Wacom Bamboo Fun mouse and pen should work fine with Inkscape now. Sadly, this does not fix GIMP to work with Bamboo Fun! 😦

Update: John Burnett has suggested an alternate solution that should probably work. Please see the comments below.

Adobe Acrobat: OCR

You have scanned in a paper or a section of a book and converted it to a PDF. What next? The next best thing to do would be to run OCR on the PDF.

I use Adobe Acrobat for this. The converted PDF document right now is only acting as a container for the scanned bitmap images. By running OCR on it, Acrobat can recognize text in the image and embed it along with the image. This way you can mark and copy text in the PDF. And also be able to search for text in the document.

To do OCR:

Choose DocumentOCR Text RecognitionRecognize text using OCR …

In the Recognize Text dialog that pops up the default options should be fine. Click OK.

The OCR then runs on each page serially and may take some time on long documents. You may also notice that the scanned images in the document get straightened a bit and may also get downsampled. After the OCR is complete, save the PDF.

ImageMagick: Convert images to PDF document

The convert command-line tool from ImageMagick is the easiest way I know to convert a bunch of images into a single PDF document. It is as easy as:

convert *.jpg paper.pdf

(Make sure the ImageMagick installation path is in your %PATH% environment variable for this to work from any directory.)

I typically use this to convert the scans of old CS papers. Even today there is a surprisingly large amount of old CS papers that are not available online in a digital format. The only option is to head down to the library, get hold of the journal and either photocopy or scan the pages. I always prefer to scan in the paper as JPG images, then straighten and edit the images a bit in Picasa and then convert it into a PDF document.

Windows: Fonts Folder

Windows Explorer displays the contents of the Fonts folder (C:\Windows\Fonts) in a special way. You may need to be aware of this if you need the complete path of a particular font. For example, as input to a command-line program (say adding text to an image using Imagemagick) or in your application code.

  • Explorer does not display the filenames of the fonts. You cannot see the filename no matter what kind of View you switch Explorer to.
  • Also, Explorer displays the fonts grouped by Font Family. (Note that the Fonts directory is actually completely flat, there are no subdirectories in it. The Font Family grouping is GUI sugar by Explorer.) Only obscure fonts which are alone are displayed as individual fonts. The Font Family is like a folder in Explorer, open it to see the individual fonts.

fontext.dll seems to be the special DLL that Explorer uses for displaying the Fonts folder. (C:\Windows\System32\fontext.dll) It can be observed that Windows creates a temporary fontext.dll.mui whenever the Fonts folder is opened in Explorer, this indicates that this DLL is being used. (.mui or MUI is Multilingual User Interface, a Windows technology to enable user interfaces in multiple languages on the same computer.) There seems to be very little information available about this DLL.

Anyway, to see the font filename, right-click the individual font and open its Properties. (For example, Consolas Bold turns out to be consolab.ttf)

Or you could open up a command window and look at the contents of the C:\Windows\Fonts directory. You will also notice that all the fonts actually have only a 8.3 filename! Even the newer Vista and Windows 7 fonts!

PS: I also noted with a tinge of sadness that the old Add Fonts dialog box had finally been laid to rest in Windows 7. It cannot be found or invoked from anywhere. This decrepit looking dialog box had been in Windows since the days of Windows 3.1 for almost 20 years (upto Vista).

Windows: Path with spaces

Windows Vista fixed one colossal mistake Microsoft had made with directory names. The obnoxiously named C:\Documents and Settings was changed to the short and sweet C:\Users. It was short, meaningful and most importantly it did not have spaces in the path! The My (and the following space) was removed from directories like My Documents and they were shortened to Documents, Pictures and Videos.

I know it is 2009 and I should expect most real-world applications to deal with paths that have spaces. (Sadly, a lot of open-source applications ported over from Linux to Windows fail on this.) However, I believe that it is of paramount importance that the default Windows directory names themselves should be as short as possible and have no spaces.

There is one elephant that remains, even in Windows 7: C:\Program Files

Strangely, there are some applications and libraries that (can deal with paths with spaces, but) require their installation path to have no spaces! Since they cannot work from C:\Program Files they try to install themselves onto C:\ itself. This irritates me a lot, since it clutters up that root directory! So, I resort to having another C:\Programs\ folder around for these applications to install into. The famous culprits that do this are cygwin, CGAL and Qt.

What I would like to learn from the likes of Raymond Chen is why Windows 7 still uses C:\Program Files instead of using something shorter like C:\Programs?! If they could go through the pains of renaming Documents and Settings and its bastard children, surely they could have done the same with Program Files!!!

Robocopy: Backup rights on Windows 7

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.)

Firefox: Changing size of dialog boxes

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.

CUDA: Environment Variables

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