Motorola ROKR E6: USB Web Camera

One neat feature of most Motorola cellphones, including that of the Motorola ROKR E6 is that it can be easily used as a web camera with your computer. This is very handy since Motorola cellphones do not need any special cables and work with the ubiquitous mini-USB-to-USB cable. To use it as a web camera:

  • Install the web camera driver that is present on the CD accompanying the cellphone.
  • On the cellphone, open SetupUSB Mode and choose Webcamera.
  • Connect the cellphone through USB to the computer. It should be detected by Windows as a USB Video Device.
  • The cellphone camera should work as a web camera from any application. Switch the cellphone camera lens between Landscape and Macro modes to suit your need.
Advertisements

Eclipse: Find and Search

Eclipse is a strange beast. To search for a string, I was using the common Ctrl+F keyboard shortcut. This would pop up the familiar Find/Replace dialog. But soon, I was looking for a way to search through the entire project or workspace and could not find any way to do that using the Find/Replace dialog.

It turns out that there a larger, more complex Search feature in Eclipse! Why they would keep both Find and Search instead of combining them (like Visual Studio), that I cannot fathom. Ctrl+H is the default keyboard shortcut for this Search and indeed it shows up with custom searches for all the languages supported by Eclipse. (I use the PyDev Search, since I use Eclipse for Python code.)

The editor does not show the first matching search result (like in Find/Replace), but shows the Search results in a new Search window at the bottom. All in all, very odd business. But, at least I can now search through the entire project/workspace.

Python: Print to Standard Error

Printing error messages (as opposed to diagnostic log messages) to the Standard Error stream (sys.stderr) is a good habit. This is done by passing file=std.stderr to print(). In Eclipse, the sys.stderr messages are printed in a different color (red above) which is great to spot the error messages.

import sys
print("Checking oxygen tank", i, "... FAIL!", file=sys.stderr)

Tried with: Python 3.2

How to change limits of Console in Eclipse

The Console is one of the windows that is typically placed at the bottom of Eclipse. It is used to display the build output when compiling files and it is also used to display the console output written out by your program.

There is a limit to the number of characters or lines that the Console will hold. If your build or output is more than this limit, then the characters or lines at the top of the Console are silently removed. This can be problematic since it is very common for build outputs to be very verbose or for your program to spew a lot of output to the standard output. Thankfully, these limits can be changed or increased easily.

To change or increase the limit on number of lines of build output for C/C++, go to: Settings > C/C++ > Build > Console. The entry we need to change here is Limit console output (number of lines). The default limit is a tiny 500 lines. Increase it to a larger number like 10000.

To change or increase the limit on buffer size for output from your program, go to: Windows > Preferences > Run/Debug > Console. The entry we need to change here is Console buffer size (characters). The default limit is a small 80000 characters. Change it to a larger number like 1000000.

Tried with: Eclipse 3.7.2 and Ubuntu 12.04

How to add clickable hyperlinks and email addresses in LaTeX

Hyperlinks can be added to a LaTeX document by using the commands from the hyperref package:

\documentclass[a4paper]{article}
\usepackage{hyperref}   % Package for hyperlinks

\begin{document}
\href{http://web.media.mit.edu/~minsky/}{Marvin Minsky}\\   % Text to URL
\url{http://web.media.mit.edu/~minsky/}\\                   % Text is URL
\href{mailto:linus@kernel.org}{Email Linus}                 % Email
\end{document}

Note that the URL is displayed in a fixed-width font. This is the default font used for the \url command. If you want the URL to be displayed in the same font as that used for the rest of the document, use the \urlstyle command as follows:

\documentclass[a4paper]{article}
\usepackage{hyperref}   % Package for hyperlinks

\begin{document}
% Default URL font
\url{http://web.media.mit.edu/~minsky/}\\
% Set URL font to same as current text font
\urlstyle{same}
\url{http://web.media.mit.edu/~minsky/}\\
\end{document}

Windows XP: Launch Firewall as Non-Admin

Administrator privileges are needed to change the settings or add/delete/edit exceptions in the Windows Firewall. The Firewall application resides as a .cpl file in C:\Windows\System32. Control Panel (.cpl) files can be launched using the Windows Control Panel (control.exe).

Use the runas.exe command-line program to launch the firewall with Administrator privileges:

$ runas /user:ComputerName\AdminName "control firewall.cpl"

GDocs: Multi-select & Progress Bars with Flashblock

Google Docs now allows you to upload any kind of file into their online storage. I guess they noticed that people were emailing themselves lots of files to keep them stored online.

The GDocs file upload process has the same multi-select and progress bar capability as in Gmail. And similar to Gmail, it will not work properly if Flash is being blocked by the Flashblock addon. So, the fix for this problem is the same as for Gmail: Add docs.google.com to the Flashblock whitelist.

Wacom Bamboo Fun: The Case of the USB Hub on Windows 7

My Wacom Bamboo Fun which was working fine for more than a year with Windows XP continues to have problems with Windows 7. I have ensured that I have the latest Wacom drivers installed (v5.2.1-6) meant for Windows 7.

The problem is that sometimes the Wacom mouse cursor just freezes up. Nothing I do seems to unfreeze it. I unplug the tablet and plug it back, no change. I reboot the computer, sometimes this works, but sometimes even this does not unfreeze it! This problem was puzzling me for a while, until I ran across this post in the Wacom forums:

Make sure to connect the tablet to a USB port in the back of the machine and not through a hub or other USB extension.

Voila! My Wacom tablet is actually connected through a USB hub! The USB hub is in my Dell 1907FP display, which is connected by a USB cable to my PC case. The reason I need to do this is because I like to keep my PC case below the desk. That reduces clutter on the desk and frees up precious desk space. This is the USB connection hierarchy to my Wacom tablet:

Another post on the Wacom forums explained why the tablet will not work properly if connected through a USB hub:

Cause might either be that the tablet does not get sufficient power or that Windows can not find it’s HID drivers which a mandatory for the Wacom driver to connect to the tablet and operate properly. In order to make sure that the tablet is supplied with sufficient power, please connect it directly to a free port of your computer, not via a USB hub.

So, it is a power issue! Connecting the Wacom tablet through a USB hub is reducing the power available to the tablet. I connected the Wacom tablet directly to my PC case with a USB cable and the USB connection hierarchy reduced by a level. Notice how the Generic USB hub (which belongs to the Dell 1907FP display) is gone:

But, nothing on the forums could explain why the tablet was working fine under Windows XP. Since the only change is the OS, this must be a driver issue. Windows 7 HID drivers are checking on or doing something more stringent than Windows XP related to power.

In any case, changing the setup of my desk so that the Wacom tablet is connected directly to the PC case would be hard. Instead, there is a trick that seems to work for me. Whenever the mouse cursor freezes (which is about once a week), bring up the Tablet Preference File Utility and choose All User PreferencesRemove.

I cannot fathom why, but removing the tablet preferences of all the users unfreezes the mouse cursor and the tablet works again! 🙂

Windows XP: Run Explorer as Administrator

If you are using Windows XP as a non-admin user, you will frequently encounter file operations that require Administrator privileges. Logging off and on or using fast user switching to get to an Administrator account for trivial tasks is laborious. Instead, an easier way is to run an instance of Explorer with Administrator privileges.

However, if you try to execute the Windows Explorer shortcut (StartProgramsAccessoriesWindows Explorer) with the Run as trick, you may find that it does not work. To make this work, login into an Administrator account (say IAmRoot account), open Windows Explorer, choose ToolsFolder Options and enable the option Launch folder windows in a separate process. You should be able to launch Windows Explorer with Administrator privileges (of the IAmRoot account) from a non-admin account after this using Run as.

For more details and alternate methods to achieve the same, please check out the detailed post by Aaron Margosis on Runas with Explorer.

Foobar2000: File Operations

I find the File Operations component of Foobar2000 very useful to delete MP3 files in my playlist. The default delete only removes the track from the playlist, but with File Operations I can delete it from the playlist and the disk (which is what I want).

To do this, right-click on the track and from the context menu choose File OperationsDelete File.

The only nitpick I have with File Operations component is that it does not seem to be available on the Foobar2000 Components page. If you need it you need to choose it during installation from the Optional Features section in the Choose Components dialog.