Archive for the ‘Howto’ Category

Dual Monitors w/ Dual Video Cards in Fedora 10 & Ubuntu 8.10

Friday, January 2nd, 2009

There’s more than one way to skin a cat, and there are at least four ways to set up dual monitors in GNU/Linux.

  1. Xinerama (the right way)
  2. nVidia TwinView (the way that supports companies that want to control how you use your computer)
  3. Matrox MergedFG (another good way)
  4. BigDesktop (ATI’s analog of option 2)

I don’t believe options 2 and 4 are really options for me since I do not like the idea of paying for a video card and not being able to use it freely. I will describe my setup and include my xorg.conf as well, for Fedora 10. I’m hoping that it will also work for Ubuntu, and I’ll post on that ASAP.

First, my hardware. I have a cheap ATI Rage 128 and an nVidia GeForce4 MX 4000. The nVidia has two outputs, so I was able to get dual monitors working with TwinView, but I only did that to make sure it would support it. I don’t think that it supports dual monitors with Xinerama, unless I use the nVidia card. So, that’s why I have my $20 ATI card. I will also report on whether I can get it working with the nVidia card only, but later..

I followed the guide for Xinerama, pretty much exactly. When I was done I made sure that the r128 driver was loaded by doing

modprobe r128

I had made a back up copy of my xorg.conf, of course. You only forget this step one time. Or twice, but no more :-)

I restarted X after following the guide above, thinking that there would probably be a few glitches. Well, there was one glitch, and it was the line that said

Fatal server error:
Caught signal 11.  Server aborting

But I looked back through the file “/var/log/Xorg.0.log” and noticed the following:

(EE) Screen 1 deleted because of no matching config section.

It turns out that in my xorg.conf file, I had labeled the screen for the ATI card, which is not what I wanted to do. It turns out that in the “Device” section (for the ATI card) the meaning of “Screen” is not related to displays, but which output of the card. For my nVidia card there are two outputs, so I needed to label the Screen there as the first screen. In the ATI section, I don’t want to label the screen since there is only one output. Weird. Here’s what it looks like now:

Section "Device"
Identifier     "Device0"
Driver         "nv"
VendorName     "NVIDIA Corporation"
BoardName      "GeForce4 MX 4000"
BusID          "PCI:2:0:0"
Screen         0
Option         "DDCMode" "true"
EndSection

Section "Device"
Identifier     "Device1"
Driver         "r128"
VendorName     "ATI Technologies Inc"
BoardName      "Rage 128 PP/PRO TMDS"
BusID          "PCI:1:6:0"
Option         "DDCMode" "true"
EndSection

This fixed my errors, and I was able to restart X with this new and improved xorg.conf.

I also had to edit /etc/gdm/custom.conf (in Fedora 10) or /etc/gdm/gdm.conf-custom (in Ubuntu 8.10) to add this line under the [xdmcp] section:

DisplaysPerHost=2

I still have issues when X stops (either by restarting X by CTL+ALT+BKSP or logging out from within Gnome). This issue is related to X and possibly also gdm, because I can exit from within a non-gdm X Gnome session and it will turn the shell screen into fuzzy gibberish. I can still type startx (and then it locks up with a blinking cursor on the top left of the primary screen — the other one is blank). I have to soft reset to get out of it.

Section “ServerLayout”
Identifier “Default Layout”
Screen 0 “Screen0″
Screen 1 “Screen1″ RightOf “Screen0″
InputDevice “Keyboard0″ “CoreKeyboard”
InputDevice “Mouse0″ “CorePointer”
Option “Xinerama” “true”
EndSection

Section “Files”
EndSection

Section “Module”
Load “dbe”
Load “extmod”
Load “type1″
Load “freetype”
Load “glx”
EndSection

Section “ServerFlags”
Option “Xinerama” “0″
EndSection

Section “InputDevice”
Identifier “Mouse0″
Driver “mouse”
Option “Protocol” “auto”
Option “Device” “/dev/psaux”
Option “Emulate3Buttons” “no”
Option “ZAxisMapping” “4 5″
EndSection

Section “InputDevice”
Identifier “Keyboard0″
Driver “kbd”
EndSection

Section “Monitor”
Identifier “Monitor0″
VendorName “Aopen”
ModelName “AOP F90JS”
HorizSync 30.0 – 80.0
VertRefresh 55.0 – 75.0
Option “DPMS”
EndSection

Section “Monitor”
Identifier “Monitor1″
VendorName “Unknown”
ModelName “ViewSonic Q9-2 Series”
HorizSync 30.0 – 80.0
VertRefresh 55.0 – 75.0
Option “DPMS”
EndSection

Section “Device”
Identifier “Device0″
Driver “nv”
VendorName “NVIDIA Corporation”
BoardName “GeForce4 MX 4000″
BusID “PCI:2:0:0″
Screen 0
Option “DDCMode” “true”
EndSection

Section “Device”
Identifier “Device1″
Driver “r128″
VendorName “ATI Technologies Inc”
BoardName “Rage 128 PP/PRO TMDS”
BusID “PCI:1:6:0″
Option “DDCMode” “true”
EndSection

Section “Screen”
Identifier “Screen0″
Device “Device0″
Monitor “Monitor0″
DefaultDepth 24
SubSection “Display”
Depth 24
Modes “1280×1024″
EndSubSection
EndSection

Section “Screen”
Identifier “Screen1″
Device “Device1″
Monitor “Monitor1″
DefaultDepth 24
SubSection “Display”
Depth 24
Modes “1280×1024″
EndSubSection
EndSection

I hope this may be of use to someone down the road. Please ask questions, but don’t expect me to know much other than what I did to get my setup working.

Edit: I noticed that as of the latest Ubuntu kernel (and Fedora as well) the glitch is lessened. I can log out and log back in, but when I do the second (ATI) card displays some glitches in the screen about 60% over from the left, a vertical line about 1/4 an inch thick… it’s minor, and I can happily live with it.

Edit: I have now switched over to gNewSense and this setup still works fine. I’m using the latest Kernel Libre so that I can take advantage of the drivers for the Atheros cards that are not in the latest gNewSense liveCD kernel.

LaTeX in Gnome

Tuesday, June 10th, 2008

If you use LaTeX to create professional documents, and if you use GNU/Linux with Gnome, you are in the minority. I can’t possibly overrate this setup, and I encourage you to invest some time in it – it will be worth the gains to you, especially if you are a researcher and write papers a lot. I used LaTeX for my English papers in my college composition class. LaTeX is useful for writing books as well, in fact it is the de facto standard for publishing anything you want to look really awesome, especially math books and papers.

So, how do you set it up and begin using LaTeX? First things first. You have to learn about LaTeX. There are a bunch of tutorials, but a very nice one is by Andy Roberts -  Getting to Grips with LaTeX.

Next, you’ll want to get some sort of editor for LaTeX. For KDE (which is not Gnome, obviously) you would simply use Texmaker. The problem with installing this on Gnome is that you get a ton of new libraries for QT and it’s a lot of stuff to install for one program. There is an easier way – use Vim. Well, most people aren’t going to do that! How about using Gedit? It’s got a nice extension for LaTeX (and a lot of other nice extensions too). There is a nice website set up for this plugin to Gedit, and installing is a breeze. You’ll also need the rubber package which includes the TeX libraries and all.

The Gedit plugin is in beta, so not everything works just perfectly. Hey, if you like it, donate to the people who are writing it – Free Software doesn’t have to be gratis. You might encourage them to finish your favorite missing feature sooner.

LDAP Servers at VCU

Thursday, April 3rd, 2008

It’s funny that it’s taken me this long to think about using an LDAP server for all my VCU email addresses. Everyone has an address that is available online anyway, so VCU let’s you use the LDAP server to quickly look up addresses.

There is a page dedicated to setting up an LDAP server in Thunderbird at the VCU Technology Services website, so I won’t repeat it here.

LDAP can be used for many things I suppose, but it seems most useful for email addresses and phone numbers.

For my own future reference, there is an LDAP server at NCSU as well.

Enable numlock at startup in GNU/Linux

Sunday, April 22nd, 2007

Many GNU/Linux distributions are set up so that when X starts the numlock key is disabled. It’s really a simple thing to fix, but it can be quite frustrating until you get around to fixing it. Here’s a quick way to fix it that I’ve used on Ubuntu. I will also discuss a method that should work on other systems.

Ubuntu

I started out by looking at the UbuntuGuide for help. There is a quick fix there that involves using the Gnome Desktop Manager (GDM). I don’t want to be tied to that program, even though I use it. It seems to me that the fix should be independent of the particular desktop environment. In fact, it is independent. There is a handy little program called numlockx that can be used in various ways to fix the problem.

Start out by installing numlockx:

sudo aptitude install numlockx

Now add an entry to your Xsession file, as follows:

sudo vim /etc/X11/Xsession

Page down until you see the line “exit (0)”, and paste this code above that line:

# Turn on numlock when X starts.
if [ -x /usr/bin/numlockx ]; then
    /usr/bin/numlockx on
fi

Now you can save the file and restart your X session to see that it works.

Other Distros

For other distributions, I believe you can add this line to your /etc/X11/xinitrc file:

numlockx on

I haven’t tested this, but if you try it, let me know how it works.

Java newline characters

Monday, March 26th, 2007

Java doesn’t work the same way on all platforms (GNU/Linux, Windows, Mac), even though the Java Virtual Machine was designed for that purpose. In fact, there are some system inconsistencies that apparently can’t be avoided. For example, each operating system uses different end-of-line characters in text files.

  • Windows: [ \r\n ]
  • GNU/Linux or Unix: [ \n ]
  • Macintosh: [ \r ]
  • and sometimes [ \f ]

If you want to read information from a string, input stream or a file, you can use the Scanner class to accomplish this task. If the file is delimited with a comma and then a space “, ” you must set the delimiter by object.useDelimiter(", ");. You can also put a regular expression in the parentheses like this: object.useDelimiter(", |\n"); and then the Scanner will look for a comma-space or an end of the line.

Suppose you want to scan a line that contains several types of data (String, int, etc) that looks like this: George Jones, 44, 88, 99, 22, 90 and suppose you set up to scan it using this method: object.next();. You must first set the delimiter, of course. Then you will have no trouble scanning the name George Jones. But, then let’s suppose you want to scan the numbers as integers. You can use object.nextInt(); which works fine until the last number 90. At that point there is no next comma-space delimiter to find, so you get an exception.

The solution to this problem is to use the proper delimiters: object.useDelimiter(", |\n");. In the case that you created the file on Windows, that will NOT work. You must use \r\n in that case. Once you know the correct characters for the file, you can use the expression "\n|\r\n|\r" and it will work on files created on all major operating systems.

Another complication to using Java is if you compile a program on Linux it will set the default end-of-line characters to the GNU/Linux (\n); however if you compile it on Windows it will use (\r\n).

Somtimes it may be necessary to use the [ \f ] delimiter, though I am not sure at which times. This delimiter is called the “form feed” character. If you have problems with end of lines, just try it.

Also, be aware that GNU/Linux text documents usually have a trailing empty line at the end of the file.

Quick and dirty CD burning with cdrecord

Sunday, March 25th, 2007

To make a cd from an iso file, it’s pretty easy with cdrecord. I’ve had less luck using graphical front-ends to cdrecord (such as xcdroast, xfburn, etc).

You must first create the iso file to burn. This is pretty simple. Make a temporary directory somewhere, and put all the files you wish to burn into this directory. To create an iso filesystem image in the file output.iso, where the directory temp will become the root directory in the iso:

mkisofs -o output.iso temp

Now, to find information on your burner device:

cdrecord --scanbus dev=ATA

Then, to burn the iso image:

cdrecord -v speed=40 dev=ATA:x,x,x output.iso

Where the x,x,x is noted in the readout for the scanbus command.

Obviously, you can change the speed as you wish. I usually write as fast as possible, and I don’t have problems.

How to get Firefox and Thunderbird to send links to each other

Sunday, March 25th, 2007

Often, when using Firefox and Thunderbird on GNU/Linux, there is a problem that can be annoying. When you click on an email address in Firefox, it won’t do anything (you want Thunderbird to open a new message with the email address in the mailto link). It can happen in Thunderbird too, when you click on a url (you want Firefox to open a new tab or window with that url). Here’s a pretty simple way to fix it.

In order to get Firefox to send mailto links to Thunderbird:

  1. Open Firefox
  2. In the navigation bar type about:config
  3. In the page of items right click and select New >> String
  4. Insert name: network.protocol-handler.app.mailto
  5. Insert value: thunderbird

Another way to do it is to edit your “/home/USER/.mozilla/xxxxx.default/prefs.js” file. You should do this when Firefox is not running, otherwise it will not save the modifications. Just add one of these lines, according to your specific system. You may have to check to see which it is for you by running “thunderbird” and “mozilla-thunderbird” in a terminal to see which one opens Thunderbird.

user_pref("network.protocol-handler.app.mailto","thunderbird");
OR
user_pref("network.protocol-handler.app.mailto","mozilla-thunderbird");

In order to get Thunderbird to send url clicks to Firefox, edit the file “/home/USER/.mozilla-thunderbird/xxxxx.default/prefs.js” by adding the following line:

user_pref("network.protocol-handler.app.http","firefox");

If you are using another program for mail, you could try the part above using, for example, “evolution” instead of thunderbird.

Enable Firefox 2 backspace navigation

Friday, November 17th, 2006

In Firefox 1.x, I was accustomed to using the backspace button to navigate to the previous page in history. One click back navigation is a feature I’ve grown accustomed to, and I wouldn’t want to do without it. In case this feature is disabled in your version of Firefox 2, here is a simple way to enable it again. Firefox has a convenient interface for advanced settings, and it is not found in the preferences. To get to it you simply type “about:config” in the address bar.

Once there, you should see a list of configuration items. It may take a while to scroll through looking for the right one, and when you see it you may not know that it’s the right entry. Instead, you can type browser.backspace_action into the filter field at the top.

Double click on the line to change the value. If you want to use the backspace button, enter “0″, otherwise leave it at “1″.

It’s strange that there was an extension for Firefox 1.x to disable this feature. There must be a lot of people who want the backspace button to do something else, or possibly they want to be able to use alt+arrowLeft to do it. If you were happy that Firefox 2 disabled it, I’d like to know your reason. Comments are welcome!