Archive for the ‘Howto’ Category

Redirect linux console beep to the sound card

Monday, January 19th, 2009

I’ve been frustrated for a long time that my Ubuntu Hardy Heron desktop machine would send a console or terminal beep (e.g. ctrl-G) to the PC speaker for a harsh 1980’s-style tone from under my desk.  I usually turn off the audible beep and live with a visual beep (screen or window flash), but I’ve started using irssi through screen, and I wanted a way to let it notify me of messages even when buried under other windows.

I tried softbeep, but that didn’t work for me.  However, I just found the Fancy Beeper Daemon, which did.  Here’s what I did to set it up.

First, I downloaded and unpacked the beep-2.6.24+.tar.gz tarball.  Then I ran “sudo install.sh” (I already had the linux kernel headers and compiler tools installed.)

For whatever reason,the new /dev/beep device wasn’t globally readable, so “sudo chmod a+r /dev/beep fixed that.  (A more sophisticated approach would have that chown to the console user on login, but this is a single-user machine, so I didn’t bother.)

Once that was done, I needed a daemon to poll that device and play a sound using aplay.  The Fancy Beeper Daemon tarball includes several examples, but I chose to create my own instead: beepd_aplay (to use this, change the user, group and pid file location to suit your own setup).

Then I added that to my .bashrc to run automatically when I log in.   Now, I get a nice sound through my sound card and speakers instead of that harsh system beep.

Avoiding the “encountered a problem and needs to close” dialog on Windows

Tuesday, March 25th, 2008

When running some Perl batch programs on Microsoft Windows XP, I got frustrated that some sub-programs would crash and pop up a dialog box with a message “perl.exe has encountered a problem and needs to close”.

Since the dialog is modal, everything stops until I press a button, which is incredibly annoying! If it needs to close, then just close and get on with it!

After some digging around on the web, I found a way to suppress those dialogs:

KB#124873: Disabling System Hard Error Message Dialog Boxes

In short, set the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\ErrorMode
registry key to the value “2″.

Hosting a git repository on dreamhost

Saturday, January 26th, 2008

[This entry updated April 14, 2008 based on comments and this blog. Updated again August 26, 2008.]

I use dreamhost.com as my hosting provider and wanted to use it to host git repositories as well. git supports publishing via HTTP so that part is pretty easy, but I also wanted to make it easy to push my local work to the repository on dreamhost.

Unfortunately, git documentation was a little impenetrable the first few times I read it and dreamhost doesn’t offer git automatically, so here is a summary of what I did in case it helps
someone else figure it out.

(more…)

ActiveState Perl and Microsoft Visual C++ Express 2005

Saturday, November 17th, 2007

I recently tried to use Microsoft’s free Visual C++ Express 2005 with ActiveState Perl to compile XS modules from CPAN and found that it wouldn’t work. The fix appears to be adding a file to the C:\perl\bin directory: perl.exe.manifest

This fix taken from Perl Monks: Problems with FREE MS VC++ tools.

Gutsy Nvidia Twinview window placement

Sunday, November 11th, 2007

I recently upgraded to Ubuntu Gutsy Gibbon with the built-in Nvidia drivers and discovered that my dual monitor desktop reverted to the annoying behavior of placing windows and dialogs dead center in the expanded desktop, right at the split between the two monitors. It would also maximize windows across both monitors rather than just one.

After trying various configuration options in xorg.conf, I found that a simple change to the Compiz Advanced Desktop Effects Settings fixed this problem, at least for most windows. (Some dialogs still split the screens.)

First, install the compizconfig-settings-manager package, which adds the Advanced Desktop Effects Settings application to the System->Preferences menu.

Next, launch that preference app and select the “Display Settings” tab. Manually set the display output configuration in the “Outputs” section, then uncheck “Detect Outputs”. For example, for my side-by-side 1280×1024 screens:


Display Settings

Logout and restart X (Ctrl-Alt-Backspace). That should fix the problem.

Some of the Compiz effects may wind up restricted to a single monitor. To fix this, many of them have options to span the effect across all monitors. For example, the “Scale” effect has the following option:


Scale Settings