Wednesday, June 18, 2008

Smart Search

By far the most useful plugin I've added to Firefox in the past half-year or so:

https://addons.mozilla.org/en-US/firefox/addon/188

SmartSearch adds a context menu item that allows you to send selected text (or whatever word you right-clicked on) to any one of the links in the Bookmarks 'Quick Searches' folder (Bookmarks->Organize Bookmarks->Bookmarks Menu->Quick Searches). I had to create this folder myself, because at some point I short-sightedly deleted it as being useless.

The SmartSearch page on quicksearches has a number of handy links such as a dictionary, thesaurus, IMDB, amazon, netcraft, whois, wayback archive, and google maps. I added a few more for google images and some source code pages:

Google Images Quicksearch
Google Code Quicksearch
Koders Quicksearch
Krugle Code Quicksearch (requires JS)
Codease SmartQuery
Codease FullText Query

Obviously many more can come in handy, and the code search engines can be trimmed down to just one or two (probably Koders and Codease).

The good news is that new Quicksearches are simple to create: navigate to the search page, right-click on the search form, select 'Add a keyword for this search', invent some useful keyword, and use the Quick Searches folder for the 'Create in' location.

Tuesday, May 27, 2008

Nightly Tester Tools

Got sick of the Intel driver crashing X11, and Ubuntu releasing their upgraded packages only on the recent version (Horny Heron or something). Bit the bullet, did the upgrade, and...

...Firefox 3beta got installed! What the hell?!? Poof go all (well, most) of my extensions, you know those handy things I use for, oh, locking down Firefox, anonymous browsing, other small conveniences that make using such a poorly-performing browser worthwhile.

Included in these was Zotero, in which I have quite a number of documents stored for offline viewing, and which *still* has no independent UI for accessing them (even the Open Office plugin requires a running instance of Firefox). Suckfest à la mode, just what I ordered!

A search of the Zotero forums, though, turns up a link to the Nightly Tester Tools plugin, which can be used to run an extension for a previous version of Firefox. Zotero is now up and running on Firefox 3beta.

Version 3 does seem to be a bit faster than 2, and hasn't been too crashy. The theme/extension writers should really get their act together and update/port their stuff before this puppy hits the street.

Wednesday, May 7, 2008

Pulseaudio, Firefox, Flash 9

Upgrading to the latest flash plugin (9) kills audio in Firefox. Awesome!

Based on the PulseAudio information on http://www.pulseaudio.org/wiki/PerfectSetup
and the library provided by revolutionlinux, it took only a couple of steps to get things working:

cd /usr/src
git-clone http://git.0pointer.de/repos/libflashsupport.git
cd libflashsupport
sudo ./bootstrap.sh
sudo ./configure --prefix=/usr
sudo make
sudo make install

Then restart firefox.

It probably helps to have /etc/firefox/firefoxrc contain the line

FIREFOX_DSP="padsp"

...and to have /etc/asound.conf contain the lines

pcm.!default {
type pulse
}

ctl.!default {
type pulse
}

pcm.pulse {
type pulse
}

ctl.pulse {
type pulse
}


...but libflashsupport is the magic bit.

Monday, May 5, 2008

VimMate

Yet another Textmate-style extension to Vim:

http://vimmate.rubyforge.org/

This one integrates a project manager with Vim. Jury is still out on whether it will prove useful, but coupled with the Vim Debugger plugin it could prove quite useful for the dynamic languages.

Git as a backup tool

Recently migrated from CVS to GIT at work, and started to look at other uses of local GIT repositories. Backing up config files in home directories seemed a natural application, and as usual someone else has thought of it, implemented it, and abandoned it:

git-home-history

Getting this built is pretty straightforward:
cd /usr/src
git clone http://jean-francois.richard.name/ghh.git
cd ghh
./autogen.sh
make
make install
cd ~
git-home-history init
vi .gitignore
git commit -a
crontab -e
* */4 * * * /usr/local/bin/git-home-history commit >/dev/null 2>&1


The last line is what should be added to crontab to run this every 4 hours.

There are similar projects for /etc and for general backup:
etckeeper
gibak

Other useful GITisms:
* install tgit
* install qgit
* get vim syntax and filetype plugins from vim-mode-for-git-commits; also check out the GitDiff plugin
* add the following to ~/.bashrc or equivalent:
GIT_PAGER=`which tig`
export GIT_PAGER
* add the following to ~/.vimrc or equivalent:
let git_diff_spawn_mode=1
autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=git

Wednesday, April 23, 2008

e17 profile backup script


Given that E17 uses binary config files, and these may get hosed without warning, it is useful to back them up after making changes.

The following shell script will do just that, via tar:

#!/bin/sh

[ -d ~/.e/backup ] || mkdir -p ~/.e/backup

tar -zcf ~/.e/backup/e17-config-$(date +%F-%T).tgz ~/.e/e


Also worth noting is an improved way of using the E17 profile switching for extending battery life: put a shell script for switching to the battery profile in /etc/acpi/battery.d, and one for switching to the A/C profile in /etc/acpi/ac.d . Note that this occasionally causes E17 to crash (and take X with it), so be conservative.

Current configuration:
  • Smoke theme, Darkness startup, Slick icons
  • 10 1x1 virtual desktops
  • XRENDER engine with Composite disabled
  • 3 profiles (AC, battery, and default)
  • Run command: uxterm -bg black -fg orange -fa 'xft:Courier New' -fs 11 -hold -e
  • Shelf (invisible, below windows, shrink:48, all desktops) on upper right-top (Contents: cpufreq, mixer, winselector, battery, deskshow, tclock, temperature, exalt)
  • Shelf (invisible, below windows, shrink:60, all desktops) on lower left-left (Contents: Pager)
  • Shelf (default, below everything, shrink:40, all desktops, auto-hide) on upper left-top (Contents: Start, IBar, Taskbar)
  • Shelf (invisible, above everything, shrink:40, all desktops, auto-hide) on lower right-bottom (C0ntents: IBox)
  • Shelf( default, above everything, shrink:48, desktop 0:0, auto-hide) on lower-right-right (Contents: News, Forecasts)

I should note that Forecasts doesn't seem to work at all. I also disabled the screen savers, lock, and power management as they are all a bit crashy.

The screenshot isn't much to look at.

Friday, April 18, 2008

Powertop && Latencytop

Now that most everything is working (sans the crappy TI SD reader) on a good solid kernel, it's time to break stuff by adding powertop and latencytop. Laptop users should play with powertop a bit to find out how to lower their power consumption; latencytop can be useful in debugging lagged or unresponsive applications.

sudo apt-get install powertop

http://www.latencytop.org/

The latencytop patch applies cleanly to 2.6.24.2, and requires CONFIG_SCHEDSTATS be set. Powertop requires CONFIG_TIMER_STATS and suggests many more adjustments while it is running ( though apparently the usbcore.autosuspend advice is deprecated).

On an unrelated topic, now that inttab is gone the settings for terminals (you know, respawn getty and all that) is in tty-specific files in /etc/event.d . Why? Who knows! Maybe they're trying to reduce the AT&Tness of their *nix.

Thursday, April 17, 2008

Hibernation

Spent the extra hour and got hibernation working last night; here are some basic notes on the experience.

The only truly working suspend-to-disk implementation is Suspend2 AKA Tux-On-Ice (TOI), available as a kernel path from http://www.tuxonice.net/downloads .

Download and path the kernel as follows:

cd /usr/src/linux-2.6.24-2
patch -p1 < /tmp/tuxonice-3.0-rc5-for-2.6.24.patch


Make config/menuconfig/xconfig and ensure the following options are set:

CONFIG_TOI_CORE=y

# Image Storage (you need at least one allocator)
CONFIG_TOI_FILE=y
CONFIG_TOI_SWAP=y
CONFIG_TOI_DEFAULT_PRE_HIBERNATE=""
CONFIG_TOI_DEFAULT_POST_HIBERNATE=""
CONFIG_TOI_CRYPTO=y
CONFIG_TOI_USERUI=y
CONFIG_TOI_USERUI_DEFAULT_PATH="/usr/lib/suspend2-userui/suspend2ui_fbsplash"
# CONFIG_TOI_KEEP_IMAGE is not set
CONFIG_TOI_REPLACE_SWSUSP=y
# CONFIG_TOI_CLUSTER is not set
CONFIG_TOI_CHECKSUM=y
CONFIG_TOI_DEFAULT_WAIT=25
CONFIG_TOI_DEFAULT_WAIT=25
# CONFIG_TOI_PAGEFLAGS_TEST is not set
CONFIG_TOI=y
...
CONFIG_CRYPTO_LZF=y


Rebuild/reinstall the kernel. If you use an initrd or initramfs, a new one must be made according to the instructions at:
http://wiki.tuxonice.net/DistroAndHardwareSetup/Ubuntu_Gutsy_Gibbon

Note that the initramfs files may exist both in /etc/initramfs-tools and /usr/share/initrafms-tools ; in this case, create the file suspend2_do_resume in /etc/initramfs-tools . I had to fill my /etc/initramfs-tools tree with files from the /usr/share/initramfs-tools tree; it now looks like this:

/etc/initramfs-tools/update-initramfs.conf
/etc/initramfs-tools/hook-functions
/etc/initramfs-tools/init
/etc/initramfs-tools/hooks/console_tools
/etc/initramfs-tools/hooks/console_setup
/etc/initramfs-tools/hooks/usplash
/etc/initramfs-tools/hooks/thermal
/etc/initramfs-tools/hooks/kernelextras
/etc/initramfs-tools/hooks/uswsusp
/etc/initramfs-tools/hooks/udev
/etc/initramfs-tools/initramfs.conf
/etc/initramfs-tools/scripts/init-premount/udev
/etc/initramfs-tools/scripts/local-premount/suspend2_do_resume
/etc/initramfs-tools/scripts/local-premount/uswsusp
/etc/initramfs-tools/scripts/nfs
/etc/initramfs-tools/scripts/functions
/etc/initramfs-tools/scripts/nfs-top/udev
/etc/initramfs-tools/scripts/local
/etc/initramfs-tools/scripts/init-top/console_setup
/etc/initramfs-tools/scripts/init-top/framebuffer
/etc/initramfs-tools/scripts/init-top/usplash
/etc/initramfs-tools/scripts/init-top/all_generic_ide
/etc/initramfs-tools/scripts/init-bottom/udev
/etc/initramfs-tools/conf.d/resume
/etc/initramfs-tools/modules

The initramfs is rebuilt with the command
update-initramfs -u -k `uname -r`

The following config settings work fine:

/etc/hibernate/suspend2.conf
UseSuspend2 yes
Reboot no
EnableEscape yes
DefaultConsoleLevel 1
Compressor lzf
Encryptor none
SuspendDevice swap:/dev/sda2
FullSpeedCPU yes


/etc/hibernate/common.conf :
Verbosity 1
LogFile /var/log/hibernate.log
LogVerbosity 4
LogTimestamp yes
HibernateVT 15
Distribution debian # (or fedora/gentoo/mandrake/redhat/slackware/suse)
XDisplay :0
SaveClock restore-only
ChangeGrubMenu yes
GrubMenuFile /boot/grub/menu.lst
AlternateGrubMenuFile /boot/grub/menu-suspended.lst
BackupGrubMenuFile /boot/grub/menu.lst.hibernate.bak
UnloadBlacklistedModules yes
LoadModules auto
SwitchToTextMode yes

Note that /boot/grub/menu.lst must be copied to menu-suspended.lst, which will be the boot menu displayed when the system is hibernating. Add the line "resume=swap:/dev/sda2" (or whatever your swap partition is) to the default kernel boot option, and add a kernel boot option with the No Resume (param is "noresume") option set for easy recovery in case of failure.

The command "hibernate -v3" should now susend the system to disk.

Apropos of nothing: Ubuntu has the default language set to require UTF-8 (e.g. en_US.UTF-8), which really screws up compiler output, man pages, and so forth (in particular, single and double quotes appear as f’s) in non-Unicode terminals (e.g. Aterm, Eterm). One could switch to a unicode terminal, e.g.
rxvt-unicode -bg black -fg orange -fade 25 -fn 'xft:Courier 10 Pitch-12'
...but setting the language to C in ~/.bashrc (export LANG=C) lets you keep using your favorite terminal.

Wednesday, April 16, 2008

toshiba_acpi, toshset, and transreflectivity

The new version of toshset (1.73, available at http://www.schwieters.org/toshset ) supports the r500 transreflective screen via the option

toshset -trmode

Usage is simple: to turn the backlight off and use the display in direct sunlight, type

toshset -trmode off

To turn the backlight back on, type

toshset -trmode on

Note that you can still use the display in direct sunlight without turning the backlight off (this works fantastically, btw). The trmode option simple saves you (much) power.

There are some caveats to getting this to work, however:

1. The toshiba kernel module must not be loaded, so remove it from /etc/modules .
2. The character device 181 must be associated with toshiba_acpi kernel module, not the toshiba kernel module. This change can be made in /etc/modprobe.d/aliases .
3. The patch toshiba_acpi-dev_toshiba_test5-linux_2.6.21.patch must be applied. This works fine with the 2.6.24 kernel :
cd /usr/src/linux-2.6.24-2
cd drivers/acpi
patch -p0 < /tmp/toshiba_acpi-dev_toshiba_test5-linux_2.6.21.patch
cd ../..
make modules
make modules_install

4. If the file /etc/modprobe.d/toshiba_acpi.modprobe exists, open it and comment out the line
options toshiba_acpi hotkeys_over_acpi=1

The fingerprint reader supposedly works with libfprint (no Ubuntu package, not bothering).
The SD card reader still cannot read cards (mmc0: error -110 whilst initialising SD card).
Hibernation (aka suspend-to-disk) still doesn't resume, probably because of Ubuntu's swap-device-UUID-changing problem.

One more fun fact: change the Xorg driver from 'i810' to 'intel' :
Driver "intel"
Helps keep X from hanging due to an illegal instruction. Isn't running Linux fun?

Friday, March 21, 2008

xdg-open and general freedesktop annoyance

Using the E17 RSS reader has recently acquainted me with xdg-open from freedesktop.org, or as it is more affectionately known, "the utility that causes all URLs to be opened in the most sucky browser installed, e.g. konqeror or nautilus".

Fortunately, you can add the lines

BROWSER=`which firefox`
export BROWSER

into ~/.profile, or into ~/.bashrc and do the old bash-profile-symlink-hack:

ln -s ~/.bashrc ~/.bash_profile

...and a reasonably well-written XSession file (e.g. the one that ships with *buntu)
will find it.

But come on, an ENVIRONMENT VARIABLE? For a helper program called by X applications?
You have to restart X if you want to change it!

What is so horrible about an optional freedesktop config file, say in ~/.local/etc/defaults/browser, that lets you change this at runtime?

Or, if having to read a file every time a link is checked is the problem (I can see that), why not have a freedesktop config service that caches settings and can be flushed by the user?

There is an upside to all of this: having spent the past evening restarting either E17 or X to tweak parts of the system, I am coming to like the idea of using XSM to restore all of my terminal, IDE, and browser sessions. If it plays well with E17's virtual desktops.

Systrayless Wifi

Didn't come across this last time I was playing with E17: exalt network manager.

Install:

sudo apt-get install exalt exalt-daemon emodule-exalt libexalt-dbus-dev libexalt-dev


This solves the "have to run knetworkmanager in an alternate WM' problem, as
exalt runs as a standalone app (and has an E17 widget).

Caveats: Hold the shift key (not Caps Lock!) down when entering your WEP key, and be sure to changed the mode from Ad-Hoc to Managed.

For those who are suffering with unmaintained E17 packages, use the Gos servers:

deb http://packages.thinkgos.com/gos/ reloaded main
deb-src http://packages.thinkgos.com/gos/ reloaded main

Tuesday, March 18, 2008

2.6.22 kernel and 'alps_process_byte'

On the R500 (and other laptops, apparently) kernel 2.6.22 (and a few before, and a few after) panic on resume with an oops like the following:

[113189.828000] EIP: [] alps_process_byte+0x18/0x60 [psmouse] SS:ESP 0
068:d6d27ee8
[113189.828000] <0>Kernel panic - not syncing: Fatal exception in interrupt
[113189.828000]

Recompiling without extra alps support does not help.

Adding the module 'psmouse' into the MODULES variable in /etc/default/acpi-support seems to work -- no crashes so far. (Update 3/21: still no crashes! We have a winner)

Wednesday, February 20, 2008

KNetworkManager suckage

Part of this past weekend's wifi debugging process.

Selecting 'manual configuration' in ketwork manager will cause the
wireless card to be ONLY configured manually: a list of available
wireless networks will no longer appear in knetworkmanager.

The fix is to remove all entries for the wireless card in /etc/network/interfaces .


In better news, the 2.6.24 kernel has the Intel wireless drivers for the r500 built-in.