How to fix MBR for Windows


I had installed Windows 10 successfully. While messing around with my other Linux partitions, a partition delete went awry and on booting I was dropped into a GRUB rescue prompt. What I wanted was the Master Boot Record to be restored to boot into Windows 10.


  • On another computer, I downloaded a Windows 10 ISO and created a bootable Windows recovery USB disk as described here.

  • I booted with this USB disk, chose Troubleshoot -> Advanced Options -> Command Prompt.

  • At the command prompt, type these commands:

$ bootrec /rebuildbcd
$ bootrec /fixmbr
$ bootrec /fixboot
$ exit

After restarting I was able to boot into Windows 10.

How to create Windows installer USB stick using WinUSB

A USB thumb drive with Windows ISO on it can be used to install Windows newly or repair an existing installation of Windows. Such a bootable USB stick can be created easily on Ubuntu:

  • Prepare the ISO of the version of Windows you want to install or use. For example, the Windows 10 ISO can be obtained here. If you are upgrading from a Windows 7 or 8, you can find out which version you are allowed to upgrade to here (check the Upgrade Editions section).

  • Note that common tools like Startup Disk Creator or UNetBootIn can only create installer USB sticks for Linux operating systems. They cannot be used for installing Windows.

  • An easy tool to create an installer USB thumb drive for booting Windows is WinUSB. It can be installed from a PPA:

$ sudo add-apt-repository ppa:colingille/freshlight  
$ sudo apt-get update  
$ sudo apt-get install winusb
  • Plug in your USB stick, open WinUSB and create a bootable Windows installation media.

You should be able to boot up using this USB stick.

Tried with: WinUSB 1.0.11, Windows 10 x64 and Ubuntu 14.04

How to show images in split window in OpenCV

A typical scenario in computer vision is to show multiple images in different parts of a single window, like a split window. However, OpenCV can only display a single cv::Mat in a single window using cv::imshow(). So, to achieve what we want, we create a single cv::Mat whose size is equal to the window. We copy our multiple images into this mat at the locations we want and just display the big mat.

(Note that this is far easier than the ROI regions you would need to use with IplImage.)

This sample illustrates showing two 640x480 images side-by-side in a single window:

// 640x480 images
cv::Mat mat_1;
cv::Mat mat_2;

// Create 1280x480 mat for window
cv::Mat win_mat(cv::Size(1280, 480), CV_8UC3);

// Copy small images into big mat
mat_1.copyTo(win_mat(cv::Rect(  0, 0, 640, 480)));
mat_2.copyTo(win_mat(cv::Rect(640, 0, 640, 480)));

// Display big mat
cv::imshow("Images", win_mat);

Tried with: OpenCV 2.4.8 and Ubuntu 14.04

How to remove driver in Windows


If you work with lots of devices in Windows, you are sure to run into problems with device drivers. Sometimes, a particular version of a device driver might cause problems and removing it might be the only solution.

Using Device Manager

This is an easy removal method if you have the device and know that its driver is being used when the device is plugged in. For such a case, plug in the device and open Device Manager. Right-click on the device and choose Properties. In the Driver tab, choose Uninstall.

Using Driver Store Explorer

If you do not have the device or plugging it in causes problems, then the Driver Store Explorer (RAPR) can be used to remove the driver as described here.

Tried with: Windows 7 x64

Feature transfer error: Access is denied


A friend of mine was trying to install the EMTrade program on Windows 8.1. He was logged in as a standard user, but when the installer asked for administrator permissions using User Account Control (UAC), he provided the login and password of an administrator account. The installer proceeded to install, but failed while creating the C:\Program Files\Emkay directory, with this error:

Feature transfer error
File: C:Program FilesEmkay
Access is denied


A few old installers for Windows still struggle with UAC. The EMTrade installer worked fine when I explicitly switched user, logged into an administrator account and installed from inside it.

Tried with: Windows 8.1

Ubuntu guest in VirtualBox loses network access after Windows host hibernate


I have a Windows host system which is running an Ubuntu guest inside VirtualBox. While the Ubuntu guest is running, I hibernate the Windows host. Later, after the Windows host is resumed, I find that network connectivity is lost in the Ubuntu guest. The LAN network interface is present and shows as connected. However, no domain name can be resolved or pinged.


I found that this bug in VirtualBox is reported here. Disconnecting the network interface and connecting back did not work. But, turning off networking and turning it back on worked!

Tried with: Ubuntu 14.04, VirtualBox 4.3.20 and Windows 7 Professional 64-bit

How to disable caps lock in Windows

Registry entry to disable caps lock.
Registry entry to disable caps lock.

I find that the caps lock key is useless for me and it only hinders typing when accidentally pressed. It can be disabled on Windows by adding a registry entry.

  • Save the text below as a disable_caps_lock.reg file:

It creates a new registry entry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

  • Double-click the file to add this registry entry and its value. It will ask for Administrator permissions.

  • Restart Windows. Your caps lock key should be disabled now.

  • To enable the caps lock back, open the Registry Editor, delete the above entry and restart Windows.

Tried with: Windows 7 Professional 64-bit

Driver Store Explorer

Windows (Vista and later) manage device drivers in a location called the driver store. This makes it easy to manage both the inbuilt and third-party drivers on the system. When you face some driver problems, you may want to view and manipulate with drivers.

The Driver Store Explorer (RAPR) is an useful tool to view, add or remove drivers from the driver store. I found it useful to fix a recent problem where a newer driver was not being installed over an older one.

I opened RAPR with Administrator privileges, clicked Enumerate to view the list of drivers, found the old offending driver and removed it. I later installed the new driver using its installer.

Tried with: RAPR 0.5 and Windows 7 x64