Dual-headed Goodness

I finally figured out how to get my desktop box at work, running Ubuntu (of course!), to deal with the Matrox Parhelia P650 dual-headed video card and the pair of Dell 2001FP digital flat-panel monitors connected. I grabbed the latest Linux version of the Matrox video drivers from the Matrox driver support page, followed the binary driver installation instructions from the Ubuntu Wiki (Thanks, Cory!), and (after much Googling around for example configurations and a couple of false starts) cobbled together the following xorg.conf file. As always, YMMV significantly.

# /etc/X11/xorg.conf (xorg X Window System server configuration file)

Section "Files"
       FontPath        "unix/:7100"                    # local font server
       # if the local font server has problems, we can fall back on these
       FontPath        "/usr/lib/X11/fonts/misc"
       FontPath        "/usr/lib/X11/fonts/cyrillic"
       FontPath        "/usr/lib/X11/fonts/100dpi/:unscaled"
       FontPath        "/usr/lib/X11/fonts/75dpi/:unscaled"
       FontPath        "/usr/lib/X11/fonts/Type1"
       FontPath        "/usr/lib/X11/fonts/CID"
       FontPath        "/usr/lib/X11/fonts/100dpi"
       FontPath        "/usr/lib/X11/fonts/75dpi"
       # paths to defoma fonts
       FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
       FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID"
EndSection

Section "Module"
       Load    "bitmap"
       Load    "dbe"
       Load    "ddc"
       Load    "dri"
       Load    "extmod"
       Load    "freetype"
       Load    "glx"
       Load    "int10"
       Load    "record"
       Load    "type1"
       Load    "vbe"
EndSection

Section "InputDevice"
       Identifier      "Generic Keyboard"
       Driver          "keyboard"
       Option          "CoreKeyboard"
       Option          "XkbRules"      "xorg"
       Option          "XkbModel"      "pc104"
       Option          "XkbLayout"     "us"
EndSection

Section "InputDevice"
       Identifier      "Configured Mouse"
       Driver          "mouse"
       Option          "CorePointer"
       Option          "Device"                "/dev/input/mice"
       Option          "Protocol"              "ImPS/2"
       Option          "Emulate3Buttons"       "true"
       Option          "ZAxisMapping"          "4 5"
EndSection

Section "Device"
       Identifier      "MatroxVideoCard0"
       Driver          "mtx"
       BusID           "PCI:1:0:0"
       Option          "HWcursor" "off"
       Screen 0
       Option          "DigitalScreen1" "on"
EndSection

Section "Device"
       Identifier      "MatroxVideoCard1"
       Driver          "mtx"
       BusID           "PCI:1:0:0"
       Option          "HWcursor" "off"
       Screen 1
       Option          "DigitalScreen2" "on"
EndSection

Section "Monitor"
       Identifier      "Monitor0"
       VendorName      "Dell"
       ModelName       "Dell 2001FP (Digital)"
       DisplaySize     410 310
       HorizSync       31.0 - 80.0
       VertRefresh     56.0 - 76.0
       Option          "dpms"
EndSection

Section "Monitor"
       Identifier      "Monitor1"
       VendorName      "Dell"
       ModelName       "Dell 2001FP (Digital)"
       DisplaySize     410 310
       HorizSync       31.0 - 80.0
       VertRefresh     56.0 - 76.0
       Option          "dpms"
EndSection


Section "Screen"
       Identifier      "Screen0"
       Device          "MatroxVideoCard0"
       Monitor         "Monitor0"
       DefaultDepth    24
       SubSection "Display"
               Depth 24
               Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480"
       EndSubSection
EndSection

Section "Screen"
       Identifier      "Screen1"
       Device          "MatroxVideoCard1"
       Monitor         "Monitor1"
       DefaultDepth    24
       SubSection "Display"
               Depth 24
               Modes "1600x1200" "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480"
       EndSubSection
EndSection


Section "ServerLayout"
       Identifier      "Dual-headed Configuration"
       Screen "Screen0" RightOf "Screen1"
       Screen "Screen1" 0 0
       InputDevice     "Generic Keyboard"
       InputDevice     "Configured Mouse"
EndSection

Section "ServerFlags"
       Option          "Xinerama"
EndSection

Section "DRI"
       Mode    0666
EndSection

Installing BlueDragon on Ubuntu

Dave Epler presented a great session on LAMBDA boxes at CFUnited-05 in late June 2005. During the course of his presentation, the conversation turned to Ubuntu and his use of it. Dave graciously provided some pointers on getting New Atlanta’s free BlueDragon CFML server installed. With credit to him, here are the steps I had to go through to get BD up and running on my Ubuntu 5.04 boxes. In addition to Ubuntu 5.04, I am running Apache 2.0.53, and installing the free version of BD 6.2. YMMV, of course…

Updated 11.21.2005: These same steps also work verbatim with Ubuntu 5.10, which includes Apache 2.0.54 and MySQL 4.0.24 in its repositories.
Updated 07.03.2006: These same steps, at least down through the automation of the server startup/shutdown, also work verbatim with Ubuntu 6.06, which includes Apache 2.0.55. I have not yet tried for connectivity with my MySQL installation yet. Note also that the name of the file downloaded from the New Atlanta site will be different than shown in the steps below.

Configuring the Directory Structure

BD’s installation script makes some assumptions about where/how the Apache Web server is installed. The BD installation manual covers the gist of what has to happen to get the BD installation to see and recognize the installed Apache so that its connector can be configured; see section 3.7.7 of that document for details. I use the stock Apache2 installation via synaptic on my Ubuntu boxes, and that stock installation is very different from the standard Apache directory structure. As a result, several directories and links need to be established before you run the installation script:

sudo mkdir -p /usr/local/apache/bin
sudo mkdir -p /usr/local/apache/conf
sudo ln -s /etc/apache2/apache2.conf /usr/local/apache/conf/httpd.conf
sudo ln -s /var/www /usr/local/apache/htdocs
sudo ln -s /usr/lib/apache2/modules /usr/local/apache/modules
sudo ln -s /usr/sbin/apache2 /usr/local/apache/bin/httpd

Installing BlueDragon

With the above directories and symbolic links in place, you should be able to run the BD installation script. If you haven’t done so, download it from the the New Atlanta site. As of this writing, it will come down as a file named “BlueDragon_Server_62-Linux.sh”. This script, if invoked without any arguments, will run a GUI-based installer, but I used (and recommend) the console-mode version:

sudo BlueDragon_Server_62-Linux.sh -i console

I chose to install BD in /opt/bluedragon-6.2, and other than that, pretty much accepted the defaults offered by the installation as it went through. If, toward the end of the installation script, it does not recognize the presence of Apache on your box, Ctrl-C the script, and double-check the folders, links, etc., from above.

The installation script modifies file /usr/local/apache/conf/httpd.conf, but to be consistent with Apache2’s installation methodology on Ubuntu, I took the following steps to make the connection between the Web server:

  1. Delete the updated httpd.conf file (and the renamed version of the symlink) created by the installation script, and re-symlink them as above:
    sudo rm -f /usr/local/apache/conf/httpd.conf
    sudo rm -f /usr/local/apache/conf/httpd.conf.bak
    sudo ln -s /etc/apache2/apache2.conf /usr/local/apache/conf/httpd.conf
  2. Using sudo, create file /etc/apache2/mods-available/servletexec.load with the following content:
    LoadModule servletexec_module /usr/lib/apache2/modules/mod_servletexec2.so
  3. Using sudo, create file /etc/apache2/mods-available/servletexec.conf with the following content:
    ServletExecInstances default 127.0.0.1:9999
    ServletExecAliases default /servlet .cfc .cfm .cfml
    
    <location /servlet>
    SetHandler servlet-exec
    </location>
    
    AddHandler servlet-exec cfc
    AddHandler servlet-exec cfm
    AddHandler servlet-exec cfml
  4. Symlink those two new files into Apache’s configuration:
    sudo ln -s /etc/apache2/mods-available/servletexec.load /etc/apache2/mods-enabled/servletexec.load
    sudo ln -s /etc/apache2/mods-available/servletexec.conf /etc/apache2/mods-enabled/servletexec.conf
  5. Restart Apache, and then manually start the BD server using the following command:
    sudo /opt/bluedragon-6.2/bin/StartBlueDragon.sh

At this point, the next step is to make sure it actually works. The BD installation script places an index.cfm file in the root of the Web folder (i.e., /var/www/index.cfm). Point your Web browser at http://localhost/index.cfm, and you should see the results rendered as processed CFML (not as CFML source). I also tested my installation by copying /var/www/index.cfm into my user account’s local Web folder:

cp /var/www/index.cfm ~/public_html/index.cfm

and pointing my browser at that folder to make sure that the server would appropriately process CFML files there.

Configuring BD to Run as a Non-root User

For obvious security reasons, we don’t want the BD server to be running as root, so we need to create a group and user for the BD server, and then change the ownership of the BD server files appropriately:

sudo groupadd bdragon
sudo useradd -d '/opt/bluedragon-6.2' -c 'BlueDragon CFML Server' -s /bin/sh -g bdragon bdragon
sudo passwd -l bdragon
sudo chown -R bdragon.bdragon /opt/bluedragon-6.2

Automating Startup/Shutdown

The BD installation script creates an “init” script for the BD server, placing it in /etc/rc.d/init.d/BlueDragon_Server. There are a couple of things that I had to do to that script to get it to work:

  1. That script references a file /etc/rc.d/init.d/functions which does not exist on (at least my) Ubuntu boxes. Comment out that line.
  2. Add a line setting a variable that specifies the user under whose identity the server is to run.
  3. Tweak the lines that start and stop the BD server, to specify that you want the process run as the user ‘bdragon’ that you created above. My startup script looks like this. (Note: ‘daemon’ was not installed by default on my system, but is available for installation via synaptic.):
    #!/bin/sh
    # Startup script for the BlueDragon Server
    #. /etc/rc.d/init.d/functions
    bdstart=" /opt/bluedragon-6.2/bin/StartBlueDragon.sh "
    bdstop=/opt/bluedragon-6.2/bin/StopBlueDragon.sh
    prog="BlueDragon Server"
    bduser=bdragon
    
    start() { echo -n "Starting $prog: "; daemon -u $bduser $bdstart ; echo ; RETVAL=$? ; return $RETVAL ; }
    stop() { echo -n "Stopping $prog: "; daemon -u $bduser $bdstop  ; echo ; RETVAL=$? ; return $RETVAL ; }
    case "$1" in
    start) start& ;;
    stop) stop  ;;
    restart) stop; start ;;
    *) echo $"Usage: $prog {start|stop|restart}"
    exit 1
    esac
  4. For consistency with the rest of the system startup/shutdown stuff on my system, I copied the modified script to the directory with the rest of the system files:
    sudo cp /etc/rc.d/init.d/BlueDragon_Server /etc/init.d
  5. The last piece then is to establish the symbolic links from the various run-level folders to the startup/shutdown script I placed in /etc/init.d — this is discussed within the BD installation manual (see section 4.2.3, “Startup and Shutdown Automation on Linux”, p. 15). I chose to mimic the configuration of the Apache installation for these links for the various run-levels:
    sudo ln -s /etc/init.d/BlueDragon_Server /etc/rc0.d/K95bluedragon
    sudo ln -s /etc/init.d/BlueDragon_Server /etc/rc1.d/K95bluedragon
    sudo ln -s /etc/init.d/BlueDragon_Server /etc/rc2.d/S95bluedragon
    sudo ln -s /etc/init.d/BlueDragon_Server /etc/rc3.d/S95bluedragon
    sudo ln -s /etc/init.d/BlueDragon_Server /etc/rc4.d/S95bluedragon
    sudo ln -s /etc/init.d/BlueDragon_Server /etc/rc5.d/S95bluedragon
    sudo ln -s /etc/init.d/BlueDragon_Server /etc/rc6.d/K95bluedragon

After all of that, I could restart my system, sign in, and successfully invoke one of my test CFM pages.

Configuring BD to see MySQL

Out of the box, BD is not configured to be able to connect to MySQL datasources. The BD installation manual touches on this (see Section 3.4, p. 7), and points you to an entry within the New Atlanta BD FAQ with instructions on how to configure BD to provide support for MySQL.Those installations instructions, in summary, are as follows:

  1. Download the version 3.0.x version of the MySQL Connector/J package from the MySQL site. As of this writing, that file is mysql-connector-java-3.0.17-ga.tar.gz. (Note: MySQL does have a 3.1-series of the Connector/J product available, but the BD FAQ entry points the reader to the 3.0-series, and Dave Epler has indicated that he was unable to get the 3.1-series to work when he tried it.)
  2. Open the downloaded .tar.gz file, and extract just the mysql-connector-java-3.0.17.jar file.
  3. Copy that file to the appropriate location, per the above entry from the BD FAQ:
    sudo cp mysql-connector-java-3.0.17-ga.jar /opt/bluedragon-6.2/lib/mysql.jar
    sudo chown bdragon.bdragon /opt/bluedragon-6.2/lib/mysql.jar
  4. Restart BD. The BD administrator should now have an entry in the list of available datasource types for MySQL.

Applying the BD Server Hotfix

The hotfixes that NewAtlanta makes available are cumulative, so all you need to do is grab the most recent (August 2005, as of this writing) and apply it. The hotfixes themselves come with readme files and instructions; take the time to read through them. Having said that, here are the steps I took to apply the August 2005 hotfix (after unpacking the downloaded file in a folder named /home/ron/Downloads/BlueDragon/tmp):

sudo daemon -u bdragon /opt/bluedragon-6.2/bin/StopBlueDragon.sh
cd /opt/bluedragon-6.2/lib
sudo cp BlueDragon.jar BlueDragon.jar.20051122
sudo cp /home/ron/Downloads/BlueDragon/tmp/BlueDragon.jar ./
sudo chown bdragon.bdragon *
cd ../bin/apache
sudo mv mod_servletexec.so mod_servletexec.so.20051122
sudo cp /home/ron/Downloads/BlueDragon/tmp/mod_serveltexec.so ./
sudo chown bdragon.bdragon *
sudo daemon -u bdragon.bdragon /opt/bluedragon-6.2/bin/StartBlueDragon.sh

More to come…

  • Issues and Questions…

Credits

I can take credit for very little of this — all I have done is take my notes and turn them into this post. Much of the credit has to go back to Dave Epler, and I am grateful for his help and guidance. Credit also has to go to the folks at New Atlanta for the quality of their documentation for their BlueDragon server product and their willingness to make a free version of it available to developers.

What Did They Expect?

I first came across this article “Speed of Apple Intel dev systems impress developers” yesterday on the CNET site, talking about how impressed some software developers were with the speed of Mac OS on Intel platforms that Apple is making available to help with their transition to the new hardware platform. Two thoughts came to mind, almost immediately (given that I was still on my first cup of coffee when I saw it):

  1. Given the reported specs for the box (quoted as 3.6 GHz Intel Pentium 4 processor with 2 MB L2 Cache, 800MHz front-side bus, 1GB of 533MHz DDR2 Dual Channel SDRAM, and an Intel Graphics Media Accelerator 900), wouldn’t almost anything be fast?
  2. 10 seconds from Apple logo to desktop? OK, maybe that is fast…

Conviction: A Novel

Richard North Patterson, Random House, 2005

I just finished it. Patterson happens to be in the upper half of my list of favorite authors, and this one didn’t disappoint me. On the surface, it’s a story about the defense of a man convicted and sentenced to death for his role in a murder. More importantly (at least in my opinion), it’s an eye-opening, thought-provoking work that looks at the risks associated with (and to a lesser extent, the constitutionality of) capital punishment in the US, the workings of the US legal system (even as Patterson admits that he had to significantly simplify aspects of it to make the book accessible to readers), and how easy it is for our justice system to lose sight of the fact the system itself exists to protect individual people (both victims and people accused of crimes). This isn’t the first time that he has taken on a potentially difficult subject (the death penalty), but he does it in a manner that will (should?) have make people stop and think about their own views on the subject.

CFEclipse Installation Notes

After attending CFUnited-05 in Washington, DC last week, and particularly in light of Macromedia’s announcement that they were going to be officially involved in supporting the CFEclipse project, I decided I needed to take a look at the use of CFEclipse for CF development. Having gone through a couple of iterations in setting up Eclipse and CFEclipse, I decided that some installation notes might come in handy. Most of these instructions are based on installing and configuring the platform on Windows box, but steps on other platforms should be pretty much identical.

Installing Eclipse

CFEclipse is a plugin for the Eclipse environment, and the easiest way to install CFEclipse is via Eclipse itself, so the first step is to install Eclipse.

  1. You will need the Java JRE v. 1.4.1 or later installed on your system for the current version of Eclipse to work. Install or update, as (or if) needed.
  2. Download the Eclipse package from the main Eclipse site. I don’t do any Java development at present, so I just pulled down the Platform Runtime Binary for the Win32 environment, and saved it to my hard drive. Make sure you also get a copy of the user documentation — it is a good overview of how Eclipse works and how to use it.
  3. Unzip the downloaded archive, and extract all of the files to a location where Eclipse will be installed (e.g., c:\program files\eclipse), making sure that the folder names in the ZIP archive are retained.
  4. Create a shortcut to the Eclipse executable.

Installing CFEclipse

There are good instructions on installing CFEclipse on both the CFEclipse project page, and on Nathan Strutz’s CFEclipse resource page, but I am going to summarize them here as part of this process.

  1. Start Eclipse (if it is not already running).
  2. Select “Help |Software Updates | Find and Install…”.
  3. Select “Search for new features to install” and click “Next >”.
  4. Click “New Remote Site…”.
  5. Enter “CFEclipse” in the Name field, and “http://cfeclipse.tigris.org” in the URL field (both without the enclosing quotes). Click “OK”.
  6. Make sure the CFEclipse node is checked and that Eclipse is unchecked. Click “Finish”.
  7. On the Search Results dialog, check the CFEclipse node. Click “Next >”.
  8. Read through and accept the terms of the CFEclipse license agreement. Click “Next >”.
  9. Click “Finish”.
  10. If you get prompted about installing an “unsigned feature”, click “Install”.
  11. When the installation has finished, Eclipse will want to restart itself. Allow it to do so.

Installing Plugins

There are lots of different plugins that extend Eclipse and work well with CFEclipse. I will touch on those that I find most valuable here. For each of these, exit Eclipse prior to installing the plugin files; when you restart Eclipse, it will find the newly-installed plugin.

  1. CSS Editor: Download the most recent build for this from Nathan Strutz’s CFEclipse Resource page (you are looking for http://www.dopefly.com/pages/net.sourceforge.csseditor_0.0.3_rc2.zip, as of this writing). Save it to disk. Open the archive and extract the contents to the “plugins” folder within the Eclipse folder, paying particular attention to the embedded folders in the ZIP archive so that the files end up in the right place.
  2. JavaScript/ActionScript Editor: Download the most recent build for this plugin from Nathan Strutz’s CFEclipse Resource page (you are looking for http://www.dopefly.com/pages/net.sourceforge.jseditor_0.0.5.zip, as of this writing). Save it to disk. Open the archive and extract the contents to the “plugins” folder within the Eclipse folder, paying particular attention to the embedded folders in the ZIP archive so that the files end up in the right place.
  3. XMLBuddy: Download the “standard” version (as opposed to their “pro” version) from http://xmlbuddy.com. Save it to disk. Open the archive and extract the contents to the “plugins” folder within the Eclipse folder, paying particular attention to the embedded folders in the ZIP archive so that the files end up in the right place.
  4. Quantum DB: Download the current version from the Quantum DB project page on SourceForge. Save it to disk. Open the archive and extract the contents to the appropriate directories under Eclipse (everything should end up under plugins/ or features/). Start/re-start Eclipse. To open the Quantum DB perspective, select “Window | Open Perspective | Other…” and then select “Quantum DB”. If you are using Quantum DB to talk to MS SQL Server, you should probably also look at using the jTDS JDBC driver rather than the default JDBC-ODBC bridge. I will post some additional notes on that one in the next couple of days.
  5. More to come…

Installing Code Snippets

The CFEclipse project has made available a basic set of code snippets that can be edited and supplemented as you need. To install those snippets:

  1. Download the “snips” archive from the CFEclipse project page; as of this writing, the file can be found at http://cfeclipse.tigris.org/releases/snips_1.1.9.zip.
  2. Extract the contents of the downloaded archive to a folder of your choice. I use the “plugins” folder under my Eclipse installation (e.g., c:\program files\eclipse\plugins). This will create a folder named “snippets” there.
  3. To point CFEclipse at these snippets, select “Window | Preferences…” and select “CFEclipse”.
  4. In the “File Paths” block on the Preferences dialog, specify the appropriate folder for the “Paths to snippets directory”. Select “OK” to save the preferences change and close the Preferences dialog.
  5. You will need to re-start Eclipse to get it to see the snippets.
  6. To open the Snip Tree view, select “Window | Show View | Other…”, expand the “CFML” branch, and select “Snip Tree View”.

Setting Common Preferences

At first, the breadth and depth of the user preferences that can be set in Eclipse and all of its plugins can be pretty overwhelming. Here are a few that I typically tweak when I install and configure Eclipse/CFEclipse on new machine.

  1. General appearance and editor preferences:
    1. General | Appearance | Colors and Fonts | Basic | Text Font: Bitstream Vera Sans Mono, 8 pt.
    2. General | Editors | Text Editors | Displayed Tab Width: 2
    3. General | Editors | Text Editors | Undo History Size: 255
    4. General | Editors | Text Editors | Check “Show Line Numbers”
  2. I like the current line to be highlighted in the CFEclipse editor, which it doesn’t seem to be by default. To turn this on, and make it look like the other editors, do the following:
    1. Select “Window | Preferences…”
    2. CFEclipse | Editor | Check “Highlight current line”
    3. CFEclipse | Editor | Appearance color options | Current line highlight: rgb(232, 242, 254)
  3. Other CFEclipse preferences:
    1. Editor | Undo Steps: 255
    2. Editor | Check “Trim trailing spaces before saving”
    3. Editor | Check “Show line numbers”
    4. Editor | Line numbers color: rgb(128, 128, 128)
    5. Editor | Displayed tab width: 2
    6. Code Folding | Turn off the initial collapse on CFML and HTML comments

Problems/Issues

  1. There is something wrong with the handling of preferences for the CSS editor plugin. Whenever I attempt to open it, it generates a warning message “The currently displayed page contains invalid values.” and it won’t let me save or update the preferences under “CSS | Editor”. It seems to be related to the line “FAKE=true” that is getting stuffed into file .metadata/.plugins/org.eclipse.core.runtime/net.sourceforge.csseditor.prefs (in your default workspace folder) whenever the preferences for this plugin get updated. I manually removed that line and added the line “lineNumberRuler=true” to this file to turn on line numbers in the CSS editor.
  2. If the Browser view is open, the workbench throws an error on exit. The error doesn’t seem to cause any problems, but it is annoying.