Saturday, August 22, 2009

Partial success with Logitech EX100 wireless keyboard and mouse

Previous: Ubuntu: No love for Kodak printers

The second home office peripheral I wanted to try with the new Ubuntu laptop was the Logitech EX100 wireless keyboard and mouse. I had hoped it would solve the usability problem with the Synaptic touch pad moving the input cursor when it detected hand movements above the pad.

It's one of those good news, bad news things. The good news is the wireless mouse worked flawlessly on a plug-and-play basis with no installation, configuration, or other effort on my part. With the touch pad turned off, I've been typing my little heart out for several minutes now, and Ubuntu is still responding to keyboard input (from the Toshiba laptop's keyboard).

The bad news is that I've got no response from the wireless keyboard. But the truth is, the wireless mouse solves my particular problem quite nicely.

I found a note on a forum complaining about this model of wireless mouse not working with Open Office spreadsheet on Ubuntu. I gave that a try, and apparently the problem was solved in a subsequent release. No problems here.

Next: Value Stream Mapping font

Ubuntu: No love for Kodak printers

Previous: Installing Banshee media player

Or maybe I should say, Kodak: No love for Ubuntu. Either way, the outcome is the same.

Back at home, I was eager to try my shiny new laptop with some of my home office peripherals. I found no driver for the Kodak ESP-3 multipurpose printer on CUPS. The Kodak driver download site had nothing available for Unix, and no listing for Linux at all. A thread on Ubuntu forums where people were asking about this printer model indicated there is no driver for it and no practical workaround for using the printer with Ubuntu.

Last post, I reported one less reason to boot into Vista. Sadly, I must now report one more reason to boot into Vista.

You might ask: So, why not replace the Kodak printer with a supported model? I might answer: Remember the reason I was in the market for a new laptop in the first place? It was high cost of ownership of hardware. The Kodak ESP-3 is a low cost of ownership printer. It's also low-maintenance and very reliable. I'm keeping it.

Next: Partial success with Logitech EX100 keyboard and mouse

Thursday, August 20, 2009

Installing Banshee media player and ffmpeg video converter

Previous: Audio support fixed

With audio working, I went ahead and installed support for watching videos.

I started Firefox and went to https://addons.mozilla.org/en-US/firefox/. There, I installed the Video DownloadHelper add-on. Then I installed ffmpeg (video converter) and Banshee (media player) from a command line:
sudo apt-get install ffmpeg
sudo apt-get install banshee
Smooth as silk, no problems, no extra steps. Done. Lovely!

One less reason to boot into Vista. That in itself is like a cool drink of water on a hot day.

Next: Ubuntu: No love for Kodak printers

Audio support fixed

Previous: Problem with keyboard and Synaptic touch pad

Well, I told you I was a noob, didn't I?

Searching around the net I learned that one can check to see if one has support for audio by trying to run alsamixer. If the software isn't there, the program won't start. I tried
alsamixer
and a mixer panel came up. The master volume slider was set to minimum. I moved it to maximum.

Problem solved.

Geez, what a noob!

Next: Installing Banshee media player and ffmpeg video converter

Sunday, August 16, 2009

Problem with keyboard and Synaptic touch pad

Previous: Linux vs. Vista download performance

One of the problems I've mentioned here is that from time to time Ubuntu would stop responding to the keyboard and touch pad. I had not been able to find a report of exactly the same behavior with Ubuntu 9.04 or with Toshiba laptops. I did find some similar reports dating from 2007.

Today I was working on the Vista side of the system to disable some of its pre-configured annoyances, since it had become clear that I would have to use Vista for certain non-work-related tasks. The same behavior occurred once while I was working on Vista.

If the problem affects both operating systems, then it follows that it isn't a problem with the OS, drivers, or firmware. It has to be either the BIOS or the hardware.

This is good news, because if the problem affects Vista users then maybe Microsoft will pressure Toshiba and/or Phoenix Technologies to fix it. They certainly won't care about Linux users.

It may be coincidental, but I've observed an apparent correlation with using the hardware switch to turn off the touch pad so that you can type freely without having your hand movements interpreted as mouse movements. The problem has been less frequent when I avoid turning off the touch pad and just live with the occasional cursor jumps.

Another correlation is that when I close the lid and then open it again later to resume work, Ubuntu no longer responds to the keyboard. I have not observed this behavior when using Vista.

When I get home from this road trip I plan to test a wireless mouse with its own USB Bluetooth adapter. If that works, then the inability of Ubuntu to see the built-in Bluetooth adapter will be less annoying. I'm hopeful that this will eliminate the interference between the keyboard and touch pad, as well.

Next: Audio support fixed

Linux vs. Vista download performance

Previous: Making Vista liveable

When installing one of the two Windows program I need, I noticed a significant discrepancy between the download times on Vista and Ubuntu. Vista doesn't always behave this badly, so there must be a factor involved in this that isn't obvious to me. In any case, here's what I observed.

I needed to install the Zune software (to manage my Zune portable media player) on the Vista instance on my dual-boot Toshiba Satellite P500. I booted into Vista, opened Internet Explorer, and navigated to http://www.zune.net/en-US/software/default.htm to download the Zune 3.0 software.

The download ran for about 10 hours before it was rudely interrupted by the scheduled automatic system update at 3:00 a.m. I awoke to discover the machine had rebooted into Ubuntu, the default OS, after the Windows update restarted the system. The download had not been completed. I tried again, and saw that the download was proceeding extremely slowly. I canceled it and decided to download the file from Ubuntu, just to see if there might be a difference.

In Ubuntu, using Firefox, the same download finished in 5 minutes. Same site, same file, same Internet connection, same hardware. Different OS, different Web browser. In other words: Two suspects.

The 133 MB file was not the Zune software. It was only the installer for the Zune software. Having installed Zune software before (on Windows XP), I knew the installer would have to download components during the installation procedure. Those downloads could not be done on the Ubuntu instance because they were tied into the actual software installation. So, there would be another opportunity to observe download behavior on Vista.

Booting into Vista again, I copied the Zune installer and ran it. When it got to the downloading components step in the installation, the downloads once again ran extremely slowly. I left it running and went to work for the day.

When I returned 11 hours later, the download components step was still running. It finished after 11.5 hours. The remainder of the installation steps finished in a few seconds.

Based on previous installs of Zune software, I can say the Zune installer was not the cause of the slow download. Internet Explorer was not involved in this step, so it could not have been the culprit. Only one suspect remained: Vista.

Hmm. Largest software company. Many of the top engineers in the field on staff. More than 25 years continuous product development experience in the Windows product line. And this is the best they can do? Really?

Interesting.

Next: Problem with keyboard and Synaptic touch pad

Making Vista liveable

Previous: Firefox Web development add-ons

Okay, I've installed a lot of development tools and so forth, and I'm pretty happy with the way it all works. When I turned my attention to "consumer" uses of my shiny new machine, I encountered a couple of problems. Ubuntu cannot see the Toshiba's audio adapter or Bluetooth adapter. I spent a couple of hours online looking for solutions and found none, except for a problem with audio on Toshiba laptops dating from 2007 and involving an earlier incarnation of Ubuntu.

I did find a couple of references to a contractual arrangement between Microsoft Corporation and Phoenix Technologies, the makers of the machine's BIOS, that some people assume means that Phoenix may have designed the BIOS to be unfriendly toward operating systems other than Microsoft Vista. I think that is probably speculation on their part, and I plan to keep looking for solutions.

At the moment, I have no way to predict whether I will be able to get Ubuntu to work with the audio adapter and Bluetooth adapter in the Toshiba Satellite. It's possible someone will create drivers, firmware, or whatever else is required to support them. It's also possible that the Phoenix BIOS is actually the problem.

In any case, I need a way to organize my music files and sync my Zune, and I need a Windows system to run Music Publisher. If the audio problem is not solved, I will have to switch to Vista when I want to visit YouTube or Hulu, listen to music on Pandora or a streaming radio station, or listen to news. It would be nice to have audio when using Skype, too. That meant I would be spending at least some of my time on Vista.

OEMs have a long tradition of configuring pre-installed Windows systems in a way designed to piss people off and make them hate computers. Although Toshiba's motto is "leading innovation," in this regard they are respectful of tradition.

So, how could I make the Vista environment less annoying? Here are a few steps I took that seemed to help. None of this pertains to Ubuntu, of course.

Removing unnecessary programs from startup


Press the Start orb, type msconfig into the Search field, and press Enter. This opens the System Configuration utility. Go to the Start tab. YMMV, but what I did was to deselect the following entries:
  • Intel(R) Common User Interface - igfxtray.exe
  • Intel(R) Common User Interface - hkcmd.exe
  • Intel(R) Common User Interface - igfxpers.exe
  • TOSHIBA Button Support
  • TOSHIBA Zooming Utility
  • TOSHIBA Flash Cards
  • TOSHIBA Web Camera
  • SmartFaceVWatcher
  • RealConnect Agent
  • Google Toolbar Notifier
  • CyberLink Power Cinema
  • CyberLink MediaLibrary Service
These changes reduced startup time noticeably and reduced the number of annoying reminders and pop-ups almost to none.

Disabling "notification balloons"


Press the Start orb, type regedit into the Search field, and press Enter. This opens the Registry Editor. Navigate to HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Explorer/Advanced. From the menu choose New -> DWORD(32 bit). Name it EnableBalloonTips. Give it a value of zero. Close the Registry Editor.

Disabling Auto-Complete in Internet Explorer


Start Internet Explorer. On the main menu, choose Tools -> Internet Options. Go to the Content tab. Under AutoComplete, press Settings. In the resulting dialog box, deselect all the checkboxes. Press OK.

To get rid of existing AutoComplete entries, in Internet Options go to the General tab. In the Delete section, press Delete Forms.

Disabling assorted annoyances in Google Toolbar


In Internet Explorer, choose the Tools drop-down near the right-hand end of the Google Toolbar. Choose Options from the drop-down menu. Choose the Search tab. Under 'Search features', deselect 'Suggest searches as you type'.

Go to the General tab. Under 'Additional settings', deselect 'Send usage statistics to Google'.

Go to the Custom Buttons tab. Deselect all the items you don't want.

Go to the AutoFill tab. Deselect 'AutoFill'.

Press the Save button.

Installing necessary Windows programs


As I mentioned previously, there are two Windows-only programs I need: Braeburn Software's Music Publisher and the Microsoft Zune sync software.

Music Publisher is a commercial product that comes on a CD. Installation consists of running the installer off the CD. No problems there.

The Zune software is a free download. Getting the download to work turned into an educational exercise on the relative downloading performance of Vista vs. Ubuntu. It's a tale in its own right, so I blogged about it separately.

Making frequently-used programs easy to access


I took the following steps to place entries in the Start menu for the programs I use most often on Vista:
  1. Right-clicked the taskbar and chose Properties from the context menu to open the Taskbar and Start Menu utility.
  2. Went to the Start Menu tab.
  3. Deselected the checkboxes labeled Store and display a list of recently opened files and Store and display a list of recently opened programs.
  4. Clicked the Customize button next to the Start Menu radio button near the top of the panel.
  5. Deselect the checkboxes near the bottom of the panel labeled Internet link and E-mail link.
  6. Clicked OK until I had clicked my way out of the Taskbar and Start Menu utility.
  7. Clicked the Start orb and then the All Programs link.
  8. Navigated to the shortcut for each program of interest, right-clicked it, and clicked Pin to Start Menu


General beautification


Downloaded the flattering photgraph of me from this very website and set it as my User icon in Vista.

Next: Linux vs. Vista download performance

Firefox web development add-ons

Previous: Installing eXPlainPMT

Upgraded Firefox


Ubuntu came with Firefox 3.0.2 pre-installed. To upgrade it, I typed 'apt:firefox-3.5' in the Firefox location field. This is a front-end to Synaptic Package Manager that was added to Firefox for the Ubuntu distro.

This installed Firefox 3.5.2 and added an entry in the Applications -> Internet menu named 'Shiretoko Web Browser' (the codename for Firefox 3.5).

On starting the new browser, I saw that it had transferred my bookmarks correctly. However, it did not find a compatible version of Ubuntu Firefox Extensions. I typed 'apt:' and 'apt:firefox-3.5' into the location field and it complained about the protocol name. Maybe this handy feature is gone!

Add-ons for web development


I browsed to https://addons.mozilla.org/en-US/firefox/ and selected the following add-ons (selected all before restarting Firefox):
  • Abduction!
  • Bottom Error Console
  • ColorZilla
  • Console2
  • Dom Inspector
  • EditCSS
  • Execute JS
  • Firebug
  • lori (Life-of-request info)
  • QuickRestart
  • SQL Injection
  • SQLite Manager
  • Web Developer
  • XSL Results

The current version of Html Validator was not available on the Mozilla add-on site on the date when I was installing add-ons. The version on the developer's site at http://users.skynet.be/mgueury/mozilla/ turned out to be incompatible with Shiretoko. Too bad, since this one does validation locally in the browser and does not depend on any third-party sites.

The current version of Selenium IDE was not available on the Mozilla site. I installed it from "Selenium HQ" at http://seleniumhq.org/download/. The install worked fine.

Next: Making Vista liveable

Saturday, August 15, 2009

Installing eXPlainPMT

Previous: Installing Git

eXPlainPMT is an Open Source project planning tool geared for Extreme Programming.

Installation


I installed it like this:
  1. Downloaded the distribution archive from http://github.com/explainpmt/explainpmt/tree/master.
  2. Unzipped the archive into my home directory.
  3. Renamed the top-level directory 'explainpmt'.
  4. I'm using SQLite for this program, so I didn't need to create a MySQL database.
  5. The instructions say to edit config/database.yml, but this distribution had no such file. There was a database_cruise.yml with an entry for postgresql, but I wanted to use sqlite. I created a database.yml file with the following contents:
    production:
    adapter: sqlite3
    database: db/production.db
    development:
    adapter: sqlite3
    database: db/development.db
    test:
    adapter: sqlite3
    database: db/test.db
  6. Created file log/production.log and gave it permissions 0666.
  7. In the explainpmt directory: Ran
    rake db:migrate RAILS_ENV=production
    Note the syntax differs from the instructions given on Github. It complained about the Rails version and suggested this to fix it:
    sudo gem install -v=2.0.2 rails
    After that the rake command completed successfully.

Verify installation


From the explainpmt directory, I ran this command to start up the program:
./script/server webrick -e production -p 8100
In Firefox, I went to localhost:8100. eXPlainPMT started up clean. I entered the default userid and password, admin/admin, and everything looked normal.

Conveniences



When I want to use eXPlainPMT for a personal development project, I copy the full eXPlainPMT directory structure to /projects/projectname/explainpmt so that there is a separate "backlog" or "master story list" or "work queue" (pick your favorite buzzwords) for the project. That means starting a separate eXPlainPMT instance for each project. To simplify starting and stopping the tool, I created a bash script to wrap the command line shown above and to capture the pid to stop the server later. You can cd to the /projects/projectname directory and type 'backlog xxxx' where xxxx is the port number you want the server to listen on. When finished working on that project for the moment, you can type 'backlog_stop'. The script looks like this:
#!/bin/bash
# Start an instance of eXPlainPMT
# Assumes you are in the /projects/projectname directory
# and eXPlainPMT lives in /projects/projectname/explainpmt
if [ ! $# == 1 ]; then
echo "Usage: $0 port-number"
exit
fi
`./script/server webrick -e production -p $1 2> temp_$` &
sleep 5
# Grab the pid and create a quick and dirty shutdown script
echo `awk '/pid=/ {split($5,thepid,"="); print "kill -9 " thepid[2]}'
temp_$` > backlog_stop
chmod +x backlog_stop
firefox http://localhost:$1
Also added an alias to .bash_aliases:
# Start any eXPlainPMT server
alias backlog='~/bin/backlog_start'

A comment on the installation instructions


I've used eXPlainPMT in the past and so I was reasonably familiar with it. Had that not been the case, I suspect I would have given up and looked for another tool. The installation instructions are sparse and several releases out of date. I don't know that a novice user would be successful following the published installation instructions. This may not be the best way to encourage people to use an Open Source product.

Next: Firefox development tools

Installing Git

Previous: Pimp My Instiki.

Git is a distributed source control management system that is useful both for managing my own local projects and for downloading and contributing to Open Source projects. I installed it on Ubuntu with this command:
sudo apt-get install git-core

Next: Installing eXPlainPMT

Friday, August 14, 2009

Pimp My Instiki

Previous: Installing support for .NET development.

Instiki is a simple wiki that I use to keep track of useful information. I find it easier to find information if it's organized in a wiki than if it's scattered all over the filesystem.

To get Instiki, go to http://www.instiki.org and download it. There's no further installation to do, and no mandatory configuration before you can start using Instiki. Start an instance by navigating to the directory where you installed Instiki and running the instiki command.

Instiki is very simple and is Open Source. Users are encouraged to customize it. Some people use Instiki as the basis of public websites, and they do some pretty extensive customization. For my purposes, it's just a single-user wiki running on my laptop. To make it a little friendlier and better integrated with my desktop, I've made the following changes.

Start and stop scripts


As shipped, Instiki expects you to start it from a command line and stop it by typing ctrl+C. I set up a start script that starts Webrick in the background and saves the pid so that a kill command can be issued later.

Start script is ~/bin/wiki. It picks up the pid from stderr, where Instiki writes it, and creates the stop script on the fly in ~/bin/wiki_stop. The stop script does a kill -9, since Instiki appears to ignore SIGTERM.
#!/bin/bash
# Start the instiki wiki
cd ~/wiki/inst*
`./instiki 2> wiki_$` &
sleep 12
# Grab the pid and create a quick
# and dirty shutdown script.
echo `awk '/pid=/ {split($5,thepid,"="); print "kill -9 "
thepid[2]}' wiki_$` > ~/bin/wiki_stop
chmod +x ~/bin/wiki_stop
# This will start Firefox if necessary.
# Otherwise it will open in a new tab.
firefox http://localhost:2500/
I set up aliases for the scripts in ~/.bash_aliases.
alias wiki='~/bin/wiki'
alias wiki_stop='~/bin/wiki_stop'

Associated an icon with Instiki and created a desktop definition


AFAIK no one has yet created a logo or icon for Instiki. I found a nice one in a set called Influens by artist Matt U on Deviant Art, at http://mat-u.deviantart.com/art/influens-icons-62280875. It looks like this:


The icon is apopros of the way I use Instiki in that it depicts a folder of documents with sticky notes on them, suggesting an informal, working scratchpad area.

I copied it to ~/wiki/instiki.png and created an instiki.desktop file in /usr/share/applications with the following contents:
[Desktop Entry]
Encoding=UTF-8
Name=Instiki
Comment=Personal Wiki
Exec=wiki
Icon=/home/dave/wiki/instiki.png
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true
Made the favicon for Instiki match the desktop icon by copying the .ico version of the file to ~/wiki/inst*/public/favicon.ico.

Reclaimed screen real estate when viewing a page


By default, Instiki displays wiki content in a narrow column centered on the page. To make this area wider I made the following change in ~/wiki/inst*/public/stylesheets/instiki.css. As shipped, the definition of #Content looks like this:
#Content {
border-top:none;
margin:auto;
padding:0.3em;
text-align:left;
width:100%;
max-width:55em;
}
I removed the max-width specification, resulting in this:

#Content {
border-top:none;
margin:auto;
padding:0.3em;
text-align:left;
width:100%;
}

Reclaimed screen real estate when editing a page


The edit and create views provide a small textarea for entering content. They also display a few examples of wiki markup in an area on the right-hand side of the frame. Since I'm using Instiki on my local machine only, I don't have to worry about accommodating different screen sizes or different markup languages. I'd rather have a large textarea that mostly fills the frame. I don't need the markup help to be visible all the time and I'm always using Textile, so I could free up some real estate by replacing the help area with a single link. Here are the portions of ~/wiki/inst*/app/views/wiki/edit.rhtml that were affected, as shipped:

<%-
@title = "Editing #{@page.name.escapeHTML}"
@content_width = 720
@hide_navigation = true
-%>

<div id="MarkupHelp">
<%= render(:file => "#{@web.markup}_help") %>
<%= render(:file => 'wiki_words_help') %>
</div>

<% form_tag({
:action => 'save',
:web => @web.address,
:id => @page.name },
{ 'id' => 'editForm',
'method' => 'post',
'onsubmit' => 'cleanAuthorName()',
'accept-charset' => 'utf-8' }) do %>
<div>
<textarea name="content" id="content" rows="24" cols="60">
<%= h(flash[:content] ||
((params['content'] && params['content'].is_utf8?) ?
params['content'] : @page.content).purify) %></textarea>
. . .
I removed the MarkupHelp div, added a link to Textile help to open in a new tab, and increased the size of the textarea, resulting in this:

<%-
@title = "Editing #{@page.name.escapeHTML}"
@content_width = 720
@hide_navigation = true
-%>
<% form_tag({
:action => 'save',
:web => @web.address,
:id => @page.name },
{ 'id' => 'editForm',
'method' => 'post',
'onsubmit' => 'cleanAuthorName()',
'accept-charset' => 'utf-8' }) do %>
<div>
<a href="http://hobix.com/textile/quick.html"
target="_blank">Textile Help</a><br />
<textarea name="content" id="content"
rows="30" cols="190"><%= h(flash[:content] ||
((params['content'] && params['content'].is_utf8?) ?
params['content'] : @page.content).purify) %></textarea>
. . .
I made the same changes in ~/wiki/inst*/app/views/wiki/new.rhtml.

Disabled spam filtering


Since this instance of Instiki resides locally and is not accessible on the network, I didn't need Instiki to protect me from my own innocent updates. I disabled spam filtering by deleting the file config/spam_patterns.txt.

One more thing...


I copied my personalized version of Instiki over from my MacBook Pro rather than installing Instiki fresh and repeating the modifications. Initially, Instiki would not start up. It displayed the catch-all "Do you smell smoke?" message and offered no clues on the console or log file.

A brief Internet search turned up a note on http://rubyforge.org/pipermail/instiki-users/2009-April.txt reporting that on Debian and its variants (including Ubuntu) some packages on which Instiki depends are not installed by default. I ran the following command, and the problem was fixed:
sudo apt-get install 
ruby1.8-dev swig libsqlite3-ruby1.8 flex bison


Next: Installing Git

Thursday, August 13, 2009

Installing support for .NET development

This is a follow-up from Installing support for ColdFusion development.

Fair warning: This is not a definitive tutorial, it's just an informal record of my experiences in trying to install software for .NET development on Ubuntu. I had not done any .NET development prior to this. Maybe in a future blog post I'll have something more interesting to share.

.NET development is supported on Linux by the Open Source project mono, at http://www.mono-project.com. In reading about this on the web, I learned that the Ubuntu distro includes support for running .NET applications with mono, but not for developing them. My first step, then, was to install the basic mono package:
sudo apt-get install mono-devel
To verify the installation worked, I followed the instructions at http://www.mono-project.com/Mono_Basics to compile and run a few simple Hello World programs.

The first is a command-line Hello World that looks like this:
using System;

public class HelloWorld
{
static public void Main ()
{
Console.WriteLine ("Hello Mono World");
}

}
To produce a .NET 2.0 assembly, I compiled with
gmcs hello1.cs
No errors reported. To execute the program, I used
mono hello1.exe
It worked fine.

BTW this was my first-ever C# program. I'm so proud! :-) Oh, wait. I didn't test-drive it. I'm so ashamed. :-(

The second test was a gtk# version of the same thing. It looks like this:
using Gtk;
using System;

class Hello {

static void Main()
{
Application.Init ();

Window window = new Window ("helloworld");
window.Show();

Application.Run ();

}
}
and is compiled like this:
gmcs hello2.cs -pkg:gtk-sharp-2.0
I ran it with
mono hello2.exe
and it worked fine.

Next there was a Winforms sample. It looks like this:
using System;
using System.Windows.Forms;

public class HelloWorld : Form
{
static public void Main ()
{
Application.Run (new HelloWorld ());
}

public HelloWorld ()
{
Text = "Hello Mono World";
}
}
I compiled it according to the instructions with this command:
gmcs hello3.cs -pkg:dotnet
This one didn't go quite so well. It complained about 13 missing dlls.

I found a suggestion at http://code.google.com/p/paint-mono/issues/detail?id=6 to try this:
sudo apt-get install libmono-winforms2.0-cil
and compile with
gmcs hello3.cs -r:System.Windows.Forms.dll
This time the compile worked. I tried running the program with
mono hello3.exe
and it worked fine.

So at that point I had at least a partial installation of basic mono development tools. Clearly, there were still missing pieces, but at the time I did not know what more to look for.

MonoDevelop IDE


This is an IDE for working with mono. The home page is http://www.monodevelop.com. I installed it with
sudo apt-get install monodevelop
Mono Develop appeared under Applications -> Programming and it started up nicely. I didn't know what more to check, so I declared victory and moved on.

NUnit (unit testing tool)


I didn't find any useful help on the NUnit site at http://www.nunit.org, so I searched the web and found some help at stackoverflow.com/questions/924239/what-the-best-setup-latest-mono-monodevelop-on-ubuntu-9-04. They suggested this:
sudo apt-get install
monodevelop-nunit monodevelop-debugger-mdb
As far as I could tell, this appeared to work.

NUnit with MonoDevelop


I had to search for help with this, as well. There doesn't seem to be any single comprehensive source of "getting started" information for people who want to learn to work with mono. At http://www.dijksterhuis.org/using-nunit-with-monodevelop/ Martijn Dijksterhuis suggests the following.

First, create a new Solution in MonoDevelop. I chose Console Project and skipped the options presented in the Project Features dialog. Then, right-click the References item in the Solution tree menu in the left-hand pane. Choose Edit References and select NUnit.Core and NUnit.Framework to include them in the Solution. What I found at that point were two options named nunit.core (all lower case) and two options named nunit.framework. One of each had a version number. I chose the entries that had version numbers.

Next step was to paste in the sample program Martijn had posted:
using System;
using NUnit.Framework;

namespace bank
{
public class Account
{
private float balance;
public void Deposit(float amount)
{
balance += amount;
}

public void Withdraw(float amount)
{
balance -= amount;
}

public void TransferFunds(Account destination, float amount)
{
}

public float Balance
{
get { return balance; }
}
}
}

namespace bank
{
[TestFixture]
public class AccountTest
{
[Test]
public void TransferFunds()
{
Account source = new Account();
source.Deposit(200.00F);
Account destination = new Account();
destination.Deposit(150.00F);

source.TransferFunds(destination, 100.00F);
Assert.AreEqual(250.00F, destination.Balance);
Assert.AreEqual(100.00F, source.Balance);

}

[Test]
public void DepositFunds()
{
Account source = new Account();
source.Deposit(200.00F);
Assert.AreEqual(200.00F, source.Balance);
}

}
}

namespace UnitTestDemo
{
public class MyAccountingSoftware
{

public static void Main()
{
bank.Account DemoAccount = new bank.Account();
DemoAccount.Deposit(1000.00F);
DemoAccount.Withdraw(500.50F);
Console.WriteLine("Our account balance is {0}", DemoAccount.Balance);
}

}
}
I chose View -> Unit Tests from the MonoDevelop menubar and right-clicked my Solution, then chose View -> Test Results to see the results. It appeared as if NUnit ran, and the sample program had 1 passing and 1 failing test. Looked good enough as a start.

Next: Pimp My Instiki

Installing support for ColdFusion development

Previous: Installing Tomcat.

I wanted to set up a ColdFusion development environment similar to that used at a current client of mine. That environment is based on ColdFusion, ColdSpring, ModelGlue, and MXUnit. The software used in this set-up is:
  • Eclipse - development IDE
  • ColdFusion - the base product
  • ColdFusion Eclipse Plugin - Eclipse support for ColdFusion development
  • ColdFusion ModelGlue - an MVC framework for webapps
  • ColdSpring - a Spring-like IoC implementation for ColdFusion
  • MXUnit - a unit test framework for ColdFusion, based on JUnit
  • CFEclipse Plugin - Eclipse support for CFML
  • MXUnit Eclipse Plugin - Eclipse support for MXUnit

ColdFusion


I followed instructions on http://www.adobe.com to download and install ColdFusion Developer Edition.
  1. Navigate to the ColdFusion product page on Adobe's website: http://www.adobe.com/products/coldfusion/.

  2. Follow the link labeled Download the free Developer Edition.

  3. Sign in to the Adobe site. Create a userid and password if you don't already have one. Don't worry, it's harmless.

  4. From the drop-down list for ColdFusion Developer Edition, choose the appropriate language and operating system.

  5. Click the button labeled Download next to the Developer Edition drop-down box.

  6. I copied the downloaded file, which is an installation program, to an "installation" directory, gave myself execution permission on it, and ran it. I followed the prompts to install a standalone ColdFusion server with a root directory of /home/dave/coldfusion8, to listen on port 8500.

  7. Started ColdFusion with
    sudo ./coldfusion8/bin/coldfusion start
    and navigated in Firefox to localhost:8500. (Yeah, you read that right: You need root privileges to start a single-user development server on your own machine. That's "enterprise" software, for ya. <sigh>) It told me no application was configured to respond to the request. I tried localhost:8500/CFIDE (based on what I saw in ~/coldfusion8/wwwroot, and not because I knew what I was doing) and it displayed a directory listing of wwwroot/CFIDE. I clicked on administrator and the ColdFusion Administrator app started up. It accepted the password I had defined during the installation process, and appeared to be working. I took this to mean a crude install of the base product had been accomplished. I looked, but couldn't find a sample app. Often, vendors include a sample app you can attempt to run, so that you can see whether the product installed correctly. No such luck here. If there are problems, I suppose they will turn up as I continue configuring the environment.

Install ColdSpring


ColdSpring is a port of Spring to ColdFusion. Its main features are support for IoC and AOP. I obtained it from http://www.coldspringframework.org/. The site offers a quick start guide, a reference guide, and API docs for CFCs. The simplicity and clarity of the packaging and documentation were a refreshing contrast to the "enterprisey" organization and packaging of ColdFusion itself.

I downloaded the pdf Reference Guide. The guide states you can install ColdSpring by placing the source in the web root directory. I learned the hard way that they should have said to unpack the distribution archive in the web root directory. "Place the source" there didn't imply that to me.

There is more than merely a problem with wording, though. While the Reference Guide says you can either place the source in wwwroot or define mappings in Administrator, in fact you must do both. After I defined a mapping for /coldspring to wwwroot, the quickstart app worked. The other sample apps did not work. This tells me the basic install is okay, and there are some configuration secrets that the developers and supporters of ColdSpring think are too obvious to bear mentioning. I'll have to seek help to complete the configuration later, when I'm ready to try using these tools.

Install ModelGlue


ModelGlue is a Model-View-Container framework that comes in ColdFusion and Flex flavors. I downloaded a zipped distribution archive from http://www.modelglue.org. At first glance, the documentation at http://docs.model-glue.com/ looks comprehensive, well-organized, and filled with concrete, practical examples, tutorials, and how-tos. One exceptionally good feature of the documentation is that the main heading on the first page reads, "Don't panic!" The site also has installation and configuration instructions, which I followed more-or-less like this:
  1. Unpack the distribution archive
  2. Copy the ModelGlue folder to ColdFusion's wwwroot folder

Install MXUnit


MXUnit is a unit testing framework based on JUnit. To get it, I went to http://www.mxunit.org/ and downloaded the distribution archive. Then I unpacked it in the coldfusion8/wwwroot directory.

To verify the installation, I started the ColdFusion server and went to http://localhost:8500/mxunit/index.cfm. It ran a trivial sample app and displayed a "Congratulations" message.

So far, so good with the ColdFusion setup.

Install the CFEclipse Eclipse Plugin


This is an Eclipse plugin that provides language support for ColdFusion Markup Language (CFML). The CFEclipse wiki has current information about the Eclipse update site, recent versions, known problems and workarounds. When I installed it, the update site was www.cfeclipse.org/update. Installation instructions are at http://trac.cfeclipse.org/wiki/InstallingCfeclipse. I followed the instructions more-or-less this way:
  1. Started Eclipse
  2. From the main menu, chose Help -> Install New Software...
  3. In the Install dialog window, clicked the Add button. Entered 'CFEclipse' in Name and 'http://www.cfeclipse.org/update' in Location. Clicked OK.
  4. Eclipse displayed two downloadable items, the editor and the documentation. I checked both. I also unchecked the 'group items by category' box and clicked Next. This resulted in an error, apparently because it tried to grab the documentation for Eclipse 3.4 and 3.5. I only needed 3.5, so I deselected the documentation for 3.4 and tried again. It seemed to like this better.
  5. Clicked Next on the 'review' dialog.
  6. On the 'accept licenses' dialog, clicked the 'accept' radio button but the installation did not work. The Next and Finish buttons remained disabled. I tried checking 'do not accept', scrolling from top to bottom of each license, and then checking 'accept' on each one. This time, the Finish button became enabled.
  7. Eclipse called for a restart, and I clicked Yes to restart it.
Since I have no existing ColdFusion code and no ColdFusion experience, I didn't try to write a test app. I noticed that when I opened the perspectives dialog, there was an entry for CFEclipse. I chose it and things looked pretty normal.

Install the MXUnit Eclipse Plugin


The installation instructions at http://www.mxunit.org/doc/index.cfm?doc=installplugin appear to be designed for an earlier version of Eclipse and for Microsoft Windows. It looks like a standard Eclipse software update, so I used the information from the site but followed a procedure like the one I used for the CFEclipse Plugin. The update site is http://mxunit.org/update. This installed MXUnit Test Runner.

At this point I believed I had a working installation of the ColdFusion development tools my client uses.

Next: Installing support for .NET development.

Installing Tomcat

Previous: Installing Tomcat - FAIL!

I went to http://tomcat.apache.org and downloaded a zipped archive of Tomcat. I unpacked it into my home directory, resulting in a directory tree starting with apache-tomcat-x.x.x. I renamed the top-level directory tomcat-dev.

In Terminal I changed to the tomcat-dev/bin directory and granted execute permission on everything in it with
chmod +x *
Then I tried starting Tomcat with
startup.sh
I expected this to start a server listening on port 8080. It worked.

I edited conf/server.xml and set the connection port to 8081. I edited conf/tomcat-users.xml to define a user like this

<role rolename="manager"/>
<role rolename="tomcat"/>
<user username="tomcat" password="tomcat" roles="tomcat,manager"/>
</tomcat-users>
Tomcat started properly on 8081, and I could get to the Manager app.

Next: Installing support for ColdFusion development

Installing Tomcat - FAIL!

Previous: Installing support for Java development

Installing Tomcat should be routine. I've done it many times on Windows and OS X systems. Installing it on Ubuntu turned out to be a lengthy and frustrating experience.

The Ubuntu help pages have a description of how to install Tomcat system-wide or on a per-user basis for a development environment; see https://help.ubuntu.com/8.10/serverguide/C/tomcat.html.

I followed the instructions provided on that page under Using private instances. The commands to install Tomcat and to create a user-specific instance were:
sudo apt-get install tomcat6-user
tomcat6-instance-create my-instance
This resulted in a Tomcat installation under ~/my-instance. I'm not crazy about that directory name. Before changing it, I wanted to verify the installation was okay so far. I checked my-instance/conf/server.xml and saw it was set to listen on port 8080, so I left it alone. I ran this command:
my-instance/bin/startup.sh
Browsing to localhost:8080 in Firefox got me a blank document. I tried localhost:8080/manager and got a blank document. I tried localhost:8080/tomcat and got a blank document. In my-instance/logs, both catalina.out and the log file indicated startup was normal, services started properly, and showed no other activity and no errors. I had not seen this behavior in a Tomcat installation before.

I edited my-instance/conf/server.xml and changed the connector port to 8088, then tried it again. Same behavior. The documentation states that no webapps are deployed by default. That might be the reason it serves nothing but blank documents. Apparently, the manager app is not included in the per-user package. Normally, I expect to see the "It works!" message by default.

My next thought was to download the manager application by itself and drop it into the webapps directory. All the documentation I could find stated that the manager application is included by default in Tomcat installations. Clearly, this is not the case for the user-specific Ubuntu package.

The Ubuntu Tomcat help page listed this command to install the manager application, assuming you had installed the service version of Tomcat. It looked as if this might do the trick:
sudo apt-get install tomcat6-admin
Unfortunately, this resulted in a Tomcat service automatically installing and starting.

It was unclear how to shut the thing down manually. I found a posting online that indicated the start and stop commands are in /etc/init.d. I ran
/etc/init.d/tomcat6 stop
to shut down the instance. I was unable to locate a .war file for the manager app anywhere.

A task that should have taken me five minutes had now extended into hours. I had to stop and go to work. Before I gave up for the morning, I found a backup copy of another Tomcat installation on an external hard drive. I was thinking of copying the manager and host-manager applications from there to the user-specific Tomcat installation on Ubuntu, but on reflection I realized this was not a repeatable or reliable way to install software.

I decided to install dev instances of Tomcat the "old-fashioned way."

Next: Installing Tomcat

Installing support for Java development

Previous: Installing support for Ruby development.

Basic software installs


I installed the Java development tools, Eclipse, and Maven with these commands:
sudo apt-get install sun-java6-jdk
sun-java6-plugin maven2 eclipse
To check which version of Java was the default after the install, I ran
java -version
It displayed 1.5.0, so I ran this command to set version 6 as the default:
sudo update-java-alternatives -s java-6-sun
After that when I ran java -version it came back with 1.6.0.

To verify maven2 was installed correctly, I ran the following command:
mvn --version
No problems at this point.

To verify Eclipse was installed correctly, I went to the Applications -> Programming on the main menubar and saw there was an entry for Eclipse. I selected it, saw that it started, and exited. I noticed the version was 3.2. I will check into getting a more recent version later.

Maven configuration


Although maven2 appeared to have installed correctly, I was unable to locate the local repo or the maven home directory or any environment variable settings pertaining to maven. A quick web search failed to turn up any useful information about the default location where apt-get installs maven2.

As far as I could tell, being a n00b and all, the environment variables maven2 supposedly needs to be set were not set, and there was no local repo. I decided to try
mvn archetype:generate
just to see whether it would do anything or complain about missing components or unknown paths or whatever. I chose quickstart when prompted, and it worked perfectly. It also created .m2/repository as it downloaded dependencies. Nice to know.

Upgrading Eclipse to 3.5 "Galileo"


At the time I installed it, the latest Eclipse release wasn't yet included in the Ubuntu distro. John Paulett provides a nice set of instructions for installing it on Ubuntu 9.04 on his site at http://johnpaulett.com/2009/06/26/install-eclipse-galileo-3-5-on-ubuntu-jaunty-9-04/. Using his instructions as a guide, this is how I installed Eclipse 3.5:
  1. Created a directory for Eclipse under /home. John recommends ~/bin/packages/eclipse, and he later installs Galileo in ~/bin/packages/eclipse/eclipse3.5 because he needs multiple versions of Eclipse. I don't need multiple versions, so I installed it in ~/bin/packages.
    cd ~/bin
    mkdir packages
  2. Downloaded the 64-bit version of Eclipse 3.5 (long lines are broken for readability in Blogger):
    cd packages
    wget http://d2u376ub0heus3.cloudfront.net/galileo/
    eclipse-java-galileo-linux-gtk-x86_64.tar.gz
  3. Next, I unpacked the archive in place, in the packages directory:
    tar xzvf eclipse-java-galileo-linux-gtk*.tar.gz
  4. I deviated from John's instructions at this point, and just updated /usr/share/applications/eclipse.desktop to point to the executable I had just installed:
    Exec=/home/dave/bin/packages/eclipse/eclipse

I started Eclipse from the main menu, Applications -> Programming -> Eclipse, and it started the new Galileo version. Eclipse had no trouble opening one of the workspaces I had copied over from my OS X system.

Eclipse configuration


I set the M2_REPO classpath variable in Eclipse to point to the local repo. I started Eclipse and navigated to Window -> Preferences, then expanded the tree menu items Java -> Build Path -> Classpath Variables.

I noticed that this version of Eclipse comes with an M2_REPO already defined. It points to the default location of /Users/dave/.m2. Then I chose Edit and changed the value to /home/dave/.m2.

Migrating Java development projects


I copied my ~/.m2/repository from the MacBook Pro to an external drive, and then from there merged it with the ~/.m2/repository on Ubuntu.

I copied my eclipse-workspaces directory from the MacBook Pro to the external drive, and from there to the ~/projects directory on Ubuntu.

Next step was to try and build the projects I'm currently working on to discover what configuration options I would have to change to get things working on the new system. I've been around the block too many times to expect things to "just work." Somewhere, something must be pointing to a resource that doesn't exist on the new system, or depends on a different version of something than the one I've installed. I decided to try building a Function Point Analysis application I'd been working on last year. It's a good test case for maven2 because it's got multiple components and a hierarchy of POMs.

I was surprised and pleased when mvn compile worked on the first try. I ran mvn test and got two failures out of many, many tests. Old, dusty neurons fired, reminding me that these tests used to fail with maven on my old system, too. They worked under Eclipse. So it was time to see if Eclipse would "just work," too. Wouldn't that be nice? Sure it would. Actually, I knew it wouldn't work because I needed to change the build dependencies in Eclipse to reflect their new locations. But I could at least see that no other, unexpected errors occurred.

The project would not build inside Eclipse because references to external libraries were invalid. I expected this, since I had set things up differently on OS X. I knew I would have to redefine a few things with the new setup. I was satisfied that things were in place and would work. There was just some housekeeping to do since I had decided to organize the files differently on the new system. Java was good to go!

Next: Installing Tomcat - FAIL!

Wednesday, August 12, 2009

Installing support for Ruby development

Previous: Updating Ubuntu.

Ruby


To install Ruby support:
sudo apt-get install ruby-full

Geany (an IDE)


Low let's get Geany, a rudimentary IDE I find handy for Ruby development.
sudo apt-get install geany

Gems (to install other Ruby packages)


This installation procedure is a little different from the usual apt-get thing.

1. Look on Ruby Forge and see what the latest version of Ruby Gems is: http://rubyforge.org/frs/?group_id=126. Hover over the .tgz filename to see the correct URL for the wget command.

2. The Ruby community does not recommend using apt-get to install Ruby Gems because Advanced Package Tool and gems may get out of sync about versions. The recommended way is to open a Terminal window and enter the following commands (in this case the version I found in step 1 was 1.3.4). Long lines are split for readability in Blogger. Use common sense.
cd ~
wget http://rubyforge.org/frs/download.php/57643/
rubygems-1.3.4.tgz
tar xzvf rubygems-1.3.4.tgz
cd rubygems-1.3.4
sudo ruby setup.rb
3. Note which executable was installed (a message appears near the end of the installation) and define a symlink to it. In this case it was version 1.8.
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
4. If the installation worked, the following command will display version information. In this case we want to see "1.3.4". By changing directories first I help myself believe the PATH was updated. I hear it's good to believe.
cd
gem -v

MySQL server


I use MySQL for Ruby on Rails development (and other things, too). To install:
sudo apt-get install mysql-server
Of course, you should set the MySQL root password to something other than "empty" when prompted. The installer starts mysqld. To be sure it worked, run
ps ax | grep mysql
and look for /var/run/mysqld/mysqld.pid.

After installation, you can stop and start MySQL through System -> Administration -> Services on the main menubar. Alternatively, you can start and stop MySQL from a Terminal window using the commands:
sudo /etc/init.d/mysql start
and
sudo /etc/init.d/mysql stop

MySQL GUI client


To install a gui client for MySQL, choose Applications -> Add/Remove Applications from the main menubar. If prompted to update the list of available packages, do so. Under Show, choose "All available applications". Select "MySQL Administrator" for a GUI client and "MySQL Query Browser" for a GUI tool for running queries. After the installer finishes, the two applications will appear under Applications -> Programming on the main menubar.

Ruby bindings for MySQL


Open a Terminal window and enter the following commands:
cd ~
sudo apt-get install libmysql-ruby libmysqlclient-dev
The package libmysqlclient-dev is a virtual package. When you run the command above, you will see an error message that shows the name of the real package. Substitute it in the command line and run it again. When I ran it, it showed libmysqlclient15-dev, so I ran the command this way:
sudo apt-get install libmysql-ruby libmysqlclient15-dev
Run this command to build it:
sudo gem install mysql

Rails


Use Gems to install Rails. Open a Terminal window and enter the following command
cd ~
sudo gem install rails
If the installation succeeded, the following command will display version information:
rails -v
Verify the installation by generating a trivial rails app:
cd ~
rails myrailsapp -d mysql
or, for sqlite3:
cd ~
rails myrailsapp
In myrailsapp/script, run the command:
./server
If all is well, a WEBrick server will start and will listen on port 3000 for HTTP requests. Try loading the following URL in a browser. You should see a welcome page.
http://localhost:3000

Testing tools


These are tools for test-driven-, behavior-driven-, and storytest-driven-development:
  • Autotest - continuous testing (part of ZenTest)
  • Cucumber - storytest tool
  • RCov - coverage tool
  • rspec - BDD tool
  • Webrat - browser simulator (used by Cucumber)

On Debian variants (like Ubuntu), you have to install a couple of libraries before installing Webrat. They are needed by Nokogiri, the XML libary used in Webrat.
sudo gem install ZenTest
sudo gem install rcov
sudo gem install rspec rspec-rails
sudo gem install cucumber
sudo apt-get install libxslt1-dev libxml2-dev
sudo gem install webrat

Some conveniences


I'm rather slow-witted, so I find it helpful to follow a few conventions even though I'm the only person working on my system or on my little side projects. I put my software development projects under a directory called /projects. I nearly always use Geany for Ruby on Rails development. I use rspec and Cucumber with these projects. So it's convenient to have a quick way to set up a new Ruby on Rails project in the usual directory that includes the elements I usually want and that creates a Geany project file. To that end, I created a shell script in ~/bin that sets these things up for me. The script newrailsapp looked like this as of the time I posted this information:
#!/bin/bash
if [ -z $1 ]; then
echo "usage: newrailsapp appname"
exit
fi
if [ -e $1 ]; then
echo "Can't create $1 because it already exists. Quitting."
exit
fi

# Create the rails app

rails -d mysql $1

# Generate rspec support for the app

cd $1
./script/generate rspec
./script/generate cucumber

# Create a geany project file for the app

echo "Creating geany project file $1.geany"
cd ..
echo "[indentation]" > $1.geany
echo "indent_width=4" >> $1.geany
echo "indent_type=1" >> $1.geany
echo "indent_hard_tab_width=8" >> $1.geany
echo "detect_indent=false" >> $1.geany
echo "indent_mode=2" >> $1.geany
echo " " >> $1.geany
echo "[project]" >> $1.geany
echo "name=$1" >> $1.geany
echo "base_path=/home/dave/projects/$1/" >> $1.geany
echo "make_in_base_path=false" >> $1.geany
echo " " >> $1.geany
echo "[files]" >> $1.geany
echo "current_page=-1" >> $1.geany
Also created these aliases in ~/.bash_aliases:
# Start Geany (IDE)
alias geany='geany &'
# Start and stop any Rails test server
alias server='script/server &'
alias server_stop='~/bin/server_stop'

The alias geany just starts Geany in the background. Saves a couple of keystrokes.

The purpose of server is to start a Webrick server for dev-testing a Rails app. It's meant to be run from a command line when you're in the appropriate project subdirectory. The server script looks like this:
#!/bin/bash
script/server &
The purpose of server_stop is to stop a Webrick server. It looks like this (with the usual caveat about long lines)
#!/bin/bash
kill -9 `ps -o pid,cmd --no-heading -p $(pgrep ruby)
| grep script/server | awk '{print $1}'`
The assumption is that there will only be one Webrick server running at a time. It's a safe assumption because all of this is set up for a single user environment.

Next: Installing support for Java development

Updating Ubuntu

Previous: Toshiba Satellite Ubuntu-Vista dual-boot configuration.

With the basic install of Ubuntu done, it was time to bring the instance up to date. To do that, I ran the following commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
The first two commands download and install various software updates for the OS.

The build-essential package consists of C header files, libraries, compilers and so forth necessary for building software.

Next: Installing support for Ruby development

Tuesday, August 11, 2009

Toshiba Satellite Ubuntu-Vista dual boot configuration

Previos: The Great Laptop Quest Part 2: The Hardware.

It should be a straightforward matter to configure a machine to boot into alternate operating systems. Resize, move, and/or create partitions on the hard drive or drives; install the operating systems into the appropriate partitions; mount any shared data partitions in each operating system; and "To start, press any key."

It should be a straightforward matter.

In reading about the particular hardware and software products I intended to configure on the Toshiba Satellite laptop, I learned about quite a few problems people were having when trying to set up a dual boot with Windows Vista. Vista, it seems, is a bit non-standard in the way it manages its boot partition. What's more, it's fairly unfriendly toward those who try to muck with it. The salient points are:
  1. Vista has to boot from the first primary partition on the hard drive.

  2. Vista writes a special "boot code" into bytes 63 through 2047 of the boot partition. The "real" partition data starts at offset 2048. This appears to be designed to defeat partition management programs that were not published by Microsoft Corporation. If that was the design intent, then it has succeeded.

  3. When you use a non-Microsoft partition management program to shrink the Vista boot partition to make space on the hard drive for a second operating system, the program might innocently rewrite the partition data starting at offset zero. After all, why shouldn't it? At that point Vista is broken.

  4. Did I say "broken?" I'm sorry. I meant to say, "unrecoverable." There's no option but to reinstall Vista from scratch using the original installation DVDs. Unfortunately...

  5. ...you don't have the original installation DVDs if you purchased an OEM system with Vista pre-installed.
On my first attempt to set up the dual boot environment, I followed the tutorial at http://apcmag.com/how_to_dualboot_vista_with_linux_vista_installed_first.htm, which seemed to me to be well throught-out and reasonable. I used Vista's Disk Manager utility to shrink the partition. Then I installed Ubuntu using a Live CD burned on the Mac. The installation went smoothly and there were almost no issues on the Ubuntu side. I spent a few hours tracking down a problem with Ubuntu recognizing the Intel 5100agn wireless chipset, and there was an issue with power management settings causing "shutdown" to terminate Ubuntu but not to turn the machine off. When I booted into Vista the first time after the Ubuntu install, there were no errors related to the partition resize.

So I had a functional dual boot configuration. But the resulting configuration was not quite what I had in mind. Disk Manager would not allow the Vista boot partition to shrink any smaller than about half its original size. That resulted in a Vista partition of about 154 GB. Since my goal was to create a shared data partition occupying most of the hard drive space, most of the Vista partition would simply contain wasted space. What I really wanted to do was shrink the Vista partition to about 16 GB. Neither Disk Manager on Vista nor the partitioner in the Ubuntu install process offered a way for me to set up the partitions in this way, although the Ubuntu installer did have an option to set up all partitions manually. Under the circumstances, I wasn't confident that doing so would leave Vista undamaged or recoverable.

What I had in mind was a configuration like the one described in this description of a partitioning scheme: http://www.psychocats.net/ubuntu/partitioning. Although Ubuntucat considers this approach outdated and currently favors Wubi, I think the partitioning scheme shown below would be ideal for my needs:



What about the risk of destroying my Vista installation? I sifted through many online forum postings, blog entries, and articles. I kept finding contradictory information. It occurred to me that the apparent contradictions might simply be due to timing. Many of the horror stories about repartitioning causing a broken and unrecoverable Vista installation dated from 2007. Reading more carefully, I learned that gparted version 0.3.4 and later are reported to be able to resize a Vista partition without damaging it, although moving a Vista partition may require a system recovery using a bootable Vista installation disc. Well, I wasn't planning to move the partition, was I?

Furthermore, I read on a couple of forums (for instance, here: http://forums.computers.toshiba-europe.com/forums/thread.jspa?threadID=45393&tstart=0) that Toshiba ships its pre-installed Vista systems with a recovery partition on the hard drive, as well as a utility to create a bootable recovery disc based on the contents of that partition. It was claimed that the recovery disc can fix the problems that resizing the Vista partition might cause. "Recovery" in this case means restoring the factory settings; that is, putting the factory-installed Vista back where it was when the unit shipped. That would wipe out any user data or installed applications as well as the Ubuntu partitions. But it would (hopefully) get the machine back into a usable state so that I could continue to break it again and again in the process of learning how to get to the configuration I really wanted.

This information gave me greater confidence to try to configure the hard drive as I had originally intended. In addition, my risk of data loss was minimal. I had not yet installed anything on the Vista instance or the Ubuntu instance. They were both clean installs. If the Vista recovery disc failed to repair any damage I might do to the Vista partition, I could order an installation DVD from Toshiba for a nominal price (about $20). My greatest cost in that case would be the time lost while waiting for the installation DVD to be delivered. Even if that failed, I could conceivably install Ubuntu alone on the Toshiba laptop and use the little Acer unit for the two Windows-specific applications I cared about. All my current work is safely on the MacBook Pro and/or an external storage device.

So, why not?

I booted from the Ubuntu Live CD and followed the instructions at https://help.ubuntu.com/community/WindowsDualBoot for setting up a dual boot configuration with Windows. The partitioner was unable to resize the Vista partition. After it spun for a long time at 0% complete, it aborted the operation with no further information.

End of story for now. Obviously, I need more knowledge and experience before I can successfully set up a system such as many Linux aficionados consider routine and simple. Frustrating!

Afterwards I tried booting into Vista. It detected a problem with the hard drive and ran chkdsk. It found no errors, yet hung at the point where it says, "Please wait while your computer restarts." After 15 minutes the computer had not restarted. With some apprehension, I powered it off manually and turned it back on. Fortunately, Vista started normally this time.

Next, I shut down Vista and booted into Ubuntu, to ensure I hadn't broken it. It started fine.

For the moment, the configuration has a couple of shortcomings:
  1. I wasn't able to allocate as much hard disc space to Ubuntu as I had wanted; and
  2. My /home directory will be embedded in the same partition as the rest of Ubuntu.
When I've learned enough to configure the system in a more suitable way, I'll be able to save my /home directory contents by making a backup of its contents prior to installing another Linux. That's slightly less convenient than having the /home directory in its own partition, but probably not a big deal.

Next: Updating Ubuntu

The Great Laptop Quest Part 2: The Hardware

Previous: The Great Laptop Quest Part 1: Software Support

Okay, so we know Ubuntu Linux supports all the applications I need in my work and most of those I like to use for pleasure. Now it was time to find a laptop with the necessary hardware features, service life, and aesthetic characteristics.

I looked at quite a few specifications online. Having used Apple products for the past several years, I was very much out of touch with the current state of the art in non-Apple OEM products. I assumed all Intel-based laptops would be comparable. I was disappointed in the relatively lame hardware configurations offered by other OEMs. In the 15" display range, all the OEM laptops offer relatively poor display resolution. The other Intel OEM equipment lacks integrated Bluetooth support, and not all products offer Bluetooth even as an add-on. Many of the OEM units lack an IEEE-1394 (aka Firewire, I.Link, or Lynx) port. Many OEMs are still installing tray-style DVD drives instead of the more reliable slot-style drives. Backlit keyboards are treated as special upgrades rather than basic features.

A sturdy full-size keyboard is an important consideration for me, as well. I do a considerable amount of typing, and keyboard longevity has been a problem for me not only with my current MacBook Pro but also with past laptops, particularly those from Dell and Texas Instruments (probably a moot point).

Support for dual monitors is another useful feature. I like this feature when making presentations.

Eventually I was able to find only a handful of OEM laptops that were comparable to Apple equipment. I was surprised and a bit disappointed at just how short the list of candidates turned out to be. If only Apple's quality rose to the level of their coolness factor!

The price differential was so extreme that it became a decision factor for choosing the replacement equipment for the MacBook Pro. I found that I could obtain two laptops and pay less than one-third the price of a single MacBook Pro comparable to the one I'm replacing. The 15.4" MacBook Pro had always been a compromise size: Small enough (just) to carry to meetings and presentations, and large enough (just) to serve as my workhorse platform for everyday work. With the price differential greater than 3:1, it was feasible to consider a higher-end laptop that had more of the hardware options I wanted and that had a larger display, along with a "netbook"-sized unit for presentations and note-taking.

I found many favorable customer reviews regarding the Toshiba Satellite series, representing the higher-end product range, and the Acer Aspire One, representing the netbook product range. Customers were writing that they had purchased their second unit, and their first unit was still in good working condition after 4 years or more. If these units last 6 years and cost 1/3 the price of a MacBook Pro, then the total cost of ownership will be 1/6th that of a new MacBook Pro. It's hard for coolness alone to compete with numbers like those.

So, the "small enough and large enough" criterion could be met simply by purchasing one large laptop and one small one. No need for a compromise on size!

Global electrical system support is largely a non-issue these days, but it was still worth investigating, just in case. Optional power supplies and third-party adapters take care of this requirement nicely.

I must say no other laptop compares to the Mac in terms of aesthetic appeal. The highly-regarded Toshiba Satellite and Acer Aspire One units aren't bad-looking, though. In an era when most laptops still look like plain black slabs, the Toshiba and Acer stand out without looking garish.

Based on my assessment of software and hardware, my Mac replacement would consist of these two units:





My plan: Configure the Toshiba Satellite P500 with an 18.4" display as a dual boot with Ubuntu Linux as the default OS and Windows Vista as the alternate. Use the Acer Aspire One to run presentations and handle similar work-related tasks. Its pre-installed Windows XP environment is fine for the purpose.

Next step: Ubuntu-Vista dual boot configuration on the Toshiba Satellite.

The Great Laptop Quest Part 1: Software Support

Previous: Macrilege!

As a consultant and knowledge worker, I use my computer for writing; preparing and giving presentations; developing spreadsheets with graphics; and writing, testing, and demonstrating software in various languages. These tasks call for software that supports document authoring and desktop publishing, image manipulation, presentation slides, and all aspects of software development including version control and test environments suitable for local deployment.

For exchanging files with clients and colleagues who use Microsoft Office, I need word processing, spreadsheet, and presentation software that can read and write Microsoft Office file formats. Support for Windows fonts is also helpful, since most of the formatting issues that come up with transferring presentations between software packages have to do with font support.

As a consumer, I use my computer for surfing the web, viewing videos, listening to music, organizing my media files and syncing to my portable media player, and playing casual games, where "casual" means games like Tetris or Minesweeper rather than those like Warhammer or Halo 3.

Both for work and for pleasure, I also need the basic facilities people have come to expect in a personal computer system: Wireless networking capability, Bluetooth support, CD/DVD reading and writing, good display resolution, acceptable perceived responsiveness, and so forth.

The software support described above constitutes my needs in a laptop. Regarding wants, it would be nice to be able to watch DVD movies on the computer, to make phone calls using a service such as Skype, to organize and play my media files, and to sync my portable media player.

I installed several software packages on Ubuntu Linux under VmWare on my MacBook Pro to see whether Linux met these needs (and as many wants as possible). My findings were encouraging.

OpenOffice installed easily, worked well, and supported all my requirements in "office" software. The tools I use for Java development all work well - Java, Maven, Eclipse, etc. The tools I use for Ruby development all work well - Ruby, Rails, etc. I had problems getting NetBeans to start. I experimented with using Geany as the IDE for Ruby development, and found it satisfactory even if not as feature-rich as NetBeans. I understand there's a product called Mono that enables .NET development under Linux; that sounds interesting, but I didn't check it out for purposes of this investigation. For version control, I've been using subversion for quite some time and I've been transitioning to git. These programs work fine on Linux.

I was able to install Apache, Tomcat, and MySQL with no difficulties. I found it easy to build and deploy Ruby on Rails applications and Java webapps to the Apache environment. All the tools relevant to this type of work are well supported on Linux.

The mind mapping program I'm accustomed to using, FreeMind, works the same on Linux as on any other platform. For other tasks I perform on the computer, I had to try out different programs than those I had been using before. This turned out to be no problem at all. Gimp came pre-installed on Ubuntu, and works fine for my image editing needs. I found a news reader called Pan that has all the functionality I need. I installed ffmpeg and found it works fine for converting media files. A program called Banshee worked fine as a media library organizer and media player, although it is not able to sync my Zune. Banshee actually proves the case for Mono, since it's a .NET application. In addition to the basic Unix-style utilities for managing archive files, Linux supports ZipCreator, unrar, and several other tar-like and zip-like utilities.

Firefox is the web browser that comes with Ubuntu (Gnome), and it was already my personal favorite so this was a natural fit.

I like to use a wiki to maintain notes and reference information locally, for my own use. I had been using Confluence personal edition for this purpose. According to Atlassian's website, it's supposed to work on Linux, but I was unable to get it to start. I downloaded Instiki and manually converted my wiki pages; it wasn't too burdensome, and forced me to review the contents and delete out-of-date information, which was a useful exercise anyway.

I could not verify hardware drivers and firmware in the VmWare environment. I had to rely on information in Linux forums online to assure myself that the necessary support was available. What I read sounded promising.

It was not feasible to verify that Skype would work under 64-bit Linux, since my MacBook Pro is a 32-bit system and Skype does not (currently) offer a 64-bit version of its software for Linux. I did find explanations online of how to install the 32-bit verison of Skype on a 64-bit Linux system, so this sounded promising, as well.

There is one Windows-specific application in particular that I use: Music Publisher from Braeburn Software. I made no attempt to check out comparable software for Linux, because I strongly prefer this particular product. I will have to run it on a Windows system. This does not affect my assessment of laptops for professional use and general personal use.

The only disappointment was that I could not find a way to sync my Zune using Banshee (or even by copying files manually). It seems the Zune is not recognized at all as an external storage device. This is true both in Mac OS X and in Ubuntu Linux. Apparently, the Zune is specifically designed to work only with Microsoft Windows. This is not a show-stopper for my assessment, although it would be convenient to sync the Zune with my primary laptop.

One of my requirements about software was that the system demand an "acceptable level of tinkering." What does that mean? Well, most operating systems don't "just work," like a toaster. Mac OS X comes closest. Microsoft Windows requires tinkering to get rid of a lot of annoying little reminders, helpful hints, confirmation dialogs, security warnings, advertisements, talking paper-clips, and pre-installed programs that nobody wants. Windows demands further tinkering on an ongoing basis to keep it free of malware. Unix and Linux systems have a reputation for requiring a high level of technical tweaking just to get them into a usable state and keep them operational.

For my purposes, an "acceptable level of tinkering" falls somewhere between the tinkering the average consumer would accept and the tinkering a computer science major would accept. I have a technical background, so I am capable of learning and understanding whatever tinkering might be required. However, my goal in using my personal computer is not to tinker with it endlessly. I want my new system to be easy to use, but I'm prepared to do a bit of manual labor to get everything installed and configured properly.

With that in mind, my VmWare assessment of Ubuntu Linux passed the test.

As far as software support was concerned, Ubuntu Linux was looking good. Next step: Check out the laptops available from vendors other than Apple.

Thursday, August 6, 2009

Macrilege!

Apple customers are funny. They...that is, we...seem to have almost a cult-like attitude about Apple products. Over the past few years, nearly all my colleagues have purchased Mac laptops. At user group meetings, conference presentations, training classes, on airplanes and on client engagements they pull out shiny new MacBook Pro laptops almost to the total exclusion of any other product. That sort of reverence seems a bit silly; it's just another company, after all. Yet, it's part of the Apple customer culture. Maybe that's why I feel compelled to justify my recent decision to move away from the Mac platform. Maybe, too, it's why I feel an irrational sort of guilt about it.

I've been a happy Mac user for about five years now. I've got no complaints about Mac OS X. The problem is the cost of ownership of the Apple hardware. My MacBook Pro (the second Mac I've owned) is in need of replacement, and it's less than three years young. I've replaced the keyboard, and worn out the second keyboard. I've replaced the battery and the power supply. The display has many dead pixels and uneven brightness. The machine has started to exhibit intermittent scary behavior having to do with electricity, causing the occasional mysterious crash.

Okay, so why not just get a new MacBook Pro? Well, my first Mac, a PowerBook G4, cost about $2,500 and was serviceable for about two years. It still runs today, but not reliably enough to use for anything important. The MacBook Pro cost about $3,000 when it was new. A comparable replacement today would start at around $3,600. When beefed up appropriately, it would be around $4,000 to $4,200. With an expected useful lifetime of around three years...well, it just doesn't add up.

Non-Apple laptops don't run Mac OS X. Has Microsoft Windows improved to the point that I can work with it happily? Based on my occasional use of my wife and son's Windows Vista machines, I would say "No." Not to worry: There are beaucoup versions of Unix and Linux out there. One in particular has become relatively user-friendly: Ubuntu (and its cousins).

So, should I just dump my Mac and buy a one-way ticket to Ubuntuland? It turns out that I'm just a tiny bit too risk-averse to take such a rash step. To find out whether Ubuntu could meet my needs, I made a list of my needs and then loaded an instance of Ubuntu Linux under VmWare on the MacBook Pro to check out the available software.

When I thought about what, exactly, I actually do with my computer, I was surprised at how modest my needs really are. I spend a lot of my time working on the computer, but it seems I spend that time doing just a handful of different tasks.

My software needs:

  1. Support for all the types of work for which I use my computer

  2. Acceptable level of tinkering needed to configure the system and keep it running


My hardware needs:

  1. Support for all desired hardware features

  2. Reasonable initial price and total cost of ownership

  3. Portable, yet large enough to be a comfortable platform for work; and small enough to be convenient to carry to conference sessions and business meetings for giving presentations and taking notes

  4. Usable on different national electrical grids, since I travel in my work

  5. Reasonably nice-looking; doesn't look like a prop from 2001: A Space Odyssey





Thus begins the search for a new laptop! Next: The Great Laptop Quest.