Sunday, December 23, 2007

Compaq Presario C500 and Kubuntu wireless networking fun

These instructions on the Ubuntu KNetworkmanager page got my Compaq Presario C500's Broadcom BCM 94311 MCG wlan interface back up and running after I fu-fiddled around with it this afternoon. I made the mistake of clicking the "Manual Configuration" option in KNetworkmanager, after which I lost all wireless connection, and couldn't find my way back out of the wireless woods:
  1. Made a backup of the file /etc/network/interfaces
  2. Delete all configuration settings in the file except the lo interface

    auto lo
    iface lo inet loopback
    address 127.0.0.1
    netmask 255.0.0.0

  3. saved the file then typed /etc/init.d/networking restart
  4. After enabling the laptop's wireless networking hard-button, the wired network reappeared in Networkmanager's Connection Status
  5. Also followed the instructions to enable the connection to survive suspend or hibernate, and bypass the keyring password at every login

Tuesday, December 18, 2007

Setting up a Canon Pixma MP530 on Kubuntu 7.10 (Gutsy)

I started tinkering with Rails again on Vista. Boy, is Mongrel ever slow. That's what prompted me to test-drive Kubuntu in the first place. OK, let's try it again. Download the Gutsy image, repartition, reinstall... wow, it Just Works. After a minor bit of fiddling to get the sound card working, I'm up and running on Kubuntu again. Except the printing thing. Complicating the matter, the printer, a Canon Pixma MP530, is shared out from a whitebox PC running Windows XP Home.

After a bit of googling, this is what I did:

1. Following a tip on the OpenPrinting database MP530 page pointing to Brady Hunsaker's advice I downloaded the .rpm MP500 driver files from Canon's FTP site.
2. Installed alien (what a cool name, not to be confused with alien-arena) then I converted the .rpm's to .deb's and installed them.
3. Brady says create symlinks to old library names... but he doesn't explicitly say _where_, for the sake of beginners like me. After a few minutes of noobiness, I realized the symlinks should be in the same directory as the library files to which they point (`/usr/lib/`, not in the printer driver directory `/usr/share/cups/model`).
4. As a test, I plugged the printer directly into a USB port on my laptop then fired up the CUPS server on the default URL http://localhost:631/. No luck, CUPS couldn't see the printer, even after I power-cycled it.
5. I noticed one of the device options is "Windows printer via SAMBA". Hrm...
6. Followed the instructions on Debian and Windows Shared Printing mini-HOWTO to verify that my lappie can connect to the Winbox via smbclient as `smbclient -I WIN.BOX.IP.ADDRESS -L WINBOXNAME -N`.
7. Plugged the MP530 back into the Winbox, then started going through the new printer install, this time for "Windows printer via SAMBA":
1. Add new printer
2. Fill in the name, etc.
3. Device for printer: select Windows printer via SAMBA
4. URI: `smb://WINDOWS.PC.IP.ADDRESS/HOSTNAME/PRINTERNAME`
5. Browse to the PPD file in /usr/share/cups/model/canonmp500.ppd
6. When prompted, enter your Linux username and password (like sudo)
7. Configure and enjoy the printer!

I successfully test-printed a couple of pages duplexed from a PDF, then printed a couple of images to 4x6 photo paper from the cassette tray. Looks like the MP500 driver works just great! Cool!

Monday, December 17, 2007

Double-clicking to select text fails in jEdit on Kubuntu Gutsy Gibbon (7.10)

After a failed attempt to upgrade Feisty, I wiped my Kubuntu partition and reinstalled Gutsy from scratch on my Compaq Presario C506ca. All went well - I managed to get the sound working (can't recall the tweak right now), got Ruby, Rails 2.0 and jEdit installed. Then I discovered I had to double-click real fast to select words or lines of text in jEdit. A little googling around led me at last to this post Bug #55270 in xorg (Ubuntu): “Double-click timeout is not applied to X”, which explained the problem and best of all had a fix: add *multiClickTime: 400 to your .Xdefaults or .Xresources file (not sure which one applies to which environment, but .Xdefaults worked for me).

Wednesday, December 12, 2007

stupid ruby trick #1

Here's why I like dynamic languages. I have a template (function) in an XSLT application that I invoke with the number of columns in an output table. The template then returns a list of integer values separated by carets "^".

Each integer is the width of a column as a percentage of the table width. The ideal width for each column depends on the size of the column header label and text in each row, which is a bit of a subjective fiddle, so I can't really automate setting the proportion of each column, at least not without doing some advanced parsing of the table data.

Of course, all the integers for a given number of columns are supposed to add up to 100 percent, and the list should have only as many integers as there are columns in the table. For tables with 5 or 6 columns, it's pretty easy to eyeball the sum, and make sure there's the right number of values, e.g. "10^20^20^30^20". When the tables get up to 14 or 15 columns, manually adding up all those column widths to 100 for the right number of columns becomes a PITB. Time for a little scripting!

So I whipped up this little one-liner in irb to do the math for me:


C:\USAFIPD\Tools\Reports>irb
>> n = "4^10^10^10^6^6^6^5^6^6^6^5^6^5^6^3"
=> "4^10^10^10^6^6^6^5^6^6^6^5^6^5^6^3"
>> eval(n.gsub("^","+"))
=> 100
>> puts "sum: " + eval(n.gsub("^","+")) + " cols: " + n.split("^").length
TypeError: can''t convert Fixnum into String
from (irb):3:in ''+''
from (irb):3
>> puts "sum: " + eval(n.gsub("^","+")).to_s + " cols: " + n.split("^").length.to_s
sum: 100 cols: 16
=> nil
>>


I made a couple of fumbles and educated guesses, based on my experience with Javascript and Perl, e.g. that eval(n.gsub(...)) would add up the digits. Still, I didn't have to refer to the Pickaxe Book at all!

I'll stick that into a .rb file for future use, passing in the list of column widths as an arg (once I remember how to get it from ARGV [or is it ARGS?!]). Gee, maybe I could put the body in a loop that keeps prompting me if the sum is not 100, so I can keep fiddling the string until it's right... hm...

Monday, October 1, 2007

Getting the Aptana Help Server working on Windows Vista

Overcame a minor irritation - I kept getting an HTTP 500 internal server error from Aptana's built-in help documentation server after installing Aptana on my Windows Vista system. After some fiddling around with the Help Server's host name and port, I found the sweet spot by setting the host name to "localhost" and leaving the port number field blank, allowing Aptana to pick its own value.

Thursday, July 26, 2007

Windows Vista, Wacom and Logitech Woes

**<rant>**I bought a Wacom Graphire4 4x5 tablet for my daughter this week. According to her, the driver and bundled Photoshop Elements3 and Corel Painter Essentials 2 installed with no problem on our Windows XP system.

I however wasted 2 hours attempting to install the bundled apps onto Windows Vista on my laptop this evening. In the end, after googling around a bit, I made an educated guess that Vista just hates the Microsoft Installer packages wrapping the vintage 2004 Photoshop and Corel apps. Also, it appears Adobe has no intention of supporting Vista, so I won't hold my breath waiting for Wacom to upgrade the bundle...

The Vista version of the tablet driver installer freshly downloaded from the Wacom site *also* seemed to hang up partway through the install process. In the end, it appears to have installed itself, however I now have *seven* annoying popup messages to dismiss when I logon to Windows, each popup informing me that it couldn't find a driver for this or that USB device - when in fact the drivers for the Wacom tablet and the Logitech wireless keyboard/mouse are installed *just fine*.

Speaking of the Logitech stuff, I still haven't received a satisfactory answer from them about the annoying popup messages, four months after I first complained about it on their support Web site. Well, at least Logitech attempts to listen to their customers - I found no such avenue for recourse on the Wacom site. Just fire off an email to them and hope for the best.**</rant>**

Monday, July 23, 2007

Andale Mono font for Windows Command Prompt

Andale Mono is one of the nicer monospaced fonts for the command prompt (DOS box) on Windows. Unlike the default Lucida Console, Andale Mono has a dot in the middle of the zero character to distinguish it from the capital O. It also has much nicer proportions than the default Windows raster fonts.

Microsoft dropped Andale Mono as a default font choice from the Windows 2000 and XP DOS prompt configuration. However, some years back, a helpful fellow named Aaron Toponce wrote up a blog page with the gory details on restoring Andale Mono to the DOS prompt font list.

I had the foresight (luck) to bookmark Aaron's instruction page using Yahoo!'s My Web social bookmarking thingy. Aaron's domain has long since reverted to a marketing link farm, but I had the foresight (luck) again to *save a copy* of Aaron's page along with the Yahoo! My Web bookmark. For this feature alone My Web is gold.

As I settled into my latest PC at work, I used Aaron's instructions to restore Andale Mono to my command window. Here for your elucidation is my slightly edited version of Aaron's instructions:

> The Windows command prompt supports monospace TrueType and OpenType fonts. By default, only Lucida Console and Raster Fonts are installed. You can add more monospace fonts using a simple registry hack:

> 1. Navigate to HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/Current Version/Console/TrueTypeFont. As you will notice, the existing Lucida Console is named '0'.
> 2. Add a new string named '00' (I believe only '0' can be used, although I haven't tried anything else),
> 3. Modify the data to be the font name.
> 4. Add as many TrueType and OpenType monospace fonts as you like, just keep adding zeros to the string name.
> 5. Open a DOS Prompt, right-click the title bar then select Properties from the context menu.
> 6. Select the Font tab. Andale Mono should appear in the list of fonts. Select it, then set the size (I like 14).