Tuesday, February 27, 2007

Hi, Rocky Mountains!

I'm off to Kansas to see the family and then to Denver for the American Physical Society March Meeting. I'll try to post something next week.

Sunday, February 25, 2007

Did Bono Approve This?

So the other day I went over to Staples and bought a 2GB SanDisk Cruzer Micro USB Flash Drive, for the pretty low price of $24.98 (including rebate, which Staples makes ridiculously easy). Really nice price, considering I once bought a 256 MB drive for $60.

I have no complaints with the drive. I deleted the junk software that SanDisk put on the drive, and it works just fine under Linux, and on the Mac. I love it. It fits on my keychain, has a retractable USB plug, and looks cute. It'll carry around just about anything I want.

On the Mac, though, two partitions show up. The first is just the partition I see in Linux. The second, however, is labeled U3 and contains the software I deleted off the main partition: the windows only U3 Launchpad and application software. In a partition that Linux doesn't see and Mac OS X won't touch.

Plug this into a Windows XP box and it autolaunches. OK, you can remove the software, but only under windows, and only if Launchpad is running. I'm scared to death to stick it into our one and only XP box to see if I can do it. Apparently one can reformat the drive under Linux, but if I screw it up, I've got a $25 bit of plastic and silicon that's not heavy enough to make a good paperweight.

So what's the problem? Leave it alone, right? But big pendrives are great for Sneakernet applications. Suppose I want to carry a big file to a friend's Windows box? Up pops Launchpad, which should at least freak him out, if it doesn't cause any other problems. I know U3 vets all the software it allows on the drive, but it's still running programs on a friend's computer that he didn't give me permission to run. And then there is our own XP box, Hal's evil twin, which has the nice printer attached to it. I'd really like to Sneaker my files onto it, but not with this drive as long as it has U3 on it.

So I ask my small community of readers: Anyone successfully reformat a 2GB Cruzer, removed the U3 stuff, and still have a drive that can be read under Linux, OS X, and Windows? Leave details in the comments.

Monday, February 19, 2007

Almost One Line Archiving

This is one of those “well, if I don't write it down, I'll forget it,” posts, but someone else may find it helpful as well.

I recently did a bunch of updates on my favorite website. I keep a duplicate copy of the site where I can work on it without making a big mess of the active site. All of the files are in a directory we'll call $HOME/website. So I'm going to modify the files in my local copy of $HOME/website, check to make sure I haven't frakked anything, and then upload everything to the hosting computer, pause, take a deep breath and pray I really haven't frakked anything, and update the real website.

So what I want to create is a tarball consisting of all the files I've changed in $HOME/website since the last time I did an update. This is an almost one-liner. I say that because you need to do one step before you make any changes at all:

$ touch $HOME/newupdates

This creates a zero-length file. The important thing is that it will be older than any of the files you are about to change, and younger than any of the files that remain unchanged. If you have another file like this around, then you don't need this step.

Now make all the changes you want, making sure you have valid spelling, HTML, physics, tax advice, etc.

Now do the archive:

cd $HOME ; tar cvzf updates.tar.gz \
`find $HOME/website -type f -newer newupdates \
| xargs`; touch newupdates

(That's really all one line, of course, though you should be able to enter it as is with the backslashes.)

This uses the find command to list all regular (-type f) files in the directory $HOME/website which are newer than newupdates, then uses xargs to put them into a single string, and creates a gzipped tarball file named updates.tar.gz. Then it again touches the newupdates file, so that the next time you do this you won't pick up the files you've already archived.

Then copy updates.tar.gz wherever you want it.

Tuesday, February 13, 2007

X-ing out Tabs

In Firefox/Swiftfox 2.0, by default the active tab has a big red "X" beside it. Click on the X and the tab disappears. The disadvantage of this is that one can't delete a tab without making it active. A more desirable behavior would be to have an X in each tab, so you can delete the tab without opening it.

This hack is not mine, so I'll reference Geek to Live, where I found it. What you do is:

  1. In the address bar of the browser enter about:config
  2. In the Filter box that appears, enter the string browser.tabs.closeButtons
  3. Right-click the string that appears, and select Modify
  4. Change the number to "1" if you want an X in each tab, or to "3" if you want the Firefox 1.5 default behavior (one X, all the way to the right on the tab bar). Experimenting, "0" is the default 2.0 behavior, and "2" is no Xs at all.

The change should take effect as soon as you hit enter.

Saturday, February 10, 2007

The Perils of Packratitis

Well, the day started out promising. I'd slept well, read the paper, had breakfast, and headed downstairs with a cup of coffee to read my email.

Turn on the computer, and I'm greeted with a text screen including the words

Uncompressing Linux ...  OK, booting the kernel
[17179570.784000] Kernel panic - not syncing:  VFS : Unable to mount rootfs on unknown-block (0,0)
[17179570.784000]

and other such unpleasantness.

I remembered that a kernel upgrade had pushed through last night, so I suspected that was the trouble. After all, it was a kernel upgrade of Fedora that without sound for nearly a week a couple of years ago.

The new kernel is 2.6.15-28. (2.6.15 is the actual kernel version, the 28 is the latest Ubuntu fix.) So I shut off the box, turned it on again, and hit the ESC key when the option was offered. This brings up the GRUB menu, from which I selected the 2.6.15-27 kernel. Booting continued normally.

But what went wrong? How do I fix it? Well, after searching many forums, it appears that kernel panics happen for a lot more reasons than you'd expect, and have different causes. Mine? Well, after much searching, I was prompted to look at the GRUB menu, which is controlled by the file /boot/grub/menu.lst (that's an "ell", not a "one"). In there, I found these lines:

## ## End Default Options ##

title           Ubuntu, kernel 2.6.15-28-686
root            (hd0,0)
kernel          /vmlinuz-2.6.15-28-686 root=/dev/hda2 ro quiet splash
savedefault
boot

title           Ubuntu, kernel 2.6.15-28-686 (recovery mode)
root            (hd0,0)
kernel          /vmlinuz-2.6.15-28-686 root=/dev/hda2 ro single
boot

title           Ubuntu, kernel 2.6.15-27-686 (recovery mode)
root            (hd0,0)
kernel          /vmlinuz-2.6.15-27-686 root=/dev/hda2 ro single
initrd          /initrd.img-2.6.15-27-686
boot

title           Ubuntu, kernel 2.6.15-27-386
root            (hd0,0)
kernel          /vmlinuz-2.6.15-27-386 root=/dev/hda2 ro quiet splash
initrd          /initrd.img-2.6.15-27-386
savedefault
boot

See what's missing? The 15-28 kernel entries don't have the "initrd" lines. Simple enough, huh? This kernel update had problems. Maybe this manifested itself here by not updating the menu.lst file properly. Easy enough to fix, right? Just edit (as root) the menu.lst file, adding the line

initrd          /initrd.img-2.6.15-28-686

in the appropriate place.

Wrong. I got an edit error, suggesting that the file system was full. Oops.

The /boot sector is a separate partition. So see how full it really is:

$ df /boot
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda1                97826     97862         0 100% /boot

Oh boy. What's going on?

Well, I suffer from packratitis — the inability to throw out something that might be useful. Turns out that I had several copies of the old kernel. Well, more then several. It looks like I had a copy of every kernel since I first started with Ubuntu. Both i686 and i386 versions — though the later are completely unnecessary.

Go back to the old kernel, reboot, then go into synaptic and delete a few old kernel modules. The relevant packages are linux-image-version_number and linux-restricted-modules-version_number, where "version_number is something like 2.6.15... This freed up enough space so I could successfully edit the menu.lst file.

This time, when I booted, I got the message that the 2.6.15-28 compressed kernel was corrupted — obviously the install hadn't completed. So I went back to synaptic, reinstalled linux-image-2.16.15-28-686 and linux-restricted-modules-2.16.15-28-686, and, once again, rebooted.

Success. Finally.

Lessons learned?

  • You don't need every version of the kernel that comes down the pike. The upgrade process leaves the old kernel lying around for good and sufficient reason, as we have seen, but if a kernel is working well you can delete most of the older ones.
  • I don't think we need any of the 386 kernels. A Celeron chip is equivalent to at least a Pentium 4, so the 686 kernel should be sufficient.
  • Every once in a while, you need to check all your partitions to see how full they are getting.
  • Don't blame the upgrade process — at least until you've checked out the possibility that you've fraked yourself.
  • You know, it's kind of fun working on a broken computer — just like the old days when we booted "alternative" OSes on an Apple //e.
  • During my (as opposed to the kernel's) panic, I downloaded Slackware (still reading, Pete?). I tried installing it on my alternative Linux box. I failed, but I think I know why. It's certainly a more hands-on distribution. I will get it installed on the alternative Linux box, and at some time in the future I may change over entirely.

So fun's over, and we're back to running regular, updated Ubuntu Dapper. Stay tuned for more adventures in Linux debugging.

Sun's ODF Plug-In for Office

Linux Insider reports that Sun will provide an ODF plug-in for Microsoft Office 2003. Which means that I'll be able to send my OpenOffice.org files in their native format to those poor souls stuck with MS-Office. When they say "I can't read this," I reply, "sure you can. Here's the plug-in."

And then I say, "you know, the sofware I use isn't just free as in freedom. It's free as in beer, too.

Friday, February 09, 2007

Vista Marketing

Here's a good one: the Washington Post's tech writer Rob Pegoraro recently got Gateway to loan him a Vista-loaded laptop for review. Guess what? Vista claimed it was an illegitimate copy!. Wonderful. So either one of Microsoft's biggest suppliers is shipping pirated copies of Vista (extremely doubtful), or Vista's piracy-protection mechanism is fraked. Which makes me wonder what would happen if I bought one of those fancy new boxes Best Buy and Office Depot keep pushing at me in the Sunday supplement. I mean, if Microsoft can't make sure that reviewers get a legit copy of Vista, what about ordinary users?

Oh, wait. The next computer I buy might come with Windows, but after I tear it out by its DOS roots and install Linux I won't have any problem with piracy-protection software.

Never mind.

Tuesday, February 06, 2007

Plus, If He Wins, Catherine Zeta-Jones Will Be First Lady

From The Onion:

Mysterious Congressman Announces Dark Horse Candidacy

New Presidential Candidate

Sunday, February 04, 2007

Super Bowl XLI

Just a few random thoughts on the game:

  • Chicago did a pretty good job with its "If Rex Grossman is off the field he can't hurt us offense," but they lost sight of it in the fourth quarter, leading to defeat.
  • While I'm happy Tony Dungy and Payton Manning won, phrases like "second Super Bowl win in Colts' franchise history" stick in my craw. It's the first win for Indianapolis, OK? The phrase "in the middle of the night" still only means one thing in Maryland.
  • So much for playing the game in nice-weather venues. New York (well, Jersey) or DC (I mean Landover) would have been a lot better this week. It was football weather — cold.
  • I was going to give best commercial award to K-Fed, because nothing else caught my attention — I don't remember what he was advertising, either. But the two minute warning NFL in-house with Brett Favre was better, and the only memorable one in the lot.
  • Next Super Bowl? Ravens and Redskins. (If you believe that, boy, have I got some penny stocks to sell you.)

This Is Why Linus Is Way Cooler Than Bill Or Steve

Linux Kernel 2.6.20 Release Announcement

Thanks to LWN

gnuplot 4.2

gnuplot is one of those programs I can't live without. It's fair to say that 70% of the graphics I've published in my work were created with gnuplot, and the only reason that figure isn't higher is that I wrote a lot of papers before I found out about gnuplot.

The version supplied with Dapper is 4.0, but I found from an email that 4.2.rc4 was recently released. Going to the project home page I found that this release included support for animated GIFs, something that I was trying to create more or less by hand for an upcoming talk. Now expecting the new version to be available in Dapper is a bit much, so I went to SourceForge and downloaded the tarball. (Click on "Download gnuplot development," then on "4.2.rc4." It's not obvious.)

After a bit of tweaking, I found that I had to fire up synaptic and install the libreadline5-dev and libgd2-dev packages. These let me compile in readline support, so I can do things like tab-complete file names, and support for gif and png files, for the aforesaid animated gifs.

From there it's straightforward, using the checkinstall to create the .deb file:

$ untar gnuplot-4.2.rc4.tar.gz
$ cd gnuplot-4.2.rc4
$ ./configure --with-readline=gnu --enable-history-file
$ make
$ sudo checkinstall -D make install-strip

This makes, and installs,

gnuplot-4.2.rc4_4.2.rc4-1_i386.deb

which works. Once I get the paper cleared and presented, I'll see about putting up one of the animated gifs as an example.

Friday, February 02, 2007

Deleting the Double Green Line

Many blogs and web sites have been displaying ads in what I find is an annoying fashion. Selected words are underlined twice in green. When you run your mouse over them, an annoying popup appears, advertising something. Here's a random example.

(My favorite was a blog which had a phrase something like "overall this method works well," where overall was underlined and offered to sell me blue jeans with bibs.)

There outta be ways to block these things, and there are in fact many. These popups all have the name IntelliTXT on them, someplace. They are so ubiquitous that Firefox 2.0's Google search offers 11 different versions of the string "IntelliTXT *", most of which have to do with blocking, removing, or disabling the things.

As it turns out, Wikipedia has a good "stub" article, which includes blocking information. In my case, the easiest way to block everything is to use the Adblock extension for Firefox. Just add the string "*Intellitxt*" to Adblock's filter, reload the offending page, and the double green lines are gone.

Wikipedia: It's not just for truthiness.