All posts by Aaron

Cygwin/X causes NVIDIA Optimus to run all of the time

NVIDIA Optimus is a technology that is used in systems with both an integrated Intel GPU and a discrete NVIDIA GPU.  Speaking of modern systems, this is pretty much any system with an NVIDIA GPU, as all Sandy Bridge and Ivy Bridge CPUs from Intel contain an Intel GPU on the chip.  Naturally, the Intel GPU is less capable than the NVIDIA GPU, but it uses considerably less power and is completely adequate for all but the most demanding graphics tasks.  So, Optimus allows the Intel GPU to run most of the time, kicking in the NVIDIA GPU only when it is needed for games or graphically-intensive applications.  Since the NVIDIA GPU is able to be powered off most of the time, the system uses less power, less heat, and lasts longer on battery.

NVIDIA will automatically guess which apps should be used for which GPU based on profiles that are managed by NVIDIA and updated regularly.  However, you have the choice to override this behavior and decide on an app-by-app basis which GPU should be used.  I have my machine set up to use the integrated GPU for everything by default, and have a list of just a few apps that will kick in the NVIDIA GPU.

Cygwin/X, or XWin, is an X server that you can run on Windows that allows you to run X applications (locally, or remotely via SSH tunnel).

I was recently poking around and discovered that Cygwin/X causes Optimus to activate the NVIDIA GPU (regardless of what is set in the NVIDIA control panel).


Continue reading Cygwin/X causes NVIDIA Optimus to run all of the time

Windows 8: Stuck on “Maintenance in Progress”

My Windows 8 machine ran out of disk space this morning.  The Windows Search service decided that it should gobble up all of my remaining space with an index file nearly 300 GB in size.  But, that’s a different problem.

Anyway, running out of disk space always causes some odd things to happen.  One of them was that the flag icon in the system tray reported “Maintenance in progress” and would not stop.  Opening up the Action Center, I could see that it indeed claimed maintenance was in progress, but clicking the “Stop” link didn’t do anything.  It appears that the automatic maintenance tried to run at some point during the night, broke because the disk was full, and ended up stuck in a bad state.  This persisted across a regular reboot.

To fix it, you have to manually start and stop it again.

  • Go to Task Scheduler.
  • Navigate to Task Scheduler Library\Microsoft\Windows\TaskScheduler.
  • Right-click “Regular Maintenance” and select “Properties.”
  • Go to the “Settings” tab, check “Allow this task to be run on demand,” and click “OK.”
  • Right-click “Regular Maintenance” and click “Run,” then do it again and click “End.”

After this, the automatic maintenance issue should be sorted out.


writhziden in this thread found the solution.

IDT: The SigmaTel audio driver must be removed

I migrated my Windows installation from my old machine (with a SigmaTel audio controller) to my new machine (with an IDT audio controller).

Both the SigmaTel controller and the IDT controller work with the standard Windows HD audio driver.  However, to gain access to additional functionality, like the ability to switch the input port between “microphone” mode and “line in” mode, a more specific driver is required.

When trying to install the IDT driver, it insisted that I must first uninstall the SigmaTel driver with the error message:

The SigmaTel audio driver must be removed. Please uninstall the SigmaTel audio driver from the system and then run this installer again.

My SigmaTel device is no longer present and I was not able to find anything in “Uninstall” programs list related to it.  Using Process Monitor, I noticed that the IDT installer was checking:


Deleting this registry key solved the problem.

Installing the Samsung ML-1210 printer driver on Windows 8, Windows 10 (also other Samsung, Lexmark, Xerox laser printers with unsigned drivers)

Note, September 8, 2015: This article was written for Windows 8, but the process also works with Windows 10.

Alright, so.  I have a Samsung ML-1210 printer, which is a pretty old black-and-white laser printer.

Samsung made an unsigned 64-bit driver available for Windows Vista.  This driver also happens to work with Windows 7 (in fact they later re-packaged it and added Windows 7 to the list of supported operating systems).  Windows 7 complains about the missing signature but will allow you to install the driver.  I used it for a few years this way.  However, Windows 8 is not happy to take the driver.  It complains about missing file hashes, claims that the software was probably tampered with, and will not install the driver.

Samsung also has a “universal” driver available.  I couldn’t get it to work with the ML-1210.

After quite a bit of searching, I came across an easy solution.  I noticed that several other Samsung printers from the era have the same driver available for download.  Sure enough, the driver supports many different printer models, which is not surprising really since they probably all use a similar if not identical communication protocol.  However, on the support page for the ML-2250, they have a different version of the driver posted (9.61 MB instead of 9.6 MB, even though the version number is the same).  Hmm…

It turns out that this driver also supports the ML-1210, and it is signed.

Here’s what you do.

  • Download the “Print Driver,GDI” version 3.01 (9.61 MB) from the ML-2250 page (linked above).  You get a file called ML-2250_Win7_GDI.exe.
  • Use WinRAR or a similar tool to extract the files compressed in ML-2250_Win7_GDI.exe.
  • In the files you extracted, navigate to Printer\GDI\VISTA_64.  Here’s your printer driver.  Save the contents, and point Windows here during driver installation.

One other note.  Windows 8 didn’t actually ask me for the driver.  It just installed the printer without a driver, I had to find it under “Other devices” in the device manager and install the driver manually.  After that, everything worked fine.

This solution is probably not limited to the ML-1210, but to other Samsung GDI printers that don’t have a signed driver available for download on their page.  There are several printers listed as supported in the INF.

Update: November 5, 2012

Pascal notes in the comments that this also works with a Lexmark printer, so it’s not limited to just Samsung laser printers.  Also, I recently had an issue on the server that hosts this site and had to restore a backup of my database, so I lost a few days of comments right around the launch of Windows 8.  A few other Samsung printers have been reported working with this driver, including the ML-1740.  If you got your printer working, let us all know the model number in the comments below.

Update: March 13, 2013

From the comments, it looks like there are some Xerox printers out there that also work with this driver.

“Sharing” tab missing from folder properties in Windows 7

This morning, I noticed that the “Sharing” tab was missing from my folder “Properties” windows.  I have no idea how long this has been the case, but it’s something that I need to be available when I need it.

There was also no “Share With” option on the right-click context menu for folders.

Searching the Internet lead to a lot of suggestions that did nothing to fix my issue, but this thread provided the critical hint.  Someone else with the same problem figured out that ntshrui.dll is the library that provides the sharing functionality, and somehow it was not being called.  The solution was to look in the registry of a fresh, working Windows 7 install for references to this library and copy them over to the install with the missing “Sharing” tab.

Although he reports success, he doesn’t give the registry entries.  So, I booted up my Windows 7 VM, looked for entries that seem to tie ntshrui.dll to sharing functionality, and exported them all.  I imported the registry file on my main Windows install, which was having the problem.  After logging off and logging back on, I found the “Sharing” tab to be back.

Here is the registry file that I ended up with.  If you have this problem, try importing the file (don’t worry if you get an error that not all entries could be written), and then log off and on again.  It might work, but it’s possible that there are other things that could cause this as well.

Check hardware RAID array status on Ubuntu Server

Here’s a post I’ve been sitting on for a bit over two years.  I was doing some clean-up/organization on my hard drive today and I ran across the text file with the notes that I made.  :-P

We have some Dell servers running Ubuntu Server on a RAID array.  It is necessary to be able to check on the status of the RAID array programmatically and fire off alerts if one of the disks fails.

This is actually pretty easy to accomplish.

First, install the mpt-status package (sudo aptitude install mpt-status).

Then, load the mptctl kernel module (sudo modprobe mptctl).

Find the SCSI ID for your disk array (sudo mpt-status -p).  For me, it was “2.”

Get a RAID status report with mpt-status -i 2 (where “2” is the SCSI ID from the previous step).  mpt-status should be run as the root user. You can add the -n flag to get some additional information in the output, including the percent completion of an in-progress rebuild operation.

The exit code for mpt-status will be 0 if everything looks good or something else if there is a problem.

Move a Windows install from one machine to another using in-place upgrade

Update, May 17, 2016: With Windows 10, and maybe Windows 8/8.1 as well, you don’t need to jump through these hoops.  Just move or clone a drive to your new system and boot it up.  Windows detects that it has been moved and does a new device scan.  If your new system needs a disk controller driver that is not built into Windows (i.e. some kind of RAID device), you’ll want to make sure that the driver is installed before the move.

Windows usually isn’t very happy when you try to move it to a different PC. If you were to take the hard drive out of one PC, install it in a different PC, and try to boot it up, unless the system components were identical or very similar, you would probably be presented with a BSOD right after the boot begins.

There are a few different ways to prepare your Windows installation to be moved to a different machine. One way is to use Sysprep to generalize your installation. This will make it forget about a lot of the hardware-specific information that it has and allow it to be booted on different hardware. The downside is that it loses a lot of your personalizations.

I’m writing about the in-place upgrade method because I didn’t find another article explaining it in detail. This method isn’t necessarily better than the Sysprep method, but it will keep all of your settings and programs. You will lose some installed Windows updates, which you will have to install again after the switch is complete.

Continue reading Move a Windows install from one machine to another using in-place upgrade

Ctrl+C to copy does not always work in Eclipse

Alright, here’s an annoying one.  When using Eclipse, I find that Ctrl+C fails to perform the “copy” operation.  Sometimes.

So, I press Ctrl+C to copy and go someplace else to paste and find the previous contents of the clipboard have been inserted.  Somewhat annoying.  I got into the habit of pressing Ctrl+C several times to make sure the copy command went through, but sometimes it still would not.

This issue does not appear to be specific to any particular platform or version.  I am experiencing the issue with Eclipse 4.1.2 on Windows, and a coworker of mine is experiencing the same thing in Eclipse 3.7.2 for OS X.  However, we are working on a rather large project (a few thousand files), which means Eclipse’s memory use is rather high and the editor seems to briefly “stall” from time to time.  These stalls aren’t long or annoying enough to get in the way of getting work done, but if you happen to hit the Ctrl+C while it is stalling, the copy command does not process.  The problem may get slightly worse if Eclipse is open for a long time.

That’s my working theory, anyway; I may be completely off, as others are reporting this and making no mention of a large project.  There is in fact a bug report on the issue in the Eclipse bug tracker that suggests that the bug may have been introduced in Indigo SR1 (Eclipse 3.7.1 and 4.1.1) — and also an older report describing similar behavior as far back as 2007, that was supposedly fixed, but people continued to report the issue was occurring.

In the newer report, Jun Luo suggested on Monday to unbind the keyboard shortcuts for cut, copy, and paste in Eclipse Preferences -> General -> Keys.  I tried removing the Ctrl+C binding and all week I have not experienced this issue, so I am calling it fixed.  My Mac-using coworker has not reported the issue recurring since removing the ⌘+C binding, either.

It is strange that removing the registered Ctrl+C shortcut for copying text actually fixes it.  I am supposing that this removes any special binding that Eclipse itself makes to Ctrl+C; however, the underlying SWT element still processes it as a copy command, and this works even if Eclipse is a little busy.

What’s funny is later on in the week, I experienced the same issue with Ctrl+X for “cut.”  I cut some text, it disappeared, and when I went to paste it, I got the previous contents of my clipboard.  So, I’ve disabled the “Ctrl+X” binding for “cut” as well.

Use rsync to copy only one type of file

Scenario: A remote server has a bunch of PHP files that I want to copy down to my machine.  I want to periodically update my local copy of the files, catching up with changes that have been made to the files on the server, but ideally not copying over everything again.

rsync is perfect for this.

However, there’s a catch:  There’s an enormous amount of data on the remote side that I do not want.  I only want the PHP files.  How do I tell rsync to copy only one type of file?

The solution is not very complicated but it is also not very intuitive.  Here’s what I ended up with, which seems to work fine:

rsync (--options) /path/to/local/copy --include '*/' --include '*.php' --exclude '*'

That --include '*/' is the part that is particularly confusing.  This instructs rsync to include files in subdirectories, even though the --exclude '*' is given (which keeps rsync from copying everything).  If you don’t have it, you’ll only get the PHP files from the root level of the copy source.

Thanks to Maururu for the hint.